:root {
  --fg: #ece6d8;
  --dim: rgba(236, 230, 216, .56);
  --line: rgba(236, 230, 216, .16);
  --warm: #ffb36b;
  --cool: #b9d3ff;
  --bg: #05070d;
  --ink-shadow: 0 1px 30px rgba(0, 0, 0, .35);
  --gutter: clamp(16px, 3.2vw, 44px);
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --serif: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}
/* daylight: the sky is pale, so the type up in the sky turns to ink (the harbour stays dark) */
:root[data-sky="day"] .sentence, :root[data-sky="day"] .topbar, :root[data-sky="day"] #cursor {
  --fg: #10141b;
  --dim: rgba(16, 20, 27, .6);
  --line: rgba(16, 20, 27, .2);
  --warm: #b34a12;
  --ink-shadow: 0 1px 24px rgba(255, 255, 255, .25);
}
:root[data-sky="day"] .doors { --ink-shadow: 0 2px 30px rgba(0, 0, 0, .45); }
.sentence, .topbar { color: var(--fg); transition: color 1.2s ease; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans); color: var(--fg); background: var(--bg);
  min-height: 100svh; overflow-x: hidden;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: color 2s ease;
}
body.locked { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 400; }
.dim { color: var(--dim); }
::selection { background: var(--warm); color: #000; }

#sky, #fx { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#sky { z-index: 0; background: radial-gradient(120% 80% at 60% 100%, #1a1420 0%, #070a12 50%, #030409 100%); }
#fx { z-index: 1; pointer-events: none; mix-blend-mode: screen; }
main, .topbar, .ticker { position: relative; z-index: 2; }

/* ---------------- gate ---------------- */
#gate {
  position: fixed; inset: 0; z-index: 50; background: #030409;
  display: grid; place-items: center; padding: var(--gutter);
  transition: opacity 1.4s cubic-bezier(.7, 0, .2, 1), visibility 0s 1.4s;
}
#gate.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.gate-inner { width: min(560px, 100%); }
.gate-line { min-height: 1.6em; color: #ece6d8; }
.gate-line.dim { color: rgba(236, 230, 216, .5); }
.gate-line .caret { display: inline-block; width: .6em; height: 1.05em; background: currentColor; vertical-align: -.2em; animation: blink 1s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.gate-horizon { position: relative; height: 70px; margin: 34px 0 30px; }
.gate-horizon span { position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, #ece6d8 20%, #ece6d8 80%, transparent); transform: scaleX(0); transform-origin: 50% 50%; transition: transform 1.6s cubic-bezier(.2, .7, 0, 1); }
.gate-horizon::after { /* Rangitoto, in one line */
  content: ""; position: absolute; left: 50%; bottom: 1px; width: 58%; height: 38px; transform: translateX(-38%) scaleY(0); transform-origin: bottom;
  background: #ece6d8; clip-path: path("M0 38 C 60 34, 110 12, 150 4 C 160 2, 166 1, 172 3 C 176 1, 182 1, 190 4 C 230 12, 290 34, 400 38 Z");
  opacity: .92; transition: transform 1.4s .6s cubic-bezier(.2, .7, 0, 1);
}
#gate.drawn .gate-horizon span { transform: scaleX(1); }
#gate.drawn .gate-horizon::after { transform: translateX(-38%) scaleY(1); }
.gate-actions { display: flex; gap: 28px; align-items: baseline; flex-wrap: wrap; opacity: 0; transform: translateY(8px); transition: all .9s 1.4s ease; }
#gate.drawn .gate-actions { opacity: 1; transform: none; }
.gate-btn { font-family: var(--serif); font-style: italic; font-size: clamp(28px, 5vw, 44px); color: rgba(236, 230, 216, .55); padding: 6px 0; position: relative; transition: color .4s; }
.gate-btn.primary { color: #ece6d8; }
.gate-btn em { font-family: var(--mono); font-style: normal; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin-left: 12px; color: var(--warm); vertical-align: middle; }
.gate-btn span { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .5s cubic-bezier(.2, .7, 0, 1); }
.gate-btn:hover span, .gate-btn:focus-visible span { background-size: 100% 1px; }
.gate-btn:hover { color: #ece6d8; }
.gate-btn:focus-visible { outline: none; }

/* ---------------- cursor ---------------- */
#cursor { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; display: none; }
.has-cursor #cursor { display: block; }
.has-cursor, .has-cursor a, .has-cursor button { cursor: none; }
.c-dot, .c-ring { position: absolute; left: 0; top: 0; border-radius: 50%; }
.c-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--fg); }
.c-ring { width: 38px; height: 38px; margin: -19px 0 0 -19px; border: 1px solid var(--line); display: grid; place-items: center; transition: width .45s cubic-bezier(.2, .7, 0, 1), height .45s cubic-bezier(.2, .7, 0, 1), margin .45s cubic-bezier(.2, .7, 0, 1), background .45s, border-color .45s; }
.c-label { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #000; opacity: 0; transition: opacity .2s; white-space: nowrap; }
#cursor.big .c-ring { width: 92px; height: 92px; margin: -46px 0 0 -46px; background: var(--fg); border-color: transparent; }
#cursor.big .c-label { opacity: 1; color: var(--bg); }
#cursor.big .c-dot { opacity: 0; }
:root[data-sky="day"] #cursor.big .c-label { color: #fff; }

/* ---------------- top bar ---------------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 14px;
  text-shadow: var(--ink-shadow);
}
.tb-coords { text-align: center; }
.tb-sound { justify-self: end; display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; padding: 8px 0; }
.bars { display: flex; gap: 2px; align-items: flex-end; height: 12px; }
.bars i { width: 2px; height: 2px; background: currentColor; transition: height .08s linear; }

/* ---------------- hero ---------------- */
.hero {
  min-height: 100svh; position: relative;
  display: grid; grid-template-rows: 1fr auto;
  padding: calc(64px + env(safe-area-inset-top)) var(--gutter) 64px;
}
.sentence { align-self: start; padding-top: clamp(12px, 5vh, 60px); text-shadow: var(--ink-shadow); }
.lead { margin-bottom: .6em; padding-left: .3vw; }
.wordmark {
  font-family: var(--sans); font-weight: 760; font-variation-settings: "wdth" 100;
  font-size: clamp(64px, 17.2vw, 330px); line-height: .78; letter-spacing: -.045em;
  margin-left: -.05em; white-space: nowrap; user-select: none;
}
.wordmark .ch { display: inline-block; will-change: font-variation-settings, transform; transform-origin: 50% 100%; }
.wordmark .ch.pt { color: var(--warm); }
.wordmark .ch .in { display: inline-block; transform: translateY(105%); }
.wordmark .clip { display: inline-block; overflow: hidden; vertical-align: bottom; padding: 0 .02em .08em; margin-bottom: -.08em; }
.revealed .wordmark .ch .in { transform: none; transition: transform 1.3s cubic-bezier(.16, 1, .3, 1); transition-delay: calc(var(--i) * 55ms + .2s); }

.predicate {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(30px, 4.3vw, 76px); line-height: 1.02; letter-spacing: -.01em;
  margin-top: .22em; min-height: 2.1em; max-width: 24ch;
  font-variation-settings: "opsz" 96;
}
.predicate .w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .12em; margin-bottom: -.12em; }
.predicate .w > span { display: inline-block; transform: translateY(110%); transition: transform .9s cubic-bezier(.16, 1, .3, 1); }
.predicate .w.in > span { transform: none; }
.predicate .w.out > span { transform: translateY(-110%); transition-duration: .5s; transition-timing-function: cubic-bezier(.7, 0, .84, 0); }
.predicate .accent { color: var(--warm); }

/* ---------------- doors ---------------- */
.doors { align-self: end; border-top: 1px solid var(--line); margin-bottom: 8px; }
.door {
  position: relative; display: grid; align-items: center;
  grid-template-columns: 56px 1fr auto 64px; gap: 18px;
  padding: clamp(10px, 1.8vh, 20px) 0; border-bottom: 1px solid var(--line);
  isolation: isolate; overflow: hidden;
}
.door::before { /* a light that rises from the waterline on hover */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(0deg, color-mix(in srgb, var(--fg) 12%, transparent), transparent);
  transform: scaleY(0); transform-origin: bottom; transition: transform .7s cubic-bezier(.16, 1, .3, 1);
}
.door:hover::before, .door:focus-visible::before, .door.hot::before { transform: scaleY(1); }
.door:focus-visible { outline: none; }
.door-no { align-self: start; padding-top: .9em; }
.door-verb { display: flex; align-items: baseline; gap: 0 clamp(8px, 1.4vw, 22px); flex-wrap: wrap; text-shadow: var(--ink-shadow); }
.door-big {
  font-weight: 800; font-size: clamp(46px, 6.6vw, 128px); line-height: .82; letter-spacing: -.035em;
  font-variation-settings: "wdth" 75;
}
.door-big .ch { display: inline-block; transition: font-variation-settings .8s cubic-bezier(.16, 1, .3, 1), transform .8s cubic-bezier(.16, 1, .3, 1); transition-delay: calc(var(--i) * 30ms); font-variation-settings: "wdth" 75; }
.door:hover .door-big .ch, .door:focus-visible .door-big .ch, .door.hot .door-big .ch { font-variation-settings: "wdth" 125; }
.door-soft { font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.9vw, 50px); line-height: 1; color: var(--dim); transition: color .6s, transform .8s cubic-bezier(.16, 1, .3, 1); }
.door:hover .door-soft, .door.hot .door-soft { color: var(--fg); transform: translateX(.2em); }
.door-meta { display: grid; gap: 6px; text-align: right; justify-items: end; }
.door-host { color: var(--fg); }
.door-status { display: flex; align-items: center; gap: 8px; color: var(--dim); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); position: relative; }
.up .dot { background: #7ee2a0; box-shadow: 0 0 10px #7ee2a0; }
.up .dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid #7ee2a0; animation: pulse 2.4s ease-out infinite; }
.down-state .dot { background: #ff7a6b; }
@keyframes pulse { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
.door-arrow { justify-self: end; width: 48px; height: 48px; overflow: hidden; }
.door-arrow svg { width: 48px; height: 48px; fill: none; stroke: currentColor; stroke-width: 1.4; transform: translateX(-60%); opacity: .4; transition: transform .7s cubic-bezier(.16, 1, .3, 1), opacity .5s; }
.door:hover .door-arrow svg, .door.hot .door-arrow svg { transform: none; opacity: 1; }
.door .key { font-family: var(--mono); font-size: 10px; border: 1px solid var(--line); padding: 1px 5px; border-radius: 3px; margin-left: 8px; }

.down { position: absolute; right: var(--gutter); bottom: 34px; display: flex; align-items: center; gap: 12px; }
.down i { width: 1px; height: 26px; background: currentColor; transform-origin: top; animation: drip 2.2s cubic-bezier(.7, 0, .3, 1) infinite; }
@keyframes drip { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* ---------------- ticker ---------------- */
.ticker { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; overflow: hidden; border-top: 1px solid var(--line); padding: 9px 0 max(9px, env(safe-area-inset-bottom)); backdrop-filter: blur(0px); white-space: nowrap; color: var(--dim); }
.ticker-track { display: inline-flex; gap: 0; animation: tick 60s linear infinite; will-change: transform; }
.ticker-track span { padding: 0 1.4em; }
.ticker-track b { font-weight: 500; color: var(--fg); }
@keyframes tick { to { transform: translateX(-50%); } }
.ticker:hover .ticker-track { animation-play-state: paused; }

/* ---------------- rules ---------------- */
.rules { padding: 20vh var(--gutter) 90px; position: relative; }
.rules-title { font-family: var(--sans); font-weight: 800; font-size: clamp(56px, 13vw, 240px); line-height: .85; letter-spacing: -.045em; font-variation-settings: "wdth" 62; margin-bottom: 8vh; }
.rules-title .it { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.02em; color: var(--warm); }
.rules-list { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.rules-list li { padding: 28px 28px 44px 0; border-bottom: 1px solid var(--line); position: relative; }
.rules-list li:not(:nth-child(3n)) { border-right: 1px solid var(--line); }
.rules-list li:not(:nth-child(3n+1)) { padding-left: 28px; }
.r-no { display: block; margin-bottom: 42px; color: var(--warm); }
.rules-list h3 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(26px, 2.4vw, 38px); line-height: 1.05; margin-bottom: 14px; }
.rules-list p { font-size: 16px; line-height: 1.55; color: var(--dim); max-width: 36ch; font-variation-settings: "wdth" 92; }
.colophon { margin: 16vh 0 12vh; display: grid; grid-template-columns: 1fr 3fr; gap: 28px; }
.colophon p:nth-child(2) { font-family: var(--serif); font-size: clamp(22px, 2.5vw, 38px); line-height: 1.28; max-width: 34ch; }
.colophon .keys { grid-column: 2; line-height: 2.2; }
kbd { font-family: var(--mono); font-size: 10px; border: 1px solid var(--line); border-radius: 3px; padding: 2px 6px; color: var(--fg); }
.foot { border-top: 1px solid var(--line); padding-top: 18px; }
.foot-mark { font-family: var(--serif); font-style: italic; font-size: clamp(64px, 19vw, 360px); line-height: .9; letter-spacing: -.03em; color: transparent; -webkit-text-stroke: 1px var(--line); margin: 3vh 0 4vh -.04em; white-space: nowrap; transition: -webkit-text-stroke-color 1s; }
.foot:hover .foot-mark { -webkit-text-stroke-color: var(--warm); }
.foot-line { display: flex; justify-content: space-between; padding-bottom: 40px; }

.reveal { opacity: 0; transform: translateY(30px); transition: opacity 1.2s ease, transform 1.2s cubic-bezier(.16, 1, .3, 1); }
.reveal.seen { opacity: 1; transform: none; }
.rules-list li.reveal { transition-delay: calc(var(--i, 0) * 90ms); }

/* ---------------- scrubber ---------------- */
#scrub { position: fixed; z-index: 20; left: 50%; bottom: 52px; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); padding: 16px 18px; background: rgba(5, 7, 13, .78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(236, 230, 216, .16); color: #ece6d8; border-radius: 2px; }
.scrub-row { display: flex; gap: 14px; align-items: center; justify-content: space-between; }
.scrub-row.wx { justify-content: flex-start; margin-top: 12px; flex-wrap: wrap; }
.scrub-row button { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; padding: 4px 8px; border: 1px solid rgba(236, 230, 216, .2); border-radius: 2px; }
.scrub-row button.on { background: #ece6d8; color: #05070d; }
#scrub-val { color: var(--warm); margin-left: auto; }
#scrub input { width: 100%; margin: 14px 0 2px; accent-color: #ffb36b; }

/* ---------------- small screens ---------------- */
@media (max-width: 820px) {
  .tb-coords { display: none; }
  .topbar { grid-template-columns: 1fr auto; }
  .tb-home .dim { display: none; }
  .hero { padding-bottom: 54px; }
  .door { grid-template-columns: 30px 1fr 36px; gap: 10px; }
  .door-meta { grid-column: 2 / 4; grid-row: 2; text-align: left; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 10px; letter-spacing: .1em; }
  .door .key { display: none; }
  .tb-sound-label { font-size: 10px; }
  .door-arrow { grid-column: 3; grid-row: 1; width: 36px; height: 36px; }
  .door-arrow svg { width: 36px; height: 36px; transform: none; opacity: .8; }
  .door-no { padding-top: .5em; }
  .down { display: none; }
  .rules-list { grid-template-columns: 1fr; }
  .rules-list li { border-right: 0 !important; padding-left: 0 !important; padding-right: 0; }
  .r-no { margin-bottom: 18px; }
  .colophon { grid-template-columns: 1fr; }
  .colophon .keys { grid-column: 1; display: none; }
}
@media (max-width: 420px) {
  .wordmark { font-size: 19.5vw; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .ticker-track { animation: none; }
}

/* once you've dived below the waterline, the fixed bars need a floor under them */
.topbar::before { content: ""; position: absolute; inset: 0 0 -24px; z-index: -1; background: linear-gradient(to bottom, rgba(5, 7, 13, .9), transparent); opacity: 0; transition: opacity .6s; pointer-events: none; }
body.scrolled .topbar::before { opacity: 1; }
body.scrolled .topbar { --fg: #ece6d8; --dim: rgba(236, 230, 216, .56); color: var(--fg); }
.ticker { background: linear-gradient(to top, rgba(5, 7, 13, .85), rgba(5, 7, 13, .35)); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
