/* The map page. One canvas that never scrolls, and the words scrolling beside it (below it on a phone). */
/* it and the original portfolio at /explore/ cross-fade into each other where the browser can, and a
   project's name carries over into its case study's title */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.4s; }
::view-transition-group(pname) { animation-duration: 0.6s; animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1); }
:root {
  --bg: #0a0b0d;
  --ink: #ecebe6;
  --dim: rgba(236, 235, 230, 0.56);
  --faint: rgba(236, 235, 230, 0.16);
  --line: rgba(236, 235, 230, 0.1);
  --panel: rgba(14, 15, 18, 0.92);
  --red: #ff5d5d;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --vh: 100vh;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.5 var(--sans); overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px; font: 500 13px var(--mono); text-decoration: none; }
.skip:focus { top: 12px; }

#map { position: fixed; left: 0; top: 0; width: 100%; height: 100vh; display: block; touch-action: pan-y; z-index: 0; }
body.stacked #map { z-index: 6; }

/* ---------------------------------------------------------------- HUD */
.hud { position: fixed; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; z-index: 10; pointer-events: none; opacity: 0; transition: opacity 0.6s var(--ease); }
.hud > * { pointer-events: auto; }
body.ready .hud { opacity: 1; }
.hud.top { top: 0; height: var(--top, 76px); background: linear-gradient(var(--bg) 30%, rgba(10, 11, 13, 0)); }
.brand { display: flex; flex-direction: column; text-decoration: none; line-height: 1.1; transition: opacity 0.4s; }
.brand b { font: 400 25px var(--serif); letter-spacing: 0.005em; }
.brand span { font: 500 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); margin-top: 3px; }
/* on the first screen the words already say the name, so the HUD stays quiet */
body.at-start .brand { opacity: 0; pointer-events: none; }

.tools { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.status { display: flex; align-items: center; gap: 8px; margin: 0; font: 400 11px var(--mono); color: var(--dim); }
.status i { width: 7px; height: 7px; border-radius: 50%; background: #4fe3c1; box-shadow: 0 0 8px #4fe3c1; }
.status.off i { background: var(--red); box-shadow: 0 0 8px var(--red); }
.status.off { color: var(--red); }
.sound { display: flex; align-items: center; gap: 8px; font: 500 11px var(--mono); color: var(--dim); border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px 6px 10px; transition: color 0.2s, border-color 0.2s; }
.sound:hover { color: var(--ink); border-color: var(--faint); }
.sound i { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 10px; }
.sound i b { width: 2px; height: 3px; background: currentColor; border-radius: 1px; }
.sound i b:nth-child(2) { height: 6px; }
.sound i b:nth-child(3) { height: 9px; }
.sound[aria-pressed="false"] i::after { content: ""; position: absolute; left: -2px; right: -2px; top: 50%; height: 1px; background: currentColor; transform: rotate(-40deg); }
.sound[aria-pressed="true"] { color: var(--ink); border-color: var(--faint); }
.sound[aria-pressed="true"] i b { animation: eq 0.9s ease-in-out infinite; }
.sound[aria-pressed="true"] i b:nth-child(2) { animation-delay: -0.3s; }
.sound[aria-pressed="true"] i b:nth-child(3) { animation-delay: -0.6s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 10px; } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 10px); z-index: 30; margin: 0; max-width: min(560px, calc(100% - 32px)); padding: 10px 16px; border-radius: 10px; border: 1px solid var(--faint); background: var(--panel); font: 400 13px var(--sans); opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s var(--ease); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- the thread: where you are on the page */
.thread { position: fixed; z-index: 7; left: 22px; top: calc(var(--top, 76px) + 28px); bottom: 44px; width: 1px; background: var(--line); pointer-events: none; opacity: 0; transition: opacity 0.6s; --p: 0; }
body.ready .thread { opacity: 1; }
.thread b { position: absolute; left: -3px; top: calc(var(--k) * 100%); width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--bg); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); }
.thread .pk { position: absolute; left: -6px; top: calc(var(--p) * 100%); width: 13px; height: 13px; margin-top: -6.5px; border-radius: 50%; border: 1px solid var(--ink); box-shadow: 0 0 12px rgba(236, 235, 230, 0.35); }
body.stacked .thread { left: 16px; right: 16px; top: calc(var(--vb) - 5px); bottom: auto; width: auto; height: 1px; }
body.stacked .thread b { left: calc(var(--k) * 100%); top: -3px; margin: 0 0 0 -3.5px; }
body.stacked .thread .pk { left: calc(var(--p) * 100%); top: -6px; margin: 0 0 0 -6.5px; }

/* ---------------------------------------------------------------- the words */
.flow { position: relative; z-index: 2; width: var(--pw, 440px); opacity: 0; transition: opacity 0.6s var(--ease); }
body.ready .flow { opacity: 1; }
.flow::before { content: ""; position: fixed; z-index: -1; left: 0; top: 0; bottom: 0; width: var(--pw, 440px); background: linear-gradient(90deg, rgba(10, 11, 13, 0.97) 82%, rgba(10, 11, 13, 0)); pointer-events: none; }
.sec { --c: var(--ink); min-height: var(--vh); display: flex; flex-direction: column; justify-content: center; padding: calc(var(--top, 76px) + 16px) 34px 48px 54px; }
.pn-in { display: flex; flex-direction: column; gap: 14px; transition: opacity 0.5s var(--ease); }
.sec:not(.on) .pn-in { opacity: 0.26; }
/* the first time a section comes into view its lines rise in, one after another */
.sec .pn-in > * { opacity: 0; transform: translateY(14px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.sec.seen .pn-in > * { opacity: 1; transform: none; }
.sec.seen .pn-in > :nth-child(2) { transition-delay: 0.06s; }
.sec.seen .pn-in > :nth-child(3) { transition-delay: 0.12s; }
.sec.seen .pn-in > :nth-child(4) { transition-delay: 0.18s; }
.sec.seen .pn-in > :nth-child(n + 5) { transition-delay: 0.24s; }

.pn-kind { margin: 0; font: 500 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.pn-kind b { color: var(--c); font-weight: 600; }
.pn-role { display: flex; align-items: center; gap: 10px; color: rgba(236, 235, 230, 0.7); }
.pn-role .dot { width: 7px; height: 7px; border-radius: 50%; background: #4fe3c1; box-shadow: 0 0 10px #4fe3c1; animation: beat 2s ease-in-out infinite; }
@keyframes beat { 50% { opacity: 0.35; } }
.pn-hello { margin: -4px 0 0 -3px; font: 400 clamp(64px, 6.6vw, 104px) / 0.92 var(--serif); letter-spacing: -0.01em; }
.pn-tag { margin: 0; font: 400 clamp(26px, 2.3vw, 34px) / 1.15 var(--serif); color: rgba(236, 235, 230, 0.82); }
.pn-tag em { color: #4fe3c1; }
.pn-name { margin: -4px 0 0 -2px; font: 400 clamp(46px, 4.4vw, 70px) / 0.95 var(--serif); }
/* the name is the door to the case study one level down: its corner mark is the map frame's corner */
.pn-door { position: relative; display: inline-block; padding-right: 0.42em; color: inherit; text-decoration: none; }
.pn-door i { position: absolute; right: 0.04em; top: 0.12em; width: 0.22em; height: 0.22em; border-top: 2px solid var(--c); border-right: 2px solid var(--c); opacity: 0.75; transition: transform 0.35s var(--ease), opacity 0.35s; }
.pn-door span[data-decode] { background: linear-gradient(var(--c), var(--c)) 0 100% / 0 2px no-repeat; transition: background-size 0.45s var(--ease); }
.pn-door:hover i, .pn-door:focus-visible i { transform: translate(0.07em, -0.07em) scale(1.3); opacity: 1; }
.pn-door:hover span[data-decode], .pn-door:focus-visible span[data-decode] { background-size: 100% 2px; }
.pn-door:focus-visible { outline: none; }
/* links inside the copy */
.pn-lede a, .pn-proof a, .pn-foot a { color: var(--ink); text-decoration: underline 1px; text-decoration-color: color-mix(in srgb, var(--c) 55%, transparent); text-underline-offset: 3px; transition: text-decoration-color 0.25s, color 0.25s; }
.pn-lede a:hover, .pn-proof a:hover, .pn-foot a:hover { text-decoration-color: var(--c); }
.pn-proof a { white-space: nowrap; }
/* diving into a cell: everything but the name gets out of the way */
body.diving .pn-in > :not(.pn-name), body.diving .hud, body.diving .thread { opacity: 0 !important; transition: opacity 0.3s var(--ease); }
.pn-name-s { font-size: clamp(34px, 3vw, 46px); line-height: 1.04; }
.pn-name-s em { font-style: italic; color: var(--dim); }
.pn-q { margin: 0; font: italic 400 21px/1.3 var(--serif); color: var(--dim); }
.pn-lede { margin: 0; font-size: 16.5px; line-height: 1.55; color: rgba(236, 235, 230, 0.78); max-width: 34ch; }
.pn-try { display: flex; gap: 12px; align-items: baseline; margin: 6px 0 0; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--c) 9%, transparent); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent); font-size: 16px; line-height: 1.45; color: var(--c); }
.pn-try i { font-style: normal; font-weight: 600; }
.pn-try i::before { content: "→"; display: inline-block; animation: point 1.6s var(--ease) infinite; }
body.stacked .pn-try i::before { content: "↑"; animation-name: point-up; }
@keyframes point { 50% { transform: translateX(4px); } }
@keyframes point-up { 50% { transform: translateY(-3px); } }
.pn-query { font: 400 15px var(--sans); color: var(--ink); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--faint); border-radius: 8px; padding: 10px 12px; }
.pn-query:focus { outline: none; border-color: var(--c); }
.pn-ctl { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: baseline; padding: 12px 0 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pn-ctl label { font: 500 11px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.pn-ctl output { font: 600 13px var(--mono); color: var(--c); }
.pn-ctl input { grid-column: 1 / -1; width: 100%; accent-color: var(--c); height: 24px; margin: 0; }
input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--faint); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px rgba(10, 11, 13, 1), 0 0 14px var(--c); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--faint); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--c); }
.pn-live { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; }
.pn-live:empty { display: none; }
.pn-live div { min-width: 0; }
.pn-live dt { font: 400 10px var(--mono); color: var(--dim); }
.pn-live dd { margin: 2px 0 0; font: 600 18px var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.pn-proof { margin: 0; font-size: 13.5px; color: var(--dim); }
.pn-links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.pn-contact { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0 0; font: 400 12.5px var(--mono); }
.pn-contact a { color: var(--dim); text-decoration: none; }
.pn-contact a:hover { color: var(--ink); }
.pn-mail { align-self: flex-start; font: 400 clamp(30px, 2.9vw, 44px) / 1.1 var(--serif); text-decoration: none; background: linear-gradient(var(--ink), var(--ink)) 0 100% / 0 1px no-repeat; transition: background-size 0.4s var(--ease); padding-bottom: 2px; word-break: break-all; }
.pn-mail:hover, .pn-mail:focus-visible { background-size: 100% 1px; }
.pn-foot { margin: 18px 0 0; font: 400 11px var(--mono); color: var(--dim); }
.btn { display: inline-flex; align-items: center; gap: 6px; font: 500 13px var(--mono); text-decoration: none; padding: 10px 15px; border-radius: 8px; background: var(--c); color: var(--bg); }
.btn.ghost { background: none; color: var(--ink); border: 1px solid var(--faint); }
.btn:hover { filter: brightness(1.1); }
.btn.ghost:hover { border-color: var(--ink); }

/* a first glance down the page: the start of the thread, with a packet already on its way */
.cue { position: relative; display: block; width: 1px; height: 52px; margin: 22px 0 0 3px; background: var(--faint); }
.cue i { position: absolute; left: -3px; top: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 10px rgba(236, 235, 230, 0.6); animation: cue 1.9s var(--ease) infinite; }
@keyframes cue { 0% { transform: translateY(0); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(46px); opacity: 0; } }

/* stacked: the map stays on top and the words scroll up underneath it */
body.stacked .flow { width: auto; padding-top: var(--vb); }
body.stacked .flow::before { display: none; }
body.stacked .sec { min-height: calc(var(--vh) - var(--vb)); justify-content: flex-start; padding: 22px 18px 34px; }
body.stacked .pn-in { gap: 11px; }
body.stacked .pn-hello { font-size: clamp(46px, 12vw, 72px); }
body.stacked .pn-name { font-size: clamp(38px, 9vw, 56px); }
body.stacked .pn-name-s { font-size: clamp(28px, 7vw, 40px); }
body.stacked .pn-tag { font-size: 22px; }
body.stacked .pn-q { font-size: 18px; }
body.stacked .cue { display: none; }

.noscript { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--bg); z-index: 60; }
.noscript p { max-width: 640px; line-height: 1.8; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 640px) {
  .hud { padding: 0 12px; }
  .pn-live dd { font-size: 15px; }
  .brand b { font-size: 21px; }
  .brand span { display: none; }
  .status { display: none; }
  .sound span { display: none; }
  .sound { padding: 7px 9px; }
  .pn-try { margin: 0; padding: 10px 12px; font-size: 15px; }
  .pn-lede { font-size: 15px; line-height: 1.5; }
  body.stacked .pn-in { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .sec .pn-in > * { transform: none; }
}
