/* ============ The Flemish Nightmare ============ */

@font-face { font-family: "Cinzel"; src: url("fonts/cinzel-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("fonts/cinzel-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("fonts/cormorant-garamond-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("fonts/cormorant-garamond-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: swap; }

:root {
  --black: #050506;
  --bone: #ece3d6;
  --bone-dim: rgba(236, 227, 214, .62);
  --bone-faint: rgba(236, 227, 214, .28);
  --gold: #c49a62;
  --ember: #e08a3c;
  --serif: "Cormorant", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --caps: "Cinzel", "Trajan Pro", Georgia, serif;
  --bar: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--black); color: var(--bone); overflow: hidden; }
body { font-family: var(--serif); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============ GATE ============ */
.gate {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; text-align: center; padding: 24px;
  background: radial-gradient(ellipse at 50% 60%, #14100c 0%, var(--black) 65%);
  transition: opacity 2.4s ease, visibility 0s linear 2.4s;
}
.gate.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.gate-inner { max-width: 560px; }
.gate-presents {
  font-family: var(--caps); font-size: 11px; letter-spacing: .5em; text-transform: uppercase;
  color: var(--bone-faint); margin-bottom: 28px; opacity: 0; animation: rise 2s ease .3s forwards;
}
.gate-title {
  font-family: var(--caps); font-weight: 600; line-height: .95; color: var(--bone);
  font-size: clamp(42px, 8.5vw, 88px); letter-spacing: .02em;
  text-shadow: 0 0 40px rgba(224, 138, 60, .18);
  opacity: 0; animation: rise 2.4s ease .8s forwards, breathe 7s ease-in-out 3.2s infinite;
}
.gate-title span { display: block; font-size: .52em; color: var(--gold); letter-spacing: .08em; margin-bottom: .1em; }
.gate-line {
  font-style: italic; font-size: clamp(19px, 2.4vw, 23px); line-height: 1.5; color: var(--bone-dim);
  margin: 34px auto 42px; max-width: 30em; opacity: 0; animation: rise 2.4s ease 1.8s forwards;
}
.gate-enter {
  font-family: var(--caps); font-size: 13px; letter-spacing: .38em; text-transform: uppercase;
  padding: 16px 30px 16px 36px; border: 1px solid var(--bone-faint); color: var(--bone);
  transition: border-color .6s, background .6s, letter-spacing .8s, opacity .6s;
  opacity: 0; animation: rise 2s ease 2.8s forwards;
}
.gate-enter:hover:not(:disabled) { border-color: var(--gold); background: rgba(196, 154, 98, .07); letter-spacing: .44em; }
.gate-enter:disabled, .gate-silent:disabled { cursor: progress; }
.gate-enter:disabled span { opacity: .35; }
.gate-note { font-size: 15px; font-style: italic; color: var(--bone-faint); margin-top: 22px; opacity: 0; animation: rise 2s ease 3.3s forwards; }
.gate-silent {
  margin-top: 10px; font-size: 14px; color: var(--bone-faint); text-decoration: underline; text-underline-offset: 4px;
  text-decoration-color: rgba(236, 227, 214, .15); opacity: 0; animation: rise 2s ease 3.5s forwards;
}
.gate-silent:hover { color: var(--bone-dim); }
.gate-lang { position: absolute; top: 22px; right: 26px; font-family: var(--caps); font-size: 12px; letter-spacing: .2em; color: var(--bone-faint); }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { text-shadow: 0 0 40px rgba(224, 138, 60, .14); } 50% { text-shadow: 0 0 60px rgba(224, 138, 60, .3); } }

/* ============ STAGE ============ */
.stage { position: fixed; inset: 0; background: var(--black); }
.scroller { position: absolute; inset: 0; overflow: hidden; }
.scene {
  position: absolute; left: 0; top: 0; overflow: hidden;
  transform-origin: 50% 50%; will-change: transform;
  opacity: 0; transition: opacity 4s ease;
}
body.entered .scene { opacity: 1; }
.attic { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; filter: brightness(.92) saturate(.95); }
body.entered .attic { animation: settle 40s ease-out forwards; }
@keyframes settle { from { transform: scale(1.06); } to { transform: scale(1); } }

.glow { position: absolute; pointer-events: none; mix-blend-mode: screen; border-radius: 50%; }
.glow-hearth {
  left: 55.6%; top: 62%; width: 30%; height: 42%; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(255, 150, 60, .55), rgba(224, 110, 40, .18) 45%, transparent 75%);
}
.glow-floor {
  left: 57%; top: 82%; width: 40%; height: 26%; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(255, 140, 60, .22), transparent 80%);
}
.candle {
  position: absolute; width: 3.4%; aspect-ratio: 1; transform: translate(-50%, -50%);
  pointer-events: none; mix-blend-mode: screen; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 196, 120, .5), rgba(255, 160, 80, .12) 45%, transparent 75%);
  animation: candle 3.1s ease-in-out infinite alternate;
}
.candle:nth-of-type(2n) { animation-duration: 2.3s; animation-delay: -1s; }
.candle:nth-of-type(3n) { animation-duration: 3.7s; animation-delay: -2s; }
@keyframes candle { 0% { opacity: .55; } 30% { opacity: .9; } 55% { opacity: .7; } 80% { opacity: 1; } 100% { opacity: .6; } }

/* figure behind the right window */
.window-r { position: absolute; left: 71.5%; top: 35.8%; width: 3.6%; height: 12.6%; overflow: hidden; pointer-events: none; }
.figure {
  position: absolute; top: 8%; left: -60%; width: 55%; height: 120%;
  background: radial-gradient(ellipse 50% 50% at 50% 40%, rgba(255, 255, 255, .85), rgba(220, 230, 240, .35) 50%, transparent 72%);
  filter: blur(3px); opacity: 0;
}
.figure.pass { animation: pass 7s ease-in-out forwards; }
@keyframes pass {
  0% { left: -60%; opacity: 0; }
  20% { opacity: .55; }
  50% { left: 25%; opacity: .7; }
  62% { left: 25%; opacity: .7; }
  100% { left: 140%; opacity: 0; }
}

/* flour footprints */
.steps { position: absolute; inset: 0; pointer-events: none; }
.step {
  position: absolute; width: 1.7%; aspect-ratio: .45; transform: translate(-50%, -50%) rotate(var(--r)) scale(var(--s, 1));
  opacity: 0; transition: opacity 1.6s ease; filter: blur(.4px);
}
.step.on { opacity: .62; }
.step svg { width: 100%; height: 100%; display: block; fill: rgba(245, 240, 232, .9); }

.mist { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; mix-blend-mode: screen; opacity: .9; }
.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 75% 70% at 50% 52%, transparent 55%, rgba(0, 0, 0, .55) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, .35), transparent 14%, transparent 86%, rgba(0, 0, 0, .45));
}
.cursorlight {
  position: fixed; left: 0; top: 0; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%;
  pointer-events: none; mix-blend-mode: soft-light; opacity: 0; transition: opacity 1.5s;
  background: radial-gradient(closest-side, rgba(255, 210, 160, .5), transparent 80%);
}
body.entered.fine .cursorlight { opacity: 1; }
.grain { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .07; image-rendering: pixelated; mix-blend-mode: overlay; }

/* hotspots */
.hot {
  position: absolute; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  display: grid; place-items: center; opacity: 0; transition: opacity 2s ease;
}
body.entered .hot { opacity: 1; transition-delay: 3s; }
.hot-dot {
  width: 9px; height: 9px; border-radius: 50%; background: rgba(245, 236, 222, .85);
  box-shadow: 0 0 12px 2px rgba(255, 220, 180, .45); position: relative;
}
.hot-dot::after {
  content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 1px solid rgba(245, 236, 222, .45);
  animation: ring 3.2s ease-out infinite;
}
.hot:nth-of-type(2n) .hot-dot::after { animation-delay: -1.1s; }
.hot:nth-of-type(3n) .hot-dot::after { animation-delay: -2.2s; }
@keyframes ring { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.9); opacity: 0; } }
.hot.seen .hot-dot { background: rgba(196, 154, 98, .6); box-shadow: 0 0 8px rgba(196, 154, 98, .3); }
.hot.seen .hot-dot::after { animation: none; opacity: 0; }
.hot-label {
  position: absolute; top: calc(50% + 18px); left: 50%; transform: translate(-50%, 4px); white-space: nowrap;
  font-family: var(--caps); font-size: 11px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--bone); text-shadow: 0 1px 8px #000, 0 0 2px #000;
  opacity: 0; transition: opacity .5s, transform .5s; pointer-events: none;
}
.hot:hover .hot-label, .hot:focus-visible .hot-label { opacity: 1; transform: translate(-50%, 0); }
@media (hover: none) { .hot-label { opacity: .8; transform: translate(-50%, 0); font-size: 10px; } }

/* ============ BARS ============ */
.bar {
  position: fixed; left: 0; right: 0; z-index: 20; height: var(--bar);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 28px;
  font-family: var(--caps); font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--bone-faint);
  opacity: 0; transition: opacity 2s ease 2.5s; pointer-events: none;
}
body.entered .bar { opacity: 1; pointer-events: auto; }
.bar-top { top: 0; padding-top: env(safe-area-inset-top); background: linear-gradient(to bottom, rgba(5, 5, 6, .9), rgba(5, 5, 6, 0)); }
.bar-bottom { bottom: 0; padding-bottom: env(safe-area-inset-bottom); background: linear-gradient(to top, rgba(5, 5, 6, .9), rgba(5, 5, 6, 0)); }
.status { display: flex; align-items: center; gap: 10px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #b5542c; box-shadow: 0 0 8px #e07a3c; animation: candle 2.6s infinite alternate; }
.found { text-align: center; font-style: normal; }
.controls { justify-self: end; display: flex; align-items: center; gap: 22px; }
.lang button, .gate-lang button { padding: 6px 4px; letter-spacing: .2em; opacity: .5; transition: opacity .4s, color .4s; }
.lang button:hover, .gate-lang button:hover { opacity: .9; }
.lang button.on, .gate-lang button.on { opacity: 1; color: var(--bone); }
.lang span, .gate-lang span { margin: 0 6px; opacity: .4; }
.sound { padding: 8px 4px; }
.sound-bars { display: flex; align-items: flex-end; gap: 3px; height: 14px; }
.sound-bars i { width: 2px; background: var(--bone-dim); height: 30%; animation: eq 1.4s ease-in-out infinite alternate; }
.sound-bars i:nth-child(2) { animation-delay: -.5s; animation-duration: 1.1s; }
.sound-bars i:nth-child(3) { animation-delay: -.9s; animation-duration: 1.7s; }
.sound-bars i:nth-child(4) { animation-delay: -.2s; animation-duration: 1.3s; }
.sound[aria-pressed="false"] .sound-bars i { animation: none; height: 2px; }
@keyframes eq { from { height: 20%; } to { height: 100%; } }

.credit { letter-spacing: .2em; }
.frags { display: flex; gap: 6px; }
.frags button {
  min-width: 38px; padding: 10px 6px; letter-spacing: .1em; font-size: 12px; color: var(--bone-faint);
  border-bottom: 1px solid transparent; transition: color .4s, border-color .4s;
}
.frags button:hover { color: var(--bone); }
.frags button.seen { color: var(--gold); }
.frags button.active { color: var(--bone); border-color: var(--gold); }
.socials { justify-self: end; display: flex; gap: 14px; }
.socials a { display: grid; place-items: center; width: 34px; height: 34px; opacity: .6; transition: opacity .4s; }
.socials a:hover { opacity: 1; }
.socials a[hidden] { display: none; }
.socials svg { width: 18px; height: 18px; fill: none; stroke: var(--bone); stroke-width: 1.4; }
.socials svg .fill, .panel-social svg .fill { fill: var(--bone); stroke: none; }

/* ============ PANEL ============ */
.panel {
  position: fixed; z-index: 30; top: calc(var(--bar) + 4vh); bottom: calc(var(--bar) + 4vh); width: min(460px, 40vw);
  display: flex; flex-direction: column; justify-content: center;
  padding: 44px 46px; overflow-y: auto;
  background: linear-gradient(160deg, rgba(14, 11, 9, .9), rgba(6, 6, 7, .88));
  border: 1px solid rgba(236, 227, 214, .09);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .9s ease, transform .9s ease;
}
.panel.right { right: 4vw; transform: translateX(16px); }
.panel.left { left: 4vw; transform: translateX(-16px); }
.panel.open { opacity: 1; transform: none; }
.panel-close { position: absolute; top: 14px; right: 18px; font-size: 28px; line-height: 1; padding: 6px 10px; color: var(--bone-faint); transition: color .3s; }
.panel-close:hover { color: var(--bone); }
.panel-num { font-family: var(--caps); font-size: 12px; letter-spacing: .4em; color: var(--gold); margin-bottom: 14px; }
.panel-title { font-family: var(--caps); font-weight: 400; font-size: 25px; letter-spacing: .08em; line-height: 1.25; margin-bottom: 24px; color: var(--bone); }
.panel-body p { font-size: 20px; line-height: 1.6; color: var(--bone-dim); margin-bottom: 16px; }
.panel-body p.whisper { font-style: italic; color: var(--bone); }
.panel-body p.small { font-size: 16px; color: var(--bone-faint); }
.panel-body a.text-link { color: var(--gold); text-decoration: none; border-bottom: 1px solid rgba(196, 154, 98, .4); }
.panel-body a.text-link:hover { border-color: var(--gold); }
.panel-socials { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.panel-social {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; text-decoration: none;
  font-family: var(--caps); font-size: 11px; letter-spacing: .26em; text-transform: uppercase;
  border: 1px solid var(--bone-faint); transition: border-color .4s, background .4s;
}
.panel-social:hover { border-color: var(--gold); background: rgba(196, 154, 98, .07); }
.panel-social svg { width: 16px; height: 16px; fill: none; stroke: var(--bone); stroke-width: 1.4; }

.finale {
  position: fixed; z-index: 25; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(640px, 86vw); text-align: center; pointer-events: none;
  font-style: italic; font-size: clamp(22px, 3vw, 32px); line-height: 1.45; color: var(--bone);
  text-shadow: 0 2px 20px #000, 0 0 4px #000;
  opacity: 0; transition: opacity 3s ease;
}
.finale.on { opacity: 1; }

.noscript { position: fixed; inset: 0; z-index: 99; display: grid; place-content: center; gap: 12px; text-align: center; background: var(--black); font-size: 20px; padding: 24px; }

/* ============ SMALL SCREENS ============ */
@media (max-width: 820px), (orientation: portrait) {
  :root { --bar: 56px; }
  .bar { padding: 0 16px; font-size: 10px; letter-spacing: .18em; }
  .bar-top { grid-template-columns: 1fr auto; }
  .found { display: none; }
  .bar-bottom { grid-template-columns: auto 1fr auto; gap: 8px; }
  .credit { display: none; }
  .frags { justify-self: start; gap: 0; }
  .frags button { min-width: 34px; }
  .cursorlight { display: none; }
  .panel, .panel.left, .panel.right {
    left: 10px; right: 10px; width: auto; top: auto; bottom: calc(var(--bar) + 8px); max-height: 60vh;
    padding: 32px 24px 26px; justify-content: flex-start; transform: translateY(20px);
  }
  .panel.open { transform: none; }
  .panel-title { font-size: 21px; margin-bottom: 16px; }
  .panel-body p { font-size: 18px; }
}
@media (orientation: portrait) {
  .scroller { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .scroller::-webkit-scrollbar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .3s !important; }
}
