/* =====================================================
   Global Design Tokens & Base Overrides — 5th Ave
   Colors are seeded by dynamic-css.php (never hardcode here).
   Everything else lives here as the single source of truth.
   ===================================================== */

:root {

    /* ---- Typography ---- */
    --font-heading: 'Plus Jakarta Sans', sans-serif;
    --font-body:    'Plus Jakarta Sans', sans-serif;

    --fw-regular:   400;
    --fw-medium:    500;
    --fw-semibold:  600;
    --fw-bold:      700;
    --fw-extrabold: 800;

    --text-h1:      clamp(2rem,   5vw, 3.5rem);
    --text-h2:      clamp(1.75rem, 4vw, 2.75rem);
    --text-h3:      clamp(1.25rem, 3vw, 1.75rem);
    --text-body-lg: 1.125rem;
    --text-body:    1rem;
    --text-sm:      0.875rem;
    --text-xs:      0.75rem;

    --leading-heading: 1.15;
    --leading-body:    1.65;

    /* ---- Spacing (4px base unit) ---- */
    --space-1:  0.25rem;
    --space-2:  0.5rem;
    --space-3:  0.75rem;
    --space-4:  1rem;
    --space-5:  1.25rem;
    --space-6:  1.5rem;
    --space-8:  2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-14: 3.5rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* ---- Layout & Section Spacing ---- */
    /*
     * --container-max controls the boxed width of the ENTIRE site.
     * Change this one value to change every section, header, and footer at once.
     * Common values: 1200px | 1280px | 1320px | 1400px | 1440px
     */
    --container-max: 1280px;
    --section-py:    80px;   /* top/bottom padding on every section — 50px on mobile */
    --section-px:    20px;   /* left/right padding on every section (via .fave-container) */

    /* Text measures — consistent line lengths everywhere (see RULE 1).
       Never hardcode ch widths for headings/body in component CSS. */
    --measure-heading: 20ch; /* centred / CTA headings        */
    --measure-text:    56ch; /* body + subheading reading copy */

    /* ---- Breakpoints ---- */
    /*
     * CSS variables CANNOT be used inside @media conditions — this is a browser limitation.
     * These are stored as unitless numbers for JavaScript access.
     * In CSS, use the exact px values listed here — never use arbitrary values.
     *
     * Quick reference for media queries:
     *   @media ( max-width: 1280px ) { }   ← xl   — large laptops and below
     *   @media ( max-width: 1024px ) { }   ← lg   — tablets landscape / small laptops
     *   @media ( max-width: 768px )  { }   ← md   — tablets portrait
     *   @media ( max-width: 640px )  { }   ← sm   — phones / small tablets
     *   @media ( max-width: 480px )  { }   ← xs   — small phones (iPhone SE etc.)
     *
     * JavaScript access:
     *   const bp = parseInt( getComputedStyle(document.documentElement).getPropertyValue('--bp-md') );
     *   if ( window.innerWidth <= bp ) { ... }
     */
    --bp-xs:  480;    /* small phones — iPhone SE, narrow viewports           */
    --bp-sm:  640;    /* phones landscape, small tablets                       */
    --bp-md:  768;    /* tablets portrait — iPad, Android tablets              */
    --bp-lg:  1024;   /* tablets landscape, small laptops — most used          */
    --bp-xl:  1280;   /* standard desktop                                      */
    --bp-2xl: 1440;   /* large desktop / wide monitors                         */

    /* ---- Border Radius ---- */
    --radius-sm:   4px;
    --radius-md:   8px;
    --radius-lg:   12px;
    --radius-xl:   16px;
    --radius-full: 9999px;

    /* ---- Shadows ---- */
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06),  0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.06);
    --shadow-xl: 0 20px 50px rgba(0,0,0,.12), 0 8px 16px rgba(0,0,0,.07);

    /* ---- Transitions ---- */
    --ease-base: 0.2s ease;
    --ease-slow: 0.4s ease;

    /* ---- Z-index scale ---- */
    --z-base:     1;
    --z-raised:   10;
    --z-dropdown: 100;
    --z-sticky:   200;
    --z-modal:    300;
    --z-overlay:  400;

    /* ---- Fixed constant — not admin-settable ---- */
    --color-on-dark: rgba(255, 255, 255, 0.82);

    /* ---- Semantic UI colours (functional, not brand — defined once here) ---- */
    --color-rating:  #F59E0B;            /* star ratings / gold accents */
    --color-error:   #DC2626;            /* form validation errors      */
    --color-overlay: rgba(0, 0, 0, 0.4); /* mask / scrim alpha          */
    --color-divider-on-dark: rgba(255, 255, 255, 0.1); /* hairlines on dark backgrounds */

    /* --color-primary-rgb / --color-primary-light-rgb / --color-text-rgb
       are output by dynamic-css.php so rgba(var(--color-primary-rgb), .08)
       tints track admin colours. Never hardcode RGB numbers in component CSS. */
}

/* ---- Body base — overrides stale Tailwind compiled output ---- */
body {
    /* Offset for the fixed 80px header (see header.css .header-inner height) */
    padding-top: 80px;
    background-color: var(--color-white);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--text-body);
    line-height: var(--leading-body);
}

/* ---- Container utility — controls left/right section spacing globally ---- */
.fave-container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--section-px);
}

/* =====================================================
   Section spacing — mobile override
   Changing --section-py here updates every section at once.
   ===================================================== */

@media ( max-width: 768px ) {
    :root {
        --section-py: 50px;
    }
}

/* =====================================================
   Back-to-top button
   ===================================================== */

.back-to-top {
    position: fixed;
    bottom: var(--space-8);
    right: var(--space-8);
    z-index: var(--z-dropdown);
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity var(--ease-slow), visibility var(--ease-slow), transform var(--ease-slow), background-color var(--ease-base);
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: var(--color-primary-dark);
}

/* =====================================================
   Accessibility — skip link + focus styles (RULE 33)
   ===================================================== */

.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    background: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-weight: var(--fw-semibold);
    z-index: var(--z-overlay);
    transition: top var(--ease-base);
}

.skip-link:focus {
    top: var(--space-4);
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* =====================================================
   Section header helpers — shared by every page
   One pattern: eyebrow label, heading, sub. Keeps line
   lengths consistent sitewide via the measure tokens.
   ===================================================== */

.fave-eyebrow {
    display: inline-block;
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-bottom: var(--space-3);
}

.fave-section-head {
    font-family: var(--font-heading);
    font-size: var(--text-h2);
    font-weight: var(--fw-bold);
    line-height: var(--leading-heading);
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.fave-section-head--center {
    text-align: center;
    max-width: var(--measure-heading);
    margin-inline: auto;
}

.fave-section-sub {
    font-family: var(--font-body);
    font-size: var(--text-body-lg);
    line-height: var(--leading-body);
    color: var(--color-muted);
    max-width: var(--measure-text);
    margin-top: var(--space-4);
}

.fave-section-sub--center {
    text-align: center;
    margin-inline: auto;
}

/* Eyebrow on dark backgrounds */
.fave-eyebrow--on-dark {
    color: var(--color-on-dark);
}
