/* ==========================================================================
   Zemirots: ivory paper, warm ink, and the gold of the cover
   ========================================================================== */
:root {
  --paper: #fbf7ee;
  --paper-2: #f5eedf;
  --card: #fffdf8;
  --ink: #1f1a14;
  --ink-2: #4e453a;
  --muted: #8a7d6b;
  --line: #e8dec9;
  --gold: #b8862b;
  --gold-deep: #8f6419;
  --gold-soft: #f1e2bb;
  --gold-grad: linear-gradient(100deg, #9a6b1f 0%, #e3bd62 30%, #b8862b 55%, #f1d78f 80%, #a77724 100%);
  --night: #17130e;
  --night-2: #221c15;

  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --hebrew: "Frank Ruhl Libre", "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(60, 40, 10, .06), 0 2px 8px rgba(60, 40, 10, .05);
  --shadow: 0 2px 6px rgba(60, 40, 10, .06), 0 14px 40px -12px rgba(60, 40, 10, .22);
  --bar-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 12px); }
body {
  margin: 0;
  font: 400 16px/1.6 var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; outline: none; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.view:not([hidden]) { animation: view-in .45s var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
#view-book:not([hidden]) { animation-name: fade; }
::selection { background: var(--gold-soft); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
[dir="rtl"], .he { font-family: var(--hebrew); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 22px; border-radius: 999px;
  font-weight: 600; font-size: 15px; letter-spacing: .01em;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s, border-color .2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-ink { background: var(--ink); color: #fff8e8; box-shadow: 0 8px 24px -10px rgba(31, 26, 20, .6); }
.btn-ink:hover { box-shadow: 0 12px 28px -10px rgba(31, 26, 20, .7); }
.btn-gold { background: var(--gold-grad); background-size: 160% 100%; color: #2b1d05; box-shadow: 0 6px 18px -8px rgba(160, 110, 20, .7); }
.btn-gold:hover { background-position: 100% 0; }
.btn-line { background: rgba(255, 253, 248, .7); border-color: var(--line); color: var(--ink); backdrop-filter: blur(6px); }
.btn-line:hover { border-color: var(--gold); }
.btn-sm { padding: 8px 14px; font-size: 14px; gap: 6px; }
.btn-sm svg { width: 16px; height: 16px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: transparent; border: 1px solid var(--line); cursor: pointer;
  transition: background .2s, border-color .2s;
}
.icon-btn:hover { background: var(--card); border-color: var(--gold); }
.icon-btn:disabled { opacity: .35; cursor: default; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 40px);
  padding-top: env(safe-area-inset-top);
  background: rgba(251, 247, 238, .82);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.scrolled .topbar { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-script { height: 34px; width: auto; }
.brand-word { font: 600 22px/1 var(--serif); letter-spacing: .18em; text-transform: uppercase; }
.topnav { display: flex; align-items: center; gap: clamp(8px, 2.5vw, 28px); }
.topnav a:not(.btn) { text-decoration: none; font-weight: 600; font-size: 15px; color: var(--ink-2); padding: 6px 2px; position: relative; }
.topnav a:not(.btn)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--gold-grad); transform: scaleX(0); transition: transform .3s var(--ease); }
.topnav a:not(.btn):hover::after, .topnav a.active::after { transform: scaleX(1); }
.topnav a.active { color: var(--ink); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; isolation: isolate; }
.hero-waves { position: absolute; z-index: -1; pointer-events: none; opacity: .9; width: min(1100px, 120vw); }
.hero-waves-top { top: -40px; right: -12vw; transform: scaleX(-1); }
.hero-waves-bottom { bottom: -30px; left: -8vw; }
.hero-inner {
  max-width: 1200px; margin: 0 auto;
  padding: clamp(32px, 6vw, 80px) clamp(20px, 4vw, 40px) clamp(56px, 8vw, 110px);
  display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(32px, 5vw, 72px); align-items: center;
}
.hero-logo { width: min(520px, 100%); margin: 0 0 18px -10px; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .6)); }
.hero-lede { font: 500 clamp(20px, 2.2vw, 24px)/1.45 var(--serif); color: var(--ink-2); max-width: 32ch; margin: 0 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }

/* 3D book */
.cover3d { display: grid; justify-items: center; gap: 18px; text-decoration: none; perspective: 1800px; }
.book3d {
  position: relative; width: min(330px, 70vw); aspect-ratio: 396 / 612;
  transform-style: preserve-3d; transform: rotateY(-24deg) rotateX(6deg) rotateZ(1deg);
  transition: transform .9s var(--ease);
  animation: bob 7s ease-in-out infinite;
}
.cover3d:hover .book3d, .cover3d:focus-visible .book3d { transform: rotateY(-8deg) rotateX(2deg); }
.book3d-front {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  border-radius: 3px 8px 8px 3px;
  transform: translateZ(14px);
  box-shadow: 0 30px 60px -18px rgba(60, 40, 10, .45), 0 10px 20px -10px rgba(60, 40, 10, .3);
}
.book3d-front::after { content: ""; }
.book3d-pages {
  position: absolute; top: 1%; bottom: 1%; left: calc(100% - 14px); width: 28px;
  transform: rotateY(90deg);
  background: repeating-linear-gradient(90deg, #f7f0e1 0 2px, #e2d6be 2px 3px);
}
.book3d-back { position: absolute; inset: 0; transform: translateZ(-14px); background: #e9dcc0; border-radius: 3px 8px 8px 3px; }
.book3d::before { /* soft floor shadow */
  content: ""; position: absolute; left: 8%; right: -6%; bottom: -26px; height: 30px;
  background: radial-gradient(closest-side, rgba(70, 45, 10, .28), transparent);
  transform: translateZ(-40px); filter: blur(4px);
}
.book3d::after { /* sheen */
  content: ""; position: absolute; inset: 0; transform: translateZ(15px); border-radius: 3px 8px 8px 3px;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .45) 45%, transparent 60%);
  background-size: 250% 100%; background-position: 100% 0;
  transition: background-position 1.2s var(--ease); pointer-events: none;
}
.cover3d:hover .book3d::after { background-position: 0 0; }
.cover-hint { font: 600 12px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
@keyframes bob { 50% { translate: 0 -8px; } }

/* ---------- search ---------- */
.search { position: relative; display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 0 18px; transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(184, 134, 43, .14); }
.search > svg { color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 500 16px/1 var(--sans); color: var(--ink); padding: 15px 0; }
.search input::placeholder { color: #a99c88; }
.search input::-webkit-search-cancel-button { filter: sepia(1) saturate(2) hue-rotate(5deg); }
.search kbd { font: 600 12px/1 var(--sans); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; }
.search-hero { box-shadow: var(--shadow); max-width: 560px; }
.search-hero input { font-size: 17px; padding: 18px 0; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 20;
  list-style: none; margin: 0; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.suggest li a { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; text-decoration: none; }
.suggest li a:hover, .suggest li a[aria-selected="true"] { background: var(--paper-2); }
.suggest .more a { grid-template-columns: 1fr; text-align: center; color: var(--gold-deep); font-weight: 600; font-size: 14px; }

/* ---------- blocks ---------- */
.block { max-width: 1200px; margin: 0 auto; padding: clamp(40px, 6vw, 80px) clamp(20px, 4vw, 40px); }
.block-head { margin-bottom: 28px; }
.eyebrow { font: 700 12px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--gold-deep); margin: 0 0 12px; }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.1; margin: 0; }
h2 { font-size: clamp(32px, 4vw, 46px); }

.section-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.section-card:first-child { background: radial-gradient(500px 220px at 85% 0%, rgba(233, 196, 106, .22), transparent 70%), var(--card); }
.section-card:first-child .sc-he { font-size: 34px; }
@media (max-width: 1180px) {
  .section-grid { grid-template-columns: repeat(3, 1fr); }
  .section-card:first-child { grid-column: span 2; }
}
@media (max-width: 700px) {
  .section-grid { grid-template-columns: 1fr; }
  .section-card:first-child, .section-card:last-child { grid-column: auto; }
  .section-card { min-height: 0; }
}
.section-card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 24px 24px 20px; min-height: 200px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
}
.section-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--gold-grad); transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease); }
.section-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #dcc9a0; }
.section-card:hover::before { transform: scaleX(1); }
.section-card .sc-he { font: 500 26px/1.25 var(--hebrew); direction: rtl; text-align: right; color: var(--ink); }
.section-card .sc-en { font: 600 22px/1.2 var(--serif); margin-top: 6px; }
.section-card .sc-blurb { color: var(--ink-2); font-size: 14px; margin: 0; }
.section-card .sc-foot { margin-top: auto; padding-top: 14px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); font-weight: 600; }
.section-card .sc-foot svg { width: 18px; height: 18px; color: var(--gold); transition: transform .3s var(--ease); }
.section-card:hover .sc-foot svg { transform: translateX(4px); }

.block-ranked { padding-top: 0; }
.ranked { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; counter-reset: none; }
.ranked a {
  display: grid; grid-template-columns: 46px 1fr; gap: 14px; align-items: center;
  padding: 12px 16px 12px 12px; border-radius: 12px; text-decoration: none;
  border: 1px solid transparent; transition: background .2s, border-color .2s;
}
.ranked a:hover { background: var(--card); border-color: var(--line); }
.rank-badge {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font: 700 20px/1 var(--serif); color: #3a2706; background: var(--gold-grad); background-size: 200% 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 4px 10px -4px rgba(150, 100, 20, .6);
}
.ranked .r-tr { font-weight: 600; font-size: 15px; line-height: 1.3; }
.ranked .r-he { font: 400 15px/1.3 var(--hebrew); color: var(--ink-2); direction: rtl; text-align: left; }

.about { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; border-top: 1px solid var(--line); }
.about p { color: var(--ink-2); max-width: 54ch; }
.about-actions { margin: 24px 0 12px; display: flex; gap: 12px; flex-wrap: wrap; }
.version { font-size: 13px; color: var(--muted); }
.dedication { margin: 0; padding: clamp(18px, 3vw, 32px); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

.site-foot { position: relative; text-align: center; padding: 60px 20px 40px; color: var(--muted); font-size: 13px; overflow: hidden; }
.foot-sparkle { width: min(560px, 90vw); margin: 0 auto 8px; opacity: .85; }

/* ---------- song list ---------- */
.list-head { position: sticky; top: var(--bar-h); z-index: 30; background: linear-gradient(var(--paper) 85%, rgba(251, 247, 238, 0)); padding: 28px clamp(16px, 4vw, 40px) 14px; max-width: 1000px; margin: 0 auto; }
.list-head h1 { font-size: clamp(36px, 5vw, 52px); margin-bottom: 18px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 2px 4px; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); mask-image: linear-gradient(90deg, #000 92%, transparent); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--ink-2); transition: all .2s; }
.chip:hover { border-color: var(--gold); }
.chip[aria-selected="true"] { background: var(--ink); color: #fff8e8; border-color: var(--ink); }
.chip .n { opacity: .55; margin-left: 4px; font-weight: 500; }
.result-count { max-width: 1000px; margin: 4px auto 0; padding: 0 clamp(16px, 4vw, 40px); color: var(--muted); font-size: 14px; min-height: 22px; }

.song-list { max-width: 1000px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 40px; }
.group { margin-top: 26px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 14px 4px 10px; border-bottom: 1px solid var(--line); }
.group-head h2 { font-size: 26px; }
.group-head .g-he { font: 500 20px/1 var(--hebrew); color: var(--gold-deep); direction: rtl; }
.rows { list-style: none; margin: 0; padding: 0; }
.row a {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 10px; border-bottom: 1px solid rgba(232, 222, 201, .6);
  text-decoration: none; border-radius: 10px;
  transition: background .15s;
}
.row a:hover { background: var(--card); }
.num {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font: 700 17px/1 var(--serif); color: var(--gold-deep); border: 1px solid #e5d3a8; background: #fffaf0;
}
.num.top { background: var(--gold-grad); background-size: 200% 100%; color: #3a2706; border-color: transparent; }
.num.pg { font: 600 11px/1.1 var(--sans); color: var(--muted); border-style: dashed; text-align: center; }
.row-main { min-width: 0; }
.row-tr, .row-en { display: block; }
.row-tr { font-weight: 600; font-size: 16px; line-height: 1.3; }
.row-en { font-size: 13px; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.row-he { font: 500 20px/1.3 var(--hebrew); direction: rtl; text-align: right; color: var(--ink); white-space: nowrap; }
.row-fa { font: 500 17px/1.3 system-ui, sans-serif; direction: rtl; color: var(--ink-2); }
mark { background: linear-gradient(transparent 55%, var(--gold-soft) 55%); color: inherit; padding: 0 1px; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-he { font: 500 30px/1.3 var(--hebrew); color: var(--ink-2); margin: 0 0 6px; }

/* ---------- single song ---------- */
#view-song { padding-bottom: 40px; }
.song-bar { position: sticky; top: var(--bar-h); z-index: 30; max-width: 980px; margin: 0 auto; padding: 10px clamp(12px, 3vw, 28px); display: flex; justify-content: space-between; align-items: center; background: rgba(251, 247, 238, .9); backdrop-filter: blur(10px); }
.crumb { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--ink-2); padding: 8px 10px 8px 4px; border-radius: 8px; }
.crumb:hover { color: var(--ink); }
.song-tools { display: flex; gap: 8px; }
.song { max-width: 980px; margin: 0 auto; padding: 0 clamp(12px, 3vw, 28px); }
.song-head { text-align: center; padding: 18px 0 26px; }
.song-kicker { font: 700 12px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--gold-deep); margin: 0 0 16px; }
.song-he { font: 500 clamp(36px, 6vw, 60px)/1.15 var(--hebrew); margin: 0; }
.song-he:empty { display: none; }
.song-tr { font: 600 clamp(24px, 3.4vw, 34px)/1.2 var(--serif); margin: 8px 0 0; }
.song-he:empty + .song-tr { font-size: clamp(34px, 5vw, 54px); }
.song-en { color: var(--muted); margin: 6px 0 0; font-size: 15px; }
.song-en:empty { display: none; }
.sheet {
  --zoom: 1;
  display: flex; flex-direction: column; align-items: center; gap: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: var(--shadow);
  padding: clamp(14px, 3vw, 36px) clamp(8px, 2vw, 28px);
  overflow-x: auto;
  position: relative;
}
.sheet::before { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(184, 134, 43, .28); border-radius: 3px; pointer-events: none; }
.sheet img {
  width: min(calc(var(--pw) * 2.4px * var(--zoom)), calc(100% * var(--zoom)));
  max-width: none; height: auto;
}
.sheet.zoomed { align-items: flex-start; }
/* formatted lyrics */
.reading-controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 10px; margin: 0 auto 22px; }
.seg { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.seg button:first-child { font-family: var(--hebrew); font-size: 15px; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.pick[hidden] { display: none; }
.pick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.pick select { font: 600 14px var(--sans); color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; cursor: pointer; }
.tog { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--ink-2); transition: all .2s; }
.tog:hover { border-color: var(--gold); }
.tog[aria-pressed="true"] { background: var(--ink); color: #fff8e8; border-color: var(--ink); }

.lyrics {
  --fs: 1;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 56px) clamp(18px, 5vw, 64px);
  position: relative; text-align: center;
}
.lyrics::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(184, 134, 43, .22); border-radius: 12px; pointer-events: none; }
.stanza { margin: 0 auto; max-width: 46em; }
.stanza + .stanza { margin-top: calc(1em * var(--fs)); padding-top: calc(1em * var(--fs)); position: relative; }
.stanza + .stanza::before { content: "✦"; position: absolute; top: -.55em; left: 50%; translate: -50% 0; font-size: 12px; color: var(--gold); opacity: .7; }
.ln { margin: 0 0 calc(.3em * var(--fs)); }
.ln p { margin: 0; }
.ln .he { font: 400 calc(25px * var(--fs))/1.5 var(--hebrew); color: var(--ink); }
.ln .he b { font-weight: 700; color: var(--gold-deep); }
.ln-bold .he { font-weight: 700; }
.ln .tr { font: italic 500 calc(19px * var(--fs))/1.3 var(--serif); color: #6d5a3a; }
.ln .en { font: 400 calc(15px * var(--fs))/1.45 var(--sans); color: var(--ink-2); display: none; }

/* Hebrew on the right, English on the left */
.side .ln .en { display: block; }
.side-lines .stanza { max-width: none; }
.side-lines .ln { display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "en he" "en tr"; column-gap: clamp(20px, 4vw, 48px); align-items: center; text-align: left; }
.side-lines .ln .he { grid-area: he; text-align: right; }
.side-lines .ln .tr { grid-area: tr; text-align: right; }
.side-lines .ln .en { grid-area: en; }
.side-lines .ln-latin { display: block; text-align: center; }
.side-lines .ln-latin.ln-pair { display: grid; grid-template-areas: "en txt"; }
.side-lines .ln-pair .txt { grid-area: txt; text-align: right; }
.side-block { display: grid; grid-template-columns: 1fr 1fr; column-gap: clamp(20px, 4vw, 48px); align-items: start; }
.side-block .col-he { grid-column: 2; grid-row: 1; text-align: right; }
.side-block .col-he .stanza { max-width: none; }
.side-block .col-en { grid-column: 1; grid-row: 1; text-align: left; font: 400 calc(15px * var(--fs))/1.6 var(--sans); color: var(--ink-2); border-right: 1px solid var(--line); padding-right: clamp(16px, 3vw, 40px); }
.side-block .col-en p { margin: 0 0 1em; }
.side .stanza + .stanza::before { display: none; }
.ln .txt { font: 500 calc(19px * var(--fs))/1.4 var(--serif); }
.ln-note .he, .ln-note .txt { font-size: calc(15px * var(--fs)); color: var(--muted); font-family: var(--sans); font-weight: 600; letter-spacing: .02em; }
.ln-note .tr { font-size: calc(14px * var(--fs)); }
.mode-he .tr { display: none; }
.mode-tr .he { display: none; }
.mode-tr .tr { font-size: calc(23px * var(--fs)); color: var(--ink); line-height: 1.4; }
.mode-tr .ln-note .he { display: block; }
.lyrics.prose { text-align: justify; }
.lyrics.prose .he { text-align: justify; text-align-last: right; }
.lyrics.prose .tr, .lyrics.prose .en { text-align: left; }
.lyrics.prose .ln { margin-bottom: calc(.6em * var(--fs)); }
.lyrics .loading, .lyrics .empty { color: var(--muted); text-align: center; margin: 40px 0; }

.printed { margin-top: 18px; }
.extras { display: grid; gap: 16px; margin-top: 22px; }
.extra { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px clamp(18px, 4vw, 32px); }
.extra h3 { font: 700 12px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--gold-deep); margin: 0 0 14px; }
.extra p { color: var(--ink-2); margin: 0 0 10px; line-height: 1.65; }
.extra-info p { font-size: 15px; }
.track { display: grid; gap: 6px; margin-bottom: 14px; }
.track span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.track audio { width: 100%; height: 40px; }
.videos { display: grid; gap: 14px; }
.videos-many { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.yt, .yt-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 14px; overflow: hidden; display: block; background: #000; }
.yt { padding: 0; cursor: pointer; box-shadow: 0 14px 30px -16px rgba(40, 25, 5, .55); }
.yt img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease), filter .3s; }
.yt::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, .35)); }
.yt:hover img { transform: scale(1.03); filter: brightness(.9); }
.yt-play { position: absolute; z-index: 1; left: 50%; top: 50%; translate: -50% -50%; width: 68px; height: 68px; border-radius: 50%;
  display: grid; place-items: center; background: var(--gold-grad); background-size: 200% 100%; color: #2b1d05;
  box-shadow: 0 10px 26px -6px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .5); transition: transform .25s var(--ease); }
.yt-play svg { width: 28px; height: 28px; fill: currentColor; stroke: none; margin-left: 3px; }
.yt:hover .yt-play { transform: scale(1.08); }
.withheld { text-align: center; padding: 10px 0; }
.withheld-he { font: 500 calc(28px * var(--fs)) var(--hebrew); color: var(--ink); margin: 0 0 14px; }
.withheld p { color: var(--ink-2); max-width: 36em; margin: 0 auto 8px; }
.withheld-small { font-size: 14px; }
.withheld a, .extra-credits a { color: var(--gold-deep); }
.extra-credits ul { margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--ink-2); }
.extra-credits li { margin-bottom: 6px; line-height: 1.5; }
.extra-credits li span { font-weight: 600; }
.credits-note { font-size: 13px; margin: 10px 0 0 !important; }
.yt-channel { position: absolute; z-index: 1; left: 14px; bottom: 12px; color: #fff; font: 600 13px var(--sans); text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.extra-watch { padding-bottom: clamp(18px, 3vw, 26px); }
.num.lib { color: var(--gold); border-style: solid; background: var(--card); }
.num.lib svg { width: 17px; height: 17px; }
.section-card-lib { background: linear-gradient(140deg, #231d15, #3a2d18); border-color: #3a2d18; color: #f6e9cc; }
.section-card-lib .sc-he, .section-card-lib .sc-en { color: #f6e2b0; }
.section-card-lib .sc-blurb, .section-card-lib .sc-foot { color: #cdb98f; }

/* table mode: big words, nothing else */
body.table-mode .topbar, body.table-mode .song-bar, body.table-mode .song-head, body.table-mode .reading-controls,
body.table-mode .extras, body.table-mode .pager, body.table-mode .song-source, body.table-mode .site-foot, body.table-mode .printed { display: none !important; }
body.table-mode #view-song { padding: 0; }
body.table-mode .song { max-width: none; padding: 0; }
body.table-mode .lyrics { border: 0; border-radius: 0; box-shadow: none; min-height: 100vh; font-size: 130%; --fs: 1.45 !important; padding: 6vh 6vw; }
body.table-mode .lyrics::before { display: none; }
.table-exit { display: none; }
body.table-mode .table-exit { display: grid; position: fixed; top: 14px; right: 14px; z-index: 90; }

.song-source { text-align: center; margin: 18px 0 0; font-size: 14px; }
.song-source a { color: var(--gold-deep); font-weight: 600; text-underline-offset: 3px; }

.pager { max-width: 980px; margin: 30px auto 0; padding: 0 clamp(12px, 3vw, 28px); display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pager-link { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); text-decoration: none; transition: border-color .2s, transform .2s var(--ease); min-height: 84px; }
.pager-link:hover { border-color: var(--gold); transform: translateY(-2px); }
.pager-link:empty { visibility: hidden; }
.pager-next { text-align: right; align-items: flex-end; }
.pager-link small { font: 700 11px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.pager-link .p-tr { font-weight: 600; }
.pager-link .p-he { font: 500 18px/1.2 var(--hebrew); color: var(--ink-2); }

/* slide-in when changing songs */
.song.enter-next { animation: in-next .45s var(--ease); }
.song.enter-prev { animation: in-prev .45s var(--ease); }
@keyframes in-next { from { opacity: 0; transform: translateX(28px); } }
@keyframes in-prev { from { opacity: 0; transform: translateX(-28px); } }

/* ---------- flipbook ---------- */
body.reading { background: var(--night); color: #f3e9d4; }
body.reading .topbar { background: rgba(23, 19, 14, .78); border-bottom-color: rgba(255, 255, 255, .06); }
body.reading .brand-script { filter: invert(1) sepia(.5) saturate(2) hue-rotate(5deg) brightness(1.1); }
body.reading .topnav a:not(.btn) { color: #cdbf9f; }
body.reading .topnav a.active { color: #fff3d6; }
body.reading .site-foot { display: none; }

#view-book { height: calc(100vh - var(--bar-h)); height: calc(100dvh - var(--bar-h)); }
.reader {
  height: 100%; display: flex; flex-direction: column;
  background:
    radial-gradient(1200px 600px at 50% 40%, rgba(214, 170, 80, .16), transparent 70%),
    radial-gradient(800px 400px at 50% 110%, rgba(214, 170, 80, .10), transparent 70%),
    var(--night);
}
.stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 18px clamp(56px, 7vw, 100px) 6px; }
.flip-btn {
  position: absolute; top: 50%; translate: 0 -50%; z-index: 5;
  width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(241, 215, 143, .35);
  background: rgba(34, 28, 21, .7); color: #f1d78f; cursor: pointer; display: grid; place-items: center;
  transition: background .2s, transform .2s var(--ease), opacity .2s;
  backdrop-filter: blur(6px);
}
.flip-btn:hover { background: rgba(60, 46, 26, .9); transform: scale(1.06); }
.flip-btn:disabled { opacity: .2; cursor: default; transform: none; }
.flip-prev { left: clamp(8px, 2vw, 28px); }
.flip-next { right: clamp(8px, 2vw, 28px); }
.flip-btn svg { width: 24px; height: 24px; }

.book-wrap { width: 100%; height: 100%; display: grid; place-items: center; perspective: 2600px; }
.book {
  --pw: 300px;
  position: relative; display: grid; grid-template-columns: var(--pw) var(--pw);
  height: calc(var(--pw) * 612 / 396);
  transform-style: preserve-3d;
  transition: transform .7s var(--ease);
}
.book.rtl { transform: scaleX(-1); }
.book.rtl img { transform: scaleX(-1); }
.book.only-r { transform: translateX(calc(var(--pw) / -2)); }
.book.only-l { transform: translateX(calc(var(--pw) / 2)); }
.book.rtl.only-r { transform: scaleX(-1) translateX(calc(var(--pw) / -2)); }
.book.rtl.only-l { transform: scaleX(-1) translateX(calc(var(--pw) / 2)); }
.slot { position: relative; width: var(--pw); height: 100%; cursor: pointer; }
.slot img { width: 100%; height: 100%; object-fit: cover; background: #fff; user-select: none; -webkit-user-drag: none; }
.slot.empty img { visibility: hidden; }
.slot-l img { box-shadow: -18px 24px 50px -20px rgba(0, 0, 0, .7); border-radius: 4px 0 0 4px; }
.slot-r img { box-shadow: 18px 24px 50px -20px rgba(0, 0, 0, .7); border-radius: 0 4px 4px 0; }
.slot-l::after, .slot-r::after { content: ""; position: absolute; top: 0; bottom: 0; width: 18%; pointer-events: none; }
.slot-l::after { right: 0; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .14) 85%, rgba(0, 0, 0, .22)); }
.slot-r::after { left: 0; background: linear-gradient(270deg, transparent, rgba(0, 0, 0, .10) 85%, rgba(0, 0, 0, .2)); }
.slot.empty::after { display: none; }
.spine { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; translate: -1px 0; background: rgba(0, 0, 0, .18); pointer-events: none; }
.book.only-r .spine, .book.only-l .spine { display: none; }

.leaf {
  position: absolute; top: 0; width: var(--pw); height: 100%;
  transform-style: preserve-3d; z-index: 3; pointer-events: none;
  transition: transform .8s cubic-bezier(.45, .05, .25, 1);
}
.leaf.fwd { left: var(--pw); transform-origin: left center; }
.leaf.back { left: 0; transform-origin: right center; }
.leaf .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; background: #fff; }
.leaf .face img { width: 100%; height: 100%; object-fit: cover; }
.leaf .face-back { transform: rotateY(180deg); }
.leaf .face::after { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .8s; }
.leaf.fwd .face-front::after { background: linear-gradient(90deg, rgba(0, 0, 0, .35), transparent 60%); }
.leaf.fwd .face-back::after { background: linear-gradient(270deg, rgba(0, 0, 0, .3), transparent 60%); }
.leaf.back .face-front::after { background: linear-gradient(270deg, rgba(0, 0, 0, .35), transparent 60%); }
.leaf.back .face-back::after { background: linear-gradient(90deg, rgba(0, 0, 0, .3), transparent 60%); }
.leaf.turning .face::after { opacity: 1; }
.leaf.fwd.turning { transform: rotateY(-180deg); }
.leaf.back.turning { transform: rotateY(180deg); }

/* single-page swipe mode */
.strip { display: none; }
.single .book-wrap { display: none; }
.single .strip {
  display: flex; width: 100%; height: 100%; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
}
.single .strip::-webkit-scrollbar { display: none; }
.single .stage { padding: 12px 0 4px; }
.single .flip-btn { display: none; }
.strip-page { flex: 0 0 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; display: flex; align-items: center; justify-content: center; padding: 0 14px; }
.strip-page img { width: auto; height: auto; max-width: 100%; max-height: 100%; background: #fff; border-radius: 3px; box-shadow: 0 20px 50px -18px rgba(0, 0, 0, .8); }

.on-page { min-height: 46px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; padding: 6px 16px 0; }
.on-page a { font-size: 13px; font-weight: 600; text-decoration: none; color: #f1dfb6; border: 1px solid rgba(241, 215, 143, .25); background: rgba(255, 240, 200, .05); border-radius: 999px; padding: 6px 12px; transition: background .2s, border-color .2s; white-space: nowrap; }
.on-page a:hover { background: rgba(255, 240, 200, .12); border-color: rgba(241, 215, 143, .6); }
.on-page .lbl { font: 700 10px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: #9c8a68; margin-right: 4px; }

.reader-bar {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center;
  padding: 10px clamp(12px, 3vw, 28px) calc(10px + env(safe-area-inset-bottom));
}
.rbtn { display: inline-flex; align-items: center; gap: 8px; background: rgba(255, 240, 200, .06); border: 1px solid rgba(241, 215, 143, .2); color: #f1dfb6; border-radius: 999px; padding: 9px 14px; cursor: pointer; font-weight: 600; font-size: 14px; transition: background .2s; }
.rbtn:hover { background: rgba(255, 240, 200, .14); }
.rbtn svg { width: 18px; height: 18px; }
.scrub { display: flex; align-items: center; gap: 14px; padding: 0 10px; min-width: 0; }
.scrub-label { font: 600 18px/1 var(--serif); color: #f6e7c4; white-space: nowrap; min-width: 92px; text-align: center; }
#scrub { flex: 1; min-width: 60px; accent-color: #d9b15a; height: 24px; }

/* ---------- drawer & overlays ---------- */
.drawer { position: fixed; inset: 0; z-index: 60; background: rgba(10, 8, 5, .5); backdrop-filter: blur(2px); display: flex; animation: fade .25s; }
.drawer-panel { width: min(440px, 92vw); height: 100%; background: var(--paper); color: var(--ink); display: flex; flex-direction: column; box-shadow: 20px 0 60px rgba(0, 0, 0, .35); animation: slide-in .35s var(--ease); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 10px; }
.drawer-head h2 { font-size: 32px; }
.search-drawer { margin: 0 20px 10px; }
.search-drawer input { padding: 12px 0; }
.drawer-body { overflow-y: auto; padding: 0 12px 30px; }
.drawer-body h3 { font: 700 11px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--gold-deep); margin: 22px 10px 8px; }
.drawer-body a { display: grid; grid-template-columns: 1fr auto 34px; gap: 10px; align-items: baseline; padding: 9px 10px; border-radius: 8px; text-decoration: none; }
.drawer-body a:hover { background: var(--paper-2); }
.drawer-body .d-tr { font-weight: 600; font-size: 14px; }
.drawer-body .d-he { font: 500 16px/1.2 var(--hebrew); direction: rtl; color: var(--ink-2); }
.drawer-body .d-pg { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
@keyframes slide-in { from { transform: translateX(-100%); } }
@keyframes fade { from { opacity: 0; } }

.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(15, 12, 8, .96); color: #f3e9d4; display: flex; flex-direction: column; animation: fade .25s; }
.overlay-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; }
.overlay-head h2 { font-size: 28px; }
.overlay .icon-btn { border-color: rgba(241, 215, 143, .3); }
.overlay .icon-btn:hover { background: rgba(255, 240, 200, .1); }
.grid { overflow-y: auto; padding: 8px 20px 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 18px; }
.grid a { text-decoration: none; display: grid; gap: 6px; text-align: center; font-size: 12px; font-weight: 600; color: #cdbf9f; }
.grid img { width: 100%; aspect-ratio: 396 / 612; object-fit: cover; border-radius: 3px; background: #fff; box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .8); transition: transform .2s var(--ease), outline-color .2s; outline: 2px solid transparent; outline-offset: 3px; }
.grid a:hover img { transform: translateY(-3px); }
.grid a.current img { outline-color: #d9b15a; }
.zoom-body { flex: 1; overflow: auto; display: flex; gap: 16px; justify-content: safe center; align-items: flex-start; padding: 0 16px 40px; touch-action: pan-x pan-y pinch-zoom; }
.zoom-body img { width: min(1100px, 100%); height: auto; background: #fff; border-radius: 3px; cursor: zoom-in; }
.zoom-body.big img { width: 1600px; max-width: none; cursor: zoom-out; }
.zoom-body.pair img { width: min(800px, 48%); }
.zoom-body.pair.big img { width: 1300px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); translate: -50% 0; z-index: 80; background: var(--ink); color: #fff8e8; padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); animation: fade .2s; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; text-align: left; }
  .cover3d { order: -1; }
  .book3d { width: min(220px, 52vw); }
  .cover-hint { display: none; }
  .about { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --bar-h: 58px; }
  .brand-word { display: none; }
  .brand-script { height: 30px; }
  .topnav { gap: 14px; }
  .topnav a:not(.btn) { font-size: 14px; }
  .hero-inner { padding-top: 20px; }
  .hero-logo { display: none; }
  .book3d { width: min(200px, 50vw); }
  .hero-lede { font-size: 19px; text-align: center; margin-inline: auto; }
  .hero-actions { justify-content: center; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .search kbd { display: none; }
  .row a { grid-template-columns: 44px 1fr; grid-template-areas: "n main" "n he"; row-gap: 2px; }
  .row .num { grid-area: n; width: 36px; height: 36px; font-size: 15px; }
  .row-main { grid-area: main; }
  .row-he, .row-fa { grid-area: he; text-align: left; font-size: 18px; white-space: normal; }
  .reader-bar { grid-template-columns: auto 1fr auto; }
  .reader-bar #open-zoom { display: none; }
  .rbtn span { display: none; }
  .rbtn { padding: 10px; }
  .scrub-label { min-width: 70px; font-size: 16px; }
  .pager { grid-template-columns: 1fr 1fr; }
  .pager-link { padding: 12px 14px; min-height: 0; }
  .pager-link .p-he { font-size: 15px; }
  .ln .he { font-size: calc(21px * var(--fs)); }
  .ln .tr { font-size: calc(17px * var(--fs)); }
  .lyrics { border-radius: 14px; }
  .reading-controls { gap: 8px; }
  .pick span { display: none; }
  /* phones: controls on one swipeable row, more room for the words */
  .reading-controls { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none;
    margin: 0 -12px 16px; padding: 2px 12px; -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
  .reading-controls::-webkit-scrollbar { display: none; }
  .reading-controls > * { flex: none; }
  .seg button { padding: 7px 11px; font-size: 13px; }
  .tog, .pick select { padding: 7px 12px; font-size: 13px; }
  .lyrics { padding: 22px 14px 26px; border-radius: 14px; }
  .lyrics::before { inset: 5px; border-radius: 10px; }
  .song-head { padding: 6px 0 16px; }
  .song-kicker { margin-bottom: 10px; font-size: 11px; }
  .extra { padding: 18px 16px; border-radius: 14px; }
  .extra-watch { padding: 16px 0 0; background: transparent; border: 0; }
  .extra-watch h3 { padding: 0 4px; }
  .yt, .yt-frame { border-radius: 12px; }
  .yt-play { width: 58px; height: 58px; }
  .videos-many { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 86%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .videos-many > * { scroll-snap-align: start; }
  .song-bar { padding: 6px 12px; }
  .icon-btn { width: 38px; height: 38px; }
  .ln .en { line-height: 1.4; }
  /* phones: translation sits under each line instead of beside it */
  .side-lines .ln { display: block; text-align: center; }
  .side-lines .ln .he, .side-lines .ln .tr, .side-lines .ln-pair .txt { text-align: center; }
  .side-lines .ln-latin.ln-pair { display: block; }
  .side-lines .ln .en { margin: 2px 0 4px; font-size: calc(14px * var(--fs)); color: var(--muted); }
  .side-block { display: block; }
  .side-block .col-en { border-right: 0; padding: 18px 0 0; margin-top: 18px; border-top: 1px solid var(--line); }
  .list-head { padding-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .book3d { animation: none; }
}
@media print {
  .topbar, .song-bar, .pager, .song-source, .site-foot { display: none !important; }
  .sheet { box-shadow: none; border: 0; }
}
