/* One typeface, one size for almost everything, like a terminal. Hierarchy
   comes from color, from the box-drawing structure and from the banner. */
:root {
  --night: #0f1026;
  --deep: #15173a;
  --rule: #2c2f5e;
  --fog: #8d92c2;
  --paper: #e3e5fb;
  --indigo: #818cf8;
  --lilac: #c4b5fd;
  --mono: "Cascadia Mono", "Cascadia Code", "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  --col: 100ch;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  background: var(--night);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  font-variant-ligatures: none;
  -webkit-font-smoothing: antialiased;
}
@media (max-width: 40rem) { body { font-size: 14px; } }
a { color: var(--indigo); text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
a:hover { color: var(--lilac); }
:focus-visible { outline: 2px solid var(--lilac); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--indigo); color: var(--night); }
code { font-family: inherit; color: var(--lilac); }
p { margin: 0 0 1em; }
.col { width: 100%; max-width: var(--col); margin: 0 auto; padding: 0 1rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -3rem; z-index: 10; background: var(--indigo); color: var(--night); padding: 0.3em 0.8em; }
.skip:focus { top: 0.6rem; }
[hidden] { display: none !important; }

/* menu bar */
.bar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--night) 88%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--rule); }
.bar-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1.5rem; padding-top: 0.7rem; padding-bottom: 0.7rem; }
.mark { color: var(--paper); text-decoration: none; font-weight: 700; font-size: 1.1em; }
.cursor { color: var(--indigo); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
nav { display: flex; flex-wrap: wrap; gap: 0.1rem 1.4rem; }
nav a { color: var(--fog); text-decoration: none; }
nav a:hover { color: var(--paper); }
nav kbd { font: inherit; color: var(--indigo); margin-right: 0.5ch; }
nav .out::after { content: " ↗"; color: var(--indigo); }
@media (max-width: 40rem) {
  .bar { position: static; }
  nav kbd { display: none; }
  nav { gap: 0.1rem 1rem; }
  .field {
    -webkit-mask-image: linear-gradient(to right, transparent 25%, #000 75%), linear-gradient(to bottom, #000 15%, transparent 32%);
    mask-image: linear-gradient(to right, transparent 25%, #000 75%), linear-gradient(to bottom, #000 15%, transparent 32%);
  }
}

/* hero */
.hero { position: relative; overflow: hidden; padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2.5rem, 5vw, 4rem); }
.field {
  position: absolute; inset: 0; margin: 0; z-index: -1;
  font: 12px/14px var(--mono); color: var(--indigo); opacity: 0.32;
  overflow: hidden; pointer-events: none; user-select: none;
  -webkit-mask-image: linear-gradient(to right, transparent 30%, #000 70%), linear-gradient(to bottom, #000 50%, transparent 85%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 30%, #000 70%), linear-gradient(to bottom, #000 50%, transparent 85%);
  mask-composite: intersect;
}
.hero .col { position: relative; }
.banner {
  margin: 0 0 1.75rem;
  font-size: clamp(14px, calc((100vw - 2rem) / 14), 46px);
  line-height: 1.08;
  font-weight: 700;
  white-space: pre;
  letter-spacing: 0;
  width: max-content;
  background: linear-gradient(115deg, var(--indigo) 20%, var(--lilac) 85%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgb(129 140 248 / 0.45));
}
.tagline { font-size: clamp(1.15rem, 1rem + 1vw, 1.6rem); line-height: 1.3; font-weight: 700; margin: 0 0 0.75rem; max-width: 34ch; }
.lede { color: var(--fog); max-width: 62ch; margin: 0 0 2.5rem; }

/* a box whose title sits in its top border, the way TUI panes are drawn */
.pane { position: relative; border: 1px solid var(--rule); border-radius: 4px; padding: 1.4rem 1.25rem 1.1rem; background: var(--night); margin: 0 0 2.25rem; }
.pane-title { position: absolute; top: -0.85em; left: 1.25ch; margin: 0; padding: 0 1ch; background: var(--night); font-size: 1em; font-weight: 400; color: var(--indigo); }
.pane-title::before { content: "┤ "; color: var(--rule); }
.pane-title::after { content: " ├"; color: var(--rule); }

.tabs { display: flex; gap: 0.25rem; margin: 0 0 0.9rem; }
.tabs button { font: inherit; color: var(--fog); background: none; border: 0; padding: 0.1em 0.6ch; cursor: pointer; }
.tabs button:hover { color: var(--paper); }
.tabs button[aria-selected="true"] { color: var(--night); background: var(--indigo); }

.cmd { display: flex; align-items: flex-start; gap: 1ch; background: var(--deep); border-radius: 3px; padding: 0.75rem 0.9rem; }
.cmd .prompt { color: var(--fog); flex: none; user-select: none; }
.cmd code { flex: 1; min-width: 0; color: var(--paper); white-space: pre-wrap; word-break: break-all; }
.copy { flex: none; font: inherit; font-size: 0.9em; color: var(--indigo); background: none; border: 1px solid var(--rule); border-radius: 3px; padding: 0 0.9ch; cursor: pointer; }
.copy:hover { border-color: var(--indigo); }
.copy[data-done] { color: var(--night); background: var(--indigo); border-color: var(--indigo); }
.hint { color: var(--fog); font-size: 0.93em; margin: 0.75rem 0 0; max-width: 72ch; }

/* the replayed session */
.term { margin: 0; border: 1px solid var(--rule); border-radius: 6px; background: var(--deep); box-shadow: 0 30px 80px -40px rgb(129 140 248 / 0.45); overflow: hidden; }
.term-bar { display: flex; align-items: center; gap: 1.5ch; padding: 0.4rem 0.9rem; border-bottom: 1px solid var(--rule); color: var(--fog); font-size: 0.85em; }
.term-name::before { content: "▍"; color: var(--indigo); margin-right: 0.6ch; }
.term-speed { margin-left: auto; }
.term-replay { font: inherit; color: var(--indigo); background: none; border: 1px solid var(--rule); border-radius: 3px; padding: 0 0.9ch; cursor: pointer; }
.term-replay:hover { border-color: var(--indigo); }
.term-screen {
  margin: 0; padding: 0.9rem 1rem; font-size: 14px; line-height: 1.45;
  height: calc(23 * 14px * 1.45 + 1.8rem); overflow: hidden;
  white-space: pre; color: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 2px, rgb(255 255 255 / 0.018) 2px 3px);
}
@media (max-width: 40rem) { .term-screen { font-size: 11px; height: calc(23 * 11px * 1.45 + 1.8rem); padding: 0.7rem; } }
.term-screen .a { color: var(--indigo); }
.term-screen .m { color: var(--fog); }
.term-screen .w { color: #f5c97a; }
.term-screen .p { color: var(--fog); }
.term-screen .caret { background: var(--paper); color: var(--deep); animation: blink 1.1s steps(1) infinite; }

/* sections */
.sect { padding: clamp(2rem, 4.5vw, 3.25rem) 0; }
.rule { display: flex; align-items: center; gap: 1.5ch; font-size: 1em; font-weight: 700; color: var(--paper); margin: 0 0 2rem; }
.rule::before { content: "##"; color: var(--indigo); font-weight: 400; }
.rule::after { content: ""; flex: 1; border-top: 1px dashed var(--rule); }

/* why: laid out like the options block of --help */
.opts { margin: 0; display: grid; gap: 1.1rem; }
.opts div { display: grid; grid-template-columns: 16ch 1fr; gap: 0 2ch; }
.opts dt { color: var(--indigo); font-weight: 700; }
.opts dd { margin: 0; color: var(--fog); max-width: 64ch; }
.opts dd code { color: var(--paper); }
@media (max-width: 40rem) { .opts div { grid-template-columns: 1fr; } }

/* inside: a tree, because the steps run in order */
.tree { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.tree li { position: relative; display: grid; grid-template-columns: 12ch 1fr; gap: 0 2ch; padding: 0 0 1.1rem 4ch; border-left: 1px solid var(--rule); margin-left: 0.5ch; }
.tree li::before { content: "├─"; position: absolute; left: -0.5ch; top: 0; color: var(--rule); background: var(--night); line-height: inherit; }
.tree li:last-child { border-left-color: transparent; padding-bottom: 0; }
.tree li:last-child::before { content: "└─"; }
.tree b { color: var(--indigo); }
.tree span { color: var(--fog); max-width: 64ch; }
.tree code { color: var(--paper); }
@media (max-width: 40rem) { .tree li { grid-template-columns: 1fr; } }

/* manual: a man page */
.man { border: 1px solid var(--rule); border-radius: 4px; padding: 1.1rem 1.5rem 1.25rem; background: linear-gradient(var(--deep), var(--night) 60%); }
.man h3 { font-size: 1em; margin: 1.6rem 0 0.4rem; color: var(--paper); font-weight: 700; }
.man-head { display: flex; justify-content: space-between; gap: 2ch; color: var(--fog); margin: 0; }
.man-head:last-child { margin-top: 2rem; }
.man b { color: var(--paper); }
.man i { font-style: normal; color: var(--lilac); }
.man p { color: var(--fog); max-width: 70ch; }
.ind { margin-left: 4ch; }
.cmds { margin-top: 0; margin-bottom: 0; display: grid; grid-template-columns: 20ch 1fr; gap: 0.35rem 3ch; }
.cmds dt { white-space: nowrap; color: var(--fog); }
.cmds dd { margin: 0; color: var(--fog); }
.cmds dt b { color: var(--indigo); }
.cfg, .ex { margin: 0.5rem 0 0; padding: 0.75rem 1rem; background: var(--night); border: 1px solid var(--rule); border-radius: 3px; overflow-x: auto; line-height: 1.6; }
.ex { margin-top: 0; }
.cfg .k { color: var(--indigo); }
.cfg .c, .ex .c { color: var(--fog); }
@media (max-width: 40rem) {
  .man { padding: 1rem; }
  .ind { margin-left: 1ch; }
  .cmds { grid-template-columns: 1fr; gap: 0; }
  .cmds dd { margin-bottom: 0.7rem; }
  .man-head span:nth-child(2) { display: none; }
}

/* questions */
.faq details { border-top: 1px dashed var(--rule); }
.faq details:last-child { border-bottom: 1px dashed var(--rule); }
.faq summary { list-style: none; cursor: pointer; padding: 0.8rem 0; color: var(--paper); display: flex; gap: 1.5ch; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "[+]"; color: var(--indigo); flex: none; }
.faq details[open] summary::before { content: "[-]"; }
.faq summary:hover { color: var(--lilac); }
.faq details p { color: var(--fog); margin: 0 0 1rem 4.5ch; max-width: 66ch; }
.faq code { color: var(--paper); }

/* a status line, the way a TUI ends */
.status { margin-top: clamp(2rem, 5vw, 3rem); background: var(--deep); border-top: 1px solid var(--rule); font-size: 0.9em; }
.status-inner { display: flex; flex-wrap: wrap; padding-top: 0; padding-bottom: 0; }
.seg { padding: 0.55rem 1.5ch; color: var(--fog); border-right: 1px solid var(--rule); text-decoration: none; white-space: nowrap; }
.seg:first-child { padding-left: 1ch; }
.seg.on { background: var(--indigo); color: var(--night); font-weight: 700; border-right: 0; }
/* A status line stays one line: the note gives way first, cut short with an
   ellipsis, and on a phone it moves to a row of its own under the segments. */
.seg.grow { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
a.seg:hover { color: var(--paper); background: var(--night); }
a.seg:last-child { border-right: 0; }
@media (max-width: 52rem) {
  .seg.grow { order: 1; flex-basis: 100%; white-space: normal; border-right: 0; border-top: 1px solid var(--rule); padding-left: 1ch; }
}
@media (max-width: 30rem) {
  .seg { padding-left: 1ch; padding-right: 1ch; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor, .term-screen .caret { animation: none; }
}
