/* =========================================================================
   道教清善壇 — Tsing Saints Taoist Centre
   Next-generation site · design system
   Signature: temple-hall framing — vertical 對聯 rails + red seal (印) markers.
   ========================================================================= */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
img, picture, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--cinnabar); outline-offset: 3px; border-radius: 2px; }

/* ---------- tokens ---------- */
:root {
  /* colour — grounded in the gold-and-red temple seal */
  --ink:        #241c17;   /* sumi-ink text            */
  --ink-soft:   #4a3f34;   /* secondary text           */
  --paper:      #f6eedd;   /* warm rice-paper ground   */
  --paper-deep: #efe3c9;   /* recessed panels          */
  --paper-veil: #fbf6ea;   /* raised cards             */
  --cinnabar:   #b0271d;   /* 朱砂 — primary vermilion  */
  --cinnabar-d: #8c1a12;   /* pressed / hover          */
  --gold:       #b58a2e;   /* antique imperial gold    */
  --gold-leaf:  #c8a24a;   /* leaf-gold (gradients)    */
  --gold-hi:    #d8b656;   /* gold highlight           */
  --jade:       #2f5d51;   /* restrained secondary     */
  --line:       #d9c9a6;   /* hairline on paper        */
  --line-strong:#c3ab7d;

  /* type */
  --serif: "Noto Serif TC", "Source Han Serif TC", "Songti TC", "Songti SC",
           "STSong", "SimSun", "Times New Roman", serif;
  --sans:  "Noto Sans TC", "PingFang HK", "PingFang TC", "Microsoft JhengHei",
           "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  --latin-display: Georgia, "Times New Roman", var(--serif);

  /* fluid scale */
  --step--1: clamp(0.86rem, 0.82rem + 0.2vw, 0.95rem);
  --step-0:  clamp(1.06rem, 1.0rem + 0.32vw, 1.22rem);   /* body — large  */
  --step-1:  clamp(1.3rem, 1.18rem + 0.6vw, 1.6rem);
  --step-2:  clamp(1.6rem, 1.4rem + 1.0vw, 2.2rem);
  --step-3:  clamp(2.0rem, 1.6rem + 2.0vw, 3.2rem);
  --step-4:  clamp(2.6rem, 1.9rem + 3.6vw, 5rem);

  /* space */
  --gap: clamp(1rem, 0.7rem + 1.4vw, 1.6rem);
  --section-y: clamp(3.5rem, 2.6rem + 4vw, 6.5rem);
  --content: 72rem;
  --measure: 40rem;

  --radius: 2px;
  --shadow: 0 1px 2px rgba(36,28,23,.06), 0 8px 30px -12px rgba(36,28,23,.22);
  --shadow-lift: 0 2px 6px rgba(36,28,23,.08), 0 20px 48px -18px rgba(36,28,23,.32);
  --rail: 3.2rem; /* couplet rail width on wide screens */

  /* motif toolkit — mask-image data URIs (colour comes from background-color, not the SVG) */
  --hui-src: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 16' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M0 15h32'/%3E%3Cpath d='M24 15V3H8v8h10V7h-5'/%3E%3C/svg%3E");
  --cloud-src: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 148 28' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M1 25h30'/%3E%3Cpath d='M31 25c9 0 15.5-6 15.5-14 0-5-3.6-8.6-8.4-8.6-4.4 0-7.7 3.2-7.7 7.4 0 3.6 2.7 6.3 6.2 6.3 2.9 0 5-2 5-4.7'/%3E%3Cpath d='M147 25h-30'/%3E%3Cpath d='M117 25c-9 0-15.5-6-15.5-14 0-5 3.6-8.6 8.4-8.6 4.4 0 7.7 3.2 7.7 7.4 0 3.6-2.7 6.3-6.2 6.3-2.9 0-5-2-5-4.7'/%3E%3Cpath d='M58 25c5.5 0 9-4 9-9.5 0-3.6 3.4-6.2 7-6.2s7 2.6 7 6.2c0 5.5 3.5 9.5 9 9.5'/%3E%3C/svg%3E");
  --cloud-cnr-src: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M1 47C1 24 12 10 33 5'/%3E%3Cpath d='M33 5c5.4-1.2 9.2 2 9.2 6.6 0 3.8-3 6.6-6.6 6.6-3 0-5.2-2.2-5.2-5 0-2.3 1.8-4 4-4'/%3E%3Cpath d='M8 47c0-17 8-27 24-31.5'/%3E%3C/svg%3E");
}

/* ---------- base ---------- */
html { color-scheme: light; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.9;                 /* generous leading for CJK + older eyes */
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* subtle rice-paper fibre + a whisper of gold at the top */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(181,138,46,.10), transparent 60%),
    repeating-linear-gradient(90deg, rgba(120,90,40,.018) 0 2px, transparent 2px 4px);
}

p { max-width: var(--measure); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.3; color: var(--ink); }
strong { font-weight: 700; color: var(--cinnabar-d); }
a { text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------- layout helpers ---------- */
.wrap { width: min(100% - 2.4rem, var(--content)); margin-inline: auto; }
.section { padding-block: var(--section-y); position: relative; scroll-margin-top: 5.5rem; }
.section--deep { background: var(--paper-deep); }
.lede { font-size: var(--step-1); line-height: 1.85; color: var(--ink-soft); max-width: 46rem; }

.skip-link {
  position: absolute; left: 1rem; top: .6rem; z-index: 200;
  background: var(--cinnabar); color: #fff; padding: .6rem 1rem; border-radius: var(--radius);
  transform: translateY(-250%); transition: transform .2s;
}
.skip-link:focus { transform: translateY(0); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* =========================================================================
   Section heading — the seal (印) marker + bilingual eyebrow
   ========================================================================= */
.head {
  display: flex; align-items: flex-start; gap: clamp(1rem,2vw,1.6rem); margin-bottom: clamp(1.6rem,3vw,2.6rem);
  --seal-rise: 0.65rem;
  border-top: 1px solid var(--line-strong);
  padding-top: calc(1.4rem + var(--seal-rise));
}
.seal {
  flex: none;
  width: clamp(3rem, 5vw, 3.9rem); height: clamp(3rem, 5vw, 3.9rem);
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2rem); color: #fbeecb;
  background:
    linear-gradient(145deg, var(--cinnabar), var(--cinnabar-d));
  border-radius: 2px;
  box-shadow: inset 0 0 0 2px rgba(255,240,205,.5), inset 0 0 0 5px var(--cinnabar), var(--shadow);
  position: relative;
  transform: rotate(-3deg);
  margin-top: calc(-2 * var(--seal-rise) - 1.4rem);
}
.head-text { padding-top: .1rem; }
.eyebrow {
  font-family: var(--sans); font-size: var(--step--1); font-weight: 600;
  letter-spacing: .28em; text-transform: uppercase; color: var(--gold);
  display: block; margin-bottom: .35rem;
}
.head h2 { font-size: var(--step-3); letter-spacing: .04em; }
.head h2 .en { display:block; font-family: var(--latin-display); font-style: italic; font-weight: 400;
  font-size: var(--step-1); color: var(--ink-soft); letter-spacing: .01em; margin-top: .2rem; }
/* keep a semantic CJK word group from breaking mid-word at narrow widths */
.nb { white-space: nowrap; }

/* =========================================================================
   Header / nav
   ========================================================================= */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 1rem; min-height: 4.4rem; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; margin-right: auto; }
.brand img, .foot-brand img {
  flex: none;
  block-size: auto;
  aspect-ratio: 1;
  object-fit: contain; object-position: center;
  border-radius: 50%;
}
.brand img { inline-size: 2.6rem; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.25rem; letter-spacing: .06em; line-height: 1.15; }
.brand-name .en { display: block; font-family: var(--sans); font-weight: 500; font-size: .62rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }

.nav-links { display: flex; align-items: center; gap: clamp(.6rem, 1.4vw, 1.4rem); list-style: none; margin: 0; padding: 0; }
.nav-links a {
  text-decoration: none; font-size: .98rem; font-weight: 500; color: var(--ink);
  padding: .4rem .1rem; position: relative; white-space: nowrap;
}
.nav-links a::after {
  content:""; position:absolute; left:0; right:100%; bottom:.05rem; height:2px;
  background: var(--cinnabar); transition: right .28s ease;
}
.nav-links a:hover::after, .nav-links a:focus-visible::after { right: 0; }

.nav-cta {
  text-decoration: none; font-weight: 600; font-size: .95rem;
  background: var(--cinnabar); color: #fff; padding: .55rem 1rem; border-radius: var(--radius);
  box-shadow: var(--shadow); transition: background .2s, transform .2s;
}
.nav-cta:hover { background: var(--cinnabar-d); }

.nav-toggle { display: none; background: none; border: 0; padding: .4rem; }
.nav-toggle svg { width: 1.9rem; height: 1.9rem; }

/* =========================================================================
   Couplet rails (對聯) — the temple-hall framing · wide screens only
   ========================================================================= */
.rail {
  position: fixed; top: 0; bottom: 0; width: var(--rail); z-index: 40;
  display: none; place-items: center; pointer-events: none;
  writing-mode: vertical-rl; text-orientation: upright;
  font-family: var(--serif); font-size: 1.15rem; font-weight: 700;
  letter-spacing: .5em; color: var(--cinnabar);
  opacity: .72;
}
.rail span { text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.rail--l { left: 0; border-right: 1px solid var(--line); background: linear-gradient(90deg, rgba(181,138,46,.08), transparent); }
.rail--r { right: 0; border-left: 1px solid var(--line); background: linear-gradient(270deg, rgba(181,138,46,.08), transparent); }

/* =========================================================================
   Hero
   ========================================================================= */
.hero {
  position: relative; min-height: min(92vh, 46rem);
  display: grid; align-items: center;
  color: #f8efe0;
  overflow: hidden;
}
.hero__bg { position: absolute; inset: 0; z-index: -1; }
.hero__bg img { width: 100%; height: 100%; object-fit: cover; }
.hero__bg::after {
  content:""; position:absolute; inset:0;
  background:
    linear-gradient(180deg, rgba(28,18,12,.55) 0%, rgba(28,18,12,.35) 40%, rgba(28,18,12,.72) 100%),
    radial-gradient(90% 70% at 30% 40%, rgba(28,18,12,.15), rgba(28,18,12,.6));
}
.hero__inner { padding-block: clamp(3rem,10vh,7rem); }
.hero__title {
  font-family: var(--serif); font-weight: 700; color: #fdf6e6;
  font-size: var(--step-4); letter-spacing: .14em; line-height: 1.1;
  text-shadow: 0 2px 24px rgba(0,0,0,.4);
}
.hero__en { font-family: var(--latin-display); font-style: italic; font-size: var(--step-1);
  color: var(--gold-hi); letter-spacing: .06em; margin-top: .6rem; }
.hero__tag {
  margin-top: 1.4rem; font-size: var(--step-1); color: #f2e6cf; max-width: 34rem;
  font-weight: 400; line-height: 1.7;
}
.hero__meta { margin-top: .5rem; font-size: 1rem; letter-spacing: .3em; color: var(--gold-hi); text-transform: none; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 2.1rem; }

/* buttons */
/* plaques, not web buttons: square corners, colour/keyline feedback only, never a hover lift */
.btn {
  --bg: var(--cinnabar); --fg: #fff;
  display: inline-flex; align-items: center; gap: .5rem;
  text-decoration: none; font-weight: 600; font-size: 1.02rem;
  background: var(--bg); color: var(--fg);
  padding: .8rem 1.5rem; border-radius: 0; border: 1px solid transparent;
  box-shadow: var(--shadow); transition: background .2s, box-shadow .2s, border-color .2s;
}
.btn--solid { background: var(--cinnabar); box-shadow: var(--shadow), inset 0 0 0 3px rgba(216,182,86,.55); }
.btn--solid:hover { background: var(--cinnabar-d); }
.btn--ghost { background: transparent; color: #fdf6e6; border-color: rgba(255,246,230,.55); box-shadow: none; }
.btn--ghost:hover { background: rgba(255,246,230,.12); }
.btn--gold { background: linear-gradient(160deg, var(--gold-hi), var(--gold)); color: #3a2a08; }

/* =========================================================================
   About + sacred image
   ========================================================================= */
.about-grid { display: grid; gap: clamp(1.6rem, 4vw, 3.4rem); grid-template-columns: 1fr; }
.about-body > * + * { margin-top: 1.1rem; }
.about-body p { max-width: 42rem; }
.figure { position: relative; }
/* universal photo mount — 6px paper-veil mat + hairline border, square corners, no shadow */
.figure__zoom {
  display: block; width: 100%; padding: 6px; border: 0; margin: 0;
  background: var(--paper-veil); text-align: inherit; cursor: zoom-in;
}
.figure img { width: 100%; height: 100%; object-fit: cover; border: 1px solid var(--line-strong); border-radius: 0; display: block; }
.figure figcaption {
  padding: .8rem 1rem; font-size: var(--step--1); color: var(--ink-soft);
  background: var(--paper-veil); border-top: 2px solid var(--gold);
}
/* devotional mount — shows a small revered image crisply at native size, not stretched.
   Distinct treatment from the universal mat: no mat padding on its own zoom button
   (its own centred/contain layout on a paper-deep panel already frames it), but the image
   still drops its shadow and gains square corners for cohesion with the rest of the site. */
.figure--mount { background: var(--paper-deep); border-top: 4px solid var(--gold); overflow: visible; }
.figure--mount .figure__zoom { padding: 0; background: none; }
.figure--mount img {
  width: auto; height: auto; max-width: 100%; max-height: 30rem; object-fit: contain;
  margin: clamp(1rem,3vw,2rem) auto 0; border: 1px solid var(--line-strong);
  border-radius: 0; background: #fff;
}
.figure--mount figcaption { background: transparent; border-top: 0; padding: 1rem clamp(1rem,3vw,1.6rem) 1.3rem; }
/* wide altar banner */
.figure.banner { margin-top: clamp(1.6rem, 4vw, 3rem); }
.figure.banner img { width: 100%; height: auto; max-height: 30rem; object-fit: cover; }
/* master with no portrait — single readable column */
.master.master--solo { grid-template-columns: 1fr; max-width: 50rem; }
.pull {
  border-left: 3px solid var(--cinnabar); padding: .3rem 0 .3rem 1.2rem;
  font-family: var(--serif); font-size: var(--step-1); color: var(--cinnabar-d); line-height: 1.7;
}
/* A registration reference belonging to the pull quote above it — the government file
   number for the tax-exempt status that quote describes. Small and muted: a credential,
   not a claim.

   It CARRIES THE CINNABAR RULE ON, and margin-top:0 joins the two into one unbroken
   stroke, so the line is visibly inside the quote block. Left-aligned and unruled it
   read as an orphan: the quote's last line is short (社群。), which opens an L-shaped
   void to its right, and a detached line under that void looked like a stray.

   RIGHT-ALIGNED for the same reason — it fills that void and reads as an attribution
   under a quotation. On narrow screens the line nearly fills the column, so the
   alignment is barely perceptible there and the block just looks centred.

   Both share .about-body's 42rem measure, so the right edges agree. The compound
   selector also beats .about-body's 1.1rem stack gap on specificity. */
.pull:has(+ .pull-ref) { padding-bottom: .1rem; }
.pull + .pull-ref {
  border-left: 3px solid var(--cinnabar);
  margin-top: 0; padding: 0 0 .35rem 1.2rem;
  text-align: right;
  font-size: var(--step--1); color: var(--ink-soft);
}

/* =========================================================================
   Lineage band
   ========================================================================= */
.lineage { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1rem; }
.lineage__node {
  font-family: var(--serif); font-size: var(--step-1); color: var(--ink);
  background: var(--paper-veil); border: 1px solid var(--line-strong);
  padding: .8rem 1.2rem; border-radius: var(--radius); box-shadow: var(--shadow);
  text-align: center;
}
.lineage__node small { display:block; font-family: var(--sans); font-size: .72rem;
  letter-spacing: .12em; color: var(--gold); text-transform: uppercase; margin-top: .2rem; }
.lineage__arrow { color: var(--gold); font-size: 1.4rem; }
/* the two lineage documents — the 邱長春祖師 scroll and the 全真七祖法系 chart. Both are
   revered/documentary images that must read whole and legible, so they take the devotional
   mount (contain, native ratio) rather than the cropping photo mat. */
.lineage-scans {
  display: grid; gap: 1rem; margin-top: clamp(1.6rem, 4vw, 2.4rem);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.lineage-scans .figure--mount img { max-height: 26rem; }
/* these two captions are short labels under a centred, contained image — centre them on it.
   Scoped to .lineage-scans: the About 呂祖聖像 mount carries a prose paragraph that must stay
   left-aligned to stay readable. */
.lineage-scans .figure--mount figcaption { text-align: center; }

/* =========================================================================
   Service cards
   ========================================================================= */
/* charter register (章程) — flat entries, no card box; numeral chip + inline title, body beneath */
.cards { position: relative; display: flex; flex-direction: column; padding-top: 1.8rem; }
.cards::before {
  content: ""; position: absolute; top: 0; right: 0; z-index: 1; pointer-events: none;
  width: 7rem; height: 1.35rem;
  background-color: var(--gold-leaf); opacity: .45;
  -webkit-mask-image: var(--cloud-src);   mask-image: var(--cloud-src);
  -webkit-mask-repeat: no-repeat;         mask-repeat: no-repeat;
  -webkit-mask-position: center;          mask-position: center;
  -webkit-mask-size: contain;             mask-size: contain;
}
.card {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: .9rem; row-gap: .5rem;
  padding-block: 1.6rem;
}
.card + .card { border-top: 1px solid var(--line); }
.card__mark {
  flex: none;
  font-family: var(--serif); font-weight: 700; font-size: 1.1rem; color: #fbeecb;
  width: 2rem; height: 2rem; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--cinnabar), var(--cinnabar-d));
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255,240,205,.5);
}
.card h3 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: var(--step-1); }
.card p { flex: 1 1 100%; margin: 0; font-size: var(--step--1); color: var(--ink-soft); line-height: 1.75; max-width: none; }
@media (min-width: 56rem) {
  .cards { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 3rem; row-gap: 2.6rem; }
  .card { padding-block: 0; }
  .card + .card { border-top: 0; }
  .card:not(:nth-child(3n+1)) { border-left: 1px solid var(--line); padding-left: 1.5rem; }
}
/* services closing line (registration call-to-action) reads wider than the default measure clamp */
#services .wrap > p.lede:last-of-type { margin-top: 1.8rem; font-size: var(--step-0); max-width: none; }

/* =========================================================================
   The Master
   ========================================================================= */
.master { display: grid; gap: clamp(1.6rem,4vw,3rem); grid-template-columns: 1fr; }
.master__body > * + * { margin-top: 1rem; }
.master__name { font-family: var(--serif); font-size: var(--step-2); color: var(--cinnabar-d); }
.master__name small { display:block; font-family: var(--sans); font-weight:500; font-size: .8rem;
  letter-spacing:.2em; color: var(--gold); text-transform: uppercase; margin-top:.3rem; }

/* =========================================================================
   News / registration cards
   ========================================================================= */
.news { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(18rem,1fr)); }
.notice {
  background: var(--paper-veil); border: 1px solid var(--line); border-top: 4px solid var(--cinnabar);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); position: relative;
}
.notice__tag {
  display:inline-block; font-size: .74rem; font-weight:700; letter-spacing:.16em;
  color:#fff; background: var(--gold); padding:.2rem .6rem; border-radius: var(--radius); text-transform: uppercase; margin-bottom:.8rem;
}
.notice h3 { font-size: var(--step-1); margin-bottom: .5rem; }
.notice p { font-size: var(--step--1); color: var(--ink-soft); max-width:none; }
.notice__contact { margin-top: .9rem; font-size: var(--step--1); font-weight:600; color: var(--cinnabar-d); }
.notice__contact a { color: inherit; }

/* =========================================================================
   Gallery
   ========================================================================= */
.filterbar, .filterbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.4rem; }
.filterbar button {
  appearance: none; -webkit-appearance: none; display: inline-flex; align-items: center;
  font-size: .92rem; font-weight:500; background: var(--paper-veil);
  border: 1px solid var(--line-strong); color: var(--ink-soft);
  padding: .45rem 1rem; border-radius: 2px; transition: all .2s;
}
.filterbar button[aria-pressed="true"] { background: var(--cinnabar); color:#fff; border-color: var(--cinnabar); }
.filterbar button:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.filterbar button[aria-pressed="true"]:hover { color: #fff; }

/* sub-titles — each 服務／法會 gets its own head-rule above its own grid, so a photo's
   attribution is readable at a glance instead of inferred from a mixed wall of tiles. */
.gallery-group + .gallery-group { margin-top: clamp(1.7rem, 4vw, 2.6rem); }
.gallery-group__head { display: flex; align-items: baseline; gap: .7rem; margin: 0 0 .9rem; }
.gallery-group__head::after {
  content: ""; flex: 1 1 auto; height: 1px; background: var(--line-strong); transform: translateY(-.25em);
}
.gallery-group__title {
  margin: 0; font-family: var(--serif); font-size: var(--step-0); font-weight: 700;
  color: var(--cinnabar-d); letter-spacing: .02em;
}
/* The whole sub-title is the control (round 7) — the centre tapped the ❖, expected the
   section to open full-screen and got nothing. Wiring only the glyph was too literal a
   reading: a 17px ornament is a needlessly small thing to ask a finger to find. The button
   renders exactly as the bare <h3> text did (UA chrome reset, font and colour inherited)
   and a negative-inset ::after grows the target past the text on all four sides without
   shifting the heading by a pixel. The ❖ goes back to being the ornament it looks like. */
.gallery-group__open {
  appearance: none; -webkit-appearance: none; background: none; border: 0; padding: 0;
  margin: 0; font: inherit; color: inherit; letter-spacing: inherit; text-align: left;
  cursor: pointer; position: relative;
}
.gallery-group__open::after { content: ""; position: absolute; inset: -.55rem -.4rem; }
.gallery-group__open:hover, .gallery-group__open:hover .gallery-group__mark { color: var(--cinnabar); }
.gallery-group__open:focus-visible { outline: 2px solid var(--cinnabar); outline-offset: 3px; }
.gallery-group__mark { color: var(--gold); margin-right: .45rem; }
.gallery-group__count {
  order: 3; flex: 0 0 auto; font-family: var(--sans); font-size: .7rem;
  color: var(--ink-soft); letter-spacing: .08em;
}
/* a group's own prose, set like the section ledes — read before the tiles, not a caption */
.gallery-group__note {
  margin: 0 0 1rem; font-size: var(--step--1); line-height: 1.75; color: var(--ink-soft); max-width: 46rem;
}

/* column-flow masonry — every photo shows whole at its natural ratio (no crop),
   which handles the mixed portrait/landscape shapes gracefully. */
.grid-gallery { columns: 180px 4; column-gap: .8rem; }
/* universal photo mount: 6px paper-veil mat + hairline border, square corners, no shadow */
.tile {
  position: relative; display: block; width: 100%; margin: 0 0 .8rem; break-inside: avoid;
  border: 0; padding: 6px; background: var(--paper-veil);
}
.tile img { width: 100%; height: auto; display: block; border: 1px solid var(--line-strong); border-radius: 0; transition: border-color .2s ease; }
.tile:hover img, .tile:focus-visible img { border-color: var(--cinnabar); }
.tile figcaption {
  position: absolute; left: 6px; right: 6px; bottom: 6px;
  padding: 1.4rem .8rem .7rem; font-size: .82rem; color: #fff; text-align: left;
  background: linear-gradient(transparent, rgba(20,12,8,.82));
  opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s;
  /* Never a hit target. .grid-gallery is a multi-column container, and Chromium gives an
     absolutely-positioned descendant inside one a hit box that does not match where it
     paints — measured here, the first tile's figcaption claimed a 99×183px box starting
     33px ABOVE its own sub-title heading, so a tap on the heading (and, once it became a
     control, on the ❖) landed on an invisible caption instead. It only ever decorates the
     tile button that contains it, so it has no business in hit-testing at all. */
  pointer-events: none;
}
.tile:hover figcaption, .tile:focus-visible figcaption { opacity: 1; transform: none; }

.gallery-more {
  display: grid; grid-template-rows: 0fr; visibility: hidden;
  transition: grid-template-rows .28s cubic-bezier(.2,.7,.3,1), visibility 0s linear .28s;
}
.gallery-more > .grid-gallery { min-height: 0; overflow: hidden; }
.gallery-more.is-open {
  grid-template-rows: 1fr; visibility: visible;
  transition: grid-template-rows .28s cubic-bezier(.2,.7,.3,1), visibility 0s;
}
.group-toggle {
  display: block; width: 100%; min-height: 3rem; margin-top: .6rem;
  background: var(--paper-veil); border: 1px solid var(--line-strong); border-radius: 0;
  font-family: var(--serif); font-size: var(--step-0); color: var(--cinnabar-d); text-align: center;
}
.group-toggle:hover, .group-toggle:focus-visible { border-color: var(--cinnabar); }
/* Deliberately NO content-visibility/contain-intrinsic-size here. It was tried and reverted:
   an offscreen group is sized by the intrinsic-size placeholder rather than its real height,
   and with ten small groups a 480px estimate inflated the document from 4769px to 5602px —
   lengthening the very scroll this change exists to shorten. 39 images need no such help. */

@media (max-width: 48rem) {
  .grid-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
  .tile { margin: 0; }
  .tile img { aspect-ratio: 1; object-fit: cover; }
}

/* desktop: uniform square grid — kill the masonry columns, every tile the same shape */
@media (min-width: 48rem) {
  .grid-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
  .tile { margin: 0; }
  .tile img { aspect-ratio: 1; object-fit: cover; }
}
@media (min-width: 64rem) {
  .grid-gallery { grid-template-columns: repeat(4, 1fr); }
}

/* lightbox */
.lightbox {
  --lb-pad: clamp(1rem, 4vw, 3rem); --lb-cap: 4.5rem;
  position: fixed; inset: 0; z-index: 300; display: none;
  background: rgba(18,11,7,.94); padding: var(--lb-pad);
}
.lightbox.is-open {
  display: grid; grid-template-rows: minmax(0, 1fr) auto; align-content: center; justify-items: center; gap: 1rem;
}
.lightbox__stage {
  position: relative; z-index: 1; display: grid; place-items: center;
  width: 100%; min-width: 0; min-height: 0; overflow: hidden; touch-action: pinch-zoom;
}
.lightbox__stage img {
  max-width: 100%;
  max-height: calc(100vh - var(--lb-cap) - var(--lb-pad) * 2);  /* fallback iOS 15.0 */
  max-height: calc(100dvh - var(--lb-cap) - var(--lb-pad) * 2);
  width: auto; height: auto; place-self: center;
  border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.6);
  transform-origin: center center; will-change: transform; cursor: zoom-in;
}
.lightbox.is-zoomed .lightbox__stage img { cursor: grab; }
.lightbox__cap { color: #f2e6cf; text-align: center; font-size: 1rem; }
.lightbox__hint { color: var(--gold-hi); text-align: center; font-size: .85rem; margin-top: -.6rem; letter-spacing: .04em; }
.lightbox__btn {
  position: absolute; z-index: 2; top: 50%; transform: translateY(-50%);
  width: 3.4rem; height: 3.4rem; border-radius: 50%; font-size: 1.7rem; display: grid; place-items: center;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.34);
}
@media (pointer: coarse) { .lightbox__btn { width: 4rem; height: 4rem; } }
.lightbox__btn:hover { background: rgba(255,255,255,.2); }
.lightbox__btn[hidden] { display: none; }  /* single-item album — no prev/next */
.lightbox__prev { left: clamp(.5rem,3vw,2rem); }
.lightbox__next { right: clamp(.5rem,3vw,2rem); }
.lightbox__close { top: max(var(--lb-pad), env(safe-area-inset-top)); right: var(--lb-pad); transform: none; }

/* =========================================================================
   Free scriptures + downloads
   ========================================================================= */
.list-cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem,1fr)); }
.dl {
  display: flex; align-items: center; gap: 1rem; text-decoration: none;
  background: var(--paper-veil); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.3rem; box-shadow: var(--shadow); transition: transform .2s, border-color .2s;
}
.dl:hover { border-color: var(--cinnabar); }
.dl__icon { flex:none; width: 2.6rem; height:2.6rem; display:grid; place-items:center;
  background: var(--cinnabar); color:#fff; border-radius: var(--radius); font-family: var(--serif); font-size: 1.3rem; }
.dl__t { font-family: var(--serif); font-size: var(--step-1); line-height:1.3; }
.dl__t small { display:block; font-family: var(--sans); font-size:.78rem; color: var(--ink-soft); letter-spacing:.04em; }

.gift { background: var(--paper-veil); border:1px solid var(--line); border-left: 4px solid var(--gold);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.gift h3 { font-size: var(--step-1); margin-bottom:.4rem; }
.gift p { font-size: var(--step--1); color: var(--ink-soft); max-width:none; }

/* =========================================================================
   Enshrined deities — the shrine album (zen, Otera-style)
   ========================================================================= */
.shrine-grid { display: grid; gap: clamp(1.4rem, 3vw, 2.2rem); grid-template-columns: 1fr; }
.shrine {
  background: var(--paper-veil); border: 1px solid var(--line); border-top: 4px solid var(--gold);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
}
/* natural aspect ratio — panels read as hanging scrolls; heights differ across the row by design.
   Universal photo mount: 6px paper-veil mat + hairline border, square corners, no shadow. */
.shrine__img { flex: none; padding: 6px; background: var(--paper-veil); }
.shrine__img img { width: 100%; height: auto; border: 1px solid var(--line-strong); border-radius: 0; display: block; }
.shrine__body { padding: 1.3rem clamp(1.2rem,2.4vw,1.6rem) 1.6rem; }
.shrine__body h3 { font-size: var(--step-1); color: var(--cinnabar-d); margin-bottom: .15rem; }
.shrine__body .en { display:block; font-family: var(--latin-display); font-style: italic; font-weight: 400;
  font-size: .88rem; color: var(--gold); letter-spacing: .02em; margin-bottom: .95rem; }
ol.shrine__list {
  list-style-type: cjk-ideographic; display: grid; gap: .38rem;
  padding-inline-start: 2.7rem; margin: 0;
}
ol.shrine__list li {
  font-family: var(--serif); font-size: 1rem; line-height: 1.55;
  color: var(--ink); max-width: none;
}
ol.shrine__list li::marker { color: var(--gold); font-family: var(--serif); }
/* desktop: equal-width triptych — one uniform square window per panel.
   Luzu and Foshrine are both native-square (zero crop, edge to edge); Guanyin sits in a
   deliberate 神龕 alcove (contain on deep paper, top glow) — no deity is cropped.

   This briefly became a 4:3 contain-everything row, when the Buddhas panel held a
   2.26:1 crop of the hall: cover would have sliced off the outer two of the 四座千佛
   寶塔燈 its caption names, and containing a panorama in a square left it a thin strip
   marooned in empty paper. The centre then supplied a SQUARE hall photograph, which
   removed the reason for the 4:3 window, so this reverted to the original geometry.

   The rule that survived both rounds: a panel source should be square or taller, never
   a panorama. If one arrives, fix the SOURCE — do not reshape the row around it, and do
   not let cover crop a deity to make it fit. */
@media (min-width: 62rem) {
  .shrine-grid { grid-template-columns: repeat(3, 1fr); gap: 1.6rem; align-items: stretch; }
  .shrine__img img {
    aspect-ratio: 1 / 1; height: auto;
    object-fit: cover; object-position: 50% 50%;
  }
  .shrine-grid .shrine:nth-child(3) .shrine__img img {
    object-fit: contain;
    background:
      radial-gradient(90% 55% at 50% 0%, rgba(216,182,86,.22), rgba(216,182,86,0) 65%),
      var(--paper-deep);
    box-shadow: inset 0 0 0 1px rgba(195,171,125,.6), inset 0 3px 12px rgba(60,40,10,.10);
  }
}

/* =========================================================================
   佛光普照位 tower — <details> plaque + stepped gold-leaf stupa (pure CSS)
   ========================================================================= */
.tower { margin-top: 1.2rem; }
.tower__summary {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  min-height: 2.75rem; padding: .7rem 1.1rem;
  background: var(--paper-deep); border: 1px solid var(--gold); border-radius: 2px;
  font-family: var(--serif); font-size: var(--step-0); color: var(--cinnabar-d);
  cursor: pointer; list-style: none;
}
.tower__summary::-webkit-details-marker { display: none; }
.tower__summary::after { content: "⊕"; color: var(--gold); font-size: 1.15em; }


/* =========================================================================
   Monthly observances — schedule notices + original scans
   ========================================================================= */
.notice--month { border-top-color: var(--gold); }
.notice__month-tag { display:inline-block; font-family: var(--serif); font-size: var(--step-1);
  color: var(--cinnabar-d); font-weight: 700; margin-bottom: .8rem; }
.notice__list { list-style: none; margin: 0; padding: 0; }
.notice__list li {
  padding-block: .9rem; max-width: none;
  color: var(--ink); font-size: var(--step-0); line-height: 1.8;
  /* pre-line, so a line break the operator typed in the CMS survives to the page.
     The sheet breaks lines inside a single notice — the ※ 取籌問事 paragraph ends on
     a colon and its date sits on the next line, still part of the same notice — and
     without this the two could only be separated by making them two items, which
     puts a divider rule between them and splits one notice into two.
     Spaces still collapse and wrapping is normal; only newlines are honoured. The
     text is still set with textContent, so this changes presentation, never parsing. */
  white-space: pre-line;
}
.notice__list li + li { border-top: 1px solid var(--line); }
.notice__list li b {
  display: block; font-family: var(--serif); font-weight: 700;
  color: var(--cinnabar-d); font-size: var(--step-0);
}
.notice__list li b::before { content: "❖ "; color: var(--gold); }
/* An item with no `lead` is simply a paragraph in the list — no marker, no rule, no
   sub-heading. The sheet distinguishes its lines only by a ★/＊/※ glyph we do not
   render, so on the page they are all just lines of the notice. A previous version
   gave the undated ones their own gold-ruled 「每月通告」 block; that heading appears
   nowhere on the printed sheet, and it is what made the section confusing to read
   beside the scan. The rules that styled it were removed with it. */
/* The standing 鸞壇部 line — true of every month, so it sits once under the cards
   rather than repeating inside each. Set quieter than a notice item: it is context,
   not this month's news. */
.notice-standing {
  margin-top: 1.4rem; padding-left: 1rem;
  border-left: 3px solid var(--gold);
  font-size: var(--step--1); line-height: 1.8; color: var(--ink-soft);
  max-width: none;
}
.notice-scans { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem,1fr)); margin-top: 1.8rem; }
.notice-scans .figure img { max-height: 24rem; object-fit: contain; background: var(--paper-veil); }

/* master portrait mount */
.master__figure img { aspect-ratio: 3 / 4; object-fit: cover; width: 100%; height: 100%; }

/* =========================================================================
   Contact + form
   ========================================================================= */
.contact-grid { display: grid; gap: clamp(1.6rem,4vw,3rem); grid-template-columns: 1fr; }
.info-list { list-style: none; display: grid; gap: 1.1rem; margin: 0; padding: 0; }
.info-list li { display: flex; gap: .9rem; align-items: flex-start; }
.info-list .k { flex:none; width: 2.6rem; height:2.6rem; display:grid; place-items:center;
  background: var(--paper-deep); border:1px solid var(--line-strong); border-radius: 50%; color: var(--cinnabar); }
.info-list .v { line-height: 1.65; }
.info-list .v b { display:block; font-family: var(--serif); font-size: 1.05rem; }
.info-list a { color: var(--cinnabar-d); text-decoration: none; font-weight: 600; }
.info-list a:hover { text-decoration: underline; }
@media (max-width: 48rem) {
  /* smaller icon column + tighter gutter so the address/phone/email text gets more line width */
  .info-list li { gap: .8rem; }
  .info-list .k { width: 2.2rem; height: 2.2rem; }
}

.form { background: var(--paper-veil); border:1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.3rem,3vw,2rem); box-shadow: var(--shadow); }
.field { margin-bottom: 1.1rem; }
.field label { display:block; font-weight:600; font-size: .95rem; margin-bottom: .35rem; }
.field label .req { color: var(--cinnabar); }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 1.02rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: .7rem .85rem; transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--cinnabar);
  box-shadow: 0 0 0 3px rgba(176,39,29,.14); }
.field textarea { min-height: 8rem; resize: vertical; }
.form__note { font-size: var(--step--1); color: var(--ink-soft); margin-top: -.3rem; margin-bottom: 1rem; }
.form__status { margin-top: 1rem; padding: .9rem 1rem; border-radius: var(--radius); font-size: .95rem; display:none; }
.form__status.ok { display:block; background: #eef4ec; border:1px solid #b9d3ad; color: #2f5d3a; }
.form__status.err { display:block; background:#f8eae7; border:1px solid #e2b3ac; color: var(--cinnabar-d); }
.honey { position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden; }

/* 職事榜 (duty board) — contacts + responsibilities panel, top of the Contact section */
.duty-board {
  background: var(--paper-veil); border-radius: 0; border-top: 3px solid var(--gold);
  max-width: var(--measure);
  margin-bottom: clamp(2rem, 4vw, 3rem);
  padding: 1.6rem clamp(1.2rem,3vw,1.8rem) 1.8rem;
}
.duty-board__title { font-family: var(--serif); font-size: var(--step-1); color: var(--ink); margin-bottom: 1rem; }
.duty-board__list { list-style: none; padding: 0; margin: 0; }
.duty-board__row { padding-block: 1.1rem; }
.duty-board__row + .duty-board__row { border-top: 1px solid var(--line); }
.duty-board__who { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.duty-board__name { font-family: var(--serif); font-weight: 700; font-size: var(--step-1); color: var(--ink); }
.duty-board__row:first-child .duty-board__name { color: var(--cinnabar-d); }
.duty-board__plaque { font-family: var(--serif); font-size: var(--step--1); padding: 2px 10px; border-radius: 0; }
.duty-board__plaque--cinnabar { background: var(--cinnabar); color: #fbeecb; }
.duty-board__plaque--gold { background: var(--paper-deep); border: 1px solid var(--gold); color: var(--ink-soft); }
.duty-board__desc { margin-top: .4rem; font-size: var(--step--1); color: var(--ink-soft); max-width: none; }
.duty-board__tel {
  display: inline-flex; align-items: center; margin-top: .5rem;
  min-height: 44px; min-width: 44px;
  font-weight: 700; font-size: var(--step-1); color: var(--cinnabar-d); text-decoration: none;
}
.duty-board__tel:hover { text-decoration: underline; }
.duty-board__note {
  margin-top: 1.3rem; padding-top: 1.1rem; border-top: 1px solid var(--line);
  font-size: var(--step--1); color: var(--ink-soft); max-width: none;
}
.duty-board__note a { color: var(--cinnabar-d); font-weight: 600; text-decoration: none; }

/* desktop: full-width duty board, the two 道長 rows sit side-by-side */
@media (min-width: 48rem) {
  .duty-board { max-width: none; margin-bottom: 2.4rem; }
  .duty-board__list { display: grid; grid-template-columns: 1fr 1fr; }
  .duty-board__row + .duty-board__row {
    border-top: 0; border-left: 1px solid var(--line); padding-left: 2rem;
  }
}

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer {
  position: relative; overflow: hidden;
  background-color: #201812;
  background-image:
    radial-gradient(70% 90% at 50% -10%, rgba(216,182,86,.16), transparent 60%),
    radial-gradient(30% 40% at 12% 18%,  rgba(176,39,29,.14),  transparent 70%);
  color: #e8dcc4; padding-block: clamp(2.5rem,5vw,4rem);
}
.site-footer::before {  /* 回紋 cap band */
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 14px;
  background-color: var(--gold-leaf); opacity: .85;
  -webkit-mask-image: var(--hui-src); mask-image: var(--hui-src);
  -webkit-mask-repeat: repeat-x;      mask-repeat: repeat-x;
  -webkit-mask-size: 28px 14px;       mask-size: 28px 14px;
  -webkit-mask-position: center;      mask-position: center;
}
.site-footer a { color: var(--gold-hi); }
/* colophon (落款) — the couplet pair, read right-to-left; row-reverse keeps DOM/reading
   order (弘道濟世 first) while placing it visually on the right. */
.colophon { position: relative; z-index: 1; text-align: center; padding-block: 2.5rem; }
.colophon__couplet { display: flex; flex-direction: row-reverse; justify-content: center; gap: 2.2rem; }
.colophon__col {
  writing-mode: vertical-rl; text-orientation: upright;
  font-family: var(--serif); font-weight: 700; font-size: 1.7rem;
  color: var(--gold-leaf); letter-spacing: .3em;
}
.colophon__seal {
  width: 1.9rem; height: 1.9rem; font-size: .95rem; border-radius: 2px;
  margin: 1.4rem auto 0; transform: rotate(-2deg);
  box-shadow: inset 0 0 0 1px rgba(255,240,205,.5), inset 0 0 0 3px var(--cinnabar);
}
.foot-grid { display:grid; gap: 2rem; grid-template-columns: 1fr; }
/* colophon now lives inside .foot-grid (DOM-last) — on the single-column mobile grid,
   reorder it back to the top so phone composition reads identical to before the move */
@media (max-width: 48rem) {
  .colophon { order: -1; justify-self: center; }
}
.foot-brand { display:flex; align-items:center; gap:.8rem; }
.foot-brand img { inline-size: 3rem; }
.foot-brand .n { font-family: var(--serif); font-size: 1.3rem; letter-spacing:.06em; }
.foot-brand .n small { display:block; font-family: var(--sans); font-size:.66rem; letter-spacing:.16em; color: var(--gold-hi); text-transform: uppercase; }
.foot-col h4 { font-family: var(--sans); font-size:.78rem; letter-spacing:.2em; text-transform:uppercase; color: var(--gold-hi); margin-bottom:.7rem; }
.foot-col p, .foot-col li { font-size: .95rem; color:#cfc1a5; line-height:1.8; }
.foot-col ul { list-style: none; padding: 0; margin: 0; }
.foot-col a { text-decoration:none; }
.foot-col a:hover { text-decoration: underline; }
.foot-bottom { margin-top: 2.4rem; padding-top: 1.4rem; border-top: 1px solid rgba(205,165,68,.25);
  font-size: .82rem; color:#a89a7f; display:flex; flex-wrap:wrap; gap:.6rem 1.4rem; justify-content:space-between; }

/* =========================================================================
   Reveal animation
   ========================================================================= */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (min-width: 48rem) {
  .about-grid { grid-template-columns: 1.3fr .9fr; }
  .master { grid-template-columns: .8fr 1.2fr; }
  .contact-grid { grid-template-columns: .9fr 1.1fr; }
  .foot-grid { grid-template-columns: 1.5fr 1fr 1fr auto; }
  .site-footer { padding-top: clamp(2rem, 4vw, 3rem); }
  .colophon { padding-top: .4rem; padding-bottom: 0; }
  .colophon__couplet { gap: 1.4rem; }
  .colophon__col { font-size: 1.55rem; }
  .colophon__seal { margin-top: 1.2rem; }
  .head { --seal-rise: 1.2rem; }
  .head .seal { margin-left: -0.5rem; }
}
@media (min-width: 90rem) {
  .rail { display: grid; }
  body { padding-inline: 0; }
}

.nav-links__cta { display: none; }   /* mobile-only CTA, lives inside the dropdown (desktop uses .nav-cta) */

@media (max-width: 60rem) {
  .nav-links { display: none; }
  .nav-cta { display: none; }          /* keep the top bar to logo + toggle → header height never shifts */
  .nav-toggle { display: inline-flex; border-radius: var(--radius); transition: color .2s, background .2s; }
  .site-header.open .nav-toggle { color: var(--cinnabar); background: var(--paper-deep); }
  /* header surface unifies with the open panel — no translucent/solid seam */
  .site-header.open { background: var(--paper); backdrop-filter: none; -webkit-backdrop-filter: none; }

  /* hanging plaque board (掛牌) — paper ground + 回紋 crown band along the top edge.
     border-top (not the header's own border-bottom) carries the seam hairline: this panel
     is painted on top of the header, so its own border is what stays visible — reads as
     bar+panel being one continuous plaque. */
  .site-header.open .nav-links {
    display: flex; position: absolute; inset-inline: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0; padding-bottom: 1rem;
    background-color: var(--paper);
    background-image:
      radial-gradient(120% 80% at 50% -20%, rgba(181,138,46,.14), transparent 62%),
      repeating-linear-gradient(90deg, rgba(120,90,40,.022) 0 2px, transparent 2px 4px);
    border-top: 1px solid var(--line-strong);
    border-bottom: 2px solid var(--gold); box-shadow: var(--shadow-lift);
    max-height: calc(100dvh - 4.4rem); overflow-y: auto;
  }
  .site-header.open .nav-links::before {
    content: ""; flex: none; height: 12px;
    background-color: var(--gold);
    -webkit-mask-image: var(--hui-src); mask-image: var(--hui-src);
    -webkit-mask-repeat: repeat-x;      mask-repeat: repeat-x;
    -webkit-mask-size: 24px 12px;       mask-size: 24px 12px;
    -webkit-mask-position: center;      mask-position: center;
  }

  /* ink-fade dividers with a centred ❖ patch, replacing the plain li+li border */
  .site-header.open .nav-links li:not(.nav-links__cta) { position: relative; }
  .site-header.open .nav-links li:not(.nav-links__cta) + li:not(.nav-links__cta)::before {
    content: ""; position: absolute; left: 1.6rem; right: 1.6rem; top: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--line-strong) 14%, var(--line-strong) 86%, transparent);
  }
  .site-header.open .nav-links li:not(.nav-links__cta) + li:not(.nav-links__cta)::after {
    content: "❖"; position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%);
    width: 1.1rem; height: 1.1rem; display: grid; place-items: center;
    background: var(--paper); color: var(--gold-leaf); font-size: .6rem; line-height: 1;
  }

  /* rows: label only — no chip, no gloss, just even padding-block via min-height + flex centring */
  .site-header.open .nav-links li:not(.nav-links__cta) > a {
    display: flex; align-items: center; justify-content: center;
    min-height: 3.5rem; padding-inline: 1.4rem;
    font-family: var(--serif); font-size: 1.35rem; letter-spacing: .35em; color: var(--ink);
    transform: none;
  }
  .site-header.open .nav-links a::after { display: none; }

  /* active/tap state — paper-deep bg + inset cinnabar bar, never a translateY lift */
  .site-header.open .nav-links li:not(.nav-links__cta) > a:hover,
  .site-header.open .nav-links li:not(.nav-links__cta) > a:active {
    background: var(--paper-deep); color: var(--cinnabar-d);
    box-shadow: inset 3px 0 0 var(--cinnabar);
  }

  /* staggered reveal — animation (not transition) so it fires on display:none → flex */
  @keyframes navIn { from { opacity: 0; transform: translateY(-.5rem); } to { opacity: 1; transform: none; } }
  .site-header.open .nav-links li { animation: navIn .34s cubic-bezier(.2,.7,.3,1) both; animation-delay: calc(var(--i, 0) * 42ms); }

  /* the CTA renders as a lacquered plaque at the foot of the menu — flat, no lift/tilt */
  .nav-links__cta { display: block; border-top: 0 !important; margin: 1.1rem 1.4rem .2rem; transform: none; }
  .site-header.open .nav-links .nav-links__cta a {
    display: block; transform: none;
    background: var(--cinnabar); color: #fff; text-align: center; border-radius: 0;
    padding: .95rem 1rem; font-family: var(--sans); font-size: 1.02rem; font-weight: 600;
    letter-spacing: .14em; box-shadow: inset 0 0 0 3px rgba(216,182,86,.55);
  }
  .site-header.open .nav-links .nav-links__cta a:hover,
  .site-header.open .nav-links .nav-links__cta a:active { background: var(--cinnabar-d); color: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  .site-header.open .nav-links li { animation: none; }
}

/* Lineage stacks vertically on narrow screens → arrows point down, not sideways */
@media (max-width: 48rem) {
  .lineage { flex-direction: column; align-items: center; gap: .55rem; }
  .lineage__node { width: 100%; max-width: 24rem; }
  .lineage__arrow { transform: rotate(90deg); line-height: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
  .reveal { opacity: 1; transform: none; }
}
