/* לצידך: the rooms. Scenes stack as you scroll, each one a place on the defence side. Light falls on the wall behind the words, never on the letters. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .36s; animation-timing-function: cubic-bezier(.22, .61, .36, 1); }
::view-transition-group(*) { animation-duration: .42s; animation-timing-function: cubic-bezier(.22, .61, .36, 1); }
.top, .bar { view-transition-name: chrome-top; }
.bar { view-transition-name: chrome-bar; }

:root { --head: 88px; --rail: 34px; }
html { scroll-padding-top: calc(var(--head) + var(--rail) + 16px); }

/* the docket rail */
.rail { border-top: 1px solid var(--line-dark); background: rgba(18, 21, 28, .78); font-size: 14.5px; color: var(--soft-dark); }
.rail-in { display: flex; align-items: center; gap: 28px; min-height: var(--rail); }
.rail a b { color: var(--brass); font-weight: 700; }
.rail-rec { display: inline-flex; min-width: 170px; color: var(--cream); font-family: var(--archive); font-size: 16px; overflow: hidden; }
.rail-rec bdi { display: inline-block; }
.rail-rec.flip bdi { animation: rail-flip .22s var(--ease); }
@keyframes rail-flip { from { transform: translateY(70%); opacity: 0; } to { transform: none; opacity: 1; } }
.rail-pos { color: var(--mute-dark); }
.rail-pause { margin-inline-start: auto; font-size: 13.5px; color: var(--mute-dark); min-height: 30px; padding-inline: 6px; }
.rail-pause:hover { color: var(--cream); }

/* the opening room */
.opening { position: relative; min-height: 100svh; display: flex; align-items: flex-end; overflow: hidden; background: var(--ink); }
.home .top { background: rgba(18, 21, 28, .97); border-bottom-color: var(--line-dark); }
.opening .hero-img { position: absolute; inset: calc(var(--head) + var(--rail)) 0 0 0; width: 100%; height: calc(100% - var(--head) - var(--rail)); object-fit: cover; object-position: 38% 12%; }
.opening::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(18, 21, 28, .72) 0, rgba(18, 21, 28, 0) 170px), linear-gradient(270deg, rgba(18, 21, 28, .9) 12%, rgba(18, 21, 28, .55) 40%, rgba(18, 21, 28, 0) 66%), linear-gradient(0deg, rgba(18, 21, 28, .7) 0, rgba(18, 21, 28, 0) 26%); }
.opening .hero-in { position: relative; z-index: 2; padding-block: 170px 64px; }
.opening h1 { max-width: 10.5ch; font-size: clamp(50px, 7vw, 104px); line-height: 1.02; font-weight: 300; }
.mishna { margin-bottom: 18px; font-size: clamp(17px, 1.5vw, 21px); font-weight: 500; color: var(--cream); }
.mishna cite, .verse cite { display: block; margin-top: 2px; font-style: normal; font-size: 14px; font-weight: 400; color: var(--mute-dark); }

/* provenance sits on the picture it belongs to */
.prov { position: absolute; inset: auto auto 14px 14px; z-index: 3; max-width: min(62ch, calc(100% - 28px)); padding: 3px 9px; font-size: 14px; line-height: 1.4; color: var(--cream); background: rgba(18, 21, 28, .84); }
.prov a { text-decoration: underline; text-underline-offset: 2px; margin-inline-start: 4px; }
.prov-in { margin-top: 6px; font-size: 14px; color: var(--mute-dark); }

/* the stack: each scene pins, the next one slides over it */
.stack { position: relative; }
.scene { position: sticky; top: 0; height: 100svh; min-height: 620px; overflow: hidden; display: flex; align-items: flex-end; background: var(--ink); }
.scene > img { position: absolute; inset: calc(var(--head) + var(--rail)) 0 0 0; width: 100%; height: calc(100% - var(--head) - var(--rail)); object-fit: cover; object-position: var(--pos, 50% 20%); }
.clip { position: absolute; inset: calc(var(--head) + var(--rail)) 0 0 0; width: 100%; height: calc(100% - var(--head) - var(--rail)); object-fit: cover; object-position: var(--pos, 38% 12%); opacity: 0; transition: opacity .7s ease-out; }
.clip.on { opacity: 1; }
.scene::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.scene.side-end::before { background: linear-gradient(270deg, rgba(18, 21, 28, .84) 8%, rgba(18, 21, 28, .34) 40%, rgba(18, 21, 28, 0) 62%), linear-gradient(0deg, rgba(18, 21, 28, .5) 0, rgba(18, 21, 28, 0) 30%); }
.scene.side-start::before { background: linear-gradient(90deg, rgba(18, 21, 28, .84) 8%, rgba(18, 21, 28, .34) 40%, rgba(18, 21, 28, 0) 62%), linear-gradient(0deg, rgba(18, 21, 28, .78) 0, rgba(18, 21, 28, .46) 36%, rgba(18, 21, 28, 0) 64%); }
.scene-in { position: relative; z-index: 2; display: flex; padding-block: 96px 76px; }
.side-start .scene-in { justify-content: flex-end; }
.scene.short { position: relative; height: 86svh; }
.glow { position: relative; max-width: min(600px, 46vw); color: var(--cream); }
.glow::before { content: ""; position: absolute; inset: -34% -30%; z-index: -1; background: radial-gradient(closest-side, rgba(255, 244, 222, .1), rgba(255, 244, 222, 0)); }
.kicker { margin-bottom: 8px; font-size: 16px; font-weight: 600; color: var(--brass); }
.glow h2 { font-size: clamp(34px, 4vw, 58px); line-height: 1.08; font-weight: 300; margin-bottom: 12px; text-shadow: 0 1px 22px rgba(18, 21, 28, .7); }
.glow p { color: var(--soft-dark); text-shadow: 0 1px 14px rgba(18, 21, 28, .7); }
.glow .link { color: var(--cream); }

/* the docket board */
.board { position: relative; z-index: 2; padding-block: clamp(64px, 8vw, 104px); background: #0e1016; }
.board-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: end; }
.board-n { font-family: var(--archive); font-size: clamp(88px, 13vw, 190px); line-height: .86; color: var(--brass); font-variant-numeric: tabular-nums; }
.board-cur { min-height: 1.5em; margin-top: 10px; font-family: var(--archive); font-size: 17px; color: var(--soft-dark); opacity: 0; transition: opacity .3s; }
.board.counting .board-cur { opacity: 1; }
.board.counting .wall li { color: rgba(214, 208, 196, .16); border-top-color: rgba(201, 169, 97, .07); }
.board .wall li { transition: color .2s, border-color .2s; }
.board.counting .wall li.on { color: var(--soft-dark); border-top-color: rgba(201, 169, 97, .2); }
.board h2 { font-size: clamp(26px, 2.8vw, 38px); margin-bottom: 8px; }
.board .fine { color: var(--mute-dark); max-width: 66ch; }
.board-groups { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 12px; font-size: 19px; }
.board-groups b { font-weight: 600; }
.wall { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0 20px; margin-top: 32px; font-family: var(--archive); font-size: 16px; color: var(--soft-dark); }
.wall li { padding-block: 6px; border-top: 1px solid rgba(201, 169, 97, .2); white-space: nowrap; overflow: hidden; }
.fact-phone { display: none; }

/* the door to the archive */
.archive-door { position: relative; z-index: 2; padding-block: clamp(64px, 8vw, 104px); background: var(--cream); color: var(--ink); --soft: #2d3240; --mute: var(--mute-light); }
.door-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.sheet { max-width: 340px; padding: 10px; background: #fff; box-shadow: 0 16px 40px -26px rgba(18, 21, 28, .55); }
.sheet.big { max-width: 420px; }
.sheet img { width: 100%; }
.verse { font-family: var(--archive); font-size: clamp(30px, 3.6vw, 48px); line-height: 1.16; color: var(--bordeaux); margin-bottom: 18px; }
.verse cite { color: var(--mute-light); }
.archive-door h2, .ar-head h1 { font-size: clamp(28px, 3vw, 42px); font-weight: 400; margin-bottom: 4px; }
.archive-door .fine, .ar-head .fine { color: var(--bordeaux); font-family: var(--archive); font-size: 18px; margin-bottom: 12px; }
.archive { background: var(--cream); color: var(--ink); --rule: var(--line-light); --soft: #2d3240; --mute: var(--mute-light); }
.ar-head { padding-block: calc(var(--head) + var(--rail) + 40px) 56px; }
.ar-head .crumb { color: var(--mute-light); }
.archive img { filter: none; }

/* room headers */
.room-head { position: relative; min-height: 76svh; display: flex; align-items: flex-end; overflow: hidden; background: var(--ink); }
.room-head > img { position: absolute; inset: calc(var(--head) + var(--rail)) 0 0 0; width: 100%; height: calc(100% - var(--head) - var(--rail)); object-fit: cover; object-position: 40% 18%; }
.room-head::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(18, 21, 28, .7) 0, rgba(18, 21, 28, 0) 170px), linear-gradient(270deg, rgba(18, 21, 28, .88) 14%, rgba(18, 21, 28, .42) 44%, rgba(18, 21, 28, 0) 66%), linear-gradient(0deg, rgba(18, 21, 28, .55) 0, rgba(18, 21, 28, 0) 30%); }
.room-in { position: relative; z-index: 2; padding-block: 170px 64px; }
.room-in h1 { max-width: 14ch; font-size: clamp(42px, 5.6vw, 80px); line-height: 1.04; font-weight: 300; }
.room-in .lead { margin-top: 16px; color: var(--soft-dark); max-width: 40ch; }
.room-in .crumb { color: var(--soft-dark); }

/* the prepared document */
.paper-doc { padding: clamp(24px, 4vw, 44px); background: var(--paper); color: var(--ink); box-shadow: 0 24px 60px -34px rgba(0, 0, 0, .6); }
.paper-doc header { padding-bottom: 14px; border-bottom: 1px solid var(--bordeaux); margin-bottom: 8px; }
.paper-doc header h2 { font-size: clamp(28px, 3vw, 38px); }
.paper-doc header p { color: var(--mute-light); margin-top: 4px; }
.doc-list { counter-reset: d; }
.doc-list li { counter-increment: d; position: relative; padding: 18px 44px 18px 0; border-bottom: 1px solid var(--line-light); }
.doc-list li::before { content: counter(d); position: absolute; inset: 18px 0 auto auto; font-family: var(--archive); font-size: 28px; line-height: 1; color: var(--bordeaux); }
.doc-list h2 { font-size: 23px; margin-bottom: 6px; }
.doc-list p { color: #2d3240; font-size: 17.5px; }
.paper-doc footer { display: flex; justify-content: space-between; gap: 16px; padding-top: 14px; font-size: 15px; color: var(--mute-light); }
.linkish { font-weight: 600; color: var(--bordeaux); text-decoration: underline; min-height: 44px; }

/* station mode */
.now { min-height: 100svh; padding-block: calc(var(--head) + var(--rail) + 32px) 96px; background: var(--ink); }
.now h1 { font-size: clamp(44px, 7vw, 76px); font-weight: 300; }
.now .lead { margin-block: 12px 18px; }
.now ol { counter-reset: n; max-width: 46ch; }
.now li { counter-increment: n; position: relative; padding: 14px 40px 14px 0; border-top: 1px solid var(--line-dark); font-size: 21px; line-height: 1.35; }
.now li::before { content: counter(n); position: absolute; inset: 15px 0 auto auto; font-family: var(--archive); font-size: 24px; color: var(--brass); }
.now-btns { display: grid; gap: 12px; max-width: 420px; margin-block: 24px; }

/* the ledger */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 16px 8px; }
.filters button { min-height: 44px; padding: 0 14px; border: 1px solid var(--line-dark); font-size: 16px; color: var(--soft-dark); }
.filters button span { color: var(--brass); margin-inline-start: 4px; }
.filters button[aria-pressed="true"] { background: var(--brass); color: var(--ink); border-color: var(--brass); }
.filters button[aria-pressed="true"] span { color: var(--ink); }
.ledger-wrap { overflow-x: auto; margin-top: 12px; }
.ledger { width: 100%; border-collapse: collapse; font-size: 17px; }
.ledger th { text-align: right; padding: 8px 12px 8px 0; font-size: 15px; font-weight: 600; color: var(--brass); }
.ledger td { padding: 9px 12px 9px 0; border-top: 1px solid var(--line-dark); white-space: nowrap; }
.ledger tr[hidden] { display: none; }

/* the press wall */
.wall-press { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 14px; }
.wall-press figure { margin: 0; }
.wall-press .w2 { grid-row: span 2; }
.wall-press a { display: block; overflow: hidden; }
.wall-press img { width: 100%; aspect-ratio: 16 / 11; object-fit: cover; object-position: 50% 22%; transition: transform .4s var(--ease); }
.wall-press .w2 img { aspect-ratio: auto; height: calc(100% - 28px); min-height: 320px; }
.wall-press a:hover img { transform: scale(1.02); }
.wall-press figcaption { margin-top: 6px; font-size: 15px; color: var(--soft-dark); }
.wall-press b { font-weight: 600; color: var(--cream); }

/* the file lands */
.op { position: fixed; inset: 0; z-index: 25; overflow: hidden; background: #0a0b0f; }
.op img { position: absolute; }
.op-table { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.op-file { left: 50%; top: 50%; width: min(64vw, 980px); transform: translate(-50%, -190%) scale(1.14) rotate(-1.6deg); will-change: transform; }
.op.drop .op-file { animation: op-drop .46s cubic-bezier(.5, 0, .9, .55) forwards; }
.op.hit { animation: op-shake .16s linear; }
@keyframes op-drop { to { transform: translate(-50%, -38%) scale(1) rotate(0deg); } }
@keyframes op-shake { 25% { transform: translateY(3px); } 60% { transform: translateY(-2px); } }
.op canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.op-line { position: absolute; inset: auto 0 16% 0; text-align: center; font-size: clamp(22px, 2.4vw, 34px); font-family: var(--display); color: var(--cream); opacity: 0; transition: opacity .3s var(--ease); }
.op.hit .op-line, .op.leave .op-line { opacity: 1; }
.op.leave { animation: op-leave .9s cubic-bezier(.22, .61, .36, 1) forwards; }
@keyframes op-leave { to { opacity: 0; transform: scale(1.06); } }
.hero-sub .since { white-space: nowrap; color: var(--brass); }
.op-skip { position: absolute; inset: auto auto 18px 18px; min-height: 44px; padding: 0 14px; color: var(--soft-dark); font-size: 15px; }
.is-opening .top { z-index: 30; }

@media (max-width: 1120px) { .wall { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 860px) {
  :root { --head: 68px; --rail: 0px; }
  .rail { display: none; }
  .opening { display: block; min-height: 0; padding-top: var(--head); }
  .opening::before { display: none; }
  .opening .hero-img { position: relative; inset: auto; display: block; height: 40svh; object-position: 30% 18%; }
  .opening .hero-in { padding-block: 16px 22px; }
  .opening h1 { font-size: 40px; }
  .opening .hero-answer { font-size: 26px; margin-top: 6px; }
  .opening .hero-sub { margin-block: 8px 12px; font-size: 17px; }
  .mishna { order: 9; margin: 12px 0 0; font-size: 15px; color: var(--mute-dark); }
  .opening .hero-in { display: flex; flex-direction: column; }
  .opening .cta-row .btn { flex: 1 1 100%; min-height: 54px; }
  .opening .prov { inset: calc(var(--head) + 40svh - 32px) auto auto 8px; }
  .glow { max-width: none; }
  .prov { font-size: 13px; }
  .fact-phone { display: block; margin-top: 18px; font-size: 17px; }
  .fact-phone b { color: var(--brass); }
  .scene { position: relative; height: auto; min-height: 86svh; }
  .scene > img { inset: 0; height: 100%; object-position: var(--pos-m, var(--pos)); }
  .scene.short { height: auto; }
  .scene.side-end::before, .scene.side-start::before { background: linear-gradient(0deg, rgba(18, 21, 28, .94) 8%, rgba(18, 21, 28, .5) 42%, rgba(18, 21, 28, 0) 68%); }
  .scene-in { padding-block: 72px 56px; }
  .side-start .scene-in { justify-content: flex-start; }
  .scene .prov, .room-head .prov { inset: auto auto 8px 8px; }
  .board-top { grid-template-columns: 1fr; }
  .wall { grid-template-columns: repeat(2, 1fr); }
  .wall li:nth-child(n+13) { display: none; }
  .door-grid { grid-template-columns: 1fr; }
  .sheet { max-width: 220px; }
  .room-head { min-height: 62svh; }
  .room-head::before { background: linear-gradient(0deg, rgba(18, 21, 28, .94) 10%, rgba(18, 21, 28, .5) 46%, rgba(18, 21, 28, .1) 72%); }
  .room-in { padding-block: 120px 44px; }
  .wall-press { grid-template-columns: 1fr 1fr; }
  .wall-press .w2 { grid-column: 1 / -1; grid-row: auto; }
  .wall-press .w2 img { height: auto; aspect-ratio: 16 / 10; min-height: 0; }
  .ledger td:nth-child(2), .ledger th:nth-child(2) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .scene { position: relative; }
  .rail-rec.flip bdi { animation: none; }
}
@media print {
  .rail, .room-head, .contact, .prov, .side, .bar { display: none !important; }
  .paper-doc { box-shadow: none; padding: 0; }
  body { background: #fff; }
}
