/* ============================================================================
   ALCHEMIST HAVEN — DESIGN TOKENS
   The single source of truth for every color, space, size and duration.

   Rule: nothing outside this file declares a raw value.
   No hex codes, no arbitrary px. If you need a value that isn't here,
   the answer is to add it here with a reason — not to inline it.

   Governed by docs/SPEC-002-design-system.md. Enforced by stylelint.
   ============================================================================ */

:root {

	/* ------------------------------------------------------------------
	   1 · PALETTE — raw values. Never reference these directly in
	   component CSS; use the semantic roles in §2 instead.
	   ------------------------------------------------------------------ */

	--ah-cream:        #faf5e4;
	--ah-warm:         #fff8e4;
	--ah-gold:         #b08d3c;   /* DECORATIVE ONLY — fails AA as text on cream */
	--ah-gold-deep:    #856a26;   /* the text-safe gold */
	--ah-rose:         #a83e56;
	--ah-royal:        #7a2d3e;
	--ah-honey:        #d9a441;
	--ah-ink:          #20281b;
	--ah-forest:       #24402a;   /* the trade-secret band (Kyle 2026-10-29, "full width green"): cream 10.45:1, honey 5.07:1 */

	/* lane:spec-026b start — the Aphrodite's Glow label pink (SPEC-026 G2, D-109 KIT request). */
	--ah-orchid:       #b76ca5;   /* DECORATIVE ONLY — the jar label's printed pink, sampled */
	--ah-orchid-deep:  #a82676;   /* the text-safe pink: 6.01:1 on cream, 6.18:1 on warm */
	/* lane:spec-026b end */

	/* Derived. Kept as explicit values so they can be reasoned about. */
	--ah-ink-70:       rgba( 32, 40, 27, .70 );
	--ah-ink-45:       rgba( 32, 40, 27, .45 );
	--ah-gold-34:      rgba( 176, 141, 60, .34 );
	--ah-gold-18:      rgba( 176, 141, 60, .18 );
	--ah-gold-08:      rgba( 176, 141, 60, .08 );

	/* ------------------------------------------------------------------
	   2 · SEMANTIC ROLES — what component CSS actually uses.
	   A role says what a color is FOR, which is what makes it safe to
	   change the palette later without auditing every component.
	   ------------------------------------------------------------------ */

	/* Surfaces */
	--ah-surface:          var( --ah-cream );   /* the page ground */
	--ah-surface-raised:   var( --ah-warm );    /* cards, panels, anything lifted */
	--ah-surface-sunken:   var( --ah-gold-08 ); /* wells, inset areas */

	/* Text — every one of these is AA or better on --ah-surface */
	--ah-text:             var( --ah-ink );
	--ah-text-muted:       var( --ah-ink-70 );  /* captions, meta, secondary */
	--ah-text-subtle:      var( --ah-ink-45 );  /* placeholders, disabled */
	--ah-text-accent:      var( --ah-gold-deep );
	--ah-text-price:       var( --ah-royal );
	--ah-text-sale:        var( --ah-rose );
	--ah-text-on-dark:     var( --ah-cream );

	/* Ornament — decorative marks only. NEVER carries text.
	   This separation is the whole reason the contrast rule holds. */
	--ah-ornament:         var( --ah-gold );
	--ah-ornament-soft:    var( --ah-gold-34 );

	/* A FILLED accent surface. Shares a value with --ah-text-accent today, and
	   that is a coincidence, not a relationship: one paints text, one paints a
	   ground behind text. Using a role named "text" to fill a background is the
	   ornament/text-accent category error one layer down. */
	--ah-surface-accent:   var( --ah-gold-deep );

	/* Transient attention — the just-picked mark, a gradient sweep, a notice
	   border. One role, not three: if a use turns up that is not transient
	   attention, split it then rather than now. */
	--ah-highlight:        var( --ah-honey );

	/* For filter: drop-shadow(), which accepts NO spread — so none of the
	   --ah-shadow-* composites can be reused there. Same ink and depth as
	   --ah-shadow-md, expressed in the three lengths a filter will take.
	   Requested by FRONT, which was otherwise reaching for a raw palette token. */
	--ah-shadow-drop:      0 24px 30px rgba( 32, 40, 27, .45 );

	/* Lines */
	--ah-border:           var( --ah-gold-34 );
	--ah-border-soft:      var( --ah-gold-18 );

	/* Interactive */
	--ah-action:           var( --ah-royal );
	--ah-action-hover:     var( --ah-rose );
	--ah-action-text:      var( --ah-cream );
	--ah-focus:            var( --ah-gold-deep );

	/* ------------------------------------------------------------------
	   3 · SPACING — a 4px grid. Ten steps, no exceptions.
	   Every padding, margin and gap in the theme is one of these.
	   ------------------------------------------------------------------ */

	--ah-space-3xs:   2px;
	--ah-space-2xs:   4px;
	--ah-space-xs:    8px;
	--ah-space-sm:   12px;
	--ah-space-md:   16px;   /* the default gap between related things */
	--ah-space-lg:   24px;
	--ah-space-xl:   32px;
	--ah-space-2xl:  48px;
	--ah-space-3xl:  64px;
	--ah-space-4xl:  96px;

	/* Section rhythm — the vertical beat between page sections.
	   Fluid so the page breathes on desktop without crushing on mobile. */
	--ah-section:      clamp( 48px, 8vw, 96px );
	--ah-section-tight: clamp( 32px, 5vw, 64px );

	/* ------------------------------------------------------------------
	   4 · TYPE
	   ------------------------------------------------------------------ */

	--ah-font-display: "Playfair Display", "Playfair Fallback", Georgia, "Times New Roman", serif;
	--ah-font-body:    "Lora", "Lora Fallback", Georgia, "Times New Roman", serif;

	/* Kit-local aliases, documented rather than migrated.
	   alchemist-ui.css references --ah-display / --ah-body for font-family. They
	   are TYPE, and stage 1 of the migration is colour only — folding them into
	   --ah-font-display / --ah-font-body changes the fallback stack, which is a
	   geometry change that would muddy the colour diff this stage depends on.
	   They are listed here so they are documented, not undocumented-and-live.
	   Re-open with stage 3. */
	--ah-display:      "Playfair Display", "Playfair Fallback", serif;
	--ah-body:         "Lora", "Lora Fallback", Georgia, serif;

	/* Scale — ~1.2 ratio. Rem-based so it respects the user's font size. */
	--ah-size-2xs:   0.72rem;   /* tracked caps, badges, chips */
	--ah-size-xs:    0.8rem;
	--ah-size-sm:    0.875rem;
	--ah-size-base:  1rem;      /* body */
	--ah-size-md:    1.125rem;
	--ah-size-lg:    1.25rem;
	--ah-size-xl:    1.5rem;
	--ah-size-2xl:   1.875rem;
	--ah-size-3xl:   2.5rem;
	--ah-size-4xl:   3.25rem;

	/* Fluid display sizes. ONE clamp formula shape, three steps —
	   so headings scale together instead of drifting apart. */
	--ah-display-sm: clamp( 1.5rem,  1.2rem + 1.5vw, 1.875rem );
	--ah-display-md: clamp( 1.875rem, 1.4rem + 2.4vw, 2.5rem );
	--ah-display-lg: clamp( 2.5rem,  1.8rem + 3.5vw, 3.25rem );

	/* Line height */
	--ah-leading-none:    1;
	--ah-leading-tight:   1.12;   /* display headings */
	--ah-leading-snug:    1.3;    /* subheads */
	--ah-leading-normal:  1.6;    /* body — do not go below this for paragraphs */
	--ah-leading-relaxed: 1.75;   /* long-form: Her Story, Diary */

	/* Letter spacing */
	--ah-tracking-tight:  -0.01em;
	--ah-tracking-normal:  0;
	--ah-tracking-wide:    0.06em;
	--ah-tracking-wider:   0.12em;
	--ah-tracking-caps:    0.16em;  /* the signature tracked small-caps */

	/* Weight */
	--ah-weight-normal:   400;
	--ah-weight-medium:   500;
	--ah-weight-semibold: 600;
	--ah-weight-bold:     700;

	/* ------------------------------------------------------------------
	   5 · SHAPE
	   ------------------------------------------------------------------ */

	--ah-radius-sm:   8px;
	--ah-radius:     12px;
	--ah-radius-lg:  20px;
	--ah-radius-pill: 999px;

	--ah-shadow-sm:  0 4px 12px -8px rgba( 32, 40, 27, .30 );
	--ah-shadow:     0 10px 30px -18px rgba( 32, 40, 27, .35 );
	--ah-shadow-lg:  0 24px 60px -28px rgba( 32, 40, 27, .40 );

	--ah-border-width:       1px;
	--ah-border-width-thick: 2px;

	/* ------------------------------------------------------------------
	   6 · MOTION
	   All of it is suppressed under prefers-reduced-motion — see §9.
	   ------------------------------------------------------------------ */

	--ah-ease:       cubic-bezier( .33, .02, .2, 1 );
	--ah-ease-out:   cubic-bezier( .16, 1, .3, 1 );

	--ah-duration-fast:  120ms;
	--ah-duration:       240ms;
	--ah-duration-slow:  480ms;
	--ah-duration-reveal: 800ms;  /* the base reveal (DIRECTION §2): everything that enters */
	--ah-stagger-reveal:  100ms;  /* between items of one entering batch */

	/* lane:spec-038p1 start — SPEC-038 P1 (D-142, DIRECTION §2): the showpieces' motion tokens. */
	--ah-ease-in-out:     cubic-bezier( .85, 0, .15, 1 );   /* travel across a large distance: page-level moves, pinned scenes */
	--ah-ease-spring:     cubic-bezier( .34, 2.27, .64, 1 ); /* the Button 046 hover overshoot, and any small "lands with life" */
	--ah-duration-travel: 1200ms; /* a long move a reader follows; zeroed under reduced motion (§9) */
	/* lane:spec-038p1 end */

	/* ------------------------------------------------------------------
	   7 · LAYOUT
	   ------------------------------------------------------------------ */

	--ah-measure:        68ch;    /* max line length for readable prose */
	--ah-container:    1200px;
	--ah-container-narrow: 760px; /* Her Story, Diary, legal pages */
	--ah-gutter:       clamp( 16px, 4vw, 32px );

	--ah-touch-target:   44px;    /* WCAG 2.5.5 minimum. Never smaller. */

	/* Header actions and the bag (SPEC-022 §10, D-137): a line icon's glyph and
	   stroke inside the 44px target, the royal count badge, and the two cart
	   thumbnails (the drawer's and the hover preview's). */
	--ah-icon-size:      22px;
	--ah-icon-stroke:    1.5px;
	--ah-badge-size:     18px;
	--ah-badge-type:     10.5px;
	--ah-thumb:          56px;
	--ah-thumb-sm:       40px;

	/* Z-index — a named ladder beats scattered magic numbers */
	--ah-z-base:        0;
	--ah-z-raised:      10;
	--ah-z-sticky:     100;
	--ah-z-header:     200;
	--ah-z-overlay:    300;
	--ah-z-modal:      400;
	--ah-z-progress:   500;   /* the scroll progress line — above an open drawer */

	/* The masthead (SPEC-022 §1-§3, D-116). `--ah-header-height` is GONE: it
	   said 172px while the masthead measured 102.6-165px, and a token that
	   describes a layout nobody has is worse than no token.

	   The header is sticky at `top: admin-offset - band-h`, so the band slides
	   out above the viewport and the bar holds. Neither box ever changes
	   height on scroll — the "shrink" is the band leaving, not the bar
	   shortening, because a sticky element that shortens moves every element
	   below it.

	   Anything that must clear the header reads BAR + ADMIN OFFSET. Hash links
	   and scrollIntoView() already get that from `html { scroll-padding-top }`
	   in ah-chrome.css, so a scroll-margin that adds it again double-counts. */
	--ah-bar-h:          64px;   /* the sticky bar. Fixed; never animated */
	--ah-band-h:          0px;   /* the brand band: retired at every width (Kyle 2026-10-29, "the logo has to be horizontal with the menu items"); was 88px >=768px */
	--ah-progress-h:      3px;   /* the progress line's thickness */
	--ah-admin-offset:    0px;   /* WP admin bar; set below, only when present */

	/* The wordmark image (SPEC-023), sized by height; width follows its 901:286
	   ratio. logo-h is the brand band, mark-h is the bar (the compact mark, and
	   the brand itself below 768px). */
	--ah-brand-logo-h:   52px;
	--ah-brand-mark-h:   36px;

	/* ------------------------------------------------------------------
	   8 · ORNAMENT ASSETS
	   ------------------------------------------------------------------ */

	--ah-trellis: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><g fill='none' stroke='%23b08d3c' stroke-opacity='.6'><circle cx='60' cy='60' r='36'/><circle cx='0' cy='0' r='36'/><circle cx='120' cy='0' r='36'/><circle cx='0' cy='120' r='36'/><circle cx='120' cy='120' r='36'/></g><path d='M60 53 l2.6 4.5 -2.6 4.5 -2.6 -4.5 z' fill='%23b08d3c' fill-opacity='.4'/></svg>");
	--ah-caret:   url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23856a26' stroke-width='1.6' stroke-linecap='round'/></svg>");
}

/* ----------------------------------------------------------------------------
   7b · MASTHEAD — width- and admin-bar-dependent values
   `:root:has(> body.admin-bar)` and not `body.admin-bar`: a property set on
   body does not inherit UP to html, and `scroll-padding-top` lives on html.
   The widths are core's own — the admin bar is 46px at 782px and down, and
   below 601px it is `position: absolute`, so it scrolls away and offsets
   nothing. 767.98px is the band breakpoint (D-043's 768).
   ---------------------------------------------------------------------------- */

@media ( max-width: 767.98px ) {

	:root {
		--ah-band-h: 0px;
	}
}

/* In @supports so tools/scripts/token-drift.cjs — which strips @media and
   @supports blocks to find BASE values — does not read this conditional 32px
   as the base declaration (it did: "declared 32px, live 0px"). A browser
   without :has() would ignore the rule either way. */
@supports selector(:has(*)) {

	:root:has(> body.admin-bar) {
		--ah-admin-offset: 32px;
	}
}

@media ( max-width: 782px ) {

	:root:has(> body.admin-bar) {
		--ah-admin-offset: 46px;
	}
}

@media ( max-width: 600px ) {

	:root:has(> body.admin-bar) {
		--ah-admin-offset: 0px;
	}
}

/* ----------------------------------------------------------------------------
   9 · REDUCED MOTION
   Zeroing the duration tokens kills every transition and animation that uses
   them, in one place, instead of per-component overrides.
   ---------------------------------------------------------------------------- */

@media ( prefers-reduced-motion: reduce ) {
	:root {
		--ah-duration-fast: 0ms;
		--ah-duration:      0ms;
		--ah-duration-slow: 0ms;
		--ah-duration-reveal: 0ms;
		--ah-stagger-reveal:  0ms;
		/* lane:spec-038p1 start */
		--ah-duration-travel: 0ms;
		/* lane:spec-038p1 end */
	}
}

/* ----------------------------------------------------------------------------
   10 · BREAKPOINTS — reference only.
   Custom properties DO NOT work inside media queries. These are written here
   so the numbers live in one place; use the literal values in @media and keep
   them matching this list.

       --ah-bp-sm    480px    large phone
       --ah-bp-md    768px    tablet / the kit's existing single breakpoint
       --ah-bp-lg   1024px    small laptop
       --ah-bp-xl   1280px    desktop
   ---------------------------------------------------------------------------- */

/* lane:spec-022p2 start */
/* Warrior line name (Uncial Antiqua) in the nav card and drawer row: 8.6:1 on --ah-surface (Warrior 02 §10, SPEC-022 NB1(a)). */
:root {
	--ah-steel: #3d4756;
}
/* lane:spec-022p2 end */

/* lane:spec-030 start */
/*
 * Warrior Pain Relief (SPEC-030 §5, design warrior/02 §1). Measured from the tin label
 * and the hero plates, not picked: --ah-mist is the source's top edge (the stage ground
 * under the bar), --ah-mother is the mean of the label's "The Mother" ink (PROVENANCE;
 * 8.35:1 on cream, 8.59:1 on warm, 7.12:1 on mist) and is the only red on the page.
 * --ah-steel ships with the nav (spec-022p2 above).
 */
:root {
	--ah-mist: #dfe4ea;
	--ah-steel-deep: #252c36;
	--ah-mother: #911312;
}
/* lane:spec-030 end */
