/* ============================================================
   CHI SHAN — 栖山
   The shared system: tokens, base type, and the parts every page shares.
   DIRECTION STUDY "Paper & Seal, finished" (branch dir/original, 2026-11-20), on the
   her-site wave's system: the original's celadon paper and its grain (as a ground, never
   over a photograph), EB Garamond to read, letterspaced serif capitals as the label voice,
   Cormorant with its green italic second line, square ink buttons; her deep green, the
   seal red sampled from her logo, brass as decoration only; Noto Serif SC for characters.
   Her hand draws, ours sets: every brush, mountain and seal on a page is cut from her
   own logo file; our side only sets type and rules.
   This :root is the one place a colour, a face or a size is declared.

   Fonts load from <link> tags in each page's head (the frame's SiteHead), never
   from a CSS @import. Without them every stack below falls back cleanly.
   ============================================================ */

/* ============================================================
   TOKENS — the contract (brief § 2). Names are fixed; values are the brief's.
   ============================================================ */
:root {
  color-scheme: light;

  /* ---- Colour. Direction study "Paper & Seal, finished" (2026-11-20): the original's
     celadon card stock is the page again, the raised paper its alternate band; her deep
     green keeps the one dark band. Ratios: WCAG formula, run 2026-11-20 on these hexes. ---- */
  --paper: #ebede2;          /* the original's celadon paper, read off her printed card: the page ground */
  --band: #f3f4ec;           /* the original's raised paper (paper-2): the alternate ground for a section */
  --ink: #2c3727;            /* headings, body, focus ring, the solid button — 10.54 on paper, 11.27 on band */
  --ink-soft: #3f4c38;       /* every quieter line — 7.71 on paper, 8.24 on band */
  --pine: #46553c;           /* the original's pine green: the label voice, the menu's small words — 6.76 / 7.22 */
  --green: #384333;          /* hers: the one dark band — paper on it 8.79 */
  --moss: #55654a;           /* the second voice of a heading (the original's green-mid, a step deeper) — 5.30 / 5.67 */
  --moss-light: #bfcda2;     /* the second voice on the green band — 6.18 */
  --on-green-soft: #cfd4c6;  /* ledes, captions, labels on the green band — 6.88 */
  --seal: #aa1c11;           /* sampled from her seal: the nav's current dot, a form error, her logo. Never a button, link or heading */
  --brass: #b5a880;          /* decoration only: the footer lockup's rule, the one mat's inner edge. Never text */
  --brass-deep: #857248;     /* a text link's underline (a non-text cue: 3.95 / 4.22) */
  --line: #c7cdb8;           /* the original's hairline: it only separates */
  --line-strong: #7a806c;    /* lines a person must see: field underlines, pipes, control rings — 3.46 / 3.70 */
  /* The paper grain of her card stock. Drawn as a BACKGROUND of each ground, never as a layer
     over the page, so a photograph sits on top of it, undimmed (the reason the grain was retired). */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .17 0 0 0 0 .22 0 0 0 0 .15 .16 0 0 0 -.04'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --line-on-green: rgba(244, 241, 233, .22);
  --night: #172019;          /* the lightbox backdrop, the film's ground */
  --night-scrim: color-mix(in srgb, var(--night) 94%, transparent);  /* the lightbox backdrop */
  --night-disc: color-mix(in srgb, var(--night) 60%, transparent);   /* the expand glyph's disc on a photo */
  --well-on-green: rgba(244, 241, 233, .08);
  --well: var(--band);       /* a photo well's ground: band on paper (the .ground-* classes reset it) */
  --glyph-ghost: color-mix(in srgb, var(--ink) 9%, var(--band));     /* the home hero's empty-state 栖 (brief § 5.1) */

  /* ---- Faces: the original's. Cormorant Garamond for display, EB Garamond to read and
     for the label voice (letterspaced serif capitals), Noto Serif SC for every Chinese
     character — body included, so both languages read in one serif hand (the build cuts
     the face to each page's own characters, scripts/cjk-font-subset.mjs). ---- */
  --display: "Cormorant Garamond", "Noto Serif SC", Georgia, serif;
  --body: "EB Garamond", "Noto Serif SC", "Songti SC", Georgia, serif;
  --label: var(--body);
  --cjk: "Noto Serif SC", "Songti SC", serif;

  /* ---- Spacing, grid, radii (brief § 2.5) ---- */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 120px;
  --section-y: clamp(64px, 8vw, 120px);
  --maxw: 1280px;                         /* the content width, gutters outside it */
  --gutter: clamp(20px, 5vw, 80px);
  --grid-gap: 24px;
  --r-control: 2px;                       /* buttons and inputs; 0 everywhere else */
  --header-h: 76px;
  --scroll-pad: 92px;

  /* ---- Motion (brief § 6) ---- */
  --ease: cubic-bezier(.22,.61,.36,1);
  --dur-hover: 150ms;
  --dur-menu: 160ms;
  --dur-lightbox: 200ms;
  --dur-zoom: 600ms;
}

/* ---- The type scale (brief § 2.3): nothing under 13 px, in either language.
   English values; [lang|="zh"] below restates the Chinese ones. Each step is a size
   (--t-*), a line-height (--lh-*), and for headings a weight (--w-*) and tracking
   (--track-*). Declared on an element that carries a lang attribute, so a Chinese
   page or a Chinese run picks up its own scale, and a component may still set a step
   locally for its children. ---- */
:root, [lang|="en"] {
  --t-floor: 13px;
  --t-label: 13px;  --lh-label: 1.5;  --track-label: .16em;  /* her card's spaced capitals */
  --t-small: 16px;  --lh-small: 1.55;
  --t-body: 19px;   --lh-body: 1.6;
  --t-lede: 21px;   --lh-lede: 1.55;
  --t-h4: 25px;                       --lh-h4: 1.2;   --w-h4: 500;
  --t-h3: clamp(26px, 2.2vw, 32px);   --lh-h3: 1.15;  --w-h3: 500;
  --t-h2: clamp(36px, 4.4vw, 62px);   --lh-h2: 1.06;  --w-h2: 400;  --track-h2: -.012em;
  --t-h1: clamp(46px, 6vw, 88px);     --lh-h1: 1.02;  --w-h1: 400;  --track-h1: -.015em;
  --t-price: clamp(44px, 4vw, 60px);  --lh-price: 1;
  --t-inscription: 28px; --track-inscription: .32em;
  --measure: 34em;                    /* body and ledes; about 68 characters, or 34 Chinese */
  --track: var(--track-label);
  --track-wide: .3em;                 /* the widest label: a place, or her values */
}
@media (max-width: 760px) {
  :root { --header-h: 60px; --scroll-pad: 76px; }
  :root, [lang|="en"] {
    --t-body: 18px;
    --t-lede: 19px;
    --t-h4: 23px;
    --t-inscription: 20px;
    --track-label: .13em;
    --track-wide: .22em;
  }
}
[lang|="zh"] {
  --t-label: 14px;  --lh-label: 1.6;  --track-label: .2em;
  --t-small: 15px;  --lh-small: 1.85;
  --t-body: 16px;   --lh-body: 1.95;
  --t-lede: 18px;   --lh-lede: 1.85;
  --t-h4: 20px;                       --lh-h4: 1.45;  --w-h4: 500;
  --t-h3: clamp(22px, 1.9vw, 26px);   --lh-h3: 1.4;   --w-h3: 500;
  --t-h2: clamp(28px, 3.3vw, 46px);   --lh-h2: 1.35;  --w-h2: 500;  --track-h2: 0;
  --t-h1: clamp(36px, 4.8vw, 68px);   --lh-h1: 1.3;   --w-h1: 500;  --track-h1: 0;
  --track: var(--track-label);
  --track-wide: var(--track-label);
}
@media (max-width: 760px) {
  [lang|="zh"] { --t-lede: 17px; }
}

/* ============================================================
   BASE
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: auto; scroll-padding-top: var(--scroll-pad); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  background: var(--paper) var(--grain);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--moss-light); color: var(--ink); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Headings: the display face, the scale above. A class rule on a page may set more. */
h1, h2, h3, h4 { font-family: var(--display); text-wrap: balance; }
h1 { font-size: var(--t-h1); line-height: var(--lh-h1); font-weight: var(--w-h1); letter-spacing: var(--track-h1); }
h2 { font-size: var(--t-h2); line-height: var(--lh-h2); font-weight: var(--w-h2); letter-spacing: var(--track-h2); }
h3 { font-size: var(--t-h3); line-height: var(--lh-h3); font-weight: var(--w-h3); }
h4 { font-size: var(--t-h4); line-height: var(--lh-h4); font-weight: var(--w-h4); }
/* Two voices: her <em> part is the second voice. The original's voice: in English it is the
   Cormorant italic in green, in an h1 and an h2 alike; smaller headings keep it roman. In
   Chinese it is the colour alone (never italic, below). */
h1 em, h2 em { color: var(--moss); font-style: italic; }
h3 em, h4 em { color: var(--moss); font-style: normal; }
p { text-wrap: pretty; }

/* ---- Chinese (brief § 2.4) ----
   1. Never italic: the second voice in Chinese is the colour change alone. This is the
      one place the rule is enforced, so it outranks any class that sets italic; an
      English run inside a Chinese page (lang="en") is not matched and keeps its italic.
   4. Strict line breaking; nothing here is justified.
   5. No negative tracking (the [lang|="zh"] tokens set the headings' tracking to 0). */
:lang(zh) { font-style: normal !important; line-break: strict; }
/* 6. A Chinese tag inside an English line (点茶 after a workshop name, a person's Chinese name) */
.zh-tag { font-family: var(--cjk); font-size: .78em; font-weight: 400; color: var(--ink-soft); letter-spacing: 0; }
/* 2. Chinese headings and names in Noto Serif SC (stage-1 carry item 6; the stage-2 page
      seats' requests). Matched on the heading's own language, so an English heading on a
      Chinese page (lang="en-AU") keeps the display face; a heading set in the label voice
      (.label) keeps the label face. */
:is(h1, h2, h3, h4):lang(zh):not(.label) { font-family: var(--cjk); }
/* An English run inside a Chinese heading (a name marked lang="en-AU") keeps the display face */
:is(h1, h2, h3, h4):lang(zh):not(.label) :lang(en) { font-family: var(--display); }
/* 7. Chinese headings, ledes, labels and questions break at her punctuation and spaces,
      never inside a word (栖山, 茶文化 and 参与者 were split across lines, and a line could
      end on one character alone). Four stage-3 page seats each solved this on their own
      page; it is one rule here now (stage 3 integrator). overflow-wrap still breaks a
      clause too long for its line, so nothing overflows. Running paragraphs keep ordinary
      Chinese breaking: phrase breaks there leave a ragged column of short lines. */
:is(h1, h2, h3, h4, .label, .lede, .faq-q-text, .story-label, .story-title):lang(zh) {
  word-break: keep-all; overflow-wrap: anywhere;
}

.wrap { width: 100%; max-width: calc(var(--maxw) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.cjk { font-family: var(--cjk); }
.measure { max-width: var(--measure); }

/* The label voice: small letterspaced serif capitals (the original's). Her label strings are typed in
   capitals and render as typed; one we write is sentence case and this rule lifts it. */
.label {
  font-family: var(--label);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  font-size: var(--t-label);
  line-height: var(--lh-label);
  font-weight: 500;
  color: var(--pine);
}
/* Chinese labels: Noto Serif SC, spaced, no capitals effect */
.label:lang(zh) { font-family: var(--cjk); font-weight: 500; }

/* A lede: the quieter line under a heading */
.lede { font-size: var(--t-lede); line-height: var(--lh-lede); color: var(--ink-soft); }

/* Visually hidden, still read aloud */
.vh {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---- A text link (brief § 2.6): ink, a 1 px brass-deep underline 5 px off; hover 2 px ink ---- */
.text-link {
  color: var(--ink); font-weight: 500;
  text-decoration: underline; text-decoration-color: var(--brass-deep);
  text-decoration-thickness: 1px; text-underline-offset: 5px;
  transition: text-decoration-color var(--dur-hover) var(--ease);
}
.text-link:hover { text-decoration-color: var(--ink); text-decoration-thickness: 2px; }
/* A text link standing alone (not inside a sentence) takes 44 px of height through padding */
.text-link.standalone { display: inline-block; min-height: 44px; padding-block: calc((44px - 1em * var(--lh-body)) / 2); }

/* ---- The original's buttons: square, tracked serif capitals. The solid one is ink on
   paper; .btn-line is its outlined twin (the second action beside it, never alone). ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 52px; padding: 10px 30px;
  font-family: var(--label); font-size: var(--t-label); font-weight: 500; line-height: 1.3;
  letter-spacing: .18em; text-transform: uppercase; text-align: center;
  color: var(--paper); background: var(--ink); border: 1px solid var(--ink); border-radius: 0;
  cursor: pointer;
  transition: background-color var(--dur-hover) var(--ease), border-color var(--dur-hover) var(--ease), color var(--dur-hover) var(--ease);
}
.btn:hover, .btn:focus-visible { background: var(--green); border-color: var(--green); color: var(--paper); }
.btn:lang(zh) { font-family: var(--cjk); font-size: 15px; letter-spacing: .16em; }
.btn.btn-line { background: transparent; color: var(--ink); border-color: var(--ink); text-decoration: none; }
.btn.btn-line:hover, .btn.btn-line:focus-visible { background: var(--ink); color: var(--paper); }

/* ---- Grounds. A section takes one; the well follows its ground; each carries the grain. ---- */
.ground-paper { background: var(--paper) var(--grain); --well: var(--band); }
.ground-band  { background: var(--band) var(--grain);  --well: var(--paper); }
.ground-green { background: var(--green) var(--grain); color: var(--paper); --well: var(--well-on-green); }
.ground-green :is(h1, h2, h3, h4) { color: var(--paper); }
.ground-green :is(h1, h2, h3, h4) em { color: var(--moss-light); }
.ground-green :is(.label, .lede) { color: var(--on-green-soft); }
.ground-green :focus-visible { outline-color: var(--paper); }
.ground-green .btn { background: var(--paper); border-color: var(--paper); color: var(--green); }
.ground-green .btn:hover, .ground-green .btn:focus-visible { background: var(--band); border-color: var(--band); color: var(--green); }
.ground-green .btn.btn-line { background: transparent; color: var(--paper); border-color: var(--paper); }
.ground-green .btn.btn-line:hover, .ground-green .btn.btn-line:focus-visible { background: var(--paper); color: var(--green); }
.ground-green .text-link { color: var(--paper); text-decoration-color: var(--on-green-soft); }
.ground-green .text-link:hover { text-decoration-color: var(--paper); }

/* The old pages' parts (the stage-1 header, hero, motto, tea list, Visit, booking card,
   seal and footer, and their phone rules) were retired with the old pages (stage 3, WP-28,
   2026-11-20): no built page names their classes. The held contact form (ContactForm.astro,
   EnquiryBlock.astro: built and OFF, D8) is restyled on direction C when it is wired back in. */
.hidden { display: none !important; }

/* ============================================================
   REDUCED MOTION — every animation and transition answers to this
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; animation-iteration-count: 1 !important; }
}

/* ============================================================
   THE FLOOR — the skip link (the kit's polish floor, 2026-11-04)
   ============================================================ */
/* Skip link: off-screen until a keyboard reaches it, then an ink chip just under the header bar, at the gutter */
.skip-link {
  position: fixed; top: 100px; left: var(--gutter); z-index: 70;
  font-family: var(--body); font-size: var(--t-small); font-weight: 500;
  padding: 12px 18px; background: var(--ink); color: var(--paper); border-radius: var(--r-control);
  transform: translateY(calc(-100% - 110px));
}
.skip-link:focus-visible, .skip-link:focus { transform: none; outline-color: var(--ink); }
@media (max-width: 980px) { .skip-link { top: 80px; } }

/* ============================================================
   THE MIX (Wilson's picks, 2026-11-20): two pieces carried over from the Synthesis study
   ============================================================ */
/* 1 · Her card's pipe. A run of words set as on the foot of her printed card:
   | CALMNESS | CONNECTION | REFINED EXPERIENCE | CURATED |
   The pipes are drawn (a 1 px rule), never typed, so a reader hears only the words. */
.pipes {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  list-style: none; row-gap: var(--s-2);
  font-family: var(--label); font-weight: 500; text-transform: uppercase;
  font-size: var(--t-label); line-height: 1.4; letter-spacing: var(--track-label);
  color: var(--ink-soft);
}
.pipes > li { display: inline-flex; align-items: center; white-space: nowrap; }
.pipes > li::before,
.pipes > li:last-child::after {
  content: ""; display: inline-block; width: 1px; height: 1.15em; margin-inline: 1.1em;
  background: currentColor; opacity: .55;
}
.ground-green .pipes { color: var(--on-green-soft); }

/* 3 · The card: once a page, a block set as her printed cards are — centred, on her card
   stock, inside a hairline drawn just in from its edge (the original's centred, unhurried
   composition, kept to one place so the rest of the page keeps today's one left edge). */
.card {
  position: relative; text-align: center;
  background: var(--paper) var(--grain); border: 1px solid var(--line-strong);
  padding: clamp(40px, 5vw, 80px) clamp(24px, 4.5vw, 72px);
  --well: var(--band);
}
.card::before {
  content: ""; position: absolute; inset: 9px; border: 1px solid var(--line); pointer-events: none;
}
.card > * { position: relative; }
.card .sh, .card .sh-lede, .card .measure { margin-inline: auto; }
.card .label { letter-spacing: .3em; }      /* her card's S Y D N E Y: the widest tracking on the site */
.card .label:lang(zh) { letter-spacing: .2em; }

/* ============================================================
   THE MELD (dir/meld, 2026-11-21) — the copybook's practice square (田字格) on the
   Original's paper. One square per character of hers, a dashed cross inside, in a
   regular-script face; the square is ruled in her seal's red, thinned into the paper,
   so no new colour enters the page. Markup: CharGrid.astro.
   ============================================================ */
:root {
  --kai: "Ma Shan Zheng", "Kaiti SC", "STKaiti", "KaiTi", "Noto Serif SC", serif;
  --zg-rule: color-mix(in srgb, var(--seal) 58%, var(--paper));   /* the square's edge (decoration) */
  --zg-cross: color-mix(in srgb, var(--seal) 30%, transparent);   /* its dashed cross (decoration) */
  --zg-trace: color-mix(in srgb, var(--seal) 20%, var(--paper));  /* the pale red model under the ink */
}
.zg {
  --zg-max: 52px;
  --zg-room: calc(100vw - 2 * var(--gutter));
  --zg: max(30px, min(var(--zg-max), calc(var(--zg-room) / var(--n, 1))));
  --zg-ink: var(--ink);
  --zg-edge: var(--zg-rule);
  --zg-dash: var(--zg-cross);
  display: inline-block; vertical-align: top;
  font-family: var(--kai); font-weight: 400; font-style: normal; letter-spacing: 0;
  line-height: 1; color: var(--zg-ink);
}
.zg--s  { --zg-max: 34px; }
.zg--m  { --zg-max: 52px; }
.zg--l  { --zg-max: 76px; }
.zg--xl { --zg-max: 104px; }
.zg-cells { display: flex; flex-wrap: wrap; gap: calc(var(--zg) * .32); }
.zg-run { display: flex; border: 1px solid var(--zg-edge); }
.zg-c {
  position: relative; flex: none;
  width: var(--zg); height: var(--zg);
  display: grid; place-items: center;
  font-size: calc(var(--zg) * .72);
  background:
    repeating-linear-gradient(90deg, var(--zg-dash) 0 3px, transparent 3px 6px) center / 100% 1px no-repeat,
    repeating-linear-gradient(180deg, var(--zg-dash) 0 3px, transparent 3px 6px) center / 1px 100% no-repeat;
}
.zg-c + .zg-c { border-left: 1px solid var(--zg-edge); }
.zg-ch { position: relative; display: block; transform: translateY(.02em); }
/* Vertical: each run is a column, the first at the right (her poem reads right to left) */
.zg--v .zg-cells { flex-direction: row-reverse; flex-wrap: nowrap; gap: 0; }
.zg--v .zg-run { flex-direction: column; }
.zg--v .zg-run + .zg-run { border-right: 0; }
.zg--v .zg-c + .zg-c { border-left: 0; border-top: 1px solid var(--zg-edge); }
/* Writing: the pale red model shows first, then the ink is written over it, a square at a
   time (a page script adds .is-pending, then .is-writing; no script: written whole) */
.zg--write .zg-c::before {
  content: attr(data-ch); position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--zg-trace); transform: translateY(.02em);
}
.zg--write.is-pending .zg-ch { opacity: 0; }
.zg--write.is-writing .zg-ch { animation: zg-write 520ms var(--ease) both; animation-delay: calc(var(--i, 0) * 120ms + 200ms); }
@keyframes zg-write { from { opacity: 0; clip-path: inset(0 0 100% 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: reduce) {
  .zg--write.is-pending .zg-ch { opacity: 1; }
  .zg--write.is-writing .zg-ch { animation: none; }
}
/* A gloss: the other language beside her characters, in the label voice */
.gloss { font-family: var(--label); font-size: var(--t-label); line-height: var(--lh-label); letter-spacing: var(--track-label); text-transform: uppercase; font-weight: 500; color: var(--pine); }
/* Inside a link the squares stand as one box, so the link's underline never runs under them */
a .zg { display: inline-block; width: 100%; }
a .zg .zg-cells { width: max-content; max-width: 100%; }
