/* =========================================================
   Charles Cuisine — Design system (paper)
   Base partagée entre home, recette, catégorie.
   Tokens · reset · typographie de base · nav · footer · motion
   ========================================================= */

/* ---------- 1. Design tokens ---------- */
:root {
    --paper: oklch(0.97 0.012 80);
    --paper-warm: oklch(0.94 0.018 80);
    --ink: oklch(0.22 0.020 50);
    --ink-soft: oklch(0.45 0.015 50);
    --ink-faint: oklch(0.72 0.012 50);
    --rule: oklch(0.82 0.010 50);
    --rouge: oklch(0.46 0.18 30);     /* #B32912 — calé sur le rouge du logo brush */
    --rouge-deep: oklch(0.38 0.15 30);

    --ff-serif: 'Vollkorn', 'Iowan Old Style', 'Palatino', 'Georgia', serif;
    --ff-sans: 'Bricolage Grotesque', -apple-system, 'Helvetica Neue', sans-serif;
    --ff-hand: 'Caveat', 'Bradley Hand', 'Marker Felt', cursive;

    --s-3xs: 4px;
    --s-2xs: 8px;
    --s-xs: 12px;
    --s-sm: 16px;
    --s-md: 24px;
    --s-lg: 32px;
    --s-xl: 48px;
    --s-2xl: 64px;
    --s-3xl: 96px;
    --s-4xl: 128px;

    --w-text: 65ch;
    --w-page: 1120px;
    --w-narrow: 720px;

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- 2. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--ff-serif);
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    line-height: 1.55;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern", "liga", "calt";
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }
em, i { font-style: italic; }
::selection { background: var(--rouge); color: var(--paper); }

/* ---------- 3. Navigation partagée ---------- */
.bistrot-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(8px);
    -webkit-backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--rule);
}

/* Checkbox technique — visually hidden, still focusable */
.nav-toggle-cb {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.nav-inner {
    max-width: var(--w-page);
    margin: 0 auto;
    padding: var(--s-xs) var(--s-md);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-md);
}

.nav-mark {
    font-family: var(--ff-serif);
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.nav-mark em { font-style: italic; font-weight: 500; color: var(--rouge); }

.nav-links {
    display: flex;
    gap: var(--s-md);
    font-family: var(--ff-sans);
    font-size: 0.8125rem;
    font-weight: 500;
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

.nav-links a {
    position: relative;
    padding-block: var(--s-2xs);
    color: var(--ink-soft);
    transition: color 0.25s var(--ease-out);
}

.nav-links a:hover { color: var(--ink); }

.nav-links a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 2px;
    height: 1px;
    background: var(--rouge);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s var(--ease-out);
}

.nav-links a:hover::after { transform: scaleX(1); }

/* Burger + scrim — hidden on desktop */
.nav-burger { display: none; }
.nav-scrim { display: none; }

/* --- Mobile : burger + slide-down panel --- */
@media (max-width: 640px) {
    .nav-inner { padding: var(--s-2xs) var(--s-sm); }

    .nav-burger {
        display: inline-flex;
        align-items: baseline;
        gap: 0.14em;
        padding: var(--s-2xs) var(--s-3xs);
        font-family: var(--ff-hand);
        font-weight: 600;
        font-size: 1.625rem;
        line-height: 1;
        color: var(--rouge);
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        min-height: 44px;
        transition: color 0.25s var(--ease-out);
    }
    .nav-burger:hover { color: var(--rouge-deep); }
    .nav-burger-arrow {
        display: inline-block;
        transition: transform 0.4s var(--ease-out);
    }
    .nav-burger-close { display: none; }

    .bistrot-nav:has(.nav-toggle-cb:checked) .nav-burger-open { display: none; }
    .bistrot-nav:has(.nav-toggle-cb:checked) .nav-burger-close { display: inline-flex; }

    /* Slide-down panel — the nav-links container becomes the panel on mobile */
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        padding: var(--s-lg) var(--s-md) var(--s-2xl);
        background: var(--paper-warm);
        border-bottom: 1px solid var(--rule);
        font-family: var(--ff-serif);
        font-size: 1.75rem;
        font-weight: 500;
        font-style: italic;
        text-transform: none;
        letter-spacing: -0.01em;
        color: var(--ink);
        transform: translateY(calc(-100% - 8rem));
        transition: transform 0.45s var(--ease-out);
        box-shadow: 0 32px 48px -28px oklch(0.22 0.02 50 / 0.4);
        pointer-events: none;
        visibility: hidden;
    }

    .nav-links a {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        padding: var(--s-md) 0;
        color: var(--ink);
        border-bottom: 1px dashed var(--rule);
        transition: color 0.2s var(--ease-out);
    }
    .nav-links a:last-child { border-bottom: 0; }
    .nav-links a::after { display: none; }
    .nav-links a:hover { color: var(--rouge); }

    /* Small ornament on each panel link — tiny arrow on the right */
    .nav-links a::before {
        content: '→';
        order: 2;
        margin-left: var(--s-md);
        font-family: var(--ff-hand);
        font-style: normal;
        font-size: 1.4rem;
        color: var(--rouge);
        opacity: 0.55;
        transition: transform 0.3s var(--ease-out), opacity 0.2s var(--ease-out);
    }
    .nav-links a:hover::before { transform: translateX(4px); opacity: 1; }

    .bistrot-nav:has(.nav-toggle-cb:checked) .nav-links {
        transform: translateY(0);
        pointer-events: auto;
        visibility: visible;
        z-index: 60;
    }

    /* Nav bar goes fully opaque when open, and stacks above the scrim */
    .bistrot-nav:has(.nav-toggle-cb:checked) {
        background: var(--paper-warm);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .bistrot-nav:has(.nav-toggle-cb:checked) .nav-inner {
        position: relative;
        z-index: 60;
        background: var(--paper-warm);
    }

    /* Scrim : clickable outside area to close */
    .nav-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: oklch(0.22 0.02 50 / 0);
        pointer-events: none;
        transition: background 0.35s var(--ease-out);
        z-index: -1;
    }
    .bistrot-nav:has(.nav-toggle-cb:checked) .nav-scrim {
        background: oklch(0.22 0.02 50 / 0.35);
        pointer-events: auto;
        z-index: 40;
    }
}

/* ---------- 4. Colophon partagé ---------- */
.colophon {
    border-top: 1px solid var(--rule);
    padding: var(--s-xl) var(--s-md) var(--s-lg);
}

.colo-inner {
    max-width: var(--w-page);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--s-lg);
    align-items: center;
    text-align: center;
}

@media (min-width: 760px) {
    .colo-inner { flex-direction: row; justify-content: space-between; text-align: left; align-items: flex-end; }
}

.colo-mark {
    font-family: var(--ff-serif);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.colo-mark em { font-style: italic; font-weight: 500; }

.colo-tagline {
    margin-top: var(--s-3xs);
    font-family: var(--ff-serif);
    font-style: italic;
    font-size: 0.9375rem;
    color: var(--ink-soft);
}

.colo-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--s-sm) var(--s-md);
    font-family: var(--ff-sans);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-soft);
    max-width: 100%;
}

.colo-links a { transition: color 0.25s var(--ease-out); }
.colo-links a:hover { color: var(--rouge); }

.colo-bottom {
    max-width: var(--w-page);
    margin: var(--s-lg) auto 0;
    padding-top: var(--s-md);
    border-top: 1px solid var(--rule);
    display: flex;
    justify-content: space-between;
    gap: var(--s-md);
    font-family: var(--ff-sans);
    font-size: 0.75rem;
    color: var(--ink-faint);
    letter-spacing: 0.05em;
    flex-wrap: wrap;
}

/* ---------- 5. Patterns partagés : kicker + tampon ---------- */
.kicker {
    font-family: var(--ff-sans);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--rouge);
    margin-bottom: var(--s-sm);
}

.stamp {
    display: inline-flex;
    align-items: center;
    gap: 0.15em;
    font-family: var(--ff-sans);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--rouge);
    padding: 0.25em 0.55em;
    border: 1.5px solid currentColor;
    border-radius: 1px;
    transform: rotate(-2deg);
}

/* ---------- 6. Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
    html { scroll-behavior: auto; }
}

/* ---------- 7. Focus ---------- */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--rouge);
    outline-offset: 3px;
    border-radius: 2px;
}
