/* História: a scroll story with small interactions. Works without JS; JS adds motion. */
.saga { display: grid; gap: clamp(56px, 10vw, 120px); position: relative; }
.saga p { max-width: 64ch; }
.saga .kicker { font: 500 12px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ember); margin: 0; }

/* the huge faint year behind everything */
.bigyear { position: fixed; right: -2vw; bottom: -4vh; z-index: 0; pointer-events: none; font: 900 clamp(120px, 32vw, 380px)/1 var(--serif); color: #E7A04B; opacity: .06; letter-spacing: -.04em; transition: opacity .4s; }
.saga > * { position: relative; z-index: 1; }

/* reveal */
.js .ch, .js .rv { opacity: 0; transform: translateY(24px); transition: opacity .9s ease, transform .9s ease; }
.js .ch.in, .js .rv.in { opacity: 1; transform: none; }

/* hero: the Açude do Prata at night */
.acude { position: relative; min-height: min(86vh, 760px); border-radius: 10px; overflow: hidden; background: radial-gradient(120% 80% at 70% 10%, #1b2140 0%, #0C0E15 60%); display: grid; align-content: end; }
.acude canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; touch-action: manipulation; }
.acude .over { position: relative; padding: clamp(20px, 5vw, 56px); display: grid; gap: 14px; pointer-events: none; }
.acude h1 { font: 900 clamp(56px, 13vw, 150px)/.86 var(--serif); margin: 0; letter-spacing: -.02em; text-shadow: 0 2px 30px #0008; }
.acude h1 span { display: block; color: #F6F1E6; }
.acude .hook { font: italic clamp(18px, 2.4vw, 23px)/1.4 var(--serif); max-width: 34ch; margin: 0; color: #E9E1CF; }
.acude .hint { font: 12px var(--mono); letter-spacing: .08em; color: #C9C2D8; margin: 0; min-height: 1.5em; transition: opacity .6s; }

/* chapters */
.ch { display: grid; gap: 18px; }
.ch .num { font: 900 clamp(64px, 12vw, 120px)/.8 var(--serif); color: transparent; -webkit-text-stroke: 1px #E7A04B99; margin: 0; }
.ch h2 { font: 700 clamp(30px, 5vw, 52px)/1.02 var(--serif); margin: 0; }
.ch .lead { font: clamp(18px, 2.2vw, 21px)/1.55 var(--serif); margin: 0; color: #E9E1CF; }
.ch p { margin: 0; }
.ch .two { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 48px); align-items: center; }
@media (max-width: 760px) { .ch .two { grid-template-columns: minmax(0, 1fr); } }
.ch .txt { display: grid; gap: 14px; }
.ch blockquote { margin: 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--ember); font: italic 18px/1.5 var(--serif); color: #F1EADB; max-width: 60ch; }
.ch blockquote cite { display: block; margin-top: 6px; font: normal 12px var(--mono); color: var(--muted); }
.ch .aside { font-size: 14px; color: var(--muted); }
.stage { background: #141726; border: 1px solid #ffffff14; border-radius: 10px; padding: clamp(18px, 3vw, 28px); display: grid; gap: 14px; justify-items: center; text-align: center; }
.stage .cap { font: 12px var(--mono); letter-spacing: .06em; color: var(--muted); margin: 0; }
.btn-soft { font: 500 14px var(--sans); color: var(--night); background: var(--ember); border: 0; border-radius: 999px; padding: 10px 18px; cursor: pointer; }
.btn-soft[disabled] { opacity: .5; cursor: default; }
.btn-ghost { font: 500 14px var(--sans); color: var(--ember); background: none; border: 1px solid #E7A04B88; border-radius: 999px; padding: 8px 16px; cursor: pointer; }

/* I · the double wick */
.lamp { width: 150px; height: 150px; }
.lamp .fl { transform-origin: 50% 100%; animation: flick 1.6s ease-in-out infinite alternate; }
.lamp .fl.b { animation-delay: -.7s; }
@keyframes flick { from { transform: scaleY(1) skewX(0); } to { transform: scaleY(1.12) skewX(3deg); } }

/* II · the whisper */
.whisper { overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.whisper .msg { font: italic clamp(22px, 3.4vw, 30px)/1.3 var(--serif); color: #F6F1E6; filter: blur(9px); opacity: .35; transition: filter 1.4s ease, opacity 1.4s ease, letter-spacing 1.4s ease; letter-spacing: .12em; margin: 0; max-width: 22ch; }
.whisper.on .msg { filter: blur(0); opacity: 1; letter-spacing: 0; }
.whisper .hold { width: 92px; height: 92px; border-radius: 50%; border: 1px solid #E7A04B; background: radial-gradient(circle, #E7A04B33, transparent 70%); color: var(--ember); font: 500 12px var(--mono); letter-spacing: .06em; cursor: pointer; }
.whisper.on .hold { background: radial-gradient(circle, #E7A04B77, transparent 70%); }

/* III · the penance: the ghost's 3D model in wool and a linen veil under the yellow sambenito, in a dark stone room lit by a swinging lamp (tools/ghost/penance); hand in the petition and the habit burns away, she comes into the light and sinks to her knees, tired, on real motion capture. No CSS flicker here: the lamp's flicker is in the video */
.kneel { position: relative; width: min(100%, 380px); aspect-ratio: 540 / 684; overflow: hidden; border-radius: 10px; background: #07070c url(/img/kneel-poster.webp?v=6) center / cover no-repeat; }
.kneel video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.kneel .snap { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; transition: opacity .6s ease; }
.penance .under { font: italic 18px/1.35 var(--serif); color: #F1EADB; margin: 0; max-width: 30ch; opacity: 0; transition: opacity 1.2s .4s; }
.penance.down .under { opacity: 1; }

/* IV · the crossing */
.sea { width: 100%; max-width: 520px; height: auto; }
.sea .route { fill: none; stroke: #E7A04B; stroke-width: 2; stroke-dasharray: 4 6; }
.sea .coast { fill: none; stroke: #9C98AB; stroke-width: 1.2; opacity: .7; }
.sea text { font: 11px var(--mono); fill: #C9C2D8; letter-spacing: .06em; }
.sea .ship { fill: #F6F1E6; }

/* V · Friday */
.friday { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: center; width: 100%; }
@media (max-width: 560px) { .friday { grid-template-columns: minmax(0, 1fr); } }
.friday ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.friday li button { width: 100%; text-align: left; display: flex; gap: 10px; align-items: center; font: 15px var(--sans); color: var(--text); background: #ffffff08; border: 1px solid #ffffff1a; border-radius: 8px; padding: 9px 12px; cursor: pointer; }
.friday li button::before { content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--ember); }
.friday li button[aria-pressed="true"] { color: var(--muted); background: #E7A04B14; }
.friday li button[aria-pressed="true"]::before { background: var(--ember); }
.window { position: relative; width: min(100%, 300px); justify-self: center; aspect-ratio: 1; border-radius: 50% 50% 6px 6px; overflow: hidden; border: 6px solid #3a2e22; background: linear-gradient(#7FA7C9, #E8C389); transition: background 1.2s; }
.window .sun { position: absolute; left: 50%; width: 38%; aspect-ratio: 1; border-radius: 50%; background: #FFD98A; transform: translate(-50%, 0); transition: top 1.2s, opacity 1.2s; top: 18%; box-shadow: 0 0 40px #FFD98A; }
.window .star { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff; opacity: 0; transition: opacity 1s; }
.window .glow { position: absolute; inset: 0; background: radial-gradient(circle at 50% 110%, #E7A04Bcc, transparent 60%); opacity: 0; transition: opacity 1.2s; }
.window .shabbat { position: absolute; inset: auto 0 14% 0; text-align: center; font: 700 26px var(--serif); color: #FFE9BF; opacity: 0; transition: opacity 1s .5s; }
.friday.done .shabbat { opacity: 1; }

/* VI · voices */
.voices { width: 100%; display: grid; gap: 14px; }
.voices .deck { position: relative; min-height: 230px; display: grid; overflow: hidden; border-radius: 8px; }
.voices figure { grid-area: 1 / 1; margin: 0; background: var(--linen); color: var(--linen-ink); border-radius: 8px; padding: 22px; text-align: left; display: grid; gap: 10px; align-content: start; transition: transform .6s, opacity .6s; }
.js .voices figure { opacity: 0; transform: translateX(30px) rotate(2deg); pointer-events: none; }
.js .voices figure.cur { opacity: 1; transform: none; pointer-events: auto; }
.voices blockquote { border: 0; padding: 0; color: var(--linen-ink); font: italic 19px/1.45 var(--serif); }
.voices figcaption { font: 12px var(--mono); color: var(--linen-muted); letter-spacing: .04em; }
.voices .nav { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; }
.voices .dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--ember); background: none; padding: 0; cursor: pointer; }
.voices .dot[aria-current="true"] { background: var(--ember); }
.no-js-hide { display: none; }
.js .no-js-hide { display: flex; }

/* VII · the children, as flames */
.flames { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 14px; justify-content: center; }
.flames button { background: none; border: 0; color: var(--text); cursor: pointer; display: grid; justify-items: center; gap: 6px; font: 13px var(--sans); padding: 4px; width: 82px; }
.flames .f { width: 16px; height: 26px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #FFE9BF, #E7A04B 55%, #b3541e); box-shadow: 0 0 18px #E7A04B99; animation: flick 1.8s ease-in-out infinite alternate; }
.flames li:nth-child(2n) .f { animation-delay: -.6s; }
.flames li:nth-child(3n) .f { animation-delay: -1.1s; }
.flames .pt .f { background: radial-gradient(circle at 50% 70%, #fff, #cfd8f0 55%, #7d8fb8); box-shadow: 0 0 18px #cfd8f088; }
.flames button[aria-pressed="true"] { color: var(--ember); }
.flames button[aria-pressed="true"] .f { transform: scale(1.35); }
.childnote { min-height: 3em; font: italic 17px/1.45 var(--serif); color: #E9E1CF; text-align: center; margin: 0; max-width: 52ch; }
.legendkey { font: 12px var(--mono); color: var(--muted); display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.legendkey i { display: inline-block; width: 8px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* VIII · descendants as a thread of cards */
.thread { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.thread li { background: #141726; border: 1px solid #ffffff14; border-radius: 10px; padding: 14px 16px; display: grid; gap: 4px; transition: border-color .3s, transform .3s; }
.thread li:hover { border-color: #E7A04B88; transform: translateY(-2px); }
.thread .t { font: 700 18px/1.25 var(--serif); }
.thread .m { font-size: 14px; color: var(--muted); }
.thread.also li { background: none; border-style: dashed; }

/* IX · the irony */
.irony-ch { background: linear-gradient(#1a0f10, #0C0E15); border: 1px solid #A3261E55; border-radius: 12px; padding: clamp(20px, 4vw, 44px); }
.irony-ch .two { align-items: start; }
.irony-ch .num { -webkit-text-stroke-color: #A3261E; }
.irony-ch h2 { color: #F1EADB; }
.lines .tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.lines .tabs button { font: 500 13px var(--sans); color: var(--text); background: none; border: 1px solid #ffffff33; border-radius: 999px; padding: 7px 14px; cursor: pointer; }
.lines .tabs button[aria-selected="true"] { border-color: var(--ember); color: var(--night); background: var(--ember); }
.gens { list-style: none; margin: 16px 0 0; padding: 0 0 0 18px; border-left: 2px solid #E7A04B55; display: grid; gap: 10px; }
.gens li { position: relative; font: 16px/1.35 var(--serif); }
.gens li::before { content: ""; position: absolute; left: -25px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 0 4px #150d0e; }
.gens li small { display: block; font: 13px var(--sans); color: var(--muted); }
.gens li.star::before { background: #fff; box-shadow: 0 0 12px #fff, 0 0 0 4px #150d0e; }
.gens li.star { color: #fff; }
.gens li.knot::before { background: #A3261E; width: 16px; height: 16px; left: -27px; box-shadow: 0 0 14px #A3261E, 0 0 0 4px #150d0e; }
.gens li.knot { color: #ffb4a8; font-weight: 700; }
.js .gens li { opacity: 0; transform: translateX(-8px); transition: opacity .35s, transform .35s; }
.js .gens li.in { opacity: 1; transform: none; }
.js .lines .gens[hidden] { display: none; }
.ancestors { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ancestors li { display: grid; gap: 2px; }
.ancestors .t { font: 700 17px/1.3 var(--serif); color: #F1EADB; }
.ancestors .m { font-size: 14px; color: var(--muted); }

/* X · the shelf */
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 300px); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 10px; overscroll-behavior-x: contain; }
.shelf > li { scroll-snap-align: start; list-style: none; background: var(--linen); color: var(--linen-ink); border-radius: 8px; padding: 16px; display: grid; gap: 6px; align-content: start; }
.shelf { margin: 0; padding-left: 0; }
.shelf .ty { font: 500 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.shelf .t { font: 700 18px/1.25 var(--serif); }
.shelf .m { font-size: 14px; color: var(--linen-muted); }
.shelf a { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .js .ch, .js .rv, .js .gens li { opacity: 1; transform: none; transition: none; }
  .lamp .fl, .flames .f { animation: none; }
}

/* prologue: the panellada first, then a short timeline */
.prologue { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 56px); align-items: start; }
@media (max-width: 760px) { .prologue { grid-template-columns: minmax(0, 1fr); } }
.prologue .cta { justify-self: start; }
.timeline.short li { padding-bottom: 16px; }
.timeline.short .yr { font-size: 18px; }
.timeline.short p { font-size: 15px; }

/* Torah tsivvah lanu Mosheh, the first verse a child learns, opening the story */
.opener .first-verse { width: fit-content; margin: 2px 0 4px; display: grid; gap: 6px; border-left: 2px solid var(--ember); padding: 4px 0 4px 16px; max-width: min(100%, 640px); background: linear-gradient(90deg, #0C0E15aa, transparent); }
.opener .first-verse p { margin: 0; }
.opener .first-verse .he { font: 500 clamp(18px, 2.6vw, 28px)/1.55 var(--serif); color: #F6F1E6; text-align: right; }
.opener .first-verse .tl { font: 16px/1.45 var(--serif); color: var(--ember); }
.opener .first-verse .tr { font: 15px/1.45 var(--sans); color: #E9E1CF; }
.opener .first-verse figcaption { font: 11px var(--mono); color: #C9C2D8; letter-spacing: .03em; }
.window .shabbat { font-size: 30px; }

.opener { display: grid; justify-items: center; }
.opener .first-verse { background: none; border-left: 0; border-top: 1px solid #E7A04B66; border-bottom: 1px solid #E7A04B66; padding: 22px 8px; text-align: center; justify-items: center; }
.opener .first-verse .he { text-align: center; font-size: clamp(22px, 3.4vw, 34px); }
/* the grandmother's greeting when Shabbat comes in */
.greeting { display: none; max-width: 52ch; text-align: left; gap: 8px; margin-top: 6px; padding: 16px 18px; border-radius: 10px; background: #E7A04B14; border: 1px solid #E7A04B44; }
.greeting p { margin: 0; font: italic 17px/1.5 var(--serif); color: #F1EADB; }
.greeting .who { font: 12px var(--mono); font-style: normal; letter-spacing: .06em; color: var(--ember); }
.friday.done ~ .greeting, .stage .greeting.on { display: grid; animation: rise 1.2s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.greeting .play { margin-left: 10px; font: 500 12px var(--sans); color: var(--night); background: var(--ember); border: 0; border-radius: 999px; padding: 4px 12px; cursor: pointer; }

/* the intro's last word */
.acude .og { margin: 0; max-width: 46ch; font: 600 clamp(15px, 1.7vw, 17px)/1.5 var(--sans); color: var(--ember); text-shadow: 0 1px 12px #000a; }
/* II · Branca hushes: real footage of a woman, treated as a warm backlit shadow (no face, the hair edges and the hand lit by the candle), against a candle-lit wall (img/hush-wall.webp); the frames of the hand rising live in a sprite sheet */
.hush { position: relative; width: min(100%, 380px); aspect-ratio: 540 / 684; overflow: hidden; border-radius: 10px; background: #07070c url(/img/hush-wall.webp?v=4) center / cover no-repeat; }
/* the candle breathes: the whole scene, wall and rim, flickers a little */
.hush { animation: candle 3.7s ease-in-out infinite; }
@keyframes candle { 0%, 100% { filter: brightness(1); } 23% { filter: brightness(.93); } 41% { filter: brightness(1.04); } 58% { filter: brightness(.96); } 77% { filter: brightness(1.02); } }
@media (prefers-reduced-motion: reduce) { .hush { animation: none; } }
.hush .hush-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* the silence that speaks very loud: a big white sssshh slides out from behind her, left to right, over 4.5 seconds, starting as soon as the finger is at her lips */
.hush .shout { position: absolute; inset: 0; clip-path: inset(0 0 0 50%); }
.hush .sweep { position: absolute; left: 0; top: 36%; font: 800 clamp(72px, 30vw, 124px)/1 var(--sans); color: #fff; letter-spacing: 2px; white-space: nowrap; opacity: 0; transform: translateX(-70%); }
.whisper.on .hush .sweep { animation: sweep 4.5s linear .9s both; }
@keyframes sweep {
  0% { transform: translateX(-70%); opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateX(110%); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .whisper.on .hush .sweep { animation: none; opacity: 1; transform: translateX(20%); } }

/* background music: Romãs que plantei */
.bgm { position: fixed; right: 14px; bottom: 14px; z-index: 20; display: flex; align-items: center; gap: 8px; font: 500 12px var(--sans); color: var(--text); background: #0a0c14dd; border: 1px solid #E7A04B55; border-radius: 999px; padding: 8px 14px 8px 10px; cursor: pointer; backdrop-filter: blur(6px); }
.bgm .note { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #E7A04B22; color: var(--ember); font-size: 14px; }
.bgm[aria-pressed="true"] .note { background: var(--ember); color: var(--night); animation: beat 1.6s ease-in-out infinite; }
.bgm .ttl { font-style: italic; font-family: var(--serif); font-size: 14px; }
@keyframes beat { 50% { transform: scale(1.15); } }
@media (max-width: 480px) { .bgm .ttl { display: none; } .bgm { padding: 8px; } }
@media (prefers-reduced-motion: reduce) { .bgm[aria-pressed="true"] .note { animation: none; } }
