:root {
  --paper: #f3eadc;
  --paper-2: #fff8ee;
  --ink: #1b1612;
  --muted: #5c5148;
  --line: #2a231c;
  --accent: #c4491d;
  --accent-ink: #fff6f1;
  --prompt: #1b1612;
  --prompt-ink: #f6eadc;
  --shadow: 0 18px 40px rgba(40, 24, 12, 0.12);
  --serif: "Literata", "Iowan Old Style", Georgia, serif;
  --sans: "Onest", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, monospace;
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 90% -10%, rgba(196, 73, 29, 0.16), transparent 55%),
    linear-gradient(180deg, #f7f1e6 0%, var(--paper) 28%, #e7dccb 100%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: 0;
  transform: translateY(-120%);
  background: var(--ink);
  color: var(--paper-2);
  padding: 0.6rem 0.9rem;
  z-index: 5;
}

.skip:focus { transform: none; }

.mast,
.hero,
.ledger,
.method,
.article,
.foot {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.mast {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1.4rem 0 1rem;
  border-bottom: 1px solid var(--line);
}

.mark {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.issue {
  margin: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2.5rem;
  align-items: end;
  padding: 2.4rem 0 1rem;
}

.kicker {
  margin: 0 0 0.8rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-wrap: balance;
  scroll-margin-top: 1.2rem;
}

h1 { font-size: clamp(2.3rem, 5vw, 4.4rem); margin: 0 0 1rem; }

.dek { font-size: 1.15rem; max-width: 38rem; margin: 0; }

.hero-fig,
.shot {
  margin: 0;
}

.hero-fig img,
.shot img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-fig img {
  aspect-ratio: 3 / 2;
  transform: rotate(-1.4deg);
  transform-origin: 70% 40%;
}

figcaption {
  margin-top: 0.75rem;
  max-width: 40rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.ledger {
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0 2rem;
}

.ledger a {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1.15rem 0.2rem;
  border-top: 1px solid rgba(28, 22, 18, 0.22);
  text-decoration: none;
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(196, 73, 29, 0.2);
}

.ledger a:last-child { border-bottom: 1px solid rgba(28, 22, 18, 0.22); }

.ledger a:hover,
.ledger a:focus-visible {
  background: rgba(255, 248, 238, 0.7);
}

.num {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.ledger strong { display: block; font-size: 1.25rem; font-family: var(--serif); font-weight: 560; }
.ledger em { display: block; font-style: normal; color: var(--muted); }
.go { font-family: var(--mono); font-size: 0.85rem; }

.method {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 2rem;
  padding: 0 0 3rem;
}
.method > :only-child { grid-column: 1 / -1; }

.steps { display: grid; gap: 0.8rem; margin: 0; padding: 0; list-style: none; }

.steps li {
  background: var(--paper-2);
  border-left: 4px solid var(--accent);
  padding: 0.85rem 1rem;
}

.steps b { font-family: var(--serif); font-weight: 560; }

.article { padding: 2rem 0 3rem; max-width: 760px; }

.article .shot { margin: 1.4rem 0 1.6rem; }
.article .shot img { aspect-ratio: 3 / 2; }
.crop-left { object-position: 12% center; }

.lead {
  font-size: 1.2rem;
  margin-top: 0;
}

.answer {
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 1rem 1.1rem;
  margin: 1.2rem 0 1.6rem;
}

.answer p { margin: 0.4rem 0 0; }
.answer p:first-child { margin-top: 0; }

h2 { font-size: clamp(1.6rem, 3vw, 2.15rem); margin: 2rem 0 0.7rem; }
h3 { font-size: 1.25rem; margin: 1.4rem 0 0.4rem; }

.prompt {
  background: var(--prompt);
  color: var(--prompt-ink);
  padding: 1rem 1rem 1.1rem;
  margin: 1.2rem 0;
  box-shadow: var(--shadow);
}

.prompt header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.7rem;
}

.prompt p { margin: 0; font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }

.copy {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255, 246, 241, 0.3);
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  font: 600 0.95rem/1 var(--sans);
  cursor: pointer;
}

.copy:hover { background: #a33b16; }

pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.55;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.4rem;
  font-variant-numeric: tabular-nums;
  background: var(--paper-2);
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid rgba(28, 22, 18, 0.2);
}

th { font-family: var(--serif); font-weight: 560; }

.diagram {
  width: 100%;
  height: auto;
  margin: 1rem 0 1.4rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
}

.bridge {
  margin: 2rem 0 0;
  padding: 1.2rem 1.2rem 1.3rem;
  background:
    repeating-linear-gradient(-45deg, rgba(196, 73, 29, 0.12) 0 8px, transparent 8px 16px),
    var(--paper-2);
  border: 2px solid var(--accent);
}

.bridge h2 { margin-top: 0; }

.slot {
  margin: 0.8rem 0 0;
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--accent);
}

.back { margin-top: 2rem; }
.back a { font-weight: 600; }

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  align-items: baseline;
  border-top: 1px solid var(--line);
  padding: 1.2rem 0 calc(1.4rem + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.95rem;
}

.foot a { font-weight: 600; color: var(--ink); }
.foot p { margin: 0; }

#copy-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise 0.7s ease both; }
  .rise-2 { animation-delay: 0.12s; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 800px) {
  .hero, .method { grid-template-columns: 1fr; }
  .hero-fig img { transform: none; }
  .ledger a { grid-template-columns: 3.2rem 1fr; }
  .go { display: none; }
  .mast { align-items: flex-start; flex-direction: column; }
  .prompt header { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rise { animation: none; }
  .hero-fig img { transform: none; }
}
