/* Vardaris: a page that behaves like the terminal it describes.
 *
 * Everything sits on a monospace character grid. Widths are in `ch`, frames are
 * the double-line boxes a BBS draws in CP437 with the title set into the top
 * edge, and the only "button" is a bracketed menu item that inverts when it is
 * selected, the way SGR 7 does. No radii, no drop shadows, no cards: a terminal
 * has none of those, and they are what makes a page read as a template.
 *
 * IBM Plex Mono carries the structure. IBM Plex Sans is kept for paragraphs of
 * prose only, because 60 characters of monospace running text is tiring.
 */

/* ── tokens ────────────────────────────────────────────────────────────────── */

:root {
  /* The app's terminal canvas and ink. */
  --bg:     #0e1014;
  --bg-2:   #13161c;
  --line:   #2a2f38;
  --line-2: #3a414d;
  --ink:    #e6e9ed;
  --ink-2:  #a8aeb8;
  --ink-3:  #6f7580;

  /* Status lamps, as the app draws them. */
  --live:    #32cd7a;
  --standby: #fbbf49;
  --lost:    #ef6060;

  /* The icon's gust: tip, body, tail. Links and the one rule under the header. */
  --w1: #6fd0ff;
  --w2: #2f8bf0;
  --w3: #b3b8ff;

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --text: clamp(0.94rem, 0.9rem + 0.2vw, 1.02rem);
  --small: 0.8rem;
  --page: 100ch;
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2.5rem);
  --row: 1.6rem;
}

/* ── base ──────────────────────────────────────────────────────────────────── */

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--text)/1.6 var(--mono);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--w1);
  text-decoration: underline 1px;
  text-decoration-color: color-mix(in srgb, var(--w1) 40%, transparent);
  text-underline-offset: 0.25em;
}
a:hover { color: var(--bg); background: var(--w1); text-decoration: none; }

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

p { margin: 0 0 var(--row); max-width: 68ch; }
.prose p, .prose li { font-family: var(--sans); color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 600; }

code, kbd {
  font-family: var(--mono); font-size: 0.92em;
  color: var(--ink); background: var(--bg-2);
  padding: 0 0.35ch; border: 1px solid var(--line);
}

.page { width: min(100% - var(--gutter) * 2, var(--page)); margin-inline: auto; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1ch; top: 1ch; z-index: 10; background: var(--ink); color: var(--bg); padding: 0.4em 1ch; }

/* ── top line ──────────────────────────────────────────────────────────────── */

.top > .page {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 2ch; padding-block: 1.1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 1ch;
  color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: 0.02em;
}
.brand:hover { background: none; color: var(--ink); }
.brand img { width: 22px; height: 22px; }
.brand span { color: var(--ink-3); font-weight: 400; }

.menu { display: flex; flex-wrap: wrap; gap: 0 2ch; }

/* A menu item: bracketed, inverted when selected or hovered. */
.item {
  color: var(--ink-2); text-decoration: none; white-space: nowrap;
}
.item::before { content: "["; color: var(--ink-3); }
.item::after  { content: "]"; color: var(--ink-3); }
.item:hover, .item[aria-current="page"] { color: var(--bg); background: var(--ink); }
.item:hover::before, .item:hover::after,
.item[aria-current="page"]::before, .item[aria-current="page"]::after { color: var(--bg); }
.item.primary { color: var(--ink); }

.gust {
  height: 2px;
  background: linear-gradient(to right, var(--w1), var(--w2) 55%, var(--w3));
}

/* ── the wire: hero terminal ───────────────────────────────────────────────── */

.wire {
  margin-block: clamp(2rem, 1rem + 4vw, 4.5rem) 0;
  border: 3px double var(--line-2);
  background: #0b0d11;
}
.wire-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 2ch;
  padding: 0.35rem 1.5ch;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3); font-size: var(--small);
}
.wire-bar .host { color: var(--ink-2); }
.wire-bar .mode { margin-left: auto; display: flex; gap: 1ch; }
.wire-bar button {
  font: inherit; color: var(--ink-3); background: none; border: 0; padding: 0 0.5ch;
  cursor: pointer;
}
.wire-bar button[aria-pressed="true"] { color: var(--bg); background: var(--ink-2); }
html:not(.js) .wire-bar .mode { display: none; }

.wire-screen {
  padding: clamp(1.2rem, 0.8rem + 2vw, 2.4rem) clamp(1.5ch, 1ch + 2vw, 4ch);
  min-height: 18rem;
}
.wire-screen .sys { color: var(--ink-3); margin: 0 0 1.2rem; font-size: var(--small); }
.wire h1 {
  margin: 0 0 1.4rem;
  font: 600 clamp(2.2rem, 1rem + 5.2vw, 4.9rem)/1.02 var(--mono);
  letter-spacing: -0.04em;
}
.wire h1 .c { visibility: hidden; }
.wire h1 .c.on { visibility: visible; }
.wire .lead { color: var(--ink-2); max-width: 62ch; margin-bottom: 0.4rem; }
.cursor {
  display: inline-block; width: 0.62em; height: 1.1em; vertical-align: -0.18em;
  background: var(--ink);
}
@media (prefers-reduced-motion: no-preference) {
  .cursor { animation: blink 1.1s steps(1) infinite; }
}
@keyframes blink { 50% { opacity: 0; } }

.hexdump {
  margin: 0; color: var(--ink-2); font: 400 clamp(0.62rem, 0.5rem + 0.6vw, 0.95rem)/1.7 var(--mono);
  overflow-x: auto; white-space: pre;
}
.hexdump .o { color: var(--ink-3); }
.hexdump .a { color: var(--live); }

.hero-foot {
  display: flex; flex-wrap: wrap; gap: 1rem 3ch; align-items: baseline;
  padding-block: 1.2rem 0; color: var(--ink-3); font-size: var(--small);
}
.hero-foot b { color: var(--ink-2); font-weight: 500; }

/* A status readout with its lamp, the way the app's status bar reads. */
.state { display: inline-flex; align-items: center; gap: 1ch; color: var(--ink-2); }
.lamp {
  display: inline-block; width: 0.55em; height: 0.55em; border-radius: 50%;
  background: #2b3038;
}
.lamp.standby { background: var(--standby); box-shadow: 0 0 8px var(--standby); }
.lamp.live    { background: var(--live);    box-shadow: 0 0 8px var(--live); }

/* ── sections ──────────────────────────────────────────────────────────────── */

.sect { padding-block: clamp(3rem, 2rem + 4vw, 6rem) 0; }

/* The section header is an offset into the page, as a hex dump would number it. */
.off {
  display: flex; gap: 2ch; align-items: baseline; margin: 0 0 1.2rem; max-width: none;
  color: var(--ink-3); font-size: var(--small); letter-spacing: 0.06em;
}
.off b { color: var(--w1); font-weight: 500; }
.off::after { content: ""; flex: 1; border-bottom: 1px dashed var(--line); transform: translateY(-0.3em); }

h2 {
  margin: 0 0 1.4rem; max-width: 30ch;
  font: 600 clamp(1.45rem, 1.1rem + 1.4vw, 2.2rem)/1.15 var(--mono);
  letter-spacing: -0.025em;
}
h3 { font: 600 1rem/1.35 var(--mono); margin: 0 0 0.4rem; }

/* ── boxes ─────────────────────────────────────────────────────────────────── */

/* A CP437 double-line box with its title set into the top edge. */
.box {
  position: relative; margin: 2.2rem 0 0;
  border: 3px double var(--line-2);
  padding: 1.6rem 2ch 1.2rem;
}
.box > .title {
  position: absolute; top: -0.85em; left: 2ch;
  padding: 0 1ch; background: var(--bg);
  color: var(--standby); font-weight: 600;
}
.box p:last-child, .box pre:last-child { margin-bottom: 0; }

.note { border-left: 1ch solid var(--line); padding-left: 2ch; color: var(--ink-2); }
.note p { font-family: var(--sans); }

/* ── capture log (features) ────────────────────────────────────────────────── */

/* Written the way a capture file with timestamps and direction labels reads. */
.log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.log li {
  display: grid; grid-template-columns: 14ch 4ch minmax(0, 1fr); gap: 0 1.5ch;
  padding: 1.3rem 0; border-bottom: 1px solid var(--line);
}
.log time { color: var(--ink-3); font-size: var(--small); padding-top: 0.15rem; }
.log .dir { font-size: var(--small); font-weight: 600; padding-top: 0.15rem; }
.log .rx { color: var(--live); }
.log .tx { color: var(--w1); }
.log p { font-family: var(--sans); color: var(--ink-2); margin: 0; }
.log li:hover { background: var(--bg-2); }
@media (max-width: 640px) {
  .log li { grid-template-columns: auto 1fr; }
  .log li > div { grid-column: 1 / -1; padding-top: 0.4rem; }
}

/* ── screenshots ───────────────────────────────────────────────────────────── */

/* A Mac window has rounded corners of its own, so it is never put inside a square
   frame: the window stands on the page, traced by a hairline that follows its alpha
   (a 1 px glow, not a shadow), with the caption as a status line under it. */
.shot { margin: 0; }
.shot img { width: 100%; filter: drop-shadow(0 0 0.5px rgb(255 255 255 / 0.35)); }
.shot figcaption {
  display: flex; flex-wrap: wrap; gap: 0 2ch; align-items: baseline;
  padding: 0.7rem 0 0; color: var(--ink-3); font-size: var(--small);
}
.shot figcaption b { color: var(--ink); background: var(--line); padding: 0 1ch; font-weight: 500; }

/* The hero is a crop of a window, so it has one real corner and three cut edges.
   The cut edges fade into the page instead of ending in a hard line. */
.hero-shot img {
  filter: none;
  -webkit-mask-image: linear-gradient(to right, #000 70%, transparent), linear-gradient(to bottom, #000 72%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, #000 70%, transparent), linear-gradient(to bottom, #000 72%, transparent);
  mask-composite: intersect;
}

.hero-shot { margin-top: clamp(2.5rem, 1.5rem + 3vw, 4rem); }

.gallery { display: grid; gap: 2rem 3ch; }
@media (min-width: 900px) {
  .gallery { grid-template-columns: 1fr 1fr; }
  .gallery > :first-child { grid-column: 1 / -1; }
}

/* ── session file ──────────────────────────────────────────────────────────── */

.split { display: grid; gap: 2rem 4ch; }
@media (min-width: 900px) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }

.json {
  margin: 0; overflow-x: auto; white-space: pre;
  font: 400 0.88rem/1.65 var(--mono); color: var(--ink-2);
}
.json .k { color: var(--w1); }
.json .n { color: var(--standby); }
.json .s { color: var(--live); }
.json .hl { background: var(--bg-2); color: var(--ink); display: inline-block; width: 100%; }

/* ── keys ──────────────────────────────────────────────────────────────────── */

/* Dot leaders, like the key list in a printed manual. */
.keys { list-style: none; margin: 0; padding: 0; max-width: 56ch; }
.keys li { display: flex; gap: 1ch; align-items: baseline; padding: 0.3rem 0; }
.keys li span:first-child { color: var(--ink-2); }
.keys li i { flex: 1; border-bottom: 1px dotted var(--line-2); transform: translateY(-0.3em); }
.keys kbd { background: none; border: 0; padding: 0; color: var(--ink); }

/* ── documents ─────────────────────────────────────────────────────────────── */

.doc { padding-block: clamp(2.5rem, 1.5rem + 3vw, 4.5rem) 0; }
.doc .page { max-width: 76ch; }
.doc h1 { font: 600 clamp(1.9rem, 1.3rem + 2vw, 2.8rem)/1.1 var(--mono); letter-spacing: -0.03em; margin: 0; }
.doc .updated { color: var(--ink-3); font-size: var(--small); margin: 0.6rem 0 2.4rem; }
.doc h2 {
  font-size: 1.05rem; max-width: none; margin: 3rem 0 1rem;
  display: flex; gap: 1ch;
}
.doc h2::before { content: "##"; color: var(--ink-3); font-weight: 400; }
.doc ul { padding-left: 2ch; }
.doc li { margin-bottom: 0.5rem; }
.doc li::marker { content: "- "; color: var(--ink-3); font-family: var(--mono); }
.lead { color: var(--ink-2); }
.doc .lead { font-family: var(--sans); font-size: 1.12rem; }

.qa { padding: 1.2rem 0; border-top: 1px dashed var(--line); }
.qa h3 { display: flex; gap: 1ch; }
.qa h3::before { content: "?"; color: var(--standby); }
.qa p:last-child { margin-bottom: 0; }

/* ── status bar (footer) ───────────────────────────────────────────────────── */

.status { margin-top: clamp(4rem, 3rem + 4vw, 7rem); border-top: 3px double var(--line-2); }
.status .page { padding-block: 1.2rem 1.6rem; }
.lamps {
  display: flex; flex-wrap: wrap; gap: 0.3rem 2.5ch; align-items: center;
  font-size: var(--small); color: var(--ink-3); margin-bottom: 1.2rem;
}
.lamps span { display: inline-flex; align-items: center; gap: 0.8ch; }
.lamps .lamp.on { background: var(--live); box-shadow: 0 0 6px var(--live); }
.lamps .lamp.flash { background: var(--w1); box-shadow: 0 0 8px var(--w1); }
.lamps .meter { margin-left: auto; }
.lamps .meter b { color: var(--ink-2); font-weight: 500; }
html:not(.js) .lamps .meter { display: none; }

.legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 3ch; }
.legal p { margin: 0 0 0.2rem; font-size: var(--small); color: var(--ink-3); font-family: var(--sans); }

.box .prose + p { margin-top: 1rem; }
