/* longthread.dev
   Ink and paper at night: warm text on a cool dark ground, one brass accent for the thread.
   The thread is the only place colour is spent. Everything else stays quiet. */

:root {
  --ink: #0e1426;
  --ink-rise: #151d33;
  --ink-sink: #0a0f1d;
  --rule: #26304c;
  --paper: #e9e6de;
  --muted: #8e99b8;
  --thread: #c8964a;
  --thread-lit: #e8b96a;

  --serif: "Newsreader", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --measure: 34rem;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --rail-w: clamp(1.5rem, 4vw, 3.25rem);
}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
}

/* A faint vertical warmth behind the fold, as if a lamp is on. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    120% 70% at 12% -10%,
    rgba(200, 150, 74, 0.09),
    transparent 60%
  );
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

a {
  color: var(--paper);
  text-decoration-color: var(--rule);
  text-underline-offset: 0.25em;
  transition:
    color 0.15s ease,
    text-decoration-color 0.15s ease;
}
a:hover {
  color: var(--thread-lit);
  text-decoration-color: var(--thread);
}
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--thread-lit);
  outline-offset: 3px;
  border-radius: 2px;
}

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

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.75rem 0 0;
}

.wordmark {
  font-family: var(--mono);
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--paper);
}
.wordmark b {
  font-weight: 600;
}
.wordmark span {
  color: var(--thread);
}

.masthead nav {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
  display: flex;
  gap: 1.25rem;
}
.masthead nav a {
  color: var(--muted);
  text-decoration: none;
}
.masthead nav a:hover {
  color: var(--thread-lit);
}

/* ── hero ─────────────────────────────────────────────────────────────── */

.hero {
  padding: clamp(3.5rem, 11vh, 7rem) 0 clamp(2.5rem, 7vh, 4.5rem);
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.75rem, 1.6rem + 5.4vw, 5.25rem);
  line-height: 1.02;
  letter-spacing: -0.022em;
  margin: 0 0 1.25rem;
  max-width: 15ch;
}
.hero h1 em {
  font-style: italic;
  color: var(--thread);
}

.hero .lede {
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  color: var(--muted);
  max-width: var(--measure);
  margin: 0 0 2.5rem;
  text-wrap: pretty;
}

/* ── the thread: the one thing this page is remembered by ─────────────── */

.thread {
  margin: 0 0 2.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.thread::-webkit-scrollbar {
  display: none;
}
.thread svg {
  display: block;
  min-width: 30rem;
  width: 100%;
  height: auto;
}

.thread .run {
  stroke: var(--thread);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
}
.thread .gap {
  stroke: var(--thread);
  stroke-width: 2;
  stroke-dasharray: 1 7;
  stroke-linecap: round;
  fill: none;
  opacity: 0.5;
}
.thread .node {
  fill: var(--ink);
  stroke: var(--thread);
  stroke-width: 2;
}
.thread .tick {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--muted);
  letter-spacing: 0.04em;
}
.thread .under {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--thread);
  letter-spacing: 0.04em;
}

@media (prefers-reduced-motion: no-preference) {
  .thread .draw {
    stroke-dasharray: var(--len);
    stroke-dashoffset: var(--len);
    animation: draw 1.5s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  }
  .thread .gap.draw {
    stroke-dasharray: 1 7;
    stroke-dashoffset: 0;
    opacity: 0;
    animation: fade 0.5s ease forwards;
  }
  .thread .node,
  .thread .tick,
  .thread .under {
    opacity: 0;
    animation: fade 0.5s ease forwards;
  }
  @keyframes draw {
    to {
      stroke-dashoffset: 0;
    }
  }
  @keyframes fade {
    to {
      opacity: 1;
    }
  }
  .thread .gap.draw {
    animation-name: fadeHalf;
  }
  @keyframes fadeHalf {
    to {
      opacity: 0.5;
    }
  }
}

/* ── install command ──────────────────────────────────────────────────── */

.install {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
}

.cmd {
  font-family: var(--mono);
  font-size: 0.875rem;
  background: var(--ink-sink);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.7rem 0.95rem;
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  overflow-x: auto;
  white-space: nowrap;
  max-width: 100%;
}
.cmd::before {
  content: "/";
  color: var(--thread);
  flex: none;
}
.cmd.plain::before {
  content: none;
}

/* ── sections hang off a quiet rail that breaks at every boundary ─────── */

/* The rail repeats the hero's argument at page scale: solid while a section runs, dashed across
   the break, never actually severed. The breaks are explicit `.brk` elements, not leftover margin —
   an accidental gap reads as sloppy spacing, and this one has to read as the point. */

.band {
  position: relative;
  padding: clamp(2rem, 5vh, 3rem) 0;
  padding-left: var(--rail-w);
}
.band::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(200, 150, 74, 0.32);
}
.band::after {
  content: "";
  position: absolute;
  left: -3.5px;
  top: clamp(2rem, 5vh, 3rem);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
  border: 1px solid var(--thread);
}

.brk {
  position: relative;
  height: 3.25rem;
}
.brk::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background-image: linear-gradient(var(--thread) 42%, transparent 0);
  background-size: 1px 7px;
  opacity: 0.22;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}

.band h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
  line-height: 1.14;
  letter-spacing: -0.015em;
  margin: 0 0 1rem;
  max-width: 20ch;
}

.band > p {
  max-width: var(--measure);
  color: var(--muted);
  text-wrap: pretty;
}
.band > p strong {
  color: var(--paper);
  font-weight: 500;
}

/* ── plugin list ──────────────────────────────────────────────────────── */

.plugins {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: grid;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
}

.plugins li {
  background: var(--ink);
  transition: background 0.15s ease;
}
.plugins li:hover {
  background: var(--ink-rise);
}

.plugins a {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 0.45rem 0.85rem;
  align-items: baseline;
  padding: 1.45rem 1.6rem;
  text-decoration: none;
}

.plugins .name {
  font-family: var(--mono);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--paper);
  transition: color 0.15s ease;
}
.plugins .ver {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.plugins .go {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--muted);
  transition:
    transform 0.18s ease,
    color 0.15s ease;
}
.plugins .blurb {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.9375rem;
  max-width: 54ch;
  text-wrap: pretty;
}
.plugins li:hover .name {
  color: var(--thread-lit);
}
.plugins li:hover .go {
  color: var(--thread-lit);
  transform: translateX(3px);
}

/* ── figures lifted from the record ───────────────────────────────────── */

.figures {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1.75rem 2rem;
  max-width: 46rem;
}
.figures dt,
.figures .n {
  font-family: var(--serif);
  font-size: clamp(2rem, 1.6rem + 1.6vw, 2.75rem);
  line-height: 1;
  color: var(--paper);
  letter-spacing: -0.02em;
}
.figures .n span {
  color: var(--thread);
}
.figures .k {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-wrap: pretty;
}

/* ── prose (rendered plugin READMEs) ──────────────────────────────────── */

.prose {
  max-width: 44rem;
  padding-bottom: 5rem;
}
.prose h1 {
  display: none;
}
.prose h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 1.3rem + 1vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 3.25rem 0 1rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}
.prose h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.0625rem;
  margin: 2rem 0 0.6rem;
}
.prose p,
.prose li {
  color: #cfcdc6;
  text-wrap: pretty;
}
.prose strong {
  color: var(--paper);
  font-weight: 600;
}
.prose em {
  color: var(--paper);
}
.prose ul,
.prose ol {
  padding-left: 1.15rem;
}
.prose li {
  margin: 0.45rem 0;
}
.prose li::marker {
  color: var(--thread);
}

.prose code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--ink-sink);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}
.prose pre {
  background: var(--ink-sink);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1rem 1.15rem;
  overflow-x: auto;
}
.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.7;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.15rem 0 0.15rem 1.25rem;
  border-left: 2px solid var(--thread);
  color: var(--muted);
}
.prose blockquote strong {
  color: var(--thread-lit);
}

.prose .tablewrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.875rem;
}
.prose th,
.prose td {
  text-align: left;
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.prose th {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.prose tbody tr:last-child td {
  border-bottom: 0;
}
.prose td code {
  white-space: nowrap;
}

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

/* ── detail page header ───────────────────────────────────────────────── */

.detail-head {
  padding: clamp(2.5rem, 8vh, 4.5rem) 0 0;
}
.detail-head .back {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
}
.detail-head .back:hover {
  color: var(--thread-lit);
}
.detail-head h1 {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(2rem, 1.6rem + 2vw, 3rem);
  letter-spacing: -0.02em;
  margin: 1.25rem 0 0.75rem;
}
.detail-head .tagline {
  font-family: var(--serif);
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.4rem);
  line-height: 1.45;
  color: var(--muted);
  max-width: 40rem;
  margin: 0 0 2rem;
  text-wrap: pretty;
}

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

.foot {
  border-top: 1px solid var(--rule);
  margin-top: 2rem;
  padding: 2rem 0 3.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
}
.foot a {
  color: var(--muted);
  text-decoration: none;
}
.foot a:hover {
  color: var(--thread-lit);
}

@media (max-width: 34rem) {
  .plugins a {
    grid-template-columns: 1fr;
  }
  .masthead nav {
    gap: 0.9rem;
  }
}
