/* TOKYO GRIMOIRE — shared "Chalk · Pure White" editorial theme (Phase 7 restyle)
   Used by /, /about, /contact, and the reading plate of /ar/{id}.

   Restyle only: this file changes the LOOK (light paper ground, Bodoni Moda +
   EB Garamond serif, hairline frames, engraved eyebrows, ornaments, the house
   seal). Every class name from the previous dark theme is preserved so the
   existing markup + Pages Function output keep rendering unchanged.

   The /ar AR hero (the black <model-viewer> stage) keeps its own inline styles
   and stays black — only the reading plate below it adopts this paper theme.
   Fonts are linked per page (Google Fonts) with a serif fallback here. */

:root {
  color-scheme: light;

  /* paper + ink (chalk / pure white) */
  --paper: #ffffff;
  --paper-2: #fafafa;
  --paper-edge: #f1f1f1;
  --ink: #14110f;
  --ink-2: rgba(20, 17, 15, 0.60);
  --ink-3: rgba(20, 17, 15, 0.38);
  --hair: rgba(20, 17, 15, 0.20);
  --hair-soft: rgba(20, 17, 15, 0.10);
  --accent: #14110f;            /* atmosphere, not efficacy */
  --accent-ink: #ffffff;
  --seal-ink: #14110f;
  --ok: #2f5d3a;                /* calm green — form success */
  --err: #6f2230;              /* oxblood — form error */

  /* type */
  --serif-display: "Bodoni Moda", "Didot", "Times New Roman", Georgia, serif;
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --font: var(--serif);         /* legacy alias */

  --radius: 0;                  /* sharp editorial cut */
  --maxw: 680px;

  /* legacy aliases (kept so any stray reference still resolves) */
  --bg: var(--paper);
  --bg-elev: var(--paper-2);
  --bg-card: var(--paper-2);
  --fg: var(--ink);
  --muted: var(--ink-2);
  --faint: var(--ink-3);
  --border: var(--hair);
  --border-strong: rgba(20, 17, 15, 0.32);
  --good: var(--ok);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* barely-there frontispiece vignette */
  background:
    radial-gradient(120% 80% at 50% 0%, #ffffff, var(--paper-2) 90%) no-repeat;
  background-attachment: fixed;
}

a { color: var(--ink); }
::selection { background: var(--ink); color: var(--paper); }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* engraved label + ornament divider — reusable editorial chrome */
.eyebrow {
  display: inline-block;
  font-family: var(--serif);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--ink-3);
}
.ornament { display: flex; align-items: center; gap: 14px; margin: 22px 0; }
.ornament .orn-rule { flex: 1; height: 1px; background: var(--hair); }
.ornament .orn-mark { font-size: 11px; color: var(--ink-2); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 22px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(120%) blur(10px);
  -webkit-backdrop-filter: saturate(120%) blur(10px);
  border-bottom: 1px solid var(--hair);
}
.site-header .brand {
  font-family: var(--serif-display); font-weight: 500;
  letter-spacing: 0.30em; text-transform: uppercase;
  font-size: 15px; text-decoration: none; color: var(--ink); white-space: nowrap;
}
.site-nav { display: flex; align-items: center; gap: 22px; }
.site-nav a {
  color: var(--ink-2); text-decoration: none;
  font-family: var(--serif); font-size: 13px;
  letter-spacing: 0.20em; text-transform: uppercase;
}
.site-nav a:hover { color: var(--ink); }
.site-nav .nav-cta { color: var(--accent-ink); }   /* solid ink button */
@media (max-width: 540px) {
  .site-nav { gap: 14px; }
  .site-nav .nav-label { display: none; }   /* keep the CTA on small screens */
}

/* ---------- footer ---------- */
.site-footer {
  margin-top: auto;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 30px 22px;
  border-top: 1px solid var(--hair);
  color: var(--ink-3);
  font-family: var(--serif); font-size: 13px;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.site-footer span { color: var(--ink-3); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px; padding: 0 26px; border-radius: var(--radius);
  font-family: var(--serif); font-size: 13px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent; -webkit-tap-highlight-color: transparent;
  transition: transform 0.06s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--accent-ink); border-color: var(--ink); }
.btn-primary:hover { opacity: 0.86; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--hair); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-lg { min-height: 54px; padding: 0 34px; font-size: 14px; letter-spacing: 0.20em; }

/* ---------- the house seal (brand mark) ---------- */
.tg-seal { display: block; color: var(--seal-ink); animation: tg-turn 80s linear infinite; }
.tg-seal-frame { stroke-width: 1; vector-effect: non-scaling-stroke; }
.tg-seal-ticks line { stroke-width: 1; }
.tg-seal-nodes { stroke-width: 1; }
.tg-seal-scrawl { stroke-width: 2.2; opacity: 0.92; }
.tg-seal-inscription {
  font-family: var(--serif); font-size: 27px; font-weight: 500;
  letter-spacing: 2.5px; opacity: 0.78;
}
@keyframes tg-turn { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---------- landing ---------- */
.landing {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 56px 22px 64px; gap: 0;
}
.landing .eyebrow { margin-bottom: 26px; }
.landing .landing-seal {
  width: clamp(232px, 62vw, 348px); height: clamp(232px, 62vw, 348px);
  margin: 0 0 30px;
}
.landing h1 {
  margin: 0 0 22px;
  font-family: var(--serif-display); font-weight: 600;
  font-size: clamp(38px, 11vw, 66px); line-height: 1.02; letter-spacing: 0.2px;
  text-wrap: balance;
}
.landing .persona { margin: 0 auto 12px; max-width: 30em; color: var(--ink); font-size: 19px; line-height: 1.6; }
.landing .draw { margin: 0 auto 30px; max-width: 32em; color: var(--ink-2); font-size: 17px; line-height: 1.65; }
.landing .cta-caption { margin: 18px auto 0; max-width: 30em; color: var(--ink-3); font-style: italic; font-size: 14px; line-height: 1.6; }

/* ---------- prose (about) ---------- */
.page { flex: 1; padding: 52px 0 12px; }
.page h1 {
  font-family: var(--serif-display); font-weight: 600;
  font-size: clamp(30px, 7vw, 44px); letter-spacing: 0.2px; line-height: 1.06;
  margin: 0 0 24px;
}
.prose { color: var(--ink-2); font-size: 17.5px; line-height: 1.75; }
.prose p { margin: 0 0 18px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose h2 {
  color: var(--ink); font-family: var(--serif-display); font-weight: 600;
  font-size: 22px; letter-spacing: 0.2px; margin: 34px 0 14px;
  padding-bottom: 11px; border-bottom: 1px solid var(--hair);
}

.use-modes { display: grid; gap: 16px; margin: 10px 0 20px; }
@media (min-width: 600px) { .use-modes { grid-template-columns: 1fr 1fr; } }
.use-mode { background: var(--paper-2); border: 1px solid var(--hair); border-radius: var(--radius); padding: 22px 22px 20px; }
.use-mode h3 { margin: 0 0 9px; color: var(--ink); font-family: var(--serif-display); font-size: 17px; font-weight: 600; letter-spacing: 0.2px; }
.use-mode p { margin: 0; color: var(--ink-2); font-size: 16px; line-height: 1.65; }

.note {
  margin-top: 26px; padding: 18px 20px;
  border: 1px solid var(--hair); border-left: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2); color: var(--ink-3);
  font-style: italic; font-size: 14.5px; line-height: 1.7;
}
.note strong { color: var(--ink); font-style: normal; }

/* ---------- contact form ---------- */
.form { display: grid; gap: 18px; max-width: 460px; }
.field { display: grid; gap: 7px; }
.field label {
  font-family: var(--serif); font-size: 12px;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-3);
}
.field input, .field textarea {
  width: 100%; background: var(--paper); color: var(--ink);
  border: 1px solid var(--hair); border-radius: var(--radius); padding: 13px 14px;
  font: 400 16px/1.5 var(--serif); resize: vertical;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--ink); }
.field textarea { min-height: 130px; }
/* honeypot — visually hidden, off-screen, not announced */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { font-size: 15px; min-height: 1.2em; font-style: italic; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--err); }

/* ---------- reading plate (/ar/{id} v2) ---------- */
.reading-wrap { background: var(--paper); padding: 40px 22px 8px; }
.reading { max-width: var(--maxw); margin: 0 auto; }
.reading-top { display: flex; flex-direction: column; align-items: center; text-align: center; }
.reading-top .ornament { width: 100%; max-width: 360px; margin: 16px auto 30px; }

.reading-name {
  font-family: var(--serif-display); font-weight: 600;
  font-size: clamp(24px, 6vw, 34px); letter-spacing: 0.2px; line-height: 1.1;
  margin: 0 0 14px;
}
.reading-meaning { color: var(--ink-2); font-size: 17.5px; line-height: 1.7; margin: 0 0 30px; }

.cues { display: grid; gap: 22px; margin: 0 0 30px; }
@media (min-width: 600px) { .cues { grid-template-columns: 1fr 1fr; gap: 28px; } }
.cue-group { padding-top: 14px; border-top: 1px solid var(--hair); }
.cue-group h3 {
  margin: 0 0 14px; font-family: var(--serif); font-size: 12px; font-weight: 500;
  letter-spacing: 0.26em; text-transform: uppercase; color: var(--ink-3);
}
.cue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cue { display: flex; align-items: center; gap: 13px; padding: 11px 0; border-top: 1px solid var(--hair-soft); }
.cue-list .cue:first-child { border-top: none; padding-top: 2px; }
.cue-figure { flex: 0 0 auto; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; }
.cue-icon { color: var(--accent); display: inline-flex; }
.cue-icon svg { width: 20px; height: 20px; }
.swatch { width: 22px; height: 22px; border-radius: 0; border: 1px solid var(--hair); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
.cue-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.cue-sense { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); }
.cue-cue { font-size: 16.5px; color: var(--ink); }

.breath {
  margin: 0 0 30px; padding: 18px 20px;
  border-left: 2px solid var(--ink);
  background: var(--paper-2);
  color: var(--ink-2); font-style: italic; font-size: 16px; line-height: 1.7;
}

.reading-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 22px; }
.hold-note { width: 100%; margin: 4px 0 0; color: var(--ink-3); font-style: italic; font-size: 13px; }
.reading-guard {
  margin: 0; text-align: center; color: var(--ink-3); font-style: italic;
  font-size: 13.5px; line-height: 1.6; letter-spacing: 0.02em;
}

/* ---------- /today — casting stage + reveal (Phase 7) ----------
   A dark casting stage (same spirit as the /ar black hero — glowing line-art
   sigils read well on it) sits above a paper reveal. The reveal is the LANDED
   state: it renders directly with no JS / reduced-motion / on reload. The
   casting animation (today.js) only plays on a real draw and is purely cosmetic;
   it always resolves to this same landed layout. */
.today-page { display: flex; flex-direction: column; min-height: 100vh; }

/* dark casting stage */
.cast-band {
  position: relative;
  background: #050505;
  padding: 30px 22px 40px;
  display: flex; flex-direction: column; align-items: center;
  overflow: hidden;
}
.cast-band::before {            /* soft center vignette to focus the chosen */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(58% 58% at 50% 47%, rgba(46, 43, 70, 0.55), #050505 78%);
}
.cast-brand {
  position: relative; z-index: 2;
  margin-bottom: 18px;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--serif); font-size: 12px;
  letter-spacing: 0.28em; text-transform: uppercase;
}
.cast-stage {
  position: relative; z-index: 2;
  width: min(86vw, 360px); aspect-ratio: 1 / 1;
}

/* a single seal slot — absolutely placed, centered on (left,top) via translate.
   Slot classes hold the LANDED layout; today.js overrides transform/opacity
   inline during the cast, then clears it so these rules resume (responsive). */
.cast-seal {
  position: absolute; left: 50%; top: 50%;
  width: 38%; aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%) scale(var(--s, 1));
  color: rgba(244, 242, 255, 0.92);
  will-change: transform, opacity;
}
.cast-seal-art {
  width: 100%; height: 100%; display: block;
  filter: drop-shadow(0 0 6px rgba(180, 172, 235, 0.35));
}
.slot-chosen { left: 50%; top: 50%; --s: 1.12; z-index: 3; }
.slot-chosen .cast-seal-art { filter: drop-shadow(0 0 16px rgba(190, 182, 255, 0.55)); }
.slot-left  { left: 21%; top: 31%; --s: 0.56; opacity: 0.42; z-index: 1; }
.slot-right { left: 79%; top: 31%; --s: 0.56; opacity: 0.42; z-index: 1; }

/* paper reveal (landed copy) */
.reveal.container { padding-top: 40px; padding-bottom: 8px; text-align: center; }
.reveal-eyebrow { display: block; margin: 0 0 18px; }
.reveal-heading {
  margin: 0 0 30px;
  font-family: var(--serif-display); font-weight: 600;
  font-size: clamp(26px, 6.4vw, 40px); line-height: 1.12; letter-spacing: 0.2px;
  text-wrap: balance;
}

.reveal-chosen { display: flex; flex-direction: column; align-items: center; }
.reveal-chosen-name { margin: 0 0 12px; }
.reveal-chosen-meaning { max-width: 30em; margin: 0 0 26px; }
.reveal-cta { margin: 2px 0 0; }

.reveal-divider { width: 100%; max-width: 320px; margin: 38px auto 26px; }

.reveal-others { margin: 0 0 8px; }
.reveal-others-label { display: block; margin: 0 0 16px; }
.reveal-others-list {
  list-style: none; margin: 0 0 18px; padding: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.reveal-other {
  color: var(--ink-3); font-size: 16px; line-height: 1.5;
}
.reveal-other-name {
  font-family: var(--serif-display); font-weight: 500;
  color: var(--ink-2); letter-spacing: 0.2px;
}
.reveal-other-summary { color: var(--ink-3); font-style: italic; }
.reveal-others-note {
  margin: 0; color: var(--ink-3); font-style: italic;
  font-size: 13.5px; line-height: 1.6;
}

/* footer */
.today-footer {
  margin-top: auto;
  padding: 30px 22px 36px;
  border-top: 1px solid var(--hair);
  text-align: center;
}
.today-foot-line {
  margin: 0 0 14px; color: var(--ink-2);
  font-style: italic; font-size: 14.5px; line-height: 1.6;
}
.today-foot-nav {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  color: var(--ink-3);
  font-family: var(--serif); font-size: 13px;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.today-foot-nav a { color: var(--ink-2); text-decoration: none; }
.today-foot-nav a:hover { color: var(--ink); }
.today-foot-nav span { color: var(--ink-3); }

/* ---------- /sigils — The Grimoire archive (Phase 7 PR-A) ----------
   Pure-white editorial index of all 167 sigils. The page is paper; only each
   card's THUMB is a dark-inset panel holding the house seal as ink line-art
   (no glow). Cards + chips + count are baked into the static HTML by
   pipeline/build_sigils_index.py; /assets/sigils.js only filters the baked DOM,
   so there is no entrance animation here (reduced-motion needs nothing extra). */

/* screen-reader-only utility */
.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;
}

.archive {
  flex: 1; width: 100%; max-width: 1180px; margin: 0 auto;
  padding: 48px 22px 28px;
}

.archive-intro { max-width: var(--maxw); margin: 0 0 30px; }
.archive-title {
  margin: 0 0 12px;
  font-family: var(--serif-display); font-weight: 600;
  font-size: clamp(34px, 8vw, 52px); line-height: 1.04; letter-spacing: 0.2px;
}
.archive-sub {
  margin: 0; max-width: 34em;
  font-family: var(--serif); font-style: italic;
  color: var(--ink-2); font-size: 18px; line-height: 1.6;
}

/* ----- controls: search · chips · sort · count ----- */
.archive-controls {
  margin: 0 0 26px; padding: 0 0 22px;
  border-bottom: 1px solid var(--hair);
  display: grid; gap: 18px;
}
.archive-search { max-width: 360px; width: 100%; }
.search-input {
  width: 100%; background: var(--paper); color: var(--ink);
  border: 1px solid var(--hair); border-radius: var(--radius);
  padding: 11px 14px; font: 400 16px/1.4 var(--serif);
}
.search-input::placeholder { color: var(--ink-3); font-style: italic; }
.search-input:focus { outline: none; border-color: var(--ink); }

.filter-group { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 12px; }
.filter-label {
  flex: 0 0 auto; min-width: 66px;
  font-family: var(--serif); font-size: 11px; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-3);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none; cursor: pointer;
  background: var(--paper); color: var(--ink-2);
  border: 1px solid var(--hair); border-radius: var(--radius);
  padding: 6px 13px; min-height: 32px;
  font-family: var(--serif); font-size: 12.5px;
  letter-spacing: 0.1em; text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.chip.is-active { background: var(--ink); color: var(--accent-ink); border-color: var(--ink); }

.archive-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px;
}
.sort-field { display: flex; align-items: center; gap: 10px; }
.sort-field .filter-label { min-width: 0; }
.sort-select {
  appearance: none; cursor: pointer;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--hair); border-radius: var(--radius);
  padding: 7px 30px 7px 12px; min-height: 32px;
  font: 400 14px/1.2 var(--serif);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: right 13px center, right 8px center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.sort-select:focus { outline: none; border-color: var(--ink); }
.archive-count {
  margin: 0; color: var(--ink-3);
  font-family: var(--serif); font-size: 12px;
  letter-spacing: 0.2em; text-transform: uppercase;
}

/* ----- the grid ----- */
.archive-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.sigil-card { margin: 0; }
.sigil-card[hidden] { display: none; }
.sigil-card-link {
  display: flex; flex-direction: column; gap: 11px;
  height: 100%; padding: 14px 14px 16px;
  text-decoration: none; color: var(--ink);
  border: 1px solid var(--hair); border-radius: var(--radius);
  background: var(--paper);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}
.sigil-card-link:hover { border-color: var(--ink); box-shadow: 0 6px 22px rgba(20, 17, 15, 0.08); }
.sigil-card-link:active { transform: translateY(1px); }
.sigil-card-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* dark-inset thumb — the only dark surface; holds the ink-line house seal */
.sigil-thumb {
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1; width: 100%;
  background: #0e0e13; color: rgba(238, 236, 247, 0.62);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.sigil-seal { width: 74%; height: 74%; display: block; }   /* ink line-art, no glow */
.sigil-thumb-img { width: 100%; height: 100%; object-fit: contain; display: block; }

.sigil-name {
  font-family: var(--serif-display); font-weight: 600;
  font-size: 17px; line-height: 1.18; letter-spacing: 0.2px; color: var(--ink);
}
.sigil-meta {
  font-family: var(--serif); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3);
}
.sigil-summary {
  font-family: var(--serif); font-size: 14.5px; line-height: 1.5; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.archive-empty {
  margin: 28px 0 0; color: var(--ink-3);
  font-family: var(--serif); font-style: italic; font-size: 16px;
}

@media (max-width: 460px) {
  .archive-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .filter-label { min-width: 100%; }
}
