:root {
  --bg: #0f0f0e;
  --surface: #191918;
  --line: #33332f;
  --ink: #f0eee8;
  --muted: #a8a69f;
  --accent: #ff5a26;
  --on-accent: #0f0f0e;
  --dot: rgba(240, 238, 232, .09);
  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --gutter: 16px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #e4e3df;
  --surface: #efeeea;
  --line: #c0beb6;
  --ink: #141412;
  --muted: #55534d;
  --accent: #b52f08;
  --on-accent: #fff;
  --dot: rgba(20, 20, 18, .1);
  color-scheme: light;
}
@media (min-width: 768px) { :root { --gutter: 40px; } }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--display);
  overflow-x: clip;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(420px circle at var(--mx, 75%) var(--my, 20%), #000, rgba(0, 0, 0, .25));
  mask-image: radial-gradient(420px circle at var(--mx, 75%) var(--my, 20%), #000, rgba(0, 0, 0, .25));
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
h2 { font-size: clamp(2.4rem, 7.5vw, 5.25rem); }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.eyebrow, .fine, .bar, .dir, .file, .term, .reply-from, .reply-status, .run-steps span, .chips button {
  font-family: var(--mono);
}
.eyebrow { font-size: .8125rem; color: var(--accent); margin-bottom: 18px; }
.fine { font-family: var(--mono); font-size: .8125rem; color: var(--muted); }

/* Scroll progress */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
}
@supports (animation-timeline: scroll()) {
  .progress { animation: grow linear both; animation-timeline: scroll(root); }
  @keyframes grow { to { transform: scaleX(1); } }
}

/* Top bar */
.bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px var(--gutter);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: .875rem;
}
.bar-name { font-weight: 500; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.bar-name span { color: var(--accent); }
.bar-actions { display: flex; align-items: center; gap: 14px; }
.bar-mail {
  min-height: 44px; display: inline-flex; align-items: center;
  text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px;
}
.switch {
  min-height: 44px; display: inline-flex; align-items: center; gap: 8px;
  padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
}
.switch-track {
  width: 36px; height: 20px; border: 1px solid var(--muted); border-radius: 20px; position: relative; display: block;
}
.switch-knob {
  position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink); transition: transform .25s;
}
[data-theme="light"] .switch-knob { transform: translateX(16px); background: var(--accent); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 22px;
  background: var(--accent); color: var(--on-accent);
  border: 1px solid var(--accent);
  font: 600 1rem/1.2 var(--display); text-decoration: none; cursor: pointer;
  transition: transform .2s, background .2s, color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--muted); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Hero */
.hero { padding: 28px var(--gutter) 0; display: grid; gap: 8px; }
.hero h1 { font-size: clamp(2.6rem, 11.4vw, 6.4rem); font-weight: 700; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-sub { max-width: 34em; margin-top: 24px; font-size: 1.125rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 14px; }
.portrait { position: relative; aspect-ratio: 1; margin: 0 calc(var(--gutter) * -1); }
.portrait img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 4%, #000 70%, transparent), linear-gradient(to right, transparent, #000 16%, #000 84%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 4%, #000 70%, transparent), linear-gradient(to right, transparent, #000 16%, #000 84%, transparent);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
.p-light { display: none; }
[data-theme="light"] .p-light { display: block; }
[data-theme="light"] .p-dark { display: none; }

@media (min-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    align-items: center; gap: 24px;
    min-height: calc(100svh - 60px);
    padding-top: 0;
  }
  .hero h1 { font-size: clamp(3.4rem, 6.2vw, 6.4rem); }
  .portrait { margin: 0; }
}

/* Sections */
.section { padding: 88px var(--gutter) 0; }
.section-head { max-width: 760px; margin-bottom: 36px; }
.section-head > p:last-child { margin-top: 20px; font-size: 1.125rem; }

/* Explorer */
.explorer { border: 1px solid var(--line); background: var(--surface); }
.tree { border-bottom: 1px solid var(--line); padding: 10px 0; }
.dir { padding: 10px 16px 2px; font-size: .8125rem; color: var(--muted); }
.file {
  display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 16px;
  border: 0; background: none; color: var(--ink); text-align: left; font-size: .9375rem; cursor: pointer;
}
.file.nested { padding-left: 32px; }
.file:hover { color: var(--accent); }
.file[aria-current="true"] { background: var(--accent); color: var(--on-accent); }
.docs { min-height: 340px; }
.doc { padding: 22px 16px 30px; border-bottom: 1px solid var(--line); }
.doc:last-child { border-bottom: 0; }
.js .doc { border-bottom: 0; }
.doc::before {
  content: attr(data-path); display: block; margin-bottom: 20px;
  font: .8125rem var(--mono); color: var(--muted); overflow-wrap: anywhere;
}
.doc h3 { font-size: clamp(1.9rem, 5vw, 3rem); margin-bottom: 18px; }
.doc p + p { margin-top: 12px; }
.doc ul, .doc ol { margin: 14px 0 0; padding-left: 1.2em; }
.doc li { margin-top: 8px; }
.doc li::marker { color: var(--accent); }
.gap { font: .8125rem var(--mono); background: var(--accent); color: var(--on-accent); padding: 1px 6px; }
.js .doc.open { animation: rise .35s ease both; }
html:not(.js) .tree { display: none; }
@media (min-width: 768px) {
  .explorer { display: grid; grid-template-columns: 270px minmax(0, 1fr); }
  .tree { border-bottom: 0; border-right: 1px solid var(--line); }
  .doc { padding: 26px 40px 40px; }
}

/* Layers lab */
.lab { display: grid; gap: 16px; }
.switches { display: grid; gap: 0; align-content: start; }
.layer {
  display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 10px 0;
  border-top: 1px solid var(--line); cursor: pointer;
}
.layer input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.layer strong { display: block; font-size: 1.25rem; line-height: 1.2; }
.layer small { display: block; font-size: .9375rem; color: var(--muted); line-height: 1.3; }
.toggle {
  flex: none; width: 52px; height: 30px; border: 1px solid var(--muted); border-radius: 30px; position: relative;
  transition: background .2s, border-color .2s;
}
.toggle::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--ink); transition: transform .25s cubic-bezier(.3, 1.5, .6, 1), background .2s;
}
.layer input:checked + .toggle { background: var(--accent); border-color: var(--accent); }
.layer input:checked + .toggle::after { transform: translateX(22px); background: var(--on-accent); }
.layer input:focus-visible + .toggle { outline: 2px solid var(--accent); outline-offset: 3px; }
.lab-all { margin-top: 12px; justify-self: start; }

.reply { border: 1px solid var(--line); background: var(--surface); padding: 20px 16px; }
.reply-from { font-size: .875rem; }
.reply-status { font-size: .8125rem; color: var(--accent); margin-top: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.reply-body { padding: 18px 0; min-height: 250px; font-size: 1.125rem; }
.reply-body p { animation: rise .3s ease both; }
.reply-body p + p { margin-top: 10px; }
.reply-verdict { border-top: 1px solid var(--line); padding: 14px 0 12px; font-size: 1.125rem; }
.reply-verdict span { color: var(--muted); }
html:not(.js) .switches { display: none; }
@media (min-width: 960px) {
  .lab { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 40px; }
  .reply { padding: 28px; }
  .reply-body { min-height: 220px; }
}

/* The run */
.run { margin-top: 88px; }
.js .run.pinned { height: 320vh; }
.run-pin {
  padding: 56px var(--gutter) 40px;
  background: var(--accent); color: var(--on-accent);
  display: flex; flex-direction: column; justify-content: center;
}
.js .run.pinned .run-pin { position: sticky; top: 0; min-height: 100svh; }
.run .eyebrow { color: inherit; }
.run h2 { font-size: clamp(1.9rem, 5.4vw, 3.6rem); max-width: 14em; }
.run-number {
  font-weight: 800; font-size: clamp(4.2rem, 21vw, 15rem); line-height: 1; letter-spacing: -.05em;
  margin-top: 22px; font-variant-numeric: tabular-nums;
}
.run-caption { font-size: 1.25rem; font-weight: 600; }
.run-steps { list-style: none; margin: 26px 0 16px; padding: 0; display: grid; gap: 0; }
.run-steps li {
  display: grid; grid-template-columns: 5.5em 1fr; gap: 8px; padding: 10px 0;
  border-top: 1px solid currentColor;
  transition: opacity .3s;
}
.run-steps span { font-size: .875rem; align-self: center; }
.js .run.pinned .run-steps li { opacity: .35; }
.js .run.pinned .run-steps li.on { opacity: 1; }
.run .fine { color: inherit; }
@media (min-width: 960px) { .run-steps { grid-template-columns: repeat(4, 1fr); gap: 20px; } .run-steps li { display: block; } .run-steps span { display: block; margin-bottom: 4px; } }

/* Terminal */
.term { border: 1px solid var(--line); background: var(--surface); font-size: .9375rem; }
.term-log {
  height: 340px; overflow-y: auto; padding: 16px; overscroll-behavior: contain;
}
.term-log p { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 6px; }
.term-log b { font-weight: 500; color: var(--accent); }
.term-log .cmd { color: var(--muted); }
.term-line { display: flex; align-items: center; gap: 10px; padding: 4px 16px; border-top: 1px solid var(--line); }
.term-line label { color: var(--accent); white-space: nowrap; }
.term-line input {
  flex: 1; min-width: 0; min-height: 48px; border: 0; background: none; color: var(--ink);
  font: 1rem var(--mono); outline: none;
}
.term-line:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid var(--line); }
.chips button {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--muted); background: none; color: var(--ink);
  font-size: .875rem; cursor: pointer;
}
.chips button:hover { border-color: var(--accent); color: var(--accent); }
html:not(.js) .term { display: none; }

/* Contact */
.contact { padding: 110px var(--gutter) 90px; }
.contact h2 { font-size: clamp(2.8rem, 11vw, 9rem); }
.contact-sub { margin-top: 22px; max-width: 32em; font-size: 1.1875rem; }
.mail {
  display: block; margin: 20px 0 14px; padding: 8px 0; min-height: 44px; color: var(--accent);
  font-weight: 700; font-size: clamp(1.125rem, 5.4vw, 3.6rem); letter-spacing: -.02em;
  overflow-wrap: anywhere; text-underline-offset: .12em;
}
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px;
  padding: 20px var(--gutter) 28px; border-top: 1px solid var(--line);
  font: .8125rem var(--mono); color: var(--muted);
}

/* Boot screen */
.boot {
  position: fixed; inset: 0; z-index: 100; background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  padding: 28px var(--gutter); font: .9375rem var(--mono); cursor: pointer;
  transition: opacity .35s, visibility .35s;
}
.boot.done { opacity: 0; visibility: hidden; }
.boot p:last-child { color: var(--accent); }

/* Motion */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1); }
.js .reveal.in { opacity: 1; transform: none; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  .progress { display: none; }
}
