/* ============================================================
   TANAKH READER — "Illuminated Ink"
   A reverent, manuscript-inspired aesthetic.
   Deep ink ground · warm vellum text · gold + tekhelet accents.
   Distinct from the main focusimmersion site by design.
   ============================================================ */

:root {
  /* Ground & surfaces — deep ink, like a scribe's night desk */
  --ink:        #100d0a;
  --ink-2:      #161210;
  --panel:      #1c1814;
  --panel-2:    #221d18;
  --hairline:   rgba(196, 168, 110, 0.16);
  --hairline-2: rgba(196, 168, 110, 0.30);

  /* Vellum text */
  --vellum:     #ece3d2;
  --vellum-dim: #b9ad96;
  --vellum-faint: #8a7f6b;

  /* Illumination — gold leaf */
  --gold:       #c9a24b;
  --gold-hi:    #e6c878;
  --gold-deep:  #8a6d2c;

  /* Tekhelet — the sacred biblical blue */
  --tekhelet:   #2f5d8a;
  --tekhelet-hi:#4f86bd;

  /* Crimson rubric (for sacred-name marks / accents) */
  --rubric:     #9c4a3c;

  --shadow:     0 24px 60px -20px rgba(0,0,0,0.75);
  --shadow-sm:  0 8px 24px -10px rgba(0,0,0,0.6);

  --ff-he:   'Frank Ruhl Libre', 'David Libre', 'Times New Roman', serif;
  --ff-disp: 'Cormorant Garamond', Georgia, serif;
  --ff-body: 'EB Garamond', Georgia, serif;
  --ff-sans: 'Spectral SC', 'EB Garamond', serif;

  --maxw: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--vellum);
  font-family: var(--ff-body);
  font-size: 19px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* atmospheric depth: a faint gold vignette + ink grain */
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(201,162,75,0.07), transparent 55%),
    radial-gradient(90% 60% at 50% 120%, rgba(47,93,138,0.06), transparent 60%);
  background-attachment: fixed;
}

/* subtle paper grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap { position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ============================================================
   MASTHEAD
   ============================================================ */
.masthead {
  text-align: center;
  padding: 64px 24px 40px;
  position: relative;
}
.masthead .eyebrow {
  font-family: var(--ff-sans);
  font-variant: small-caps;
  letter-spacing: 0.34em;
  font-size: 0.72rem;
  color: var(--gold);
  text-transform: lowercase;
  margin-bottom: 18px;
}
.masthead .he-title {
  font-family: var(--ff-he);
  font-size: clamp(3.4rem, 11vw, 6.2rem);
  line-height: 0.95;
  color: var(--vellum);
  font-weight: 500;
  direction: rtl;
  margin: 0;
  text-shadow: 0 0 38px rgba(201,162,75,0.18);
}
.masthead .en-title {
  font-family: var(--ff-disp);
  font-size: clamp(1.4rem, 4vw, 2.1rem);
  font-style: italic;
  color: var(--vellum-dim);
  font-weight: 500;
  margin: 6px 0 0;
  letter-spacing: 0.01em;
}
.masthead .place {
  margin-top: 18px;
  font-family: var(--ff-sans);
  font-variant: small-caps;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  color: var(--vellum-faint);
}
.masthead .place b { color: var(--gold); font-weight: 600; }

/* illuminated rule */
.rule {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin: 26px auto 0; max-width: 360px;
}
.rule::before, .rule::after {
  content: ""; height: 1px; flex: 1;
  background: linear-gradient(90deg, transparent, var(--hairline-2), transparent);
}
.rule .dot { color: var(--gold); font-size: 0.9rem; transform: translateY(-1px); }

/* ============================================================
   READING-LANGUAGE SELECTOR (the six tongues)
   ============================================================ */
.lang-bar {
  display: flex; flex-direction: column; align-items: center;
  gap: 7px; margin: 10px auto 0; max-width: 780px;
}
.lang-row {
  display: flex; align-items: center; justify-content: center;
  gap: 0.55rem; flex-wrap: wrap;
}
.lang-bar-label {
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.16em;
  font-size: 0.64rem; color: var(--vellum-faint); min-width: 6.2em; text-align: right;
}
.lang-tab.lang-fixed { cursor: default; }
.lang-tab.lang-fixed:disabled { opacity: 1; }
.lang-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.lang-tab {
  font-family: var(--ff-sans); font-size: 0.8rem; letter-spacing: 0.03em;
  color: var(--vellum); background: transparent;
  border: 1px solid var(--hairline-2); border-radius: 999px;
  padding: 4px 13px; cursor: pointer; line-height: 1.4;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.lang-tab[lang="ja"] { font-family: "Noto Serif JP", serif; }
.lang-tab[lang="he"] { font-family: var(--ff-he), serif; }
.lang-tab:hover { color: var(--gold-hi); border-color: var(--gold); }
.lang-tab[aria-pressed="true"] {
  color: var(--ink); background: var(--gold); border-color: var(--gold-hi);
  box-shadow: 0 0 0 3px rgba(201,162,75,0.16);
}

/* ============================================================
   CHAPTER NAV
   ============================================================ */
.chapter-nav {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, var(--ink) 60%, rgba(16,13,10,0.86));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
  padding: 12px 0;
}
.chapter-nav .inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  justify-content: space-between;
}
.book-pill {
  font-family: var(--ff-he); font-size: 1.5rem; color: var(--gold-hi);
  direction: rtl; line-height: 1;
}
.book-pill small {
  display:block; font-family: var(--ff-sans); font-variant: small-caps;
  letter-spacing: 0.2em; font-size: 0.6rem; color: var(--vellum-faint);
  direction: ltr; margin-top: 4px;
}
.chap-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.chap-tab {
  appearance: none; cursor: pointer;
  font-family: var(--ff-disp); font-size: 1.15rem; font-weight: 600;
  width: 44px; height: 44px; border-radius: 50%;
  background: transparent; color: var(--vellum-dim);
  border: 1px solid var(--hairline-2);
  transition: all .25s ease;
  display: grid; place-items: center;
}
.chap-tab:hover { color: var(--gold-hi); border-color: var(--gold); transform: translateY(-2px); }
.chap-tab[aria-current="true"] {
  color: var(--ink); background: var(--gold);
  border-color: var(--gold-hi);
  box-shadow: 0 0 0 4px rgba(201,162,75,0.16);
}

/* ============================================================
   CHAPTER OPENER + PLAY-ALL
   ============================================================ */
.chapter-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  margin: 56px 0 12px; padding-bottom: 18px;
  border-bottom: 1px solid var(--hairline);
}
.chapter-head .label {
  font-family: var(--ff-sans); font-variant: small-caps;
  letter-spacing: 0.26em; font-size: 0.72rem; color: var(--gold);
}
.chapter-head h2 {
  font-family: var(--ff-disp); font-weight: 600; font-style: italic;
  font-size: clamp(2rem, 6vw, 3.2rem); margin: 4px 0 0; color: var(--vellum);
}
.chapter-head .he-num {
  font-family: var(--ff-he); color: var(--gold-hi);
  font-size: 1.6rem; direction: rtl; margin-left: 10px;
}

.playall {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.12em;
  font-size: 0.82rem; color: var(--vellum);
  background: var(--panel); border: 1px solid var(--hairline-2);
  padding: 11px 18px; border-radius: 999px; cursor: pointer;
  transition: all .25s ease;
}
.playall:hover { border-color: var(--gold); color: var(--gold-hi); box-shadow: var(--shadow-sm); }
.playall .ico { width: 14px; height: 14px; fill: currentColor; }
.playall.is-playing { border-color: var(--tekhelet-hi); color: var(--tekhelet-hi); }

/* play control + reverence mode label */
.play-cluster { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.audio-mode {
  display: inline-flex; align-items: center; gap: 7px; cursor: help;
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.14em;
  font-size: 0.64rem; color: var(--tekhelet-hi);
}
.audio-mode .dot-mode {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--tekhelet-hi); box-shadow: 0 0 0 3px rgba(79,134,189,0.16);
}

/* ============================================================
   VERSES
   ============================================================ */
.verses { margin-top: 8px; }

.verse {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0 18px;
  padding: 26px 0;
  border-bottom: 1px solid var(--hairline);
  transition: background .4s ease;
  scroll-margin-top: 90px;
}
.verse:last-child { border-bottom: none; }

.verse.active {
  background:
    linear-gradient(90deg, rgba(201,162,75,0.10), transparent 70%);
  box-shadow: inset 3px 0 0 var(--gold);
}

/* gutter: verse number + play */
.vgutter {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding-top: 4px;
}
.vnum {
  font-family: var(--ff-disp); font-weight: 600; font-size: 1.25rem;
  color: var(--gold); line-height: 1;
}
.vnum .he { display:block; font-family: var(--ff-he); font-size: 0.85rem;
  color: var(--vellum-faint); direction: rtl; margin-top: 3px; }

.vplay {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--hairline-2); background: transparent;
  color: var(--vellum-dim); cursor: pointer;
  display: grid; place-items: center; transition: all .22s ease;
  flex: none;
}
.vplay:hover { color: var(--gold-hi); border-color: var(--gold); transform: scale(1.08); }
.vplay svg { width: 13px; height: 13px; fill: currentColor; }
.vplay.playing { color: var(--tekhelet-hi); border-color: var(--tekhelet-hi);
  box-shadow: 0 0 0 4px rgba(79,134,189,0.14); }

.vbody { min-width: 0; }

.he-text {
  direction: rtl;
  font-family: var(--ff-he);
  font-size: clamp(1.7rem, 4.4vw, 2.25rem);
  line-height: 1.85;
  color: var(--vellum);
  margin: 0 0 14px;
  letter-spacing: 0.005em;
}
.he-text .word {
  cursor: pointer; border-radius: 4px;
  padding: 0 2px; transition: background .18s ease, color .18s ease;
}
.he-text .word:hover,
.he-text .word:focus-visible {
  background: rgba(201,162,75,0.16); color: var(--gold-hi);
  outline: none;
}
.he-text .word.is-name { color: var(--tekhelet-hi); }

.en-text {
  font-family: var(--ff-body);
  font-size: 1.06rem; line-height: 1.62;
  color: var(--vellum-dim);
  font-style: italic;
  max-width: 60ch;
}
.en-text::first-letter { color: var(--vellum); }
/* Japanese translation line — proper JP serif, upright (not italic) */
.en-text.tr-ja {
  font-family: "Noto Serif JP", serif;
  font-style: normal; line-height: 1.85; font-size: 1.02rem;
}
.en-text.tr-ja::first-letter { color: inherit; }

/* ============================================================
   WORD POPOVER
   ============================================================ */
.popover {
  position: fixed; z-index: 60;
  width: min(320px, calc(100vw - 32px));
  background: var(--panel-2);
  border: 1px solid var(--hairline-2);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px 20px 16px;
  opacity: 0; transform: translateY(6px) scale(0.98);
  pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.popover.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.popover::before {
  content: ""; position: absolute; inset: 0; border-radius: 14px;
  padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(201,162,75,0.5), transparent 45%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.popover .pop-he {
  font-family: var(--ff-he); direction: rtl; font-size: 2rem;
  color: var(--vellum); line-height: 1.2; margin-bottom: 2px;
}
.popover .pop-lemma {
  font-family: var(--ff-disp); font-style: italic; font-size: 1.15rem;
  color: var(--gold-hi);
}
.popover .pop-strongs {
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.14em;
  font-size: 0.72rem; color: var(--tekhelet-hi); margin-left: 8px;
}
.popover .pop-row { margin-top: 12px; }
.popover .pop-k {
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.16em;
  font-size: 0.64rem; color: var(--vellum-faint); display:block; margin-bottom: 2px;
}
.popover .pop-v { font-size: 0.98rem; color: var(--vellum); }
.popover .pop-v.morph { font-family: 'DM Mono', monospace; font-size: 0.82rem; color: var(--vellum-dim); }
.popover .pop-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; color: var(--vellum-faint);
  font-size: 1.2rem; cursor: pointer; line-height: 1;
}
.popover .pop-close:hover { color: var(--gold-hi); }
.pop-divider { height: 1px; margin: 14px 0 0;
  background: linear-gradient(90deg, var(--hairline-2), transparent); }
.popover .pop-hear {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 16px; padding: 8px 14px;
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.1em;
  font-size: 0.74rem; color: var(--ink);
  background: var(--gold); border: 1px solid var(--gold-hi); border-radius: 999px;
  cursor: pointer; transition: background 0.15s, transform 0.15s;
}
.popover .pop-hear:hover { background: var(--gold-hi); transform: translateY(-1px); }
.popover .pop-hear .ico { width: 14px; height: 14px; fill: var(--ink); }
.popover .pop-link { margin-top: 14px; }
.popover .pop-link a {
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.1em;
  font-size: 0.72rem; color: var(--tekhelet-hi); text-decoration: none;
}
.popover .pop-link a:hover { color: var(--gold-hi); }

/* ============================================================
   ABOUT THIS TEXT — source & reverence panel (collapsible)
   ============================================================ */
.about-text {
  margin: 28px auto 0; max-width: 760px;
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border: 1px solid var(--hairline); border-radius: 12px;
  overflow: hidden;
}
.about-text > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
}
.about-text > summary::-webkit-details-marker { display: none; }
.about-eyebrow {
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.24em;
  font-size: 0.72rem; color: var(--gold);
}
.about-toggle { position: relative; width: 12px; height: 12px; flex: none; }
.about-toggle::before, .about-toggle::after {
  content: ""; position: absolute; background: var(--vellum-faint);
  transition: transform .25s ease, opacity .25s ease;
}
.about-toggle::before { top: 5px; left: 0; width: 12px; height: 1.5px; }
.about-toggle::after  { left: 5px; top: 0; width: 1.5px; height: 12px; }
.about-text[open] .about-toggle::after { transform: rotate(90deg); opacity: 0; }
.about-text[open] > summary { border-bottom: 1px solid var(--hairline); }
.about-body { padding: 6px 22px 22px; }
.about-policy {
  font-size: 0.96rem; color: var(--vellum-dim); line-height: 1.62;
  border-left: 3px solid var(--rubric); padding-left: 14px; margin: 14px 0 18px;
}
.about-policy b { color: var(--vellum); font-weight: 600; }
.about-sources { margin: 0; display: grid; gap: 12px; }
.about-sources > div {
  display: grid; grid-template-columns: 168px 1fr; gap: 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--hairline);
}
.about-sources > div:last-child { border-bottom: none; padding-bottom: 0; }
.about-sources dt {
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.12em;
  font-size: 0.7rem; color: var(--gold);
}
.about-sources dd {
  margin: 0; font-size: 0.92rem; color: var(--vellum-dim); line-height: 1.55;
}
.about-sources dd b { color: var(--vellum); font-weight: 600; }
.about-sources dd a { color: var(--tekhelet-hi); text-decoration: none; }
.about-sources dd a:hover { color: var(--gold-hi); }
@media (max-width: 560px) {
  .about-sources > div { grid-template-columns: 1fr; gap: 4px; }
}

/* ============================================================
   STUDY EDITIONS (Amazon) — deliberately secondary to the text.
   Sits below the reader, the Name note, and the source panel.
   ============================================================ */
.resources { margin: 36px 0 0; opacity: 0.92; }
.resources .section-head { text-align: center; margin-bottom: 24px; }
.resources .eyebrow {
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.28em;
  font-size: 0.66rem; color: var(--vellum-faint);
}
.resources h3 {
  font-family: var(--ff-disp); font-style: italic; font-weight: 600;
  font-size: clamp(1.3rem, 3.4vw, 1.7rem); margin: 4px 0 0; color: var(--vellum-dim);
}
.res-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.res-card {
  display: block; text-decoration: none;
  background: var(--ink-2); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 18px; transition: all .28s ease;
  position: relative; overflow: hidden;
}
.res-card::after {
  content: "↗"; position: absolute; top: 14px; right: 16px;
  color: var(--vellum-faint); font-size: 0.82rem; transition: all .28s ease; opacity: 0.7;
}
.res-card:hover {
  border-color: var(--gold); transform: translateY(-3px); box-shadow: var(--shadow-sm);
}
.res-card:hover::after { color: var(--gold-hi); transform: translate(2px,-2px); opacity: 1; }
.res-card .tag {
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.16em;
  font-size: 0.58rem; color: var(--vellum-faint);
}
.res-card .title {
  font-family: var(--ff-disp); font-size: 1.12rem; font-weight: 600;
  color: var(--vellum-dim); margin: 6px 0 4px; line-height: 1.2;
}
.res-card .author { font-size: 0.86rem; color: var(--vellum-faint); font-style: italic; }
.disclosure {
  margin-top: 18px; text-align: center;
  font-size: 0.76rem; color: var(--vellum-faint); font-style: italic;
}

/* ============================================================
   NOTES + FOOTER
   ============================================================ */
.name-note {
  margin: 56px auto 0; max-width: 680px;
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border: 1px solid var(--hairline); border-left: 3px solid var(--tekhelet);
  border-radius: 10px; padding: 18px 22px;
  font-size: 0.96rem; color: var(--vellum-dim); line-height: 1.6;
}
.name-note b { color: var(--tekhelet-hi); font-weight: 600; font-style: normal; }

.site-footer {
  margin-top: 72px; padding: 40px 24px 64px;
  border-top: 1px solid var(--hairline); text-align: center;
}
.site-footer .attrib {
  font-size: 0.82rem; color: var(--vellum-faint); line-height: 1.8;
  max-width: 760px; margin: 0 auto;
}
.site-footer .attrib b { color: var(--vellum-dim); font-weight: 600; }
.site-footer .mark {
  font-family: var(--ff-he); font-size: 1.6rem; color: var(--gold);
  direction: rtl; margin-bottom: 16px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  body { font-size: 17px; }
  .verse { grid-template-columns: 44px 1fr; gap: 0 12px; padding: 20px 0; }
  .vplay { width: 34px; height: 34px; }
  .vnum { font-size: 1.05rem; }
  .masthead { padding: 44px 20px 28px; }
  .chapter-head { margin-top: 40px; }
}

/* ============================================================
   MOTION
   ============================================================ */
.verse, .chapter-block { animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.loading { text-align:center; padding: 80px 0; color: var(--vellum-faint);
  font-family: var(--ff-disp); font-style: italic; font-size: 1.3rem; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ============================================================
   LANDING — HERO
   The front door. Same Illuminated-Ink palette, larger gesture.
   ============================================================ */
.hero {
  position: relative; z-index: 1;
  text-align: center;
  padding: clamp(72px, 14vh, 132px) 24px clamp(36px, 6vh, 60px);
  overflow: hidden;
}
.hero-glow {
  position: absolute; inset: -10% -20% auto -20%; height: 60vh;
  pointer-events: none; z-index: -1;
  background:
    radial-gradient(60% 70% at 50% 0%, rgba(201,162,75,0.13), transparent 62%),
    radial-gradient(50% 60% at 50% 30%, rgba(47,93,138,0.10), transparent 70%);
  filter: blur(2px);
}
.hero .eyebrow {
  font-family: var(--ff-sans); font-variant: small-caps;
  letter-spacing: 0.32em; font-size: 0.72rem;
  color: var(--gold); text-transform: lowercase; margin-bottom: 22px;
}
.hero-he {
  font-family: var(--ff-he);
  font-size: clamp(4rem, 16vw, 9rem);
  line-height: 0.9; color: var(--vellum); font-weight: 500;
  direction: rtl; margin: 0;
  text-shadow: 0 0 60px rgba(201,162,75,0.22);
}
.hero-en {
  font-family: var(--ff-disp); font-style: italic; font-weight: 500;
  font-size: clamp(1.5rem, 4.5vw, 2.4rem);
  color: var(--vellum-dim); margin: 10px 0 0; letter-spacing: 0.01em;
}
.hero-lede {
  max-width: 50ch; margin: 26px auto 0;
  font-size: 1.04rem; line-height: 1.72; color: var(--vellum-dim);
}
.hero-lede b { color: var(--gold-hi); font-weight: 600; }
.hero-sub {
  margin-top: 22px; font-family: var(--ff-he);
  font-size: 1.15rem; color: var(--vellum-faint); letter-spacing: 0.06em;
}

/* ============================================================
   LANDING — SECTIONS + BOOK GRID
   ============================================================ */
.tk-section { margin: clamp(48px, 8vh, 88px) 0 0; }
.tk-section-head {
  display: flex; align-items: baseline; gap: 22px; flex-wrap: wrap;
  padding-bottom: 18px; margin-bottom: 26px;
  border-bottom: 1px solid var(--hairline);
  position: relative;
}
.tk-section-head::after {
  content: ""; position: absolute; left: 0; bottom: -1px; width: 96px; height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.tk-sec-he {
  font-family: var(--ff-he); font-weight: 500; direction: rtl;
  font-size: clamp(2.1rem, 6vw, 3.2rem); color: var(--gold-hi);
  margin: 0; line-height: 1; text-shadow: 0 0 30px rgba(201,162,75,0.14);
}
.tk-sec-meta { display: flex; flex-direction: column; gap: 2px; }
.tk-sec-en {
  font-family: var(--ff-disp); font-style: italic; font-weight: 600;
  font-size: clamp(1.2rem, 3vw, 1.6rem); color: var(--vellum);
}
.tk-sec-sub {
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.2em;
  font-size: 0.68rem; color: var(--vellum-faint);
}

.tk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 14px;
}
.tk-card {
  position: relative; display: flex; flex-direction: column;
  gap: 6px; text-decoration: none;
  min-height: 132px; padding: 20px 18px 16px;
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border: 1px solid var(--hairline);
  border-radius: 13px; overflow: hidden;
  transition: transform .3s cubic-bezier(.2,.7,.2,1), border-color .3s ease, box-shadow .3s ease;
}
/* gilt edge that warms on hover */
.tk-card::before {
  content: ""; position: absolute; inset: 0; border-radius: 13px; padding: 1px;
  pointer-events: none; opacity: 0;
  background: linear-gradient(140deg, rgba(201,162,75,0.6), transparent 48%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  transition: opacity .3s ease;
}
.tk-card:hover, .tk-card:focus-visible {
  transform: translateY(-4px); border-color: var(--gold);
  box-shadow: var(--shadow-sm); outline: none;
}
.tk-card:hover::before, .tk-card:focus-visible::before { opacity: 1; }
.tk-card-he {
  font-family: var(--ff-he); direction: rtl; font-weight: 500;
  font-size: 1.85rem; line-height: 1.2; color: var(--vellum);
  transition: color .3s ease;
}
.tk-card:hover .tk-card-he { color: var(--gold-hi); }
.tk-card-en {
  font-family: var(--ff-disp); font-style: italic; font-weight: 600;
  font-size: 1.12rem; color: var(--vellum-dim); line-height: 1.15;
}
.tk-card-meta {
  margin-top: auto; padding-top: 10px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.12em;
  font-size: 0.62rem; color: var(--vellum-faint);
}
.tk-card .tk-pair {
  color: var(--tekhelet-hi);
  border: 1px solid rgba(79,134,189,0.4); border-radius: 999px;
  padding: 1px 8px;
}
/* staggered reveal of cards on first paint */
.tk-card { animation: rise .5s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(var(--ci, 0) * 28ms + var(--si, 0) * 60ms); }
.landing-footer { margin-top: clamp(56px, 10vh, 96px); }

/* ============================================================
   READER — back link + I/II part toggle
   ============================================================ */
.back-link {
  position: absolute; top: 22px; left: 24px;
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.16em;
  font-size: 0.72rem; color: var(--vellum-faint); text-decoration: none;
  transition: color .25s ease;
}
.back-link:hover { color: var(--gold-hi); }

.nav-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.part-tabs { display: inline-flex; gap: 6px; }
.part-tab {
  appearance: none; cursor: pointer;
  display: inline-flex; flex-direction: column; align-items: center;
  background: transparent; border: 1px solid var(--hairline-2);
  border-radius: 10px; padding: 6px 12px; line-height: 1;
  color: var(--vellum-dim); transition: all .25s ease;
}
.part-tab .rom {
  font-family: var(--ff-disp); font-weight: 600; font-size: 1.05rem;
}
.part-tab .rom-en {
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.12em;
  font-size: 0.52rem; color: var(--vellum-faint); margin-top: 2px;
}
.part-tab:hover { border-color: var(--gold); color: var(--gold-hi); }
.part-tab[aria-pressed="true"] {
  border-color: var(--gold); background: rgba(201,162,75,0.12); color: var(--gold-hi);
}
.part-tab[aria-pressed="true"] .rom-en { color: var(--gold); }

@media (max-width: 640px) {
  .tk-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 11px; }
  .tk-card { min-height: 116px; padding: 16px 14px 13px; }
  .tk-card-he { font-size: 1.6rem; }
  .back-link { position: static; display: inline-block; margin-bottom: 16px; }
}

/* Link back to the main Focus Immersion (language-study) site */
.footer-home {
  margin-top: 18px; text-align: center;
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.12em;
  font-size: 0.74rem;
}
.footer-home a {
  color: var(--gold); text-decoration: none;
  border-bottom: 1px solid var(--hairline-2); padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}
.footer-home a:hover { color: var(--gold-hi); border-color: var(--gold); }

/* ============================================================
   GLOBAL NOW-PLAYING / STOP BAR (appears while audio plays)
   ============================================================ */
.now-playing {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 16px);
  z-index: 60; display: flex; align-items: center; gap: 12px;
  padding: 9px 9px 9px 16px; border-radius: 999px;
  background: rgba(28, 24, 20, 0.96); border: 1px solid var(--gold-deep);
  box-shadow: 0 14px 40px -12px rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
.now-playing.visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.now-playing .np-pulse {
  width: 9px; height: 9px; border-radius: 50%; background: var(--gold-hi);
  box-shadow: 0 0 0 0 rgba(230,200,120,0.5); animation: npPulse 1.4s ease-out infinite;
}
@keyframes npPulse {
  0% { box-shadow: 0 0 0 0 rgba(230,200,120,0.45); }
  100% { box-shadow: 0 0 0 9px rgba(230,200,120,0); }
}
.now-playing .np-label {
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.1em;
  font-size: 0.74rem; color: var(--vellum-dim); white-space: nowrap;
}
.np-stop {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.08em;
  font-size: 0.74rem; color: var(--ink); cursor: pointer;
  background: var(--gold); border: 1px solid var(--gold-hi); border-radius: 999px;
  padding: 6px 14px; transition: background .18s ease;
}
.np-stop:hover { background: var(--gold-hi); }
.np-stop svg { width: 12px; height: 12px; fill: var(--ink); }
@media (prefers-reduced-motion: reduce) { .now-playing .np-pulse { animation: none; } }

/* clean structural hide for the now-playing bar (HTML hidden + display:flex) */
.now-playing[hidden] { display: none; }

/* partial-translation notice (chapter not yet translated in the chosen language) */
.tr-pending {
  margin: 14px 0 0; padding: 9px 14px;
  border: 1px dashed var(--hairline-2); border-radius: 8px;
  font-family: var(--ff-sans); font-variant: small-caps; letter-spacing: 0.08em;
  font-size: 0.72rem; color: var(--vellum-faint); background: rgba(201,162,75,0.04);
}

/* audio languages not yet voiced for a chapter — shown but disabled ("coming") */
.lang-tab.lang-unavail { opacity: 0.5; cursor: default; display: inline-flex; align-items: baseline; gap: 0.4em; }
.lang-tab.lang-unavail:hover { color: var(--vellum); border-color: var(--hairline-2); }
.lang-tab.lang-unavail .lang-name { opacity: 0.78; }
.lang-tab .lang-soon {
  font-family: var(--ff-sans); font-size: 0.62rem; letter-spacing: 0.04em;
  text-transform: lowercase; opacity: 0.85; color: var(--gold);
  border: 1px solid var(--hairline-2); border-radius: 999px; padding: 0 0.45em;
}
.lang-tab[lang="ko"] { font-family: "Noto Serif KR", serif; }
.lang-tab[lang="zh"] { font-family: "Noto Serif TC", serif; }

/* interface-language picker (top-right of the masthead) */
.ui-lang {
  position: absolute; top: 18px; right: 18px; z-index: 5;
  font-family: var(--ff-sans); font-size: 0.72rem; letter-spacing: 0.02em;
  color: var(--vellum-dim); background: var(--panel);
  border: 1px solid var(--hairline-2); border-radius: 8px;
  padding: 4px 8px; cursor: pointer; transition: color .18s, border-color .18s;
}
.ui-lang:hover { border-color: var(--gold); color: var(--gold-hi); }
@media (max-width: 560px) { .ui-lang { top: 12px; right: 12px; font-size: 0.66rem; } }
