/* WORLD — an earlier scripture and the Quran, side by side.
   Mobile-first (390px design width), tokens only, so all five skins work.

   LAYOUT LAW (mirrors world.js):
   - .wd-left is the earlier scripture, .wd-right is always the Quran. The grid
     never reorders them: no direction, no order, no row-reverse anywhere below.
   - .wd-cite is sticky and is never given a hidden, collapsed or truncated state.

   Phone (<700px): the two panels stack and the segment toggle jumps between them.
   Nothing is hidden — both panels and both citation bars stay in the page.
   Tablet/desktop (>=700px): the reader breaks out of the 560px column and the
   panels sit in two independently scrolling columns. */

.wd { padding-bottom: 26px; --wd-seg-h: 44px; }

/* ---------- heads ---------- */
.wd-head { margin: 10px 0 12px; }
.wd-h1 { font-size: 1.4rem; font-weight: 600; letter-spacing: .01em; }
.wd-sub { color: var(--text-dim); font-size: .82rem; line-height: 1.55; margin-top: 5px; }
.wd-tr-name { color: var(--gold); }
.wd-loading { color: var(--text-dim); font-size: .9rem; padding: 40px 0; text-align: center; }
.wd-eyebrow {
  font-size: .64rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold); margin: 18px 0 7px;
}

/* the one framing line, from the data file, quiet by design */
.wd-framing {
  color: var(--text-dim);
  font-size: .74rem; line-height: 1.6;
  border-left: 2px solid var(--line);
  padding: 2px 0 2px 10px;
  margin: 12px 0 2px;
}

/* ---------- back ---------- */
.wd-back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-dim); font-size: .78rem;
  padding: 6px 0; margin-top: 6px;
}
.wd-back:hover { color: var(--gold); }

/* ---------- the three book buttons ---------- */
.wd-tradlist { display: flex; flex-direction: column; gap: 8px; }
.wd-trad {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 15px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: background .18s, border-color .18s, transform .12s;
}
.wd-trad:hover { background: var(--surface-2); border-color: var(--gold-dim); }
.wd-trad:active { transform: scale(.99); }
.wd-trad-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wd-trad-label { font-size: 1.12rem; font-weight: 600; letter-spacing: .01em; }
.wd-trad-tr { color: var(--text-dim); font-size: .72rem; }
.wd-trad-n {
  margin-left: auto; flex: none;
  font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold);
}
.wd-trad-go { flex: none; color: var(--gold-dim); font-size: 1.05rem; line-height: 1; }

/* ---------- More: not yet tappable ---------- */
.wd-soon {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.wd-soon-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim); font-size: .84rem;
}
.wd-soon-row:last-child { border-bottom: 0; }
.wd-soon-name { color: var(--text); }
.wd-soon-tag {
  margin-left: auto;
  font-size: .58rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold-dim);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 3px 8px;
}

.wd-about-link {
  display: inline-block; margin-top: 18px;
  color: var(--gold); font-size: .76rem;
  border-bottom: 1px solid var(--gold-dim);
}
.wd-about-link:hover { color: var(--gold-bright); }

/* ---------- theme list ---------- */
.wd-themes { display: flex; flex-direction: column; gap: 7px; }
.wd-theme-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.wd-theme-wrap:hover { border-color: var(--gold-dim); }
.wd-theme {
  display: flex; flex-direction: column; gap: 5px;
  width: 100%; text-align: left;
  padding: 11px 13px;
  transition: background .18s;
}
.wd-theme:hover { background: var(--surface-2); }
.wd-theme-t { font-weight: 600; font-size: .92rem; line-height: 1.3; }
.wd-theme-refs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  font-size: .68rem; color: var(--text-dim);
}
.wd-chip {
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  letter-spacing: .02em;
}
.wd-dot { color: var(--gold-dim); }

/* pair chooser (only when the Quran was the entry point) */
.wd-pair[hidden] { display: none; }
.wd-pair {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  padding: 9px 13px 11px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.wd-pair-l {
  width: 100%;
  font-size: .6rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold);
}
.wd-pair-b {
  display: inline-flex; align-items: baseline; gap: 7px;
  padding: 6px 12px;
  font-size: .82rem; color: var(--text);
  border: 1px solid var(--gold-dim); border-radius: var(--r-pill);
}
.wd-pair-b:hover { background: var(--surface); }
.wd-pair-tr { color: var(--text-dim); font-size: .66rem; }

/* ---------- reader: segment toggle (phone) ---------- */
.wd-seg {
  position: sticky; top: 0; z-index: 6;
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 6px 0 7px;
  margin-bottom: 4px;
  background: var(--field);
}
.wd-seg-b {
  padding: 8px 6px;
  font-size: .76rem; font-weight: 600; letter-spacing: .02em;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  transition: color .16s, border-color .16s, background .16s;
}
.wd-seg-b.on { color: var(--gold-bright); border-color: var(--gold-dim); background: var(--surface-2); }

/* ---------- reader: panels ---------- */
.wd-panels { display: flex; flex-direction: column; gap: 12px; }
.wd-panel {
  display: flex; flex-direction: column; gap: 12px;
  scroll-margin-top: var(--wd-seg-h);
  min-width: 0;
}
.wd-passage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: clip;
}

/* ---------- the citation bar: always in the DOM, always on screen ---------- */
.wd-cite {
  position: sticky; top: calc(var(--wd-seg-h) + 4px); z-index: 4;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px;
  padding: 8px 11px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: .68rem; line-height: 1.4;
}
/* the label is printed exactly as the data file spells it — no case transform,
   so the bar reads "Torah — Genesis 37:1-28 — JPS 1917" verbatim */
.wd-cite-trad { color: var(--gold-bright); font-weight: 600; letter-spacing: .02em; }
.wd-cite-sep { color: var(--gold-dim); }
.wd-cite-ref { color: var(--text); font-variant-numeric: tabular-nums; }
.wd-cite-tr { color: var(--text-dim); }
.wd-cite-title { width: 100%; color: var(--text-dim); font-size: .62rem; }

/* ---------- verses ---------- */
.wd-verses { padding: 4px 11px 12px; }
.wd-v {
  display: grid; grid-template-columns: 22px minmax(0, 1fr);
  gap: 4px;
  padding: 7px 0;
  border-bottom: 1px solid var(--hairline, rgba(214, 178, 94, .09));
}
.wd-v:last-child { border-bottom: 0; }
.wd-vn {
  color: var(--gold);
  font-size: .66rem; font-variant-numeric: tabular-nums;
  line-height: 1.9; text-align: right; padding-right: 6px;
}
.wd-vbody { min-width: 0; }
.wd-en { font-size: .845rem; line-height: 1.62; color: var(--text); }

/* Quran: Arabic first, RTL, in the app's reserved Arabic face */
.wd-v-q .wd-ar {
  font-family: var(--font-ar);
  font-size: 1.2rem; line-height: 2.05;
  direction: rtl; text-align: right;
  color: var(--gold-bright);
  margin-bottom: 4px;
}
.wd-v-q .wd-en { color: var(--text-dim); font-size: .8rem; line-height: 1.6; }

/* ---------- reader footer ---------- */
.wd-foot {
  display: flex; align-items: center; gap: 14px;
  margin-top: 16px; padding-top: 11px;
  border-top: 1px solid var(--line);
}
.wd-act { font-size: .76rem; color: var(--text-dim); display: inline-flex; align-items: center; gap: 6px; }
.wd-act:hover { color: var(--gold); }
.wd-act.right { margin-left: auto; }
.wd-act svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- about sheet ---------- */
.wd-sheet[hidden] { display: none; }
.wd-sheet {
  position: fixed; inset: 0; z-index: 210;
  background: rgba(4, 18, 14, .82);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.wd-sheet-card {
  background: var(--surface);
  border: 1px solid var(--gold-dim);
  border-radius: var(--r-lg);
  padding: 20px 18px 16px;
  max-width: 400px; max-height: 82vh; overflow-y: auto;
}
.wd-sheet-h {
  color: var(--gold); font-size: .68rem; letter-spacing: .14em;
  text-transform: uppercase; margin-bottom: 12px;
}
.wd-sheet-rows { margin-bottom: 12px; }
.wd-sheet-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--line);
  font-size: .82rem;
}
.wd-sheet-row:last-child { border-bottom: 0; }
.wd-sheet-row .dim { margin-left: auto; color: var(--text-dim); font-size: .74rem; text-align: right; }
.wd-sheet-p { font-size: .82rem; line-height: 1.65; color: var(--text); margin-bottom: 10px; }
.wd-sheet-p.dim { color: var(--text-dim); font-size: .78rem; }
.wd-sheet-card .pill { width: 100%; margin-top: 8px; }

/* ================= tablet / desktop: two columns ================= */
@media (min-width: 700px) {
  /* the app column is capped at 560px; the reader alone steps outside it,
     staying centred on the viewport */
  .wd-reader {
    --wd-w: min(calc(100vw - 40px), 1040px);
    width: var(--wd-w);
    margin-left: calc(50% - var(--wd-w) / 2);
    --wd-seg-h: 0px;
  }
  .wd-reader .wd-seg { display: none; }

  .wd-reader .wd-panels {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
  }
  /* each column scrolls on its own; the citation bar sticks inside it */
  .wd-reader .wd-panel {
    max-height: calc(100dvh - var(--tabbar-h) - 190px);
    overflow-y: auto;
    padding-right: 2px;
  }
  .wd-reader .wd-cite { top: 0; }
  .wd-reader .wd-en { font-size: .875rem; }
  .wd-reader .wd-v-q .wd-ar { font-size: 1.3rem; }

  .wd-themes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: start; }
}

/* ================= light skins ================= */
html[data-theme="v1"] .wd-v-q .wd-ar,
html[data-theme="v2"] .wd-v-q .wd-ar,
html[data-theme="v3"] .wd-v-q .wd-ar,
html[data-theme="v4"] .wd-v-q .wd-ar { color: var(--accent); }

html[data-theme="v1"] .wd-cite-trad,
html[data-theme="v2"] .wd-cite-trad,
html[data-theme="v3"] .wd-cite-trad,
html[data-theme="v4"] .wd-cite-trad { color: var(--accent); }

html[data-theme="v1"] .wd-seg-b.on,
html[data-theme="v2"] .wd-seg-b.on,
html[data-theme="v3"] .wd-seg-b.on,
html[data-theme="v4"] .wd-seg-b.on { color: var(--accent); }

html[data-theme="v1"] .wd-sheet,
html[data-theme="v2"] .wd-sheet,
html[data-theme="v3"] .wd-sheet,
html[data-theme="v4"] .wd-sheet { background: rgba(22, 26, 38, .58); }
