/* hacklog — a terminal readout that behaves like a document.
 *
 * The rules it plays by, so a later edit doesn't drift:
 *   - Monospace everywhere, because the posts are full of ids, ports and
 *     error strings and they should line up.
 *   - Amber phosphor on warm black. Not green: green reads as costume.
 *   - Exactly one moving part (the cursor), and it holds still for anyone who
 *     asked for reduced motion.
 *   - No webfonts, no scripts, no external requests of any kind. A page here
 *     is one HTML file and one stylesheet.
 *
 * Light mode is not an inverted terminal — it's fanfold paper off a line
 * printer, which is the same machine at a different hour.
 */

:root {
  --bg: #0e100e;
  --bg-2: #161a16;
  --fg: #ccc7b8;
  --dim: #8b8677;
  --accent: #f0a63c;
  --accent-dim: #a9711f;
  --rule: #2b302b;
  --measure: 74ch;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f0e6;
    --bg-2: #eae5d6;
    --fg: #26241d;
    --dim: #6a6459;
    --accent: #9a5309;
    --accent-dim: #b0873c;
    --rule: #d9d1be;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 2.5rem 1.25rem 4rem;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "DejaVu Sans Mono", "Liberation Mono", monospace;
  font-size: 15px;
  line-height: 1.7;
  font-variant-ligatures: none;
}

@media (min-width: 40rem) {
  body { font-size: 16px; padding: 3.5rem 2rem 5rem; }
}

main, .masthead, footer { max-width: var(--measure); margin: 0 auto; }

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

a { color: inherit; text-decoration: underline; text-underline-offset: 0.22em;
    text-decoration-color: var(--accent-dim); }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── masthead ─────────────────────────────────────────────────────────── */

.masthead {
  border-bottom: 1px dashed var(--rule);
  padding-bottom: 1.1rem;
  margin-bottom: 2.2rem;
}

.brand {
  display: inline-block;
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-decoration: none;
}

.cursor {
  font-weight: 400;
  margin-left: 0.15em;
  animation: blink 1.3s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

.tagline { margin: 0.35rem 0 0; color: var(--dim); font-size: 0.85rem; }

/* ── the listing ──────────────────────────────────────────────────────── */

.listing-head {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 1.2rem;
}

.listing { list-style: none; margin: 0; padding: 0; }

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0 1.5rem;
  padding: 0.45rem 0.5rem;
  border-left: 2px solid transparent;
}

.row:hover { background: var(--bg-2); border-left-color: var(--accent); }

.row-link {
  display: grid;
  grid-template-columns: 2ch 11ch 1fr;
  align-items: baseline;
  text-decoration: none;
}

/* The selection marker a TUI would draw. It occupies its column always, so
   nothing shifts sideways when the pointer lands on a row. */
.row-link::before { content: "\25B8"; color: transparent; }
.row:hover .row-link::before { color: var(--accent); }

.row-link time { color: var(--dim); font-size: 0.85rem; }
.row-title { text-decoration: underline; text-decoration-color: var(--rule);
             text-underline-offset: 0.22em; }
.row:hover .row-title { color: var(--accent); text-decoration-color: var(--accent-dim); }

.row-tags { color: var(--dim); font-size: 0.8rem; }

@media (max-width: 46rem) {
  .row { grid-template-columns: 1fr; gap: 0; }
  .row-link { grid-template-columns: 2ch 1fr; }
  .row-link time { grid-column: 2; font-size: 0.78rem; }
  .row-title { grid-column: 2; }
  .row-tags { padding-left: 2ch; }
}

.tag { color: var(--dim); text-decoration-color: var(--rule); }
.tag::before { content: "#"; opacity: 0.55; }

/* ── a post ───────────────────────────────────────────────────────────── */

article h1 {
  font-size: 1.35rem;
  line-height: 1.35;
  margin: 0 0 1.1rem;
  color: var(--accent);
  font-weight: 700;
}

/* The status block a readout would print before the body. Labels are a fixed
   column so date/by/tags line up down the left edge. */
.meta {
  display: grid;
  grid-template-columns: 6ch 1fr;
  gap: 0.1rem 1ch;
  margin: 0 0 2rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg-2);
  border-left: 2px solid var(--accent-dim);
  font-size: 0.82rem;
}

.meta dt { color: var(--dim); text-transform: uppercase; letter-spacing: 0.12em; }
.meta dd { margin: 0; }

.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.35rem; }

.prose h2 {
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 2.4rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed var(--rule);
}

.prose h3 { font-size: 1rem; margin: 1.8rem 0 0.7rem; color: var(--fg); }

.prose strong { color: var(--accent); font-weight: 700; }
.prose em { color: var(--fg); font-style: italic; }

.prose code {
  background: var(--bg-2);
  padding: 0.08em 0.38em;
  border-radius: 2px;
  font-size: 0.92em;
}

.prose pre {
  background: var(--bg-2);
  border-left: 2px solid var(--accent-dim);
  padding: 0.9rem 1rem;
  margin: 0 0 1.35rem;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.55;
}

.prose pre code { background: none; padding: 0; font-size: inherit; }

.prose blockquote {
  margin: 0 0 1.35rem;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--dim);
}

.prose hr { border: 0; border-top: 1px dashed var(--rule); margin: 2.2rem 0; }

.prose table { border-collapse: collapse; width: 100%; margin: 0 0 1.35rem;
               font-size: 0.88rem; }
.prose th, .prose td { border-bottom: 1px solid var(--rule); padding: 0.4rem 0.6rem;
                       text-align: left; }
.prose th { color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em;
            font-size: 0.78rem; font-weight: 400; }

/* ── footer ───────────────────────────────────────────────────────────── */

footer {
  margin-top: 3.5rem;
  padding-top: 1.1rem;
  border-top: 1px dashed var(--rule);
  color: var(--dim);
  font-size: 0.8rem;
}

footer p { margin: 0; }
