:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --ink: #f1ede6;
  --ink-2: #a7a29a;
  --ink-3: #6b675f;
  --line: rgba(241, 237, 230, 0.09);
  --line-2: rgba(241, 237, 230, 0.18);
  --card: rgba(18, 18, 23, 0.72);
  --accent: #f5b942;
  --radius: 18px;
  --gutter: clamp(16px, 4vw, 48px);
  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --sans: "Inter Tight", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
kbd {
  font: 500 10.5px/1 var(--mono);
  padding: 3px 5px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  color: var(--ink-2);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* The living field behind the hero, and a little film grain over everything. */
.field { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
/* The background is a live piece, fixed behind the whole page; it hears the pointer through the window. */
apeiron-player.bg-art { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; pointer-events: none; }
.grain {
  position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, .foot { position: relative; z-index: 2; }
.bar { z-index: 5; }

/* Bar */
.bar {
  position: sticky; top: 0;
  display: flex; align-items: center; gap: 20px;
  padding: 14px var(--gutter);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: linear-gradient(to bottom, rgba(8, 8, 11, 0.75), rgba(8, 8, 11, 0.35));
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.bar.scrolled { border-bottom-color: var(--line); }
.mark { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
.mark-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
  transition: background 0.6s, box-shadow 0.6s;
}
.bar-links { display: flex; gap: 18px; margin-left: auto; color: var(--ink-2); font-size: 14px; }
.bar-links a:hover { color: var(--ink); }
.find {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px 7px 12px;
  background: rgba(241, 237, 230, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.bar-links:empty + .find { margin-left: auto; }
.find:hover { border-color: var(--line-2); color: var(--ink); }

/* Hero */
/* The hero is a live Apeiron piece, full bleed under the bar; the copy sits bottom right. */
.hero {
  position: relative;
  min-height: clamp(520px, 78svh, 760px);
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 120px var(--gutter) clamp(32px, 7vh, 72px);
  overflow-x: clip; /* not y: the letters drift down past the bottom as you scroll */
}
/* A compact block for the letters, left of the copy; the piece scales to fit it. */
.hero-art {
  position: absolute; z-index: 0;
  top: 88px; left: 0;
  width: min(58vw, 780px); aspect-ratio: 1.15; max-height: calc(100% - 120px);
}
/* Parallax: the letters lag and fade as you scroll into the work (see parallax() in hub.js). */
.hero-art, .hero-copy { will-change: transform; }
.hero-art { opacity: calc(1 - var(--scroll, 0) * 0.85); }
.hero-copy { opacity: calc(1 - var(--scroll, 0) * 1.6); }
/* The stretch between hero and work; layers with data-depth go here. */
.runway { position: relative; z-index: 1; height: clamp(80px, 18vh, 200px); pointer-events: none; }
/* Transparent pieces let the flowing field show through behind them. */
.hero-art apeiron-player { display: block; width: 100%; height: 100%; background: transparent; }
.hero-copy { position: relative; z-index: 2; max-width: 420px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 760px) {
  /* On a phone the letters sit on top, as wide as the screen. They are drawn 0.74 of the box's height wide and
     29% to 73% of its height down, so the box is tall (--ah) and pulled up so the empty band above them hides
     off the top. The copy follows straight after the letters. */
  .hero { --ah: min(118vw, 520px); justify-content: flex-start; min-height: 0; padding-top: calc(44px + 0.5 * var(--ah)); padding-bottom: 8px; }
  .hero-art { z-index: 1; top: calc(44px - 0.27 * var(--ah)); left: 0; width: 100%; height: var(--ah); aspect-ratio: auto; max-height: none; }
  .hero-copy { max-width: none; }
  /* A dark veil over the rooms behind the letters and copy, fading out below so the background still shows. */
  .hero { padding-bottom: 40px; }
  .hero::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background: linear-gradient(to bottom, rgba(11, 13, 16, 0.88) 0%, rgba(11, 13, 16, 0.7) 28%, rgba(11, 13, 16, 0) 55%);
  }
  .tagline { font-size: 18px; }
  .hero-actions { margin-top: 22px; }
  .work { padding-top: 56px; }
  .work-head h2 { font-size: 38px; }
}
.eyebrow {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 18px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-2);
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #ff4d4d; box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(255, 77, 77, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 77, 77, 0); } }
.title {
  margin: 0;
  font: 400 clamp(56px, 12.5vw, 196px)/0.88 var(--serif);
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.title em { font-style: italic; color: var(--accent); transition: color 0.6s; }
.title .w { display: inline-block; opacity: 0; transform: translateY(0.35em) rotate(2deg); filter: blur(8px); animation: rise 1s var(--ease) forwards; }
@keyframes rise { to { opacity: 1; transform: none; filter: none; } }
.tagline { max-width: 34ch; margin: 0; font-size: clamp(17px, 1.6vw, 21px); color: var(--ink-2); text-wrap: pretty; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: rgba(8, 8, 11, 0.4);
  font-weight: 500; cursor: pointer;
  transition: transform 0.3s var(--ease), background 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--ink-3); }
.btn-solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-solid:hover { background: #fff; }
.btn kbd { border-color: var(--line-2); }
.hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 28px 0 0; font: 400 12px var(--mono); color: var(--ink-3); }
.hint-keys { display: inline-flex; align-items: center; gap: 6px; }
.hint-keys kbd + kbd { margin-left: 8px; }
.recording .live-dot { background: #ff4d4d; animation-duration: 0.6s; }
.recording .hint-keys::after { content: "Recording…"; margin-left: 10px; color: #ff4d4d; }

/* Work */
.work { padding: 0 var(--gutter) 120px; scroll-margin-top: 40px; }
.work-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 16px 28px;
  margin-bottom: 28px;
}
.work-head h2 { margin: 0; font: italic 400 44px/1 var(--serif); letter-spacing: -0.02em; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--ink-2);
  font-size: 13px; cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { color: var(--ink); border-color: var(--line-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip sup { font: 500 9.5px var(--mono); margin-left: 3px; opacity: 0.6; }

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: clamp(16px, 2vw, 28px);
}
.grid > li { min-width: 0; }
.grid > li.big { grid-column: span 2; }
@media (max-width: 760px) { .grid > li.big { grid-column: auto; } }

/* A card: cover at rest, the real site playing inside it on hover. */
.card {
  --a: var(--accent);
  position: relative; display: block;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease), border-color 0.3s;
}
.card.in { opacity: 1; transform: none; }
.card::before {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--a) 22%, transparent), transparent 45%);
  opacity: 0; transition: opacity 0.3s;
}
.card:hover { border-color: color-mix(in srgb, var(--a) 45%, transparent); }
.card:hover::before { opacity: 1; }
.card-media {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  background: #0d0d12;
}
.big .card-media { aspect-ratio: 16 / 8.2; }
@media (max-width: 760px) { .big .card-media { aspect-ratio: 16 / 10; } }
.card-media img,
.card-media .gen {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform 1.2s var(--ease), opacity 0.5s;
}
.card:hover .card-media img,
.card:hover .card-media .gen { transform: scale(1.04); }
.gen {
  background:
    radial-gradient(120% 90% at var(--gx, 30%) var(--gy, 20%), color-mix(in srgb, var(--a) 70%, transparent), transparent 60%),
    conic-gradient(from var(--gr, 0deg) at 70% 70%, #101018, color-mix(in srgb, var(--a) 40%, #101018), #101018 60%);
}
.gen span {
  position: absolute; left: 22px; bottom: 14px;
  font: italic 400 clamp(40px, 6vw, 72px)/1 var(--serif);
  color: rgba(255, 255, 255, 0.85); mix-blend-mode: overlay;
}
.card-media iframe {
  position: absolute; left: 0; top: 0;
  width: 1280px; height: 800px; border: 0;
  transform-origin: 0 0;
  opacity: 0; pointer-events: none;
  transition: opacity 0.6s var(--ease);
}
.card.live iframe { opacity: 1; }
.card.live .card-media img,
.card.live .card-media .gen { opacity: 0; }
.badge {
  position: absolute; z-index: 2; top: 12px; left: 12px;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 9px;
  background: rgba(8, 8, 11, 0.6);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: 999px;
  font: 500 10.5px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2);
  opacity: 0; transform: translateY(-4px); transition: all 0.3s var(--ease);
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: #ff4d4d; }
.card.live .badge { opacity: 1; transform: none; }
.card-body { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: baseline; padding: 16px 18px 18px; }
.card-num { font: 500 11px var(--mono); color: var(--ink-3); }
.card-title { margin: 0; font: 400 25px/1.1 var(--serif); letter-spacing: -0.01em; }
.big .card-title { font-size: 34px; }
.card-arrow {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line-2);
  transition: all 0.3s var(--ease);
}
.card:hover .card-arrow { background: var(--a); border-color: var(--a); color: #0b0b0f; transform: rotate(-45deg); }
.card-desc { grid-column: 2 / 4; margin: 0; color: var(--ink-2); font-size: 14px; }
.card-meta { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font: 400 11.5px var(--mono); color: var(--ink-3); }
.card-meta .tag::before { content: "#"; opacity: 0.6; }
.card-meta .out { color: var(--ink-2); }

.empty { padding: 80px 0; text-align: center; color: var(--ink-2); }
.empty-title { font: italic 400 40px var(--serif); color: var(--ink); margin: 0 0 12px; }
.empty code { font: 13px var(--mono); color: var(--ink); background: rgba(241, 237, 230, 0.06); padding: 3px 8px; border-radius: 6px; }

/* Footer */
.foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 28px var(--gutter) calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font: 400 12px var(--mono); color: var(--ink-3);
}
.foot-grow { flex: 1; }

/* Search palette */
.palette {
  width: min(560px, calc(100vw - 32px));
  margin: 12vh auto auto; padding: 0;
  border: 1px solid var(--line-2); border-radius: 16px;
  background: rgba(16, 16, 21, 0.92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  color: var(--ink);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
}
.palette::backdrop { background: rgba(4, 4, 6, 0.55); backdrop-filter: blur(3px); }
.palette[open] { animation: pop 0.22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.palette-input {
  width: 100%; padding: 18px 20px;
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  color: var(--ink); font: 400 18px var(--sans); outline: none;
}
.palette-input::-webkit-search-cancel-button { display: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.palette-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
}
.palette-list li[aria-selected="true"] { background: rgba(241, 237, 230, 0.08); }
.palette-list .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.palette-list .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-list .d { font: 400 11px var(--mono); color: var(--ink-3); }
.palette-list .none { color: var(--ink-3); cursor: default; }
.palette-foot { display: flex; gap: 5px; align-items: center; margin: 0; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }

@media (max-width: 600px) {
  .find span, .find kbd { display: none; }
  .find { padding: 8px; }
  .bar-links { display: none; }
  .hint { display: none; }
  .hero-actions .btn kbd { display: none; }
}

/* ---------- The hallway: every site hung as a picture; scroll to walk, the real sites live in their frames (hall.js) ---------- */
/* Room to breathe: the hero's field shows for a while before the hall begins, and again before the work */
.hall { position: relative; margin: 40vh 0 24vh; scroll-margin-top: 0; }
.hall-art {
  display: block;
  width: 100%;
  /* Out of the hero's field and into the hall without a seam, and out again into the work: the hall fades in and out over the page behind it */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 36vh, #000 calc(100% - 30vh), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 36vh, #000 calc(100% - 30vh), transparent 100%);
}
.hall-over { position: absolute; inset: 0; pointer-events: none; }
.hall-pin { position: sticky; top: 0; height: 100vh; overflow: hidden; perspective: none; }
.hall-site {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform, opacity;
  backface-visibility: hidden;
}
.hall-site {
  width: 1280px;
  height: 800px;
  overflow: hidden;
  background: #07080a;
  filter: brightness(0.78) saturate(0.85);
  transition: filter 0.5s var(--ease);
}
.hall-site.near { filter: none; }
.hall-site .hall-cover,
.hall-site iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; background: transparent; }
/* The frame's glass: a hairline and a soft dark falloff at the edges, over the site but never in its way */
.hall-site::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(241, 237, 230, 0.07), inset 0 0 160px rgba(0, 0, 0, 0.5);
}
.hall-visit { position: absolute; pointer-events: auto; border-radius: 999px; z-index: 100000; }
.hall-visit:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .hall-site { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .card { opacity: 1; transform: none; }
}

/* Before the first piece is published. */
.no-sites .hero-actions,
.no-sites .filters { display: none; }
