/* ===== MYRECIPECARD.KITCHEN — CANONICAL DESIGN TOKENS =====
   Hybrid system: Heritage Hearth warmth + Menu Rollout precision.
   8/8 thinker unanimous approval — cc-1747310400.
   Assembly: @c:design (Frost, Schoger, Kowalski, Meng To, Rauno, Paco, Heath, Scher)
   Heritage Hearth names (food metaphors) + Prospectus completeness + Menu Rollout motion.
*/

/* ===== TOKENS ===== */
:root {
    /* Backgrounds — Heritage Hearth warmth */
    --bg: #FAF6EC;
    --bg-warm: #F5F2EA;
    --surface: #F2EDE0;
    --card: #FFFAF5;

    /* Text */
    --text: #2C2C2C;
    --text-secondary: #5A5A5A;
    --heading: #1A1612;

    /* Primary accent — forest green (operational precision) */
    --accent: #2F4F38;
    --accent-light: #E8F0EA;

    /* Brand palette — Heritage Hearth food metaphors */
    --paprika: #D97757;        /* Functional CTA accent: buttons, warnings, active states */
    --paprika-hover: #C2472E;
    --sage: #9B8B7E;
    --cinnamon: #9B6B52;
    --cinnamon-text: #7D5540;
    --turmeric: #E8B923;
    --terra: #CB4228;

    /* Semantic — expanded from Prospectus */
    --accent-warm: #8B3B2A;    /* Links, emphasis */
    --border: rgba(155, 107, 82, 0.19);
    --green: #2C3320;          /* Success/data states */
    --red: #CB4228;            /* Error/warning states */
    --yellow: #B8860B;         /* Caution/Q-factor */
    --gold: #8B6914;           /* Premium/highlight */
    --gold-light: #FFF8E1;
    --blue: #4A6FA5;           /* Info/links */
    --blue-light: #E8EEF5;
    --dark: #141815;           /* Deep backgrounds */

    /* Typography — NO Caveat (killed per Rauno: "handwriting = loss of control") */
    --font-serif: 'Newsreader', Georgia, serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Elevation — Prospectus shadow hierarchy */
    --shadow-sm: 0 1px 3px rgba(15, 20, 15, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 20, 15, 0.06);
    --shadow-lg: 0 8px 24px rgba(15, 20, 15, 0.08);
    --shadow-cta: 0 4px 14px rgba(217, 119, 87, 0.35);

    /* Layout */
    --radius: 8px;
    --radius-lg: 12px;
    --max-w: 1140px;

    /* Motion system — 3 presets (Emil Kowalski approved) */
    --motion-fast: 100ms;
    --motion-normal: 300ms;
    --motion-slow: 600ms;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* CTA accent — distinct from paprika for conversion clarity */
    --cta-bg: #C1440E;
    --cta-bg-hover: #A33A0C;
    --cta-shadow: 0 4px 14px rgba(193, 68, 14, 0.4);
}

/* ===== UNIFIED NAV ===== */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 246, 236, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0;
}
.site-nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0.6rem 2rem;
}
.site-nav-brand {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent-warm);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.site-nav-brand img {
    height: 32px;
    width: auto;
}
.site-nav-links {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}
.site-nav-links a {
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--heading);
    text-decoration: none;
    padding: 0.4rem 0.65rem;
    border-radius: 4px;
    transition: color 150ms ease, background 150ms ease;
    white-space: nowrap;
}
.site-nav-links a:hover {
    color: var(--paprika);
    background: rgba(217, 119, 87, 0.06);
}
.site-nav-links a:focus-visible {
    outline: 2px solid var(--paprika);
    outline-offset: 2px;
}
/* Primary CTA in nav — Card Generator gets the pill */
.site-nav-links a.nav-primary {
    background: var(--paprika);
    color: #fff;
    font-weight: 600;
    border-radius: 6px;
    box-shadow: var(--shadow-cta);
    padding: 0.45rem 1rem;
}
.site-nav-links :is(a.nav-primary, a.nav-primary[aria-current="page"]) {
    background: var(--paprika);
    color: #fff;
}
.site-nav-links a.nav-primary:hover {
    background: var(--paprika-hover);
    color: #fff;
}
/* Active page indicator */
.site-nav-links a[aria-current="page"] {
    color: var(--paprika);
    font-weight: 600;
}

/* Dropdown for Tools */
.nav-dropdown {
    position: relative;
}
.nav-dropdown-trigger {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.nav-dropdown-trigger::after {
    content: '';
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    opacity: 0.5;
}
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    min-width: 200px;
    padding: 0.4rem;
    margin-top: 0.35rem;
    z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    display: block;
}
.nav-dropdown-menu a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.82rem;
}
.nav-dropdown-menu a:hover {
    background: rgba(217, 119, 87, 0.06);
}

/* ===== HAMBURGER TOGGLE (hidden on desktop, visible at 768px) ===== */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    color: var(--heading);
    border-radius: 4px;
    transition: background 150ms ease;
}
.nav-hamburger:hover {
    background: rgba(217, 119, 87, 0.06);
}
.nav-hamburger:focus-visible {
    outline: 2px solid var(--paprika);
    outline-offset: 2px;
}
.nav-hamburger svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ===== MOBILE NAV DIALOG ===== */
.mobile-nav-dialog {
    border: none;
    background: var(--bg);
    padding: 0;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.mobile-nav-dialog::backdrop {
    background: rgba(26, 22, 18, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.mobile-nav-dialog[open] {
    display: flex;
    flex-direction: column;
}
.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}
.mobile-nav-header .site-nav-brand {
    font-size: 0.95rem;
}
.mobile-nav-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--heading);
    border-radius: 4px;
}
.mobile-nav-close:hover {
    background: rgba(217, 119, 87, 0.06);
}
.mobile-nav-close:focus-visible {
    outline: 2px solid var(--paprika);
    outline-offset: 2px;
}
.mobile-nav-close svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}
.mobile-nav-links {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 0.25rem;
}
.mobile-nav-links a {
    display: block;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    color: var(--heading);
    text-decoration: none;
    padding: 0.85rem 1rem;
    border-radius: 6px;
    transition: background 150ms ease, color 150ms ease;
}
.mobile-nav-links a:hover {
    background: rgba(217, 119, 87, 0.06);
    color: var(--paprika);
}
.mobile-nav-links a:focus-visible {
    outline: 2px solid var(--paprika);
    outline-offset: -2px;
}
.mobile-nav-links a.nav-primary {
    background: var(--paprika);
    color: #fff;
    font-weight: 700;
    text-align: center;
    margin-top: 0.5rem;
    box-shadow: var(--shadow-cta);
}
.mobile-nav-links a.nav-primary:hover {
    background: var(--paprika-hover);
    color: #fff;
}
/* Nested items under Learn dropdown */
.mobile-nav-links .mobile-nav-sub {
    padding-left: 1rem;
}
.mobile-nav-links .mobile-nav-sub a {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.65rem 1rem;
}
.mobile-nav-links .mobile-nav-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sage);
    padding: 0.5rem 1rem 0.25rem;
}

/* Mobile nav */
@media (max-width: 768px) {
    .site-nav-inner {
        padding: 0.5rem 1rem;
    }
    .site-nav-links {
        display: none;
    }
    .nav-hamburger {
        display: flex;
    }
}

/* ===== UNIFIED FOOTER ===== */
.site-footer {
    background: var(--heading);
    color: rgba(250, 246, 236, 0.7);
    padding: 2.5rem 2rem 1.5rem;
    font-size: 0.82rem;
}
.site-footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 2rem;
}
.site-footer-brand {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 700;
    color: rgba(250, 246, 236, 0.9);
    margin-bottom: 0.5rem;
}
.site-footer-tagline {
    font-size: 0.78rem;
    line-height: 1.6;
    color: rgba(250, 246, 236, 0.5);
}
.site-footer h4 {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cinnamon);
    margin-bottom: 0.75rem;
}
.site-footer-links {
    list-style: none;
    padding: 0;
}
.site-footer-links li {
    margin-bottom: 0.4rem;
}
.site-footer-links a {
    color: rgba(250, 246, 236, 0.6);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 150ms ease;
}
.site-footer-links a:hover {
    color: var(--paprika);
}
.site-footer-bottom {
    max-width: var(--max-w);
    margin: 1.5rem auto 0;
    padding-top: 1rem;
    border-top: 1px solid rgba(250, 246, 236, 0.08);
    text-align: center;
    font-size: 0.72rem;
    color: rgba(250, 246, 236, 0.35);
}

@media (max-width: 600px) {
    .site-footer-inner {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }
}

/* ===== PAGE SECTION TAG (breadcrumb identity) ===== */
.page-section-tag {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0.6rem 2rem 0;
}
.page-section-tag span {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sage);
}
.page-section-tag a {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sage);
    text-decoration: none;
}
.page-section-tag a:hover { color: var(--cinnamon); }
.page-section-tag .sep { margin: 0 0.35rem; opacity: 0.4; }
.page-section-tag .current { color: var(--cinnamon); }

/* ===== RELATED CONTENT CARDS ===== */
.related-section {
    padding: 3rem 0;
    border-top: 1px solid var(--border);
}
.related-section h3 {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--heading);
    text-align: center;
    margin-bottom: 1.5rem;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 2rem;
}
@media (max-width: 768px) {
    .related-grid { grid-template-columns: 1fr; }
}
.related-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform var(--motion-normal) var(--ease-out), box-shadow var(--motion-normal) ease;
}
.related-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.related-card-tag {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cinnamon);
    margin-bottom: 0.4rem;
}
.related-card h4 {
    font-family: var(--font-sans);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--heading);
    margin-bottom: 0.35rem;
    line-height: 1.35;
}
.related-card p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
}
.related-card .related-arrow {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    margin-top: 0.6rem;
    display: block;
}

/* ===== SCROLL REVEAL ANIMATION (Menu Rollout DNA, toned to 300ms per Kowalski) ===== */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--motion-normal) ease, transform var(--motion-normal) ease;
}
.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}
/* Stagger children: 50ms per item (Kowalski approved) */
.reveal-stagger > .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 50ms; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 100ms; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 150ms; }
.reveal-stagger > .reveal:nth-child(5) { transition-delay: 200ms; }
.reveal-stagger > .reveal:nth-child(6) { transition-delay: 250ms; }

/* ===== GATE BANNER (operational precision, from Menu Rollout) ===== */
.gate-banner {
    background: linear-gradient(135deg, var(--accent) 0%, #3d6a4a 100%);
    color: #fff;
    padding: 0.625rem 1rem;
    border-radius: 6px 6px 0 0;
    font-size: 0.8rem;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== PROGRESS BAR ===== */
.progress-track {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #4a7a5a);
    border-radius: 3px;
    transition: width 400ms ease;
}

/* ===== STATUS BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: 4px;
}
.badge--success { background: #dcfce7; color: #166534; }
.badge--warning { background: #fef3c7; color: #92400e; }
.badge--neutral { background: #e5e5e5; color: #777; }

/* ===== CARD HOVER (spring feel, from Menu Rollout) ===== */
.card-interactive {
    transition: transform var(--motion-normal) var(--ease-out), box-shadow var(--motion-normal) ease;
}
.card-interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ===== METRIC CARD (left-border accent system) ===== */
.metric-card {
    border-left: 4px solid var(--accent);
    background: var(--card);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 1.25rem;
}
.metric-card--warm { border-left-color: var(--paprika); }
.metric-card--gold { border-left-color: var(--gold); }

/* ===== GRAIN TEXTURE (editorial depth) ===== */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.018;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ===== SKIP LINK (accessibility) ===== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 10000;
    background: var(--heading);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 var(--radius) var(--radius);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: top var(--motion-fast) var(--ease-out);
}
.skip-link:focus {
    top: 0;
    outline: 2px solid var(--cinnamon);
    outline-offset: 2px;
}

/* ===== GLOBAL FOCUS ===== */
:focus-visible {
    outline: 2px solid var(--cinnamon);
    outline-offset: 2px;
}
a:focus-visible {
    outline: 2px dashed var(--cinnamon);
}

/* ===== REDUCED MOTION (accessibility) ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* ===== MOBILE STICKY CTA BAR ===== */
.mobile-cta-bar { display: none; }
@media (max-width: 768px) {
    .mobile-cta-bar {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        padding: 0.75rem 1rem;
        z-index: 1000;
        background: rgba(250, 246, 236, 0.92);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    }
    .mobile-cta-bar a {
        display: block;
        width: 100%;
        text-align: center;
        background: var(--paprika);
        color: #fff;
        padding: 0.85rem 1.5rem;
        border-radius: 6px;
        text-decoration: none;
        font-weight: 700;
        font-size: 0.95rem;
        box-shadow: var(--shadow-cta);
    }
    /* Prevent content from hiding behind sticky bar */
    .site-footer { padding-bottom: 5rem; }
    /* Sutton: scroll-padding prevents focused elements from hiding behind fixed bar */
    html { scroll-padding-bottom: 5rem; }
}

/* ===== SCROLL REVEAL JS (include in each page's <script>) =====
   Copy this into each page that uses .reveal classes:

   const observer = new IntersectionObserver((entries) => {
       entries.forEach(e => { if (e.isIntersecting) { e.target.classList.add('revealed'); observer.unobserve(e.target); } });
   }, { threshold: 0.1 });
   document.querySelectorAll('.reveal').forEach(el => observer.observe(el));
*/
