/* ==========================================================================
   PROJET MAKE — LAYOUT GÉNÉRAL
   --------------------------------------------------------------------------
   RÔLE :
   - Définir les tokens visuels communs (variables CSS) utilisés par le layout.
   - Styliser la structure globale : body, shell, main.
   - Styliser le header (desktop + mobile) et le footer du site.
   - Fournir une base stable commune à toutes les pages publiques.

   IMPORTANT :
   - Chargé globalement depuis app/Views/layouts/header.php.
   - Fonctionne avec :
       - app/Views/layouts/header.php
       - app/Views/layouts/footer.php
       - assets/js/ui.js (comportements header/footer)
       - assets/js/app.js (initialisation générale)
   - Ne doit PAS contenir de styles spécifiques à une page :
       - pas de .mk-* (home),
       - pas de .catalogue-*,
       - pas de .detail-*.
   - Les styles de page vivront dans des fichiers séparés
     (home.css, catalogue.css, product.css, etc.).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TOKENS GLOBAUX DU LAYOUT
   -------------------------------------------------------------------------- */

:root {
    /* Surfaces & texte */
    --site-bg: #070b08;
    --site-surface: rgba(10, 15, 11, 0.86);
    --site-surface-strong: rgba(10, 15, 11, 0.94);
    --site-text: #f4efe7;
    --site-text-soft: rgba(244, 239, 231, 0.76);
    --site-text-faint: rgba(244, 239, 231, 0.50);
    --site-accent: #d4f54a;
    --site-line: rgba(212, 245, 74, 0.12);
    --site-line-strong: rgba(212, 245, 74, 0.22);

    /* Mise en page */
    --site-shell: min(1280px, calc(100% - 48px));
    --site-header-h: 72px;

    /* Rayons et ombres */
    --site-radius-sm: 14px;
    --site-radius-md: 20px;
    --site-radius-pill: 999px;
    --site-shadow-sm: 0 12px 30px rgba(0, 0, 0, 0.20);
    --site-shadow-md: 0 22px 60px rgba(0, 0, 0, 0.32);

    /* Transitions */
    --site-transition-fast: 0.18s ease;
    --site-transition-base: 0.24s ease;
}

/* --------------------------------------------------------------------------
   2. RESET LÉGER & STRUCTURE GÉNÉRALE
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--site-bg);
    color: var(--site-text);
}

html {
    scroll-behavior: smooth;
}

body.site-body {
    font-family: "Satoshi", "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
    /* Fond avec léger dégradé + halo vert */
    background:
        radial-gradient(circle at top right, rgba(212, 245, 74, 0.10), transparent 24%),
        linear-gradient(180deg, #040705 0%, #070b08 100%);
    color: var(--site-text);
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

ul,
ol {
    margin: 0;
    padding: 0;
}

/* Contenu principal — hauteur mini = écran - header fixe */
.site-main {
    display: block;
    width: 100%;
    min-height: calc(100vh - var(--site-header-h));
}

/* Décalage du main sous header fixe :
   - par défaut pour toutes les pages publiques
   - la home garde aussi ce padding */
.site-body:not(.site-body--admin):not(.site-body--login) .site-main {
    padding-top: var(--site-header-h);
}

/* Conteneur central pour limiter la largeur du contenu */
.mk-shell,
.site-shell {
    width: var(--site-shell);
    max-width: none;
    margin-inline: auto;
}

/* Lien “skip” accessibilité */
.site-skip-link {
    position: absolute;
    left: 16px;
    top: -56px;
    z-index: 1000;

    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;

    border-radius: var(--site-radius-pill);
    background: #ffffff;
    color: #111111;

    font-size: 0.9rem;
    font-weight: 600;

    transition: top var(--site-transition-fast);
}

.site-skip-link:focus {
    top: 12px;
}

/* Etat de focus global pour les éléments interactifs */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--site-accent);
    outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   3. HEADER FIXE (DESKTOP + MOBILE)
   -------------------------------------------------------------------------- */

.site-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;

    background: var(--site-surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    border-bottom: 1px solid var(--site-line);

    transition:
        background var(--site-transition-fast),
        border-color var(--site-transition-fast),
        box-shadow var(--site-transition-fast);
}

/* Etat sticky après scroll (géré par ui.js) */
.site-header.is-scrolled {
    background: var(--site-surface-strong);
    border-bottom-color: var(--site-line-strong);
    box-shadow: var(--site-shadow-sm);
}

/* Etat quand le menu mobile est ouvert */
.site-header.is-menu-open {
    background: var(--site-surface-strong);
    border-bottom-color: var(--site-line-strong);
}

/* Grille interne du header */
.site-header__inner {
    width: var(--site-shell);
    min-height: var(--site-header-h);
    margin: 0 auto;

    display: grid;
    grid-template-columns: 132px 1fr auto;
    align-items: center;
    gap: 28px;
}

/* Bloc logo */
.site-header__brand {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;

    width: 132px;
    min-width: 132px;
    height: 40px;
    overflow: hidden;

    flex: 0 0 132px;
}

/* Logo image — header.
   NOTE : on garde .site-header-logo en alias historique */
.site-header__logo,
.site-header-logo {
    display: block;
    width: 132px;
    height: auto;
    max-width: none;
    object-fit: contain;

    filter: brightness(0) invert(1);
    opacity: 0.96;
}

/* Navigation principale (desktop) */
.site-header__nav {
    display: flex;
    justify-content: center;
    min-width: 0;
}

.site-nav {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 30px;
    margin: 0;
    padding: 0;
}

.site-nav__link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 2px;

    color: var(--site-text-soft);
    font-size: 0.96rem;
    font-weight: 700;
    letter-spacing: 0.01em;

    transition:
        color var(--site-transition-fast),
        opacity var(--site-transition-fast);
}

.site-nav__link:hover,
.site-nav__link.is-active,
.site-nav__link[aria-current="page"] {
    color: var(--site-accent);
    opacity: 1;
}

/* Zone actions (à droite) — actuellement uniquement le burger */
.site-header__actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* Burger mobile */
.site-burger {
    display: none; /* visible uniquement en mobile */
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;

    border-radius: var(--site-radius-pill);
    background: transparent;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    transition:
        background var(--site-transition-fast),
        transform var(--site-transition-fast);
}

.site-burger:hover {
    background: rgba(255, 255, 255, 0.05);
}

.site-burger:active {
    transform: scale(0.98);
}

/* Barres internes du burger */
.site-burger__bar {
    display: block;
    width: 22px;
    height: 2px;
    margin: 4px auto;
    border-radius: 999px;
    background: #ffffff;
    transition:
        transform var(--site-transition-fast),
        opacity var(--site-transition-fast);
}

/* Etat “croix” quand le menu est ouvert (géré en JS) */
.site-burger.is-active .site-burger__bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.site-burger.is-active .site-burger__bar:nth-child(2) {
    opacity: 0;
}

.site-burger.is-active .site-burger__bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Navigation mobile (conteneur) */
.site-mobile-nav {
    display: none;
    width: 100%;
    padding: 0 0 14px;

    border-top: 1px solid rgba(212, 245, 74, 0.08);
    background: rgba(10, 15, 11, 0.96);
}

/* Etat ouvert du menu mobile */
.site-mobile-nav.is-open {
    display: block;
}

/* Liste de liens mobile */
.site-mobile-nav__list {
    list-style: none;
    width: var(--site-shell);
    margin: 0 auto;
    padding: 12px 0 4px;

    display: grid;
    gap: 4px;
}

/* Liens mobile */
.site-mobile-nav__link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 2px;

    color: rgba(244, 239, 231, 0.88);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;

    transition: color var(--site-transition-fast);
}

.site-mobile-nav__link:hover,
.site-mobile-nav__link.is-active,
.site-mobile-nav__link[aria-current="page"] {
    color: var(--site-accent);
}

/* --------------------------------------------------------------------------
   4. FOOTER GLOBAL
   -------------------------------------------------------------------------- */

.site-footer {
    margin-top: 64px;
    padding: 28px 0 34px;

    border-top: 1px solid rgba(212, 245, 74, 0.08);
    background:
        linear-gradient(180deg,
            rgba(7, 11, 8, 0.00) 0%,
            rgba(7, 11, 8, 0.28) 100%);
}

.site-footer__inner {
    width: var(--site-shell);
    margin: 0 auto;

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px 24px;
}

/* Logo footer */
.site-footer__brand {
    display: inline-flex;
    align-items: center;
}

.site-footer__logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.94;
}

/* Navigation footer */
.site-footer__nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
}

.site-footer__nav a {
    color: var(--site-text-soft);
    font-size: 0.95rem;
    font-weight: 600;
    transition: color var(--site-transition-fast);
}

.site-footer__nav a:hover {
    color: var(--site-accent);
}

/* --------------------------------------------------------------------------
   5. RESPONSIVE
   -------------------------------------------------------------------------- */

/* 5.1. Viewports <= 960px : header un peu plus compact */
@media (max-width: 960px) {
    :root {
        --site-shell: min(100% - 32px, 100%);
        --site-header-h: 68px;
    }

    .site-header__inner {
        grid-template-columns: 112px 1fr auto;
        gap: 20px;
    }

    .site-header__brand {
        width: 112px;
        min-width: 112px;
    }

    .site-header__logo,
    .site-header-logo {
        width: 112px;
    }

    .site-nav {
        gap: 22px;
    }
}

/* 5.2. Viewports <= 768px : nav desktop masquée, burger activé */
@media (max-width: 768px) {
    :root {
        --site-shell: min(100% - 28px, 100%);
    }

    .site-header__inner {
        grid-template-columns: 1fr auto;
        gap: 12px;
    }

    .site-header__nav {
        display: none;
    }

    .site-burger {
        display: inline-flex;
    }

    .site-header__brand {
        width: 104px;
        min-width: 104px;
        height: 36px;
    }

    .site-header__logo,
    .site-header-logo {
        width: 104px;
    }

    .site-footer {
        margin-top: 48px;
        padding: 24px 0 28px;
    }

    .site-footer__inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-footer__nav {
        gap: 14px;
    }
}

/* 5.3. Viewports <= 480px : encore plus compact */
@media (max-width: 480px) {
    :root {
        --site-shell: calc(100% - 24px);
        --site-header-h: 64px;
    }

    .site-header__brand {
        width: 96px;
        min-width: 96px;
        height: 32px;
    }

    .site-header__logo,
    .site-header-logo {
        width: 96px;
    }

    .site-nav__link,
    .site-mobile-nav__link,
    .site-footer__nav a {
        font-size: 0.94rem;
    }

    .site-footer__logo {
        width: 52px;
        height: 52px;
    }
}