:root {
  --bg: #000;
  --fg: #fff;
  --mid: #bdbdbd;
  --dim: #8c8c8c;
  --line: #2e2e2e;
  --line-strong: #555;
  --gutter: 24px;
  --max: 1120px;
  --edge: max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter)));
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.6 var(--mono);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
p, h1, h2, h3, ul, pre { margin: 0; }
ul { padding: 0; list-style: none; }
pre { font-family: var(--mono); }
.dim { color: var(--dim); }

:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
::selection { background: var(--fg); color: var(--bg); }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ── 3D → ASCII layer ─────────────────────────────────────────── */

#stage {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  display: block;
  pointer-events: none;
  transition: opacity .5s;
}
#stage.muted { opacity: .38; }

/* ── nav ──────────────────────────────────────────────────────── */

.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  height: 48px;
  padding: 0 var(--edge);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .06em; text-decoration: none; }
.nav nav { display: flex; gap: 4px; }
.nav nav a {
  padding: 4px 8px;
  color: var(--mid);
  text-decoration: none;
}
.nav nav a:hover { background: var(--fg); color: var(--bg); }

/* ── shared section shells ────────────────────────────────────── */

main { position: relative; }

.panel {
  position: relative;
  background: var(--bg);
  border-block: 1px solid var(--line);
}
.wrap { max-width: var(--max); margin: 0 auto; padding: 104px var(--gutter); }

.window { position: relative; padding-inline: var(--edge); }
.window span { background: var(--bg); box-decoration-break: clone; -webkit-box-decoration-break: clone; }

.fig {
  position: absolute; left: var(--edge); right: var(--edge); bottom: 20px;
  font-size: 12px; color: var(--dim);
}
.fig span { padding: 2px 0; }

.rule {
  display: flex; align-items: baseline; gap: 14px;
  font-size: 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  white-space: nowrap;
}
.rule .num { color: var(--dim); font-weight: 400; }
.rule::after {
  content: "────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────";
  flex: 1; min-width: 0; overflow: hidden;
  color: var(--line-strong); font-weight: 400; letter-spacing: 0;
}

.intro {
  max-width: 62ch;
  margin: 28px 0 56px;
  font-size: 16px; color: var(--mid);
  text-wrap: pretty;
}

/* ── hero ─────────────────────────────────────────────────────── */

.hero {
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding-top: 96px; padding-bottom: 80px;
}
.hero-copy { width: min(600px, 100%); min-width: 0; }
.prompt { font-size: 13px; margin-bottom: 28px; }
.prompt span:first-child { background: none; }
.prompt { width: max-content; background: var(--bg); }
.cursor { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.logo {
  font-family: Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  font-size: min(2.1vw, 13.5px);
  line-height: 1.08;
  letter-spacing: 0;
  white-space: pre;
  width: max-content;
  background: var(--bg);
}
.lede {
  margin-top: 36px;
  font-size: clamp(18px, 2.1vw, 23px); line-height: 1.4; font-weight: 600;
  text-wrap: balance;
}
.sub { margin-top: 16px; max-width: 52ch; font-size: 15px; color: var(--mid); text-wrap: pretty; }
.sub span, .lede span { padding: 2px 0; }

.actions { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--fg);
  text-decoration: none;
  white-space: nowrap;
}
.btn::before { content: "→ "; }
.btn:hover { background: var(--fg); color: var(--bg); }

/* ── windows onto the stage ───────────────────────────────────── */

.interlude { height: 72vh; min-height: 360px; }

/* ── studies ──────────────────────────────────────────────────── */

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

.card {
  display: flex; flex-direction: column;
  padding: 20px;
  border: 1px solid var(--line-strong);
  text-decoration: none;
  min-width: 0;
}
.card:hover { border-color: var(--fg); }
.card-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); }
.card .art {
  margin: 22px 0;
  font-size: 12px; line-height: 1.35;
  overflow: hidden;
}
.card h3 { font-size: 17px; line-height: 1.35; font-weight: 700; text-wrap: balance; }
.card:hover h3 { text-decoration: underline; text-underline-offset: 4px; }
.card .blurb { margin: 10px 0 24px; color: var(--mid); text-wrap: pretty; }
.card .tags { margin-top: auto; font-size: 12px; color: var(--dim); }

/* ── projects ─────────────────────────────────────────────────── */

.table { border-top: 1px solid var(--line-strong); }
.row {
  display: grid;
  grid-template-columns: 6ch 16ch minmax(0, 1fr) 9ch 13ch;
  gap: 16px; align-items: baseline;
  padding: 16px 12px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.row .id, .row .kind { color: var(--dim); }
.row .name { font-weight: 700; }
.row .desc { color: var(--mid); }
.row .status { text-align: right; white-space: nowrap; }
.row:hover, .row:hover * { background: var(--fg); color: var(--bg); }

/* ── log ──────────────────────────────────────────────────────── */

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; margin-top: 48px; }
.split h3 {
  font-size: 12px; font-weight: 400; color: var(--dim);
  text-transform: uppercase; letter-spacing: .1em;
  padding-bottom: 12px; border-bottom: 1px solid var(--line-strong);
}
.log li, .bench li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.log li { display: grid; grid-template-columns: 12ch 1fr; gap: 16px; }
.log time { color: var(--dim); }
.bench li::before { content: "[ ] "; color: var(--dim); white-space: pre; }

/* ── cabinet ──────────────────────────────────────────────────── */

.cabinet {
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding-top: 96px; padding-bottom: 80px;
  cursor: grab;
  touch-action: pan-y;
  user-select: none; -webkit-user-select: none;
}
.cabinet.dragging { cursor: grabbing; }
.cabinet-ui { width: min(100%, 470px); }
.cabinet .rule { background: var(--bg); }
.cabinet .intro { margin-bottom: 36px; }
.cabinet .intro span { padding: 2px 0; }

.control { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.control .label { width: 9ch; color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.control button {
  font: inherit; color: var(--fg);
  padding: 7px 12px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  cursor: pointer;
}
.control button:hover { border-color: var(--fg); }
.control button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* ── footer ───────────────────────────────────────────────────── */

footer.panel { border-bottom: 0; }
.foot {
  display: grid; grid-template-columns: 1fr auto; gap: 32px 48px; align-items: start;
  padding-block: 64px 48px;
}
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.links a { padding: 4px 8px; border: 1px solid var(--line-strong); text-decoration: none; }
.links a:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.meta { grid-column: 1 / -1; font-size: 12px; padding-top: 24px; border-top: 1px solid var(--line); }

/* ── small screens ────────────────────────────────────────────── */

@media (max-width: 900px) {
  .cards { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; gap: 48px; }
  .wrap { padding-block: 80px; }
}

@media (max-width: 720px) {
  .nav nav a { padding: 4px 5px; font-size: 12px; }
  .nav nav a[href="#cabinet"], .nav nav a[href="#log"] { display: none; }
  .row {
    grid-template-columns: 6ch minmax(0, 1fr) auto;
    grid-template-areas: "id name status" ". desc desc" ". kind kind";
    gap: 4px 12px;
  }
  .row .id { grid-area: id; } .row .name { grid-area: name; }
  .row .desc { grid-area: desc; } .row .kind { grid-area: kind; }
  .row .status { grid-area: status; }
  .foot { grid-template-columns: 1fr; }
  .interlude { height: 52vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
  #stage { transition: none; }
}
