/* ============================================================================
   The Sacrifices in Leviticus — Design System
   Ported from the sibling project "Defending Torah" (../defend/globals.css):
   parchment + ink editorial aesthetic, Frank Ruhl Libre / Cormorant Garamond /
   JetBrains Mono. Extended with the five offering accent colors and a component
   library for the visual-learning interactions. Self-hosted fonts (no CDN).
   ========================================================================== */
@import url("./fonts.css");

/* ────────── TOKENS ────────── */
:root {
  /* defend palette */
  --ink: #1a1f2e;
  --ink-soft: #2d3448;
  --ink-light: #4a5060;
  --parchment: #f4ecdc;
  --parchment-deep: #ebdfc5;
  --parchment-shadow: #d9c9a4;
  --ochre: #975e22;
  --ochre-deep: #8a5420;
  --ochre-faint: rgba(151, 94, 34, 0.07);
  --crimson: #7a2e24;
  --crimson-faint: rgba(122, 46, 36, 0.06);
  --olive: #5c6b3f;
  --muted: #574e40;
  --rule: rgba(26, 31, 46, 0.22);

  /* five offering accents (handoff §3, harmonised to parchment) */
  --olah: #2e6b76;        /* burnt — teal-blue */
  --olah-tint: rgba(46, 107, 118, 0.10);
  --minchah: #a9781f;     /* grain — warm gold/umber */
  --minchah-tint: rgba(169, 120, 31, 0.10);
  --shelamim: #5c6b3f;    /* well-being — olive */
  --shelamim-tint: rgba(92, 107, 63, 0.12);
  --chattat: #76314a;     /* purification — muted wine */
  --chattat-tint: rgba(118, 49, 74, 0.09);
  --asham: #a4532a;       /* reparation — burnt copper */
  --asham-tint: rgba(164, 83, 42, 0.10);

  /* type */
  --font-heading: 'Frank Ruhl Libre', Georgia, serif;
  --font-body: 'Cormorant Garamond', 'EB Garamond', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* scale */
  --r-sm: 4px; --r-md: 8px; --r-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(26, 31, 46, 0.08);
  --shadow-md: 0 6px 22px rgba(26, 31, 46, 0.10);
  --shadow-lg: 0 14px 40px rgba(26, 31, 46, 0.14);
  --maxw: 1180px;
  --gap: clamp(16px, 3vw, 32px);
}

/* per-offering accent — set [data-offering] on any container */
[data-offering="olah"]      { --accent: var(--olah);     --accent-tint: var(--olah-tint); }
[data-offering="minchah"]   { --accent: var(--minchah);  --accent-tint: var(--minchah-tint); }
[data-offering="shelamim"]  { --accent: var(--shelamim); --accent-tint: var(--shelamim-tint); }
[data-offering="chattat"]   { --accent: var(--chattat);  --accent-tint: var(--chattat-tint); }
[data-offering="asham"]     { --accent: var(--asham);    --accent-tint: var(--asham-tint); }
:root { --accent: var(--ochre); --accent-tint: var(--ochre-faint); }

/* ────────── RESET / BASE ────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.55;
  overflow-x: clip;
  position: relative;
  min-height: 100vh;
}
img, svg { max-width: 100%; }
h1, h2, h3, h4, h5 { font-family: var(--font-heading); font-weight: 400; }

/* parchment texture overlay (from defend) */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(151,94,34,0.08), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(122,46,36,0.06), transparent 50%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.3 0 0 0 0 0.1 0 0 0 0.08 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
  opacity: 0.9; mix-blend-mode: multiply;
}
main, header, footer { position: relative; z-index: 1; }

/* ────────── ACCESSIBILITY ────────── */
.skip-link {
  position: absolute; top: -48px; left: 0;
  background: var(--ochre-deep); color: var(--parchment);
  padding: 10px 18px; text-decoration: none; font-weight: 600; z-index: 10000;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }
*:focus-visible { outline: 2px solid var(--ochre); outline-offset: 2px; }
*:focus:not(:focus-visible) { outline: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

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

/* ────────── LAYOUT ────────── */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(18px, 4vw, 48px); }
.section { padding: clamp(48px, 7vw, 96px) 0; }
.section + .section { border-top: 1px solid var(--rule); }
.stack > * + * { margin-top: var(--gap); }
.grid { display: grid; gap: var(--gap); }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: center; }
@media (max-width: 820px) { .cols-2 { grid-template-columns: 1fr; } }

/* reveal */
@keyframes rise { from { opacity: 0; transform: translateY(18px);} to { opacity: 1; transform: none; } }
/* Only hide pre-reveal content when JS can bring it back; no-JS users see everything */
@media (scripting: enabled) { .reveal { opacity: 0; } }
.reveal.in { animation: rise 0.8s cubic-bezier(0.2,0.7,0.2,1) both; }

/* ────────── EYEBROW / SECTION HEADERS ────────── */
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--crimson); display: inline-flex; gap: 10px; align-items: baseline;
}
.eyebrow .num { font-family: var(--font-heading); font-weight: 900; font-size: 18px; color: var(--ochre); letter-spacing: 0; }
.section-title {
  font-family: var(--font-heading); font-weight: 300;
  font-size: clamp(32px, 4.4vw, 56px); line-height: 1.04; letter-spacing: -0.025em;
  color: var(--ink); margin: 16px 0 0;
}
.section-title em { font-family: var(--font-body); font-style: italic; color: var(--ochre-deep); }
.lede { font-size: clamp(19px, 2.1vw, 24px); line-height: 1.5; color: var(--ink-soft); max-width: 60ch; }
.ornamental-rule { display: flex; align-items: center; gap: 16px; color: var(--ochre); }
.ornamental-rule::before, .ornamental-rule::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.ornamental-rule .ornament { font-family: var(--font-heading); font-size: 18px; color: var(--ochre); }

/* ────────── BUTTONS ────────── */
.btn {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.2em; text-transform: uppercase;
  text-decoration: none; padding: 15px 26px; display: inline-flex; align-items: center; gap: 12px;
  transition: all 0.25s; cursor: pointer; border: 1px solid var(--ink); background: transparent; color: var(--ink);
}
.btn-primary { background: var(--ink); color: var(--parchment); }
.btn-primary:hover { background: var(--ochre); border-color: var(--ochre); transform: translateX(3px); }
.btn-ghost:hover { background: var(--ink); color: var(--parchment); }
.btn .arrow { transition: transform 0.25s; }
.btn:hover .arrow { transform: translateX(4px); }
.mono-label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; }

/* ────────── TOP NAV ────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--ink); color: var(--parchment);
  border-bottom: 1px solid rgba(244,236,220,0.12);
}
.nav-inner { display: flex; align-items: stretch; justify-content: space-between; gap: 24px; height: 64px; }
.nav-brand { display: flex; flex-direction: column; justify-content: center; gap: 1px; text-decoration: none; color: var(--parchment); flex-shrink: 0; }
.nav-brand b { font-family: var(--font-heading); font-weight: 500; font-size: 16px; line-height: 1.04; letter-spacing: -0.01em; white-space: nowrap; }
.nav-brand span { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--parchment-shadow); }
.nav-links { display: flex; align-items: stretch; gap: 2px; list-style: none; margin: 0 0 0 auto; padding: 0; min-width: 0; }
.nav-links a {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--parchment-shadow); text-decoration: none; padding: 0 11px;
  border-bottom: 2px solid transparent; transition: color 0.2s, background 0.2s, border-color 0.2s; white-space: nowrap;
}
.nav-links a:hover { color: var(--parchment); background: rgba(244,236,220,0.06); }
.nav-links a[aria-current="page"] { color: var(--parchment); border-bottom-color: var(--ochre); }
.nav-toggle { display: none; align-self: center; background: none; border: 1px solid rgba(244,236,220,0.3); color: var(--parchment);
  padding: 9px 14px; border-radius: var(--r-sm); cursor: pointer; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.nav-toggle:hover { background: rgba(244,236,220,0.08); }

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--ink); padding: 4px 18px 16px; gap: 0; border-bottom: 1px solid rgba(244,236,220,0.12);
    max-height: 0; overflow: hidden; transition: max-height 0.32s ease; box-shadow: var(--shadow-lg); margin: 0;
  }
  .nav-links.open { max-height: 82vh; overflow: auto; }
  .nav-links a {
    display: flex; padding: 13px 12px; font-size: 12px; border-bottom: 1px solid rgba(244,236,220,0.07);
    border-left: 3px solid transparent;
  }
  .nav-links a[aria-current="page"] { border-bottom-color: rgba(244,236,220,0.07); border-left-color: var(--ochre); background: rgba(244,236,220,0.05); }
}

/* ────────── BREADCRUMB + PAGER + PROGRESS ────────── */
.crumb { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding: 18px 0 0; }
.crumb a { color: var(--ochre-deep); text-decoration: none; }
.crumb a:hover { color: var(--ochre); }
.progress-rail { display: flex; gap: 6px; padding: 14px 0 0; flex-wrap: wrap; }
.progress-rail .tick { width: 26px; height: 4px; border-radius: 2px; background: var(--parchment-shadow); }
.progress-rail .tick.active { background: var(--ochre); }
.pager { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0 0; flex-wrap: wrap; }
.pager a { text-decoration: none; color: var(--ink); border: 1px solid var(--rule); padding: 16px 22px; border-radius: var(--r-md);
  flex: 1 1 260px; transition: all 0.2s; background: rgba(255,255,255,0.25); }
.pager a:hover { border-color: var(--ochre); background: var(--ochre-faint); }
.pager .dir { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--crimson); display: block; margin-bottom: 4px; }
.pager .ttl { font-family: var(--font-heading); font-size: 20px; color: var(--ink); }
.pager .next { text-align: right; }

/* ────────── HERO ────────── */
.hero { background: var(--ink); color: var(--parchment); position: relative; overflow: hidden; }
.hero .wrap { position: relative; z-index: 1; padding-top: clamp(56px, 9vw, 120px); padding-bottom: clamp(56px, 9vw, 120px); }
.hero h1 { font-family: var(--font-heading); font-weight: 300; font-size: clamp(40px, 7vw, 92px); line-height: 0.98; letter-spacing: -0.03em; margin: 18px 0 0; }
.hero h1 em { font-family: var(--font-body); font-style: italic; color: var(--ochre); }
.hero .sub { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ochre); }
.hero .orient { font-size: clamp(18px, 2vw, 22px); color: var(--parchment-shadow); max-width: 62ch; margin-top: 22px; line-height: 1.55; }
.hero .cta-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 34px; }
.hero .btn-ghost { color: var(--parchment); border-color: rgba(244,236,220,0.4); }
.hero .btn-ghost:hover { background: var(--parchment); color: var(--ink); border-color: var(--parchment); }

/* stat chips */
.stats { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 40px; }
.stat { border: 1px solid rgba(244,236,220,0.2); border-radius: var(--r-md); padding: 14px 20px; }
.stat b { font-family: var(--font-heading); font-weight: 500; font-size: 30px; color: var(--parchment); display: block; }
.stat span { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--parchment-shadow); }

/* ────────── CARDS ────────── */
.card { background: rgba(255,255,255,0.32); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: clamp(18px, 2.5vw, 28px); transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s; }
.card:hover { box-shadow: var(--shadow-md); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: var(--gap); }

/* offering card */
.offering-card {
  text-align: left; cursor: pointer; width: 100%; display: flex; flex-direction: column; gap: 8px;
  background: rgba(255,255,255,0.32); border: 1px solid var(--rule); border-left: 4px solid var(--accent);
  border-radius: var(--r-md); padding: 18px 20px; transition: all 0.22s; color: var(--ink); font: inherit;
}
.offering-card:hover { background: var(--accent-tint); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.offering-card[aria-selected="true"], .offering-card.active { background: var(--accent-tint); border-color: var(--accent); box-shadow: var(--shadow-md); }
.offering-card .heb { font-family: var(--font-heading); font-size: 26px; color: var(--accent); line-height: 1; }
.offering-card .translit { font-family: var(--font-heading); font-size: 21px; color: var(--ink); }
.offering-card .lbl { font-size: 16px; color: var(--ink-soft); }
.offering-card .fam { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

/* offering dot (nav/legend) */
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* ────────── TABBED PANEL (offering explorer detail) ────────── */
.panel { border: 1px solid var(--rule); border-radius: var(--r-lg); background: rgba(255,255,255,0.4); overflow: hidden; }
.panel-head { padding: 22px 24px 16px; border-bottom: 1px solid var(--rule); border-top: 4px solid var(--accent); }
.panel-head .heb { font-family: var(--font-heading); font-size: 40px; color: var(--accent); line-height: 1; }
.panel-head .translit { font-family: var(--font-heading); font-size: 30px; }
.panel-head .lbl { color: var(--ink-soft); font-size: 18px; }
.panel-head .tagline { font-style: italic; color: var(--ochre-deep); margin-top: 6px; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.tab {
  flex: 1 1 auto; padding: 12px 14px; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.tab:hover { color: var(--ink-soft); background: var(--accent-tint); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { padding: 24px; }
.tab-panel[hidden] { display: none; }
.field-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ochre); margin: 0 0 8px; }

/* ────────── RITUAL FLOW STEPPER (actor-coded) ────────── */
.flow { display: flex; flex-direction: column; gap: 0; }
.flow-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.lens-btn, .pill-btn {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 8px 14px; border: 1px solid var(--rule); background: rgba(255,255,255,0.4); color: var(--ink-soft);
  border-radius: 999px; cursor: pointer; transition: all 0.2s;
}
.lens-btn:hover, .pill-btn:hover { border-color: var(--ochre); color: var(--ink); }
.lens-btn[aria-pressed="true"], .pill-btn.active { background: var(--ink); color: var(--parchment); border-color: var(--ink); }
.step {
  display: grid; grid-template-columns: 44px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px dashed var(--rule);
  transition: opacity 0.3s; position: relative;
}
.step.dim { opacity: 0.32; }
.step-num {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  font-family: var(--font-heading); font-weight: 700; font-size: 17px; color: #fff;
}
.step[data-actor="offerer"] .step-num { background: var(--ochre); }
.step[data-actor="priest"] .step-num { background: var(--ink); }
.step-body .actor { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 6px; }
.step[data-actor="offerer"] .actor { color: var(--ochre-deep); }
.step[data-actor="priest"] .actor { color: var(--ink-soft); }
.step-body .txt { margin: 4px 0 0; }
.step-body .ref { font-family: var(--font-mono); font-size: 10.5px; color: var(--crimson); margin-top: 4px; display: inline-block; }
.actor-key { display: flex; gap: 18px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.actor-key .swatch { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: -1px; }

/* ────────── GIFT LADDER ────────── */
.ladder { display: flex; flex-direction: column; gap: 8px; }
.rung {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1px solid var(--rule);
  border-radius: var(--r-md); background: rgba(255,255,255,0.4); border-left: 4px solid var(--accent);
}
.rung .ic { width: 38px; height: 38px; flex-shrink: 0; color: var(--accent); }
.rung .label { font-weight: 600; }
.rung .cond { font-size: 15px; color: var(--ink-soft); }
.rung .ref { font-family: var(--font-mono); font-size: 10px; color: var(--crimson); margin-left: auto; white-space: nowrap; }
.ladder-note { font-style: italic; color: var(--muted); font-size: 16px; margin-top: 10px; }

/* ────────── DESTINATION DIAGRAM ────────── */
.destinations { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.dest {
  border: 1px solid var(--rule); border-radius: var(--r-md); padding: 14px; text-align: center;
  background: rgba(255,255,255,0.35); position: relative; transition: all 0.2s;
}
.dest.on { border-color: var(--accent); background: var(--accent-tint); }
.dest.off { opacity: 0.45; }
.dest .ic { width: 34px; height: 34px; margin: 0 auto 8px; color: var(--accent); }
.dest .name { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.dest .note { font-size: 14px; color: var(--ink-soft); margin-top: 6px; line-height: 1.4; }
.dest .mark { position: absolute; top: 8px; right: 10px; font-weight: 700; }
.dest.on .mark { color: var(--accent); }
.dest.off .mark { color: var(--muted); }

/* ────────── BADGES ────────── */
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  background: var(--accent-tint); border: 1px solid var(--rule); color: var(--ink-soft);
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.05em;
}
.badge .ic { width: 15px; height: 15px; color: var(--accent); }

/* callout / dont-miss */
.callout {
  border-left: 3px solid var(--crimson); background: var(--crimson-faint);
  border-radius: 0 var(--r-md) var(--r-md) 0; padding: 16px 20px; margin: 8px 0;
}
.callout .tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--crimson); display: block; margin-bottom: 6px; }
.callout.accent { border-left-color: var(--accent); background: var(--accent-tint); }
.callout.accent .tag { color: var(--accent); }

/* ────────── ACCORDION ────────── */
.accordion { border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; background: rgba(255,255,255,0.35); }
.accordion + .accordion { margin-top: 12px; }
.acc-head {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  font-family: var(--font-heading); font-size: 21px; color: var(--ink); transition: background 0.2s;
}
.acc-head:hover { background: var(--ochre-faint); }
.acc-head .chev { font-family: var(--font-mono); color: var(--ochre); transition: transform 0.25s; flex-shrink: 0; }
.acc-head[aria-expanded="true"] .chev { transform: rotate(90deg); }
.acc-body { padding: 0 22px; max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; }
.acc-body.open { padding: 0 22px 22px; }
.acc-body p { margin: 0; color: var(--ink-soft); }

/* ────────── MATRIX TABLE ────────── */
.matrix-tools { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.matrix-search {
  flex: 1 1 280px; padding: 12px 0; background: transparent; border: none; border-bottom: 2px solid var(--ink);
  font-family: var(--font-body); font-size: 20px; font-style: italic; color: var(--ink); outline: none;
}
.matrix-search:focus { border-bottom-color: var(--ochre); }
.matrix-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r-md); -webkit-overflow-scrolling: touch; }
table.matrix { border-collapse: collapse; width: 100%; min-width: 760px; background: rgba(255,255,255,0.4); }
table.matrix th, table.matrix td { padding: 14px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); font-size: 16px; }
table.matrix thead th { position: sticky; top: 0; background: var(--ink); color: var(--parchment); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; z-index: 2; }
table.matrix thead th .heb { font-family: var(--font-heading); font-size: 18px; display: block; }
table.matrix tbody th { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--crimson); background: var(--parchment-deep); white-space: nowrap; }
table.matrix td { border-left: 3px solid var(--col-accent, transparent); }
table.matrix tr.hide { display: none; }
table.matrix mark { background: rgba(151,94,34,0.22); color: var(--ochre-deep); padding: 0 2px; border-radius: 2px; }
.matrix-empty { padding: 24px; text-align: center; color: var(--muted); font-style: italic; }

/* ────────── FLASHCARDS ────────── */
.flash-wrap { max-width: 640px; margin: 0 auto; }
.flashcard { perspective: 1400px; width: 100%; }
.flashcard-inner {
  position: relative; width: 100%; min-height: 260px; cursor: pointer;
  transition: transform 0.6s cubic-bezier(0.4,0.2,0.2,1); transform-style: preserve-3d;
  border: none; background: none; padding: 0; font: inherit; color: inherit; display: block;
}
.flashcard-inner.flipped { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 36px; display: grid; place-items: center;
  text-align: center; box-shadow: var(--shadow-sm);
}
.flash-front { background: rgba(255,255,255,0.5); }
.flash-back { background: var(--ink); color: var(--parchment); transform: rotateY(180deg); }
.flash-face .q { font-family: var(--font-heading); font-size: clamp(20px, 3vw, 28px); line-height: 1.25; }
.flash-face .a { font-size: clamp(17px, 2.3vw, 21px); line-height: 1.5; }
.flash-hint { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; }
.flash-back .flash-hint { color: var(--parchment-shadow); }
.flash-nav { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 20px; }
.flash-count { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; color: var(--muted); }

/* ────────── QUIZ ────────── */
.quiz { max-width: 720px; margin: 0 auto; }
.quiz-q { font-family: var(--font-heading); font-size: clamp(22px, 3vw, 30px); line-height: 1.2; margin: 0 0 6px; }
.quiz-count { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--crimson); }
.quiz-choices { display: flex; flex-direction: column; gap: 10px; margin: 22px 0; }
.choice {
  text-align: left; padding: 16px 20px; border: 1px solid var(--rule); border-radius: var(--r-md);
  background: rgba(255,255,255,0.4); cursor: pointer; font: inherit; color: var(--ink); transition: all 0.18s;
  display: flex; align-items: center; gap: 14px;
}
.choice:hover:not(:disabled) { border-color: var(--ochre); background: var(--ochre-faint); }
.choice .key { font-family: var(--font-mono); font-size: 12px; color: var(--muted); border: 1px solid var(--rule); border-radius: 4px; width: 26px; height: 26px; display: grid; place-items: center; flex-shrink: 0; }
.choice.correct { border-color: var(--olive); background: rgba(92,107,63,0.14); }
.choice.correct .key { background: var(--olive); color: #fff; border-color: var(--olive); }
.choice.wrong { border-color: var(--crimson); background: var(--crimson-faint); }
.choice.wrong .key { background: var(--crimson); color: #fff; border-color: var(--crimson); }
.choice:disabled { cursor: default; }
.quiz-feedback { border-radius: var(--r-md); padding: 16px 20px; margin-top: 6px; display: none; }
.quiz-feedback.show { display: block; }
.quiz-feedback.right { background: rgba(92,107,63,0.12); border-left: 3px solid var(--olive); }
.quiz-feedback.nope { background: var(--crimson-faint); border-left: 3px solid var(--crimson); }
.quiz-score { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; color: var(--muted); margin-top: 18px; }

/* ────────── DIAGRAMS (sanctuary / depth / two-families / cross-ref) ────────── */
.diagram-frame { border: 1px solid var(--rule); border-radius: var(--r-lg); background: rgba(255,255,255,0.32); padding: clamp(12px, 2vw, 22px); }
.sanctuary-svg { display: block; width: 100%; height: auto; }
.svg-compass { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; fill: var(--muted); text-transform: uppercase; pointer-events: none; }
/* Furniture inspector: a responsive grid of cards below the full-width map */
.furniture-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.furniture-grid .rung { width: 100%; cursor: pointer; }
.svg-zone { transition: opacity 0.4s, fill 0.4s; cursor: pointer; }
.svg-zone:focus-visible { outline: 2px solid var(--ochre); }
.svg-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; fill: var(--ink); pointer-events: none; }
.svg-heb { font-family: var(--font-heading); fill: var(--ink-soft); pointer-events: none; }
.blood-path { stroke: var(--crimson); stroke-width: 3; fill: none; opacity: 0; stroke-dasharray: 6 6; transition: opacity 0.4s; }
.blood-path.show { opacity: 1; animation: dash 1.4s linear infinite; }
.blood-mark { fill: var(--crimson); opacity: 0; transition: opacity 0.4s; }
.blood-mark.show { opacity: 1; }
@keyframes dash { to { stroke-dashoffset: -24; } }

/* two families */
.families { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.family { border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 22px; background: rgba(255,255,255,0.32); }
.family h3 { margin: 0 0 4px; font-size: 26px; }
.family .sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--crimson); }
.family-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

/* depth diagram */
.depth-row { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px dashed var(--rule); }
.depth-badge { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; padding: 6px 12px; border-radius: 999px; color: #fff; white-space: nowrap; }

/* legend */
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.legend-item .ic { width: 22px; height: 22px; color: var(--ochre); flex-shrink: 0; }

/* ────────── GLOSSARY TOOLTIP ────────── */
.gl { border-bottom: 1px dotted var(--ochre); cursor: help; }
.gl-tip {
  position: absolute; z-index: 9999; max-width: 300px; background: var(--ink); color: var(--parchment);
  padding: 12px 14px; border-radius: var(--r-md); box-shadow: var(--shadow-lg); font-size: 15px; line-height: 1.45;
  font-family: var(--font-body); pointer-events: none; opacity: 0; transition: opacity 0.15s;
}
.gl-tip.show { opacity: 1; }
.gl-tip .t { font-family: var(--font-heading); font-size: 17px; display: block; }
.gl-tip .r { font-family: var(--font-mono); font-size: 10px; color: var(--ochre); letter-spacing: 0.08em; }

/* ────────── PROSE ────────── */
.prose { font-size: 20px; line-height: 1.65; color: var(--ink); max-width: 70ch; }
.prose p { margin: 0 0 1.1em; }
.prose a { color: var(--ochre-deep); border-bottom: 1px solid var(--ochre); text-decoration: none; }
.prose a:hover { color: var(--ochre); }
.heb-inline { font-family: var(--font-heading); }

/* ────────── FOOTER ────────── */
.foot { background: var(--ink); color: var(--parchment-shadow); margin-top: 0; }
.foot .wrap { padding: 48px 0; display: flex; flex-wrap: wrap; gap: 28px; justify-content: space-between; }
.foot a { color: var(--parchment); text-decoration: none; border-bottom: 1px solid rgba(244,236,220,0.3); }
.foot .col h4 { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ochre); margin: 0 0 12px; }
.foot .col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.foot .fine { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; color: var(--muted); }

/* ────────── EXPLORER LAYOUT ────────── */
.explorer { display: grid; grid-template-columns: 300px 1fr; gap: var(--gap); align-items: start; }
.explorer-rail { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 78px; }
@media (max-width: 880px) {
  .explorer { grid-template-columns: 1fr; }
  .explorer-rail { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 8px; }
  .explorer-rail .offering-card { min-width: 200px; }
}

/* ────────── RESPONSIVE ────────── */
@media (max-width: 760px) {
  body { font-size: 17px; }
  .families { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
}

/* ────────── OPTIMIZATION PASS (review fixes) ────────── */
/* anchors used as cards/chips must not show the UA underline */
.offering-card, .offering-card:hover, .badge, .badge:hover { text-decoration: none; }

/* destination cells: label and note each on their own line; keep "off" text readable */
.dest .name { display: block; }
.dest .note { display: block; margin-top: 6px; }
.dest.off { opacity: 1; }
.dest.off .ic { opacity: 0.32; }
.dest.off .name, .dest.off .note { color: var(--muted); }

/* disabled buttons: clear state, no false hover affordance */
.btn:disabled { opacity: 0.4; cursor: default; transform: none !important; }
.btn-ghost:disabled:hover { background: transparent; color: var(--ink); }
.btn-primary:disabled:hover { background: var(--ink); color: var(--parchment); }
.btn:disabled:hover .arrow { transform: none; }

/* matrix search: visible keyboard focus */
.matrix-search:focus-visible { outline: 2px solid var(--ochre); outline-offset: 3px; }

/* flashcards: let content drive height, leave room for the flip hint */
.flashcard-inner { min-height: 200px; }
.flash-face { padding-bottom: 46px; }

/* mobile: scrollable tab strip instead of an awkward wrap to a lone second row */
@media (max-width: 560px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; }
}

/* mobile: let ladder rungs stack instead of cramping into three columns */
@media (max-width: 560px) {
  .rung { flex-wrap: wrap; }
  .rung .cond { flex-basis: 100%; margin-left: 52px; }
  .rung .ref { margin-left: 52px; margin-top: 2px; }
}

/* ────────── PRINT ────────── */
@media print {
  body::before, .nav, .foot, .skip-link, .flow-controls, .matrix-tools, .nav-toggle,
  .pager, .progress-rail, .flash-nav, .quiz-choices .key { display: none !important; }
  body { background: #fff !important; color: #000; font-size: 12pt; }
  .hero { background: #fff !important; color: #000; }
  .hero h1, .hero .orient, .hero .sub { color: #000 !important; }
  .tab-panel[hidden] { display: block !important; }   /* expand all tabs */
  .acc-body { max-height: none !important; padding: 0 0 12px !important; }
  .card, .panel, .accordion, .diagram-frame { break-inside: avoid; border-color: #999; box-shadow: none; }
  .flashcard-inner { transform: none !important; }
  .flash-face { position: static; border: 1px solid #999; min-height: 0; }
  .flash-back { background: #fff !important; color: #000; transform: none; }
  a { color: #000 !important; text-decoration: underline; }
  .section + .section { border-color: #999; }
}
