/* ==========================================================================
   OnyaChamp · Systems Engineering Platform
   Art Direction: The well-kept board (dense-tiles)
   Typography: General Sans · Palette: Night and cornflower
   ========================================================================== */

/* ---------- Tokens & Scale ---------- */
:root {
  --bg: #0a0d14;
  --surface: #131824;
  --surface-high: #1a2233;
  --surface-subtle: #0f1420;
  --ink: #e9edf3;
  --muted: #9aa3b2;
  --accent: #5a9bfc;
  --accent-ink: #0a0d14;
  --accent-hover: #7ab2fd;
  --coffee: #ffdd00;
  --coffee-ink: #0a0d14;
  --danger: #ff7875;
  --success: #34d399;

  --font-display: "General Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-text: "General Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Strict 5 Type Steps */
  --step-small: 13px;
  --step-body: 16px;
  --step-lead: 20px;
  --step-head: 32px;
  --step-display: clamp(2.625rem, 5.5vw, 5rem);

  /* Margins & Structure */
  --margin: clamp(1rem, 2.5vw, 2.5rem);
  --gutter: 12px;
  --section: clamp(4rem, 8vw, 7rem);
  --radius-tile: 8px;

  /* Motion Timing */
  --t-press: 140ms;
  --t-hover: 180ms;
  --t-reveal: 700ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
}

/* ---------- Reset & Semantics ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--step-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, blockquote, ul, ol, dl, dd {
  margin: 0;
}

ul[class], ol[class] {
  padding: 0;
  list-style: none;
}

img, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: calc(var(--radius-tile) - 2px);
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

:target {
  scroll-margin-top: 5rem;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Code blocks use literal monospace */
code, pre {
  font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
  font-size: var(--step-small);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.025em;
  text-wrap: balance;
  hyphens: none;
}

h1 { font-size: var(--step-display); }
h2 { font-size: var(--step-head); }
h3, h4 { font-size: var(--step-lead); }

.display {
  font-size: var(--step-display);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.head {
  font-size: var(--step-head);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.lead {
  font-size: var(--step-lead);
  line-height: 1.45;
  color: var(--ink);
  max-width: 58ch;
}

.small {
  font-size: var(--step-small);
  line-height: 1.45;
}

.muted {
  color: var(--muted);
}

p {
  max-width: 65ch;
  text-wrap: pretty;
}

p + p {
  margin-top: 0.9em;
}

/* ---------- Layout & Grid Board ---------- */
.wrap {
  width: 100%;
  max-width: 1360px;
  margin-inline: auto;
  padding-inline: var(--margin);
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gutter);
}

.section {
  padding-block: calc(var(--section) / 2);
}

/* ---------- Tiles (Flat filled surfaces, no hairlines) ---------- */
.tile {
  background: var(--surface);
  border-radius: var(--radius-tile);
  padding: 24px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}

.tile-high {
  background: var(--surface-high);
}

.tile-subtle {
  background: var(--surface-subtle);
}

.tile-pad-lg {
  padding: 32px;
}

.tile-pad-sm {
  padding: 16px 20px;
}

/* Grid Column Spans */
.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-7  { grid-column: span 7; }
.col-6  { grid-column: span 6; }
.col-5  { grid-column: span 5; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }

/* Responsive Grid Breakpoints */
@media (max-width: 980px) {
  .col-8, .col-7, .col-5, .col-4 { grid-column: span 6; }
  .col-3 { grid-column: span 6; }
}

@media (max-width: 680px) {
  .col-8, .col-7, .col-6, .col-5, .col-4, .col-3 { grid-column: span 12; }
  .tile { padding: 18px; }
  .tile-pad-lg { padding: 22px; }
}

/* ---------- Navigation Bar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--bg);
  padding-block: 16px;
  transition: background-color var(--t-hover) ease;
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: var(--step-lead);
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  font-size: var(--step-small);
  color: var(--muted);
  font-weight: 500;
  transition: color var(--t-hover) ease;
}

.nav-link:hover {
  color: var(--ink);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .nav-links { display: none; }
}

@media (max-width: 520px) {
  .nav-row { gap: 8px; flex-wrap: wrap; }
  .nav-brand { font-size: var(--step-body); gap: 8px; }
  .nav-actions { gap: 6px; }
  .nav-actions .btn-sm { padding: 0 0.65rem; }
}

@media (max-width: 400px) {
  .btn { white-space: normal; text-align: center; padding-block: 0.45rem; }
  .nav-actions .btn { white-space: nowrap; }
}

/* ---------- Buttons (Flat filled, no gradients, no glows) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border-radius: var(--radius-tile);
  font-size: var(--step-small);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease, color var(--t-hover) ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-surface {
  background: var(--surface-high);
  color: var(--ink);
}

.btn-surface:hover {
  background: #232d42;
}

.btn-coffee {
  background: var(--coffee);
  color: var(--coffee-ink);
  font-weight: 700;
}

.btn-coffee:hover {
  background: #ffe338;
}

.btn-sm {
  min-height: 2.25rem;
  padding: 0 0.9rem;
  font-size: var(--step-small);
}

/* ---------- Hero Section ---------- */
.hero-headline {
  margin-bottom: 16px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.discipline-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

@media (max-width: 600px) {
  .discipline-list {
    grid-template-columns: 1fr;
  }
}

.discipline-item {
  background: transparent;
  padding: 6px 0;
}

.discipline-title {
  font-weight: 600;
  font-size: var(--step-small);
  color: var(--ink);
}

.discipline-desc {
  font-size: var(--step-small);
  color: var(--muted);
  margin-top: 4px;
}

/* ---------- Media Containers & Shutter Reveal ---------- */
.media-box {
  width: 100%;
  position: relative;
  overflow: clip;
  border-radius: var(--radius-tile);
  background: var(--surface-subtle);
}

.media-box img,
.media-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-tile);
}

.media-frame-contain {
  background: var(--surface-subtle);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: clip;
  flex-grow: 1;
}

.media-frame-contain img {
  width: 100%;
  height: auto;
  max-height: 440px;
  object-fit: contain;
  border-radius: calc(var(--radius-tile) - 2px);
  transition: transform var(--t-hover) var(--ease-out);
}

.media-frame-contain:hover img {
  transform: scale(1.015);
}

.phone-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gutter);
  margin-top: var(--gutter);
}

@media (max-width: 780px) {
  .phone-gallery {
    grid-template-columns: 1fr;
  }
}

.phone-shot {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
}

.phone-shot img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-tile);
  background: var(--surface-subtle);
  transition: transform var(--t-hover) var(--ease-out);
}

.phone-shot:hover img {
  transform: scale(1.015);
}

.phone-shot figcaption {
  font-size: var(--step-small);
  color: var(--muted);
  line-height: 1.45;
}

.phone-shot figcaption strong {
  color: var(--ink);
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
}

.media-caption-bar {
  padding: 12px 16px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--step-small);
}

/* Shutter Motion for Hero Video Frame */
@keyframes shutter-open {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

.shutter-image {
  animation: shutter-open 900ms var(--ease-in-out) both;
}

/* ---------- Section Headers (No Eyebrows) ---------- */
.section-title-wrap {
  margin-bottom: 24px;
}

.section-title {
  font-size: var(--step-head);
  line-height: 1.15;
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: var(--step-lead);
  color: var(--muted);
  max-width: 60ch;
}

/* ---------- Live Thing: FuelAhead Detour Calculator ---------- */
.calc-shell {
  background: var(--surface);
}

.calc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.calc-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calc-title {
  font-family: var(--font-display);
  font-size: var(--step-lead);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.calc-presets {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calc-preset-btn {
  min-height: 2.15rem;
  padding: 0 12px;
  border-radius: calc(var(--radius-tile) - 2px);
  background: var(--surface-high);
  color: var(--muted);
  font-size: var(--step-small);
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}

.calc-preset-btn:hover {
  background: #242f45;
  color: var(--ink);
}

.calc-preset-btn:active {
  transform: scale(0.97);
}

.calc-preset-btn.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.calc-inputs {
  grid-column: span 7;
  background: var(--surface-subtle);
  border-radius: var(--radius-tile);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.calc-outputs {
  grid-column: span 5;
  background: var(--surface-high);
  border-radius: var(--radius-tile);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
}

.calc-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calc-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: var(--step-small);
  color: var(--ink);
  font-weight: 500;
}

.calc-val-pill {
  background: var(--surface-high);
  color: var(--ink);
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 600;
  font-size: var(--step-small);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.calc-track-wrap {
  position: relative;
  height: 22px;
  display: flex;
  align-items: center;
}

.calc-track-bg {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #263147;
  overflow: hidden;
}

.calc-track-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
}

input.calc-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

input.calc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--accent);
  cursor: pointer;
  transition: transform var(--t-press) var(--ease-out);
}

input.calc-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input.calc-slider::-moz-range-track {
  background: transparent;
  border: 0;
}

input.calc-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--accent);
  cursor: pointer;
  transition: transform var(--t-press) var(--ease-out);
}

input.calc-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
}

.calc-bounds {
  display: flex;
  justify-content: space-between;
  font-size: var(--step-small);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.calc-verdict {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: calc(var(--radius-tile) - 2px);
  font-size: var(--step-small);
  font-weight: 700;
}

.calc-verdict.is-good {
  background: #103429;
  color: #34d399;
}

.calc-verdict.is-warn {
  background: #332710;
  color: #fbbf24;
}

.calc-verdict.is-bad {
  background: #38181d;
  color: #ff7875;
}

.verdict-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Totem display with raised tenth of a cent */
.totem-display {
  background: var(--bg);
  border-radius: calc(var(--radius-tile) - 2px);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.totem-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--step-small);
  color: var(--muted);
}

.totem-spread {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.totem-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.totem-price {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 3.3vw, 3.25rem);
  font-weight: 700;
  line-height: 0.95;
  color: var(--success);
  display: inline-flex;
  align-items: flex-start;
  font-variant-numeric: tabular-nums;
}

.totem-tenth {
  font-size: var(--step-lead);
  line-height: 1;
  margin-left: 2px;
  color: var(--ink);
}

.totem-unit {
  font-size: var(--step-small);
  color: var(--muted);
  align-self: flex-end;
  margin-left: 5px;
  margin-bottom: 4px;
}

.totem-eff {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--step-small);
  font-variant-numeric: tabular-nums;
}

.totem-eff strong {
  color: var(--ink);
  font-size: var(--step-body);
}

.calc-meter-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calc-meter-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--step-small);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.calc-meter {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
  display: flex;
}

.calc-meter-kept {
  height: 100%;
  background: var(--success);
  transition: width var(--t-hover) var(--ease-out);
}

.calc-meter-burn {
  height: 100%;
  background: var(--danger);
  transition: width var(--t-hover) var(--ease-out);
}

table.calc-ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step-small);
  font-variant-numeric: tabular-nums;
}

table.calc-ledger td {
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

table.calc-ledger tr:last-child td {
  border-bottom: none;
}

table.calc-ledger td:last-child {
  text-align: right;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.calc-cost-val {
  color: var(--danger);
}

.calc-net-box {
  background: var(--surface-subtle);
  border-radius: calc(var(--radius-tile) - 2px);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.calc-net-title {
  font-size: var(--step-small);
  font-weight: 600;
  color: var(--ink);
}

.profit-badge {
  font-size: var(--step-head);
  font-weight: 700;
  color: var(--success);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 820px) {
  .calc-inputs, .calc-outputs {
    grid-column: span 12;
    padding: 16px;
    gap: 10px;
  }
  .totem-eff {
    text-align: left;
  }
}

/* ---------- Editorial Journal Layout ---------- */
.editorial-split {
  background: var(--surface);
  border-radius: var(--radius-tile);
  padding: 28px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 24px;
  cursor: pointer;
  transition: background-color var(--t-hover) ease;
}

.editorial-split:hover {
  background: var(--surface-high);
}

.editorial-content {
  grid-column: span 7;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.editorial-meta {
  font-size: var(--step-small);
  color: var(--muted);
}

.editorial-desc {
  font-size: var(--step-body);
  color: var(--muted);
  line-height: 1.5;
}

.editorial-preview {
  grid-column: span 5;
  background: var(--bg);
  border-radius: var(--radius-tile);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.editorial-preview pre {
  margin: 0;
  font-size: var(--step-small);
  color: var(--accent);
  line-height: 1.45;
  overflow-x: auto;
  max-width: 100%;
}

@media (max-width: 900px) {
  .editorial-content, .editorial-preview { grid-column: span 12; }
}

.journal-stack {
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
  margin-top: var(--gutter);
}

.journal-item {
  background: var(--surface);
  border-radius: var(--radius-tile);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  cursor: pointer;
  transition: background-color var(--t-hover) ease;
}

.journal-item:hover {
  background: var(--surface-high);
}

.journal-main {
  flex: 1;
  min-width: 0;
}

.journal-thumb {
  width: 176px;
  flex-shrink: 0;
  aspect-ratio: 16 / 10;
  border-radius: calc(var(--radius-tile) - 2px);
  overflow: hidden;
  background: var(--bg);
}

.journal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform var(--t-hover) var(--ease-out);
}

.journal-thumb.is-contain img {
  object-fit: contain;
  padding: 4px;
}

.journal-item:hover .journal-thumb img {
  transform: scale(1.03);
}

.journal-meta {
  font-size: var(--step-small);
  color: var(--muted);
  margin-bottom: 4px;
}

.journal-title {
  font-size: var(--step-lead);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.journal-desc {
  font-size: var(--step-body);
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}

.journal-action {
  font-size: var(--step-small);
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .journal-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .journal-thumb {
    width: 100%;
    max-width: 360px;
    aspect-ratio: 16 / 9;
  }
}

/* Modal Reader for Articles */
.article-reader {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 13, 20, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--margin);
  overflow-y: auto;
}

.article-reader[hidden] {
  display: none;
}

.reader-dialog {
  background: var(--surface);
  border-radius: var(--radius-tile);
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px;
  position: relative;
}

.reader-close {
  position: sticky;
  top: 0;
  float: right;
  background: var(--surface-high);
  color: var(--ink);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--step-lead);
}

.reader-body {
  margin-top: 20px;
}

.reader-body p {
  margin-bottom: 14px;
  color: var(--ink);
  line-height: 1.6;
}

.reader-body p.lead {
  color: var(--ink);
  margin-bottom: 18px;
}

.reader-body a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.reader-body a.btn {
  text-decoration: none;
  color: var(--ink);
}

.reader-body a.btn-primary {
  color: var(--accent-ink);
}

.reader-body ul {
  padding-left: 20px;
  margin-block: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reader-body li {
  color: var(--ink);
  line-height: 1.55;
}

.reader-body h3 {
  margin-top: 28px;
  margin-bottom: 12px;
}

.reader-body pre {
  background: var(--bg);
  padding: 16px;
  border-radius: var(--radius-tile);
  overflow-x: auto;
  margin-block: 16px;
}

.reader-body pre code {
  color: var(--accent);
  font-size: var(--step-small);
  line-height: 1.5;
}

.article-stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-block: 18px;
}

.article-stat {
  background: var(--bg);
  border-radius: calc(var(--radius-tile) - 2px);
  padding: 12px 14px;
}

.article-stat strong {
  display: block;
  font-size: var(--step-lead);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.article-stat span {
  display: block;
  margin-top: 4px;
  font-size: var(--step-small);
  color: var(--muted);
}

.article-figure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-block: 22px;
}

.article-figure {
  margin: 0;
  margin-block: 22px;
  background: var(--bg);
  border-radius: var(--radius-tile);
  overflow: hidden;
  cursor: pointer;
}

.article-figure-grid .article-figure {
  margin-block: 0;
}

.article-figure img {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  background: var(--surface-subtle);
  display: block;
}

.article-figure figcaption {
  padding: 12px 16px;
  font-size: var(--step-small);
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.article-figure-zoom {
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

.article-table-wrap {
  overflow-x: auto;
  margin-block: 20px;
  background: var(--bg);
  border-radius: var(--radius-tile);
}

table.article-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: var(--step-small);
  text-align: left;
}

table.article-table th {
  background: var(--surface-high);
  color: var(--ink);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

table.article-table td {
  padding: 10px 12px;
  color: var(--muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
  line-height: 1.45;
}

table.article-table td:first-child {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

table.article-table tr:last-child td {
  border-bottom: none;
}

.state-tag-good {
  color: var(--success);
  font-weight: 600;
}

.state-tag-warn {
  color: var(--accent);
  font-weight: 600;
}

.state-tag-bad {
  color: var(--danger);
  font-weight: 600;
}

.article-cta-row {
  margin-top: 24px;
  padding-top: 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Public Tools Catalog Grid ---------- */
.tool-tile {
  background: var(--surface);
  border-radius: var(--radius-tile);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.tool-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.tool-name {
  font-size: var(--step-lead);
  color: var(--ink);
  font-weight: 700;
}

.tool-name a:hover {
  color: var(--accent);
}

.tool-desc {
  font-size: var(--step-small);
  color: var(--muted);
  line-height: 1.5;
}

.tool-terminal {
  background: var(--bg);
  padding: 10px 14px;
  border-radius: calc(var(--radius-tile) - 2px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tool-terminal code {
  color: var(--accent);
  font-size: var(--step-small);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-copy-btn {
  color: var(--muted);
  transition: color var(--t-hover) ease;
}

.tool-copy-btn:hover {
  color: var(--ink);
}

.tool-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  font-size: var(--step-small);
}

.tool-link {
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Universal Lightbox Modal ---------- */
.shot-lightbox {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(10, 13, 20, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.shot-lightbox[hidden] {
  display: none;
}

.shot-lightbox-inner {
  max-width: 1200px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.shot-lightbox-inner img {
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius-tile);
}

.lightbox-caption {
  font-size: var(--step-small);
  color: var(--ink);
  text-align: center;
}

.lightbox-counter {
  font-size: var(--step-small);
  color: var(--muted);
}

.lightbox-close,
.lightbox-nav-btn {
  background: var(--surface);
  color: var(--ink);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--t-hover) ease;
}

.lightbox-close:hover,
.lightbox-nav-btn:hover {
  background: var(--surface-high);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: var(--step-lead);
}

.lightbox-prev {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

/* ---------- Systems Utility Ledger Table ---------- */
.ledger-wrap {
  border-radius: var(--radius-tile);
  background: var(--surface);
  margin-top: 24px;
  overflow: clip;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step-body);
  text-align: left;
}

.ledger-table th {
  background: var(--surface-high);
  color: var(--ink);
  font-weight: 600;
  padding: 14px 18px;
  font-size: var(--step-small);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ledger-table td {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.ledger-table tr:last-child td {
  border-bottom: none;
}

.ledger-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.ledger-name {
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ledger-name a {
  color: var(--ink);
}

.ledger-name a:hover {
  color: var(--accent);
}

.ledger-badge {
  font-size: var(--step-small);
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-high);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 600;
}

.ledger-cmd-row {
  background: var(--bg);
  padding: 6px 10px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.ledger-cmd {
  font-size: var(--step-small);
  color: var(--accent);
  white-space: nowrap;
}

.ledger-table td:last-child {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .ledger-table thead {
    display: none;
  }
  .ledger-table,
  .ledger-table tbody,
  .ledger-table tr,
  .ledger-table td {
    display: block;
    width: 100%;
  }
  .ledger-table tr {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .ledger-table tr:last-child {
    border-bottom: none;
  }
  .ledger-table td {
    padding: 4px 0;
    border-bottom: none;
    white-space: normal;
  }
  .ledger-cmd-row {
    max-width: 100%;
    white-space: normal;
    margin-top: 6px;
  }
  .ledger-cmd {
    white-space: normal;
    word-break: break-word;
  }
}

/* Featured Tool Visual Card */
.featured-tool-card {
  background: var(--surface);
  border-radius: var(--radius-tile);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background-color var(--t-hover) ease;
}

.featured-tool-card:hover {
  background: var(--surface-high);
}

.featured-tool-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-subtle);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.featured-tool-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  transition: transform var(--t-hover) var(--ease-out);
}

.featured-tool-media:hover img {
  transform: scale(1.02);
}

.featured-tool-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
  gap: 16px;
}

/* ---------- Footer Tiles ---------- */
.footer-bar {
  padding-block: 40px;
  margin-top: var(--section);
  background: var(--surface-subtle);
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-size: var(--step-small);
  color: var(--muted);
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-nav a:hover {
  color: var(--ink);
}

/* ---------- Motion Layer (taste-skill step 9) ---------- */
@keyframes ad-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

[data-rise] {
  animation: ad-rise 0.5s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 60ms + 50ms);
}

[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms var(--ease-out), transform 700ms var(--ease-out);
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .shutter-image {
    animation-duration: 0.01ms !important;
  }
  [data-rise] {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
  [data-reveal] {
    transition-duration: 0.01ms !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

@media (max-width: 680px) {
  .reader-dialog {
    padding: 20px;
  }
  .editorial-split {
    padding: 20px;
  }
  .article-figure-grid,
  .article-stat-strip {
    grid-template-columns: 1fr;
  }
}
