/* Chainreactor Lisbon pitch. Ink on cream, plain rectangles, no glow, no glass, no pills.
   Orange is held for the loading doors in the scene; purple is for the dye only. */
@font-face { font-family: "PP Mori"; src: url("fonts/PPMori-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "PP Mori"; src: url("fonts/PPMori-SemiBold.otf") format("opentype"); font-weight: 500 700; font-display: swap; }
:root {
  --ink: #101a2c; --navy: #1d2c44; --cream: #efe8d6; --paper: #f7f2e6; --slate: #5d6d82; --line: rgba(16, 26, 44, .24);
  --dye: #7a4cb0;
  --sans: "PP Mori", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --pad: clamp(18px, 3.2vw, 44px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #bcd3e8; color: var(--ink); font-family: var(--sans); font-size: 18px; line-height: 1.45; -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.is-inside :focus-visible { outline-color: var(--cream); }
[hidden] { display: none !important; }

.haze { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(16, 26, 44, calc(var(--vig, .22) * 1)) 100%); transition: opacity .8s; }
.haze::after { content: ""; position: absolute; inset: 40% 0 0; background: linear-gradient(to top, rgba(14, 22, 38, .5), transparent); transition: opacity .8s; }
body:not([data-state="outside"]) .haze::after { opacity: 0; }
#dip { position: fixed; inset: 0; background: #0c1626; opacity: 0; pointer-events: none; }

/* ---- header */
.bar { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 18px; padding: var(--pad) var(--pad) 0; pointer-events: none; z-index: 5; }
.bar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-height: 44px; }
.mark { height: 34px; width: auto; } .word { height: 15px; width: auto; }
.mark-cream, .word-cream { display: none; }
.is-inside .mark-ink, .is-inside .word-ink { display: none; }
.is-inside .mark-cream, .is-inside .word-cream { display: block; }
.tag { font: 500 13px/1 var(--mono); letter-spacing: .1em; margin-left: auto; opacity: .8; }
.is-inside .bar { color: var(--cream); }

.btn { appearance: none; border: 1.5px solid var(--ink); background: transparent; border-radius: 0; padding: 0 20px; min-height: 48px; cursor: pointer; font-weight: 500; letter-spacing: .01em; display: inline-flex; align-items: center; gap: 10px; }
.btn-solid { background: var(--ink); color: var(--cream); }
.btn-solid:hover { background: var(--navy); }
.btn-line:hover { background: var(--ink); color: var(--cream); }
.is-inside .btn-line { border-color: var(--cream); color: var(--cream); }
.is-inside .btn-line:hover { background: var(--cream); color: var(--ink); }
.link { appearance: none; border: 0; background: none; padding: 0; min-height: 44px; font: 500 13px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.eyebrow { font: 500 13px/1.2 var(--mono); letter-spacing: .12em; margin: 0 0 18px; }
.sub { font-size: clamp(18px, 1.5vw, 24px); margin: 0 0 28px; max-width: 30ch; }
.note { font: 400 13px/1.45 var(--mono); letter-spacing: .02em; margin: 26px 0 0; opacity: .8; max-width: 44ch; }

/* ---- loading */
#loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: #bcd3e8; z-index: 20; transition: opacity .7s; }
#loading p { margin: 0; font: 500 13px var(--mono); letter-spacing: .14em; text-transform: uppercase; }
#loading i { display: block; width: 180px; height: 3px; background: rgba(16, 26, 44, .18); }
#loading b { display: block; height: 100%; width: 0; background: var(--ink); transition: width .25s; }
body:not([data-state="loading"]) #loading { opacity: 0; pointer-events: none; }

/* ---- the street: copy sits in the cool shade on the right of the façade */
#intro { position: fixed; right: var(--pad); bottom: calc(var(--pad) + 8px); width: min(40vw, 620px); color: var(--cream); z-index: 4; transition: opacity .7s, transform .9s; }
#intro .btn-solid { background: var(--cream); color: var(--ink); border-color: var(--cream); }
#intro .btn-solid:hover { background: #fff; }
#intro h1 { font-weight: 500; font-size: clamp(34px, 3.9vw, 62px); line-height: 1.02; letter-spacing: -.02em; margin: 0 0 22px; text-wrap: balance; }
body:not([data-state="outside"]) #intro { opacity: 0; transform: translateY(12px); pointer-events: none; }

#threshold { position: fixed; left: 50%; bottom: 20vh; transform: translateX(-50%); text-align: center; color: var(--cream); opacity: 0; transition: opacity 1s; z-index: 4; pointer-events: none; width: min(90vw, 880px); }
#threshold span { display: block; font: 500 14px var(--mono); letter-spacing: .16em; text-transform: uppercase; margin-bottom: 10px; opacity: .85; }
#threshold strong { display: block; font-weight: 500; font-size: clamp(26px, 3.4vw, 50px); letter-spacing: -.015em; line-height: 1.08; }
#threshold.on { opacity: 1; }

/* ---- inside */
#overview { position: fixed; left: var(--pad); bottom: calc(var(--pad) + 76px); width: min(36vw, 560px); color: var(--cream); z-index: 4; }
#overview h2 { font-weight: 500; font-size: clamp(32px, 3.8vw, 60px); line-height: 1.03; letter-spacing: -.02em; margin: 0 0 20px; text-wrap: balance; }
#overview .btn-solid { background: var(--cream); color: var(--ink); border-color: var(--cream); }
#overview .btn-solid:hover { background: #fff; }

#station { position: fixed; top: 92px; width: min(31vw, 460px); max-height: calc(100dvh - 92px - 96px); overflow: auto; background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); padding: 28px 30px 20px; z-index: 4; transition: opacity .5s; }
#station.side-left { left: var(--pad); } #station.side-right { right: var(--pad); }
#station.swap { opacity: 0; }
.kicker { display: flex; gap: 14px; align-items: baseline; font: 500 13px var(--mono); letter-spacing: .12em; text-transform: uppercase; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 18px; }
.kicker span:first-child { font-size: 30px; letter-spacing: 0; font-weight: 500; }
#station h2 { font-weight: 500; font-size: clamp(26px, 2.5vw, 38px); line-height: 1.06; letter-spacing: -.015em; margin: 0 0 18px; text-wrap: balance; }
#station dl { margin: 0; display: grid; gap: 14px; }
#station dt { font: 500 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--slate); margin-bottom: 3px; }
#station dd { margin: 0; font-size: 17px; line-height: 1.42; }
.process { list-style: none; margin: 18px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); display: flex; gap: 4px; }
.process li { flex: 1; font: 500 11px/1.25 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding-top: 14px; position: relative; color: var(--slate); }
.process li::before { content: ""; position: absolute; left: 0; right: 4px; top: 0; height: 4px; background: var(--line); }
.process li.dye::before { background: var(--dye); }
.process li b { display: block; font-size: 15px; color: var(--ink); letter-spacing: 0; }
.st-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); font: 500 12px var(--mono); letter-spacing: .1em; color: var(--slate); }
.st-nav { display: flex; gap: 8px; }
.st-nav button { width: 48px; height: 48px; border: 1.5px solid var(--ink); background: transparent; cursor: pointer; font-size: 20px; }
.st-nav button:hover { background: var(--ink); color: var(--cream); }

#chapters { position: fixed; left: 50%; bottom: calc(var(--pad) + 4px); transform: translateX(-50%); display: flex; gap: 0; z-index: 5; background: var(--paper); border: 1.5px solid var(--ink); max-width: calc(100vw - 2 * var(--pad)); overflow-x: auto; scrollbar-width: none; }
#chapters button { appearance: none; border: 0; border-right: 1px solid var(--line); background: transparent; min-height: 48px; padding: 0 18px; cursor: pointer; font: 500 14px var(--mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; position: relative; }
#chapters button:last-child { border-right: 0; }
#chapters button span { opacity: .55; margin-right: 6px; }
#chapters button:hover { background: rgba(16, 26, 44, .07); }
#chapters button[aria-current="true"] { background: var(--ink); color: var(--cream); }
#chapters button[aria-current="true"] span { opacity: .7; }
#hint { position: fixed; left: 50%; bottom: calc(var(--pad) + 62px); transform: translateX(-50%); margin: 0; font: 500 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--cream); opacity: .75; z-index: 3; pointer-events: none; white-space: nowrap; }

.foot { position: fixed; left: var(--pad); right: var(--pad); bottom: 10px; display: flex; justify-content: space-between; align-items: center; font: 500 12px var(--mono); letter-spacing: .1em; z-index: 4; pointer-events: none; opacity: .85; }
.foot .link { pointer-events: auto; font-size: 12px; }
.is-inside .foot { color: var(--cream); }

/* ---- dialogs */
dialog { border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); padding: clamp(24px, 4vw, 56px); width: min(1080px, calc(100vw - 2 * var(--pad))); max-height: calc(100dvh - 2 * var(--pad)); overflow: auto; border-radius: 0; }
dialog::backdrop { background: rgba(12, 22, 38, .72); }
dialog .x { position: absolute; top: 10px; right: 12px; width: 48px; height: 48px; border: 0; background: none; font-size: 30px; cursor: pointer; }
dialog h2 { font-weight: 500; font-size: clamp(34px, 5vw, 78px); line-height: 1; letter-spacing: -.025em; margin: 0 0 18px; text-wrap: balance; }
dialog .lead { font-size: clamp(18px, 1.6vw, 24px); max-width: 52ch; margin: 0 0 30px; }
.asks { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0; border-top: 1.5px solid var(--ink); border-left: 1px solid var(--line); }
.asks article { padding: 20px 22px 24px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.asks span { font: 500 13px var(--mono); letter-spacing: .12em; color: var(--slate); }
.asks h3 { font-weight: 500; font-size: 24px; line-height: 1.12; margin: 8px 0 10px; letter-spacing: -.01em; }
.asks p { margin: 0; font-size: 16.5px; }
.exchange { margin-top: 26px; padding: 22px 24px; background: var(--ink); color: var(--cream); }
.exchange span { font: 500 12px var(--mono); letter-spacing: .14em; opacity: .75; }
.exchange p { margin: 8px 0 0; font-size: clamp(20px, 2vw, 28px); line-height: 1.25; max-width: 40ch; }
dialog .fine { font: 400 13px/1.5 var(--mono); color: var(--slate); margin: 22px 0; max-width: 90ch; }
dialog .row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
#credits p { max-width: 70ch; font-size: 17px; }

/* ---- static fallback */
#fallback { position: fixed; inset: 0; overflow: auto; background: var(--cream); z-index: 30; }
.fb-wrap { max-width: 880px; margin: 0 auto; padding: clamp(28px, 6vw, 80px) var(--pad); }
.fb-wrap h1 { font-weight: 500; font-size: clamp(40px, 7vw, 84px); line-height: 1; letter-spacing: -.025em; margin: 0 0 18px; }
.fb-note { font: 400 14px var(--mono); color: var(--slate); }
#fbList { padding: 0; list-style: none; margin: 28px 0; display: grid; gap: 0; border-top: 1.5px solid var(--ink); }
#fbList li { padding: 18px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 70px 1fr; gap: 14px; }
#fbList b { font: 500 26px var(--mono); }
#fbList h3 { margin: 0 0 4px; font-weight: 500; font-size: 22px; } #fbList p { margin: 0 0 4px; font-size: 16.5px; }

/* ---- phones */
@media (max-width: 760px) {
  html, body { font-size: 17px; }
  .tag { display: none; } .bar { gap: 10px; } .bar .btn-line { margin-left: auto; min-height: 44px; padding: 0 14px; font-size: 15px; }
  .word { display: none; }
  #intro { right: var(--pad); left: var(--pad); top: auto; bottom: calc(var(--pad) + 18px); transform: none; width: auto; background: var(--paper); border: 1.5px solid var(--ink); padding: 18px 18px 16px; color: var(--ink); }
  #intro .btn-solid { background: var(--ink); color: var(--cream); border-color: var(--ink); }
  body:not([data-state="outside"]) #intro { transform: translateY(10px); }
  #intro h1 { font-size: 30px; margin-bottom: 12px; } #intro .eyebrow { margin-bottom: 10px; } #intro .sub { margin-bottom: 16px; font-size: 17px; } #intro .note { display: none; }
  #overview { left: var(--pad); right: var(--pad); width: auto; bottom: calc(var(--pad) + 70px); }
  #overview h2 { font-size: 30px; }
  #station { left: var(--pad) !important; right: var(--pad) !important; top: auto; bottom: calc(var(--pad) + 62px); transform: none; width: auto; max-height: 46dvh; overflow: auto; padding: 16px 18px 12px; }
  #station dd { font-size: 15.5px; } #station h2 { font-size: 24px; margin-bottom: 10px; } .kicker { margin-bottom: 10px; padding-bottom: 8px; }
  #chapters { left: var(--pad); right: var(--pad); transform: none; max-width: none; bottom: calc(var(--pad) - 6px); }
  #hint, .foot { display: none; }
  #threshold { bottom: 28vh; }
}
@media (prefers-reduced-motion: reduce) { * { transition-duration: .01ms !important; animation-duration: .01ms !important; } }
@media print {
  html, body { overflow: visible; background: #fff; }
  canvas, .haze, #dip, .bar, #loading, #intro, #threshold, #overview, #station, #chapters, #hint, .foot, #fallback { display: none !important; }
  dialog { position: static; display: block !important; border: 0; width: auto; max-height: none; overflow: visible; padding: 0; } dialog .x, dialog .row { display: none; }
  dialog#credits { display: none !important; } .exchange { background: none; color: #000; border: 1.5px solid #000; }
}

/* ?ui=0 : the picture alone, for review captures */
.no-ui .bar, .no-ui #intro, .no-ui #overview, .no-ui #station, .no-ui #chapters, .no-ui #hint, .no-ui .foot, .no-ui .haze { display: none !important; }

#fbList img { width: 100%; max-width: 520px; display: block; margin-bottom: 10px; border: 1.5px solid var(--ink); }

@media (max-height: 800px) and (min-width: 761px) { #station { padding: 18px 22px 12px; } #station dd { font-size: 15.5px; line-height: 1.36; } #station h2 { font-size: 26px; margin-bottom: 10px; } #station dl { gap: 9px; } .kicker { margin-bottom: 10px; padding-bottom: 8px; } .process { margin-top: 10px; padding-top: 10px; } .st-foot { margin-top: 12px; } .st-nav button { width: 44px; height: 44px; } }

/* ---- tuning panel (press T, or open with ?tune=1) */
#tune { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100vw); background: var(--paper); color: var(--ink); border-left: 1.5px solid var(--ink); z-index: 40; display: flex; flex-direction: column; font-size: 14px; }
#tune[hidden] { display: none; }
#tune header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
#tune header b { font-size: 18px; font-weight: 500; }
#tune .st { font: 500 11px var(--mono); letter-spacing: .08em; color: var(--slate); margin-left: auto; text-transform: uppercase; }
#tune header button { width: 36px; height: 36px; border: 0; background: none; font-size: 24px; cursor: pointer; }
#tune .tabs { display: flex; border-bottom: 1px solid var(--line); }
#tune .tabs button { flex: 1; min-height: 40px; border: 0; background: none; font: 500 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
#tune .tabs button[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
#tune .tab { overflow: auto; padding: 10px 14px 24px; flex: 1; }
#tune .row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; align-items: center; }
#tune button, #tune select, #tune input[type=text], #tune .file { font: 500 12px var(--sans); border: 1.5px solid var(--ink); background: transparent; padding: 6px 10px; min-height: 34px; border-radius: 0; cursor: pointer; color: var(--ink); }
#tune button:hover, #tune .file:hover { background: var(--ink); color: var(--cream); }
#tune .file input { display: none; }
#tune .baked { font: 400 11.5px/1.45 var(--mono); color: var(--slate); margin: 8px 0; }
#tune fieldset { border: 1px solid var(--line); margin: 10px 0; padding: 6px 10px 8px; }
#tune legend { font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 0 4px; }
#tune legend i { font-style: normal; background: var(--ink); color: var(--cream); padding: 1px 5px; margin-left: 6px; }
#tune label { display: grid; grid-template-columns: 112px 1fr 58px; gap: 8px; align-items: center; margin: 5px 0; font-size: 12px; }
#tune label.c { grid-template-columns: 1fr; }
#tune input[type=range] { width: 100%; accent-color: var(--ink); }
#tune input[type=number] { width: 58px; font: 500 11px var(--mono); border: 1px solid var(--line); background: #fff8; padding: 3px; }
#tune textarea { width: 100%; font: 400 13px/1.35 var(--sans); border: 1px solid var(--line); background: #fff8; padding: 6px; resize: vertical; color: var(--ink); }
#tune details { border-bottom: 1px solid var(--line); padding: 6px 0; }
#tune summary { cursor: pointer; font-weight: 500; min-height: 30px; display: flex; align-items: center; }
#tune code { font: 400 11px var(--mono); }
body.tuning #station.side-right, body.tuning #intro { right: calc(min(380px, 100vw) + var(--pad)); }
@media (max-width: 760px) { #tune { width: 100vw; } }

/* ---- the stage: stills and film, nothing live */
#stage { position: fixed; inset: -14px; overflow: hidden; background: #cfd6dc; transition: filter .4s; --px: 0px; --py: 0px; }
#stage img, #stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .45s; transform: translate(var(--px), var(--py)) scale(1.012); transition-property: opacity, transform; transition-duration: .45s, .5s; }
#stage img.on, #stage video.on { opacity: 1; }
#stage video { transition: none; }
#plates { position: absolute; inset: 14px; }
.plate { position: absolute; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--ink); background: var(--cream); color: var(--ink); font: 600 15px var(--mono); cursor: pointer; display: grid; place-items: center; }
.plate:hover { background: var(--ink); color: var(--cream); }
