:root {
  --navy: #e6e2db;
  --navy-2: #dfe4ea;
  --ivory: #262626;
  --ivory-soft: rgba(29, 44, 74, 0.62);
  --line: rgba(29, 44, 74, 0.28);
  --panel: rgba(233, 229, 222, 0.9);
  --accent: #8a6a3f;
  --pink: #ec1e79;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Be Vietnam Pro", system-ui, sans-serif;
  --gut: clamp(16px, 3.4vw, 52px);
}

* { box-sizing: border-box; margin: 0; }
html, body { background: var(--navy); color: var(--ivory); }
body { font-family: var(--mono); -webkit-font-smoothing: antialiased; overflow-x: hidden; }

#gl, #ph { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; display: block; }
#ph { z-index: 2; pointer-events: none; }

/* the tooth of blueprint paper, gone once the world is built */
#grain {
  position: fixed; inset: 0; pointer-events: none; opacity: 0.35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.35  0 0 0 0 0.40  0 0 0 0 0.50  0 0 0 0.12 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

#track { height: 1300vh; }
.overlay { position: fixed; z-index: 5; }
.cap { transition: none; }

/* glass labels: legible over the drawing and over the built rooms alike */
.glass {
  background: var(--panel);
  border: 1px solid var(--line);
}

body { --ink: #262626; --ink-soft: #4a4743; --halo: var(--navy); --halo-solid: #f1ede6; }
body.dusk { --ink: #f4efe7; --ink-soft: #d8d0c4; --halo: rgba(24, 20, 18, 0.9); --halo-solid: #262626; }
#bar, #rail { color: var(--ink); text-shadow: 0 0 1px var(--halo), 0 0 3px var(--halo), 0 0 8px var(--halo), 0 0 16px var(--halo); }
#hud b { color: inherit !important; }
#bar {
  position: fixed; z-index: 6; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 32px var(--gut) 0;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
}
/* left of the bar: the MONA Media mark, then the project on a hairline */
#bar .brand { display: inline-flex; align-items: center; flex: none; }
#bar .brand img { display: block; height: 24px; width: auto; filter: drop-shadow(0 0 6px var(--halo)) drop-shadow(0 0 12px var(--halo)); }
#bar .brand .on-dark { display: none; }
.dusk #bar .brand .on-light { display: none; }
.dusk #bar .brand .on-dark { display: block; }
#bar .proj { margin-right: auto; padding-left: 16px; margin-left: 16px; border-left: 1px solid var(--ink-soft); font-size: 11px; letter-spacing: 0.16em; line-height: 1.6; white-space: nowrap; }
/* the readout reads like the title block of the sheet: ink rule under it, cells split by hairlines */
.chip { display: inline-flex; white-space: nowrap; padding-bottom: 6px; border-bottom: 1px solid var(--ink); }
.chip > span { padding: 0 14px; border-left: 1px solid var(--ink-soft); }
.chip > span:first-child { padding-left: 0; border-left: 0; }
.chip > span:last-child { padding-right: 0; }
#hud b { font-weight: 500; display: inline-block; min-width: 4.2em; color: var(--ivory); }

/* the hero sits below the bar and sizes by the shorter side, so a short laptop screen never clips it */
#hero { left: clamp(16px, 5.2vw, 84px); top: calc(50% + 34px); transform: translateY(-50%); width: min(38vw, 620px); }
.eyebrow { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: min(18px, 1.6vh); }
.eyebrow .dot { margin: 0 10px; }
h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(50px, min(6.4vw, 10.5vh), 132px); line-height: 1.2; letter-spacing: -0.01em; }
h1 .l { display: block; overflow: hidden; padding: 0.08em 0 0.12em; margin: -0.08em 0 -0.12em; }
h1 .l > span { display: block; }
h1 em { font-style: italic; color: var(--accent, #8a6a3f); }
.lede { font-family: var(--sans); font-weight: 500; font-size: clamp(13.5px, 2.1vh, 16px); line-height: 1.7; max-width: 30em; margin-top: min(22px, 2.4vh); color: var(--ink-soft); }
/* the figures of the house, set like the title block of the sheet */
.spec { display: grid; grid-template-columns: 1fr 1fr; max-width: 30em; margin-top: min(26px, 2.8vh); border-top: 1px solid var(--ink); }
.spec div { padding: min(10px, 1.1vh) 0 min(11px, 1.2vh); border-bottom: 1px solid rgba(38, 38, 38, 0.22); }
.spec div:nth-child(odd) { padding-right: 16px; border-right: 1px solid rgba(38, 38, 38, 0.22); }
.spec div:nth-child(even) { padding-left: 16px; }
.spec dt { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.spec dd { font-variant-numeric: lining-nums; font-family: var(--serif); font-weight: 500; font-size: clamp(17px, 2.8vh, 22px); line-height: 1.3; margin-top: 3px; }
.credit { display: flex; align-items: center; gap: 14px; margin-top: min(22px, 2.4vh); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.credit img { height: 22px; width: auto; display: block; }
.cue { margin-top: min(30px, 3vh); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; display: flex; align-items: center; gap: 14px; color: var(--ink); }
.cue i { display: block; width: 1px; height: min(46px, 5vh); background: var(--ink); transform-origin: top; animation: cue 2.2s cubic-bezier(.6,0,.2,1) infinite; }
@keyframes cue { 0% { transform: scaleY(0); } 55% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* captions read as the drawing's own legend: no panel, ink rules, a paper halo round every
   letter the way a map keeps its labels legible over whatever is underneath */
.cap {
  left: clamp(16px, 3.2vw, 46px); bottom: clamp(22px, 5vh, 54px); width: min(400px, calc(100vw - 32px));
  visibility: hidden; opacity: 0; color: var(--ivory);
  text-shadow: 0 0 1px var(--halo), 0 0 3px var(--halo), 0 0 8px var(--halo), 0 0 16px var(--halo);
}
.cap .no {
  display: flex; justify-content: space-between; gap: 12px; padding-bottom: 7px;
  font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
  border-bottom: 1px solid var(--ivory); box-shadow: 0 1px 3px var(--halo);
}
.cap .no span + span { color: #4a4743; }
.cap .nm { font-family: var(--serif); font-weight: 500; font-size: clamp(30px, 2.5vw, 42px); line-height: 1.2; margin-top: 10px; }
.cap .dim { font-size: 11.5px; letter-spacing: 0.06em; margin-top: 2px; }
.cap dl { margin-top: 12px; font-size: 12px; line-height: 1.45; }
.cap dl div { display: grid; grid-template-columns: 8.6em 1fr; gap: 10px; padding: 6px 0; border-top: 1px dashed rgba(38, 38, 38, 0.55); }
.cap dt { letter-spacing: 0.12em; text-transform: uppercase; font-size: 10.5px; padding-top: 2px; color: #4a4743; }
.cap dd { font-variant-numeric: lining-nums; font-family: var(--serif); font-weight: 500; font-size: 17px; line-height: 1.25; }
.cap.end { width: min(420px, calc(100vw - 32px)); }
/* after dusk the scene is darker than the paper: light ink with a dark halo */
.dusk .cap { color: #f4efe7; }
.dusk .cap .no { border-color: #f4efe7; }
.dusk .cap .no span + span, .dusk .cap dt { color: #d8d0c4; }
.dusk .cap dl div { border-top-color: rgba(244, 239, 231, 0.5); }
.dusk .act { color: #d8d0c4; }
.act { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 20px; font-size: 11px; letter-spacing: 0.08em; color: var(--ivory-soft); }
.btn {
  text-shadow: none; text-decoration: none; white-space: nowrap;
  font-family: var(--mono); font-weight: 500; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--halo-solid); background: var(--ink); padding: 0 20px; min-height: 46px;
  display: inline-flex; align-items: center; gap: 14px; transition: gap .25s, background .25s;
}
.btn::after { content: "→"; letter-spacing: 0; }
@media (hover: hover) { .btn:hover { gap: 22px; background: var(--accent); } }

#rail {
  position: fixed; z-index: 6; right: var(--gut); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
}
/* the sheet index: plain halo text, the current room marked with an ink tick */
#rail span { position: relative; padding: 3px 0; color: var(--ink-soft); transition: color .3s; }
#rail span::before {
  content: ""; position: absolute; right: calc(100% + 10px); top: 50%; width: 0; height: 1px;
  background: var(--ink); box-shadow: 0 0 3px var(--halo); transition: width .4s cubic-bezier(.3,0,.2,1);
}
#rail span.on { color: var(--ink); font-weight: 500; }
#rail span.on::before { width: 26px; }

#loading {
  position: fixed; inset: 0; z-index: 20; background: var(--navy); display: grid; place-items: center; align-content: center; gap: 18px;
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ivory-soft); transition: opacity 1s ease, visibility 1s;
}
#loading i { display: block; width: 160px; height: 1px; background: var(--ivory); transform-origin: left; transform: scaleX(0.04); transition: transform .4s ease; box-shadow: 0 0 0 0.5px var(--line); }
@keyframes load { 0% { transform: scaleX(0); } 60% { transform: scaleX(1); } 100% { transform: scaleX(1); opacity: 0; } }
#loading.done { opacity: 0; visibility: hidden; }

@media (max-width: 760px) {
  #bar { padding: 14px 16px 0; }
  #bar .brand img { height: 19px; }
  #bar .proj { display: none; }
  #hud { font-size: 9px; padding-bottom: 5px; letter-spacing: 0.08em; }
  #hud > span { padding: 0 8px; }
  #hud b { min-width: 0; }
  .wide { display: none; }
  #hero { top: 76px; transform: none; width: calc(100vw - 32px); left: 16px; }
  h1 { font-size: clamp(48px, 15vw, 70px); }
  .eyebrow { margin-bottom: 8px; font-size: 10px; letter-spacing: 0.12em; }
  .lede { font-size: 13.5px; line-height: 1.6; margin-top: 8px; }
  /* on a phone the plan sits right under the text: drop the figures, halo the rest */
  .spec { display: none; }
  #hero { text-shadow: 0 0 1px var(--halo), 0 0 4px var(--halo), 0 0 10px var(--halo), 0 0 18px var(--halo); }
  .credit img { filter: drop-shadow(0 0 6px var(--halo)); }
  .credit { margin-top: 14px; }
  .credit img { height: 18px; }
  .cue, #rail { display: none; }
  .cap { left: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
  .cap .nm { font-size: 30px; margin-top: 8px; }
  .cap dl { margin-top: 8px; }
  .cap dl div { grid-template-columns: 7.4em 1fr; padding: 5px 0; }
  .cap dd { font-size: 16px; }
  .act { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .cue i, #loading i { animation: none; }
  .btn { transition: none; }
}

/* dark palettes: the paper grain lightens instead of darkening */
.dark #grain { mix-blend-mode: screen; }
