/* portfolio-v2 — ground system.
   Console-specific rules live in console.css. This file carries the tokens and the
   plain document pages (demos.html, befit.html, and the no-JS fallback in index.html). */

:root {
  --bg:      #08090b;
  --surface: #0e1014;
  --fg:      #e6e7ea;
  --mid:     #a4abb8;
  --dim:     #7d8594;
  --line:    #1c1f26;

  /* session colour — one variable, animatable. Paints state and structure, never body text. */
  --proj:    #7d8594;
  --ease:    cubic-bezier(0.2, 0.8, 0.2, 1);

  --w:  76rem;
  --wt: 42rem;

  /* One typeface for the whole console. A terminal does not mix faces, and the
     Inter-plus-a-mono pairing is the tell of a template. */
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

:root {
  --proj-soft: rgba(125, 133, 148, 0.14);
  /* The session colour where it meets text or a hairline. On a light ground the raw hue
     (acid lime especially) disappears, so this is the same hue taken down until it reads. */
  --proj-ink: var(--proj);
  --proj-on:  #08090b;          /* ink that sits on top of a --proj fill */
}
@supports (color: color-mix(in oklab, red, blue)) {
  :root { --proj-soft: color-mix(in oklab, var(--proj) 14%, transparent); }
  [data-theme="light"] { --proj-ink: color-mix(in oklab, var(--proj), #000 52%); }
}

[data-theme="light"] {
  --proj-on: #ffffff;
  --bg:      #f5f5f6;
  --surface: #ffffff;
  --fg:      #16181d;
  --mid:     #4b5261;
  --dim:     #6f7787;
  --line:    #e2e3e7;
}

@property --proj {
  syntax: "<color>";
  inherits: true;
  initial-value: #7d8594;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* The ground switches outright. Cross-fading a full-page background reads as lag rather
     than polish, and a tab backgrounded mid-fade comes back half-applied, because
     transitions do not advance while a tab is hidden. The session colour still animates:
     it is small, and there the movement means something. */
}

::selection { background: var(--proj); color: var(--proj-on); }
/* Blended, not branded: a bright thumb cuts a stripe through every panel. */
* { scrollbar-color: var(--line) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--dim); background-clip: content-box; }
*::-webkit-scrollbar-corner { background: transparent; }
*::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid var(--proj-ink); outline-offset: 2px; border-radius: 2px; }

img, video, iframe { display: block; max-width: 100%; }
a { color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line); }
a:hover { border-color: var(--proj-ink); }
h1, h2, h3 { font-family: var(--mono); font-weight: 600; letter-spacing: -0.02em; line-height: 1.08; margin: 0; }

.wrap { width: min(100% - 2.5rem, var(--w)); margin-inline: auto; }
.col  { max-width: var(--wt); }

.mono {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ── header ─────────────────────────────────────────────── */

.top { border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; min-height: 3.25rem; gap: 12px; padding-block: 12px; }
.top a { font-size: 0.8125rem; border: 0; }
.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.top nav a { color: var(--mid); }
.top nav a:hover, .top nav a[aria-current] { color: var(--fg); }

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

.hero { padding: clamp(4rem, 12vh, 8rem) 0 clamp(2.5rem, 7vh, 4.5rem); }
.hero h1 { font-size: clamp(2.5rem, 1.5rem + 4.5vw, 5rem); letter-spacing: -0.045em; }
.hero p { max-width: 34ch; margin: 1.5rem 0 0; color: var(--mid); }

/* ── numbers strip ──────────────────────────────────────── */

.figures { display: flex; flex-wrap: wrap; gap: 2.5rem; padding: 1.5rem 0; border-top: 1px solid var(--line); }
.figures div { display: flex; flex-direction: column-reverse; gap: 0.25rem; }
.figures b { font-family: var(--mono); font-size: 1.25rem; font-weight: 400; letter-spacing: -0.02em; }

/* ── index of work ──────────────────────────────────────── */

.index { border-top: 1px solid var(--line); }
.index li { list-style: none; border-bottom: 1px solid var(--line); }
.index ul { margin: 0; padding: 0; }
.index .row {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.15rem 1rem;
  padding: 1.25rem 0;
  align-items: baseline;
}
@media (min-width: 52rem) {
  .index .row { grid-template-columns: 3rem 12rem 1fr 13rem auto; gap: 1.5rem; padding: 1.5rem 0; }
}
.index h2 { font-size: 1.125rem; }
.index p  { margin: 0; color: var(--mid); font-size: 0.875rem; }
.index .stack { font-size: 0.6875rem; letter-spacing: 0.06em; color: var(--dim); }
.index .go { display: flex; gap: 1rem; }
.index .go a { font-size: 0.8125rem; color: var(--mid); }
.index .go a:hover { color: var(--fg); }

/* ── generic section ────────────────────────────────────── */

section { padding: clamp(3rem, 8vh, 5rem) 0; }
.rule { border-top: 1px solid var(--line); }
.lead { font-size: 1rem; color: var(--mid); }

.btn {
  display: inline-block;
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.btn:hover { border-color: var(--proj); background: var(--proj-soft); }
.links { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ── demo blocks (demos.html) ───────────────────────────── */

.demo { padding: clamp(3rem, 7vh, 4.5rem) 0; border-top: 1px solid var(--line); }
.demo header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.75rem 1.5rem; margin-bottom: 1.5rem; }
.demo h2 { font-size: 1.5rem; }
.demo .lead { max-width: 62ch; margin: 0 0 1.75rem; font-size: 0.9375rem; }

.stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  aspect-ratio: 16 / 10;
}
.stage > iframe, .stage > video { width: 100%; height: 100%; border: 0; }
.stage-phone { aspect-ratio: 9 / 19.5; max-width: 22rem; }
.stage-empty { display: grid; place-content: center; gap: 0.5rem; text-align: center; padding: 2rem; color: var(--dim); }
.demo footer { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; }
.demo footer a { font-size: 0.8125rem; color: var(--mid); }
.demo footer a:hover { color: var(--fg); }
.note { font-size: 0.8125rem; color: var(--dim); }

/* ── prose (case pages, cat befit.md) ───────────────────── */

.prose h2 { font-size: 1.1875rem; margin: 2.5rem 0 0.75rem; }
.prose p { margin: 0 0 1rem; color: var(--mid); }
.prose ul { margin: 0 0 1rem; padding-left: 1.1rem; color: var(--mid); }
.prose li { margin-bottom: 0.35rem; }
.prose b, .prose strong { color: var(--fg); font-weight: 500; }
.prose code { font-size: 0.875em; color: var(--fg); }
.prose pre {
  font-size: 0.75rem; line-height: 1.7; color: var(--mid);
  border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem;
  overflow-x: auto; white-space: pre; margin: 0 0 1.5rem;
}
.prose pre b { color: var(--fg); font-weight: 400; }

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

footer.page { border-top: 1px solid var(--line); padding: 2rem 0 3rem; }
footer.page .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; }

/* Document content stays readable even if a demo or a script cannot load. */

/* ── demo controls ──────────────────────────────────────── */

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
/* ── the two idioms this interface is made of ────────────────
   [thing]  anything you can act on
   · thing  anything that is just a fact
   Nothing else is clickable, nothing else is a list. */

.k {
  font: inherit; font-size: 0.75rem; line-height: 1.5;
  cursor: pointer; text-decoration: none;
  color: var(--fg); background: none; border: 0; padding: 0;
  transition: color .12s var(--ease);
}
.k::before { content: "["; color: var(--dim); }
.k::after  { content: "]"; color: var(--dim); }
.k:hover, .k:focus-visible { color: var(--proj-ink); outline: 0; }
.k:hover::before, .k:hover::after,
.k:focus-visible::before, .k:focus-visible::after { color: var(--proj-ink); }
.k:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.k[aria-pressed="true"] { color: var(--proj-ink); }

.bul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; }
.bul li { color: var(--mid); }
.bul li::before { content: "·"; color: var(--dim); margin-right: 0.6rem; }

/* ── chatair deck ───────────────────────────────────────── */

.deck { position: relative; height: 100%; }
.deck img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .5s var(--ease); }
.deck img.on { opacity: 1; }
.deck-dots { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin: 0.75rem auto 0; }
.deck img[hidden] { display: none; }
.deck-dots button { min-height: 36px; padding: 6px 12px; border-radius: 5px; border: 1px solid var(--line); cursor: pointer; color: var(--mid); background: var(--surface); font: inherit; font-size: 11px; }
.deck-dots button[aria-pressed="true"] { color: var(--fg); border-color: var(--dim); }

/* ── twitch bot command explorer ────────────────────────── */

.search {
  font: inherit; width: 100%; max-width: 22rem;
  background: none; color: var(--fg);
  border: 0; border-bottom: 1px solid var(--line); padding: 0.5rem 0;
}
.search::placeholder { color: var(--dim); }
.search:focus { outline: 0; border-color: var(--proj-ink); }

.cmds { border-top: 1px solid var(--line); margin-top: 1.25rem; }
.cmds details { border-bottom: 1px solid var(--line); }
.cmds summary {
  display: grid; grid-template-columns: 11rem 1fr; gap: 1rem;
  padding: 0.7rem 0; cursor: pointer; list-style: none;
}
.cmds summary::-webkit-details-marker { display: none; }
.cmds summary:hover { color: var(--fg); }
.cmds code { font-size: 0.8125rem; }
.cmds .desc { color: var(--mid); font-size: 0.875rem; }
.cmds .body { padding: 0 0 1rem 12rem; display: grid; gap: 0.4rem; }
@media (max-width: 48rem) {
  .cmds summary { grid-template-columns: 1fr; gap: 0.2rem; }
  .cmds .body { padding-left: 0; }
}
.cmds .body > div:not(.chat) { display: grid; grid-template-columns: 5rem 1fr; gap: 1rem; font-size: 0.8125rem; }
.cmds .body > div:not(.chat) span:first-child { color: var(--dim); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; }
.cmds .body > div:not(.chat) span:last-child { color: var(--mid); }
.count { font-size: 0.75rem; color: var(--dim); }

/* ── bot: example exchange ──────────────────────────────
   Username colour and 7TV paint are rendered the way Chatair does it:
   the asker's colour is lifted until it clears 4.5:1 on black, and the
   paint texture sits over the user colour, clipped to the glyphs. */

.chat { margin: 0.25rem 0 0.9rem; display: grid; gap: 0.3rem; }
.chat p { margin: 0; font-size: 0.9375rem; line-height: 1.5; }
.chat .who { font-weight: 500; }
.chat .badge { display: inline-block; width: 18px; height: 18px; margin-right: 0.35rem; vertical-align: -4px; }
.cmds .chat { padding: 12px; border-radius: 6px; background: #090d0b; color: #c4cdc7; overflow-wrap: anywhere; }
.cmds .chat p { color: inherit; }
.cmds code { overflow-wrap: anywhere; }
.bot-empty[hidden] { display: none; }
.demo-message { padding: 24px; border: 1px solid var(--line); border-radius: 8px; color: var(--mid); line-height: 1.7; }
[data-demo-state="ready"] > .demo-message { display: none; }
[data-demo-state]:not([data-demo-state="ready"]) > iframe,
[data-demo-state]:not([data-demo-state="ready"]) > .devbar,
[data-demo-state]:not([data-demo-state="ready"]) > .device { display: none; }
#channel-preview:not([data-demo-state="ready"]) { aspect-ratio: auto !important; background: none; border: 0; }
html:not(.js) #theme-btn, html:not(.js) #channel-preview iframe { display: none; }
.chat .paint {
  color: transparent;
  background-color: #B1EB34;                     /* user colour under the texture */
  background-image: url(assets/paint-cs-gold.webp);
  background-size: cover;
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 0 0.1px #FBDC45, 1px 1px 0.1px #803E00;
}
@supports not ((background-clip: text) or (-webkit-background-clip: text)) {
  .chat .paint { color: #B1EB34; background: none; }
}

@media (prefers-reduced-motion: reduce) {
  .js [data-anim] { opacity: 1; transform: none; transition: none; }
  * { transition-duration: 0s !important; animation: none !important; }
}
