/* =====================================================
   Global Design Tokens & Base Overrides — Fifth Ave Ltd
   Ink / gold / porcelain system, Marcellus + Manrope.
   Colors are seeded by dynamic-css.php (never hardcode here).
   Everything else lives here as the single source of truth.
   ===================================================== */

:root {

    /* ---- Typography ---- */
    /* Marcellus ships in a single 400 weight; headings never bold. */
    --font-heading: 'Marcellus', serif;
    --font-body:    'Manrope', sans-serif;

    --fw-heading:   400;   /* all headings — Marcellus has one weight */
    --fw-regular:   400;
    --fw-medium:    500;
    --fw-semibold:  600;
    --fw-bold:      700;
    --fw-extrabold: 800;

    --text-h1:      clamp(2.5rem, 6vw, 4.625rem);      /* 40–74px — home hero */
    --text-h1-alt:  clamp(2.125rem, 4.6vw, 3.625rem);  /* 34–58px — inner page heroes */
    --text-h2:      clamp(1.875rem, 3.6vw, 2.875rem);  /* 30–46px — section heads */
    --text-h2-sm:   clamp(1.75rem, 3.4vw, 2.75rem);    /* 28–44px — CTA bands */
    --text-h3:      1.5625rem;                          /* 25px — practice cards */
    --text-h3-sm:   1.25rem;                            /* 20px — capability/step cards */
    --text-body-lg: clamp(1.0625rem, 1.5vw, 1.21875rem);/* 17–19.5px — ledes */
    --text-body:    1.03125rem;                         /* 16.5px */
    --text-sm:      0.90625rem;                         /* 14.5px — buttons, nav */
    --text-xs:      0.75rem;                            /* 12px — eyebrows, fine print */

    --leading-heading: 1.14;
    --leading-body:    1.6;

    /* Letterspacing — the wide-tracked uppercase look */
    --tracking-eyebrow: 0.24em;
    --tracking-wide:    0.03em;

    /* ---- 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.
     */
    --container-max: 1180px;
    /* Fluid section padding — clamp() handles mobile automatically */
    --section-py: clamp(64px, 9vw, 110px);   /* top/bottom on every section  */
    --section-px: clamp(20px, 4vw, 48px);    /* left/right (via .fave-container) */

    /* Text measures — consistent line lengths everywhere (see RULE 1).
       Never hardcode ch widths for headings/body in component CSS. */
    --measure-heading:    16ch; /* CTA band headings                 */
    --measure-heading-lg: 18ch; /* page hero headings                */
    --measure-text:       62ch; /* ledes + body reading copy         */
    --measure-text-sm:    56ch; /* narrower copy inside dark bands   */

    /* ---- Breakpoints ---- */
    /*
     * CSS variables CANNOT be used inside @media conditions — browser limitation.
     * Stored as unitless numbers for JavaScript access.
     * In CSS use the exact px values — never arbitrary values.
     *
     *   @media ( max-width: 1280px ) { }   ← xl
     *   @media ( max-width: 1024px ) { }   ← lg
     *   @media ( max-width: 768px )  { }   ← md
     *   @media ( max-width: 640px )  { }   ← sm
     *   @media ( max-width: 480px )  { }   ← xs
     */
    --bp-xs:  480;
    --bp-sm:  640;
    --bp-md:  768;
    --bp-lg:  1024;
    --bp-xl:  1280;
    --bp-2xl: 1440;

    /* ---- Border Radius ---- */
    --radius-sm:   8px;
    --radius-md:   12px;   /* list rows, inputs        */
    --radius-lg:   16px;   /* cards                    */
    --radius-xl:   22px;   /* CTA bands                */
    --radius-full: 9999px; /* pill buttons             */

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

    /* ---- Transitions ---- */
    --ease-base: 0.25s 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 constants — not admin-settable ---- */
    --color-on-dark:        rgba(255, 255, 255, 0.72); /* body text on ink        */
    --color-on-dark-muted:  rgba(255, 255, 255, 0.6);  /* secondary text on ink   */
    --color-on-dark-faint:  rgba(255, 255, 255, 0.42); /* legal line on ink       */
    --color-divider-on-dark: rgba(255, 255, 255, 0.12);/* hairlines on ink        */

    /* ---- Semantic UI colours (functional, not brand) ---- */
    --color-rating:  #F59E0B;            /* star ratings                */
    --color-error:   #DC2626;            /* form validation errors      */
    --color-overlay: rgba(20, 23, 28, 0.5); /* mask / scrim alpha       */

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

/* ---- Body base — overrides stale Tailwind compiled output ---- */
/* No body padding-top: the header is transparent and every page
   opens with a dark hero that carries its own header offset. */
body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--text-body);
    line-height: var(--leading-body);
    -webkit-font-smoothing: antialiased;
}

/* Headings — Marcellus, single weight, tight leading, sitewide */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: var(--fw-heading);
    line-height: var(--leading-heading);
}

/* ---- 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);
}

/* =====================================================
   Default brand mark — fave_get_brand_mark() in helpers.php.
   Shown in header/footer/drawer when no logo is uploaded.
   ===================================================== */

.fave-brand-mark {
    width: 42px;
    height: 42px;
    flex: none;
    display: block;
}

/* =====================================================
   Shared text patterns — eyebrow + lede
   Used on every page, light and dark sections.
   ===================================================== */

.fave-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    letter-spacing: var(--tracking-eyebrow);
    text-transform: uppercase;
    color: var(--color-primary-dark);
}

.fave-eyebrow::before {
    content: "";
    width: 26px;
    height: 1.5px;
    background: var(--color-primary);
}

/* On ink backgrounds the eyebrow lifts to full gold */
.fave-on-dark .fave-eyebrow,
.fave-eyebrow--on-dark {
    color: var(--color-primary);
}

.fave-lede {
    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);
}

.fave-on-dark .fave-lede,
.fave-lede--on-dark {
    color: var(--color-on-dark);
}

/* Standard section head block: eyebrow, heading, lede */
.fave-sec-head {
    max-width: 720px;
    margin-bottom: clamp(36px, 5vw, 58px);
}

.fave-sec-head h2 {
    font-size: var(--text-h2);
    color: var(--color-text);
    margin: var(--space-4) 0 var(--space-4);
}

.fave-on-dark .fave-sec-head h2 {
    color: var(--color-white);
}

/* =====================================================
   Page hero — shared compact dark hero
   (practice pages, contact, legal). Home has its own
   larger hero in home.css.
   ===================================================== */

.fave-page-hero {
    position: relative;
    overflow: hidden;
    background-color: var(--color-dark);
    color: var(--color-white);
    /* Offset for the fixed transparent 78px header */
    padding-top: calc(78px + clamp(52px, 8vh, 96px));
    padding-bottom: clamp(56px, 8vh, 92px);
}

.fave-page-hero__avenue {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.55;
}

.fave-page-hero__inner {
    position: relative;
}

.fave-page-hero__heading {
    font-size: var(--text-h1-alt);
    color: var(--color-white);
    max-width: var(--measure-heading-lg);
    margin: var(--space-5) 0 var(--space-5);
}

.fave-page-hero__actions {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-top: var(--space-8);
}

/* =====================================================
   CTA band — shared component (home, practice pages, contact)
   Dark rounded panel inside a light section.
   ===================================================== */

.fave-band-section {
    padding-block: var(--section-py);
}

/* White backdrop variant (the mock's .alt sections) */
.fave-band-section--alt {
    background-color: var(--color-white);
}

.fave-band {
    position: relative;
    overflow: hidden;
    background-color: var(--color-dark);
    color: var(--color-white);
    border-radius: var(--radius-xl);
    padding: clamp(44px, 6vw, 72px);
}

.fave-band__avenue {
    position: absolute;
    right: -40px;
    top: -60px;
    opacity: 0.5;
    pointer-events: none;
}

.fave-band__inner {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-8);
    flex-wrap: wrap;
}

.fave-band__eyebrow {
    margin-bottom: var(--space-4);
}

.fave-band__heading {
    font-size: var(--text-h2-sm);
    color: var(--color-white);
    max-width: var(--measure-heading);
}

.fave-band__text {
    color: var(--color-on-dark);
    max-width: var(--measure-text-sm);
    margin-top: var(--space-4);
}

.fave-band__text--muted {
    color: var(--color-on-dark-muted);
    margin-top: var(--space-3);
}

@media ( max-width: 640px ) {
    .fave-band__inner {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =====================================================
   Scroll reveal — used on every page (observer in main.js)
   ===================================================== */

.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

@media ( prefers-reduced-motion: reduce ) {
    .reveal,
    .reveal.is-visible {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* =====================================================
   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-text);
    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-light);
}

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

.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    background: var(--color-primary);
    color: var(--color-text);
    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: 2.5px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: 4px;
}
