/* ANSI Paint: site styles.
   Static CSS, no build step. Dark theme only.
   The page column is one 80-column screen wide: 80 cells of 12px. */

@font-face {
  font-family: "Web437 IBM VGA 8x16";
  src: url("../fonts/Web437_IBM_VGA_8x16.woff") format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

:root {
  --bg: #141418;
  --panel: #1C1C22;
  --border: #2F2F38;
  --text: #ECECF1;
  --muted: #A3A3B2;
  --accent: #55FFFF;
  --on-accent: #0B0B0F;

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --vga: "Web437 IBM VGA 8x16", "Cascadia Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;

  --screen: 962px;            /* 80 columns at 12px, plus the frame */
  --gutter: 24px;
  --radius: 8px;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

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

img, svg { max-width: 100%; }

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: #FFFFFF; }

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

.wrap {
  width: 100%;
  max-width: calc(var(--screen) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute; left: 8px; top: -60px; z-index: 10;
  background: var(--accent); color: var(--on-accent);
  padding: 8px 14px; border-radius: 6px; font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; color: var(--on-accent); }

/* ---------------------------------------------------------------- palette */
/* The 16 VGA colors. f is ink, b is paper. */
.f0 { color: #000000; } .f1 { color: #0000AA; } .f2 { color: #00AA00; } .f3 { color: #00AAAA; }
.f4 { color: #AA0000; } .f5 { color: #AA00AA; } .f6 { color: #AA5500; } .f7 { color: #AAAAAA; }
.f8 { color: #555555; } .f9 { color: #5555FF; } .f10 { color: #55FF55; } .f11 { color: #55FFFF; }
.f12 { color: #FF5555; } .f13 { color: #FF55FF; } .f14 { color: #FFFF55; } .f15 { color: #FFFFFF; }
.b0 { background: #000000; } .b1 { background: #0000AA; } .b2 { background: #00AA00; } .b3 { background: #00AAAA; }
.b4 { background: #AA0000; } .b5 { background: #AA00AA; } .b6 { background: #AA5500; } .b7 { background: #AAAAAA; }
.b8 { background: #555555; } .b9 { background: #5555FF; } .b10 { background: #55FF55; } .b11 { background: #55FFFF; }
.b12 { background: #FF5555; } .b13 { background: #FF55FF; } .b14 { background: #FFFF55; } .b15 { background: #FFFFFF; }

/* The strip across the top of every page: the palette itself, 0 to 15. */
.palette-strip { display: flex; height: 4px; }
.palette-strip span { flex: 1; }

/* ---------------------------------------------------------------- header */
.site-header { border-bottom: 1px solid var(--border); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px 28px; padding-block: 14px;
}
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--vga); font-size: 24px; line-height: 1;
  color: #FFFFFF; text-decoration: none; white-space: nowrap;
  margin-right: auto;
}
.brand:hover { color: var(--accent); }
.brand-mark { color: var(--accent); }

.site-nav ul { display: flex; flex-wrap: wrap; gap: 4px 22px; list-style: none; margin: 0; padding: 0; }
.site-nav a {
  display: inline-block; padding: 6px 0;
  color: var(--text); text-decoration: none; font-size: 0.975rem;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--accent); color: #FFFFFF; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-block; padding: 12px 20px;
  background: var(--accent); color: var(--on-accent);
  border: 1px solid var(--accent); border-radius: var(--radius);
  font-weight: 600; line-height: 1.25; text-decoration: none; text-align: center;
}
.btn:hover { background: #FFFFFF; border-color: #FFFFFF; color: var(--on-accent); }
.btn-small { padding: 8px 14px; font-size: 0.95rem; }
.cta-note { margin: 14px 0 0; color: var(--muted); font-size: 0.975rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; margin-top: 24px; }

/* ---------------------------------------------------------------- type */
h1, h2, h3 { font-weight: 600; line-height: 1.15; margin: 0; text-wrap: balance; }
h2 { margin-bottom: 18px; }
h1 { font-size: clamp(2.25rem, 5.4vw + 0.6rem, 4rem); letter-spacing: -0.025em; line-height: 1.02; }
.page-head h1 { font-size: clamp(2.1rem, 3vw + 1.2rem, 3rem); }
h2 { font-size: clamp(1.5rem, 1.2vw + 1.2rem, 1.9rem); letter-spacing: -0.015em; }
h3 { font-size: 1.125rem; line-height: 1.3; }
p { margin: 0 0 1em; }
.lede { font-size: 1.1875rem; line-height: 1.55; color: var(--text); }
.muted { color: var(--muted); }
.measure { max-width: 42rem; }

code, kbd, .mono { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; }
kbd {
  display: inline-block; min-width: 1.9em; padding: 1px 7px;
  background: var(--panel); color: #FFFFFF;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px;
  font-size: 0.86em; line-height: 1.5; text-align: center; white-space: nowrap;
}

/* ---------------------------------------------------------------- sections */
main { display: block; }
.section { padding-block: 56px; }
.section + .section { border-top: 1px solid var(--border); }
.section-first { border-top: 0; padding-top: 36px; }
h3 + p { margin-top: 8px; }
.tight { margin-bottom: 0; }
.page-head { padding-block: 56px 8px; }
.page-head h1 + p { margin-top: 18px; }

/* ---------------------------------------------------------------- hero */
.hero { padding-block: 56px 28px; }
.hero-head { display: grid; gap: 24px; margin-bottom: 40px; }
.hero-head .lede { margin: 0; }

/* ---------------------------------------------------------------- rendered samples */
.screen {
  margin: 0; background: #000000;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.screen-scroll { overflow-x: auto; background: #000000; }
.screen figcaption {
  background: var(--panel); border-top: 1px solid var(--border);
  padding: 10px 14px; color: var(--muted); font-size: 0.9rem; line-height: 1.45;
}
pre.ansi {
  margin: 0 auto; padding: 0; width: max-content;
  font-family: var(--vga); font-size: 16px; line-height: 1;
  color: #AAAAAA; background: #000000;
  white-space: pre; font-variant-ligatures: none; letter-spacing: 0;
  -webkit-font-smoothing: none;
}
.screen-pad pre.ansi { margin: 16px; }
.screen-inline { display: inline-block; max-width: 100%; vertical-align: top; }
/* A grid cell holding an inline sample must be allowed to shrink below the
   sample's natural width, or the sample widens the page on a phone; the
   sample then scrolls inside .screen-scroll. */
.split > * { min-width: 0; }
/* Two pictures side by side (the photo and its .ans): the same width, so
   the same height too, since both are about three by four. */
.compare { display: grid; gap: 16px; margin-top: 28px; align-items: start; }
.compare img { display: block; width: 100%; height: auto; }
/* The demo movie, on the home page and in the manual: its GIF, 640 by
   400, at one pixel a dot. Where a display scales it the dots stay
   square-edged, as on a terminal. On the home page the frame is as wide
   as the picture (640 and the border), so the modem's first lines sit
   in the screen's corner; the manual's frame spans its column. */
.movie-demo { margin-top: 28px; max-width: 642px; }
.manual .movie-demo { max-width: none; }
.movie-demo img { display: block; margin: 0 auto; height: auto; image-rendering: pixelated; }
/* A narrow window on a display of one device pixel a dot shows the
   picture smaller than it is, and square-edged shrinking drops whole
   rows of its letters. There it is smoothed. A phone has pixels to spare. */
@media (max-width: 689px) and (max-resolution: 1.5dppx) {
  .movie-demo img { image-rendering: auto; }
}

/* ---------------------------------------------------------------- the manual */
.manual .screen { margin: 20px 0 24px; }
.manual .screen img { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.manual .shot-wide img { width: 100%; }
.manual .shot-side { display: inline-block; max-width: 100%; vertical-align: top; }
.manual .shot-side + .shot-side { margin-top: 0; }
.manual h3 { margin-top: 36px; }
.manual h2 + h3, .manual h2 + p + h3 { margin-top: 24px; }
.manual .spec kbd { margin-left: 6px; }
.manual .trio { display: grid; gap: 16px; margin-top: 28px; }
.manual .trio .screen { margin: 0; }
.manual .trio img { width: 100%; }
.manual .limits td:first-child { font-weight: 600; white-space: nowrap; padding-right: 22px; }
/* A list of controls keeps its distance from the heading above it and the paragraph below. */
.manual h3 + .spec { margin-top: 10px; }
.changelog h3 { margin-top: 36px; }
.changelog h3 + .spec { margin-top: 10px; }
.changelog h2 + .muted { margin-top: -8px; margin-bottom: 18px; }
.manual h3 + .split { margin-top: 8px; }
.manual .spec + p { margin-top: 18px; }
.manual .page-head .muted { margin-top: 22px; }

.blink { animation: vga-blink 1.1s steps(1, end) infinite; }
@keyframes vga-blink { 50% { color: transparent; } }

/* ---------------------------------------------------------------- cards */
.cards { display: grid; gap: 16px; list-style: none; margin: 0; padding: 0; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 20px 22px; display: flex; flex-direction: column; gap: 10px;
}
.card pre.ansi { margin: 0 0 6px; background: transparent; }
.card p { margin: 0; color: var(--muted); font-size: 0.975rem; line-height: 1.55; }

/* ---------------------------------------------------------------- lists and tables */
.spec { display: grid; gap: 0; margin: 0; }
.spec > div { display: grid; gap: 4px 24px; padding: 14px 0; border-top: 1px solid var(--border); }
.spec > div:last-child { border-bottom: 1px solid var(--border); }
.spec dt { font-weight: 600; }
.spec dd { margin: 0; color: var(--muted); }

.table-scroll { overflow-x: auto; }
.table-scroll + p { margin-top: 18px; }
table { width: 100%; border-collapse: collapse; font-size: 1rem; }
caption { text-align: left; font-weight: 600; font-size: 1.125rem; padding-bottom: 10px; }
th, td { text-align: left; vertical-align: top; padding: 11px 16px 11px 0; border-top: 1px solid var(--border); }
thead th { border-top: 0; color: var(--muted); font-weight: 500; font-size: 0.9rem; padding-block: 6px; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 1px solid var(--border); }
tbody th { font-weight: 600; white-space: nowrap; }
td.keys, th.keys { white-space: nowrap; width: 1%; padding-right: 22px; }
td.note { color: var(--muted); }
.keymap td.keys, .keymap th.keys { width: 11.5rem; }
.yes { color: #55FF55; } .no { color: var(--muted); }

.plain-list { margin: 0; padding-left: 1.2em; }
.plain-list li { margin-bottom: 0.5em; }
.plain-list li::marker { color: var(--accent); }

.boards { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 20px 0; padding: 0; }
.boards li {
  font-family: var(--vga); font-size: 16px; line-height: 1;
  color: #FFFFFF; background: #000000;
  border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px;
}

.jump { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; margin: 22px 0 0; padding: 0; font-size: 0.975rem; }

.split { display: grid; gap: 28px; align-items: start; }
.stack > * + * { margin-top: 28px; }
.sub { margin-top: 40px; }
.sub > h3 { margin-bottom: 12px; }

.callout {
  background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 16px 18px; margin: 0;
}
.callout p:last-child { margin-bottom: 0; }

.closing { text-align: left; }

/* ---------------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--border); padding-block: 40px 56px; color: var(--muted); font-size: 0.95rem; }
.footer-grid { display: grid; gap: 28px; }
.site-footer h2 { font-size: 0.95rem; letter-spacing: 0; color: var(--text); margin-bottom: 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--text); }
.site-footer a:hover { color: var(--accent); }
.site-footer p { margin-bottom: 0.7em; }

/* ---------------------------------------------------------------- wider screens */
@media (min-width: 640px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .compare { grid-template-columns: 1fr 1fr; gap: 24px; }
  .manual .trio { grid-template-columns: repeat(3, 1fr); }
  .spec > div { grid-template-columns: 13rem 1fr; }
  .footer-grid { grid-template-columns: 1.3fr 1fr 1.5fr; }
}
@media (min-width: 880px) {
  .section { padding-block: 72px; }
  .hero-head { grid-template-columns: 7fr 5fr; align-items: end; gap: 48px; }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .split { grid-template-columns: 1fr 1fr; gap: 48px; }
  .manual .tools-split, .manual .aside-split { grid-template-columns: 1fr auto; gap: 40px; }
}
/* From here the column is a full 80 cells of 12px, so the 80-column pieces run at 24px. */
@media (min-width: 1010px) {
  .screen-wide pre.ansi { font-size: 24px; }
}

@media (max-width: 760px) {
  .site-header .wrap { gap: 6px 16px; }
  .site-nav { order: 3; width: 100%; }
}

@media (max-width: 480px) {
  :root { --gutter: 16px; }
  .brand { font-size: 16px; gap: 8px; }
  .site-nav ul { gap: 2px 18px; }
  .section { padding-block: 44px; }
  .hero { padding-block: 36px 12px; }
  .page-head { padding-block: 36px 4px; }
  th, td { padding-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .blink { animation: none; }
}

.site-footer .version { color: var(--muted); font-size: 0.9rem; }
