/* ===== Tokens ===== */
/* subset to the letters it draws ("Saksham Agrawal", "magical"): 27 KB -> 3.5 KB. Add letters with fontTools if it is used for new words. */
@font-face { font-family: "Harry P"; src: url("assets/HarryP-subset.woff") format("woff"); font-display: swap; }
:root {
  --midnight: #04141b;
  --ink: #082029;
  --teal: #0d3a48;
  --burgundy: #6b1d2a;
  --gold: #c9a45c;
  --gold-hi: #ecd39a;
  --silver: #dfe6ea;
  --parchment: #efe4c8;
  --quill: #2b1d12;
  --quill-soft: #5a4330;
  --text: #e8e4d8;
  --text-soft: #e2dfd5;
  --stone: #c3cdd0;
  --glow: 150, 210, 255;
  --gryffindor: #c0392b;
  --ravenclaw: #4a74d0;
  --hufflepuff: #e0b23a;
  --slytherin: #2f9a5e;

  --display: "Cinzel", Georgia, serif;
  --deco: "Cinzel Decorative", "Cinzel", Georgia, serif;
  --fell: "IM Fell English", Georgia, serif;
  --body: "EB Garamond", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  --pad: clamp(84px, 10vw, 140px);
  --mx: -999px; --my: -999px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--midnight); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--text); font: 500 1.16rem/1.65 var(--body); overflow-x: hidden; overflow-x: clip; }
img, svg { display: block; max-width: 100%; }
a { color: var(--gold-hi); }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.15; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--gold); color: var(--midnight); padding: 10px 14px; border-radius: 6px; }
.skip:focus { top: 12px; }

.eyebrow { font: 600 .8rem/1 var(--display); letter-spacing: .26em; text-transform: uppercase; color: var(--gold); margin: 0 0 .9rem; }
.kicker { font: .88rem/1.5 var(--mono); color: #8fc3d2; margin: 0 0 .7rem; min-height: 1.5em; }
.kicker .out { color: var(--gold-hi); margin-left: .6em; }
.js .kicker[data-cmd] .out { opacity: 0; transition: opacity .35s; }
.js .kicker[data-cmd].done .out { opacity: 1; }
.kicker.center { text-align: center; }
.lede { color: var(--text); max-width: 38rem; margin: .2rem 0 0; font: 500 clamp(1.2rem, 1.7vw, 1.4rem)/1.5 var(--body); text-wrap: pretty; }
.lede.center { margin: 0 auto 2.4rem; text-align: center; }
.tech { font: .88rem/1.6 var(--mono); color: var(--stone); margin: .7rem 0 0; }
.metric { font: 600 .98rem/1.3 var(--display); color: var(--gold-hi); margin: .6rem 0 0; letter-spacing: .04em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: .75rem 1.6rem;
  font: 600 .9rem/1 var(--display); letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none; border-radius: 3px; cursor: pointer;
  transition: transform .3s ease, box-shadow .3s ease, background-color .3s ease;
}
.btn-gold { color: #1d1408; border: 1px solid var(--gold-hi); background: linear-gradient(180deg, #f0d89c, #c9a45c 60%, #ad8a45); }
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(201,164,92,.3); }
.btn-ghost { color: var(--silver); border: 1px solid rgba(223,230,234,.45); background: rgba(4,20,27,.55); }
.btn-ghost:hover { background: rgba(223,230,234,.1); transform: translateY(-2px); }
.btn-ink { color: var(--parchment); background: var(--quill); border: 1px solid var(--quill); }
.btn-ink:hover { background: var(--burgundy); }

/* ===== Wand + torch (desktop pointer) ===== */
.wand { display: none; }
@media (pointer: fine) {
  html.wand-on, html.wand-on * { cursor: none !important; }
  html.wand-on .wand { display: block; }
}
.wand { position: fixed; left: 0; top: 0; z-index: 90; width: 26px; height: 162px; pointer-events: none; transform-origin: 50% 2%; will-change: transform; filter: drop-shadow(2px 4px 4px rgba(0,0,0,.6)); }
.wand svg { width: 100%; height: 100%; overflow: visible; }
.wand .tip { fill: #f4fbff; transition: r .3s; }
.wand .halo { transform-box: fill-box; transform-origin: center; animation: halo 2.6s ease-in-out infinite alternate; transition: r .3s; }
.wand.hot .tip { r: 2.6; }
.wand.hot .halo { r: 11; }
@keyframes halo { from { opacity: .55; transform: scale(.85); } to { opacity: .95; transform: scale(1.08); } }
/* Background world: one faint, continuous illustrated layer that scrolls with the page (parallax by transform). */
.world-clip { position: absolute; left: 0; top: 0; width: 100%; z-index: 0; overflow: hidden; pointer-events: none; }
.world { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; color: #cfeeff; opacity: .14; will-change: transform; contain: strict; }
.world svg, .lamp-world svg { position: absolute; left: 50%; translate: -50% 0; overflow: visible; }
.world .corridor-line, .lamp-world .corridor-line { left: 0; translate: none; width: 100%; }
/* The wand's lamp: a fixed circle with a *static* mask, moved by transform; inside, a lit copy of the world is
   counter-translated so the faint ink beneath appears revealed. No repaint per frame. */
.lamp { position: fixed; left: 0; top: 0; z-index: 0; width: 460px; height: 460px; pointer-events: none; opacity: 0; transition: opacity .4s ease; will-change: transform;
  -webkit-mask: radial-gradient(circle closest-side, #000 0%, rgba(0,0,0,.55) 55%, transparent 100%); mask: radial-gradient(circle closest-side, #000 0%, rgba(0,0,0,.55) 55%, transparent 100%);
  background: radial-gradient(circle closest-side, rgba(150,210,255,.10), transparent 80%); overflow: hidden; }
html.wand-on .lamp, html.drift-on .lamp { opacity: 1; }
html.nox .lamp, html.nox .hero-lamp { opacity: 0 !important; }
.lamp-world { position: absolute; left: 0; top: 0; width: 100vw; color: #f4dfa8; opacity: .7; will-change: transform; }
main > section:not(.hero) { isolation: isolate; overflow-x: clip; background: var(--tint, transparent); }
#what-i-do { --tint: linear-gradient(180deg, transparent, rgba(13,58,72,.22) 50%, transparent); }
#room-of-requirement { --tint: radial-gradient(ellipse 80% 60% at 50% 30%, rgba(107,29,42,.2), transparent 70%); }
#sorting-hat { --tint: radial-gradient(ellipse 60% 70% at 30% 50%, rgba(201,164,92,.07), transparent 70%); }
#journey { --tint: linear-gradient(180deg, transparent, rgba(13,58,72,.18) 45%, transparent); }
#spellbook { --tint: radial-gradient(ellipse 70% 60% at 50% 45%, rgba(120,60,30,.14), transparent 70%); }
#records { --tint: linear-gradient(180deg, transparent, rgba(30,40,80,.2) 50%, transparent); }
#trophy-room { --tint: radial-gradient(ellipse 70% 60% at 50% 40%, rgba(201,164,92,.07), transparent 70%); }
#owl-post { --tint: radial-gradient(ellipse 60% 70% at 20% 50%, rgba(150,210,255,.06), transparent 70%); }
/* nothing animates in a section that is off screen (rain, cues, card pieces, the owl's blink...) */
main > section:not(.onscreen), main > section:not(.onscreen) *, main > section:not(.onscreen) *::before, main > section:not(.onscreen) *::after { animation-play-state: paused !important; }
/* ...except an open Daily Prophet, which can live inside a card */
main > section dialog[open], main > section dialog[open] * { animation-play-state: running !important; }

/* ===== Top bar ===== */
.topbar {
  position: fixed; inset: 0 0 auto; z-index: 50;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .7rem var(--gutter) 34px;
  background: linear-gradient(180deg, rgba(4,20,27,.92), rgba(4,20,27,0));
  transition: background-color .4s ease, box-shadow .4s ease;
}
.topbar.scrolled { background: rgba(4,20,27,.96); box-shadow: 0 1px 0 rgba(201,164,92,.14); }
.mono { font: 700 1.3rem/1 var(--deco); color: var(--silver); text-decoration: none; letter-spacing: .04em; }
.mono span { color: var(--gold); }
.plainnav { display: flex; gap: 1.6rem; margin-left: auto; }
.plainnav a { font: 400 .84rem/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: #dbe0dd; text-decoration: none; padding: .7rem 0; position: relative; transition: color .3s; }
.plainnav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: .3rem; height: 1px; background: var(--gold); transform: scaleX(0); transition: transform .35s ease; }
.plainnav a:hover::after, .plainnav a[aria-current]::after { transform: scaleX(1); }
.plainnav a[aria-current], .plainnav a:hover { color: var(--gold-hi); }
.menu-btn { display: none; margin-left: auto; min-height: 44px; padding: .4rem 1rem; border: 1px solid rgba(223,230,234,.4); border-radius: 999px; background: rgba(4,20,27,.6); font: 600 .8rem/1 var(--display); letter-spacing: .16em; text-transform: uppercase; cursor: pointer; }
@media (max-width: 860px) {
  .menu-btn { display: inline-flex; align-items: center; }
  .mono { margin-right: auto; }
  .plainnav {
    position: absolute; top: calc(100% - 26px); left: var(--gutter); right: var(--gutter); margin: 0;
    flex-direction: column; gap: 0; padding: 8px 18px; border-radius: 6px;
    background: rgba(6,28,36,.97); border: 1px solid rgba(201,164,92,.3);
    opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .3s, transform .3s, visibility .3s;
  }
  .plainnav.open { opacity: 1; visibility: visible; transform: none; }
  .plainnav a { padding: 14px 0; border-bottom: 1px solid rgba(201,164,92,.15); }
  .plainnav a:last-child { border-bottom: 0; }
}

#sparkles { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 85; }

/* ===== Owl ===== */
.owl { width: 100%; height: 100%; overflow: visible; }
.owl .body { fill: #f6f3ec; }
.owl .wing-folded path { fill: #e7e2d6; }
.owl .wing-open { display: none; }
.owl .wing-open path:first-child { fill: #efebe2; }
.owl .spk { fill: none; stroke: #3d3833; stroke-width: 1.7; stroke-linecap: round; opacity: .6; }
.owl .disc { fill: none; stroke: #d8d2c5; stroke-width: 1.2; }
.owl .feet { stroke: #bdb5a5; stroke-width: 2.2; stroke-linecap: round; }
.owl .lid { fill: #f6f3ec; transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(0); animation: blink 7s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(0); } 96% { transform: scaleY(1); } }
.flyer { position: fixed; left: 0; top: 0; z-index: 86; width: 60px; height: 60px; pointer-events: none; will-change: transform; display: none; }
.flyer.on { display: block; }
.flyer .wing-folded, .flyer .feet { display: none; }
.owl .carry { display: none; }
.flyer { overflow: visible; } .flyer .owl { overflow: visible; }
.flyer.errand .carry { display: inline; transform-box: view-box; transform-origin: 60px 114px; animation: carry-swing .7s ease-in-out infinite alternate; }
@keyframes carry-swing { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
.flyer .wing-open { display: block; transform-box: fill-box; animation: flap .32s ease-in-out infinite alternate; }
.flyer .wl { transform-origin: 100% 40%; }
.flyer .wr { transform-origin: 0% 40%; }
@keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(-.3); } }
.owl-slot.away { visibility: hidden; }
.perch-glow { position: absolute; pointer-events: none; opacity: 0; border-radius: 50%; background: radial-gradient(circle, rgba(255,248,222,.95), rgba(236,211,154,.5) 30%, rgba(191,230,255,.15) 55%, transparent 70%); }
.perch-spot > .perch-glow { left: -.25em; bottom: calc(.66em - 21px); width: 84px; height: 84px; translate: -50% 0; }
.window-spot > .perch-glow { inset: -25%; }

/* ===== Great Hall (hero) ===== */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: grid; place-items: start center; overflow: hidden; isolation: isolate; }
.scene { position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse 75% 65% at 30% 22%, #0f4556 0%, #082c39 42%, var(--midnight) 88%); }
.moon {
  position: absolute; left: 28%; top: 8%; width: min(34vw, 460px); aspect-ratio: 1; translate: -50% 0; border-radius: 50%;
  background:
    radial-gradient(circle at 62% 58%, rgba(60,45,35,.18) 0 9%, transparent 10%),
    radial-gradient(circle at 38% 66%, rgba(60,45,35,.14) 0 6%, transparent 7%),
    radial-gradient(circle at 30% 36%, rgba(60,45,35,.12) 0 8%, transparent 9%),
    radial-gradient(circle at 45% 40%, #b8a189 0%, #8e7865 55%, #6b5a4d 100%);
  opacity: .5; filter: blur(.6px);
  box-shadow: 0 0 90px 30px rgba(190,160,130,.12);
}
.stars { position: absolute; inset: 0 0 40%; opacity: .55; will-change: opacity; background-image: radial-gradient(1px 1px at 30px 40px, #fff, transparent), radial-gradient(1px 1px at 160px 110px, #dff, transparent), radial-gradient(1.4px 1.4px at 260px 30px, #fff, transparent), radial-gradient(1px 1px at 380px 150px, #fff, transparent); background-size: 420px 220px; animation: twinkle 6s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: .3; } to { opacity: .6; } }

.castle { position: absolute; left: 0; bottom: 0; width: 100%; height: 76%; }
.castle .keep { fill: #03151d; }
.castle .shade { fill: #010a0f; opacity: .7; }
.castle .arches { fill: #072835; }
.castle .detail { fill: none; stroke: #0e2f3b; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.castle .win { fill: #e9a24a; opacity: .72; }
.hero-lamp { position: absolute; left: 0; top: 0; width: 520px; height: 520px; pointer-events: none; overflow: hidden; opacity: 0; transition: opacity .4s ease; will-change: transform;
  -webkit-mask: radial-gradient(circle closest-side, #000 0%, rgba(0,0,0,.5) 50%, transparent 100%); mask: radial-gradient(circle closest-side, #000 0%, rgba(0,0,0,.5) 50%, transparent 100%); }
html.wand-on .hero-lamp, html.drift-on .hero-lamp { opacity: 1; }
.hero-lamp-in { position: absolute; left: 0; top: 0; will-change: transform; }
.castle-lit { pointer-events: none; }
.castle-lit .keep { fill: url(#stone); stroke: rgba(190,230,250,.55); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.castle-lit .shade { fill: #04141b; opacity: .55; }
.castle-lit .arches { fill: #0d3c4c; }
.castle-lit .detail { stroke: rgba(170,220,240,.55); }
.castle-lit .win { fill: #ffd27f; opacity: 1; animation: none; }
.rain {
  position: absolute; left: -40px; right: 0; top: -240px; bottom: 0; opacity: .45; pointer-events: none; will-change: transform;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' stroke='%23cfe8f5' stroke-opacity='.35' stroke-width='1'%3E%3Cpath d='M20 10l-3 16M70 60l-3 16M130 20l-3 16M190 90l-3 16M40 140l-3 16M100 120l-3 16M160 180l-3 16M220 30l-3 16M10 200l-3 16M120 210l-3 16M200 150l-3 16M80 180l-3 16'/%3E%3C/svg%3E") 0 0 / 240px 240px;
  animation: rain .7s linear infinite;
}
@keyframes rain { to { transform: translate3d(40px, 240px, 0); } }
.mist { position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: linear-gradient(180deg, transparent, rgba(4,20,27,.6) 55%, var(--midnight)); }

.hero-copy { position: relative; text-align: center; padding: clamp(110px, 20vh, 200px) var(--gutter) 0; max-width: 76rem; }
.hero-copy::before { content: ""; position: absolute; inset: 10% -6% -10%; z-index: -1; background: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(2,12,17,.72), transparent 75%); pointer-events: none; }
.inscription {
  font: 400 clamp(3.6rem, 11vw, 9rem)/.95 "Harry P", var(--display); letter-spacing: .03em; color: #e9eff2;
}
/* silver, like the film titles */
.hp-name {
  display: inline-block; padding: 0 .06em; color: transparent;
  background: linear-gradient(180deg, #ffffff 0%, #e6edf0 30%, #9fb0b8 48%, #5d6f78 52%, #c9d4d9 66%, #f4f7f8 82%, #a9b8bf 100%);
  -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,.35)) drop-shadow(0 3px 0 rgba(10,20,26,.9)) drop-shadow(0 8px 18px rgba(0,0,0,.8)) drop-shadow(0 0 30px rgba(var(--glow), .2));
}
.role { font: 400 clamp(.95rem, 1.5vw, 1.1rem)/1.4 var(--mono); letter-spacing: .08em; color: var(--gold-hi); margin: 1.1rem 0 0; text-shadow: 0 1px 8px #000; }
.follow { position: absolute; bottom: 26px; left: 50%; translate: -50% 0; display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; font: italic 1rem/1 var(--fell); color: var(--gold-hi); }
.ff { display: flex; gap: 6px; height: 30px; }
.ff svg { width: 9px; height: 18px; fill: var(--gold); transform: rotate(180deg); animation: step-cue 2.4s ease-in-out infinite; }
.ff svg:last-child { margin-top: 12px; animation-delay: 1.2s; }
@keyframes step-cue { 0%, 100% { opacity: .2; } 40% { opacity: .9; } }

/* ===== Section frame + guiding footsteps ===== */
main > section:not(.hero) { padding: var(--pad) var(--gutter) calc(var(--pad) * .5); position: relative; }
.sec-head { position: relative; max-width: 1180px; margin: 0 auto clamp(32px, 5vw, 56px); }
.sec-head::before { content: ""; position: absolute; inset: -30px -60px -30px -60px; z-index: -1; pointer-events: none; background: radial-gradient(ellipse 45% 60% at 30% 50%, rgba(2,12,17,.6), transparent 75%); }
.sec-head h2, .post h2, .hat-text h2 { font: 600 clamp(2rem, 5vw, 3.4rem)/1.08 var(--display); color: #f4efe2; margin-bottom: .8rem; }
/* Marauder's-Map walker along the top */
.walker { position: fixed; left: var(--gutter); right: var(--gutter); top: 58px; height: 26px; z-index: 51; pointer-events: none; }
.corridor { position: absolute; left: 0; right: 0; top: 12px; border-top: 1px dashed rgba(217,196,143,.22); }
.corridor i { position: absolute; top: -3px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: rgba(217,196,143,.45); }
.prints svg { position: absolute; left: 0; top: 0; width: 8px; height: 16px; max-width: none; fill: #d9c48f; margin: -8px 0 0 -4px; opacity: 0; will-change: transform, opacity; }
.tag {
  position: absolute; top: 12px; left: 0; translate: 0 -50%; white-space: nowrap; will-change: transform;
  padding: 3px 12px; font: italic .82rem/1.2 var(--fell); color: #3e2714;
  background: #e6d5a8; border: 1px solid rgba(74,46,23,.45);
  clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 50%, 100% 100%, 0 100%, 6px 50%);
  opacity: .6; transition: opacity .5s ease;
}
.tag b { font-weight: 400; }
.tag .room { color: #6b4a2a; font-size: .74rem; }
.tag .room::before { content: "· "; }
.walker.moving .tag { opacity: 1; }

/* The owl perches on the heading you're reading */
.perch-spot { display: inline-block; position: relative; width: 0; height: 0; vertical-align: baseline; }
.perch-spot > .owl-slot { position: absolute; left: -.25em; bottom: .66em; width: 42px; height: 42px; translate: -50% 0; }
.window-spot { display: block; position: absolute; left: 50%; bottom: calc(20% + 6px); width: 50%; aspect-ratio: 1; translate: -50% 0; }
.window-spot > .owl-slot { position: absolute; inset: 0; width: 100%; height: 100%; translate: none; left: 0; bottom: 0; }

/* Two-way reveals: rise from below when scrolling down, drop from above when scrolling up; re-arm once fully off-screen */
.js .rv { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
html.js[data-dir="up"] .rv:not(.in) { transform: translateY(-14px); }
.js .rv.in { opacity: 1; transform: none; }

/* ===== What I do ===== */
.band .band-title { text-align: center; font: 600 clamp(2rem, 5vw, 3.4rem)/1.08 var(--display); color: #f4efe2; margin: 0 0 .8rem; }
.plaques { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.plaques li { padding: 28px 24px; border-radius: 4px; background: rgba(8,34,44,.82); border: 1px solid rgba(201,164,92,.22); transition: border-color .4s, transform .4s; }
.plaques li:hover { border-color: rgba(236,211,154,.6); transform: translateY(-3px); }
.rune { display: block; font-size: 1.9rem; color: var(--gold); margin-bottom: 12px; }
.plaques h3 { font: 600 1.18rem/1.2 var(--display); color: #f4efe2; margin-bottom: 8px; }
.plaques p { font-size: 1.08rem; color: var(--text-soft); margin: 0; }
@media (max-width: 960px) { .plaques { grid-template-columns: 1fr 1fr; } }
@media (max-width: 540px) { .plaques { grid-template-columns: 1fr; } }

/* ===== Room of Requirement ===== */
.artefacts { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 24px; }
.artefact { height: 100%; position: relative; padding: 28px 26px 26px; border-radius: 6px; background: rgba(8,34,44,.85); border: 1px solid rgba(201,164,92,.24); transition: transform .45s ease, border-color .45s ease, box-shadow .45s ease; }
.artefact:hover, .artefact:focus-within { transform: translateY(-6px); border-color: rgba(236,211,154,.6); box-shadow: 0 24px 50px -24px rgba(0,0,0,.9); }
/* One custom artefact per project */
.piece { display: block; height: 64px; margin: 30px 0 18px; color: var(--gold); }
.pipeline { width: 100%; max-width: 280px; }
.pipeline .nodes rect, .pipeline .rail { fill: none; stroke: rgba(201,164,92,.55); stroke-width: 1.2; }
.pipeline .rail { stroke-dasharray: 3 3; }
.pipeline .lbl text { fill: #e6d9b8; stroke: none; font: italic 11px var(--fell); text-anchor: middle; }
.pipeline .pulse { fill: rgba(236,211,154,.12); stroke: var(--gold-hi); stroke-width: 1.4; animation: hop 4.8s ease-in-out infinite; }
@keyframes hop { 0%, 18% { transform: translateX(0); } 25%, 43% { transform: translateX(68px); } 50%, 68% { transform: translateX(136px); } 75%, 93% { transform: translateX(204px); } 100% { transform: translateX(0); } }
.wave { display: flex; align-items: center; gap: 3px; position: relative; max-width: 240px; }
.wave i { flex: 1; height: var(--h); max-height: 100%; border-radius: 2px; background: linear-gradient(var(--gold-hi), rgba(201,164,92,.35)); transform-origin: center; animation: vu 1.2s ease-in-out infinite alternate; animation-delay: var(--d); }
@keyframes vu { from { transform: scaleY(.25); } to { transform: scaleY(1); } }
.wave span { position: absolute; right: 0; bottom: -16px; font: .62rem/1 var(--mono); color: var(--stone); letter-spacing: .06em; }
.orb { display: flex; align-items: center; gap: 16px; }
.orb svg { width: 64px; height: 64px; flex: none; }
.orb .ball { fill: rgba(150,210,255,.08); stroke: rgba(201,164,92,.6); }
.orb .stand { fill: none; stroke: var(--gold); stroke-width: 1.4; }
.orb .seq circle { fill: #dff4ff; opacity: 0; animation: seq 4s ease-in-out infinite; }
.orb .seq circle:nth-child(2) { animation-delay: .4s; } .orb .seq circle:nth-child(3) { animation-delay: .8s; }
.orb .seq .next { fill: var(--gold-hi); animation-delay: 1.4s; }
@keyframes seq { 0%, 5% { opacity: 0; } 15%, 80% { opacity: .9; } 100% { opacity: 0; } }
.orb .bars { flex: 1; display: grid; gap: 8px; max-width: 180px; }
.orb .bars span { position: relative; display: block; padding-bottom: 6px; font: .68rem/1 var(--mono); color: var(--text-soft); }
.orb .bars span b { font-weight: 400; color: var(--gold); }
.orb .bars span::before, .orb .bars span::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; border-radius: 2px; }
.orb .bars span::before { right: 0; background: rgba(201,164,92,.18); }
.orb .bars span::after { width: 0; background: var(--gold-hi); transition: width 1.4s ease .3s; }
.rv.in .orb .bars span::after, html:not(.js) .orb .bars span::after { width: var(--v); }
.rocket-pad { position: relative; z-index: 1; width: 64px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 8px; }
.rocket { width: 32px; height: 64px; margin: 0 auto; overflow: visible; filter: drop-shadow(0 0 8px rgba(201,164,92,.35)); transition: transform .4s ease; }
.rocket-pad:hover .rocket { transform: translateY(-3px); }
.rocket .flame { fill: #ffd27f; opacity: 0; transform-box: fill-box; transform-origin: 50% 0; }
.rocket.launch { animation: launch 1.2s cubic-bezier(.5,0,.8,.4) forwards; }
.rocket.launch .flame { opacity: 1; animation: burn .12s linear infinite alternate; }
.rocket.return { animation: touchdown .9s ease-out; }
@keyframes launch { 0% { transform: translateY(0); } 15% { transform: translateY(4px); } 100% { transform: translateY(-460px) scale(.7); opacity: 0; } }
@keyframes burn { from { transform: scaleY(.8); } to { transform: scaleY(1.25); } }
@keyframes touchdown { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer { position: relative; width: 150px; }
.drawer .front { position: absolute; left: 0; right: 0; bottom: 0; height: 34px; border-radius: 3px; background: linear-gradient(#5a3a22, #3b2414); border: 1px solid rgba(201,164,92,.45); }
.drawer .pull { position: absolute; left: 50%; top: 12px; width: 34px; height: 8px; margin-left: -17px; border: 1px solid var(--gold); border-radius: 0 0 8px 8px; border-top: 0; }
.drawer .cat-card { position: absolute; left: 14px; right: 14px; bottom: 14px; height: 40px; border-radius: 2px; background: var(--parchment); transition: transform .5s ease; display: grid; place-items: center; }
.drawer .cat-card b, .drawer .cat-card i { grid-area: 1 / 1; font: 600 .66rem/1 var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--burgundy); border: 1.5px solid var(--burgundy); padding: 3px 6px; transform: rotate(-6deg); animation: stamp 5s infinite; }
.drawer .cat-card i { font-style: normal; color: #2f6b45; border-color: #2f6b45; animation-delay: 2.5s; }
@keyframes stamp { 0%, 45% { opacity: 1; } 50%, 95% { opacity: 0; } 100% { opacity: 1; } }
.artefact:hover .drawer .cat-card, .artefact:focus-within .drawer .cat-card { transform: translateY(-16px); }

/* System diagram in each dossier */
.flow-h { margin-top: 28px !important; }
.flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flow .col { display: flex; flex-direction: column; gap: 6px; }
.flow .col span { padding: 8px 12px; border: 1px solid rgba(43,29,18,.55); border-radius: 3px; background: rgba(255,255,255,.35); font: italic 1rem/1.25 var(--fell); text-align: center; }
.flow small { font: .8rem/1.3 var(--mono); color: var(--quill-soft); font-style: normal; }
.flow .arr { font-style: normal; color: var(--burgundy); font-size: 1.2rem; }
.flow-note { margin-top: 10px; font: .8rem/1.5 var(--mono); color: var(--quill-soft); }
@media (max-width: 680px) { .flow { flex-direction: column; align-items: stretch; } .flow .arr { text-align: center; transform: rotate(90deg); } }
.badge { position: absolute; top: 24px; right: 22px; font: 600 .7rem/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-hi); border: 1px solid rgba(201,164,92,.5); padding: 6px 9px; border-radius: 2px; }
.badge.live { color: #a8e6b8; border-color: rgba(120,210,150,.5); }
.badge.live::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #6fdc8c; vertical-align: 1px; }
.artefact h3 { font: 600 1.45rem/1.2 var(--display); color: #f6f1e4; margin-bottom: 10px; padding-right: 6.5rem; }
.artefact p { font-size: 1.07rem; color: var(--text-soft); margin: 0; }
.card-actions { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-top: 18px; }
.open-cue { background: none; border: 0; padding: 8px 0; min-height: 44px; cursor: pointer; font: italic 1.08rem/1 var(--fell); color: var(--gold-hi); text-decoration: underline; text-decoration-color: rgba(201,164,92,.5); text-underline-offset: 5px; }
.open-cue::before { content: ""; position: absolute; inset: 0; border-radius: 6px; }
.artefact .primary { position: relative; z-index: 1; padding: 8px 0; font: 600 .8rem/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-hi); text-decoration: none; border-bottom: 1px solid var(--gold); }
.artefact .primary:hover { color: #fff; }

/* CausalFunnel: a click heatmap */
.heat { position: relative; display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px 5px; align-content: center; }
.heat i { aspect-ratio: 1; border-radius: 50%; background: var(--gold-hi); }
.heat i.hot { box-shadow: 0 0 8px rgba(255,190,90,.9); background: #ffd27f; }
.heat b { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; border: 1px solid #fff2cf; animation: ripple 2.4s ease-out infinite; }
@keyframes ripple { from { transform: scale(.4); opacity: 1; } to { transform: scale(3.2); opacity: 0; } }
.heat span, .bars span { position: absolute; right: 0; bottom: -16px; font: .62rem/1 var(--mono); color: var(--stone); letter-spacing: .06em; }
/* DealerOS: monthly demand bars, the festive month, next month's forecast */
.bars { position: relative; display: flex; align-items: flex-end; gap: 5px; }
.bars i { flex: 1; border-radius: 2px 2px 0 0; background: linear-gradient(rgba(236,211,154,.7), rgba(201,164,92,.25)); transform-origin: 50% 100%; transition: transform .5s ease; }
.bars i.fest { background: linear-gradient(#ffd27f, #c9a45c); box-shadow: 0 0 10px rgba(255,190,90,.5); }
.bars i.fc { background: none; border: 1px dashed var(--gold-hi); border-bottom: 0; }
.artefact:hover .bars i, .artefact:focus-within .bars i { transform: scaleY(1.06); }
/* this portfolio: the castle, two windows twinkling */
.minic { width: 100%; }
.minic use { fill: rgba(201,164,92,.55); }
.minic .tw { fill: #ffd27f; animation: twinkle-win 2.8s ease-in-out infinite; }
.minic .t2 { animation-delay: -1.4s; }
@keyframes twinkle-win { 50% { opacity: .25; } }

/* Dossiers */
dialog { padding: 0; border: 0; }
dialog::backdrop { background: rgba(2,10,14,.78); }
.prophet {
  width: min(960px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow: auto;
  color: #241a10; border-radius: 2px;
  background: radial-gradient(ellipse at 20% 10%, rgba(255,250,235,.55), transparent 55%), radial-gradient(ellipse at 85% 90%, rgba(150,110,50,.18), transparent 60%), linear-gradient(#ece2c6, #e3d6b4);
  box-shadow: 0 30px 80px rgba(0,0,0,.7); padding: clamp(22px, 4vw, 44px);
}
.prophet[open] { animation: rise .35s ease-out; }
@keyframes rise { from { opacity: 0; } to { opacity: 1; } } /* opacity only: a transform would trap the fixed wand inside the dialog */
.prophet .x { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; background: none; font-size: 1.2rem; color: var(--quill); cursor: pointer; border-radius: 50%; }
.prophet .x:hover { background: rgba(43,29,18,.1); }
.np-head { text-align: center; margin-bottom: 18px; }
.np-ears { display: flex; justify-content: space-between; margin: 0 0 6px; font: italic .9rem/1 "Old Standard TT", var(--body); color: #4a3826; }
.masthead { font: 400 clamp(2.4rem, 7vw, 4.4rem)/1 "UnifrakturMaguntia", var(--deco); margin: 0; padding: 8px 0 10px; border-top: 3px solid #241a10; }
.np-date { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0; padding: 6px 2px; border-top: 1px solid #241a10; border-bottom: 3px double #241a10;
  font: 400 .82rem/1.2 "Old Standard TT", var(--body); letter-spacing: .08em; text-transform: uppercase; }
.prophet .np-hl { font: 700 clamp(1.9rem, 4.6vw, 3.1rem)/1.02 "Old Standard TT", Georgia, serif; text-align: center; letter-spacing: -.01em; margin: 6px 0 10px; text-wrap: balance; }
.deck { font: italic 400 1.22rem/1.45 "Old Standard TT", var(--body); text-align: center; max-width: 42rem; margin: 0 auto 10px; color: #3a2a1a; text-wrap: balance; }
.byline { text-align: center; margin: 0 0 18px; padding-bottom: 12px; border-bottom: 1px solid rgba(36,26,16,.45); font: .8rem/1 "Old Standard TT", var(--body); letter-spacing: .14em; text-transform: uppercase; color: #4a3826; }
.np-body { columns: 3 15rem; column-gap: 28px; column-rule: 1px solid rgba(36,26,16,.3); font: 400 1.04rem/1.5 var(--body); text-align: justify; hyphens: auto; }
.np-body p { margin: 0 0 .8em; }
.np-body .lead { font-size: 1.1rem; }
.np-body .lead::first-letter { float: left; font: 700 3.6em/.82 "Old Standard TT", Georgia, serif; padding: 4px 8px 0 0; color: #241a10; }
.np-box { break-inside: avoid; margin: 0 0 1em; padding: 14px 16px; border: 1px solid #241a10; box-shadow: inset 0 0 0 3px #e7dcbd, inset 0 0 0 4px rgba(36,26,16,.5); text-align: left; }
.np-box ul li { font-size: .98rem; }
.np-fig { margin: 18px 0 0; padding: 16px; border: 1px solid rgba(36,26,16,.45); background: rgba(255,255,255,.18); }
.np-fig figcaption { margin-top: 12px; font: italic .92rem/1.4 "Old Standard TT", var(--body); color: #4a3826; text-align: center; }
.prophet h3 { font: 700 .82rem/1 "Old Standard TT", var(--body); letter-spacing: .16em; text-transform: uppercase; margin: 0 0 10px; color: var(--burgundy); }
.prophet h3:not(:first-child) { margin-top: 22px; }
.prophet ul li { padding-left: 1.1em; position: relative; margin-bottom: .45em; }
.prophet ul li::before { content: "✦"; position: absolute; left: 0; color: var(--burgundy); font-size: .7em; top: .4em; }
.prophet .tech { color: var(--quill-soft); }
.prophet .metric { color: var(--burgundy); }
.prophet .links { margin: 16px 0 0; }

/* ===== Sorting Hat ===== */
.hat-sec { display: flex; align-items: center; justify-content: center; gap: clamp(24px, 6vw, 80px); flex-wrap: wrap; }
.hat-stage { display: grid; justify-items: center; gap: 10px; }
.hat { transition: transform .35s ease; }
.banner { width: 180px; height: 0; overflow: hidden; transition: height .6s cubic-bezier(.3,.8,.3,1); }
.banner span { display: block; height: 70px; padding-top: 18px; text-align: center; font: 700 1.1rem/1 var(--deco); letter-spacing: .06em; color: #fff4d8;
  background: linear-gradient(90deg, rgba(0,0,0,.2), transparent 20% 80%, rgba(0,0,0,.2)), var(--house, var(--gold));
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); box-shadow: inset 0 0 0 3px rgba(255,240,200,.25); }
.hat-sec[data-house] .banner { height: 70px; }
.hat-q { margin: 6px 0 14px; }
.q-count { font: .78rem/1 var(--mono); color: #7fb7c8; margin-bottom: 8px; }
.q { font: 600 1.25rem/1.35 var(--display); color: #f4efe2; margin-bottom: 12px; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.answers button { min-height: 52px; padding: 10px 14px; text-align: left; border-radius: 4px; border: 1px solid rgba(201,164,92,.35); background: rgba(8,34,44,.85); color: var(--text); font: italic 1.05rem/1.3 var(--fell); cursor: pointer; transition: border-color .3s, transform .3s, background-color .3s; }
.answers button:hover, .answers button:focus-visible { border-color: var(--gold-hi); transform: translateY(-2px); background: rgba(201,164,92,.12); }
.hat-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 560px) { .answers { grid-template-columns: 1fr; } }
.hat { width: clamp(180px, 26vw, 260px); background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; }
.hat .frames { position: relative; aspect-ratio: 400 / 381; filter: drop-shadow(0 18px 24px rgba(0,0,0,.6)); transition: filter .6s, transform .4s; transform-origin: 50% 90%; }
.hat .f { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; transition: opacity .35s ease; }
.hat .f-idle { opacity: 1; }
.hat-sec[data-house] .hat .f-idle { opacity: 0; }
.hat-sec[data-house] .hat .f-happy { opacity: 1; }
/* talking: main.js steps data-f through talk / excited / happy while the hat speaks; each frame crossfades into the next */
.hat-sec .hat:not(.thinking)[data-f] .f { opacity: 0; transition-duration: .2s; }
.hat-sec .hat:not(.thinking)[data-f="talk"] .f-talk,
.hat-sec .hat:not(.thinking)[data-f="excited"] .f-excited,
.hat-sec .hat:not(.thinking)[data-f="happy"] .f-happy { opacity: 1; }
.hat.speaking:not(.thinking) .frames { animation: chatter .46s ease-in-out infinite alternate; }
@keyframes chatter { from { transform: translateY(0) rotate(-.8deg) scale(1); } to { transform: translateY(-3px) rotate(.8deg) scale(1.012); } }
/* thinking (approved): squint frame plus the rock-and-bob */
.hat-sec .hat.thinking .f { opacity: 0; }
.hat-sec .hat.thinking .f-think { opacity: 1; }
.hat:hover .frames { transform: rotate(-3deg); }
.hat.thinking .frames { animation: ponder .5s ease-in-out infinite alternate; }
@keyframes ponder { from { transform: rotate(-6deg) translateY(0); } to { transform: rotate(6deg) translateY(-6px); } }
.hat-sec[data-house] .hat .frames { filter: drop-shadow(0 18px 24px rgba(0,0,0,.6)) drop-shadow(0 0 30px var(--house)); }
.hat-sec[data-house="gryffindor"] { --house: var(--gryffindor); }
.hat-sec[data-house="ravenclaw"] { --house: var(--ravenclaw); }
.hat-sec[data-house="hufflepuff"] { --house: var(--hufflepuff); }
.hat-sec[data-house="slytherin"] { --house: var(--slytherin); }
.hat-sec[data-house="all"] { --house: var(--gold); }
.hat-text { max-width: 38rem; }
.say { font: italic 1.35rem/1.5 var(--fell); color: #efe9da; min-height: 4.6em; }
.say .verdict { display: block; margin-top: .4em; font: 700 1.6rem/1.1 var(--deco); font-style: normal; color: var(--house, var(--gold-hi)); text-shadow: 0 0 18px var(--house, transparent); filter: brightness(1.35); }
.hint-inline { display: block; font-size: 1rem; color: var(--stone); margin-top: .4em; }

/* ===== Wizarding Journey ===== */
.diary { max-width: 900px; margin: 0 auto; position: relative; padding-left: 34px; }
.diary::before { content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 0; border-left: 1px dashed rgba(217,196,143,.45); }
.entry {
  position: relative; margin-bottom: 26px; padding: 26px clamp(20px, 3vw, 34px);
  color: var(--quill); border-radius: 2px; background: var(--parchment);
  box-shadow: 0 18px 40px -18px rgba(0,0,0,.8), inset 0 0 50px rgba(150,110,50,.18);
}
.entry::before { content: ""; position: absolute; left: -31px; top: 26px; width: 16px; height: 20px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 40' fill='%23d9c48f'%3E%3Cellipse cx='9' cy='9' rx='5' ry='8'/%3E%3Cellipse cx='9' cy='24' rx='3.6' ry='4.4'/%3E%3Cellipse cx='23' cy='17' rx='5' ry='8'/%3E%3Cellipse cx='23' cy='32' rx='3.6' ry='4.4'/%3E%3C/svg%3E") center / contain no-repeat; }
.entry.award { background-color: #f4e8c6; outline: 1px solid rgba(107,29,42,.35); outline-offset: -8px; }
.entry time { font: 600 .76rem/1 var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--burgundy); }
.entry h3 { font: 600 1.42rem/1.25 var(--display); margin: 10px 0 12px; }
.entry h3 span { font: italic 400 1.2rem/1.25 var(--fell); color: var(--quill-soft); }
.entry ul li { position: relative; padding-left: 1.2em; margin-bottom: .45em; font-size: 1.1rem; }
.entry ul li::before { content: "~"; position: absolute; left: 0; color: var(--burgundy); }
.entry .tech { color: var(--quill-soft); }
.quill-link { display: inline-block; margin-top: 10px; font: italic 1.08rem/1 var(--fell); color: var(--burgundy); }

/* ===== Spellbook: four spell cards ===== */
.spells { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.spell { position: relative; padding: 0 26px 24px; border-radius: 6px; overflow: hidden; background: rgba(8,30,39,.9); border: 1px solid rgba(201,164,92,.28); box-shadow: 0 24px 50px -30px rgba(0,0,0,.9); }
.spine { display: flex; align-items: center; gap: 14px; margin: 0 -26px 18px; padding: 14px 26px; background: linear-gradient(90deg, #4a1620, #6b1d2a 60%, #4a1620); border-bottom: 1px solid rgba(201,164,92,.55); box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }
.spine .num { display: grid; place-items: center; min-width: 36px; height: 36px; padding: 0 6px; border: 1px solid var(--gold); border-radius: 50%; font: 600 .9rem/1 var(--display); color: var(--gold-hi); }
.spine h3 { font: 600 1.35rem/1.2 var(--display); color: #f6eedb; letter-spacing: .04em; }
.spell-blurb { color: var(--text-soft); font-size: 1.08rem; margin: 0 0 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 6px 14px; border-radius: 999px; font: 500 1.05rem/1.3 var(--body); color: #eef0ec; background: rgba(255,255,255,.05); border: 1px solid rgba(195,205,208,.3); }
.chips li.used { color: #fff4d6; border-color: var(--gold); background: rgba(201,164,92,.14); }
.chips li.used::before { content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 8px 2px 0; border-radius: 50%; background: var(--gold-hi); box-shadow: 0 0 8px rgba(236,211,154,.8); }
.gold-dot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--gold-hi); box-shadow: 0 0 8px rgba(236,211,154,.8); }
.used-in { margin: 18px 0 0; padding-top: 14px; border-top: 1px dashed rgba(201,164,92,.3); font-size: 1.02rem; color: var(--text-soft); }
.used-in span { font: .82rem/1 var(--mono); color: var(--gold); text-transform: lowercase; margin-right: 6px; }
.used-in a { color: var(--gold-hi); text-underline-offset: 3px; }
.spell.rv:nth-child(2) { transition-delay: .08s; } .spell.rv:nth-child(3) { transition-delay: .16s; } .spell.rv:nth-child(4) { transition-delay: .24s; }
@media (max-width: 760px) { .spells { grid-template-columns: 1fr; } .spell { padding: 0 18px 20px; } .spine { margin: 0 -18px 16px; padding: 12px 18px; } }

/* ===== Hogwarts Records ===== */
.records-grid { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 280px 1fr; gap: clamp(28px, 5vw, 60px); align-items: start; }
.records-grid > * { min-width: 0; }
.portrait { margin: 0; grid-row: span 2; text-align: center; }
.frame { padding: 14px; border-radius: 150px 150px 8px 8px; background: linear-gradient(135deg, #8c6a2f, #e9d18f 30%, #a7843f 55%, #dcc27f 80%, #7d5c26); box-shadow: 0 30px 50px -20px rgba(0,0,0,.9), inset 0 0 0 2px #5e4419; }
.sitter { position: relative; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 136px 136px 2px 2px; background: radial-gradient(ellipse at 50% 35%, #12404f, #061c24 75%); box-shadow: inset 0 0 40px rgba(0,0,0,.8); cursor: pointer; }
.sitter img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; transform: scale(1.05); filter: brightness(.7); transition: transform .9s cubic-bezier(.2,.7,.2,1) .25s, filter .9s ease .25s; }
.frame.open .sitter img { transform: none; filter: none; }
/* a moving portrait: the video fades in over the still once it is actually playing */
.sitter-vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s ease; pointer-events: none; }
.sitter-vid.playing { opacity: 1; }
.sitter::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 40px rgba(0,0,0,.65), inset 0 0 0 1px rgba(236,211,154,.25); }
.sitter { container-type: inline-size; }
.bricks { position: absolute; inset: 0; }
.bricks i { position: absolute; overflow: hidden; width: 25%; height: calc(100% / 9); border-radius: 1px;
  background: linear-gradient(180deg, #5a3a2c, #44291f 60%, #36211a); box-shadow: inset 0 0 0 1.5px #1e140f, inset 2px 2px 0 rgba(255,220,190,.08), inset -2px -3px 4px rgba(0,0,0,.35);
  transition: transform .55s cubic-bezier(.5,0,.2,1), opacity .45s ease; transition-delay: calc(var(--dr) * 30ms); }
.bricks b { position: absolute; width: 400%; height: 900%; display: grid; place-items: center; pointer-events: none;
  font: 700 34cqw/1 var(--deco); color: var(--gold); text-shadow: 0 2px 0 #3a2410, 0 0 18px rgba(236,211,154,.35); }
.bricks i:nth-child(3n) { background: linear-gradient(180deg, #63402f, #4b2e22 60%, #3a241b); }
.bricks i:nth-child(5n+1) { background: linear-gradient(180deg, #4f3427, #3d251c 60%, #2f1d16); }
.frame.open .bricks i { opacity: 0; transition-delay: calc(var(--d) * 30ms);
  transform: translate(calc(var(--s) * 70%), calc(var(--s) * -90%)) rotate(calc(var(--s) * 28deg)) scale(.55); }
.brick-hint { display: block; margin-top: 8px; font: .8rem/1 var(--mono); color: var(--stone); font-style: normal; transition: opacity .4s; }
.frame.open + figcaption .brick-hint { opacity: 0; }
.portrait figcaption { margin-top: 14px; font: italic 1.08rem/1 var(--fell); color: var(--gold-hi); }
/* About: a parchment scroll that unrolls */
.scroll { position: relative; }
.rod { display: block; position: relative; height: 18px; margin: 0 -14px; border-radius: 9px; background: linear-gradient(#7a5232, #3b2414 60%, #24140a); box-shadow: 0 6px 12px rgba(0,0,0,.5); z-index: 1; }
.rod::before, .rod::after { content: ""; position: absolute; top: -4px; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #f1d79a, #a8843f 60%, #6b4f20); }
.rod::before { left: -18px; } .rod::after { right: -18px; }
.scroll-body { display: grid; grid-template-rows: 1fr; margin: -9px 0; background: var(--parchment); box-shadow: inset 0 14px 18px -12px rgba(80,55,25,.5), inset 0 -14px 18px -12px rgba(80,55,25,.5), inset 0 0 50px rgba(150,110,50,.2); }
.js .scroll .scroll-body { clip-path: inset(0 0 0 0); transition: clip-path 1.9s cubic-bezier(.45,.05,.25,1) .2s; }
.js .scroll:not(.in) .scroll-body { clip-path: inset(0 0 100% 0); }
.js .scroll .rod:last-child { transition: transform 1.9s cubic-bezier(.45,.05,.25,1) .2s; }
.js .scroll:not(.in) .rod:last-child { transform: translateY(calc(-1 * var(--scroll-h, 300px) + 18px)); }
.scroll-inner { overflow: hidden; min-height: 0; padding: 0 clamp(20px, 3vw, 36px); color: var(--quill); }
.scroll-inner > :first-child { margin-top: 32px; } .scroll-inner > :last-child { margin-bottom: 30px; }
.about blockquote { margin: 0 0 18px; font: italic 400 clamp(1.35rem, 2.4vw, 1.75rem)/1.4 var(--fell); color: var(--quill); border-left: 2px solid var(--burgundy); padding-left: 18px; }
.about p { color: var(--quill); }

/* Education: a complete, sealed envelope that opens when it comes into view */
.envelope { padding: 0 3%; }
.env { position: relative; padding-bottom: 110px; perspective: 1200px; }
.env-back, .env-front, .env-flap { position: absolute; left: 0; right: 0; }
.env-back { bottom: 0; height: 240px; background: #b9a26c; border-radius: 4px; box-shadow: 0 24px 50px -20px rgba(0,0,0,.9); }
.env .letter { z-index: 1; padding-bottom: 150px; transform-origin: 50% 100%; }
.env-front { bottom: 0; height: 240px; z-index: 2; border-radius: 0 0 4px 4px; background: linear-gradient(#e3d1a2, #cdb77f);
  clip-path: polygon(0 0, 50% 44%, 100% 0, 100% 100%, 0 100%); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 26px; }
.env-front::after { content: ""; position: absolute; inset: 0; background: linear-gradient(24deg, transparent 49.7%, rgba(90,65,30,.22) 50%, transparent 50.3%), linear-gradient(-24deg, transparent 49.7%, rgba(90,65,30,.22) 50%, transparent 50.3%); }
.address { position: relative; z-index: 1; margin: 0; text-align: center; font: italic 1.15rem/1.35 var(--fell); color: #1f5a3a; }
.env-flap { top: calc(100% - 240px); height: 120px; z-index: 0; transform-origin: 50% 0; background: linear-gradient(#d6c391, #c3ac74); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.env-seal { position: absolute; left: 50%; bottom: 89px; z-index: 4; width: 62px; height: 62px; translate: -50% 0; }
.env-seal i { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font: 700 1.05rem/1 var(--deco); font-style: normal; color: #f0c9b0;
  background: radial-gradient(circle at 40% 35%, #b43a4b, #7a1b29 60%, #4f0f1a); box-shadow: 0 6px 14px rgba(0,0,0,.5), inset 0 0 0 5px rgba(0,0,0,.18); }
.env-seal i:first-child { clip-path: polygon(0 0, 52% 0, 46% 50%, 54% 100%, 0 100%); }
.env-seal i:last-child { clip-path: polygon(52% 0, 100% 0, 100% 100%, 54% 100%, 46% 50%); }
/* closed state (JS only): flap down over the letter, letter folded inside, seal whole */
.js .envelope:not(.open) .env-flap { transform: none; z-index: 3; }
.js .envelope:not(.open) .env .letter { transform: translateY(80px) scaleY(.3); }
.js .envelope .env-flap { transition: transform .8s ease .45s, z-index 0s .85s; }
.js .envelope.open .env-flap { transform: rotateX(180deg); z-index: 0; }
.js .envelope .env .letter { transition: transform 1.2s cubic-bezier(.3,.7,.2,1) 1.1s; }
.js .envelope .env-seal i { transition: transform .6s ease, opacity .6s ease .25s; }
.js .envelope.open .env-seal i:first-child { transform: translate(-16px, 6px) rotate(-24deg); opacity: 0; }
.js .envelope.open .env-seal i:last-child { transform: translate(16px, 6px) rotate(24deg); opacity: 0; }
html:not(.js) .env-seal, .envelope.open .env-seal { pointer-events: none; }

/* The House Points Ledger: LeetCode / GitHub activity heatmap */
.ledger { grid-column: 1 / -1; padding: 26px clamp(18px, 3vw, 32px); border-radius: 6px; background: rgba(8,34,44,.85); border: 1px solid rgba(201,164,92,.28); }
.ledger-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.ledger h3 { font: 600 1.35rem/1.2 var(--display); color: #f4efe2; }
.ledger-src { display: flex; gap: 6px; }
.ledger-src button { min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(201,164,92,.4); background: none; cursor: pointer; font: 600 .74rem/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--text-soft); transition: background-color .3s, color .3s; }
.ledger-src [aria-pressed="true"] { background: rgba(201,164,92,.16); color: var(--gold-hi); }
.ledger-sum { color: var(--text-soft); font-size: 1.02rem; }
.ledger-sum strong { color: var(--gold-hi); font-weight: 500; }
.ledger-scroll { overflow-x: auto; padding-bottom: 6px; }
.ledger-months { position: relative; height: 18px; min-width: max-content; font: italic .8rem/1 var(--fell); color: var(--stone); }
.ledger-months span { position: absolute; top: 0; }
.ledger-grid { display: grid; grid-template-rows: repeat(7, 13px); grid-auto-flow: column; grid-auto-columns: 13px; gap: 3px; width: max-content; }
.ledger-grid i, .ledger-legend i { display: block; width: 13px; height: 13px; border-radius: 3px; }
.l0 { background: rgba(201,164,92,.07); box-shadow: inset 0 0 0 1px rgba(201,164,92,.1); }
.l1 { background: rgba(201,164,92,.3); }
.l2 { background: rgba(201,164,92,.55); }
.l3 { background: rgba(236,211,154,.85); }
.l4 { background: #fff1c4; box-shadow: 0 0 6px rgba(255,225,150,.8); }
.ledger-grid i { transition: opacity .6s ease; }
.ledger-legend { display: flex; align-items: center; gap: 4px; margin: 12px 0 0; font: .84rem/1 var(--mono); color: var(--stone); flex-wrap: wrap; }
.ledger-legend i { display: inline-block; }
.ledger-upd { margin-left: auto; }
.ledger-legend[hidden], .ledger-scroll[hidden], .ledger-chart[hidden] { display: none; }
.letter { position: relative; color: var(--quill); padding: 32px clamp(22px, 4vw, 40px) 40px; border-radius: 2px; background: var(--parchment); box-shadow: 0 24px 50px -20px rgba(0,0,0,.9), inset 0 0 60px rgba(150,110,50,.22); }
.letter-from { font: 600 .76rem/1 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--burgundy); }
.letter h3 { font: 600 1.45rem/1.25 var(--display); margin-bottom: 8px; }
.letter-meta { font: italic 1.18rem/1.4 var(--fell); color: var(--quill-soft); }
.letter-meta strong { font-style: normal; font-family: var(--display); color: var(--quill); }
.profiles { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; grid-column: 2; }
.profile { display: flex; flex-direction: column; gap: 6px; padding: 22px; text-decoration: none; border-radius: 4px; background: rgba(8,34,44,.85); border: 1px solid rgba(201,164,92,.28); transition: transform .4s, border-color .4s; }
.profile:hover { transform: translateY(-3px); border-color: var(--gold-hi); }
.p-label { font: 600 .74rem/1 var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.p-big { font: 700 2rem/1 var(--deco); color: #f4efe2; }
.p-sub { font: .9rem/1.4 var(--mono); color: var(--stone); }
@media (max-width: 860px) {
  .records-grid { grid-template-columns: 1fr; }
  .portrait { grid-row: auto; max-width: 240px; margin: 0 auto; }
  .profiles { grid-column: auto; }
}
@media (max-width: 480px) { .profiles { grid-template-columns: 1fr; } }

/* ===== Owl Post ===== */
/* ===== Write a Howler (contact form) ===== */
.howler { position: relative; margin: 4px 0 0; max-width: 44rem; display: grid; gap: 18px; color: var(--quill); padding: clamp(22px, 3.5vw, 32px); border-radius: 4px; background: var(--parchment); box-shadow: 0 24px 50px -20px rgba(0,0,0,.9), inset 0 0 60px rgba(150,110,50,.22); transition: opacity .45s ease, transform .55s cubic-bezier(.3,.8,.3,1); }
.howler[hidden], .howler-done[hidden] { display: none; }
.howler.is-sent { opacity: 0; transform: translateY(-26px) scale(.95); pointer-events: none; }
.howler.is-sending { opacity: .6; transform: scale(.985); pointer-events: none; }
.howler h3, .howler-done h3 { font: 700 1.6rem/1.2 var(--display); margin: 0; color: var(--quill); }
.howler-sub { font: italic 1.2rem/1.4 var(--fell); color: var(--quill); margin: -8px 0 0; }
.howler .row2 { display: grid; grid-template-columns: 1.1fr 1.3fr .9fr; gap: 14px; }
.howler .fld { display: grid; gap: 7px; }
.howler label, .howler legend { font: 700 .82rem/1.2 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--quill); }
.howler input[type="text"], .howler input[type="email"], .howler textarea { width: 100%; min-height: 48px; padding: 12px 14px; font: 1.15rem/1.4 var(--fell); color: #1d1408; background: #fbf6e6; border: 1.5px solid rgba(43,29,18,.6); border-radius: 4px; box-shadow: inset 0 1px 3px rgba(43,29,18,.12); transition: border-color .3s, box-shadow .3s, background-color .3s; }
.howler select { width: 100%; min-height: 48px; padding: 12px 38px 12px 14px; font: 1.15rem/1.4 var(--fell); color: #1d1408; background: #fbf6e6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%232b1d12' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center; border: 1.5px solid rgba(43,29,18,.6); border-radius: 4px; appearance: none; -webkit-appearance: none; cursor: pointer; box-shadow: inset 0 1px 3px rgba(43,29,18,.12); transition: border-color .3s, box-shadow .3s; }
.howler select:focus-visible { outline: 0; border-color: var(--burgundy); box-shadow: 0 0 0 3px rgba(107,29,42,.22); }
.howler textarea { resize: vertical; min-height: 116px; }
.howler ::placeholder { color: #7a634c; opacity: 1; }
.howler input:focus-visible, .howler textarea:focus-visible { outline: 0; border-color: var(--burgundy); box-shadow: 0 0 0 3px rgba(107,29,42,.22); background: #fffdf4; }
.howler .is-bad { border-color: #b3261e !important; box-shadow: 0 0 0 3px rgba(179,38,30,.16) !important; }
.howler .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.howler-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.howler-msg { font: italic 1.12rem/1.3 var(--fell); color: var(--quill); }
.howler-msg.err { color: #9c1c14; font-weight: 600; }
.howler-done { max-width: 44rem; margin: 4px 0 0; display: grid; gap: 12px; justify-items: start; padding: clamp(22px, 3.5vw, 32px); border-radius: 4px; color: var(--quill); background: var(--parchment); box-shadow: 0 24px 50px -20px rgba(0,0,0,.9), inset 0 0 60px rgba(150,110,50,.22); animation: howler-in .7s cubic-bezier(.3,.8,.3,1) both; }
.howler-done p { font: italic 1.2rem/1.45 var(--fell); color: var(--quill); margin: 0; }
.howler-done .btn-ghost { color: var(--quill); background: rgba(43,29,18,.06); border-color: rgba(43,29,18,.45); }
@keyframes howler-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) { .howler .row2 { grid-template-columns: 1fr 1fr; } .howler .row2 .fld:first-child { grid-column: 1 / -1; } }
@media (max-width: 560px) { .howler .row2 { grid-template-columns: 1fr; } .howler-actions .btn { width: 100%; } }

.owlpost { display: grid; grid-template-columns: minmax(220px, 340px) 1fr; gap: clamp(28px, 4vw, 56px) clamp(28px, 6vw, 80px); align-items: start; }
.owlery { align-self: center; }
.post-links { grid-column: 1 / -1; width: 100%; max-width: 62rem; margin: 6px auto 0; }
#owl-post { padding-inline: max(var(--gutter), calc((100% - 1180px) / 2)); }
.window { position: relative; aspect-ratio: 3 / 4; border-radius: 170px 170px 6px 6px; overflow: hidden; background: radial-gradient(ellipse at 65% 25%, #134a5c, #072531 60%, #041820); border: 8px solid #2d2019; outline: 1px solid rgba(201,164,92,.45); outline-offset: 5px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.9), inset 0 0 40px rgba(0,0,0,.8); }
.w-moon { position: absolute; right: 18%; top: 14%; width: 22%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #e9e2d0, #b9ae96); opacity: .75; box-shadow: 0 0 30px 8px rgba(230,220,190,.15); }
.perch { position: absolute; left: 10%; right: 10%; bottom: 20%; height: 10px; border-radius: 6px; background: linear-gradient(#5a3a22, #2e1c10); }
.post-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 1.4rem 0 1.4rem; }
.post-actions .btn { min-height: 52px; }
.copied { font: italic 1.05rem/1 var(--fell); color: #a8e6b8; }
.addresses { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; list-style: none; margin: 0; padding: 0; }
.addresses li:first-child { grid-column: span 2; }
.addresses a { display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 18px 20px; min-height: 48px; text-decoration: none; color: #f2ede0; font-size: 1.12rem; line-height: 1.3; overflow-wrap: anywhere; border-radius: 4px; background: rgba(8,34,44,.85); border: 1px solid rgba(201,164,92,.28); transition: transform .4s, border-color .4s; }
.addresses a span { font: 600 .74rem/1 var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.post-links .local-time { margin: 22px 0 0; text-align: center; }
.addresses a:hover { transform: translateY(-3px); border-color: var(--gold-hi); color: var(--gold-hi); }
@media (max-width: 760px) { .addresses { grid-template-columns: 1fr 1fr; } .addresses li:first-child { grid-column: 1 / -1; } }
@media (max-width: 480px) { .addresses { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .owlpost { grid-template-columns: 1fr; }
  .owlery { width: 220px; margin: 0 auto; }
  .post-actions .btn { flex: 1 1 100%; }
}

/* ===== Footer: closing scene, a small castle on a full-width horizon, the classic columns ===== */
.foot { position: relative; z-index: 1; overflow: hidden; color: var(--stone); background: linear-gradient(180deg, transparent, #061d26 22%, #04141b 70%); }
.foot-sky { position: absolute; inset: 0 0 auto; height: 70%; pointer-events: none; }
.foot-sky .stars { position: absolute; inset: 0; opacity: .8;
  background-image: radial-gradient(1.2px 1.2px at 20px 30px, #fff, transparent), radial-gradient(1px 1px at 90px 120px, #cfeaff, transparent), radial-gradient(1.4px 1.4px at 160px 60px, #fff, transparent), radial-gradient(1px 1px at 230px 170px, #fff6d5, transparent), radial-gradient(1px 1px at 60px 200px, #fff, transparent);
  background-size: 260px 240px; }
.foot-sky .s2 { background-position: 130px 90px; opacity: .45; }
.foot.onscreen .foot-sky .s2 { animation: twinkle 4s ease-in-out infinite alternate; }
@keyframes twinkle { to { opacity: .9; } }
.foot-moon { position: absolute; right: 12%; top: 70px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #fff9e6, #e8dcb4 55%, #c9b98a);
  box-shadow: 0 0 40px rgba(255,240,200,.45), 0 0 120px rgba(255,240,200,.2); opacity: .85; }
.foot-hero { position: relative; z-index: 2; max-width: 900px; margin: 0 auto; padding: clamp(110px, 14vw, 170px) var(--gutter) 0; text-align: center; }
.foot-kicker { margin: 0 0 14px; font: .9rem/1 var(--mono); color: #8fc3d2; }
.foot-title { font: 600 clamp(2rem, 5vw, 3.6rem)/1.1 var(--display); color: #f4efe2; margin: 0 0 14px; }
.hp-word { font: 400 1.25em/1 "Harry P", var(--display); letter-spacing: .02em; color: transparent;
  background: linear-gradient(180deg, #ffffff 0%, #e6edf0 30%, #9fb0b8 48%, #5d6f78 52%, #c9d4d9 66%, #f4f7f8 82%, #a9b8bf 100%); -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 2px 0 rgba(10,20,26,.9)) drop-shadow(0 0 24px rgba(var(--glow), .3)); }
.foot-sub { margin: 0 auto 26px; max-width: 34rem; color: var(--text-soft); font-size: 1.12rem; }
.foot-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.foot-horizon { position: relative; height: clamp(150px, 16vw, 210px); margin-top: 26px; pointer-events: none; }
.foot-horizon .hills { position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; max-width: none; }
.hills .far { fill: #06212b; } .hills .near { fill: #03131a; }
.foot-horizon .hills.front { z-index: 1; }
.foot-castle { position: absolute; left: 50%; bottom: 4%; width: clamp(240px, 24vw, 340px); aspect-ratio: 1280 / 853; translate: -50% 0; }
.foot-castle .castle { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; left: 0; aspect-ratio: auto; }
.foot-castle .castle { filter: drop-shadow(0 -1px 0 rgba(160,215,240,.45)) drop-shadow(0 0 18px rgba(120,190,230,.15)); }
.foot-castle .castle .keep { fill: #0b2b37; }
.foot-castle .castle .shade { fill: #06202a; }
.foot-castle .castle .win { animation: none; }
.foot.onscreen .foot-castle .win.f { animation: window-glow 5s ease-in-out infinite alternate; }
@keyframes window-glow { to { opacity: .35; } }
.foot-ground { position: relative; background: #03131a; padding: 8px var(--gutter) 30px; }
/* the classic three columns */
.v-classic { display: grid; max-width: 1080px; margin: 0 auto; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; padding: 20px 0 30px; }
.foot-brand .mono { display: inline-block; margin-bottom: 14px; }
.foot-name { margin: 0; font: 500 1.35rem/1.2 var(--display); color: #f4efe2; letter-spacing: .04em; }
.foot-role { margin: 4px 0 14px; font: .9rem/1.4 var(--mono); color: var(--gold-hi); }
.foot .local-time { margin: 0; font: 500 1rem/1.5 var(--body); color: var(--text-soft); max-width: 22rem; }
.foot-col h2 { margin: 0 0 14px; font: .84rem/1 var(--mono); color: var(--gold); letter-spacing: .08em; text-transform: lowercase; }
.foot-col li + li { margin-top: 4px; }
.foot-col a { display: inline-flex; align-items: center; min-height: 40px; padding: 0; color: #eef0ec; text-decoration: none; font-size: 1.05rem; transition: color .2s, translate .2s; }
.foot-col a:hover, .foot-col a:focus-visible { color: var(--gold-hi); translate: 4px 0; }

.foot-bar { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 10px 28px; flex-wrap: wrap; padding: 18px 0; border-top: 1px solid rgba(195,205,208,.14); font-size: .92rem; }
.foot-bar p { margin: 0; }
.to-top { margin-left: auto; min-height: 40px; padding: 8px 16px; border-radius: 999px; cursor: pointer; font: .9rem/1 var(--body); color: var(--gold-hi); background: rgba(201,164,92,.08); border: 1px solid rgba(201,164,92,.45); }
.to-top:hover { background: rgba(201,164,92,.18); }
.local-time { font: 500 1.02rem/1.4 var(--body); color: var(--text-soft); }

.foot-toggle { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; background: none; color: var(--stone); opacity: .35; font-size: .9rem; transition: opacity .2s, color .2s; }
.foot-toggle:hover, .foot-toggle:focus-visible { opacity: 1; color: var(--gold-hi); }

@media (max-width: 760px) {
  .foot-moon { width: 60px; height: 60px; top: 50px; right: 8%; }
  .v-classic { grid-template-columns: 1fr 1fr; gap: 28px 20px; }
  .foot-brand { grid-column: 1 / -1; }
  .to-top { margin-left: 0; }
}

/* ===== Mobile hero ===== */
@media (max-width: 640px) {
  .castle { width: 210%; max-width: none; left: -22%; height: auto; aspect-ratio: 1280 / 853; }
  .moon { width: 74vw; left: 30%; top: 20%; opacity: .42; }
  .stars { inset: 0 0 55%; }
  .hero { place-items: start center; }
  .hero-copy { padding-top: 112px; }
  .hero-copy::before { inset: 4% -12% -6%; }
  .kicker { font-size: .8rem; }
  .role { font-size: .9rem; }
  .follow { bottom: 18px; }
  .tag { font-size: .74rem; padding: 2px 10px; }
  .statusbar [data-sb="contest"], .statusbar [data-sb="push"], .sb-branch { display: none; }
  .tag .room { display: none; }
  .perch-spot > .owl-slot { width: 34px; height: 34px; }
}

/* ===== Cinematic opening: push in on the castle as its windows light up ===== */
html.intro .scene { animation: push-in 1.8s cubic-bezier(.2,.7,.2,1) both; }
html.intro .castle .win { animation: light-up .5s ease-out both; animation-delay: calc(.45s + var(--g) * .18s); }
html.intro .hero-copy { animation: copy-in 1.2s ease-out .9s both; }
html.intro .topbar, html.intro .walker { animation: copy-in .8s ease-out 1.4s both; }
@keyframes push-in { from { transform: scale(1.12); filter: brightness(.35); } to { transform: none; filter: none; } }
@keyframes light-up { from { opacity: 0; } to { opacity: .72; } }
@keyframes copy-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }


/* ===== Coder bits: terminal line, editor status bar, palette chip ===== */
.statusbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; gap: 0; height: 28px; align-items: stretch; overflow: hidden;
  font: .74rem/28px var(--mono); color: #cfe3ea; background: rgba(2,12,17,.82); border-top: 1px solid rgba(201,164,92,.25); }
.sb-item { padding: 0 12px; white-space: nowrap; border-right: 1px solid rgba(201,164,92,.15); }
.sb-branch { background: rgba(201,164,92,.85); color: #1d1408; }
.sb-item .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #6fdc8c; box-shadow: 0 0 6px #6fdc8c; margin-right: 4px; }
.hero .follow { bottom: 44px; }
.cmdk { display: inline-flex; align-items: center; min-height: 36px; padding: 0 10px; border-radius: 6px; border: 1px solid rgba(201,164,92,.4); background: rgba(4,20,27,.6); cursor: pointer; }
.cmdk kbd { font: .74rem/1 var(--mono); color: var(--gold-hi); }
.topbar .cmdk { margin-left: 1.2rem; order: 3; }
@media (max-width: 860px) { .topbar .cmdk { order: 0; margin-left: 0; } }

/* ===== Command palette ===== */
.palette { width: min(620px, calc(100vw - 24px)); margin: 12vh auto auto; padding: 0; border-radius: 8px; color: var(--quill); background: #efe6cd; box-shadow: 0 30px 80px rgba(0,0,0,.7); }
.palette[open] { animation: rise .25s ease-out; }
.pal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid rgba(43,29,18,.2); }
.pal-prompt { font: 1rem/1 var(--mono); color: var(--burgundy); }
.pal-head input { flex: 1; border: 0; background: none; font: 1.05rem/1.4 var(--mono); color: var(--quill); outline: none; }
.pal-list { max-height: 50vh; overflow: auto; padding: 6px; }
.pal-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 5px; cursor: pointer; font: italic 1.08rem/1.2 var(--fell); }
.pal-list li small { font: .74rem/1.2 var(--mono); color: var(--quill-soft); font-style: normal; }
.pal-list li[aria-selected="true"] { background: rgba(107,29,42,.12); box-shadow: inset 3px 0 0 var(--burgundy); }
.pal-foot { margin: 0; padding: 10px 18px; border-top: 1px solid rgba(43,29,18,.2); font: .74rem/1 var(--mono); color: var(--quill-soft); }
.pal-foot kbd, .palette kbd { font: .72rem/1 var(--mono); padding: 2px 5px; border: 1px solid rgba(43,29,18,.3); border-radius: 3px; margin-right: 2px; }

/* ===== Room of Requirement: make the Daily Prophet obvious ===== */
.prophet-hint { display: flex; align-items: center; gap: 10px; margin: 1rem 0 0; padding-top: 1rem; border-top: 1px solid rgba(201,164,92,.25); max-width: 38rem; font: 500 1.05rem/1.45 var(--body); color: var(--gold-hi); }
.prophet-hint em { font-style: italic; }
.prophet-hint svg, .open-cue svg { width: 20px; height: 20px; flex: none; color: var(--gold); }
.open-cue { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid rgba(201,164,92,.55); border-radius: 999px; text-decoration: none; background: rgba(201,164,92,.08); font-style: italic; transition: background-color .3s, border-color .3s; }
.artefact:hover .open-cue, .artefact:focus-within .open-cue { background: rgba(201,164,92,.2); border-color: var(--gold-hi); }
.np-peek { position: absolute; right: -2px; bottom: 18px; width: 54px; height: 40px; pointer-events: none; border-radius: 2px 0 0 2px;
  background: repeating-linear-gradient(#efe6cd 0 5px, #d9ceb0 5px 6px); box-shadow: -2px 2px 6px rgba(0,0,0,.4);
  transform: translateX(40px) rotate(-6deg); opacity: 0; transition: transform .45s ease, opacity .45s ease; }
.artefact:hover .np-peek, .artefact:focus-within .np-peek, .np-peek.nudge { transform: translateX(14px) rotate(-6deg); opacity: 1; }
.stack { display: block; margin: .7rem 0 0; font: .88rem/1.6 var(--mono); color: var(--stone); }
.stack .k { color: #7fb7c8; } .stack .s { color: var(--gold-hi); } .stack .p { color: var(--stone); }

/* ===== Trophy Room (certificates) ===== */
.certs { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 24px; }
.cert { position: relative; overflow: hidden; height: 100%; padding: 30px 26px 26px; border-radius: 6px; text-align: center;
  background: linear-gradient(160deg, rgba(40,28,16,.9), rgba(16,12,8,.92)); border: 1px solid rgba(201,164,92,.4); box-shadow: inset 0 0 0 6px rgba(201,164,92,.08); }
.cert::after { content: ""; position: absolute; inset: -50%; background: linear-gradient(115deg, transparent 42%, rgba(255,240,200,.22) 50%, transparent 58%); transform: translateX(-60%); transition: transform .9s ease; pointer-events: none; }
.cert:hover::after { transform: translateX(60%); }
.cert-frame { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 50%; color: var(--gold-hi); border: 1px solid var(--gold); }
.cert h3 { font: 600 1.25rem/1.25 var(--display); color: #f4efe2; margin-bottom: 6px; }
.cert-meta { font: .9rem/1.4 var(--mono); color: var(--stone); }
.cert-link { font: italic 1rem/1 var(--fell); color: var(--gold-hi); }
.cert-link.is-todo { color: var(--stone); }

/* ===== Ledger: contest rating chart ===== */
.ledger-chart { position: relative; margin: 6px 0 4px; }
.ledger-chart svg { width: 100%; height: auto; max-height: 260px; overflow: visible; }
.ledger-chart .grid line { stroke: rgba(201,164,92,.12); }
.ledger-chart .grid text { fill: var(--stone); font: 11px var(--mono); }
.ledger-chart .line { fill: none; stroke: var(--gold-hi); stroke-width: 2; stroke-linejoin: round; filter: drop-shadow(0 0 4px rgba(236,211,154,.45)); }
.ledger-chart .area { fill: url(#lc-fill); }
.ledger-chart circle { fill: #04141b; stroke: var(--gold-hi); stroke-width: 2; cursor: pointer; }
.ledger-chart circle.peak { fill: var(--gold-hi); }
.ledger-chart circle:focus { outline: none; stroke: #fff; stroke-width: 3; }
.js .ledger-chart .line { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); transition: stroke-dashoffset 1.6s ease; }
.js .ledger.in .ledger-chart .line { stroke-dashoffset: 0; }
.chart-tip { position: absolute; pointer-events: none; padding: 6px 10px; border-radius: 4px; background: #efe6cd; color: var(--quill); font: .8rem/1.35 var(--mono); white-space: nowrap; translate: -50% calc(-100% - 12px); opacity: 0; transition: opacity .2s; }
.chart-tip.on { opacity: 1; }

/* ===== Patronus ===== */
.patronus { position: fixed; left: 0; top: 0; z-index: 87; width: 220px; height: 183px; pointer-events: none; opacity: 0; will-change: transform, opacity; contain: layout style; }
.patronus-glow { position: absolute; left: -110px; top: -110px; width: 440px; height: 367px; max-width: none; pointer-events: none; }
.patronus.live-glow { filter: drop-shadow(0 0 6px rgba(210,240,255,.95)) drop-shadow(0 0 22px rgba(150,210,255,.75)) drop-shadow(0 0 60px rgba(120,190,255,.45)); }
.patronus .doe { position: relative; }
.doe { width: 100%; height: 100%; overflow: visible; }
.doe .main, .doe .far { fill: #e8f6ff; stroke: #e8f6ff; }
.doe [data-leg] path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.doe .far { opacity: .5; }
.doe .lines { fill: none; stroke: rgba(255,255,255,.8); }
.doe .aura { fill: url(#doe-aura); stroke: none; }
.doe .fine { stroke: rgba(235,248,255,.5); stroke-width: .8; stroke-linecap: round; }
.doe .lash { stroke: rgba(255,255,255,.9); stroke-width: 1; stroke-linecap: round; }
.doe .eye { fill: #fff; stroke: none; }
.doe .strand { stroke-width: 1.3; stroke-linecap: round; stroke-dasharray: 10 16; animation: strand 1.6s linear infinite; }
.doe .tail { transform-box: fill-box; transform-origin: 100% 100%; animation: flick .4s ease-in-out infinite alternate; }
@keyframes strand { to { stroke-dashoffset: -52; } }
@keyframes flick { to { transform: rotate(12deg); } }
.cast-flash { position: fixed; inset: 0; z-index: 84; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at 50% 70%, rgba(220,240,255,1), rgba(170,215,255,.6) 45%, rgba(170,215,255,.25)); }
.rider { position: absolute; left: 0; top: 0; width: 90px; height: 68px; pointer-events: none; will-change: transform; opacity: 0; transition: opacity .6s; }
.rider.on { opacity: 1; }
.rider-svg { width: 100%; height: 100%; overflow: visible; animation: bob 2.4s ease-in-out infinite; filter: drop-shadow(0 0 1px rgba(236,211,154,.55)) drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
@keyframes bob { 50% { translate: 0 -5px; } }

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .rider { display: none; }
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .rain { display: none; }
  .js .rv { opacity: 1; transform: none; }
  }

/* ===== Static copies (scripting: none): the CausalFunnel heatmap snapshot keeps html.js but runs no JS, so show every reveal finished ===== */
@media (scripting: none) {
  .hero { min-height: var(--vh, 100svh); } /* --vh: the visitor's real screen height, set by main.js */
  .hero-copy { padding-top: clamp(110px, calc(var(--vh, 100vh) * .2), 200px); }
  .js .rv { opacity: 1; transform: none; }
  .js .kicker[data-cmd] .out { opacity: 1; }
  .js .scroll:not(.in) .scroll-body { clip-path: none; }
  .js .scroll:not(.in) .rod:last-child { transform: none; }
  .js .envelope:not(.open) .env-flap { transform: rotateX(180deg); z-index: 0; }
  .js .envelope:not(.open) .env .letter { transform: none; }
  .js .envelope:not(.open) .env-seal i { opacity: 0; }
  .js .ledger-chart .line { stroke-dashoffset: 0; }
  .orb .bars span::after { width: var(--v); }
}

/* ===== Spell Class (spell-class.html) and its teaser in the Spellbook ===== */
.sc-teaser { display: block; max-width: 1180px; margin: 22px auto 0; padding: 22px 26px; border-radius: 6px; text-decoration: none; color: var(--text);
  background: linear-gradient(100deg, rgba(107,29,42,.55), rgba(8,30,39,.9) 60%); border: 1px solid rgba(201,164,92,.45); transition: border-color .3s, transform .3s; }
.sc-teaser:hover, .sc-teaser:focus-visible { border-color: var(--gold-hi); transform: translateY(-2px); }
.sc-teaser-k { display: block; font: .84rem/1 var(--mono); color: var(--gold); margin-bottom: 8px; }
.sc-teaser-h { display: block; font: 600 1.4rem/1.2 var(--display); color: #f6eedb; margin-bottom: 6px; }
.sc-teaser-p { display: block; color: var(--text-soft); }
.sc-teaser-p b { color: var(--gold-hi); font-weight: 600; white-space: nowrap; }

.sc-page { --hc: var(--gold); background: radial-gradient(ellipse at 50% -10%, #0d3a48, var(--midnight) 60%) fixed; min-height: 100vh; }
.sc-page[data-house="gryffindor"] { --hc: var(--gryffindor); } .sc-page[data-house="ravenclaw"] { --hc: var(--ravenclaw); }
.sc-page[data-house="hufflepuff"] { --hc: var(--hufflepuff); } .sc-page[data-house="slytherin"] { --hc: var(--slytherin); }
.sc-back { margin-left: auto; color: var(--gold-hi); text-decoration: none; font: .9rem/1 var(--mono); }
.sc { max-width: 880px; margin: 0 auto; padding: 110px var(--gutter) 80px; }
.sc-head h1 { font: 600 clamp(2.4rem, 6vw, 3.8rem)/1.05 var(--display); color: #f4efe2; margin-bottom: .6rem; }
.sc-house { margin: 32px 0 26px; }
.sc-house-q { margin: 0 0 10px; font: .9rem/1.4 var(--mono); color: #8fc3d2; }
.sc-houses { display: flex; flex-wrap: wrap; gap: 10px; }
.sc-houses button { min-height: 44px; padding: 8px 18px; border-radius: 999px; cursor: pointer; font: 600 .95rem/1 var(--display); letter-spacing: .06em;
  color: #eef0ec; background: rgba(255,255,255,.04); border: 1px solid rgba(195,205,208,.35); transition: background-color .25s, border-color .25s; }
.sc-houses [data-house="gryffindor"] { --c: var(--gryffindor); } .sc-houses [data-house="ravenclaw"] { --c: var(--ravenclaw); }
.sc-houses [data-house="hufflepuff"] { --c: var(--hufflepuff); } .sc-houses [data-house="slytherin"] { --c: var(--slytherin); }
.sc-houses button::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: var(--c); }
.sc-houses button[aria-checked="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 22%, transparent); }
.sc-points { margin: 12px 0 0; color: var(--text-soft); }
.sc-years { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.sc-years button { flex: 1 1 200px; min-height: 48px; padding: 10px 14px; border-radius: 6px; cursor: pointer; text-align: left; font: 500 1rem/1.3 var(--body);
  color: var(--text-soft); background: rgba(8,30,39,.8); border: 1px solid rgba(201,164,92,.22); }
.sc-years b { font: 600 .9rem/1 var(--display); color: var(--gold-hi); letter-spacing: .06em; margin-right: 4px; }
.sc-years small { float: right; font: .8rem/1.6 var(--mono); color: var(--stone); }
.sc-years [aria-selected="true"] { border-color: var(--hc); color: #f4efe2; box-shadow: inset 0 -3px 0 var(--hc); }
.sc-lesson { padding: clamp(22px, 4vw, 36px); border-radius: 6px; color: var(--quill); background: var(--parchment);
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.9), inset 0 0 60px rgba(150,110,50,.22), 0 0 0 1px rgba(201,164,92,.5); }
.sc-count { margin: 0 0 10px; font: .86rem/1 var(--mono); color: var(--burgundy); }
.sc-task { font: 500 clamp(1.3rem, 2.6vw, 1.6rem)/1.4 var(--body); margin: 0 0 20px; }
.sc-term { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 6px; background: #0b1d24; box-shadow: inset 0 0 0 1px rgba(201,164,92,.35); }
.sc-prompt { font: 1.05rem/1 var(--mono); color: var(--gold); }
.sc-term input { flex: 1; min-width: 0; min-height: 40px; border: 0; outline: none; background: none; font: 1.05rem/1.4 var(--mono); color: #e8f4f6; }
.sc-term input::placeholder { color: #6f8c95; }
.sc-term:focus-within { box-shadow: inset 0 0 0 1px var(--gold-hi), 0 0 0 3px rgba(236,211,154,.25); }
.sc-choices { display: grid; gap: 10px; }
.sc-choices button { min-height: 48px; padding: 10px 16px; border-radius: 6px; cursor: pointer; text-align: left; background: #0b1d24; border: 1px solid rgba(201,164,92,.3); }
.sc-choices code { font: 1rem/1.4 var(--mono); color: #e8f4f6; }
.sc-choices .right { border-color: #6fdc8c; box-shadow: 0 0 0 2px rgba(111,220,140,.35); }
.sc-choices .wrong { border-color: #d0574a; opacity: .6; }
.sc-result { min-height: 1.6em; margin: 18px 0 0; font-size: 1.1rem; }
.sc-result code { font: .95rem/1.4 var(--mono); padding: 2px 6px; border-radius: 3px; background: rgba(43,29,18,.1); }
.sc-result.cast { padding: 16px 18px; border-radius: 6px; background: rgba(255,255,255,.4); border-left: 4px solid var(--hc); animation: sc-cast .6s ease-out; }
.sc-result.cast p { margin: 0 0 .4em; } .sc-result.cast p:last-child { margin: 0; }
.sc-spell { font: 600 clamp(1.6rem, 3.4vw, 2.1rem)/1.1 var(--display); color: var(--burgundy); text-shadow: 0 0 18px rgba(236,211,154,.8); }
.sc-plus { font: .9rem/1 var(--mono); color: var(--quill-soft); }
.sc-result.fizzle { color: #7a3a22; }
.sc-result.curse { padding: 14px 16px; border-radius: 6px; background: rgba(46,125,50,.15); color: #1d4a22; }
@keyframes sc-cast { from { opacity: 0; transform: translateY(6px); box-shadow: 0 0 0 0 rgba(236,211,154,.9); } to { opacity: 1; transform: none; box-shadow: 0 0 0 14px rgba(236,211,154,0); } }
.sc-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.sc-tools .btn-ghost { color: var(--quill); background: rgba(43,29,18,.06); border-color: rgba(43,29,18,.35); min-height: 44px; }
.sc-tools [data-act="next"] { margin-left: auto; }
.sc-progress { display: flex; gap: 8px; justify-content: center; margin: 22px 0 10px; }
.sc-progress button { width: 14px; height: 14px; padding: 0; border-radius: 50%; cursor: pointer; border: 1px solid var(--gold); background: transparent; }
.sc-progress .done button { background: var(--gold); }
.sc-progress .now button { box-shadow: 0 0 0 3px rgba(236,211,154,.35); }
.sc-note { text-align: center; font: .84rem/1.4 var(--mono); color: var(--stone); }
@media (max-width: 560px) { .sc-tools [data-act="next"] { margin-left: 0; } .sc-term .btn { padding: 10px 14px; } }

/* ===== Castle music: the button in the top bar (four little bars that sway while it plays) ===== */
.music-btn { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 6px; cursor: pointer;
  border: 1px solid rgba(201,164,92,.4); background: rgba(4,20,27,.6); transition: border-color .3s, box-shadow .3s; }
.music-btn:hover, .music-btn:focus-visible { border-color: var(--gold-hi); }
.topbar .music-btn { order: 4; margin-left: .5rem; }
.sc-page .topbar .music-btn { margin-left: 1rem; }
@media (max-width: 860px) { .topbar .music-btn { order: 0; margin-left: 0; } }
/* the always-there call to action: the last thing in the top bar on desktop, beside Menu on phones */
.top-owl { order: 5; margin-left: .5rem; min-height: 36px; padding: 0 .95rem; font-size: .74rem; white-space: nowrap; }
@media (max-width: 860px) { .top-owl { order: 0; margin-left: 0; min-height: 44px; } }
@media (min-width: 861px) and (max-width: 1080px) { /* small laptops: tighten the links so everything stays on one line (the ⌘K keys still work) */
  .topbar { gap: .8rem; } .topbar .cmdk { display: none; }
  .plainnav { gap: .9rem; } .plainnav a { letter-spacing: .08em; white-space: nowrap; }
}
@media (max-width: 560px) { .topbar { gap: .6rem; } .topbar .cmdk { display: none; } .menu-btn { margin-left: 0; } } /* ⌘K is a keyboard shortcut: phones need the room */
/* paused: a music note, so it reads as a music button at a glance; playing: the swaying bars */
.music-btn .note, .music-btn .eq { grid-area: 1 / 1; transition: opacity .35s ease, transform .35s ease; }
.music-btn .note { width: 18px; height: 18px; color: var(--gold-hi); }
.music-btn[aria-pressed="true"] .note { opacity: 0; transform: scale(.6); }
.music-btn[aria-pressed="false"] .eq { opacity: 0; transform: scale(.6); }
.eq { display: flex; align-items: flex-end; gap: 3px; height: 14px; }
.eq i { width: 2px; height: 100%; border-radius: 1px; background: var(--gold-hi); opacity: .55; transform-origin: 50% 100%; transform: scaleY(.22); transition: transform .5s ease, opacity .5s; }
.music-btn[aria-pressed="true"] .eq i { opacity: 1; animation: eq 1.2s ease-in-out infinite alternate; }
.music-btn[aria-pressed="true"] .eq i:nth-child(2) { animation-duration: .9s; animation-delay: -.4s; }
.music-btn[aria-pressed="true"] .eq i:nth-child(3) { animation-duration: 1.4s; animation-delay: -.8s; }
.music-btn[aria-pressed="true"] .eq i:nth-child(4) { animation-duration: 1s; animation-delay: -.2s; }
.music-btn.waiting .eq i { animation-play-state: paused; } /* on, but waiting for the file or for a tap */
.music-btn[aria-pressed="true"] { box-shadow: 0 0 14px rgba(241,215,154,.25); }
@keyframes eq { from { transform: scaleY(.25); } to { transform: scaleY(1); } }
/* the one-time note in the open way in */
.music-nudge { position: absolute; top: calc(100% + 10px); right: -6px; padding: 8px 12px; border-radius: 6px; white-space: nowrap; pointer-events: none;
  font: italic 1rem/1 var(--fell); color: var(--gold-hi); background: rgba(4,20,27,.92); border: 1px solid rgba(201,164,92,.45); box-shadow: 0 10px 30px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(-4px); transition: opacity .6s ease, transform .6s ease; }
.music-nudge::before { content: ""; position: absolute; top: -5px; right: 18px; width: 8px; height: 8px; rotate: 45deg; background: inherit; border: inherit; border-width: 1px 0 0 1px; }
.music-nudge.show { opacity: 1; transform: none; }
.music-btn:has(.music-nudge.show) { border-color: var(--gold-hi); }

/* ===== Entrance screen (the gate way in) ===== */
.gate { display: none; }
html.gated { overflow: hidden; }
html.gated .gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: var(--gutter); text-align: center;
  background: radial-gradient(ellipse at 50% 38%, #0b3442, #04141b 62%, #020b10); }
.gate-sky { position: absolute; inset: 0; pointer-events: none; }
.gate-sky .stars { inset: 0; }
.gate-sky .s2 { background-position: 200px 120px; opacity: .3; animation-delay: -3s; }
.gate-card { position: relative; display: grid; justify-items: center; }
.gate-kicker { margin: 0 0 12px; font: .9rem/1 var(--mono); letter-spacing: .06em; color: #8fc3d2; animation: copy-in 1s ease-out .2s both; }
.gate-title { margin: 0 0 34px; font: 400 clamp(2.4rem, 7vw, 4.4rem)/1 "Harry P", var(--display); letter-spacing: .02em; color: transparent;
  background: linear-gradient(180deg, #ffffff 0%, #e6edf0 30%, #9fb0b8 48%, #5d6f78 52%, #c9d4d9 66%, #f4f7f8 82%, #a9b8bf 100%); -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 2px 0 rgba(10,20,26,.9)) drop-shadow(0 0 24px rgba(var(--glow), .3)); animation: copy-in 1.2s ease-out .35s both; }
.gate-seal { position: relative; width: 112px; height: 112px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; background: none; filter: drop-shadow(0 10px 14px rgba(0,0,0,.55)); animation: copy-in 1s ease-out .6s both; }
.gate-seal::before { content: ""; position: absolute; inset: -18px; border-radius: 50%; background: radial-gradient(circle, rgba(241,215,154,.28), transparent 68%); animation: seal-breathe 3.2s ease-in-out infinite alternate; }
@keyframes seal-breathe { from { opacity: .35; transform: scale(.92); } to { opacity: 1; transform: scale(1.05); } }
.gate-seal i { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font: 700 1.7rem/1 var(--deco); font-style: normal; color: #f0c9b0;
  background: radial-gradient(circle at 40% 35%, #b43a4b, #7a1b29 60%, #4f0f1a); box-shadow: inset 0 0 0 8px rgba(0,0,0,.18), inset 0 0 0 9px rgba(240,201,176,.12);
  transition: transform .7s cubic-bezier(.3,.6,.2,1), opacity .6s ease .2s; }
.gate-seal i:first-child { clip-path: polygon(0 0, 52% 0, 46% 50%, 54% 100%, 0 100%); }
.gate-seal i:last-child { clip-path: polygon(52% 0, 100% 0, 100% 100%, 54% 100%, 46% 50%); }
.gate-seal:hover i, .gate-seal:focus-visible i { transform: scale(1.04); }
.gate-seal:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 10px; }
.gate-hint { margin: 22px 0 6px; font: italic 1.15rem/1.3 var(--fell); color: var(--gold-hi); animation: copy-in 1s ease-out .8s both; }
.gate-quiet { min-height: 44px; padding: 0 12px; border: 0; cursor: pointer; background: none; font: 1rem/1 var(--body); color: var(--text-soft);
  text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(201,164,92,.4); animation: copy-in 1s ease-out .95s both; }
.gate-quiet:hover, .gate-quiet:focus-visible { color: #f4efe2; }
/* leaving: the seal splits, the card drifts towards you and the night lifts */
.gate.leaving { pointer-events: none; animation: gate-out .9s cubic-bezier(.6,0,.3,1) .25s forwards; }
.gate.leaving .gate-card { animation: gate-card-out 1s cubic-bezier(.5,0,.3,1) .15s forwards; }
.gate.broken .gate-seal i:first-child { transform: translate(-26px, 10px) rotate(-28deg); opacity: 0; }
.gate.broken .gate-seal i:last-child { transform: translate(26px, 10px) rotate(28deg); opacity: 0; }
@keyframes gate-out { to { opacity: 0; } }
@keyframes gate-card-out { to { opacity: 0; transform: scale(1.08); } }

/* ===== Spell Class over the castle ===== */
.sc-overlay { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #04141b; }
.sc-overlay::backdrop { background: transparent; }
.sc-overlay[open] { animation: sc-in .4s cubic-bezier(.2,.7,.2,1) both; }
.sc-overlay.leaving { animation: sc-out .28s ease-in both; }
@keyframes sc-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes sc-out { to { opacity: 0; transform: translateY(10px); } }
.sc-overlay iframe { display: block; width: 100%; height: 100%; border: 0; }
html.sc-open { overflow: hidden; }
html.sc-open body > :not(.sc-overlay) { visibility: hidden; }

/* page to page (where supported): a soft cross-fade instead of a blank flash */
@view-transition { navigation: auto; }

@media (prefers-reduced-motion: reduce) {
  .gate *, .gate.leaving, .gate-seal::before { animation: none !important; }
}
@media (scripting: none) { html.gated { overflow: auto; } html.gated .gate { display: none; } }
.topbar:has(.music-nudge.show) { z-index: 52; } /* the note sits above the footsteps label */
@media (max-width: 860px) { .music-nudge { right: 50%%; translate: 50%% 0; } .music-nudge::before { right: calc(50%% - 4px); } }
