:root {
  --bg: #0b111c;
  --bg-soft: #121b2a;
  --paper: #f7f1e6;
  --paper-2: #fbf7ef;
  --ink: #171514;
  --ink-soft: #48413b;
  --muted: #d8c7a3;
  --gold: #caa261;
  --gold-2: #efd28e;
  --line: rgba(202, 162, 97, .28);
  --shadow: 0 26px 90px rgba(0, 0, 0, .38);
  --reader-scale: 1;
  --radius: 24px;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", Times, serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { margin: 0; min-height: 100%; background: var(--bg); color: var(--paper); font-family: var(--sans); text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; height: auto; }
button, input { font: inherit; }
:focus-visible { outline: 3px solid var(--gold-2); outline-offset: 4px; }
.home-page { overflow: hidden; min-height: 100dvh; }
.home-shell { min-height: 100dvh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) clamp(18px, 5vw, 72px) max(24px, env(safe-area-inset-bottom)); isolation: isolate; }
.home-backdrop { position: fixed; inset: 0; z-index: -2; background: linear-gradient(rgba(6, 10, 18, .48), rgba(6, 10, 18, .77)), url('/assets/images/home-hero.jpg') center / cover no-repeat fixed; transform: translateZ(0); }
.home-shell::after { content: ""; position: fixed; inset: 0; z-index: -1; background: radial-gradient(circle at 50% 38%, rgba(239, 210, 142, .16), transparent 34%), linear-gradient(90deg, rgba(0,0,0,.48), rgba(0,0,0,.14), rgba(0,0,0,.48)); pointer-events: none; }
.home-card { width: min(760px, 100%); padding: clamp(26px, 6vw, 64px); text-align: center; border: 1px solid rgba(239, 210, 142, .24); border-radius: clamp(24px, 4vw, 42px); background: linear-gradient(145deg, rgba(10, 17, 29, .72), rgba(10, 17, 29, .46)); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.home-eyebrow, .chapter-kicker, .menu-kicker { margin: 0 0 12px; color: var(--gold-2); font-size: clamp(.76rem, .72rem + .18vw, .92rem); letter-spacing: .18em; text-transform: uppercase; font-weight: 700; }
.home-card h1 { margin: 0; font-family: var(--serif); font-size: clamp(3.15rem, 12vw, 8.25rem); line-height: .88; letter-spacing: -.06em; }
.home-subtitle { margin: clamp(18px, 3vw, 32px) auto 0; max-width: 21ch; font-family: var(--serif); font-size: clamp(1.28rem, 3.2vw, 2.35rem); line-height: 1.12; color: var(--paper-2); }
.home-tagline { margin: 18px auto 0; max-width: 34ch; color: rgba(247, 241, 230, .82); font-size: clamp(.98rem, 1.8vw, 1.22rem); line-height: 1.55; }
.home-author { margin: clamp(22px, 4vw, 36px) 0 0; color: var(--gold-2); font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; margin-top: clamp(24px, 4vw, 42px); min-height: 54px; padding: 0 28px; border: 1px solid rgba(239, 210, 142, .55); border-radius: 999px; color: #16110a; background: linear-gradient(135deg, #ffe1a0, #caa261); box-shadow: 0 14px 42px rgba(0,0,0,.32); font-weight: 800; letter-spacing: .035em; transition: transform .2s ease, box-shadow .2s ease, filter .2s ease; }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 18px 50px rgba(0,0,0,.4); filter: brightness(1.04); }
.menu-toggle { position: fixed; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); z-index: 80; display: grid; gap: 5px; width: 48px; height: 48px; padding: 13px; border: 1px solid rgba(239, 210, 142, .4); border-radius: 16px; background: rgba(8, 13, 22, .72); color: var(--paper); box-shadow: 0 12px 34px rgba(0,0,0,.28); backdrop-filter: blur(12px); cursor: pointer; }
.menu-toggle span { display: block; height: 2px; border-radius: 2px; background: currentColor; transform-origin: center; transition: transform .2s ease, opacity .2s ease; }
.menu-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.is-open span:nth-child(2) { opacity: 0; }
.menu-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.menu-scrim { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.5); backdrop-filter: blur(2px); }
.site-menu { position: fixed; inset: 0 0 0 auto; z-index: 75; width: min(92vw, 430px); transform: translateX(105%); transition: transform .28s ease; pointer-events: none; }
.site-menu.is-open { transform: translateX(0); pointer-events: auto; }
.menu-panel { height: 100%; overflow-y: auto; padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(12, 18, 29, .98), rgba(19, 29, 44, .98)); border-left: 1px solid rgba(239,210,142,.2); box-shadow: -20px 0 70px rgba(0,0,0,.42); }
.menu-panel-head { position: relative; padding: 0 56px 20px 4px; border-bottom: 1px solid rgba(239,210,142,.16); }
.menu-title { margin: 0; font-family: var(--serif); font-size: 1.75rem; line-height: 1.05; }
.menu-close { position: absolute; top: 2px; right: 0; width: 42px; height: 42px; border: 1px solid rgba(239,210,142,.24); border-radius: 14px; background: rgba(255,255,255,.05); color: var(--paper); font-size: 1.7rem; line-height: 1; cursor: pointer; }
.menu-home, .menu-chapter { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 13px 12px; border: 1px solid rgba(239,210,142,.13); border-radius: 16px; background: rgba(255,255,255,.035); transition: background .2s ease, border-color .2s ease, transform .2s ease; }
.menu-home:hover, .menu-chapter:hover { background: rgba(239,210,142,.1); border-color: rgba(239,210,142,.34); transform: translateX(-2px); }
.menu-chapters { margin-top: 16px; }
.menu-chapter { align-items: flex-start; font-size: .95rem; line-height: 1.25; }
.menu-chapter-number { flex: 0 0 auto; min-width: 2.2em; color: var(--gold-2); font-weight: 800; letter-spacing: .08em; }
.menu-chapter.is-current { border-color: rgba(239,210,142,.62); background: rgba(239,210,142,.14); }
.topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 35; min-height: 80px; padding: max(18px, env(safe-area-inset-top)) 86px 18px max(18px, env(safe-area-inset-left)); pointer-events: none; }
.brand { pointer-events: auto; display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; border: 1px solid rgba(239,210,142,.26); border-radius: 999px; background: rgba(7, 12, 22, .55); backdrop-filter: blur(12px); font-family: var(--serif); color: var(--paper-2); }
.page { background: linear-gradient(180deg, #0b111c 0, #111827 46%, #0b111c 100%); }
.chapter-hero, .contents-hero { min-height: min(68dvh, 720px); display: grid; place-items: end center; padding: 112px clamp(18px, 5vw, 72px) clamp(44px, 8vw, 92px); position: relative; overflow: hidden; isolation: isolate; }
.chapter-hero::before, .contents-hero-media { content: ""; position: absolute; inset: 0; z-index: -2; background: var(--hero-image, url('/assets/images/contents-hero.jpg')) center / cover no-repeat; transform: scale(1.02); }
.chapter-hero::after, .contents-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 50% 38%, rgba(239,210,142,.2), transparent 34%), linear-gradient(180deg, rgba(8,13,22,.22), rgba(8,13,22,.86)); }
.chapter-hero-inner, .contents-hero-inner { width: min(980px, 100%); text-align: center; }
.chapter-hero h1, .contents-hero h1 { margin: 0; font-family: var(--serif); font-size: clamp(2.25rem, 7vw, 5.4rem); line-height: .98; letter-spacing: -.045em; text-wrap: balance; }
.chapter-subline, .contents-hero p { margin: 18px auto 0; max-width: 60ch; color: rgba(247,241,230,.84); font-size: clamp(1rem, 1.7vw, 1.22rem); line-height: 1.55; }
.contents-hero { min-height: min(58dvh, 620px); }
.contents-hero-media { background-image: url('/assets/images/contents-hero.jpg'); }
.chapter-search { display: grid; gap: 8px; width: min(560px, 100%); margin: 28px auto 0; color: rgba(247,241,230,.86); text-align: left; }
.chapter-search span { font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-2); font-weight: 800; }
.chapter-search input { width: 100%; min-height: 54px; border: 1px solid rgba(239,210,142,.28); border-radius: 18px; background: rgba(7,12,22,.58); color: var(--paper); padding: 0 18px; box-shadow: 0 14px 40px rgba(0,0,0,.24); }
.toc-grid { width: min(1180px, calc(100% - 36px)); margin: -34px auto 64px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: 16px; position: relative; z-index: 3; }
.toc-card { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; min-height: 172px; padding: 22px; border: 1px solid rgba(202,162,97,.22); border-radius: var(--radius); background: linear-gradient(145deg, rgba(248,241,229,.98), rgba(236,224,203,.96)); color: var(--ink); box-shadow: 0 16px 50px rgba(0,0,0,.20); transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.toc-card:hover { transform: translateY(-4px); border-color: rgba(202,162,97,.55); box-shadow: 0 24px 66px rgba(0,0,0,.28); }
.toc-number { grid-row: 1 / span 2; color: #8c6631; font-weight: 900; letter-spacing: .06em; font-size: 1.05rem; }
.toc-title { font-family: var(--serif); font-size: clamp(1.1rem, 1.3vw, 1.42rem); line-height: 1.12; font-weight: 800; }
.toc-desc { grid-column: 2; color: var(--ink-soft); font-size: .96rem; line-height: 1.55; }
.toc-card.is-hidden { display: none; }
.reader { --reader-scale: 1; width: min(100%, 980px); margin: -32px auto 0; padding: clamp(28px, 4vw, 54px) clamp(18px, 5vw, 72px) 72px; background: linear-gradient(180deg, var(--paper-2), var(--paper)); color: var(--ink); border-radius: clamp(22px, 4vw, 40px) clamp(22px, 4vw, 40px) 0 0; box-shadow: 0 -24px 70px rgba(0,0,0,.22); position: relative; z-index: 5; }
.reader-tools { position: sticky; top: 12px; z-index: 10; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 0 0 28px; }
.reader-tools a, .reader-tools button { min-height: 40px; border: 1px solid rgba(77,57,31,.18); border-radius: 999px; background: rgba(255,255,255,.72); color: #45351f; padding: 0 14px; font-weight: 700; cursor: pointer; box-shadow: 0 8px 18px rgba(0,0,0,.08); }
.book-paragraph { margin: 0 auto 1.08em; max-width: 72ch; font-family: var(--serif); font-size: calc(clamp(1.08rem, 1rem + .45vw, 1.34rem) * var(--reader-scale)); line-height: 1.74; letter-spacing: .002em; }
.book-paragraph.short-line { max-width: 52ch; font-size: calc(clamp(1.12rem, 1.02rem + .55vw, 1.45rem) * var(--reader-scale)); line-height: 1.45; font-weight: 700; color: #2c241a; }
.book-paragraph.hebrew-only { direction: rtl; text-align: center; font-size: calc(clamp(1.55rem, 2vw, 2.2rem) * var(--reader-scale)); line-height: 1.35; color: #765726; }
.book-paragraph.contains-hebrew { word-spacing: .02em; }
.share-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; max-width: 72ch; margin: 46px auto 26px; padding-top: 28px; border-top: 1px solid rgba(77,57,31,.16); }
.share-label { color: #765726; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; font-size: .78rem; }
.share-button { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px; border: 1px solid rgba(77,57,31,.18); border-radius: 999px; background: #fffaf0; color: #312414; font-weight: 800; cursor: pointer; }
.share-button img { width: 18px; height: 18px; }
.chapter-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 940px; margin: 24px auto 0; }
.chapter-nav-card { min-height: 108px; display: grid; align-content: center; gap: 8px; padding: 20px; border: 1px solid rgba(77,57,31,.16); border-radius: 22px; background: linear-gradient(135deg, #fffaf0, #efe1c6); color: var(--ink); }
.chapter-nav-card span { color: #846335; font-size: .78rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.chapter-nav-card strong { font-family: var(--serif); font-size: clamp(1rem, 1.2vw, 1.22rem); line-height: 1.18; }
.chapter-nav-card.next { text-align: right; }
.contents-share-wrap { width: min(980px, calc(100% - 36px)); margin: 0 auto 64px; color: var(--ink); background: var(--paper); border-radius: 24px; padding: 4px 18px 18px; }
.site-footer { padding: 28px 18px 44px; text-align: center; color: rgba(247,241,230,.68); font-size: .92rem; }
.error-shell { min-height: 100dvh; display: grid; align-content: center; justify-items: center; gap: 18px; padding: 120px 20px; text-align: center; }
.error-shell h1 { font-family: var(--serif); font-size: clamp(2.5rem, 9vw, 5rem); margin: 0; }
.error-shell p { max-width: 52ch; line-height: 1.6; color: rgba(247,241,230,.82); }
@media (min-width: 1280px) {
  .reader { width: min(86vw, 1160px); }
  .book-paragraph { max-width: 76ch; }
}
@media (max-width: 760px) {
  .topbar { min-height: 72px; padding-right: 78px; }
  .brand { max-width: calc(100vw - 104px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chapter-hero, .contents-hero { min-height: 62dvh; padding-top: 104px; }
  .reader { padding-left: 20px; padding-right: 20px; }
  .reader-tools { justify-content: center; }
  .chapter-nav { grid-template-columns: 1fr; }
  .chapter-nav-card.next { text-align: left; }
  .home-card { backdrop-filter: blur(10px); }
  .home-backdrop { background-attachment: scroll; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media print {
  .menu-toggle, .site-menu, .menu-scrim, .topbar, .reader-tools, .share-bar, .chapter-nav, .site-footer { display: none !important; }
  body, .reader { background: #fff; color: #000; box-shadow: none; }
  .chapter-hero { min-height: auto; padding: 0 0 24px; }
  .chapter-hero::before, .chapter-hero::after { display: none; }
  .reader { margin: 0; padding: 0; width: 100%; }
}
