/* Cascade layers (Nov 2026). A later layer beats an earlier one regardless of specificity.
   wp-global  WordPress core and theme.json global styles (wrapped in functions.php).
   legacy     every pre-redesign sheet, in its original file order. One layer on purpose: it keeps the
              historical cascade exactly as it was. It shrinks as components migrate out of it.
   tokens, base, layout, components, patterns, pages, utilities
              the redesign: assets/css/system/, one file per component, enqueued per template. */
@layer wp-global, legacy, tokens, base, layout, components, patterns, pages, utilities;

@layer legacy {
/**
 * Morocco Passage — Design Tokens
 * The single source of design authority for this theme.
 *
 * Raw design values are permitted in this file and in theme.json only.
 * Every other stylesheet and template must consume tokens.
 *
 * ---------------------------------------------------------------------------
 * AUTHORITY
 *
 * This file is the authority. theme.json is its editor mirror: the block editor
 * cannot read CSS custom properties, so the palette is declared a second time
 * there purely so editors see brand colours in the colour picker.
 *
 *   A colour changed in :root MUST be changed in theme.json in the same commit.
 *
 * theme.json mirrors the :root palette only — that is variant A, the default.
 * The [data-mp-variant] blocks below are CSS-only and are deliberately NOT
 * reflected in the editor: they are a design-review affordance, not content.
 *
 * Verified 14 August 2026: all ten :root palette tokens match theme.json
 * exactly. Nothing else may hold a raw design value — the Codebase Quality Gate
 * confirmed zero hex literals exist outside this file.
 *
 * ---------------------------------------------------------------------------
 * DESIGN SYSTEM V2 — frozen, confirmed authoritative 13 August 2026
 *
 * A later project handoff described a different system. It was an earlier
 * pre-V2 direction and does NOT override this implementation. Recorded here so
 * the question is settled next to the code that answers it:
 *
 *   AUTHORITATIVE (this file)          SUPERSEDED (do not reintroduce)
 *   ------------------------------     -------------------------------
 *   Newsreader      display            Fraunces
 *   Instrument Sans UI                 Inter
 *   Saffron #C2761B / #8F5510          terracotta / clay accent
 *   --radius: 0  (input 2px)           3-4px radius
 *   sharp editorial, unboxed cards     heavy or boxed cards
 *   no Moroccan arch motif             arch image mask
 *   Indigo #1C3A52 / Char #1A1714 / Plaster #F4F0E7   (unchanged either way)
 *
 * If a future brief conflicts with this table, the table wins until the design
 * system is explicitly re-frozen.
 */

:root {

    /* COLORS */

    --c-canvas: #F4F0E7;
    --c-canvas-alt: #EFEDE6;
    --c-surface: #FFFFFF;

    --c-ink: #1A1714;
    --c-muted: #6E665D;

    --c-deep: #1C3A52;

    --c-signal: #C2761B;
    --c-signal-text: #8F5510;

    --c-rule: #DDD5C7;
    --c-rule-strong: #C9BFAD;

    --c-on-deep: #F4F0E7;
    --c-on-deep-muted: #CBD6DE;

    /* Derived surface tints. Introduced in Stage 1 — see report. */
    --c-rule-on-deep: rgb(244 240 231 / 22%);
    --c-scrim: rgb(26 23 20 / 55%);
    --c-focus: var(--c-signal-text);

    /* Focus indicator on deep / photographic surfaces. Batch 5A.

       --c-focus (Saffron Deep #8F5510) is tuned for AA text contrast on
       Plaster, where it measures 5.31:1. On Indigo #1C3A52 the same value
       measures 1.96:1 — below the 3:1 that WCAG 1.4.11 / 2.4.11 require of a
       focus indicator — so dark surfaces need a second value rather than a
       weakened global one.

       Saffron #C2761B measures 3.32:1 on Indigo and is already the
       dark-surface accent: it draws the navigation hover underline over the
       hero. The focus ring therefore stays inside the palette and inside the
       existing visual language.

       Applied by scope in components.css. --c-focus itself is never edited,
       so the light-surface treatment is untouched. */
    --c-focus-on-deep: var(--c-signal);

    /* TYPOGRAPHY */

    --font-display:
        "Newsreader",
        Georgia,
        "Times New Roman",
        serif;

    --font-ui:
        "Instrument Sans",
        system-ui,
        -apple-system,
        "Segoe UI",
        sans-serif;

    --fs-display: clamp(2.5rem, 6vw, 4.75rem);
    /* Final pre-media pass — the section heading stepped down from 46px to
       42px at desktop so it reads clearly below the 56px page title instead
       of competing with it; the floor is unchanged in practice (28-30px). */
    --fs-h2: clamp(1.75rem, 1.25rem + 2vw, 2.625rem);
    --fs-h3: clamp(1.375rem, 2vw, 1.75rem);

    --fs-lead: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);
    /* Card titles: compact in a three-up grid (20-24px) rather than the
       28px section-h3 they used to inherit, which wrapped long journey names
       onto four lines. Wide cards still step up through the container query
       in components.css. */
    --fs-card: clamp(1.25rem, 1.05rem + 0.6vw, 1.5rem);
    --fs-body: 1.0625rem;
    --fs-article: clamp(1.1875rem, 1.1rem + 0.2vw, 1.25rem);
    --fs-meta: 0.9375rem;
    --fs-label: 0.8125rem;

    --lh-display: 1.05;
    --lh-heading: 1.15;
    --lh-body: 1.7;
    --lh-article: 1.75;

    --ls-display: -0.02em;
    --ls-label: 0.12em;
    --ls-meta: 0.08em;

    /* SPACING */

    --s-1: 0.25rem;
    --s-2: 0.5rem;
    --s-3: 0.75rem;
    --s-4: 1rem;
    --s-5: 1.25rem;
    --s-6: 1.5rem;
    --s-8: 2rem;
    --s-10: 2.5rem;
    --s-12: 3rem;
    --s-14: 3.5rem;
    --s-16: 4rem;
    --s-24: 6rem;
    --s-32: 8rem;
    --s-40: 10rem;

    /* LAYOUT */

    --w-wide: 1440px;
    --w-content: 1200px;
    --w-reading: 660px;

    --gap-card: var(--s-6);
    --gap-layout: var(--s-8);

    /* SECTION RHYTHM TIERS — FP-R2.

       Every section used one --section-y, so a utility page breathed exactly
       as much as the homepage narrative and ten stacked sections read as one
       undifferentiated column. Four tiers now carry meaning:

         compact      utility, archives, dense lists
         normal       the default; most content sections
         generous     homepage narrative sections that need air
         atmospheric  the rare full-bleed moments that reset the eye

       Each tier is fluid, so the difference between them widens with the
       viewport instead of collapsing on mobile. */

    --section-y-compact: clamp(2rem, 4vw, 3rem);
    --section-y: clamp(2.75rem, 5vw, 4.5rem);
    /* Final pre-media pass — generous capped at 7.5rem (was 9rem). Two
       adjacent homepage sections opened 288px of padding between their
       content at desktop; 240px still reads as a chapter break without
       the page feeling empty while media frames are neutral. */
    --section-y-generous: clamp(3.25rem, 6vw, 5.5rem);
    --section-y-atmospheric: clamp(4rem, 9vw, 8rem);

    /* Horizontal gutter. Introduced in Stage 1 — see report. */
    --gutter: var(--s-6);

    /* COMPONENTS */

    --h-header-desktop: 88px;
    --h-header-mobile: 64px;
    --h-control: 52px;

    /* Resolved header height, switched at the layout breakpoint. */
    --h-header: var(--h-header-mobile);

    --radius: 0;
    --radius-input: 2px;

    /* CONTROLS — final pre-media pass (6 October 2026).
       The owner asked for a refined button system with restrained rounding.
       This deliberately amends the frozen "radius 0" rule for interactive
       controls only: buttons, inputs and chips take a 3px corner; cards,
       media frames and sections stay square, so the editorial grid keeps its
       sharp character. */
    --radius-control: 3px;
    --h-btn: 3rem;
    --h-btn-lg: 3.25rem;
    --h-input: 3rem;
    --fs-btn: 0.9375rem;
    --ls-btn: 0.01em;
    --c-deep-strong: #132A3C;
    /* ROUTE. The one map-only accent (interactive map, 8 Oct 2026): a deep
       madder red for the selected journey's route line, chosen to read
       clearly over the plaster basemap without competing with Saffron in
       the interface. Map use only; not an interface colour, not mirrored
       in theme.json. Swap to var(--c-signal) here to bring routes back
       into the saffron accent. */
    --c-route: #A63A26;

    --c-error: #9B2C2C;
    --c-error-tint: #F6E7E3;
    --c-success: #2F5D46;

    /* Focus ring and small component geometry.
       Introduced in Stage 1 — see report. */
    --focus-ring: 2px;
    --size-node: 7px;
    --icon-bar-w: 22px;
    --icon-bar-gap: 6px;

    --border: 1px solid var(--c-rule);
    --border-strong: 1px solid var(--c-rule-strong);

    /* MEDIA RATIOS */

    /* MEDIA RATIO SYSTEM — FP-R2, documented roles rather than per-component
       accidents. Six roles, each chosen for what the photograph has to do:

         hero          21/9  cinematic establishing landscape, text overlays
         hero-mobile    4/5  same subject, vertical recomposition
         tour           3/2  editorial landscape, route and terrain
         destination    4/5  portrait, a place you stand inside
         experience     1/1  square, human and close
         guide         16/9  editorial feature, reads as publishing
         entity-hero  16/9 / 4/5 / 3/2  see the entity hero block in
                       components.css, where each entity gets the ratio that
                       matches its subject rather than inheriting Tour's.

       --media-focal is the theme-facing focal point. A future adapter sets it
       per image; the theme never reads a focal meta key itself. */

    --ratio-tour: 3 / 2;
    --ratio-destination: 4 / 5;
    --ratio-experience: 1 / 1;
    --ratio-guide: 16 / 9;
    --ratio-hero: 21 / 9;
    --ratio-hero-mobile: 4 / 5;
    --ratio-entity-destination: 4 / 5;
    --ratio-entity-experience: 3 / 2;

    --media-focal: 50% 50%;
    /* Art direction can override the mobile focal point per media slot. */
    --hero-height: clamp(36rem, 82svh, 48rem);

    /* MOTION */

    /* Reveal motion. FP.

       One shift distance and one duration for every scroll reveal in the
       theme, so section heads, cards and media all arrive with the same
       weight. Deliberately small: 12px is enough to read as arrival and
       little enough that a visitor who is not looking for it never sees a
       page "assemble itself".

       --dur-reveal is longer than --dur-base because a reveal travels
       further than a hover. --stagger-reveal is the delay between siblings
       in one group; JS caps the multiplier so a long grid never trails. */
    --shift-reveal: 12px;
    --dur-reveal: 520ms;
    --stagger-reveal: 70ms;

    /* MOTION TIERS — FP-R2. One duration per interaction class, so a hover,
       a surface change and an arrival never move at the same speed and the
       site reads as one motion system rather than a set of transitions.

         micro    160ms   colour, border, arrow nudge
         base     240ms   surface and header state
         media    320ms   image scale, media crop shifts
         reveal   520ms   section arrival
         entrance 640ms   hero, once per page load */
    --dur-media: 320ms;
    --dur-entrance: 640ms;

    --dur-micro: 160ms;
    --dur-base: 240ms;

    --ease: cubic-bezier(0.2, 0, 0, 1);

    /* ELEVATION / STACKING. Introduced in Stage 1 — see report. */
    --z-header: 100;
    --z-drawer: 200;
    --z-skip-link: 300;

    /* TOUCH TARGET. The minimum interactive size (44px) for icon buttons,
       compact links and controls that are not full buttons. */
    --h-touch: 2.75rem;

    /* REFINEMENT PASS TOKENS (moved here from refinement.css). */
    --fs-nav: 0.9375rem;
    --fs-closing: clamp(2.25rem, 1.4rem + 3.4vw, 4rem);
    --fs-footer-statement: clamp(1.5rem, 1.15rem + 1.3vw, 2.125rem);
    --fs-drawer-link: clamp(1.75rem, 1.2rem + 2.6vw, 2.25rem);

    --c-ink-soft: color-mix(in srgb, var(--c-ink) 78%, transparent);
    --c-on-deep-soft: color-mix(in srgb, var(--c-on-deep) 86%, transparent);

    /* ELEVATION. Shadows are tinted with the ink colour, never pure black. */
    --c-shadow: var(--c-ink);
    --shadow-header: 0 1px 0 var(--c-rule), 0 14px 32px -26px color-mix(in srgb, var(--c-shadow) 55%, transparent);
    --shadow-popover: 0 22px 44px -28px color-mix(in srgb, var(--c-shadow) 45%, transparent), 0 2px 6px -2px color-mix(in srgb, var(--c-shadow) 10%, transparent);
    --shadow-pressed: inset 0 1px 0 color-mix(in srgb, var(--c-shadow) 12%, transparent);

    --rule-signal: 1px solid var(--c-signal);

    /* MAP (interactive map, 8 Oct 2026). Marker geometry and map heights. */
    --map-dot: 0.875rem;
    --map-dot-route: 1.375rem;
    --map-area-ring: 0.5rem;
    --map-badge: 0.6875rem;
    --map-label: 0.8125rem;
    --map-height: clamp(18rem, 52svh, 24rem);
    --map-height-tablet: clamp(22rem, 54svh, 30rem);
    --map-height-wide: clamp(30rem, 68vh, 40rem);

    /* FRONTEND PASS — 16 October 2026.

       Palette unchanged: Plaster (ivory), Char (charcoal), Indigo from the
       mark, Saffron as the one earth accent. These tokens add the editorial
       scale, the homepage rhythm, the photographic scrims and the motion
       curves used by brand.css and homepage.css. Raw values stay here. */

    /* Type scale — fluid, display face. */
    --fs-hero: clamp(3rem, 1.55rem + 6.2vw, 7.75rem);
    --fs-statement: clamp(2rem, 1.15rem + 3.4vw, 4.25rem);
    --fs-home-h2: clamp(2.125rem, 1.35rem + 3vw, 3.875rem);
    --fs-feature: clamp(1.75rem, 1.2rem + 2.1vw, 3rem);
    --fs-place: clamp(1.625rem, 1.1rem + 2vw, 2.75rem);
    --fs-row: clamp(1.25rem, 1.05rem + 0.8vw, 1.75rem);
    --fs-kicker: 0.9375rem;
    --fs-route: 0.9375rem;
    --fs-footer-name: clamp(2.5rem, 10.6vw, 12.5rem);

    --lh-hero: 0.96;
    --lh-statement: 1.08;
    --ls-hero: -0.03em;
    --ls-name: -0.04em;

    /* Measures. */
    --w-measure: 40ch;
    --w-measure-narrow: 32ch;

    /* Homepage rhythm. */
    --section-y-home: clamp(3.5rem, 2rem + 4.5vw, 6rem);
    --gap-home: clamp(2rem, 1rem + 3vw, 4.5rem);
    --hero-height-full: max(36rem, min(100svh, 68rem));

    /* Photography. Scrims are tinted with ink, never pure black, and only
       sit where type sits. */
    --c-scrim-hero: color-mix(in srgb, var(--c-ink) 78%, transparent);
    --c-scrim-hero-soft: color-mix(in srgb, var(--c-ink) 34%, transparent);
    --c-scrim-caption: color-mix(in srgb, var(--c-ink) 70%, transparent);
    --c-tile: color-mix(in srgb, var(--c-on-deep) 8%, var(--c-deep));
    --c-header-glass: color-mix(in srgb, var(--c-canvas) 92%, transparent);
    --c-on-photo: var(--c-on-deep);
    --c-on-photo-muted: color-mix(in srgb, var(--c-on-deep) 84%, transparent);
    --c-footer-name: color-mix(in srgb, var(--c-on-deep) 13%, transparent);

    /* Media frames stay square; controls keep --radius-control. */
    --radius-media: 0;

    /* Motion. One entrance curve and one page-transition length. */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --dur-page: 380ms;
    --dur-hero: 1400ms;
    --scale-hover: 1.035;
    --shift-page: 8px;

    /* Stacking. */
    --z-raised: 1;
    --z-overlay: 2;
}

@media (min-width: 768px) {
    :root {
        --gutter: var(--s-8);
    }
}

@media (min-width: 1024px) {
    :root {
        --h-header: var(--h-header-desktop);
    }
}


/**
 * VISUAL TOKEN VARIANTS
 *
 * Component structure is identical across variants. Only token values change.
 * Variant is applied as a data attribute on <html> — see functions.php.
 *
 *   A (default)  Canvas #F4F0E7  Signal #C2761B
 *   B            Canvas #EFEDE6  Signal #C2761B
 *   C            Canvas #F4F0E7  Signal #A96518
 *
 * Text-weight saffron always resolves to --c-signal-text, which holds a
 * WCAG AA contrast ratio against the canvas in every variant.
 */

[data-mp-variant="b"] {
    --c-canvas: #EFEDE6;
    --c-canvas-alt: #E8E5DC;
}

[data-mp-variant="c"] {
    --c-signal: #A96518;
}
}
