/* ==========================================================================
   tokens.css: the ONLY place a colour, size, radius, shadow or easing value is
   written. Every other stylesheet reads these; the sprite, the cursors and the
   trims in assets/trim/ bake the same hexes where CSS cannot reach.
   Look: pink and cocoa lace, milky and faded (palette v2). Dusty pink, cocoa
   and cream, nothing else. No text ever sits directly on the pale bands.
   Soft and low contrast: tone-on-tone stripes and pin dots, white scalloped
   lace, one pale rose stitch line, a 4px cocoa outline and soft shadows.
   Mixes and alphas are made only with color-mix() from the palette below.
   Text pairs (computed, WCAG 2.x):
     cocoa on lace 7.8, cream 7.4, blush-50 6.9, blush 6.2
     rose-800 on lace 6.2, cream 5.8, blush-50 5.5, blush 4.9, placeholder band 4.9
     cream on mocha-700 4.9 (title ribbon; 4.6 on its lightest fabric stripe)
     cocoa-900 on petal 6.2, on the petal dots 7.6, on the darkest multiplied fabric about 5
   ========================================================================== */

:root {
  /* ---------- palette (shared contract A; values are final) ---------- */
  --c-cocoa-900: #4b3a37;  /* deepest cocoa, rare (focus ring: 9.8:1 on cream, 3.2 on the band) */
  --c-cocoa: #604b47;      /* card outline, body text, outline of drawn art (7.4:1 on cream) */
  --c-mocha-700: #7a6561;  /* taupe fills that carry cream text: title ribbon, icon circles, rule numbers (4.9:1) */
  --c-mocha: #9c8884;      /* band colour and stripe dark tone: pale, NO text on it */
  --c-mocha-300: #a6938f;  /* stripe light tone, quiet accents */
  --c-rose-800: #84505b;   /* rose text on cream or blush (headings, link text, fact titles) */
  --c-rose-700: #925c68;   /* small accents only; no large surface uses it */
  --c-rose-600: #a8727d;   /* small accents only; no large surface uses it */
  --c-rose: #bf8a94;       /* decorative only: bow, accents (cream text on it fails) */
  --c-rose-300: #d4a9b0;   /* small hearts */
  --c-rose-200: #e0c2c4;   /* the dashed stitch line, pill edge, top strip, lace eyelets */
  --c-blush: #f0dedc;      /* page background, fact boxes, icon circles on cream tiles */
  --c-blush-50: #f6ebe8;   /* card body, pin dots */
  --c-cream: #faf3ec;      /* panels, tiles, labels, text on dark fills */
  --c-lace: #fdfaf6;       /* lace, link pills, photo frames */
  --c-petal: #dabebd;      /* faded pink cloth: text ribbon, active tab, order pill. Text on it: cocoa-900 only (6.2:1) */
  --c-petal-base: #e8dadb; /* under the blush fabric multiplied over it, lands near --c-petal */

  /* ---------- derived mixes and alphas (only from the palette) ---------- */
  --c-cocoa-a12: color-mix(in srgb, var(--c-cocoa) 12%, transparent);  /* faint contact shadow */
  --c-cocoa-a22: color-mix(in srgb, var(--c-cocoa) 22%, transparent);  /* soft shadow, patch drop shadow */
  --c-cocoa-a35: color-mix(in srgb, var(--c-cocoa) 35%, transparent);  /* deeper soft shadow (card) */
  --c-backdrop: color-mix(in srgb, var(--c-cocoa-900) 58%, transparent); /* gallery viewer ::backdrop */
  --c-hl: var(--c-blush);                                                 /* ==highlight== band (cocoa text on it 7.4:1) */
  --c-ph-band: color-mix(in srgb, var(--c-rose-200) 45%, var(--c-cream)); /* "to fill" band on light surfaces */
  --c-error: color-mix(in srgb, var(--c-rose-800) 70%, var(--c-cocoa-900)); /* #734950: errors, 6.8:1 on cream, 5.8 on blush, always with icon and words */
  --c-stitch: var(--c-rose-200);                                          /* the one stitch line colour */
  --c-ribbon-base: color-mix(in srgb, var(--c-mocha) 55%, var(--c-cream)); /* under fabric-cocoa multiplied: the title ribbon lands near mocha-700 */

  /* ---------- sprite paint slots (assets/sprite.svg reads these; set per use in the page CSS) ---------- */
  --sp-fill: var(--c-rose-300);     /* main body of a small drawing (hearts, stars) */
  --sp-fill-2: var(--c-rose);       /* secondary fill */
  --sp-thread: var(--c-cream);      /* line work of line icons */
  --sp-shine: color-mix(in srgb, var(--c-lace) 45%, transparent); /* gloss highlight */
  --sp-hole: var(--c-cocoa);        /* darkest detail */
  --sp-paper: var(--c-cream);       /* paper parts inside drawings */

  /* ---------- lettering (switch with html[data-lettering]; default in index.html = set 2) ----------
     display = names, titles, order label; label = tabs, links, small labels; text = body copy (hand font). */
  --font-display: 'Fredoka', 'Nunito', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --font-label: 'Gaegu', 'Segoe Print', 'Comic Sans MS', cursive;
  --font-text: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; /* page body: replaced by each set's hand font */
  --font-serif: 'Fraunces', 'Iowan Old Style', Georgia, 'Times New Roman', serif; /* the editor's headings only */
  --display-weight: 600;
  --display-scale: 1;          /* multiplies display sizes to balance sets */
  --display-lh: 1.05;
  --display-track: 0;          /* em */
  --label-weight: 700;
  --label-bold: 700;
  --label-scale: 1;            /* multiplies label sizes (Gaegu and Patrick Hand run small) */
  --label-lh: 1.1;
  --text-weight: 400;          /* body copy weight */
  --text-scale: 1;             /* multiplies body copy size */
  --text-lh: 1.5;              /* body line-height */
  --c-body: var(--c-cocoa);    /* body copy colour (set 2: cocoa-900) */
  --price-weight: 600;         /* price chips (display font, tabular figures) */

  /* ---------- type sizes (phone values; desktop in the media query below) ---------- */
  --fs-banner-raw: 30px;       /* tab title on the mocha ribbon */
  --fs-name-raw: 25px;         /* client name on the cream ribbon */
  --fs-links-title-raw: 26px;  /* "my links" */
  --fs-badge-raw: 26px;        /* "order here!": cocoa-900 lettering on the petal cloth of the order pill */
  --fs-tab-raw: 17px;          /* tab labels */
  --fs-link-raw: 19px;         /* link pill labels */
  --fs-sub-raw: 16px;          /* banner subtitle, tagline, small labels */
  --fs-h3-raw: 19px;           /* rule titles, menu category, fact labels */
  --fs-small-raw: 15px;        /* captions, notes, "link not set" (never below 14px) */
  --fs-marquee-raw: 16px;      /* text ribbon */
  --fs-text-raw: 17px;         /* body copy */
  --fs-price: 17px;            /* price chip */
  --fs-num: 19px;              /* number in the rule circles */
  --fs-min: 14px;              /* hard floor for any rendered text */

  --fs-banner: calc(var(--fs-banner-raw) * var(--display-scale));
  --fs-name: calc(var(--fs-name-raw) * var(--display-scale));
  --fs-links-title: calc(var(--fs-links-title-raw) * var(--display-scale));
  --fs-badge: max(19px, calc(var(--fs-badge-raw) * var(--display-scale)));
  --fs-tab: calc(var(--fs-tab-raw) * var(--label-scale));
  --fs-link: calc(var(--fs-link-raw) * var(--label-scale));
  --fs-sub: max(var(--fs-min), calc(var(--fs-sub-raw) * var(--label-scale)));
  --fs-h3: calc(var(--fs-h3-raw) * var(--label-scale));
  --fs-small: max(var(--fs-min), calc(var(--fs-small-raw) * var(--label-scale)));
  --fs-marquee: calc(var(--fs-marquee-raw) * var(--label-scale));
  --fs-text: max(var(--fs-min), calc(var(--fs-text-raw) * var(--text-scale)));
  --fs-text-small: max(var(--fs-min), calc((var(--fs-text-raw) - 2px) * var(--text-scale)));

  /* ---------- layout ---------- */
  --quilt-w: min(calc(100vw - 16px), 480px);  /* phone card width (desktop value below) */
  --side-w: 340px;             /* desktop links column */
  --binding: 4px;              /* cocoa card outline, exactly 4px */
  --stitch: 2px;               /* the dashed stitch line (palest rose: 2px so it stays visible) */
  --stitch-inset: 6px;         /* stitch frame distance from the panel edge */
  --strip-h: 12px;             /* rose top strip inside the card */
  --lace-h: 12px;              /* scalloped lace edge height */
  --stripe-w: 12px;            /* one stripe repeat (6px dark + 6px light) */
  --dots-w: 18px;              /* pin dot repeat */
  --gap-xs: 4px;
  --gap-s: 8px;
  --gap-m: 12px;
  --gap-l: 18px;
  --gap-xl: 26px;
  --tap: 44px;                 /* minimum touch target */
  --marquee-h: 38px;           /* text ribbon height (42px desktop) */
  --tab-h: 83px;               /* tab tile height (94px desktop): disc and tag sit inside the stitched frame */
  --tab-dot: 30px;             /* cream disc behind a tab icon (36px desktop) */
  --tab-icon: 19px;            /* tab icon (23px desktop) */
  --photo-d: 96px;             /* photo diameter inside the lace ring (124px desktop) */
  --lace-ring: 9px;            /* width of the lace ring around the photo (11px desktop) */
  --link-h: 56px;              /* link pill height (52px desktop): fits a label plus a state line */
  --link-dot: 32px;            /* mocha disc behind a link icon (28px desktop): its stitched ring keeps 3px from the pill's stitch */
  --link-icon: 20px;           /* link icon (19px desktop) */
  --round-button: 48px;        /* round controls: pager, viewer prev/next */
  --close-button: 50px;        /* viewer close button */
  --rule-num: 38px;            /* rule number circle */

  /* ---------- radii ---------- */
  --r-quilt: 26px;             /* card outer corners */
  --r-block: 18px;             /* the two panels (20px desktop) */
  --r-tile: 14px;              /* tab tiles, fact boxes (16px desktop) */
  --r-chip: 10px;              /* price chips, photo frames */
  --r-pill: 999px;             /* pills and circles */

  /* ---------- shadows: soft only, never solid slabs ---------- */
  --sh-card: 0 2px 3px var(--c-cocoa-a12), 0 18px 40px -14px var(--c-cocoa-a35);   /* under the card */
  --sh-panel: 0 1px 2px var(--c-cocoa-a12), 0 6px 16px -10px var(--c-cocoa-a22);   /* panels and labels */
  --sh-tile: 0 2px 0 var(--c-cocoa-a12), 0 6px 12px -6px var(--c-cocoa-a35);       /* tab tiles at rest */
  --sh-tile-pressed: 0 0 0 var(--c-cocoa-a12), 0 2px 4px -2px var(--c-cocoa-a35);   /* tab tiles pressed */
  --sh-pill: 0 1px 2px var(--c-cocoa-a12);                                           /* link pills at rest */
  --sh-pill-hover: 0 3px 4px var(--c-cocoa-a12), 0 10px 16px -10px var(--c-cocoa-a35); /* link pills lifted */
  --sh-order: 0 9px 16px -9px var(--c-cocoa-a35);                                      /* order pill: a soft ground shadow, nothing that thickens its outline */
  --sh-viewer: 0 24px 60px -20px var(--c-cocoa-a35);                                 /* viewer frame */

  /* ---------- focus: deep cocoa ring everywhere ---------- */
  --focus-color: var(--c-cocoa-900);      /* 9.8:1 on cream, 8.2 on blush, 3.2 on the pale band */
  --focus-color-on-dark: var(--c-cream);  /* spare: cream ring for dark fills (none on the page now) */
  --focus-w: 3px;
  --focus-offset: 3px;

  /* ---------- motion ---------- */
  --ease: cubic-bezier(.2, .8, .2, 1);           /* default ease-out */
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1); /* springy return */
  --dur-press: 90ms;          /* press sink */
  --dur-hover: 180ms;         /* hover lift */
  --dur-bounce: 460ms;        /* link icon circle bounces once on hover */
  --dur-tab-out: 120ms;       /* page content fades out */
  --dur-tab-in: 220ms;        /* page content fades in */
  --dur-banner: 260ms;        /* banner ribbon flip */
  --dur-viewer: 260ms;        /* gallery viewer open */
  --dur-copied: 1800ms;       /* "copied!" state */
  --dur-fx-max: 900ms;        /* cursor click effects must be gone by this */
  --dur-fade-reduced: 120ms;  /* the only animation under reduced motion */
  --dur-reveal: 150ms;        /* the words fade in together once the page is ready (none under reduced motion) */
  --marquee-speed: 40;        /* text ribbon speed, px per second (unitless, read by marquee.mjs) */

  /* ---------- stacking ---------- */
  --z-quilt: 1;               /* the card */
  --z-patch: 3;               /* the bow and the sparkle */
  --z-marquee: 4;             /* text ribbon */
  --z-cursor-fx: 9999;        /* click effects layer */
}

/* ---------- lettering set 1: DynaPuff + Shantell Sans ---------- */
html[data-lettering="1"] {
  --font-display: 'DynaPuff', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --font-label: 'Shantell Sans', 'Segoe Print', 'Trebuchet MS', system-ui, sans-serif;
  --font-text: 'Shantell Sans', 'Segoe Print', 'Trebuchet MS', system-ui, sans-serif;
  --display-weight: 600;
  --display-scale: .96;
  --display-lh: 1.05;
  --display-track: 0;
  --label-weight: 500;
  --label-bold: 650;
  --label-scale: .94;
  --label-lh: 1.15;
  --text-weight: 400;
  --text-scale: .96;
  --text-lh: 1.55;
}

/* ---------- lettering set 2 (default): Borel + Patrick Hand.
   Borel is a hairline script with tall loops: only for the four big words (name, plate title, "my links",
   order label), large, thickened with a stroke painted under the fill (counters stay open), with a tall line box.
   Patrick Hand (one weight) sets everything else, clearly bigger than the other sets, with a little air. ---------- */
html[data-lettering="2"] {
  --font-display: 'Borel', 'Segoe Script', 'Brush Script MT', cursive;
  --font-label: 'Patrick Hand', 'Segoe Print', 'Comic Sans MS', cursive;
  --font-text: 'Patrick Hand', 'Segoe Print', 'Comic Sans MS', cursive;
  --display-weight: 400;
  --display-scale: 1;
  --display-lh: 1.6;
  --display-track: 0;
  --display-stroke: .6px;      /* Borel thickened (paint-order: stroke fill) */
  --label-weight: 400;
  --label-bold: 400;
  --label-scale: 1;
  --label-lh: 1.25;
  --label-track: .01em;
  --label-stroke: .25px;       /* a touch of weight for Patrick Hand on taupe and petal */
  --text-weight: 400;
  --text-scale: 1;
  --text-lh: 1.5;
  --text-track: .01em;
  --c-body: var(--c-cocoa-900);
  /* sizes for this set (phone; desktop below) */
  --fs-name: 29px;
  --fs-banner: 34px;
  --fs-links-title: 30px;
  --fs-badge: 28px;
  --fs-tab: 19px;
  --fs-link: 20px;
  --fs-sub: 17px;
  --fs-h3: 21px;
  --fs-small: 16px;
  --fs-marquee: 18px;
  --fs-text: 20px;
  --fs-text-small: 18px;
  --fs-price: 19px;
}
@media (min-width: 960px) {
  html[data-lettering="2"] {
    --fs-name: 40px;
    --fs-banner: 46px;
    --fs-links-title: 36px;
    --fs-badge: 32px;
    --fs-tab: 20px;
    --fs-sub: 18px;
    --fs-text: 21px;
  }
}
@media (min-width: 360px) and (max-width: 389px) {
  html[data-lettering="2"] { --fs-name: 26px; }
}
@media (max-width: 359px) {
  html[data-lettering="2"] { --fs-name: 24px; --fs-banner: 30px; --fs-tab: 17px; --fs-link: 19px; }
}

/* ---------- lettering set 3 (default): Fredoka + Gaegu. Gaegu's x-height is small (0.37em):
   labels and text scale up; Gaegu ships 400 and 700 only. ---------- */
html[data-lettering="3"] {
  --font-display: 'Fredoka', 'Nunito', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --font-label: 'Gaegu', 'Segoe Print', 'Comic Sans MS', cursive;
  --font-text: 'Gaegu', 'Segoe Print', 'Comic Sans MS', cursive;
  --display-weight: 600;
  --display-scale: 1;
  --display-lh: 1.05;
  --display-track: .01em;
  --label-weight: 700;
  --label-bold: 700;
  --label-scale: 1.16;
  --label-lh: 1.05;
  --label-track: -.05em;       /* Gaegu's wide side bearings (sets 1 and 2 leave it unset) */
  --text-weight: 700;          /* Gaegu's regular is hairline-thin at text sizes; its bold reads like a soft pen */
  --text-scale: 1.26;          /* 17.5px raw -> 22px: Gaegu stays readable */
  --text-lh: 1.36;
  --text-track: -.055em;       /* Gaegu's wide side bearings in body copy */
  --text-word: -.12em;         /* and its wide word space */
}

/* ---------- small phones (320 to 359) ---------- */
@media (max-width: 359px) {
  :root {
    --fs-banner-raw: 26px;
    --fs-name-raw: 22px;
    --fs-tab-raw: 15px;
    --fs-link-raw: 17px;
    --tab-h: 83px;
    --tab-dot: 28px;
    --tab-icon: 18px;
    --photo-d: 80px;
    --lace-ring: 8px;
  }
}

/* ---------- desktop (two-column card) ---------- */
@media (min-width: 960px) {
  :root {
    --fs-banner-raw: 40px;
    --fs-name-raw: 34px;
    --fs-links-title-raw: 30px;
    --fs-badge-raw: 30px;
    --fs-tab-raw: 19px;
    --fs-link-raw: 20px;
    --fs-sub-raw: 17px;
    --fs-h3-raw: 20px;
    --fs-small-raw: 15px;
    --fs-marquee-raw: 17px;
    --fs-text-raw: 18.5px;
    --fs-price: 18px;
    --fs-num: 20px;
    --quilt-w: min(1000px, calc(100vw - 80px));
    --marquee-h: 42px;
    --tab-h: 98px;
    --tab-dot: 36px;
    --tab-icon: 23px;
    --photo-d: 124px;
    --lace-ring: 11px;
    --link-h: 52px;
    --link-dot: 28px;
    --link-icon: 19px;
    --rule-num: 42px;
    --r-block: 20px;
    --r-tile: 16px;
  }
}

/* ==========================================================================
   LEGACY ALIASES for the editor (admin/admin.css still reads the old cherry
   names). They map onto the new palette so the editor turns pink and cocoa.
   The public page must not use these names. Text pairs the editor uses:
   wine-700 (cocoa-900) on linen-200 (blush) 8.2, its 80% mix 4.7; ink on
   milk-50 5.8; milk-50 on cherry 4.8; error on milk-50 6.8.
   ========================================================================== */
:root {
  --c-wine-900: var(--c-cocoa-900);
  --c-wine-700: var(--c-cocoa-900);     /* deepest cocoa so the editor's muted mix (80%) passes on blush */
  --c-cherry: var(--c-rose-700);
  --c-cherry-400: var(--c-rose);        /* decoration only */
  --c-ink: var(--c-rose-800);
  --c-linen-200: var(--c-blush);
  --c-linen-100: var(--c-blush-50);
  --c-milk-100: color-mix(in srgb, var(--c-cream) 50%, var(--c-blush-50));
  --c-milk-50: var(--c-cream);
  --c-band: var(--c-blush);
  --c-ok: #4f6f52;                      /* editor "live" state only; never on the public page */
  --c-wine-a10: color-mix(in srgb, var(--c-cocoa-900) 10%, transparent);
  --c-wine-a30: color-mix(in srgb, var(--c-cocoa-900) 30%, transparent);
  --c-wine-a45: color-mix(in srgb, var(--c-cocoa-900) 45%, transparent);
  --c-milk-a35: color-mix(in srgb, var(--c-cream) 35%, transparent);
  --font-body: var(--font-serif);       /* the editor's headings stay in the plain serif (admin has no data-lettering) */
  --focus-outline: var(--focus-w) solid var(--c-cocoa-900);
  --sh-quilt: 0 1px 0 var(--c-wine-a45), 0 12px 26px -10px var(--c-wine-a30), 0 30px 60px -24px var(--c-wine-a30);
  --sh-button: inset 0 -3px 0 var(--c-wine-a30), inset 0 2px 0 var(--c-milk-a35), 0 2px 3px var(--c-wine-a45);
}
