/* ═══════════════════════════════════════════════════════════
   openly(1)
   The page is a man page. One typeface, one column, 80-ish
   characters wide. Colour is semantic, the way a terminal uses
   it: green = command, yellow = warning, red = defect.
   No gradients, no shadows, no rounded corners, no reveals.
   ═══════════════════════════════════════════════════════════ */

/* ── Fira Code, self-hosted ──────────────────────────────────
   SIL Open Font License 1.1, see assets/fonts/OFL.txt.
   Two subsets only, matching what this page actually renders:
     latin     ASCII plus U+00A0
     symbols2  U+2500-259F, the block glyphs the ASCII banner is built from
   Self-hosted rather than loaded from Google Fonts so there is no
   render-blocking third-party request and no third-party origin in the CSP.
   ─────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Fira Code';
  font-style: normal;
  font-weight: 300 700;   /* variable file: one woff2 covers every weight used */
  font-display: swap;
  src: url('assets/fonts/firacode-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                 U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
                 U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
                 U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fira Code';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('assets/fonts/firacode-symbols2.woff2') format('woff2');
  unicode-range: U+2000-2001, U+2004-2008, U+200A, U+23B8-23BD, U+2500-259F;
}

:root {
  --bg:      #08090a;
  --fg:      #b6b3a8;   /* terminal foreground: warm grey, not white */
  --bright:  #efebe1;
  --dim:     #828077;   /* 5.03:1 on --bg; #77756c was 4.31 and failed AA */
  --line:    #1e2122;
  --green:   #8ec07c;   /* commands, links */
  --yellow:  #d4a95e;   /* warnings */
  --red:     #d97f6a;   /* defects */

  --mono: 'Fira Code', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --col: 84ch;
  --indent: 5ch;
}

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

html {
  font-size: clamp(13px, 11px + 0.55vw, 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 2.5rem 1rem 4rem;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

.page { max-width: var(--col); margin: 0 auto; }

/* <pre> carries a UA default of `font-family: monospace`, which beats
   inheritance. Without this the ASCII banner and terminal blocks silently fall
   back to the system mono — a different advance width, so the art misaligns. */
pre { font-family: var(--mono); }

b { color: var(--bright); font-weight: 700; }
i { color: var(--fg); font-style: italic; }

::selection { background: var(--fg); color: var(--bg); }   /* inverse video */

a {
  color: var(--green);
  text-decoration: none;
  border-bottom: 1px solid rgba(142, 192, 124, 0.35);
}
a:hover { background: var(--green); color: var(--bg); border-bottom-color: var(--green); }

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ── top-right contact link ──────────────────────────────── */
.topbar { display: flex; justify-content: flex-end; margin-bottom: 0.4rem; }
.topbar a { border-bottom-color: transparent; letter-spacing: 0.04em; }
.topbar a:hover { background: var(--green); color: var(--bg); }

/* ── contact form ────────────────────────────────────────── */
/* Written as a terminal session, matching .term: same 2px left rule, same
   padding. The rule goes green on focus-within, so the block reads as an
   active session while you are typing in it. */
.cform {
  border-left: 2px solid var(--line);
  padding: 0.4rem 0 0.5rem 1.5ch;
  margin: 0 0 1.1rem;
  max-width: 72ch;
  transition: border-left-color 120ms linear;
}
.cform:focus-within { border-left-color: var(--green); }

/* the live command line */
.cform-cmd {
  margin: 0 0 0.7rem;
  color: var(--fg);
  overflow-wrap: anywhere;
}
.cform-cmd .prompt { color: var(--green); user-select: none; }
.cform-cmd .cmd    { color: var(--bright); font-weight: 700; }
.cform-cmd .flag   { color: var(--dim); }
.cform-subj        { color: var(--bright); }

/* flag + field rows */
.cform-grid {
  display: grid;
  grid-template-columns: 11ch 1fr;
  column-gap: 1.5ch;
  row-gap: 0.4rem;
  align-items: baseline;
  margin: 0 0 0.9rem;
}
.cform-grid label { cursor: pointer; }
.cform-grid .opt  { color: var(--green); }

.cform input {
  font: inherit;
  color: var(--bright);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 0 0.15rem;
  width: 100%;
  min-width: 0;            /* lets the field shrink inside the grid track */
}
.cform input:focus { outline: none; border-bottom-color: var(--green); }
.cform input::placeholder,
.cform textarea::placeholder { color: var(--dim); opacity: 1; }

/* heredoc body */
.heredoc { color: var(--dim); display: block; cursor: pointer; }
.cform textarea {
  font: inherit;
  line-height: 1.5;
  color: var(--bright);
  background: rgba(239, 235, 225, 0.025);   /* just enough to show the target */
  border: 0;
  border-left: 1px solid var(--line);
  padding: 0.3rem 0.8ch;
  margin: 0.25rem 0;
  width: 100%;
  min-width: 0;
  display: block;
  resize: vertical;
}
.cform textarea:focus { outline: none; border-left-color: var(--green); }

.cform-eof {
  display: flex;
  justify-content: space-between;
  gap: 1.5ch;
  margin: 0;
}
.cform-eof .heredoc { display: inline; }
.cform-count { color: var(--dim); }

.cform-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5ch;
  align-items: baseline;
  margin-top: 0.9rem;
}
.cbtn {
  border: 1px solid var(--green);
  background: none;
  color: var(--green);
  font: inherit;
  padding: 0 1ch;
  cursor: pointer;
}
.cbtn:hover { background: var(--green); color: var(--bg); }

/* Feedback borrows the exit-code framing from the GOAL section: 0 good, 1 not. */
.cform-status      { color: var(--fg); }
.cform-status .code { font-weight: 700; }
.cform-status.ok  .code { color: var(--green); }
.cform-status.err .code { color: var(--red); }

/* ── man page header / footer rules ──────────────────────── */
.manline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--dim);
  font-weight: 500;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
  margin-bottom: 1.75rem;
}
.manline.foot {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  padding: 0.5rem 0 0;
  margin: 3rem 0 1.5rem;
}
.manline .mid { color: var(--dim); }

/* Visible to crawlers and screen readers, not to the eye. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── ASCII key banner ────────────────────────────────────── */
/* The h1 exists for document structure; it must not impose its own type. */
.banner-title { margin: 0; font-size: inherit; font-weight: inherit; }

.banner {
  /* 76 columns; the min() keeps all of them on screen down to ~320px. */
  font-size: min(1rem, 1.9vw);
  /* line-height 1 makes the block rows meet with no seam, and fixes the cell
     aspect at 0.6 (advance) : 1 (line) — the ratio the art was resampled to. */
  line-height: 1;
  color: var(--bright);
  margin: 0 0 2.5rem;
  overflow: hidden;
  white-space: pre;
}

/* ── sections ────────────────────────────────────────────── */
section { margin: 0 0 2.4rem; }

section h2 {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--bright);
}

.body { padding-left: var(--indent); }
.body > p { margin: 0 0 0.95rem; max-width: 72ch; }
.body > p:last-child { margin-bottom: 0; }

/* A statement line, set apart the way a man page sets an example. */
.lede {
  border-left: 2px solid var(--green);
  padding-left: 1.1ch;
  margin-left: -1.1ch;
  color: var(--bright);
}

.note { color: var(--dim); }
.fine { color: var(--dim); font-size: 0.94em; }

.warn {
  border-left: 2px solid var(--yellow);
  padding-left: 1.1ch;
  margin-left: -1.1ch;
  color: var(--yellow);
}
.warn a { color: var(--yellow); border-bottom-color: rgba(212, 169, 94, 0.4); }
.warn a:hover { background: var(--yellow); color: var(--bg); }

.good { color: var(--green); }
.bad  { color: var(--red); }
.ok   { color: var(--green); }

/* ── synopsis + status tags ──────────────────────────────── */
.synopsis { color: var(--bright); }
.synopsis .opt { color: var(--green); }

.status { display: flex; flex-wrap: wrap; gap: 0.5ch; }
.tag {
  border: 1px solid var(--line);
  padding: 0 0.8ch;
  color: var(--dim);
  font-size: 0.88em;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.tag-warn { color: var(--yellow); border-color: rgba(212, 169, 94, 0.45); }
.tag-good { color: var(--green); border-color: rgba(142, 192, 124, 0.45); }

/* ── definition lists (stats, steps, files, bugs, exit) ──── */
dl { display: grid; margin: 0 0 1.1rem; column-gap: 1.5ch; }
/* min-width:0 lets the 1fr track shrink below its content's min-content width,
   which is what stops a long unbreakable citation widening the whole page. */
dl dt, dl dd { min-width: 0; overflow-wrap: break-word; }
dl dt { font-weight: 700; color: var(--bright); }
dl dd { margin: 0 0 0.85rem; }
dl dd:last-child { margin-bottom: 0; }

.stats { grid-template-columns: 6ch 1fr; }
.stats dt { color: var(--green); }
.stats dd a { color: var(--dim); border-bottom-color: transparent; }
.stats dd a:hover { background: none; color: var(--green); }

.steps { grid-template-columns: 4ch 1fr; }
.exit  { grid-template-columns: 4ch 1fr; }
.exit .cur { color: var(--yellow); }
.bugs  { grid-template-columns: 5ch 1fr; }
.bugs dt { color: var(--red); }

/* Questions stack: the question is the label, the answer is indented under it. */
.qa { display: block; }
.qa dt {
  color: var(--bright);
  margin-bottom: 0.3rem;
}
.qa dt::before { content: "Q. "; color: var(--green); }
.qa dd {
  margin: 0 0 1.3rem 4ch;
  max-width: 68ch;
}
.qa dd:last-child { margin-bottom: 0; }
.addr-inline { color: var(--bright); word-break: break-all; }

.files { grid-template-columns: 13ch 1fr; column-gap: 1ch; }
.files dt { color: var(--dim); font-weight: 400; }
.files dd { margin-bottom: 0.35rem; color: var(--bright); }
.files .addr { display: flex; flex-wrap: wrap; gap: 0 1.5ch; align-items: baseline; }
.files .addr span { word-break: break-all; }

.copy {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--green);
  cursor: pointer;
}
.copy:hover { background: var(--green); color: var(--bg); }
.copy.copied { color: var(--bright); }

/* ── terminal output blocks ──────────────────────────────── */
.term {
  border-left: 2px solid var(--line);
  padding: 0.35rem 0 0.35rem 1.5ch;
  margin: 0 0 1.1rem;
  overflow-x: auto;
  line-height: 1.5;
  color: var(--bright);
  white-space: pre;
}
.term .prompt { color: var(--green); user-select: none; }
.term .cmd    { color: var(--bright); font-weight: 700; }
.term .flag   { color: var(--dim); }
.term .out    { color: var(--fg); }

.link-strong { font-weight: 700; }

/* ── roadmap checklist ───────────────────────────────────── */
.todo { list-style: none; margin: 0; padding: 0; }
.todo li {
  padding-left: 5ch;
  text-indent: -5ch;
  margin-bottom: 0.5rem;
}
.todo .box { color: var(--dim); }
.todo .done { color: var(--dim); }
.todo .done b { color: var(--dim); }
.todo .done .box { color: var(--green); }
.todo .next .box { color: var(--yellow); }
.todo .next .note { color: var(--yellow); }

/* ── see also / colophon ─────────────────────────────────── */
.seealso a { color: var(--fg); border-bottom-color: var(--line); }
.seealso a:hover { background: var(--fg); color: var(--bg); }
.colophon { color: var(--dim); }

/* ── 404 ─────────────────────────────────────────────────── */
.err-title {
  margin: 0.4rem 0 0;
  font-size: clamp(3rem, 14vw, 6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  color: var(--red);
}

/* ── caret ───────────────────────────────────────────────── */
.prompt-end { margin: 0; color: var(--green); }
.caret, .cursor-here {
  color: var(--green);
  animation: blink 1.06s step-end infinite;
}
.cursor-here { color: var(--yellow); }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* ── narrow screens ──────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --indent: 2ch; }
  .manline .mid { display: none; }
  .files { grid-template-columns: 1fr; }
  .files dt { margin-top: 0.5rem; }
  .files dt:first-child { margin-top: 0; }
  .cform-grid { grid-template-columns: 1fr; row-gap: 0.15rem; }
  .cform-grid label { margin-top: 0.55rem; }
  .cform-grid label:first-child { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .caret, .cursor-here { animation: none; }
  .cform { transition: none; }
}

@media print {
  body { background: #fff; color: #000; }
  a { color: #000; }
}
