/* JetBrains Mono (variable, latin subset), SIL OFL 1.1: see fonts/OFL.txt */
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0b0c0b;
  --panel: #111310;
  --line: #2a2d26;
  --faint: #1a1c18;
  --fg: #dcd8cc;
  --bright: #f4f1e8;
  --dim: #7c7f73;
  --green: #a9c47f;   /* accent */
  --amber: #e0a85e;   /* numbers */
  --cyan: #8fb8c9;    /* keys, links */
  --red: #e57e72;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --wheel-w: 250px;
}
:root[data-theme="amber"] { --green: #ffb000; --amber: #ffd27a; --cyan: #e8c27a; }
:root[data-theme="blue"]  { --green: #79c0ff; --amber: #d2a8ff; --cyan: #a5d6ff; }
:root[data-theme="mono"]  { --green: #f0f0f0; --amber: #c8c8c8; --cyan: #ffffff; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  display: grid;
  grid-template-columns: var(--wheel-w) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top top" "wheel stage" "bar bar";
  height: 100dvh;
  max-width: 1400px;
  margin-inline: auto;
  padding: 0 32px;
  background: var(--bg);
  color: var(--fg);
  font: 13.5px/1.65 var(--mono);
  overflow: hidden;
}
body::before {
  /* faint drafting grid behind everything */
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--faint) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 55% 40%, #000 20%, transparent 80%);
  opacity: .55;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--bright); }
::selection { background: var(--green); color: var(--bg); }
:focus-visible { outline: 1px dashed var(--green); outline-offset: 3px; }
code { color: var(--amber); font-family: inherit; }
b { color: var(--bright); font-weight: 500; }
kbd {
  display: inline-block;
  padding: 0 .35em;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--fg);
  font: inherit;
  font-size: .9em;
  line-height: 1.4;
}
.dim { color: var(--dim); }
.num { color: var(--amber); }
.accent { color: var(--green); }
.hl { color: var(--amber); }

/* ───────── top ───────── */
.top {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); font-size: 13px; }
.mark { width: auto; height: 24px; color: var(--fg); }
.top-links { display: flex; gap: 22px; font-size: 12.5px; }
.top-links a { display: inline-flex; align-items: center; gap: 7px; color: var(--dim); }
.top-links .ico { width: 14px; height: 14px; }
.top-links a:hover { color: var(--fg); }

/* ───────── the wheel ───────── */
.wheel { grid-area: wheel; position: relative; overflow: hidden; border-right: 1px solid var(--faint); }
.wheel::before {
  /* the arc the items ride on; geometry matches ARC in main.js */
  content: "";
  position: absolute;
  left: -530px;
  top: 50%;
  width: 640px;
  height: 640px;
  transform: translateY(-50%);
  border: 1px dashed var(--line);
  border-radius: 50%;
  pointer-events: none;
}
.wheel-track { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.wheel-track.dragging { cursor: grabbing; }
.w-item {
  position: absolute;
  left: 0;
  top: 50%;
  width: 142px;
  color: var(--dim);
  transform-origin: 50% 50%;
  transition: transform .45s cubic-bezier(.2, .8, .2, 1), opacity .3s;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}
.dragging .w-item { transition: none; }
.w-item:hover { color: var(--fg); }
.w-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  height: auto;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--panel);
  filter: grayscale(.7) brightness(.75);
  transition: filter .3s, border-color .3s;
  pointer-events: none;
}
.glyph-thumb {
  display: grid;
  place-items: center;
  color: var(--dim);
  font-size: 15px;
  letter-spacing: .05em;
}
.glyph-thumb .avatar { height: 78%; width: auto; }
.glyph-thumb.mono { font-size: 30px; font-weight: 700; letter-spacing: -.06em; color: var(--fg); }
.w-label { display: block; margin-top: 5px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-item.active { color: var(--bright); }
.w-item.active .w-thumb { filter: none; border-color: var(--fg); box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--line); }
.w-item.active .glyph-thumb { color: var(--green); }
.w-item.active .w-label::after { content: "  ▸"; color: var(--green); }
.wheel-hint { position: absolute; left: 0; bottom: 10px; margin: 0; font-size: 10.5px; color: var(--dim); }
.wheel-hint kbd { font-size: 9.5px; }

/* ───────── stage + views ───────── */
.stage { grid-area: stage; position: relative; min-width: 0; }
.view {
  position: absolute;
  inset: 0;
  padding: 18px 8px 40px 44px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.view > * { max-width: 860px; }
.js .view { display: none; }
.js .view.active { display: block; animation: viewIn .28s ease-out; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }

.shell-title {
  margin: 0 0 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--faint);
  color: var(--dim);
  font-size: 12px;
}
.branch { color: var(--green); }
.cmd { margin: 22px 0 8px; color: var(--fg); }
.ps1 { color: var(--green); }
.tilde { color: var(--dim); }
.arrow { color: var(--green); margin-right: 4px; }
.transcript .cmd:first-child { margin-top: 0; }
.out p { margin: 0 0 8px; max-width: 70ch; }
.typed.caret::after, .caret-idle::after {
  content: "";
  display: inline-block;
  width: .55em;
  height: 1.1em;
  vertical-align: text-bottom;
  background: var(--fg);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.fetch-table { display: grid; grid-template-columns: 9ch minmax(0, 1fr); gap: 2px 18px; margin: 0; }
.fetch-table dt { color: var(--dim); }
.fetch-table dd { margin: 0; }
.fetch-table.big { font-size: 15px; gap: 6px 22px; }
.links-row { display: flex; flex-wrap: wrap; gap: 18px; margin: 0; }
.links-row a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }

/* blueprint */
.blueprint { margin: 0 0 22px; max-width: 760px; }
.blueprint svg { display: block; width: 100%; height: auto; font-family: var(--mono); }
.bp-frame { fill: none; stroke: var(--line); }
.bp-line { fill: none; stroke: var(--fg); stroke-width: 1; opacity: .85; }
.bp-faint { stroke: var(--line); stroke-width: 1; }
.bp-faint-line { stroke: var(--line); }
.bp-fill { fill: var(--fg); }
.bp-dash { stroke: var(--dim); stroke-dasharray: 10 4 2 4; }
.bp-led { fill: var(--green); stroke: none; }
.bp-ticks text, .bp-label { fill: var(--dim); font-size: 10px; }
.bp-dim { fill: var(--dim); font-size: 10px; }
.bp-k { fill: var(--dim); font-size: 10px; }
.bp-v { fill: var(--bright); font-size: 12px; }
.bp-live { fill: var(--green); }
.bp-spark { fill: none; stroke: var(--green); stroke-width: 1.2; }

/* project views */
.fetch { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.fetch-icon { flex: none; border-radius: 12px; }
.glyph-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}
.fetch h2 { margin: 0 0 4px; font-size: 22px; line-height: 1.2; color: var(--bright); font-weight: 600; letter-spacing: -.01em; }
.tagline { margin: 0; max-width: 68ch; }
.bar {
  display: inline-block;
  width: 120px;
  height: 9px;
  vertical-align: middle;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--amber) var(--pct, 0%), transparent 0) no-repeat;
}

.viewer { position: relative; border: 1px solid var(--line); background: #070807; }
.viewer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.viewer-head .dim { white-space: nowrap; }
.viewer figure { margin: 0; display: flex; justify-content: center; align-items: center; gap: 12px; height: 380px; padding: 12px; }
.js .viewer figure { display: none; }
.js .viewer figure.on { display: flex; }
.viewer video, .viewer img { max-width: 100%; max-height: 100%; display: block; }
.viewer video { width: 100%; height: 100%; background: #000; }
.viewer figure.tall img { height: 100%; width: auto; min-width: 0; border-radius: 10px; }
.viewer img { cursor: zoom-in; }
.pager { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); }
.pager button {
  min-width: 26px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}
.pager button:hover { color: var(--fg); }
.pager button[aria-current="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.features, .steps { margin: 0; padding: 0; list-style: none; max-width: 76ch; }
.features li, .steps li { position: relative; padding-left: 22px; margin-bottom: 5px; }
.features li::before { content: "+"; position: absolute; left: 0; color: var(--green); }
.steps { counter-reset: s; }
.steps li::before { counter-increment: s; content: counter(s) "."; position: absolute; left: 0; color: var(--green); }

/* experiments */
.exp { padding: 14px 0; border-bottom: 1px dashed var(--line); max-width: 760px; }
.exp h3 { margin: 0; font-size: 15px; font-weight: 500; }
.exp p { margin: 2px 0 0; }

/* stack */
.toml p { margin: 0; white-space: pre-wrap; }
.toml .gap { margin-top: 12px; }
.tk { color: var(--cyan); }
.s { color: var(--green); }
.uses { border-collapse: collapse; width: 100%; max-width: 760px; }
.uses th, .uses td { padding: 5px 0; border-bottom: 1px dashed var(--line); vertical-align: top; }
.uses th { text-align: left; font-weight: 400; color: var(--cyan); padding-right: 24px; white-space: nowrap; }
.uses td a { margin-right: 12px; }
.uses td a::before { content: "./"; color: var(--dim); }

/* homelab */
.neofetch { display: flex; gap: 34px; flex-wrap: wrap; align-items: flex-start; }
.neofetch .fetch-table { flex: 1; min-width: 260px; }
.art { margin: 0; color: var(--green); font: inherit; line-height: 1.35; }
.live-note { margin: 16px 0 0; font-size: 12px; color: var(--dim); }
.pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}
.note { margin: 18px 0 0; color: var(--dim); font-size: 12.5px; max-width: 70ch; }

/* ───────── command palette ───────── */
.palette {
  position: absolute;
  left: 44px;
  right: 8px;
  bottom: 14px;
  max-width: 860px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
  z-index: 5;
  animation: viewIn .15s ease-out;
}
#history { max-height: 180px; overflow-y: auto; padding: 0 14px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
#history:not(:empty) { padding-top: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--faint); }
#history .line { margin: 0 0 2px; white-space: pre-wrap; word-break: break-word; font-size: 12.5px; }
#history .muted { color: var(--dim); }
#history .err { color: var(--red); }
#prompt { display: flex; align-items: baseline; gap: 8px; padding: 9px 14px; margin: 0; }
#prompt .ps1 { font-weight: 700; }
#cmdline {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--bright);
  font: inherit;
  caret-color: var(--green);
  padding: 0;
}
#cmdline::placeholder { color: #50534a; }
.pal-hint { color: var(--dim); font-size: 11px; white-space: nowrap; }

/* ───────── bottom bar ───────── */
.bar-foot {
  grid-area: bar;
  display: grid;
  grid-template-columns: var(--wheel-w) minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 28px;
  height: 64px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.bar-foot p { margin: 0; }
.bar-name { color: var(--bright); letter-spacing: .08em; }
.bar-keys { color: var(--dim); font-size: 10.5px; margin-top: 2px !important; }
.bar-keys kbd { font-size: 9.5px; }
.cmd-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.cmd-btn:hover { color: var(--fg); }
.bar-stats { display: flex; gap: 34px; margin: 0 0 0 44px; }
.bar-stats dt { color: var(--dim); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.bar-stats dd { margin: 0; font-size: 13px; }
.bar-stats dd:not(.num) { color: var(--fg); }
.bar-graph { display: grid; row-gap: 3px; color: inherit; text-decoration: none; }
.bar-graph[hidden] { display: none; }
.bar-graph svg { display: block; }
#bar-contrib rect { fill: var(--green); }
#bar-contrib .l0 { fill: var(--line); }
#bar-contrib .l1 { opacity: .3; }
#bar-contrib .l2 { opacity: .5; }
#bar-contrib .l3 { opacity: .75; }
a.bar-graph:hover .bar-live-label { color: var(--fg); }
@media (max-width: 1180px) { .bar-graph { display: none !important; } }
.bar-live { display: grid; grid-template-columns: auto 120px; column-gap: 14px; align-items: center; }
.bar-live-label { grid-column: 1 / 3; color: var(--dim); font-size: 10px; letter-spacing: .08em; }
.spark { grid-column: 2; grid-row: 2; width: 120px; height: 22px; }
.spark polyline { fill: none; stroke: var(--green); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.bar-live-val { grid-column: 1; grid-row: 2; color: var(--amber); font-size: 13px; }

/* ───────── lightbox ───────── */
#lightbox {
  max-width: min(1200px, 94vw);
  max-height: 92vh;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--dim);
  cursor: zoom-out;
}
#lightbox::backdrop { background: rgba(4, 5, 4, .88); }
#lightbox img { display: block; max-width: 100%; max-height: calc(92vh - 40px); margin: 0 auto; }
#lightbox .cap { margin: 0; padding: 8px 12px; font-size: 12px; border-top: 1px solid var(--line); }

/* ───────── no JS: one plain page ───────── */
html:not(.js) body { display: block; height: auto; overflow: auto; }
html:not(.js) .wheel, html:not(.js) .palette, html:not(.js) .bar-foot { display: none; }
html:not(.js) .view { position: static; padding: 30px 0; border-bottom: 1px solid var(--line); }
html:not(.js) .viewer figure { height: auto; flex-wrap: wrap; }
html:not(.js) .viewer figure.tall img { height: 300px; }

/* 404 page (no JS layout) */
.window { max-width: 860px; margin: 40px auto; padding: 0 16px; }
.titlebar { display: none; }
.name { margin: 8px 0 0; font-size: clamp(48px, 9vw, 96px); line-height: 1; color: var(--bright); letter-spacing: -.04em; }
.role { margin: 10px 0 24px; color: var(--amber); }
.links { display: flex; gap: 14px; flex-wrap: wrap; }
.btn { padding: 5px 12px; border: 1px solid var(--green); color: var(--bg); background: var(--green); }
.btn.ghost { background: transparent; color: var(--green); }

/* ───────── narrow screens: the wheel becomes a strip ───────── */
@media (max-width: 860px) {
  body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "top" "wheel" "stage" "bar";
    padding: 0 16px;
  }
  .top { height: 46px; }
  .wheel { border-right: 0; border-bottom: 1px solid var(--faint); height: 100px; }
  .wheel::before, .wheel-hint { display: none; }
  .wheel-track {
    position: static;
    display: flex;
    gap: 12px;
    height: 100%;
    padding: 4px 0 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    touch-action: auto;
    cursor: auto;
  }
  .w-item { position: static; flex: none; width: 108px; transform: none !important; opacity: 1 !important; scroll-snap-align: center; }
  .w-item.active .w-label::after { content: none; }
  .w-item.active .w-label { color: var(--green); }
  .view { padding: 16px 0 80px; }
  .palette { left: 0; right: 0; }
  .bar-foot { grid-template-columns: minmax(0, 1fr) auto; height: 52px; gap: 12px; }
  .bar-stats, .bar-keys { display: none; }
  .bar-live { grid-template-columns: auto 90px; }
  .spark { width: 90px; }
  .viewer figure { height: 280px; }
  .fetch h2 { font-size: 19px; }
  .fetch-icon { width: 44px; height: 44px; }
  .glyph-icon { width: 44px; height: 44px; }
}
@media (max-width: 480px) {
  body { font-size: 13px; }
  .fetch-table { grid-template-columns: 8ch minmax(0, 1fr); gap: 2px 12px; }
  .fetch-table .bar { width: 64px; }
  .pal-hint { display: none; }
  .uses th { white-space: normal; padding-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .js .view.active, .palette { animation: none; }
  .w-item { transition: none; }
  .pulse, .typed.caret::after, .caret-idle::after { animation: none; }
}

/* inline prompt at the end of the whoami transcript */
.inline-prompt { display: flex; align-items: baseline; gap: 4px; cursor: text; }
.inline-prompt .arrow { margin-right: 4px; }
#inline-cmd {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--bright);
  font: inherit;
  caret-color: var(--green);
}
#inline-cmd::placeholder { color: #50534a; }
#inline-cmd:focus::placeholder { color: transparent; }
#inline-history .line { margin: 0 0 2px; white-space: pre-wrap; word-break: break-word; }
#inline-history .line:first-child { margin-top: 18px; }
#inline-history .muted { color: var(--dim); }
#inline-history .err { color: var(--red); }
#inline-history .echo { color: var(--fg); margin-top: 10px; }
#inline-history .echo::before { content: "› "; color: var(--green); }
