:root {
  --paper: #efeee8;
  --ink: #151817;
  --muted: #656964;
  --line: rgba(21, 24, 23, 0.2);
  --signal: #e43f1d;
  --night: #090d0d;
  --night-soft: #111817;
  --night-line: rgba(238, 238, 229, 0.18);
  --night-copy: #d7d9d0;
  --measure: 86rem;
  color-scheme: light dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 20rem;
  background:
    linear-gradient(90deg, transparent calc(50% - 0.5px), rgba(21, 24, 23, 0.03) 50%, transparent calc(50% + 0.5px)),
    var(--paper);
}

a { color: inherit; text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--signal); }
button, textarea, input { font: inherit; }
canvas { display: block; width: 100%; height: 100%; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 30;
  padding: 0.65rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.site-header,
.site-footer,
main {
  width: min(calc(100% - 2rem), var(--measure));
  margin-inline: auto;
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1.35rem 0 1rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  width: fit-content;
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0.14em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark {
  width: 1.65rem;
  aspect-ratio: 1;
  border: 1px solid currentColor;
  border-radius: 50%;
  position: relative;
}
.brand-mark::before {
  content: "";
  position: absolute;
  inset: 25% 14%;
  border: 1px solid currentColor;
  border-radius: 50%;
  transform: rotate(48deg);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 41%;
  border-radius: 50%;
  background: var(--signal);
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem 1.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

nav a {
  font-size: 0.76rem;
  color: var(--muted);
  text-decoration: none;
}
nav a[aria-current="page"], nav a:hover { color: var(--ink); }

main { min-height: 72vh; }

.eyebrow,
.work-number,
.work-facts,
.studio-status,
.editor-heading,
.shader-frame + figcaption {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow { margin: 0 0 1.1rem; color: var(--signal); }

h1, h2, h3, p { margin-top: 0; }
h1, h2, .display {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.048em;
}

h1 {
  max-width: 10ch;
  margin-bottom: 1.4rem;
  font-size: clamp(3.7rem, 9vw, 8.8rem);
  line-height: 0.86;
}

.hero {
  display: grid;
  grid-template-columns: 0.87fr 1.13fr;
  gap: clamp(2rem, 6vw, 7rem);
  align-items: center;
  padding: clamp(3.5rem, 7vw, 7rem) 0 clamp(5rem, 10vw, 10rem);
}

.hero-copy > p:not(.eyebrow),
.page-intro .lede,
.work-intro .lede,
.about-lede {
  max-width: 38rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  line-height: 1.58;
}

.hero-actions,
.studio-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6rem;
  padding: 0.62rem 0.9rem;
  border: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 0.72rem;
  font-weight: 680;
  letter-spacing: 0.055em;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}
.button:hover:not(:disabled), .button:focus-visible { background: var(--signal); border-color: var(--signal); color: #fff; }
.button-solid { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.button:disabled { cursor: not-allowed; opacity: 0.38; }

.hero-figure { margin: 0; }
.hero-figure figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.7rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.shader-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: var(--night);
}
.shader-frame-hero { aspect-ratio: 6 / 7; }
.shader-fallback {
  display: none;
  position: absolute;
  inset: auto 1rem 1rem;
  margin: 0;
  color: var(--night-copy);
  font-size: 0.78rem;
  line-height: 1.45;
}
.shader-failed .shader-fallback { display: block; }

.section-heading,
.page-intro,
.work-intro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 7vw, 8rem);
  padding: clamp(4rem, 9vw, 9rem) 0 clamp(3rem, 6vw, 6rem);
  border-top: 1px solid var(--line);
}
.section-heading h2 {
  margin: 0;
  font-size: clamp(2.5rem, 5vw, 5.7rem);
  line-height: 0.94;
}
.section-heading > p,
.intro-copy,
.work-intro-copy {
  align-self: end;
  max-width: 38rem;
  color: var(--muted);
  line-height: 1.65;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(3rem, 7vw, 8rem) clamp(1rem, 3vw, 2.5rem);
  padding-bottom: clamp(6rem, 12vw, 12rem);
}
.work-grid-full { padding-bottom: clamp(6rem, 12vw, 12rem); }
.work-card:nth-child(even) { transform: translateY(clamp(2rem, 7vw, 6rem)); }
.work-card a { display: block; text-decoration: none; }
.work-card-copy {
  display: grid;
  grid-template-columns: 4.25rem 1fr;
  gap: 0 1rem;
  padding-top: 0.9rem;
}
.work-number { grid-row: span 2; color: var(--signal); padding-top: 0.3rem; }
.work-card h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 3rem); line-height: 1; }
.work-card p { max-width: 30rem; margin: 0.55rem 0 0; color: var(--muted); line-height: 1.5; }

.playground-callout {
  margin-bottom: clamp(5rem, 10vw, 10rem);
  padding: clamp(2rem, 5vw, 5rem);
  background: var(--night);
  color: var(--night-copy);
}
.playground-callout h2 { max-width: 12ch; margin: 0 0 1.2rem; color: #f1f0e8; font-size: clamp(2.7rem, 7vw, 7rem); line-height: 0.9; }
.playground-callout > p:not(.eyebrow) { max-width: 45rem; line-height: 1.65; }
.playground-callout .button-solid { background: #f1f0e8; color: var(--night); border-color: #f1f0e8; }

.page-intro { border-top: 0; }
.page-intro h1 { max-width: 12ch; }
.work-intro { border-top: 0; padding-bottom: clamp(2rem, 5vw, 4rem); }
.work-intro h1 { max-width: 11ch; }
.work-facts { margin-top: 2rem; color: var(--ink); line-height: 1.8; }

.studio {
  margin-bottom: clamp(2rem, 5vw, 5rem);
  background: var(--night);
  color: var(--night-copy);
}
.studio-output {
  position: relative;
  aspect-ratio: 16 / 10;
  min-height: 24rem;
  background: #020404;
}
.studio-output canvas { position: absolute; inset: 0; cursor: crosshair; }
.studio-overlay {
  position: absolute;
  z-index: 2;
  inset: 1rem 1rem auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
  pointer-events: none;
}
.studio-overlay > * { pointer-events: auto; }
.seed-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.seed-label,
.chip,
.studio-timeline,
.studio-keys {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}
.seed-label {
  padding: 0.5rem 0.65rem;
  background: rgba(5, 8, 8, 0.82);
  color: #e5e4dc;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}
.seed-label output { color: #ffb49f; }
.chip {
  min-height: 2rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(238, 238, 229, 0.28);
  border-radius: 0;
  background: rgba(5, 8, 8, 0.72);
  color: #e5e4dc;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.chip:hover, .chip:focus-visible { background: var(--signal); border-color: var(--signal); color: #fff; }
.chip[aria-pressed="true"] { border-color: var(--signal); }
.studio-output:fullscreen,
.studio-output.is-immersive {
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
}
.studio-output.is-immersive { position: fixed; inset: 0; z-index: 50; width: auto; height: auto; }
html.has-immersive { overflow: hidden; }
.studio-output:fullscreen canvas,
.studio-output.is-immersive canvas { touch-action: none; }
.studio-timeline {
  display: grid;
  grid-template-columns: auto 1fr 6.5rem;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--night-line);
  color: #9ea59f;
  text-transform: uppercase;
}
.studio-timeline input { width: 100%; accent-color: var(--signal); }
.studio-timeline input:disabled { opacity: 0.35; }
.studio-timeline output { color: #e5e4dc; text-align: right; text-transform: none; }
.studio-status {
  position: absolute;
  z-index: 2;
  right: 1rem;
  bottom: 1rem;
  max-width: calc(100% - 2rem);
  padding: 0.55rem 0.7rem;
  background: rgba(5, 8, 8, 0.82);
  color: #e5e4dc;
  text-transform: none;
  backdrop-filter: blur(8px);
}
.studio-status[data-state="error"] { background: #7e1e12; }
.studio-status[data-state="working"] { color: #ffb49f; }
.studio-editor { padding: 1rem; border-top: 1px solid var(--night-line); }
.editor-heading { display: flex; justify-content: space-between; gap: 1rem; padding: 0.2rem 0 0.7rem; color: #9ea59f; }
.editor-heading label { color: #f0efe8; }
.editor-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  border: 1px solid var(--night-line);
  background: var(--night-soft);
}
.editor-gutter,
.studio-editor textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.58;
}
.editor-gutter {
  min-width: 3.2rem;
  margin: 0;
  padding: 1rem 0.65rem 1rem 0.5rem;
  overflow: hidden;
  border-right: 1px solid var(--night-line);
  color: #59615b;
  text-align: right;
  user-select: none;
  white-space: pre;
}
.editor-gutter .is-error { color: #ffb49f; background: rgba(228, 63, 29, 0.35); }
.studio-editor textarea {
  display: block;
  width: 100%;
  min-height: 30rem;
  resize: vertical;
  padding: 1rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #dce5dc;
  white-space: pre;
  overflow-wrap: normal;
  overflow: auto;
  tab-size: 4;
}
.studio-editor textarea:focus { outline: 2px solid var(--signal); outline-offset: 2px; }
.diagnostics {
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
}
.diagnostics button {
  display: block;
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 0;
  border-left: 3px solid var(--signal);
  background: rgba(126, 30, 18, 0.35);
  color: #ffd2c6;
  text-align: left;
  cursor: pointer;
}
.diagnostics li + li { margin-top: 0.25rem; }
.diagnostics button[data-severity="warning"] { border-left-color: #d6a33a; background: rgba(120, 90, 20, 0.3); color: #f5e2b6; }
.diagnostics button:hover, .diagnostics button:focus-visible { background: rgba(228, 63, 29, 0.45); }
.studio-controls .button { color: var(--night-copy); }
.studio-toggles { display: inline-flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; margin-left: auto; }
.loop-export {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--night-line);
  color: #aeb3ad;
  font-size: 0.75rem;
}
.loop-export-title {
  color: #f0efe8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.loop-export label:not(.check) { display: inline-flex; align-items: center; gap: 0.45rem; }
.loop-export select {
  min-height: 2rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--night-line);
  border-radius: 0;
  background: var(--night-soft);
  color: #e5e4dc;
}
.loop-export select:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.loop-export .button { color: var(--night-copy); }
.loop-export progress { flex: 1 1 8rem; height: 0.4rem; accent-color: var(--signal); }
.loop-estimate { color: #7f877f; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.68rem; }
.studio-keys { margin: 0.9rem 0 0; color: #7f877f; }
kbd {
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--night-line);
  color: #e5e4dc;
  font-family: inherit;
}
.studio-controls .button-solid { background: #eeeee5; color: var(--night); border-color: #eeeee5; }
.check { display: inline-flex; align-items: center; gap: 0.45rem; color: #aeb3ad; font-size: 0.75rem; }
.check input { accent-color: var(--signal); }

.source-note,
.safety-note {
  max-width: 52rem;
  margin: 0 0 clamp(5rem, 10vw, 9rem);
  color: var(--muted);
  line-height: 1.7;
}
.safety-note { padding-left: 1rem; border-left: 3px solid var(--signal); }
.safety-note h2 { margin-bottom: 0.65rem; font-family: inherit; font-size: 1rem; font-weight: 700; letter-spacing: 0; }
.safety-note p { margin-bottom: 0; }

.prose {
  max-width: 58rem;
  padding: clamp(4rem, 9vw, 9rem) 0;
}
.prose h1 { max-width: 12ch; }
.prose h2 { margin-top: 3.7rem; font-size: 2.2rem; }
.prose p, .prose li { max-width: 47rem; font-size: 1.04rem; line-height: 1.75; }
.prose .about-lede { max-width: 46rem; color: var(--ink); font-size: clamp(1.35rem, 3vw, 2.15rem); }

.site-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
}
.site-footer p { margin: 0; }

.not-found {
  min-height: 70vh;
  display: grid;
  align-content: center;
}
.not-found h1 { max-width: 12ch; }

@media (max-width: 800px) {
  .site-header { grid-template-columns: 1fr; align-items: start; }
  nav ul { justify-content: flex-start; }
  .hero, .section-heading, .page-intro, .work-intro { grid-template-columns: 1fr; }
  .hero { align-items: start; }
  .hero-figure { width: min(100%, 42rem); margin-left: auto; }
  .work-grid { gap-block: 3.5rem; }
  .work-card:nth-child(even) { transform: translateY(2.5rem); }
  .studio-output { min-height: 20rem; aspect-ratio: 4 / 3; }
  .studio-toggles { width: 100%; margin-left: 0; }
  .studio-overlay { inset: 0.6rem 0.6rem auto; }
}

@media (max-width: 580px) {
  .work-grid { grid-template-columns: 1fr; }
  .work-card:nth-child(even) { transform: none; }
  .studio { width: calc(100% + 2rem); margin-left: -1rem; }
  .studio-output { min-height: 22rem; aspect-ratio: 1; }
  .studio-editor textarea, .editor-gutter { font-size: 0.72rem; }
  .studio-editor textarea { min-height: 25rem; }
  .studio-timeline { grid-template-columns: 1fr 5.5rem; }
  .studio-timeline label { display: none; }
  .studio-keys { display: none; }
  .site-footer { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  nav, .skip-link, .button, .studio-editor, .studio-overlay, .studio-timeline, .loop-export { display: none; }
  body { background: #fff; }
  .site-header, .site-footer { border-color: #aaa; }
}
