/*
Theme Name: Isbatp
Theme URI: 
Author: Teamtreize
Description: Thème sur mesure du site de l'Isbatp (Full Site Editing) : formations, filières, actualités et parcours de candidature. Conçu et développé par Teamtreize.
Requires at least: 6.5
Tested up to: 6.5
Requires PHP: 8.0
*/

:root {
    color-scheme: light dark;
}

html {
    scroll-padding-top: 300px;
}

/* Défilement doux, sauf pour les visiteurs qui ont demandé à réduire les animations */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Masquer à partir d'un breakpoint et en dessous (cumulatif) :
   hide-on-tablet masque aussi sur mobile. */
@media (width <= 768px) {
    .hide-on-mobile { display: none !important; }
}

@media (width <= 1024px) {
    .hide-on-tablet { display: none !important; }
}

@media (width > 768px) {
    .hide-from-mobile {
        display: none !important;
    }
}

@media (width > 1024px) {
    .hide-from-tablet {
        display: none !important;
    }
}

/* Enfant de flex qui garde la largeur de son contenu au lieu de rétrécir
   (ex. rangée picto + nombre d'heures des cartes semestre). Le réglage natif
   « Fixe sans rétrécissement » impose une largeur figée : à éviter quand le
   texte varie. */
.no-shrink {
    flex-shrink: 0;
}


*  {
    box-sizing: border-box;
}

/* Retirer le margin-top du footer */
footer.wp-block-template-part {
    margin-block-start: 0 !important;
}

/* Retirer le margin-block-start du main */
main.wp-block-group,
main.wp-block-post-content {
    margin-block-start: 0 !important;
}

.wp-block-template-part:has(>.is-position-sticky) {
	--wp-admin--admin-bar--position-offset: var( --wp-admin--admin-bar--height, 0px );
	position: sticky;
	top: calc( 0px + var( --wp-admin--admin-bar--position-offset, 0px ) );
	z-index: 10;
}


header {
    position: fixed;
}

/* Fiches formation : le header défile avec la page (relative au lieu de
   sticky) et cède le haut d'écran à la barre d'ancres (pattern « Liens ancres
   et CTA »), collée au scroll. Barre repérée par le bloc
   teamtreize/liens-ancres qu'elle contient : rien à ajouter dans le contenu
   des fiches. z-index sous celui du header (10) : ses sous-menus restent
   par-dessus tant qu'il est visible. */
body.single-formations .wp-block-template-part:has(> .is-position-sticky) {
    position: relative;
}

body.single-formations .wp-block-post-content > .wp-block-group:has(> .wp-block-group > .wp-block-teamtreize-liens-ancres) {
    position: sticky;
    top: var(--wp-admin--admin-bar--height, 0px);
    z-index: 9;
}

/* Jusqu'à 1024px, Brochure / Candidater sont déjà dans la CTA fixée en bas
   d'écran (parts/cta-mobile-formation.html) : retirés de la barre, qui tient
   alors sur une ligne. Au-dessous de 768px, hide-on-mobile les masque déjà. */
@media (width <= 1024px) {
    body.single-formations .wp-block-post-content > .wp-block-group > .wp-block-group:has(> .wp-block-teamtreize-liens-ancres) > .wp-block-buttons {
        display: none;
    }
}

/* Barre d'admin WP non fixée sous 600px : rien à déduire */
@media (width <= 600px) {
    body.single-formations .wp-block-post-content > .wp-block-group:has(> .wp-block-group > .wp-block-teamtreize-liens-ancres) {
        top: 0;
    }
}

/* Ancres : arrêt sous la barre collée (154px desktop, ~125px sous 1024px) au
   lieu des 300px prévus pour le header sticky */
html:has(> body.single-formations) {
    scroll-padding-top: 200px;
}

@media (width <= 1024px) {
    html:has(> body.single-formations) {
        scroll-padding-top: 160px;
    }
}


.is-above {
    position: relative;
    z-index: 7;
}

.overflow-hidden {
    overflow: hidden;
}

.h-full {
    height:100%;
}

.has-gutter {
    padding-left: var(--wp--custom--spacing--gutter) !important;
}

a:where(:not(.wp-element-button)) {
    text-decoration: none;
    font-weight: 700;
    color: var(--wp--preset--color--black);
    transition: color 0.3s ease-in-out;

    &:hover, &:focus {
        color: var(--wp--preset--color--primary);
    }
}



@media (max-width: 768px) {
    .no-padding-on-mobile {
        &.top {
            padding-top: 0 !important;
        }
        &.bottom {
            padding-bottom: 0 !important;
        }
        &.left {
            padding-left: 0 !important;
        }
        &.right {
            padding-right: 0 !important;
        }
   
    }

    .align-center-on-mobile {
        * {
            text-align: center !important;
        }
    }
}