/* ============================================================
   I Ching Journal — design system
   Dark luxury / "quiet ritual" aesthetic
   ink #090a0b · gold #c9b99a · ember #ff5a1f
   ============================================================ */

:root {
  /* palette */
  --ink:        #090a0b;
  --ink-2:      #0d0f10;
  --ink-3:      #121415;
  --panel:      #101213;
  --panel-2:    #15181a;
  --line:       rgba(201, 185, 154, 0.14);
  --line-soft:  rgba(201, 185, 154, 0.07);
  --line-hot:   rgba(255, 90, 31, 0.32);

  --gold:       #c9b99a;
  --gold-dim:   #8e826c;
  --gold-bright:#e6d9bd;
  --ember:      #ff5a1f;
  --ember-soft: rgba(255, 90, 31, 0.12);
  --jade:       #6f9c86;
  --wine:       #a8443c;

  --text:       #ece7df;
  --text-2:     #a9a49b;
  --text-3:     #6f6b65;

  /* type */
  --serif:  "Cormorant Garamond", "Songti SC", Georgia, serif;
  --sans:   "Syne", "Helvetica Neue", Arial, sans-serif;
  --body:   "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;

  /* metrics */
  --wrap:   1200px;
  --wrap-n: 760px;
  --r:      4px;
  --r-l:    10px;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.9);
  --ease:   cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------------- reset ---------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 16.5px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* fixed atmosphere layer — grain + halo */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 620px at 78% -8%, rgba(255, 90, 31, 0.09), transparent 62%),
    radial-gradient(760px 560px at 8% 4%, rgba(201, 185, 154, 0.07), transparent 60%),
    radial-gradient(1000px 700px at 50% 118%, rgba(111, 156, 134, 0.05), transparent 65%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
}

main, header, footer, .atmo-content { position: relative; z-index: 1; }

img, svg { max-width: 100%; display: block; }

a { color: var(--gold); text-decoration: none; transition: color 0.25s var(--ease); }
a:hover { color: var(--ember); }

::selection { background: var(--ember); color: #fff; }

/* Keyboard focus. The browser default ring is near-invisible against a #090a0b
   background, and the site is fully keyboard-operable (cast tool, filter chips,
   search, journal), so make focus unmistakable. :focus-visible keeps it off
   mouse clicks. */
:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
  border-radius: 2px;
}
.btn:focus-visible,
.hex-tile:focus-visible,
.chip:focus-visible,
.method:focus-visible,
.nav-toggle:focus-visible,
.search-in:focus-visible,
#q:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 3px;
}

/* ---------------- layout ---------------- */
.wrap { width: min(100% - 48px, var(--wrap)); margin-inline: auto; }
.wrap-n { width: min(100% - 48px, var(--wrap-n)); margin-inline: auto; }

section { padding: 92px 0; }
section.tight { padding: 56px 0; }

.rule {
  height: 1px;
  border: 0;
  margin: 0;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

/* ---------------- type ---------------- */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.012em;
  margin: 0 0 0.5em;
  color: var(--text);
  font-variant-numeric: lining-nums;
}
h1 { font-size: clamp(2.7rem, 6.4vw, 5rem); }
h2 { font-size: clamp(1.9rem, 3.6vw, 3rem); }
h3 { font-size: clamp(1.35rem, 2.2vw, 1.85rem); }
h4 { font-size: 1.2rem; }

/* lining figures anywhere the number is data, not decoration */
.sub, .no, .eyebrow, .hero-meta, .meta-table, .toss-row, .jentry .d, .pill,
.btn, .nav a, .brand, .chip, .foot-bot, .browse-count, .crumbs {
  font-variant-numeric: lining-nums tabular-nums;
}

p { margin: 0 0 1.15em; color: var(--text-2); }
p.lead { font-size: 1.16rem; color: #cbc5bb; }
strong { color: var(--text); font-weight: 600; }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 18px;
}
.eyebrow.hot { color: var(--ember); }

.accent { color: var(--ember); }
.gold { color: var(--gold); }
.italic { font-style: italic; }

.serif-txt {
  font-family: var(--serif);
  font-size: 1.22rem;
  line-height: 1.66;
  color: #d6cfc3;
}

/* ---------------- header ---------------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(9, 10, 11, 0.78);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid var(--line-soft);
}
.site-head .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  height: 66px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { color: var(--text); }
.brand .mark {
  width: 22px; height: 22px;
  flex: 0 0 22px;
  color: var(--gold);
}
.brand b { color: var(--ember); font-weight: 700; }

.nav { display: flex; align-items: center; gap: 30px; }
.nav a {
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--gold-bright); }

.head-cta { display: flex; align-items: center; gap: 14px; }

.nav-toggle {
  display: none;
  background: none; border: 0; cursor: pointer;
  padding: 8px; color: var(--gold);
}

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 15px 28px;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  white-space: nowrap;
}
.btn-primary {
  background: var(--ember);
  color: #fff;
  box-shadow: 0 14px 34px -16px rgba(255, 90, 31, 0.7);
}
.btn-primary:hover {
  background: #ff6f3c; color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 20px 40px -16px rgba(255, 90, 31, 0.85);
}
.btn-ghost {
  background: transparent;
  color: var(--gold);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-bright); background: rgba(201,185,154,0.05); }
.btn-lg { padding: 18px 38px; font-size: 0.84rem; }
.btn-sm { padding: 10px 18px; font-size: 0.7rem; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }

/* ---------------- hero ---------------- */
.hero { padding: clamp(64px, 11vw, 132px) 0 84px; }
/* The hero's radial glow is a decorative bleed (inset:-12% on .glow). Clipping
   the x axis at the full-bleed hero band removes the off-screen overflow that
   otherwise pushed documentElement.scrollWidth past the viewport at every width
   below ~1440px. Only the already-invisible off-screen part is clipped, so the
   rendered look is unchanged; overflow-y stays visible so the halo still bleeds
   vertically. */
.hero { overflow-x: clip; overflow-y: visible; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 72px;
  align-items: center;
}
.hero h1 { margin-bottom: 24px; }
.hero h1 em { font-style: italic; color: var(--ember); }
.hero .lead { max-width: 46ch; margin-bottom: 34px; }
.hero-actions { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; margin-bottom: 34px; }
.hero-link {
  font-family: var(--sans); font-size: 0.76rem; letter-spacing: 0.1em;
  color: var(--text-2); border-bottom: 1px solid var(--line); padding-bottom: 3px;
}
.hero-link:hover { color: var(--ember); border-color: var(--ember); }

.trust-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
  border-top: 1px solid var(--line-soft); padding-top: 26px;
}
.trust-row b {
  display: block; font-family: var(--serif); font-size: 1.7rem; font-weight: 500;
  color: var(--gold); line-height: 1; margin-bottom: 7px;
  font-variant-numeric: lining-nums;
}
.trust-row span { font-size: 0.82rem; color: var(--text-3); line-height: 1.45; display: block; }

.hero-meta {
  display: flex; gap: 30px; flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-3);
}
.hero-meta b { display: block; font-family: var(--serif); font-size: 1.6rem; letter-spacing: 0; color: var(--gold); text-transform: none; }

.hero-art { display: grid; place-items: center; position: relative; }
.hero-art .glow {
  position: absolute; inset: -12%;
  background: radial-gradient(circle at 50% 50%, rgba(255,90,31,0.16), transparent 62%);
  filter: blur(14px);
}

/* ---------------- bagua wheel ---------------- */
.bagua { width: min(100%, 420px); height: auto; }
.bagua .ring { fill: none; stroke: var(--line); }
.bagua .tri line { stroke: var(--gold); stroke-width: 2.4; }
.bagua .tri.hot line { stroke: var(--ember); }
.bagua .spin-slow { transform-origin: 200px 200px; animation: spin 120s linear infinite; }
.bagua .spin-rev  { transform-origin: 200px 200px; animation: spin 180s linear infinite reverse; }
.bagua .core { fill: var(--ink-2); stroke: var(--line); }
.bagua text { font-family: var(--serif); fill: var(--gold-dim); font-size: 11px; letter-spacing: 0.14em; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- cards / grids ---------------- */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: linear-gradient(160deg, var(--panel), var(--ink-2));
  border: 1px solid var(--line-soft);
  border-radius: var(--r-l);
  padding: 28px;
  transition: border-color 0.35s var(--ease), transform 0.35s var(--ease);
}
.card:hover { border-color: var(--line); transform: translateY(-3px); }
.card h3 { margin-bottom: 10px; }
.card p:last-child { margin-bottom: 0; }

/* hexagram tiles */
/* minmax(0,1fr) instead of 1fr: a bare 1fr track has an automatic min-content
   minimum, and .hex-tile .no/.nm use white-space:nowrap — so a long tile label
   could force the track wider than the viewport and blow the whole page out. */
.hex-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: stretch; }

/* two-up variant used inside the narrow prose column (moving lines, nearby
   readings). Single column until there is genuinely room for two. */
.hex-grid.grid-pair { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) {
  .hex-grid.grid-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.hex-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 17px;
  min-height: 92px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  transition: all 0.28s var(--ease);
}
.hex-tile:hover {
  border-color: var(--line-hot);
  background: var(--panel-2);
  transform: translateX(2px);
}
.hex-tile .glyph {
  font-size: 1.9rem;
  line-height: 1;
  color: var(--gold);
  flex: 0 0 auto;
}
.hex-tile:hover .glyph { color: var(--gold-bright); }
.hex-tile .meta { min-width: 0; flex: 1 1 auto; position: relative; }
.hex-tile .no {
  font-family: var(--sans); font-size: 0.62rem; font-weight: 600;
  letter-spacing: 0.14em; color: var(--text-3); display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity 0.3s var(--ease);
}
.hex-tile .nm {
  font-family: var(--serif); font-size: 1.06rem; color: var(--text); line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
  transition: opacity 0.3s var(--ease);
}
.hex-tile .es {
  position: absolute; inset: 0; margin: 0;
  font-size: 0.8rem; line-height: 1.35; color: #cfc8bc;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; opacity: 0; transform: translateY(4px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  pointer-events: none;
}
.hex-tile:hover .es { opacity: 1; transform: none; }
.hex-tile:hover .no, .hex-tile:hover .nm { opacity: 0; }
.hex-tile .lines { flex: 0 0 auto; }

/* attribute chips under a hexagram title */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.chip-static {
  font-family: var(--sans); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--gold-dim); border: 1px solid var(--line);
  border-radius: 100px; padding: 6px 13px; background: rgba(201,185,154,0.03);
}

/* TL;DR line above the fold on a hexagram page */
.tldr {
  font-family: var(--serif); font-size: clamp(1.15rem, 1.9vw, 1.45rem);
  line-height: 1.5; color: var(--gold-bright); border-left: 2px solid var(--ember);
  padding-left: 20px; margin: 26px 0 0; max-width: 62ch;
}

/* conversion band */
.convert-band {
  border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 30px 32px; background: linear-gradient(160deg, var(--panel), var(--ink-2));
  display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.convert-band h3 { margin: 0 0 6px; }
.convert-band p { margin: 0; max-width: 46ch; }

/* collapsible scholar block */
details.scholar {
  border: 1px solid var(--line-soft); border-radius: var(--r);
  padding: 18px 22px; background: var(--panel); margin-top: 34px;
}
details.scholar summary {
  cursor: pointer; font-family: var(--sans); font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-dim);
}
details.scholar[open] summary { margin-bottom: 16px; }

/* "you asked" echo on the result page */
.you-asked {
  font-family: var(--serif); font-size: 1.2rem; font-style: italic;
  color: var(--gold); border-left: 2px solid var(--line); padding-left: 18px; margin: 0 0 26px;
}
.heading-arrow { text-align: center; color: var(--ember); font-size: 1.4rem; margin: 6px 0; }

/* ---------------- hexagram line diagram ----------------
   Pure lines, one stroke weight everywhere. No metal, no gradient:
   the lines carry information, the surface carries atmosphere. */
.lines { display: grid; gap: 9px; width: 108px; }
.lines .ln { display: flex; gap: 9px; height: 12px; }
.lines .ln i {
  display: block; height: 100%; border-radius: 1px;
  background: var(--gold);
}
.lines .ln.yin i { width: calc(50% - 4.5px); }
.lines .ln.yang i { width: 100%; }
.lines .ln.changing i { background: var(--ember); }
.lines .ln .tag {
  font-family: var(--sans); font-size: 0.62rem; color: var(--ember);
  align-self: center; margin-left: 7px; letter-spacing: 0.08em;
}
.lines.lg { width: 138px; gap: 11px; }
.lines.lg .ln { height: 15px; gap: 11px; }
.lines.lg .ln.yin i { width: calc(50% - 5.5px); }
.lines.sm { width: 58px; gap: 6px; }
.lines.sm .ln { height: 7px; gap: 5px; }
.lines.sm .ln.yin i { width: calc(50% - 2.5px); }
.lines.xs { width: 46px; gap: 5px; }
.lines.xs .ln { height: 6px; gap: 4px; }
.lines.xs .ln.yin i { width: calc(50% - 2px); }

/* hexagram detail hero — the diagram is the hero, not an icon */
.hex-hero {
  display: grid; grid-template-columns: auto 1fr; gap: 48px; align-items: start;
  margin-top: 8px;
}
.hex-hero-art {
  padding: 26px 24px; border: 1px solid var(--line); border-radius: var(--r-l);
  background: linear-gradient(160deg, var(--panel), var(--ink-2));
}
.hex-hero-text h1 { margin: 6px 0 8px; font-size: clamp(2.1rem, 4.4vw, 3.4rem); }

/* ---------------- tool (cast) ---------------- */
.tool-shell {
  background: linear-gradient(170deg, var(--panel), var(--ink-2) 55%, var(--ink));
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: clamp(26px, 4vw, 52px);
  box-shadow: var(--shadow);
}
.step { display: none; }
.step.active { display: block; animation: fade 0.5s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.step-dots { display: flex; gap: 9px; margin-bottom: 34px; align-items: center; }
.step-dots span {
  width: 26px; height: 2px; background: var(--line); border-radius: 2px;
  transition: background 0.4s var(--ease);
}
.step-dots span.on { background: var(--ember); }

.field { margin-bottom: 22px; }
.field label {
  display: block; font-family: var(--sans); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-dim); margin-bottom: 10px;
}
.field textarea, .field input, .field select {
  width: 100%; padding: 15px 17px;
  background: var(--ink-3); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r);
  font-family: var(--body); font-size: 1rem; line-height: 1.6;
  resize: vertical; transition: border-color 0.25s var(--ease);
}
.field textarea:focus, .field input:focus, .field select:focus {
  outline: none; border-color: var(--gold);
}
.field textarea::placeholder, .field input::placeholder { color: var(--text-3); }
.field .hint { font-size: 0.82rem; color: var(--text-3); margin-top: 8px; }

.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.method {
  text-align: left; padding: 22px;
  background: var(--ink-3); border: 1px solid var(--line-soft);
  border-radius: var(--r); cursor: pointer; transition: all 0.3s var(--ease); color: inherit;
  font-family: inherit;
}
.method:hover { border-color: var(--line); }
.method[aria-pressed="true"] { border-color: var(--ember); background: var(--ember-soft); }
.method b { display: block; font-family: var(--serif); font-size: 1.16rem; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.method span { font-size: 0.84rem; color: var(--text-2); line-height: 1.5; }

/* coin toss visual */
.coins { display: flex; gap: 16px; justify-content: center; margin: 32px 0; }
.coin {
  width: 62px; height: 62px; border-radius: 50%;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 34% 30%, #1b1f21, #0c0e0f);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.5rem; color: var(--gold-dim);
  transition: all 0.4s var(--ease);
}
.coin.hit { color: var(--ink); background: radial-gradient(circle at 34% 30%, #e6d9bd, #b8a67f); border-color: var(--gold-bright); }
.coin span { transform: translateY(-1px); }

.toss-row { display: flex; align-items: center; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.toss-row .n { font-family: var(--sans); font-size: 0.66rem; letter-spacing: 0.14em; color: var(--text-3); width: 62px; }
.toss-row .val { font-family: var(--serif); font-size: 1.05rem; color: var(--gold); width: 120px; }

/* result */
.result-head { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; margin-bottom: 30px; }
.result-head .glyph { font-size: 3.4rem; line-height: 1; color: var(--gold); }
.result-head h2 { margin: 0 0 4px; }
.result-head .sub { font-family: var(--sans); font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-3); }

.panel {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--r-l); padding: 26px 28px; margin-bottom: 20px;
}
.panel h3 { font-size: 1.25rem; margin-bottom: 12px; }
.panel .pin { font-family: var(--sans); font-size: 0.64rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ember); margin-bottom: 10px; }

.pill {
  display: inline-block; padding: 5px 12px; border-radius: 100px;
  border: 1px solid var(--line); font-family: var(--sans);
  font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-dim);
  margin: 0 6px 6px 0;
}
.pill.hot { border-color: var(--line-hot); color: var(--ember); }

/* journal */
.jentry {
  border: 1px solid var(--line-soft); border-radius: var(--r);
  padding: 18px 20px; margin-bottom: 12px; background: var(--panel);
}
.jentry .top { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; margin-bottom: 8px; }
.jentry .q { font-family: var(--serif); font-size: 1.1rem; color: var(--text); }
.jentry .d { font-family: var(--sans); font-size: 0.66rem; color: var(--text-3); white-space: nowrap; }
.jentry .r { font-size: 0.9rem; color: var(--text-2); margin: 0; }

/* article prose */
.prose h2 { margin-top: 2.2em; }
.prose h3 { margin-top: 1.8em; }
.prose ul, .prose ol { color: var(--text-2); padding-left: 22px; margin-bottom: 1.2em; }
.prose li { margin-bottom: 0.55em; }
.prose blockquote {
  margin: 28px 0; padding: 4px 0 4px 24px;
  border-left: 2px solid var(--ember);
  font-family: var(--serif); font-size: 1.3rem; font-style: italic; color: #d9d2c6;
}
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em; background: var(--ink-3); padding: 2px 6px; border-radius: 3px; color: var(--gold-bright);
}

/* two-column article layout */
.layout-2 {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 60px;
  align-items: start;
}
.side-nav { position: sticky; top: 92px; }
.side-nav ol { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.side-nav li { margin-bottom: 12px; }
.side-nav a {
  font-family: var(--sans); font-size: 0.72rem; letter-spacing: 0.08em;
  color: var(--text-3); text-transform: uppercase;
}
.side-nav a:hover { color: var(--ember); }

/* breadcrumbs */
.crumbs {
  font-family: var(--sans); font-size: 0.66rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 22px;
}
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--gold); }
.crumbs span { margin: 0 9px; color: var(--line); }

/* meta table */
.meta-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.meta-table th, .meta-table td { text-align: left; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.meta-table th { font-family: var(--sans); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-dim); font-weight: 600; width: 40%; }
.meta-table td { color: var(--text); }
.meta-table tr:last-child th, .meta-table tr:last-child td { border-bottom: 0; }

/* inline callout — one emphasised point inside prose */
.callout {
  border-left: 2px solid var(--ember);
  background: var(--ember-soft);
  border-radius: 0 var(--r) var(--r) 0;
  padding: 16px 20px;
  margin: 26px 0;
}
.callout p { margin: 0; color: var(--text); font-size: 0.95rem; }
.callout strong { color: var(--gold-bright); }

/* "moving" badge in the coin throw table */
.mv {
  font-family: var(--sans); font-size: 0.6rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ember); margin-left: 8px; white-space: nowrap;
}

.dim { color: var(--text-3); font-weight: 400; font-size: 0.78em; letter-spacing: 0.08em; }

/* affiliate / recommendation module */
.aff {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border-radius: var(--r-l);
  padding: 26px 28px;
  margin: 36px 0;
}
.aff-pin {
  font-family: var(--sans); font-size: 0.64rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ember); margin: 0 0 10px;
}
.aff-intro { font-size: 0.93rem; color: var(--text-2); margin: 0 0 18px; }
.aff-list { list-style: none; padding: 0; margin: 0; }
.aff-list li { padding: 13px 0; border-top: 1px solid var(--line-soft); margin: 0; }
.aff-list li:first-child { border-top: 0; padding-top: 0; }
.aff-list a {
  font-family: var(--serif); font-size: 1.14rem; color: var(--gold-bright);
  text-decoration: none; border-bottom: 1px solid transparent;
}
.aff-list a:hover { border-bottom-color: var(--gold-dim); }
.aff-list a::after { content: " \2197"; font-size: 0.7em; color: var(--gold-dim); }
.aff-list span { display: block; font-size: 0.88rem; color: var(--text-2); margin-top: 5px; }
.aff-note { font-size: 0.78rem; color: var(--text-3); margin: 16px 0 0; line-height: 1.6; }
.aff-note a { color: var(--gold-dim); }

/* filter bar */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }
.chip {
  font-family: var(--sans); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 9px 16px; border-radius: 100px;
  border: 1px solid var(--line); background: transparent; color: var(--text-2);
  cursor: pointer; transition: all 0.25s var(--ease);
}
.chip:hover { border-color: var(--gold); color: var(--gold); }
.chip[aria-pressed="true"] { background: var(--ember); border-color: var(--ember); color: #fff; }
.search-in {
  flex: 1 1 220px; min-width: 180px; padding: 10px 16px;
  background: var(--ink-3); border: 1px solid var(--line); border-radius: 100px;
  color: var(--text); font-family: var(--body); font-size: 0.92rem;
}
.search-in:focus { outline: none; border-color: var(--gold); }
.empty { color: var(--text-3); font-style: italic; padding: 30px 0; }

/* footer */
.site-foot { border-top: 1px solid var(--line-soft); padding: 62px 0 34px; margin-top: 40px; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 44px; margin-bottom: 46px; }
.site-foot h4 {
  font-family: var(--sans); font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-dim); margin-bottom: 16px;
}
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin-bottom: 9px; }
.site-foot a { font-size: 0.92rem; color: var(--text-2); }
.foot-bot {
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding-top: 26px; border-top: 1px solid var(--line-soft);
  font-family: var(--sans); font-size: 0.68rem; letter-spacing: 0.1em; color: var(--text-3);
}

/* ad slot */
.ad-slot {
  border: 1px dashed var(--line); border-radius: var(--r);
  min-height: 108px; display: grid; place-items: center;
  font-family: var(--sans); font-size: 0.62rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--text-3); margin: 34px 0;
}

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); padding: 13px 22px; border-radius: 100px;
  font-size: 0.86rem; opacity: 0; pointer-events: none;
  transition: all 0.35s var(--ease); z-index: 200;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- responsive ---------------- */
@media (max-width: 980px) {
  .nav { display: none; }
  .nav-toggle { display: block; }
  .nav.open {
    display: flex; flex-direction: column; align-items: flex-start;
    position: absolute; top: 66px; left: 0; right: 0;
    background: var(--ink-2); border-bottom: 1px solid var(--line);
    padding: 22px 24px; gap: 18px;
    box-shadow: 0 30px 60px -30px rgba(0,0,0,.9);
  }
}
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
  .hex-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layout-2 { grid-template-columns: minmax(0, 1fr); gap: 34px; }
  .side-nav { position: static; }
  .side-nav ol { display: flex; flex-wrap: wrap; gap: 16px; }
  .side-nav p .btn { display: inline-flex; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .hex-hero { grid-template-columns: 1fr; gap: 26px; }
  .hex-hero-art { display: inline-block; }
  .head-cta .btn .full { display: none; }
  .head-cta .btn { padding: 11px 16px; }
  .brand { font-size: 0.72rem; letter-spacing: 0.14em; gap: 9px; }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero-art { order: 2; }
  .hero-art .bagua { width: min(100%, 300px); }
  .hero { padding: 46px 0 64px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-grid { grid-template-columns: 1fr; }
  .result-head { gap: 18px; }
  .side-nav p { display: inline-block; margin-right: 10px; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  section { padding: 58px 0; }
  .wrap, .wrap-n { width: calc(100% - 34px); }
  .hex-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; gap: 30px; }
  .toss-row .val { width: 88px; }
  .site-head .inner { height: 60px; }
  .nav.open { top: 60px; }
  .hero-meta { gap: 20px; display: grid; grid-template-columns: 1fr 1fr; }
  .hero-meta b { font-size: 1.45rem; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; }
  .hero-link { text-align: center; align-self: center; }
  .trust-row { grid-template-columns: 1fr; gap: 18px; }
  .btn { padding: 14px 22px; }
  /* Long button labels ("Back to hexagram 14: Possession in Great Measure")
     are wider than a phone. nowrap makes them unbreakable, so allow wrapping
     and cap them to the parent width. */
  .btn { white-space: normal; max-width: 100%; text-align: center; }
  .btn-lg { padding: 17px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
}

@media print {
  body::before, body::after, .site-head, .site-foot, .ad-slot { display: none; }
  body { background: #fff; color: #000; }
}
