/*
 * term.css: the one stylesheet for www.meiorz.tech (home, 404, archive pages).
 *
 * The page is a plain, readable document: a warm background, serif headings,
 * one column, generous spacing. The terminal (prompt, obby, meiorz-cli) is a small
 * monospace panel at the end of the home page.
 *
 * Sections
 *   1. Tokens (light default, dark via OS preference or [data-theme])
 *   2. Base and typography
 *   3. Layout: header, nav, page, blocks, intro, footer
 *   4. Content components: buttons, badges, checklist, key/value lists, projects
 *   5. Terminal: panel, log output, echo, prompt, link buttons, ls listing, help table
 *   6. Generic pane (used by obby and meiorz-cli)
 *   7. Obby hooks
 *   8. meiorz-cli hooks: accent is --magenta, never the site's clay accent
 *   9. Motion (only with prefers-reduced-motion: no-preference and not html.motion-off)
 *  10. Print
 *
 * Contract: no inline styles anywhere (strict CSP), so every visual hook other
 * modules need is defined here. Colors come only from the tokens below; each
 * text token meets WCAG AA (4.5:1) on both --bg and --panel in both themes,
 * and --border and the --t-* tile colors meet 3:1 on --panel. --line (hairline
 * dividers) and obby air cells (.c-air) are decorative and exempt from 3:1.
 */

/* 1. Tokens */

:root {
  color-scheme: light dark;
  --bg: #faf9f5;
  --panel: #f0eee6;
  --fg: #141413;
  --muted: #5e5d59;
  --prompt: #3d6a2e;
  --accent: #a8472a;
  --accent-tint: #d27748;
  --warn: #7d5200;
  --error: #b3261e;
  --magenta: #8a3aa3;
  --border: #87867f;
  --line: #e0dcd0;

  /* Obby tiles (text color of each cell class) */
  --t-solid: #5e5d59;
  --t-kill: #b3261e;
  --t-conv: #7d5200;
  --t-jump: #8a3aa3;
  --t-check: #3d6a2e;
  --t-finish: #2c5f9e;
  --t-player: #000000;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  --radius: 8px;
  --radius-lg: 16px;
  --gap: 1ch;
  --gutter: clamp(16px, 5vw, 2.5rem);
  --prompt-h: 6.5rem; /* space the sticky prompt covers; used for scroll padding */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1f1e1d;
    --panel: #2b2a27;
    --fg: #ece9e0;
    --muted: #b0ada3;
    --prompt: #a3c785;
    --accent: #e8957a;
    --accent-tint: #f6c3a0;
    --warn: #e0b25a;
    --error: #f59488;
    --magenta: #d6a8e6;
    --border: #8a877e;
    --line: #3b3a36;
    --t-solid: #b0ada3;
    --t-kill: #f59488;
    --t-conv: #e0b25a;
    --t-jump: #d6a8e6;
    --t-check: #a3c785;
    --t-finish: #8fb8ea;
    --t-player: #ffffff;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1f1e1d;
  --panel: #2b2a27;
  --fg: #ece9e0;
  --muted: #b0ada3;
  --prompt: #a3c785;
  --accent: #e8957a;
  --accent-tint: #f6c3a0;
  --warn: #e0b25a;
  --error: #f59488;
  --magenta: #d6a8e6;
  --border: #8a877e;
  --line: #3b3a36;
  --t-solid: #b0ada3;
  --t-kill: #f59488;
  --t-conv: #e0b25a;
  --t-jump: #d6a8e6;
  --t-check: #a3c785;
  --t-finish: #8fb8ea;
  --t-player: #ffffff;
}

:root[data-theme="light"] {
  color-scheme: light;
}

/* 2. Base and typography */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5.5rem; /* clears the top bar, which follows the page */
}

html.term-ready {
  scroll-padding-bottom: var(--prompt-h);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
.h1,
.h2,
.h3 {
  margin: 0 0 0.75rem;
  color: var(--fg);
  line-height: 1.2;
  text-wrap: balance;
}

h1,
h2,
.h1,
.h2 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.01em;
}

h1,
.h1 {
  font-size: clamp(2.25rem, 7vw, 3.5rem);
  line-height: 1.1;
}

h2,
.h2 {
  font-size: clamp(1.625rem, 4vw, 2rem);
}

h3,
.h3 {
  margin-top: 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.35;
}

p,
ul,
ol,
dl,
figure {
  margin: 0.75rem 0;
}

ul,
ol {
  padding-left: 1.25rem;
}

li + li {
  margin-top: 0.3rem;
}

li::marker {
  color: var(--muted);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

[tabindex="-1"]:focus:not(:focus-visible) {
  outline: none;
}

code,
kbd,
pre {
  font-family: var(--mono);
  font-variant-ligatures: none;
}

code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--panel);
  font-size: 0.875em;
}

kbd {
  font-size: 0.875em;
  padding: 0 0.4ch;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--fg);
  white-space: nowrap;
}

button {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

/* Visually hidden but available to assistive tech (never used for content). */
.visually-hidden:not(:focus):not(:active) {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* Skip links: off-screen until focused. */
.skip {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 10;
  padding: 0.5rem 1ch;
  background: var(--bg);
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
}

.skip:focus {
  top: 1rem;
}

/* Controls that only work with JavaScript stay hidden until term.js is ready. */
html:not(.term-ready) .js-only {
  display: none;
}

/* Notes meant only for readers without JavaScript. */
html.term-ready .nojs {
  display: none;
}

/* 3. Layout */

.page,
.footer {
  max-width: calc(44rem + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* The top bar follows the page. It is see-through: the page shows behind it,
   blurred, with just enough of the background color to keep the links readable.
   It spans the window; its padding lines its content up with the page column. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.5rem;
  padding-block: 0.85rem;
  padding-inline: max(var(--gutter), calc((100% - 44rem) / 2));
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Phones: the name and the theme button on one row, the links on a second row
   that scrolls sideways, so the bar stays two rows tall. */
@media (max-width: 40rem) {
  html {
    scroll-padding-top: 7.5rem;
  }

  .site-header {
    padding-block: 0.5rem;
  }

  .site-header .site-nav {
    order: 3;
    flex: 0 0 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
  }
}

/* Back to top: a round button that appears once the intro has scrolled away
   (term.js adds .is-visible). On small screens it steps aside while the
   terminal is on screen, so it never covers the prompt or the obby controls. */
.to-top {
  position: fixed;
  right: max(1rem, calc((100vw - 44rem) / 2 - 5rem));
  bottom: 1.5rem;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--fg);
  font-size: 1.25rem;
  line-height: 1;
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
}

.to-top:hover {
  border-color: var(--fg);
}

@media (max-width: 60rem) {
  .to-top.near-terminal {
    opacity: 0;
    visibility: hidden;
  }
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: auto;
  color: var(--fg);
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
}

/* The logo: img/logo.svg used as a mask over a soft gradient of the accent color
   (--accent-tint at the ears, --accent at the tail), in both themes. */
.wordmark::before {
  content: "";
  width: 1.6em;
  height: 1.6em;
  background: linear-gradient(160deg, var(--accent-tint), var(--accent) 70%);
  -webkit-mask: url("/img/logo.svg") center / contain no-repeat;
  mask: url("/img/logo.svg") center / contain no-repeat;
}

.wordmark:hover {
  text-decoration: underline;
}

/* Section links: plain in-page links (with or without JS). */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  font-size: 0.9375rem;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--fg);
  text-decoration: underline;
}

@media (pointer: coarse) {
  .site-nav a {
    min-height: 44px;
  }
}

#theme-toggle {
  min-height: 2rem;
  padding: 0.15rem 0.85rem;
  font-size: 0.875rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

#theme-toggle:hover {
  color: var(--fg);
  border-color: var(--fg);
}

.page {
  display: block;
  padding-bottom: 3rem;
}

.block {
  padding-block: 2.75rem;
  border-top: 1px solid var(--line);
}

.block > :last-child {
  margin-bottom: 0;
}

/* The intro: a headline, one paragraph and where to go next. */
.hero {
  padding-block: clamp(2rem, 8vw, 4.5rem) 3.5rem;
  border-top: 0;
}

.hero h1 {
  margin-bottom: 1.25rem;
}

/* The typed headline: monospace, so each letter is one ch wide and the typing
   animation (section 9) can reveal it letter by letter. The text is in the
   page from the start; the right border is the cursor. */
.typed {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  border-right: 0.08em solid var(--accent);
  padding-right: 0.08em;
  font-family: var(--mono);
  font-variant-ligatures: none;
  letter-spacing: 0;
  white-space: nowrap;
  vertical-align: bottom;
}

/* Printed into the terminal log (whoami), it is plain text. */
.terminal .typed {
  display: inline;
  border: 0;
  padding: 0;
  animation: none;
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.lede {
  font-size: 1.25rem;
  line-height: 1.55;
}

.seeking {
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 0.875rem;
}

.meta {
  color: var(--muted);
  font-size: 0.9375rem;
}

h3 + .meta {
  margin-top: -0.5rem;
}

.footer {
  padding-block: 1.5rem 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}

.footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
}

.footer li + li {
  margin-top: 0;
}

.footer p {
  margin: 0;
}

/* 4. Content components */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1.5rem;
}

.button,
.run {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.4rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
.run:hover {
  border-color: var(--fg);
  text-decoration: none;
}

.button--primary {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}

.button--primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

/* "run obby" style buttons. */
.run {
  font-family: var(--mono);
  font-size: 0.9375rem;
}

.run::before {
  content: "\25B6\00A0" / "";
  color: var(--accent);
}

.checklist {
  list-style: none;
  padding-left: 0;
}

.checklist li {
  display: flex;
  gap: 0.75rem;
}

.checklist .box {
  flex: none;
  width: 1.25rem;
  color: var(--prompt);
  text-align: center;
}

/* Key/value lists (skills, contact). Two columns when there is room. */
.kv {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.15rem 2rem;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0 0 0.75rem;
  min-width: 0;
}

@media (min-width: 36rem) {
  .kv {
    grid-template-columns: max-content minmax(0, 1fr);
    row-gap: 0.75rem;
  }

  .kv dd {
    margin: 0;
  }
}

.project {
  margin: 1.25rem 0;
  padding: 1.5rem clamp(1.125rem, 4vw, 1.75rem);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.project > h3,
.project > .h3 {
  margin-top: 0;
}

.project > :last-child {
  margin-bottom: 0;
}

.project code {
  background: var(--bg);
}

/* 5. Terminal */

.terminal {
  margin-top: 0.5rem;
  padding: 1rem 1.25rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 0.9375rem;
  font-variant-ligatures: none;
  line-height: 1.55;
}

/* Page sections printed into the log keep the terminal's voice. */
.terminal .h1,
.terminal .h2,
.terminal .h3 {
  margin: 0 0 0.5rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
}

.terminal .h2 {
  color: var(--warn);
}

.terminal .h3 {
  margin-top: 1rem;
}

.terminal .lede,
.terminal .meta,
.terminal .eyebrow,
.terminal .button,
.terminal .run {
  font-size: inherit;
}

.terminal code {
  padding: 0;
  background: none;
  color: var(--prompt);
  font-size: inherit;
}

.terminal .project {
  margin: 0;
  padding: 0.25rem 0 0.25rem 1.5ch;
  border-radius: 0;
  background: none;
}

/* Pictures printed by cat. Pixel art keeps hard edges when scaled. */
.term-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.term-img.pixel {
  image-rendering: pixelated;
}

.ps1 {
  color: var(--prompt);
  font-weight: 700;
}

#log {
  margin: 0 0 0.5rem;
}

/* One printed block of output. */
.out {
  margin: 0.15rem 0 0.35rem;
  min-width: 0;
}

.out--error {
  color: var(--error);
}

.out--muted {
  color: var(--muted);
}

.out--ok {
  color: var(--prompt);
}

.out pre {
  margin: 0;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.4;
}

.out > p:first-child,
.out > ul:first-child {
  margin-top: 0;
}

/* The echoed command line. */
.echo {
  margin-top: 0.9rem;
  white-space: pre-wrap;
}

/* A clone of a page section printed into the log. */
.clone {
  padding: 0.25rem 0 0.25rem 1.5ch;
  border-left: 2px solid var(--border);
}

/* Buttons that look like links (inline commands in the output). */
.link-btn {
  display: inline;
  min-height: 1.5rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
  text-align: start;
}

.link-btn:hover {
  text-decoration-thickness: 2px;
}

.link-btn:disabled {
  color: var(--muted);
  cursor: default;
}

/* ls output */
.ls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 3ch;
  list-style: none;
  padding: 0;
  margin: 0;
}

.ls li + li {
  margin-top: 0;
}

.ls .dir {
  color: var(--accent);
  font-weight: 700;
}

.ls .file {
  color: var(--fg);
}

/* help table */
.cmds {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 2ch;
  margin: 0.25rem 0 0.75rem;
}

.cmds dt {
  margin-top: 0.35rem;
}

.cmds dd {
  margin: 0 0 0 2ch;
  color: var(--muted);
}

@media (min-width: 36rem) {
  .cmds {
    grid-template-columns: max-content minmax(0, 1fr);
  }

  .cmds dt {
    margin-top: 0;
  }

  .cmds dd {
    margin: 0;
  }
}

.group {
  margin: 0.5rem 0 0;
  color: var(--warn);
  font-weight: 700;
}

/* man pages: NAME / SYNOPSIS / ... with indented bodies */
.indent {
  margin: 0 0 0 4ch;
}

@media (max-width: 24rem) {
  .indent {
    margin-left: 2ch;
  }
}

/* The prompt: the last row of the terminal panel. It sticks to the bottom of
   the window while the panel is taller than the screen. */
.prompt {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0 1ch;
  margin: 0 -1.25rem;
  padding: 0.5rem 1.25rem 0.75rem;
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.prompt:focus-within {
  border-top-color: var(--accent);
}

.prompt__label {
  white-space: nowrap;
}

#cmd {
  width: 100%;
  min-width: 0;
  padding: 0.35rem 0.5ch;
  font-family: inherit;
  font-size: max(16px, 1em);
  font-variant-ligatures: none;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-radius: 4px;
  caret-color: var(--accent);
}

#cmd::placeholder {
  color: var(--muted);
  opacity: 1;
}

.prompt .hint {
  grid-column: 1 / -1;
  margin: 0.15rem 0 0;
  font-size: 0.8125rem;
}

/* Touch-first devices have no arrow/Tab/Ctrl keys: drop the shell's key hint
   (term.js marks it .hint--default; a mode's own hint via setHint() stays;
   the input's placeholder says "type help" instead). */
@media (pointer: coarse) {
  .prompt .hint--default {
    display: none;
  }
}

/* 6. Generic pane (obby, meiorz-cli) */

.pane {
  max-width: 100%;
  margin: 0.5rem 0 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.pane:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pane__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 2ch;
  padding: 0.3rem 1ch;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
}

.pane__body {
  padding: 0.5rem 1ch;
  overflow-x: auto;
}

.pane__footer {
  padding: 0.3rem 1ch;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--muted);
}

/* 7. Obby */

/* The playfield: one <span class="c-*"> per run of same-kind cells. */
.obby-field {
  margin: 0;
  font-size: clamp(12px, 2.7vw, 16px);
  line-height: 1.3;
  white-space: pre;
  overflow-x: auto;
  color: var(--muted);
}

/* Inside term.print() the field also matches `.out pre` (line-height 1.4).
   Rows are 1.3 tall so the filled cells below tile without gaps; a glyph box
   that overhangs its row must not count as vertical overflow (a scrollbar). */
.out pre.obby-field {
  line-height: 1.3;
  overflow-y: hidden;
}

/* Air is decorative: dimmer than the course, still visible for counting gaps. */
.c-air {
  color: var(--border);
  color: color-mix(in srgb, var(--border) 50%, var(--bg));
}

/* Every tile is a filled cell with its glyph on top, so the course reads as
   shapes first and never by color alone: walls are solid blocks, and each
   other kind keeps its own character. */
.c-solid {
  color: var(--t-solid);
  background: var(--t-solid);
}

.c-kill,
.c-conv,
.c-jump,
.c-check,
.c-finish,
.c-player {
  color: var(--bg);
  font-weight: 700;
}

.c-kill {
  background: var(--t-kill);
}

.c-conv {
  background: var(--t-conv);
}

.c-jump {
  background: var(--t-jump);
}

.c-check {
  background: var(--t-check);
}

.c-finish {
  background: var(--t-finish);
}

.c-player {
  background: var(--t-player);
}

.obby-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2.5ch;
  margin: 0 0 0.5rem;
  color: var(--fg);
}

/* Glyph key under the field: <p class="hint obby-legend"> with .c-* spans. */
.obby-legend {
  margin: 0.5rem 0 0;
}

.obby-legend {
  line-height: 1.9;
}

.obby-legend [class^="c-"],
.obby-legend [class*=" c-"] {
  padding: 0 0.4ch;
  font-weight: 700;
}

.obby-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.obby-controls button {
  min-width: 44px;
  min-height: 44px;
  padding: 0.25rem 1ch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--fg);
  font-size: 1.125rem;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.obby-controls button:active,
.obby-controls button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* 8. meiorz-cli */

/* Rounded panel: drawn with border-radius, not box-drawing characters.
   Also usable on the prompt: pushMode({ promptClass: 'cli-box', ... }). */
.cli-box {
  border: 1px solid var(--magenta);
  border-radius: 12px;
  padding: 0.4rem 1.5ch;
  margin: 0.5rem 0;
}

.prompt.cli-box {
  margin: 0 0 1rem;
  border-top: 1px solid var(--magenta);
  border-radius: 12px;
  padding: 0.4rem 1.5ch 0.5rem;
}

.cli-welcome {
  color: var(--fg);
}

.cli-welcome strong,
.cli-accent {
  color: var(--magenta);
}

/* The user's line echoed inside the CLI (render your own ">" glyph). */
.cli-prompt {
  color: var(--fg);
  font-weight: 700;
}

/* "● Tool(args)" line. Wrap the bullet in .cli-dot to color it. */
.cli-tool {
  margin-top: 0.5rem;
  color: var(--fg);
}

.cli-dot {
  color: var(--prompt);
}

/* "⎿ result" line, indented under its tool call. */
.cli-result {
  padding-left: 2ch;
  color: var(--muted);
  white-space: pre-wrap;
}

.cli-diff-add,
.cli-diff-del {
  display: block;
  min-width: max-content;
  white-space: pre;
  padding: 0 1ch;
}

.cli-diff-add .visually-hidden,
.cli-diff-del .visually-hidden {
  user-select: none;
}

.cli-diff-add {
  color: var(--prompt);
  background: color-mix(in srgb, var(--prompt) 10%, transparent);
}

.cli-diff-del {
  color: var(--error);
  background: color-mix(in srgb, var(--error) 10%, transparent);
}

.cli-spinner {
  color: var(--magenta);
}

.cli-dim {
  color: var(--muted);
}

/* Permission menu: <ol class="cli-menu" role="listbox"> with role="option" items. */
.cli-menu {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0;
}

.cli-menu li {
  display: flex;
  align-items: center;
  min-height: 1.75rem;
  margin: 0;
  padding: 0 1ch;
  border-radius: 4px;
  cursor: pointer;
}

/* Selected option: inverted colors (render your own "❯" marker as text). */
.cli-menu li[aria-selected="true"] {
  background: var(--magenta);
  color: var(--bg);
}

.cli-menu:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cli-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 2ch;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* The Shift+Tab mode indicator, inside the hint set with term.setHint(). */
.hint .cli-mode {
  color: var(--magenta);
}

/* Narrow or touch screens: keep the hint under the prompt short (the
   "scripted, no AI" part stays). */
@media (max-width: 30rem), (pointer: coarse) {
  .cli-footer__more,
  .cli-keys,
  .cli-keyhint {
    display: none;
  }
}

.cli-todo {
  list-style: none;
  padding-left: 2ch;
  margin: 0.25rem 0;
}

.cli-todo li.done {
  color: var(--muted);
  text-decoration: line-through;
}

/* 9. Motion */

@media (prefers-reduced-motion: no-preference) {
  html:not(.motion-off) {
    scroll-behavior: smooth;
  }

  html:not(.motion-off) .to-top {
    transition: opacity 0.2s ease, visibility 0.2s;
  }

  html:not(.motion-off) .out,
  html:not(.motion-off) .echo {
    animation: out-in 0.18s ease-out;
  }

  /* 12 steps and 12ch: one per character of "Hello World!" (intro_headline).
     Change both numbers if the headline changes. */
  html:not(.motion-off) h1 .typed {
    width: calc(12ch + 0.16em);
    animation: type-in 1.4s steps(12, end) 0.3s both, cursor-blink 1.1s step-end infinite;
  }

  @keyframes type-in {
    from {
      width: 0.16em;
    }
  }

  @keyframes cursor-blink {
    50% {
      border-right-color: transparent;
    }
  }

  @keyframes out-in {
    from {
      opacity: 0;
      transform: translateY(3px);
    }
  }
}

/* 10. Print */

@media print {
  /* Same specificity as both dark rules and later in the file, so a dark
     theme (OS or saved) prints dark-on-white. */
  :root:not([data-theme="light"]) {
    color-scheme: light;
    --bg: #fff;
    --panel: #fff;
    --fg: #000;
    --muted: #444;
    --prompt: #3d6a2e;
    --accent: #a8472a;
    --accent-tint: #d27748;
    --warn: #7d5200;
    --error: #b3261e;
    --magenta: #8a3aa3;
    --border: #777;
    --line: #bbb;
    --t-solid: #5e5d59;
    --t-kill: #b3261e;
    --t-conv: #7d5200;
    --t-jump: #8a3aa3;
    --t-check: #3d6a2e;
    --t-finish: #2c5f9e;
    --t-player: #000000;
  }

  body {
    background: #fff;
    color: #000;
  }

  .project {
    border: 1px solid var(--line);
  }

  .site-header {
    position: static;
  }

  .site-nav,
  .to-top,
  .terminal,
  .actions,
  .js-only,
  .skip,
  #theme-toggle {
    display: none !important;
  }
}
