/* =====================================================
   Global Design Tokens & Base Overrides — Starter Theme
   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: 1200px;
    --section-py:    80px;   /* top/bottom padding on every section — 50px on mobile */
    --section-px:    20px;   /* left/right padding on every section (via .st-container) */

    /* Fixed header — body is offset by --header-h (see header.css).
       The brand logo carries a "by BeamBright" sub-line, so it needs more
       than the starter's 32px to stay legible. Still a max-height, never fixed. */
    --header-h:   84px;
    --logo-max-h: 54px;
    --footer-logo-max-h: 64px;

    /* 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 */


    /* Home features: preview panel width once stacked (tablet / phone) */
    --feat-preview-max: 32rem;

    /* Home about: photo frame width (landscape frame, so it is wider than tall) */
    --about-arch-max:    32rem;
    --about-arch-max-sm: 28rem;

    /* Forms — Login / Sign Up split card (auth.css, form.css) */
    --form-max:        26rem;  /* single-column form width             */
    --auth-min-h:      40rem;  /* split card height on desktop         */
    --auth-stack-max:  40rem;  /* card width once stacked (tablet)     */
    --auth-art-max:    28rem;  /* seating illustration, desktop: fixed size */
    --auth-art-max-sm: 20rem;  /* seating illustration, stacked layout */

    /* Legal pages (legal.css) */
    --legal-toc-w:     16rem;  /* contents column on desktop           */
    --legal-text-max:  46rem;  /* policy text column                   */

    /* Dashboard (dashboard.css) */
    --dash-sidebar-w:  16rem;  /* sidebar column width on desktop      */
    --dash-ease-view:  0.55s ease;  /* content easing in on each view    */
    --dash-tab-time:   0.45s;       /* active tab slide between items    */
    --dash-ease-state: 0.35s ease;  /* sidebar link colour / curve fades */

    /* Event flyer (flyer.css): US Letter. cqw sizes are shares of the sheet
       width, so the on-screen preview and the printed page match exactly. */
    --flyer-page-w:      8.5in;
    --flyer-page-h:      11in;
    --flyer-ratio:       8.5 / 11;
    --flyer-tools-w:     22rem;     /* options column on desktop */
    --flyer-preview-max: 40rem;     /* preview width once stacked */
    --flyer-paper:       #FFFFFF;
    --flyer-paper-warm:  #FBF8F1;
    --flyer-ink:         #14181F;
    --flyer-qr:          #000000;   /* always black on white, so it scans */
    --flyer-font-serif:  Georgia, 'Times New Roman', serif;
    --flyer-gap-xs:      1cqw;
    --flyer-gap-sm:      1.8cqw;
    --flyer-gap-md:      3cqw;
    --flyer-gap-lg:      5cqw;
    --flyer-text-name:      6.6cqw;
    --flyer-text-name-long: 5cqw;
    --flyer-text-name-xl:   3.6cqw;
    --flyer-text-title:     3.4cqw;
    --flyer-text-body:      2.05cqw;
    --flyer-text-small:     1.5cqw;
    --flyer-qr-w:           42cqw;
    --flyer-qr-w-large:     50cqw;  /* no cover image: more room for the code */
    --flyer-logo-max-h:     4.6cqw;
    --flyer-rule-w:         0.3cqw;
    --flyer-band-h:         3cqw;

    /* ---- 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-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 {
    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 ---- */
.st-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: 1024px ) {
    :root {
        --header-h:   72px;
        --logo-max-h: 46px;
        --footer-logo-max-h: 44px;
    }
}

@media ( max-width: 768px ) {
    :root {
        --section-py: 50px;
    }
}

/* =====================================================
   Accessibility baseline (RULE 33)
   ===================================================== */

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

.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);
}

/* Visually hidden, still read by screen readers */
.st-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =====================================================
   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);
}
