:root {
  color-scheme: dark;
  --background: #0f0b04;
  --foreground: #f0c960;
  --primary: #e9bd4c;
  --primary-ink: #1c1205;
  --accent: #c14728;
  --accent-ink: #ffedb3;
  --panel: rgba(22, 17, 7, 0.88);
  --panel-strong: #2c210f;
  --panel-muted: rgba(56, 42, 19, 0.74);
  --muted: #bb9352;
  --border: #c89c45;
  --black: rgba(0, 0, 0, 0.62);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  background: var(--background);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--foreground);
  font:
    20px / 1.45 "Courier New",
    Courier,
    monospace;
  background: transparent;
}

a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent-ink);
}

img {
  display: block;
  max-width: 100%;
}

strong,
h1,
h2 {
  color: var(--primary);
  text-shadow:
    0 0 1px rgba(240, 201, 96, 0.8),
    0 0 6px rgba(233, 189, 76, 0.42);
}

h1,
h2 {
  margin: 0;
  font-family: "Courier New", Courier, monospace;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
}

h1 {
  max-width: 17ch;
  font-size: clamp(1.55rem, 4vw, 2.1rem);
  line-height: 1.65;
}

h2 {
  font-size: clamp(1.08rem, 2.7vw, 1.4rem);
  line-height: 1.45;
}

p {
  margin: 0;
}

code {
  padding: 0.05rem 0.25rem;
  border: 1px solid rgba(200, 156, 69, 0.65);
  background: rgba(7, 5, 2, 0.72);
  color: var(--accent-ink);
  font-size: 0.9em;
}

.mural-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: url("/art/backdrop-mural.png");
  background-position: center;
  background-size: cover;
  filter: saturate(1.15) brightness(1.05);
}

.mural-bg::after {
  position: absolute;
  inset: 0;
  content: "";
  background: radial-gradient(
    ellipse at center,
    rgba(18, 13, 5, 0) 35%,
    rgba(11, 7, 3, 0.4) 100%
  );
}

.site-banner,
.page-shell,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-banner {
  border-bottom: 2px solid var(--border);
  background: rgba(15, 11, 4, 0.84);
}

.banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 64rem);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  gap: 0.6rem;
}

.brand-mark {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  color: var(--primary);
  font-weight: 900;
  text-shadow:
    0 0 1px rgba(240, 201, 96, 0.8),
    0 0 6px rgba(233, 189, 76, 0.42);
}

/* When the wordmark links home (interior pages) keep it looking like the mark. */
a.brand-mark {
  text-decoration: none;
}

a.brand-mark:hover {
  color: var(--accent-ink);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid rgba(193, 71, 40, 0.7);
  background: rgba(193, 71, 40, 0.15);
  color: var(--accent-ink);
  gap: 0.45rem;
  font-size: 0.95rem;
  white-space: nowrap;
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--accent);
  animation: pulse 1.8s ease-in-out infinite;
}

.page-shell {
  display: flex;
  flex-direction: column;
  width: min(100%, 48rem);
  margin: 0 auto;
  padding: 4rem 1rem 3rem;
  gap: 5rem;
}

.terminal-panel {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--panel);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.65),
    0 0 24px rgba(233, 189, 76, 0.28),
    0 18px 40px rgba(0, 0, 0, 0.62),
    inset 0 0 60px rgba(0, 0, 0, 0.55);
}

.terminal-panel::before {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  content: "";
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.28) 3px,
    rgba(0, 0, 0, 0.28) 4px
  );
  mix-blend-mode: multiply;
}

.terminal-panel::after {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  content: "";
  background: radial-gradient(
    ellipse at center,
    rgba(233, 189, 76, 0.07) 0%,
    transparent 45%,
    rgba(0, 0, 0, 0.42) 100%
  );
  animation: crt-flicker 4s infinite steps(60);
}

.terminal-panel > * {
  position: relative;
  z-index: 5;
}

.hero {
  max-width: 48rem;
  margin: 0 auto;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13rem;
  align-items: start;
  gap: 1.5rem;
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2.25rem;
  padding: 0.4rem 0.75rem;
  border-bottom: 2px solid var(--border);
  background: var(--panel-strong);
  color: var(--primary);
  gap: 1rem;
  font-size: 1rem;
  line-height: 1.1;
  text-shadow:
    0 0 1px rgba(240, 201, 96, 0.8),
    0 0 6px rgba(233, 189, 76, 0.42);
}

.window-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.window-controls span {
  width: 0.65rem;
  height: 0.65rem;
  border: 1px solid var(--border);
  background: var(--muted);
}

.window-controls span:last-child {
  background: var(--accent);
}

.terminal-body {
  padding: 1.35rem;
}

.comment {
  color: var(--muted);
  font-size: 1.05rem;
}

.lede,
.metadata,
.provenance,
.attribution {
  color: var(--foreground);
  font-size: clamp(1rem, 2.6vw, 1.23rem);
  line-height: 1.55;
}

.lede {
  margin-top: 1.1rem;
}

.prompt {
  margin-top: 1.5rem;
  color: var(--primary);
  text-shadow:
    0 0 1px rgba(240, 201, 96, 0.8),
    0 0 6px rgba(233, 189, 76, 0.42);
}

.prompt::after {
  content: "\2588";
  margin-left: 0.15em;
  animation: cursor-blink 1.1s steps(2, start) infinite;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 1.5rem;
}

.split-reverse {
  grid-template-columns: auto minmax(0, 1fr);
}

.art-frame {
  width: 10rem;
  height: 10rem;
  margin: 0;
  overflow: hidden;
  border: 3px solid var(--border);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 10px 30px rgba(0, 0, 0, 0.62),
    0 0 22px rgba(233, 189, 76, 0.25);
}

.art-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-art {
  width: 13rem;
  height: 16rem;
}

.callout {
  margin-top: 1rem;
  padding: 0.65rem 0.8rem;
  border-left: 2px solid var(--accent);
  background: rgba(193, 71, 40, 0.12);
  color: var(--foreground);
  font-size: clamp(1rem, 2.5vw, 1.13rem);
  line-height: 1.55;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1.5rem 0 0;
  gap: 0.75rem;
}

.stats div {
  min-width: 0;
  padding: 0.6rem 0.7rem;
  border: 2px solid var(--border);
  background: var(--panel-muted);
  text-align: center;
}

.stats dt {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: clamp(0.72rem, 2.8vw, 0.98rem);
  line-height: 1.2;
}

.stats dd {
  margin: 0;
  color: var(--primary);
  font-size: clamp(1rem, 3.1vw, 1.2rem);
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-shadow:
    0 0 1px rgba(240, 201, 96, 0.8),
    0 0 6px rgba(233, 189, 76, 0.42);
}

.download-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.25rem;
  margin-top: 1.5rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--primary);
  background: var(--primary);
  color: var(--primary-ink);
  gap: 0.75rem;
  font-size: clamp(0.9rem, 2.8vw, 1.05rem);
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.download-button:hover,
.download-button:focus-visible {
  background: #f5cf67;
  color: var(--primary-ink);
}

.metadata {
  display: grid;
  margin: 1.25rem 0 0;
  gap: 0.35rem;
}

.metadata div {
  display: flex;
  gap: 0.75rem;
}

.metadata dt {
  flex: 0 0 auto;
  color: var(--muted);
}

.metadata dd {
  margin: 0;
}

.provenance {
  margin-top: 1.25rem;
  border: 2px solid var(--border);
  background: rgba(56, 42, 19, 0.45);
}

.provenance summary {
  display: flex;
  align-items: center;
  padding: 0.55rem 0.75rem;
  color: var(--primary);
  cursor: pointer;
  gap: 0.5rem;
  text-shadow:
    0 0 1px rgba(240, 201, 96, 0.8),
    0 0 6px rgba(233, 189, 76, 0.42);
}

.provenance summary::-webkit-details-marker {
  display: none;
}

.provenance summary span {
  transition: transform 150ms ease;
}

.provenance[open] summary span {
  transform: rotate(90deg);
}

.provenance > div {
  padding: 0.9rem 1rem;
  border-top: 2px solid var(--border);
}

.provenance p + p,
.provenance table + p {
  margin-top: 1rem;
}

.hashes code {
  overflow-wrap: anywhere;
}

.kinds {
  width: 100%;
  margin-top: 1rem;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.kinds caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.kinds th,
.kinds td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid rgba(200, 156, 69, 0.5);
  text-align: left;
}

.kinds th:last-child,
.kinds td:last-child {
  text-align: right;
}

.attribution {
  margin: 1.5rem 0 0;
  padding: 0.8rem 1rem;
  border-left: 2px solid var(--primary);
  background: rgba(56, 42, 19, 0.45);
}

.site-footer {
  width: min(100%, 48rem);
  margin: 0 auto;
  padding: 0 1rem 3rem;
  color: var(--muted);
  text-align: center;
}

.site-footer::before {
  display: block;
  height: 2px;
  margin-bottom: 1.3rem;
  background: var(--border);
  content: "";
}

.site-footer p + p {
  margin-top: 0.4rem;
  color: rgba(187, 147, 82, 0.7);
  font-size: 0.95rem;
}

.site-footer a {
  color: var(--primary);
}

/* --- Homepage link to the long-form story ------------------------------- */

.story-link {
  margin-top: 1.1rem;
  color: var(--foreground);
  font-size: clamp(1rem, 2.5vw, 1.13rem);
  line-height: 1.55;
}

.story-link span {
  color: var(--muted);
}

.story-link a {
  font-weight: 900;
}

/* --- Long-form article page --------------------------------------------- */

.page-shell-article {
  gap: 2.5rem;
}

.doc-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid rgba(200, 156, 69, 0.5);
  gap: 0.75rem 1.5rem;
  font-size: 0.98rem;
}

.doc-nav-foot {
  margin-top: 2.5rem;
  margin-bottom: 0;
  padding-top: 0.9rem;
  padding-bottom: 0;
  border-top: 1px solid rgba(200, 156, 69, 0.5);
  border-bottom: 0;
}

.article {
  max-width: 42rem;
  font-size: clamp(1rem, 2.3vw, 1.1rem);
  line-height: 1.72;
}

.article h1 {
  max-width: none;
  margin-top: 0.4rem;
  font-size: clamp(1.5rem, 4.4vw, 2.05rem);
  line-height: 1.35;
}

.article h2 {
  margin-top: 2.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid rgba(200, 156, 69, 0.32);
  font-size: clamp(1.18rem, 3vw, 1.45rem);
  line-height: 1.35;
}

.article h3 {
  margin-top: 1.9rem;
  color: var(--accent-ink);
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(1.02rem, 2.5vw, 1.15rem);
  font-weight: 900;
  line-height: 1.35;
}

.article p {
  margin-top: 1.05rem;
}

.article .lede {
  margin-top: 1.2rem;
}

.article .comment {
  margin-top: 0;
}

.article ul,
.article ol {
  margin: 1.05rem 0 0;
  padding-left: 1.5rem;
}

.article li {
  margin-top: 0.4rem;
  padding-left: 0.25rem;
}

.article li::marker {
  color: var(--muted);
}

.article a {
  overflow-wrap: anywhere;
}

.principle {
  margin: 1.5rem 0 0;
  padding: 0.85rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: rgba(193, 71, 40, 0.12);
  color: var(--primary);
  font-size: clamp(1.02rem, 2.5vw, 1.15rem);
  font-style: normal;
  line-height: 1.55;
  text-shadow:
    0 0 1px rgba(240, 201, 96, 0.6),
    0 0 6px rgba(233, 189, 76, 0.28);
}

/* Inline tooltip-style footnote. No JavaScript: the note text stays in the
   accessibility tree at all times (so `aria-describedby` reads it for screen
   readers) and is revealed visually on hover or keyboard focus. The marker sits
   in the right-hand part of its paragraph, so the revealed bubble is anchored to
   the marker's right edge and opens inward (leftward) with a width capped to the
   article column. That keeps the whole bubble inside the .terminal-panel, which
   is `overflow: hidden`, so it never gets clipped and never scrolls the page
   horizontally. */
.tip {
  position: relative;
  display: inline;
}

.tip-marker {
  appearance: none;
  padding: 0 0.15em;
  border: 0;
  background: none;
  color: var(--accent-ink);
  font: inherit;
  font-size: 0.72em;
  font-weight: 900;
  line-height: 1;
  vertical-align: super;
  cursor: help;
}

.tip-marker:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Visually hidden but present for assistive tech: the accessible name of the
   marker button, and the collapsed state of the note bubble. */
.tip-label,
.tip-bubble {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.tip:hover .tip-bubble,
.tip:focus-within .tip-bubble {
  top: 1.7em;
  right: 0;
  left: auto;
  z-index: 6;
  width: max-content;
  max-width: min(19rem, calc(100vw - 3rem));
  height: auto;
  margin: 0;
  padding: 0.6rem 0.8rem;
  overflow: visible;
  clip: auto;
  clip-path: none;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--panel-strong);
  box-shadow: 0 6px 18px var(--black);
  color: var(--foreground);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: normal;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes cursor-blink {
  to {
    visibility: hidden;
  }
}

@keyframes crt-flicker {
  0%,
  96%,
  100% {
    opacity: 1;
  }
  97% {
    opacity: 0.93;
  }
  98% {
    opacity: 0.99;
  }
  99% {
    opacity: 0.9;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 18px;
  }

  .page-shell {
    padding-top: 3rem;
    gap: 3rem;
  }

  .terminal-body {
    padding: 1rem;
  }

  .split,
  .split-reverse,
  .hero-layout {
    grid-template-columns: 1fr;
  }

  .art-frame,
  .hero-art {
    width: 100%;
    height: 10rem;
  }

  .metadata div {
    flex-direction: column;
    gap: 0.05rem;
  }
}

@media (max-width: 440px) {
  .banner-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats {
    gap: 0.45rem;
  }

  .stats div {
    padding-right: 0.35rem;
    padding-left: 0.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-dot,
  .terminal-panel::after,
  .prompt::after {
    animation: none;
  }

  .provenance summary span {
    transition: none;
  }
}
