/* ============================================================
   markmaton — Night / Paper (strict dual palette)
   palette · night #0D0C0A / paper #F0EBE0 — nothing else;
             every other tone is a tint of paper.
             The Markdown panel inverts: noise lives in the dark,
             clarity comes out as paper.
   type    · Clash Display (display) / General Sans (body)
           / Commit Mono (code + labels)
   ============================================================ */

:root {
  --night: #0D0C0A;
  --panel: #14120F;
  --paper: #F0EBE0;
  --ink-dim: rgba(240, 235, 224, 0.62);
  --ink-faint: rgba(240, 235, 224, 0.34);
  --line: rgba(240, 235, 224, 0.13);
  --line-soft: rgba(240, 235, 224, 0.08);
  --night-dim: rgba(13, 12, 10, 0.6);
  --display: "Clash Display", "General Sans", system-ui, sans-serif;
  --body: "General Sans", system-ui, sans-serif;
  --mono: "Commit Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --maxw: 72rem;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--night);
  color: var(--paper);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--paper); color: var(--night); }

a { color: inherit; text-decoration-color: var(--ink-faint); text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--paper); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
  border-radius: 2px;
}

code { font-family: var(--mono); font-size: 0.92em; }

svg { display: block; }

/* ---------- icons ---------- */

.head-nav svg { width: 17px; height: 17px; }
.btn svg { width: 18px; height: 18px; }
.brand-mark { width: 26px; height: 26px; color: var(--paper); }
.mini-mark { width: 20px; height: 20px; display: inline-block; vertical-align: -4px; margin-right: 8px; }

/* the slash is a knockout cut — same color as the ground it sits on */
.mark-slash {
  stroke: var(--night);
  stroke-dasharray: 23;
  stroke-dashoffset: 23;
  animation: slash-in 0.7s 0.35s cubic-bezier(0.6, 0, 0.2, 1) forwards;
}
@keyframes slash-in { to { stroke-dashoffset: 0; } }

/* marching dashes — direction of flow is real information */
.flow-line { animation: march 1.6s linear infinite; }
@keyframes march { to { stroke-dashoffset: -18; } }

/* ---------- header ---------- */

.head {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.4rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  margin-right: auto;
}

.brand-word {
  font-family: var(--mono);
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.head-nav {
  display: flex;
  gap: 1.35rem;
}

.head-nav a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.head-nav a:hover { color: var(--paper); }
.head-nav a:hover svg { color: var(--paper); }
.head-nav svg { color: var(--ink-dim); transition: color 0.2s; }

/* ---------- hero ---------- */

.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 5.5rem 1.5rem 3rem;
}

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  color: var(--ink-dim);
  margin-bottom: 2.4rem;
}

.eyebrow-tick {
  width: 2.6rem;
  height: 1px;
  background: var(--line);
  position: relative;
}
.eyebrow-tick::before,
.eyebrow-tick::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 1px;
  height: 7px;
  background: var(--line);
}
.eyebrow-tick::before { left: 0; }
.eyebrow-tick::after { right: 0; }

.hero h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(3.25rem, 9vw, 6.75rem);
  line-height: 0.96;
  letter-spacing: -0.025em;
  text-align: center;
  margin-bottom: 1.7rem;
}

.lede {
  max-width: 40rem;
  margin: 0 auto 2.6rem;
  text-align: center;
  color: var(--ink-dim);
  font-size: 1.13rem;
}
.lede code { color: var(--paper); }

.cta-row {
  display: flex;
  justify-content: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-bottom: 4.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  padding: 0.75rem 1.3rem;
  border-radius: 3px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.18s, background 0.18s, border-color 0.18s, color 0.18s;
}
.btn:active { transform: translateY(1px); }

/* inverted primary — paper is the only emphasis color */
.btn-primary {
  background: var(--paper);
  color: var(--night);
  font-weight: 700;
}
.btn-primary:hover { background: #FFFFFF; }

.btn-ghost {
  border-color: var(--line);
  color: var(--paper);
}
.btn-ghost:hover { border-color: var(--ink-faint); background: rgba(240, 235, 224, 0.05); }

/* ---------- theater (the signature figure) ---------- */

.theater {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(240, 235, 224, 0.02);
}

.theater-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
}

.stamp {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}

#pypi-version {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.3rem 0.6rem;
}

.replay {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: none;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.32rem 0.7rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.replay:hover { color: var(--paper); border-color: var(--ink-faint); }
.replay svg { width: 15px; height: 15px; transition: transform 0.5s cubic-bezier(0.6, 0, 0.2, 1); }
.replay:hover svg { transform: rotate(-180deg); }

.theater-stage {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: stretch;
  padding: 1.1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line-soft);
}
.panel-note { color: var(--ink-faint); }

.code {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.75;
  padding: 0.9rem;
  overflow-x: auto;
  white-space: pre;
  flex: 1;
}

/* code palette — tints of paper only */
.t { color: var(--paper); }
.a { color: rgba(240, 235, 224, 0.7); }
.s { color: var(--ink-dim); }
.p { color: var(--ink-faint); }
.n { color: var(--paper); }

/* the strike: a thick paper cut; the noise recedes, the cut stays bright */
.noise {
  position: relative;
  display: inline-block;
  transition: opacity 0.45s;
}
.noise::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  top: 52%;
  height: 2px;
  background: var(--paper);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s cubic-bezier(0.6, 0, 0.2, 1);
}
.noise.struck { opacity: 0.28; }
.noise.struck::after { transform: scaleX(1); }

.convert-chip {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 0 0.25rem;
}

.convert-cmd {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--night);
  background: var(--paper);
  border-radius: 3px;
  padding: 0.42rem 0.65rem;
  white-space: nowrap;
  font-weight: 700;
}

.convert-arrow { width: 64px; height: 24px; color: var(--paper); }

/* the inversion — output is paper, the page's one bright object */
.panel-md {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--night);
}
.panel-md .panel-label {
  color: var(--night-dim);
  border-bottom-color: rgba(13, 12, 10, 0.16);
}

.md-line {
  display: block;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.35s, transform 0.35s;
}
.theater.played .md-line { opacity: 1; transform: none; }
.theater.played .md-line:nth-child(1)  { transition-delay: 0.00s; }
.theater.played .md-line:nth-child(2)  { transition-delay: 0.05s; }
.theater.played .md-line:nth-child(3)  { transition-delay: 0.10s; }
.theater.played .md-line:nth-child(4)  { transition-delay: 0.15s; }
.theater.played .md-line:nth-child(5)  { transition-delay: 0.20s; }
.theater.played .md-line:nth-child(6)  { transition-delay: 0.25s; }
.theater.played .md-line:nth-child(7)  { transition-delay: 0.30s; }
.theater.played .md-line:nth-child(8)  { transition-delay: 0.35s; }
.theater.played .md-line:nth-child(9)  { transition-delay: 0.40s; }
.theater.played .md-line:nth-child(10) { transition-delay: 0.45s; }
.theater.played .md-line:nth-child(11) { transition-delay: 0.50s; }
.theater.played .md-line:nth-child(12) { transition-delay: 0.55s; }
.theater.played .md-line:nth-child(13) { transition-delay: 0.60s; }
.theater.played .md-line:nth-child(14) { transition-delay: 0.65s; }

.md-h { font-weight: 700; }
.md-a { text-decoration: underline; text-underline-offset: 0.15em; text-decoration-color: rgba(13, 12, 10, 0.45); }
.md-f { color: var(--night-dim); }

.theater-legend {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
}

.legend-strike {
  width: 1.6rem;
  height: 2px;
  background: var(--paper);
  flex: none;
}

/* ---------- rules between sections ---------- */

.rule {
  max-width: var(--maxw);
  margin: 1rem auto;
  padding: 0 1.5rem;
}
.rule::before {
  content: "";
  display: block;
  height: 1px;
  background: var(--line-soft);
}

/* ---------- sheets ---------- */

/* numbering is automatic — add a <section class="sheet"> and it renumbers */
main { counter-reset: sheet; }
.sheet { counter-increment: sheet; }

.sheet {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3.5rem;
}

.sheet-label {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  margin-bottom: 1.6rem;
}
.sheet-label::before {
  content: counter(sheet, decimal-leading-zero);
  color: var(--paper);
  font-weight: 700;
}
.sheet-name { color: var(--ink-dim); }

.sheet h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 0.9rem;
}

.sheet-lede {
  color: var(--ink-dim);
  max-width: 36rem;
  margin-bottom: 2.6rem;
}
.sheet-lede code { color: var(--paper); }

/* ---------- pipeline ---------- */

.pipeline {
  display: flex;
  align-items: stretch;
  gap: 1.1rem;
  margin-bottom: 2rem;
}

.pipe-block {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1.1rem 1.2rem;
  background: rgba(240, 235, 224, 0.02);
}

.pipe-core {
  border: 1.5px solid var(--paper);
}

.pipe-title {
  font-family: var(--mono);
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
}

.pipe-sub {
  font-size: 0.88rem;
  color: var(--ink-dim);
  line-height: 1.55;
}

.pipe-arrow {
  width: 46px;
  flex: none;
  align-self: center;
  color: var(--ink-dim);
  height: 20px;
}

.callout {
  border-left: 2px solid var(--paper);
  padding: 0.55rem 0 0.55rem 1rem;
  color: var(--ink-dim);
  font-size: 0.95rem;
}
.callout-mark { color: var(--paper); margin-right: 0.35rem; }

/* ---------- structured output ---------- */

.output-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 1.4rem;
  align-items: start;
  margin-bottom: 2.2rem;
}

.field-list { display: flex; flex-direction: column; }

.field {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.field:first-child { padding-top: 0; }

.field dt {
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}
.field dt code { color: var(--paper); }

.field dd {
  color: var(--ink-dim);
  font-size: 0.92rem;
}

.stat-row {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.stat {
  padding: 1rem 1.1rem;
  border-left: 1px solid var(--line);
}
.stat:first-child { border-left: none; }

.stat-num {
  display: block;
  font-family: var(--mono);
  font-size: 1.35rem;
  margin-bottom: 0.15rem;
}

.stat-key {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
}

/* ---------- install ---------- */

.install-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
  margin-bottom: 1.8rem;
}

.install-wide { grid-column: 1 / -1; }

.install-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  margin-bottom: 0.55rem;
}

.cmd-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  padding: 0.7rem 0.85rem;
}

.cmd {
  flex: 1;
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: nowrap;
}

.copy {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: none;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  color: var(--ink-dim);
  cursor: pointer;
  position: relative;
  transition: color 0.2s, border-color 0.2s;
}
.copy:hover { color: var(--paper); border-color: var(--ink-faint); }

.copy svg { width: 15px; height: 15px; grid-area: 1 / 1; }
.copy .ic-check { opacity: 0; transform: scale(0.6); color: var(--paper); transition: opacity 0.2s, transform 0.25s; }
.copy .ic-copy { transition: opacity 0.2s, transform 0.25s; }
.copy.copied .ic-copy { opacity: 0; transform: scale(0.6); }
.copy.copied .ic-check { opacity: 1; transform: scale(1); }

.install-note {
  color: var(--ink-dim);
  font-size: 0.92rem;
}

/* ---------- compare ---------- */

.compare-rows {
  border-top: 1px solid var(--line-soft);
}

.compare-row {
  display: grid;
  grid-template-columns: 13rem 1fr;
  gap: 1.4rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: baseline;
}

.compare-name { font-size: 0.98rem; }
.compare-name code { color: var(--paper); }
.compare-note { color: var(--ink-dim); font-size: 0.94rem; max-width: 44rem; }
.compare-note code { color: var(--paper); font-size: 0.88em; }

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--line-soft);
  margin-top: 2rem;
}

.foot-grid {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.2rem 1.5rem 2.6rem;
  display: flex;
  align-items: flex-start;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.foot-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-right: auto;
}

.foot-word { font-family: var(--mono); font-size: 0.95rem; }
.foot-tag { font-size: 0.8rem; color: var(--ink-faint); }

.foot-links {
  display: flex;
  gap: 1.4rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}
.foot-links a { color: var(--ink-dim); }
.foot-links a:hover { color: var(--paper); }

.foot-meta {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: flex-end;
}

.colophon {
  font-size: 0.78rem;
  color: var(--ink-faint);
}

/* ---------- scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .theater-stage {
    grid-template-columns: 1fr;
  }
  .convert-chip {
    flex-direction: column;
    justify-content: center;
    padding: 0.2rem 0;
  }
  .convert-arrow { transform: rotate(90deg); }
  .output-grid { grid-template-columns: 1fr; }
  .pipeline { flex-direction: column; }
  .pipe-arrow { transform: rotate(90deg); align-self: center; }
}

@media (max-width: 640px) {
  .head { flex-wrap: wrap; gap: 0.9rem; }
  .brand { margin-right: 0; }
  .hero { padding-top: 3.2rem; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { border-left: none; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .install-grid { grid-template-columns: 1fr; }
  .compare-row { grid-template-columns: 1fr; gap: 0.3rem; }
  .foot-meta { align-items: flex-start; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mark-slash { animation: none; stroke-dashoffset: 0; }
  .flow-line { animation: none; }
  .replay svg { transition: none; }
  .replay:hover svg { transform: none; }
  .noise, .noise::after, .md-line { transition: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
