/* Selah — web client typography & layout
   Inline-then-refactor philosophy. Hebrew typography lives here from day 1. */

/* Noto Serif Hebrew (OFL, resources/public/fonts/) is the SHIPPED
   Hebrew face and leads every Hebrew stack — the face Scott's
   fontconfig had been resolving all along ("what it used to be",
   2026-07-27), now guaranteed for every visitor. Full niqqud +
   te'amim coverage (U+0591-05C7). Why shipped at all: without a
   webfont the stacks bottomed out at bare `serif`, and browsers
   resolve that fallback PER DOCUMENT LANGUAGE — <html
   lang="zh-Hans"> changed the Hebrew typeface. EzraSIL stays as
   the shipped fallback; SBLHebrew for locals who have it. */
@font-face {
  font-family: 'NotoSerifHebrew';
  src: url('/fonts/NotoSerifHebrew-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'NotoSerifHebrew';
  src: url('/fonts/NotoSerifHebrew-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'EzraSIL';
  src: url('/fonts/EzraSIL.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
/* Tamil — shipped, not left to fontconfig (2026-08-20): a user's
   system can resolve Tamil to a partial legacy face (Samyak) and
   tofu whole shaping clusters — the ta chair's glosses rendered as
   boxes on a machine that HAD complete Noto Tamil installed. Any
   chair whose script we don't ship is one fontconfig away from the
   same bug; Tamil is the first, others as reported. */
@font-face {
  font-family: 'NotoSerifTamil';
  src: url('/fonts/NotoSerifTamil-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0B80-0BFF;
}
@font-face {
  font-family: 'NotoSerifTamil';
  src: url('/fonts/NotoSerifTamil-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0B80-0BFF;
}
/* Gujarati + Kannada — bundled AT SEATING (tier-5), before any
   tofu can appear. */
@font-face {
  font-family: 'NotoSerifGujarati';
  src: url('/fonts/NotoSerifGujarati-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0A80-0AFF;
}
@font-face {
  font-family: 'NotoSerifGujarati';
  src: url('/fonts/NotoSerifGujarati-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0A80-0AFF;
}
@font-face {
  font-family: 'NotoSerifKannada';
  src: url('/fonts/NotoSerifKannada-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0C80-0CFF;
}
@font-face {
  font-family: 'NotoSerifKannada';
  src: url('/fonts/NotoSerifKannada-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0C80-0CFF;
}
/* Malayalam — bundled AT SEATING (the 32nd chair), before any
   tofu can appear. */
@font-face {
  font-family: 'NotoSerifMalayalam';
  src: url('/fonts/NotoSerifMalayalam-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0D00-0D7F;
}
@font-face {
  font-family: 'NotoSerifMalayalam';
  src: url('/fonts/NotoSerifMalayalam-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0D00-0D7F;
}
/* Myanmar — bundled AT SEATING (the 34th chair). */
@font-face {
  font-family: 'NotoSerifMyanmar';
  src: url('/fonts/NotoSerifMyanmar-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  unicode-range: U+1000-109F, U+AA60-AA7F;
}
@font-face {
  font-family: 'NotoSerifMyanmar';
  src: url('/fonts/NotoSerifMyanmar-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
  unicode-range: U+1000-109F, U+AA60-AA7F;
}

/* Oriya (Odia) — bundled AT SEATING (the 37th chair). */
@font-face {
  font-family: 'NotoSerifOriya';
  src: url('/fonts/NotoSerifOriya-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0B00-0B7F;
}
@font-face {
  font-family: 'NotoSerifOriya';
  src: url('/fonts/NotoSerifOriya-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0B00-0B7F;
}

/* Sinhala — bundled AT SEATING (the 42nd chair, the last rung). */
@font-face {
  font-family: 'NotoSerifSinhala';
  src: url('/fonts/NotoSerifSinhala-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0D80-0DFF;
}
@font-face {
  font-family: 'NotoSerifKhmer';
  src: url('/fonts/NotoSerifKhmerVar.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+1780-17FF, U+19E0-19FF;
}
@font-face {
  font-family: 'NotoSerifSinhala';
  src: url('/fonts/NotoSerifSinhala-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0D80-0DFF;
}

:root {
  --color-bg:           #faf8f4;
  --color-fg:           #2a2825;
  --color-muted:        #847f76;
  --color-rule:         #e6e1d6;
  --color-aleph-tav:    #b08847;   /* warm bronze for ⟨את⟩ */
  --color-bracket:      #847f76;   /* English-required additions */
  --color-accent:       #2c5d8f;

  --font-hebrew:        'NotoSerifHebrew', 'EzraSIL', 'SBLHebrew', 'Frank Ruehl', 'David', serif;
  /* Bundled faces for non-Latin chair scripts. Each is
     unicode-range-scoped in its @font-face (Tamil: U+0B80-0BFF), so
     they only ever supply their own script's glyphs — Latin text
     never touches them. Every font stack in the app ends in
     var(--script-faces) before its generic keyword; when a new
     chair script needs a bundled face, add it HERE, once. */
  --script-faces:       'NotoSerifKhmer', 'NotoSerifTamil', 'NotoSerifGujarati', 'NotoSerifKannada', 'NotoSerifMalayalam', 'NotoSerifMyanmar', 'NotoSerifOriya', 'NotoSerifSinhala';
  --font-english:       'Cardo', 'EB Garamond', Georgia, var(--script-faces), serif;
  --font-mono:          'JetBrains Mono', 'SF Mono', Menlo, var(--script-faces), monospace;
  /* Chrome font WITHOUT the script faces — for UI surfaces that
     render native-script labels (the language menu). One glyph per
     label was downloading every bundled Noto Serif the moment the
     dropdown opened (the loaded-together discovery, 2026-08-27).
     System fonts carry these scripts on all modern OSes; the serif
     faces stay reserved for scripture text. */
  --font-chrome:        'Cardo', 'EB Garamond', Georgia, system-ui, serif;

  --size-base:          16px;
  --size-hebrew:        1.4em;     /* Hebrew larger than English */
  --leading-hebrew:     1.9;
  --leading-english:    1.55;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-english);
  font-size: var(--size-base);
  line-height: var(--leading-english);
}

#app { min-height: 100vh; }

/* The blank page — quiet and empty by intent. */
.page--blank {
  min-height: 100vh;
  background: var(--color-bg);
}

/* Thin fixed bars (header + footer) */
.app__bar {
  position: fixed;
  left: 0;
  right: 0;
  height: 38px;
  z-index: 20;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  padding: 0 1rem;
}
.app__bar--top {
  top: 0;
  border-bottom: 1px solid var(--color-rule);
}
.app__bar--bottom {
  bottom: 0;
  border-top: 1px solid var(--color-rule);
}
.app__mark {
  font-family: var(--font-hebrew);
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--color-fg);
  user-select: none;
}
.app__copyright {
  font-family: var(--font-english);
  font-size: 0.78rem;
  color: var(--color-muted);
  letter-spacing: 0.02em;
  user-select: none;
}

/* Main content sits between the bars */
.page__main {
  padding-top: 38px;
  padding-bottom: 38px;
  min-height: 100vh;
  box-sizing: border-box;
}

/* ── Side panels ───────────────────────────────────────────── */

.app__panel {
  position: fixed;
  top: 38px;          /* below header */
  bottom: 38px;       /* above footer */
  z-index: 10;
  background: var(--color-bg);
  display: flex;
  transition: width 160ms ease-out;
}
/* Disable the open/close transition while actively dragging — the
   width updates land per pointermove and need to track instantly. */
.app__panel--dragging {
  transition: none !important;
}
.app__panel--left   { left: 0;  flex-direction: row; }
.app__panel--right  { right: 0; flex-direction: row-reverse; }

.app__panel--open {
  border-color: var(--color-rule);
}
.app__panel--left.app__panel--open  { border-right: 1px solid var(--color-rule); }
.app__panel--right.app__panel--open { border-left:  1px solid var(--color-rule); }

/* Panel body — empty by intent, ready to receive */
.app__panel__body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 0.5rem 0.75rem;
}

/* The handle: a thin vertical strip on the inside edge.
   In hidden state, it IS the whole panel (and is the affordance).
   In open state, it sits at the inner edge as a resize/close grip. */
.app__panel__handle {
  width: 16px;
  flex: 0 0 16px;
  cursor: col-resize;
  position: relative;
  align-self: stretch;          /* fill panel height in the flex row */
  touch-action: none;           /* let pointer events drive drag, not scroll */
}

.app__panel--hidden .app__panel__handle {
  width: 100%;
  flex-basis: 100%;
  cursor: pointer;
}

/* The grip — a small vertical stack of dashes, dead-centered on
   the panel's vertical edge. ~60px tall regardless of viewport
   height; legibly "something to grab". */
.app__panel__handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 60px;
  border-radius: 2px;
  background-image: repeating-linear-gradient(
    to bottom,
    var(--color-muted) 0,
    var(--color-muted) 2px,
    transparent 2px,
    transparent 6px
  );
  opacity: 0.55;
  transition: opacity 120ms ease-out, background-image 120ms ease-out;
}

.app__panel__handle:hover::before {
  opacity: 1;
  background-image: repeating-linear-gradient(
    to bottom,
    var(--color-accent) 0,
    var(--color-accent) 2px,
    transparent 2px,
    transparent 6px
  );
}

/* ── Scripture component — the typography heart ───────────────── */

.scripture {
  max-width: 56rem;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.scripture__heading {
  color: var(--color-muted);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--color-rule);
  padding-bottom: 0.6rem;
}

.scripture__verse {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: baseline;
  padding: 1rem 0;
}

@media (max-width: 720px) {
  .scripture__verse { grid-template-columns: 1fr; }
}

.scripture__hebrew {
  direction: rtl;
  font-family: var(--font-hebrew);
  font-size: var(--size-hebrew);
  line-height: var(--leading-hebrew);
  text-align: right;
  unicode-bidi: isolate;
}

.scripture__english {
  font-family: var(--font-english);
  line-height: var(--leading-english);
}

.scripture__verse-num {
  color: var(--color-muted);
  font-size: 0.7em;
  vertical-align: super;
  margin-inline-end: 0.4em;
  font-feature-settings: "tnum";
}

.scripture__token {
  display: inline;
}

/* The ⟨את⟩ glyph — load-bearing, quiet but present */
.scripture__aleph-tav {
  color: var(--color-aleph-tav);
  font-weight: inherit;
}

/* English brackets ⟨…⟩ — interpretive additions */
.scripture__bracket {
  color: var(--color-bracket);
  font-style: normal;
}

/* ── App chrome ────────────────────────────────────────────── */

.app__header {
  border-bottom: 1px solid var(--color-rule);
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app__title {
  font-family: var(--font-hebrew);
  font-size: 1.4rem;
  margin: 0;
}

.app__nav {
  font-size: 0.9rem;
  color: var(--color-muted);
}

.app__nav a {
  color: var(--color-accent);
  text-decoration: none;
  margin-inline-start: 1rem;
}

.app__nav a:hover { text-decoration: underline; }

/* ── Cell strip ───────────────────────────────────────────── */

.cell-strip-wrap {
  display: inline-block;
  padding: 0;
  margin: 0;
  line-height: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.cell-strip-wrap canvas,
.cell-strip-wrap svg {
  display: block;
}

.app__nav .is-active {
  font-weight: 600;
  color: var(--color-fg);
}

/* ── Compare strip — three backends, three rows ──────────── */

.compare-strip {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1rem;
}

.compare-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.compare-row__label {
  flex: 0 0 4rem;
  text-align: end;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
}

.compare-row__view {
  flex: 1 1 auto;
  display: flex;
  justify-content: flex-start;
}


/* ── Backend stubs ────────────────────────────────────────── */

.backend-stub {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 12rem;
  border: 1px dashed var(--color-rule);
  background: rgba(0,0,0,0.02);
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  border-radius: 4px;
}

/* ── Help overlay ─────────────────────────────────────────── */

.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.help-overlay__panel {
  background: var(--color-bg);
  padding: 2rem 2.5rem;
  border-radius: 6px;
  max-width: 32rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.help-overlay h2 {
  margin-top: 0;
  font-family: var(--font-english);
  font-weight: normal;
  letter-spacing: 0.03em;
}

.help-overlay kbd {
  font-family: var(--font-mono);
  background: var(--color-rule);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.85em;
}

/* ── Tap-target utility (44×44 minimum) ───────────────────── */

.tap-target {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Focus visibility ─────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Query list (v0 first slice) ──────────────────────────── */

.q-list {
  font-family: var(--font-english);
  padding: 1.5rem 2rem;
  max-width: 880px;
  margin: 0 auto;
}

.q-list__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-rule);
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
}

.q-list__title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.q-list__total {
  color: var(--color-muted);
  font-size: 0.85rem;
}

.q-list__rows {
  list-style: none;
  padding: 0;
  margin: 0;
}

.q-list__row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto auto;
  gap: 0.8rem;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-rule);
}

.q-list__order {
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  text-align: right;
}

.q-list__name {
  font-size: 1rem;
}

.q-list__kind {
  display: none;  /* hidden in v0 — single-kind result */
}

.q-list__counts {
  color: var(--color-muted);
  font-size: 0.8rem;
  display: flex;
  gap: 0.7rem;
}

.q-list__count em {
  font-style: normal;
  color: var(--color-text);
}

/* Native-script labels in the tabbar menus use system fonts —
   see --font-chrome above. */
.wb-tabbar-menu { font-family: var(--font-chrome); }
