/* ==========================================================================
   Osiyos (אוֹתִיּוֹת) — Zero-Box Editorial System
   Inspired by classic reference typography: warm paper, hairline rules,
   Newsreader serif + Frank Ruhl Libre Hebrew with nekudos, and quiet poise.
   ========================================================================== */

:root,
[data-theme="paper"] {
  --paper: #FAF8F4;
  --ink: #141824;
  --muted: #596070;
  --rule: #E4E0D8;
  --accent: #1D44A8;
  --accent-soft: #9BB1E8;
  --card-bg: #17388C;
  --card-ink: #FAF8F4;
  --card-muted: rgba(250, 248, 244, 0.78);
  --card-line: rgba(250, 248, 244, 0.36);
  --card-hover: rgba(250, 248, 244, 0.12);
  --focus: #1D44A8;
  --error: #B42318;
  --font-serif: "Source Serif 4", Georgia, serif;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-hebrew: "Noto Serif Hebrew", "Frank Ruhl Libre", serif;
}

[data-theme="gold"] {
  --paper: #E2C478;
  --ink: #1C1610;
  --muted: #4C3E2B;
  --rule: rgba(28, 22, 16, 0.22);
  --accent: #7A1E29;
  --accent-soft: rgba(122, 30, 41, 0.45);
  --card-bg: #D9B768;
  --card-ink: #1C1610;
  --card-muted: rgba(28, 22, 16, 0.74);
  --card-line: rgba(28, 22, 16, 0.34);
  --card-hover: rgba(28, 22, 16, 0.08);
  --focus: #7A1E29;
  --error: #8F1D18;
}

[data-theme="techeiles"] {
  --paper: #17388C;
  --ink: #FAF8F4;
  --muted: rgba(250, 248, 244, 0.74);
  --rule: rgba(250, 248, 244, 0.22);
  --accent: #F2D28B;
  --accent-soft: rgba(242, 210, 139, 0.48);
  --card-bg: #122B6E;
  --card-ink: #FAF8F4;
  --card-muted: rgba(250, 248, 244, 0.78);
  --card-line: rgba(250, 248, 244, 0.36);
  --card-hover: rgba(250, 248, 244, 0.12);
  --focus: #F2D28B;
  --error: #FDA29B;
}

[data-theme="pardes"] {
  --paper: #3D2473;
  --ink: #F8F6FC;
  --muted: rgba(248, 246, 252, 0.74);
  --rule: rgba(248, 246, 252, 0.22);
  --accent: #EAD196;
  --accent-soft: rgba(234, 209, 150, 0.48);
  --card-bg: #2E1A59;
  --card-ink: #F8F6FC;
  --card-muted: rgba(248, 246, 252, 0.78);
  --card-line: rgba(248, 246, 252, 0.36);
  --card-hover: rgba(248, 246, 252, 0.12);
  --focus: #EAD196;
  --error: #FDA29B;
}

[data-theme="night"] {
  --paper: #111622;
  --ink: #EAEFF8;
  --muted: #9BA7BF;
  --rule: #242D42;
  --accent: #7EA4FF;
  --accent-soft: #435A8C;
  --card-bg: #1B2640;
  --card-ink: #EAEFF8;
  --card-muted: rgba(234, 239, 248, 0.74);
  --card-line: rgba(234, 239, 248, 0.30);
  --card-hover: rgba(234, 239, 248, 0.10);
  --focus: #7EA4FF;
  --error: #F97066;
}

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
  color: var(--ink);
  transition: background-color 180ms ease, color 180ms ease;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16.5px;
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 220ms ease, color 220ms ease;
}

body.study-mode {
  background: var(--card-bg);
  color: var(--card-ink);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

body.study-mode button:focus-visible,
body.study-mode a:focus-visible {
  outline-color: var(--card-ink);
}

.sr-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ==========================================================================
   Shell & Header
   ========================================================================== */

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  transition: background-color 220ms ease, border-color 220ms ease;
}

body.study-mode .site-header {
  background: var(--card-bg);
  border-bottom-color: var(--card-line);
}

.header-inner {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  min-height: 44px;
  align-items: center;
}

.brand-en {
  font-family: "Newsreader", Georgia, serif;
  font-size: 23px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.brand-he {
  font-family: var(--font-hebrew);
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
}

body.study-mode .brand-he {
  color: var(--card-ink);
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: auto;
  margin-right: 12px;
}

.nav-link {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 0;
  border-bottom: 1.5px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
}

.nav-link:hover {
  color: var(--ink);
}

.nav-link.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

body.study-mode .nav-link {
  color: var(--card-muted);
}

body.study-mode .nav-link:hover,
body.study-mode .nav-link.is-active {
  color: var(--card-ink);
  border-bottom-color: var(--card-ink);
}

.nav-count {
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

/* Quiet 4-Dot Paper Switcher */
.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.theme-dot {
  width: 30px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.theme-dot::before {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(20, 24, 36, 0.22);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.theme-dot[data-theme-choice="paper"]::before {
  background: #FAF8F4;
  border: 1.5px solid rgba(20, 24, 36, 0.38);
}

.theme-dot[data-theme-choice="gold"]::before {
  background: #D9B768;
  border: 1.5px solid rgba(28, 22, 16, 0.25);
}

.theme-dot[data-theme-choice="techeiles"]::before {
  background: #1D44A8;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
}

.theme-dot[data-theme-choice="pardes"]::before {
  background: #462B80;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
}

.theme-dot[data-theme-choice="night"]::before {
  background: #111622;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
}

body.study-mode .theme-dot::before {
  border-color: var(--card-line);
}

.theme-dot[aria-checked="true"]::before {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--ink);
}

body.study-mode .theme-dot[aria-checked="true"]::before {
  box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 3.5px var(--card-ink);
}

.storage-banner {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 10px 24px;
  font-family: "Inter", -apple-system, sans-serif;
  font-size: 12.5px;
  color: var(--error);
  border-bottom: 1px solid var(--rule);
}

/* ==========================================================================
   Main Container
   ========================================================================== */

.app-main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 24px 88px;
}

.app-main:focus {
  outline: none;
}

body.study-mode .app-main {
  padding-top: 24px;
  padding-bottom: 36px;
  display: flex;
  flex-direction: column;
}

.loading-state {
  padding: 48px 0;
  color: var(--muted);
  font-style: italic;
}

/* Shared Micro Typography */
.kicker {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.rule {
  height: 1px;
  background: var(--rule);
  border: 0;
  margin: 0;
}

/* ==========================================================================
   Home View — Opening, Search, Alef-Tav Ribbon, Concept of Day, Index
   ========================================================================== */

.intro-line {
  font-family: "Newsreader", Georgia, serif;
  font-size: 17px;
  font-style: italic;
  color: var(--muted);
  margin: 0 0 22px;
  line-height: 1.48;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
  margin-bottom: 18px;
}

.search-wrap:focus-within {
  border-bottom-color: var(--accent);
}

.search-icon {
  width: 17px;
  height: 17px;
  color: var(--muted);
  flex-shrink: 0;
  margin-right: 11px;
}

.search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: "Newsreader", Georgia, serif;
  font-size: 19px;
  line-height: 1.3;
  padding: 10px 0;
  outline: none;
}

.search-input::placeholder {
  color: var(--muted);
  opacity: 0.78;
}

.search-clear {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 6px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.search-clear:hover {
  color: var(--ink);
}

.search-shortcut {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.65;
  padding: 2px 6px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  margin-left: 8px;
}

/* 1-Tap RTL Alef-Tav Ribbon */
.alef-ribbon-wrap {
  position: relative;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 30px;
}

.alef-ribbon {
  display: flex;
  direction: rtl;
  align-items: stretch;
  justify-content: space-between;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  gap: 2px;
}

.alef-ribbon::-webkit-scrollbar {
  display: none;
}

.alef-btn {
  flex: 0 0 auto;
  min-width: 30px;
  min-height: 44px;
  padding: 8px 6px 9px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-family: var(--font-hebrew);
  font-size: 18px;
  font-weight: 400;
  color: var(--muted);
  opacity: 0.56;
  border-bottom: 2px solid transparent;
  transition: color 140ms ease, opacity 140ms ease, border-color 140ms ease;
}

.alef-btn.has-entries {
  color: var(--ink);
  opacity: 1;
  font-weight: 500;
}

.alef-btn:hover {
  opacity: 1;
  color: var(--accent);
}

.alef-btn.is-active {
  color: var(--accent);
  opacity: 1;
  font-weight: 700;
  border-bottom-color: var(--accent);
}

.alef-dot {
  width: 3.5px;
  height: 3.5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
}

.alef-btn.has-entries .alef-dot {
  opacity: 0.72;
}

.alef-btn.is-active .alef-dot {
  opacity: 0;
}

/* Concept of the Day — pure typography, zero box */
.cotd {
  padding: 2px 0 30px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 30px;
}

.cotd-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.cotd-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 10px;
}

.cotd-en {
  font-family: "Newsreader", Georgia, serif;
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin: 0;
}

.cotd-he {
  font-family: "Frank Ruhl Libre", serif;
  font-size: 36px;
  font-weight: 500;
  line-height: 1.08;
  direction: rtl;
  color: var(--ink);
  flex-shrink: 0;
}

.cotd-sub {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

.cotd-quote {
  font-family: "Newsreader", Georgia, serif;
  font-size: 17.5px;
  line-height: 1.56;
  color: var(--ink);
  margin: 0 0 18px;
  max-width: 62ch;
}

.cotd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
}

.text-action {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 8px 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid transparent;
  transition: border-color 140ms ease, opacity 140ms ease;
}

.text-action:hover {
  border-bottom-color: var(--accent);
}

.text-action-muted {
  color: var(--muted);
  font-weight: 500;
}

.text-action-muted:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* Index List */
.index-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  gap: 12px;
}

.index-letter-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.index-letter-he {
  font-family: "Frank Ruhl Libre", serif;
  font-size: 26px;
  font-weight: 500;
  color: var(--accent);
}

.index-letter-name {
  font-family: "Newsreader", Georgia, serif;
  font-size: 21px;
  font-weight: 400;
}

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.entry-row {
  border-bottom: 1px solid var(--rule);
}

.entry-row-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  min-height: 64px;
  transition: color 140ms ease;
}

.entry-row-link:hover .entry-row-en {
  color: var(--accent);
}

.entry-row-left {
  min-width: 0;
  flex: 1;
}

.entry-row-title-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.entry-row-en {
  font-family: "Newsreader", Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.2;
  transition: color 140ms ease;
}

.entry-row-trans {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.entry-row-saved-mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  vertical-align: middle;
}

.entry-row-snippet {
  margin: 6px 0 0;
  font-size: 15.5px;
  line-height: 1.48;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entry-row-he {
  font-family: "Frank Ruhl Libre", serif;
  font-size: 25px;
  font-weight: 500;
  direction: rtl;
  color: var(--ink);
  flex-shrink: 0;
  line-height: 1.1;
}

/* Upcoming Letter / Empty Search State */
.quiet-state {
  padding: 40px 0 28px;
}

.quiet-letter-big {
  font-family: "Frank Ruhl Libre", serif;
  font-size: 64px;
  font-weight: 500;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 10px;
}

.quiet-state h2 {
  font-family: "Newsreader", Georgia, serif;
  font-size: 26px;
  font-weight: 400;
  margin: 0 0 8px;
}

.quiet-state p {
  color: var(--muted);
  margin: 0 0 20px;
  max-width: 50ch;
}

.colophon {
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-family: "Inter", sans-serif;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

/* ==========================================================================
   Entry View — Exact Lexicon Soul
   ========================================================================== */

.entry-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}

.back-link {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.back-link:hover {
  color: var(--ink);
}

.entry-top-right {
  display: inline-flex;
  align-items: center;
  gap: 18px;
}

.bookmark-btn {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 44px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 140ms ease;
}

.bookmark-btn:hover,
.bookmark-btn[aria-pressed="true"] {
  color: var(--accent);
}

.bookmark-btn svg {
  width: 14px;
  height: 14px;
}

.entry-word-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 10px;
}

.entry-en {
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(34px, 6vw, 48px);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0;
}

.entry-he {
  font-family: "Frank Ruhl Libre", serif;
  font-size: clamp(34px, 6vw, 48px);
  font-weight: 500;
  direction: rtl;
  line-height: 1.08;
  color: var(--ink);
  flex-shrink: 0;
}

.entry-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-bottom: 24px;
}

.pronounce-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-right: 4px;
  color: var(--muted);
  font-family: "Inter", sans-serif;
  font-size: 13px;
}

.pronounce-btn:hover {
  color: var(--ink);
}

.play-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 150ms ease;
}

.play-dot::after {
  content: "";
  border-style: solid;
  border-width: 4.5px 0 4.5px 7.5px;
  border-color: transparent transparent transparent var(--paper);
  margin-left: 2px;
}

[data-theme="night"] .play-dot::after {
  border-left-color: #111622;
}

.pronounce-btn.is-speaking .play-dot {
  transform: scale(1.12);
}

.entry-translation-tag {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-left: auto;
}

/* Depth Tabs — pure underline, zero pills */
.depth-tabs {
  display: flex;
  gap: 28px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 28px;
  overflow-x: auto;
  scrollbar-width: none;
}

.depth-tabs::-webkit-scrollbar {
  display: none;
}

.depth-tab {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 0 12px;
  min-height: 44px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 140ms ease, border-color 140ms ease;
}

.depth-tab:hover {
  color: var(--ink);
}

.depth-tab[aria-selected="true"] {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* Entry Tab Content */
.entry-def {
  font-family: "Newsreader", Georgia, serif;
  font-size: 19px;
  line-height: 1.62;
  margin: 0 0 24px;
  color: var(--ink);
}

.entry-def-num {
  color: var(--accent);
  font-weight: 500;
  margin-right: 8px;
}

.entry-quote {
  border-left: 2px solid var(--accent-soft);
  padding: 2px 0 2px 16px;
  margin: 0 0 28px;
  font-family: "Newsreader", Georgia, serif;
  font-style: italic;
  font-size: 16.5px;
  line-height: 1.56;
  color: var(--muted);
}

.entry-section {
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  margin-top: 24px;
}

.entry-section-label {
  font-family: "Inter", sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 9px;
}

.shoresh-line {
  font-family: "Newsreader", Georgia, serif;
  font-size: 16.5px;
  line-height: 1.56;
  margin: 0;
}

.shoresh-he {
  font-family: "Frank Ruhl Libre", serif;
  font-size: 19px;
  font-weight: 500;
  color: var(--accent);
  margin-right: 6px;
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
}

.related-link {
  font-family: "Newsreader", Georgia, serif;
  font-size: 17px;
  color: var(--ink);
  padding: 6px 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid var(--rule);
  transition: color 140ms ease, border-color 140ms ease;
}

.related-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.related-link-he {
  font-family: "Frank Ruhl Libre", serif;
  font-size: 18px;
  color: var(--muted);
}

.related-link:hover .related-link-he {
  color: var(--accent);
}

/* Deep Dive Tab */
.deep-para {
  font-family: "Newsreader", Georgia, serif;
  font-size: 18px;
  line-height: 1.66;
  margin: 0 0 18px;
  color: var(--ink);
}

.shared-sources-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.shared-sources-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 14px;
}

.shared-source-cite {
  color: var(--muted);
  font-style: italic;
}

/* Sources Tab */
.sources-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.source-item {
  border-bottom: 1px solid var(--rule);
}

.source-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 0;
  min-height: 52px;
  transition: color 140ms ease;
}

.source-link:hover {
  color: var(--accent);
}

.source-num {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  margin-right: 12px;
}

.source-title {
  font-family: "Newsreader", Georgia, serif;
  font-size: 18px;
  flex: 1;
}

.source-host {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}

.source-link:hover .source-host {
  color: var(--accent);
}

/* Entry Bottom Pager */
.entry-pager {
  margin-top: 38px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pager-link {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 38%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pager-link:hover {
  color: var(--accent);
}

.pager-center {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-bottom: 1.5px solid var(--accent-soft);
}

.pager-center:hover {
  border-bottom-color: var(--accent);
}

/* ==========================================================================
   Full-Bleed Flashcard Study Mode (Remedy / Contemplate Soul)
   ========================================================================== */

.study-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: calc(100dvh - 120px);
  color: var(--card-ink);
}

.study-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--card-line);
}

.study-counter {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--card-muted);
  font-variant-numeric: tabular-nums;
}

.study-filters {
  display: inline-flex;
  align-items: center;
  gap: 18px;
}

.study-filter-btn {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--card-muted);
  min-height: 40px;
  border-bottom: 1.5px solid transparent;
  transition: color 140ms ease, border-color 140ms ease;
}

.study-filter-btn:hover,
.study-filter-btn[aria-pressed="true"] {
  color: var(--card-ink);
  border-bottom-color: var(--card-ink);
}

.study-close {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--card-muted);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.study-close:hover {
  color: var(--card-ink);
}

.study-body {
  margin: auto 0;
  padding: 36px 0;
  cursor: pointer;
}

.study-he {
  font-family: "Frank Ruhl Libre", serif;
  font-size: clamp(54px, 11vw, 76px);
  font-weight: 500;
  line-height: 1.06;
  direction: rtl;
  text-align: left;
  margin: 0 0 14px;
}

.study-en {
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(32px, 6vw, 44px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 8px;
}

.study-phon {
  font-family: "Inter", sans-serif;
  font-size: 13px;
  color: var(--card-muted);
  margin: 0 0 28px;
}

.study-prompt {
  font-family: "Newsreader", Georgia, serif;
  font-size: 19px;
  line-height: 1.5;
  color: var(--card-ink);
  opacity: 0.92;
  max-width: 46ch;
  margin: 0;
}

.study-back-kicker {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--card-muted);
  margin: 0 0 10px;
}

.study-back-title {
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(28px, 5vw, 36px);
  font-weight: 400;
  margin: 0 0 18px;
  line-height: 1.15;
}

.study-back-para {
  font-family: "Newsreader", Georgia, serif;
  font-size: 19px;
  line-height: 1.62;
  max-width: 56ch;
  margin: 0 0 22px;
}

.study-open-entry {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--card-ink);
  border-bottom: 1px solid var(--card-line);
  padding: 6px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.study-open-entry:hover {
  border-bottom-color: var(--card-ink);
}

.study-controls {
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.study-flip-btn {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--card-line);
  border-radius: 999px;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--card-ink);
  transition: background-color 150ms ease, border-color 150ms ease;
}

.study-flip-btn:hover {
  background: var(--card-hover);
  border-color: var(--card-ink);
}

.study-mastery-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.study-grade-btn {
  min-height: 48px;
  border: 1px solid var(--card-line);
  border-radius: 999px;
  padding: 12px 18px;
  font-family: "Inter", sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--card-ink);
  text-align: center;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.study-grade-btn:hover,
.study-grade-btn.is-selected {
  background: var(--card-hover);
  border-color: var(--card-ink);
}

.study-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--card-line);
}

.study-nav-btn {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--card-muted);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.study-nav-btn:hover {
  color: var(--card-ink);
}

.study-mastery-meta {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--card-muted);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Saved View
   ========================================================================== */

.saved-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}

.saved-title {
  font-family: "Newsreader", Georgia, serif;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0;
}

.saved-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}

.saved-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.saved-row-main:hover .entry-row-en {
  color: var(--accent);
}

.saved-remove-btn {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 44px;
  padding: 0 4px 0 12px;
  flex-shrink: 0;
}

.saved-remove-btn:hover {
  color: var(--error);
}

/* ==========================================================================
   Mobile Bottom Bar
   ========================================================================== */

.mobile-nav {
  display: none;
}

@media (max-width: 720px) {
  .header-inner {
    padding: 10px 18px;
  }

  .desktop-nav {
    display: none;
  }

  .app-main {
    padding: 20px 18px 92px;
  }

  .search-shortcut {
    display: none;
  }

  .cotd-en,
  .cotd-he {
    font-size: 30px;
  }

  .entry-def {
    font-size: 18px;
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: var(--paper);
    border-top: 1px solid var(--rule);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  body.study-mode .mobile-nav {
    display: none;
  }

  .mobile-nav-link {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Inter", sans-serif;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    position: relative;
  }

  .mobile-nav-link.is-active {
    color: var(--accent);
    font-weight: 600;
  }

  .mobile-nav-link.is-active::after {
    content: "";
    position: absolute;
    bottom: 8px;
    width: 24px;
    height: 1.5px;
    background: var(--accent);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-header,
  .mobile-nav,
  .alef-ribbon-wrap,
  .depth-tabs,
  .entry-pager,
  .bookmark-btn,
  .pronounce-btn {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
}

/* ============================================================================
   Mission Statement (Home Preface) & History of Sefer HaArachim (#/history)
   ============================================================================ */
.mission-block {
  padding: 6px 0 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}
.mission-lead {
  font-family: var(--font-serif);
  font-size: clamp(1.38rem, 2.8vw, 1.72rem);
  line-height: 1.32;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 10px 0 14px;
}
.mission-dedication {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.04rem;
  line-height: 1.55;
  color: var(--muted);
  border-left: 2px solid var(--accent-soft);
  padding-left: 14px;
  margin: 0 0 16px;
}
.mission-body p {
  font-family: var(--font-serif);
  font-size: 1.03rem;
  line-height: 1.62;
  color: var(--ink);
  margin: 0 0 11px;
  max-width: 62ch;
}
.mission-body p:last-child {
  margin-bottom: 0;
}
.mission-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
}

.history-view {
  padding-top: 4px;
}
.history-header {
  padding: 18px 0 24px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 28px;
}
.history-title {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 4.2vw, 2.55rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--ink);
  margin: 10px 0 10px;
}
.history-sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.06rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
  max-width: 58ch;
}
.history-section {
  padding: 0 0 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--rule);
  max-width: 64ch;
}
.history-section:last-of-type {
  border-bottom: none;
  margin-bottom: 12px;
}
.history-section h2 {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}
.history-section p {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  line-height: 1.68;
  color: var(--ink);
  margin: 0;
}
.history-source {
  margin-top: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}
.history-source a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  padding-bottom: 1px;
}
.history-source a:hover {
  border-bottom-color: var(--accent);
}

.history-view .entry-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* ============================================================================
   Research-Backed Typography Pairing (Dec 3, 2026)
   - Concept Titles / Editorial Lead: Source Serif 4 (scholarly Torah gravity)
   - Short Definitions / Mission / History Body / UI: Plus Jakarta Sans (9th grade & Gen Z mobile legibility)
   - Hebrew Terms with Nekudos: Noto Serif Hebrew (precision OpenType niqqud anchoring)
   ============================================================================ */
.brand-en,
.mission-lead,
.cotd-en,
.entry-title,
.entry-en,
.entry-row-en,
.index-en,
.history-title,
.study-front-en,
.flash-en {
  font-family: var(--font-serif);
}
.brand-he,
.cotd-he,
.entry-he,
.index-he,
.alef-letter,
.flash-he,
[lang="he"] {
  font-family: var(--font-hebrew);
}
.mission-body p,
.history-section p,
.entry-def,
.entry-row-snippet,
.study-back-para,
.cotd-quote,
.deep-body p {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  line-height: 1.68;
  letter-spacing: -0.005em;
}
.mission-dedication,
.history-sub {
  font-family: var(--font-serif);
  font-style: italic;
}
