/* ============================================================
   SOMA site styles
   Tokens (custom properties) are inlined in the <head> <style>
   block from soma-ui-site/assets/tokens.css via include_str!().
   This file: reset → global → grain → animations → components.
   ============================================================ */

/* ── Reset ──────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Selection highlight ──────────────────────────────────── */
::selection {
  background: color-mix(in srgb, var(--c-amber) 28%, transparent);
  color: var(--c-text);
}

/* ── Global ─────────────────────────────────────────────── */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Subtle grain on dark bg — SVG feTurbulence at 3% opacity */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Hide grain in light mode (paper bg is textured enough) */
:root[data-theme="light"] body::before,
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) body::before {
    opacity: 0.015;
  }
}

a {
  color: var(--c-amber);
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--t-fast), color var(--t-fast);
}

a:hover {
  text-decoration-color: var(--c-amber);
}

a:focus-visible {
  outline: 2px solid var(--c-amber);
  outline-offset: 2px;
  border-radius: 1px;
}

:focus-visible {
  outline: 2px solid var(--c-amber);
  outline-offset: 2px;
  border-radius: 1px;
}

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

/* ── Animations ─────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  @keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
  }

  @keyframes reveal {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
  }

  @keyframes boot-in {
    from { opacity: 0; transform: translateX(-4px); }
    to   { opacity: 1; transform: none; }
  }

  @keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
  }

  @keyframes value-dip {
    0%   { opacity: 1; }
    30%  { opacity: 0.35; }
    100% { opacity: 1; }
  }

  .logo-cursor {
    animation: blink 1s steps(1) infinite;
  }

  /* Staggered hero reveal — per-element inside hero */
  .hero__reveal {
    animation: reveal 400ms ease-out both;
  }
  .hero__reveal:nth-child(2) { animation-delay: 80ms; }
  .hero__reveal:nth-child(3) { animation-delay: 160ms; }
  .hero__reveal:nth-child(4) { animation-delay: 240ms; }
  .hero__reveal:nth-child(5) { animation-delay: 320ms; }

  /* Page-level section stagger — every page */
  /* Structure A: .page > .container > * (home, platform, suite pages) */
  .page > .container > * {
    animation: reveal 300ms ease-out both;
  }
  .page > .container > *:nth-child(1) { animation-delay:   0ms; }
  .page > .container > *:nth-child(2) { animation-delay:  70ms; }
  .page > .container > *:nth-child(3) { animation-delay: 140ms; }
  .page > .container > *:nth-child(4) { animation-delay: 210ms; }
  .page > .container > *:nth-child(5) { animation-delay: 280ms; }
  .page > .container > *:nth-child(6) { animation-delay: 350ms; }
  /* Structure B: .page > section.section (blog, changelog, manifesto pages) */
  .page > section.section {
    animation: reveal 300ms ease-out both;
  }

  /* Site header fades in first */
  .site-header {
    animation: reveal 200ms ease-out both;
  }

  /* Shared utility class for manual application */
  .reveal-item {
    animation: reveal 300ms ease-out both;
  }
  .reveal-item:nth-child(1) { animation-delay:   0ms; }
  .reveal-item:nth-child(2) { animation-delay:  70ms; }
  .reveal-item:nth-child(3) { animation-delay: 140ms; }
  .reveal-item:nth-child(4) { animation-delay: 210ms; }
  .reveal-item:nth-child(5) { animation-delay: 280ms; }
  .reveal-item:nth-child(6) { animation-delay: 350ms; }

  /* Terminal boot sequence — sequential line appearance */
  .boot-line {
    animation: boot-in 180ms ease-out both;
  }
  .boot-line:nth-child(1) { animation-delay:  400ms; }
  .boot-line:nth-child(2) { animation-delay:  560ms; }
  .boot-line:nth-child(3) { animation-delay:  720ms; }
  .boot-line:nth-child(4) { animation-delay:  880ms; }
  .boot-line:nth-child(5) { animation-delay: 1040ms; }
  .boot-line:nth-child(6) { animation-delay: 1200ms; }

  /* Nav link underline hover */
  .nav-link::after {
    width: 0;
    transition: width 150ms ease-out;
  }
  .nav-link:hover::after,
  .nav-link--active::after { width: 100%; }

  /* Card hover lift */
  .suite-card:hover { transform: translateY(-1px); }

  /* LIVE dot pulse */
  .live-dot {
    animation: live-pulse 2s ease-in-out infinite;
  }

  /* Metric value update dip */
  .metric-updating {
    animation: value-dip 150ms ease-out;
  }
}

/* Cursor visible even without animation */
.logo-cursor { font-weight: 400; }

/* ── Typography scale ───────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--c-text);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); margin-bottom: 1rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

p { max-width: 68ch; }

code, pre, .mono {
  font-family: var(--font-mono);
}

/* ── Container ───────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

/* ── Section ─────────────────────────────────────────────── */
.section {
  padding-block: var(--sp-7);
}

/* ── Page shell ──────────────────────────────────────────── */
.page {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.page-404 { justify-content: center; }

/* ── Site header ─────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-hairline);
  height: 56px;
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  height: 100%;
}

.site-header__logo {
  display: flex;
  align-items: baseline;
  gap: 0;
  text-decoration: none;
  color: var(--c-text);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.logo-word { color: var(--c-text); }
.logo-cursor { color: var(--c-amber); }

.logo-beta {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-amber);
  border: 1px solid var(--c-hairline);
  padding: 1px 5px;
  line-height: 1.5;
  align-self: center;
  flex-shrink: 0;
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  flex: 1;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--c-muted);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color var(--t-fast);
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--c-amber);
}

.nav-link:hover,
.nav-link--active {
  color: var(--c-text);
}

@media (prefers-reduced-motion: no-preference) {
  .nav-link { transition: color var(--t-fast), transform var(--t-fast); }
  .nav-link:hover { transform: translateY(-1px); }
}

/* ── Nav disclosure wrapper ───────────────────────────────────── */
/* Desktop: details is a transparent flex wrapper — summary hidden, nav always visible */
.nav-disclosure {
  display: flex;
  flex: 1;
  align-items: center;
}

.nav-disclosure > summary {
  display: none;
  list-style: none;
}

.nav-disclosure > summary::-webkit-details-marker { display: none; }

/* Force nav visible at desktop even when details is closed (UA hides non-summary in closed details) */
.nav-disclosure .site-header__nav {
  display: flex !important;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-inline-start: auto;
}

/* ── Theme toggle ─────────────────────────────────────────── */
.theme-toggle {
  background: none;
  border: 1px solid var(--c-hairline);
  border-radius: var(--r-btn);
  color: var(--c-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.875rem;
  transition: border-color var(--t-fast), color var(--t-fast);
}

.theme-toggle:hover {
  border-color: var(--c-amber);
  color: var(--c-amber);
}

/* ── Site footer ─────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--c-hairline);
  padding-block-start: var(--sp-7);
  margin-block-start: auto;
}

.site-footer__inner {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--sp-7);
  padding-block-end: var(--sp-7);
}

@media (max-width: 640px) {
  .site-footer__inner {
    grid-template-columns: 1fr;
  }
}

.site-footer__brand .logo-word { font-family: var(--font-mono); font-weight: 600; font-size: 1.125rem; }
.site-footer__tagline {
  margin-top: var(--sp-2);
  color: var(--c-muted);
  font-size: 0.8125rem;
  max-width: 32ch;
}

.site-footer__links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
}

@media (max-width: 480px) {
  .site-footer__links { grid-template-columns: 1fr 1fr; }
}

.site-footer__col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.site-footer__col-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-muted);
  margin-bottom: var(--sp-1);
}

.site-footer__col a {
  font-size: 0.8125rem;
  color: var(--c-muted);
}

.site-footer__col a:hover { color: var(--c-text); }

.site-footer__bottom {
  border-top: 1px solid var(--c-hairline);
  padding-block: var(--sp-4);
}

.site-footer__bottom .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.site-footer__copy {
  font-size: 0.75rem;
  color: var(--c-muted);
}

.site-footer__ascii {
  font-family: var(--font-mono);
  color: var(--c-hairline);
  font-size: 0.625rem;
  letter-spacing: 0.05em;
  overflow: hidden;
}

/* ── Terminal frame ───────────────────────────────────────── */
.terminal-frame {
  background: var(--c-surface);
  border: 1px solid var(--c-hairline);
  border-radius: var(--r-card);
  font-family: var(--font-mono);
  overflow: hidden;
}

.terminal-frame__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--c-hairline);
  font-size: 0.75rem;
  color: var(--c-muted);
}

.terminal-frame__tick {
  color: var(--c-hairline);
  flex-shrink: 0;
}

.terminal-frame__host {
  color: var(--c-amber);
  flex-shrink: 0;
}

.terminal-frame__rule {
  flex: 1;
  height: 1px;
  background: var(--c-hairline);
}

.terminal-frame__body {
  padding: var(--sp-4) var(--sp-5);
}

/* ── Prompt line ──────────────────────────────────────────── */
.prompt-line {
  margin-bottom: var(--sp-3);
}

.prompt-line__cmd {
  display: flex;
  align-items: baseline;
  gap: 0;
  font-size: 0.875rem;
}

.prompt-ps {
  color: var(--c-amber);
  user-select: none;
  flex-shrink: 0;
}

.prompt-command {
  color: var(--c-text);
  word-break: break-all;
}

.prompt-output {
  margin-top: var(--sp-2);
  padding-left: var(--sp-4);
}

.prompt-output__line {
  font-size: 0.8125rem;
  color: var(--c-muted);
  line-height: 1.7;
}

/* ── Code block ───────────────────────────────────────────── */
.code-block {
  background: var(--c-surface);
  border: 1px solid var(--c-hairline);
  border-radius: 0;
  overflow: hidden;
}

.code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--c-hairline);
}

.code-block__lang {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--c-muted);
  text-transform: lowercase;
  letter-spacing: 0.05em;
}

.code-block__body {
  overflow-x: auto;
  padding: var(--sp-4) var(--sp-5);
  font-size: 0.875rem;
  line-height: 1.65;
}

/* Override syntect's inline styles to respect our palette */
.code-block__body pre {
  background: transparent !important;
  margin: 0;
  padding: 0;
}

/* ── Metric tile ──────────────────────────────────────────── */
.metric-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-1);
}

.metric-tile__number {
  display: flex;
  align-items: baseline;
  gap: var(--sp-1);
}

.metric-tile__value {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  color: var(--c-amber);
  letter-spacing: -0.03em;
  line-height: 1;
}

.metric-tile__unit {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--c-muted);
  letter-spacing: 0.02em;
}

.metric-tile__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  max-width: none;
}

/* ── Stat row ─────────────────────────────────────────────── */
.stat-row {
  display: flex;
  gap: var(--sp-7);
  flex-wrap: wrap;
}

/* Divider between stat tiles */
.stat-row > .metric-tile + .metric-tile {
  padding-left: var(--sp-7);
  border-left: 1px solid var(--c-hairline);
}

@media (max-width: 480px) {
  .stat-row > .metric-tile + .metric-tile {
    padding-left: 0;
    border-left: none;
  }
  /* 2×2 grid — prevents asymmetric 3+1 wrap */
  .stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
  }
}

/* ── Status badge ─────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--c-muted);
  white-space: nowrap;
}

.status-badge__led { font-size: 0.5rem; }

.status-badge--shipped .status-badge__led { color: var(--c-ok); }
.status-badge--shipped { color: var(--c-ok); }

.status-badge--usable .status-badge__led { color: var(--c-amber); }
.status-badge--usable { color: var(--c-amber); }

.status-badge--wip .status-badge__led { color: var(--c-warn); }
.status-badge--wip { color: var(--c-warn); }

.status-badge--stub .status-badge__led { color: var(--c-muted); }

/* ── Suite card ───────────────────────────────────────────── */
.suite-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border: 1px solid var(--c-hairline);
  border-radius: var(--r-card);
  padding: var(--sp-5);
  transition: border-color var(--t-fast);
}

.suite-card:hover {
  border-color: var(--c-amber);
}

/* Blueprint corner ticks */
.suite-card::before,
.suite-card::after {
  content: '+';
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--c-amber);
  opacity: 0;
  transition: opacity var(--t-fast);
  line-height: 1;
}

.suite-card:hover::before { opacity: 0.5; }
.suite-card:hover::after  { opacity: 0.5; }
.suite-card::before { top: 3px;    left: 6px;  }
.suite-card::after  { bottom: 3px; right: 6px; }

.suite-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.suite-card__name {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--c-text);
  letter-spacing: -0.01em;
}

.suite-card__desc {
  font-size: 0.875rem;
  color: var(--c-muted);
  line-height: 1.55;
  margin-bottom: var(--sp-4);
}

.suite-card__link {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--c-amber);
  text-decoration: none;
  margin-top: auto;
}

.suite-card__link:hover { text-decoration: underline; }

/* ── Feature card ─────────────────────────────────────────── */
.feature-card {
  padding: var(--sp-5) 0;
  border-top: 1px solid var(--c-hairline);
}

.feature-card__title {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: var(--sp-2);
}

.feature-card__body {
  font-size: 0.875rem;
  color: var(--c-muted);
  line-height: 1.6;
}

/* ── Callout ──────────────────────────────────────────────── */
.callout {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-card);
  border-left: 3px solid;
  background: var(--c-surface);
  font-size: 0.875rem;
  max-width: 70ch;
}

.callout--note { border-color: var(--c-amber); }
.callout--warn { border-color: var(--c-rust);  }

.callout__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-muted);
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: 2px;
}

.callout--note .callout__label { color: var(--c-amber); }
.callout--warn .callout__label { color: var(--c-rust);  }

.callout__body { color: var(--c-text); }

/* ── Button ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 9px 20px;
  border-radius: var(--r-btn);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.btn--solid {
  background: var(--c-amber);
  color: var(--c-bg);
  border-color: var(--c-amber);
}

.btn--solid:hover {
  background: color-mix(in srgb, var(--c-amber) 92%, black);
  color: var(--c-bg);
  border-color: color-mix(in srgb, var(--c-amber) 92%, black);
}

.btn--outline {
  background: transparent;
  color: var(--c-amber);
  border-color: var(--c-amber);
}

.btn--outline:hover {
  background: color-mix(in srgb, var(--c-amber) 12%, transparent);
  color: var(--c-amber);
  border-color: var(--c-amber);
}

.btn--ghost {
  background: transparent;
  color: var(--c-muted);
  border-color: transparent;
  padding-inline: 4px;
}

.btn--ghost:hover { color: var(--c-text); }

/* ── Tag ──────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border: 1px solid var(--c-hairline);
  border-radius: 1px;
  color: var(--c-muted);
  text-transform: lowercase;
}

/* ── Keyboard key ─────────────────────────────────────────── */
.kbd-key {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 1px 6px;
  background: var(--c-surface);
  border: 1px solid var(--c-hairline);
  border-bottom-width: 2px;
  border-radius: 2px;
  color: var(--c-text);
}

/* ── ASCII divider ────────────────────────────────────────── */
.ascii-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-block: var(--sp-5);
  overflow: hidden;
}

.ascii-divider__rule {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--c-hairline);
  letter-spacing: 0.1em;
  white-space: nowrap;
  overflow: hidden;
  flex: 1;
}

.ascii-divider--labeled .ascii-divider__rule { flex: none; }

.ascii-divider__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--c-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ── Prose article ────────────────────────────────────────── */
.prose {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--c-text);
  max-width: 70ch;
  margin-inline: 0;
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--font-display);
  margin-top: var(--sp-7);
  margin-bottom: var(--sp-3);
}

.prose h1 { font-size: 2rem; }
.prose h2 { font-size: 1.5rem; border-bottom: 1px solid var(--c-hairline); padding-bottom: var(--sp-2); }
.prose h3 { font-size: 1.125rem; }

.prose p  { margin-bottom: var(--sp-4); }

.prose a {
  color: var(--c-amber);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
}

.prose a:hover { text-decoration-color: var(--c-amber); }

.prose ul, .prose ol {
  padding-left: var(--sp-5);
  margin-bottom: var(--sp-4);
}

.prose li { margin-bottom: var(--sp-2); }

.prose blockquote {
  border-left: 3px solid var(--c-rust);
  padding-left: var(--sp-4);
  margin-left: 0;
  color: var(--c-muted);
  font-style: italic;
  margin-bottom: var(--sp-4);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--c-surface);
  border: 1px solid var(--c-hairline);
  padding: 1px 5px;
  border-radius: 1px;
}

.prose pre {
  background: var(--c-surface) !important;
  border: 1px solid var(--c-hairline);
  border-left: 3px solid var(--c-amber);
  padding: var(--sp-4) var(--sp-5);
  overflow-x: auto;
  margin-bottom: var(--sp-4);
  border-radius: 0;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
}

.prose table {
  display: block;
  overflow-x: auto;
  width: max-content;
  max-width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--sp-4);
  font-size: 0.875rem;
}

.prose th, .prose td {
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--c-hairline);
}

.prose th {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--c-muted);
}

/* ── Home hero ────────────────────────────────────────────── */
.hero {
  padding-block: var(--sp-9) var(--sp-8);
  border-bottom: 1px solid var(--c-hairline);
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--c-amber);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--sp-4);
}

.hero__headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.25rem, 6vw, 4rem);
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--c-text);
  margin-bottom: var(--sp-5);
  max-width: 22ch;
}

.hero__sub {
  font-size: 1.0625rem;
  color: var(--c-muted);
  line-height: 1.65;
  margin-bottom: var(--sp-6);
  max-width: 60ch;
}

.hero__actions {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}

.hero__beta-note {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--c-muted);
  margin-bottom: var(--sp-8);
  line-height: 1.55;
}

.hero__beta-note a {
  color: var(--c-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hero__terminal {
  margin-bottom: var(--sp-6);
  max-width: 52rem;
}

.hero__stats {
  padding-top: var(--sp-4);
  border-top: 1px solid var(--c-hairline);
}

/* ── Suite grid ───────────────────────────────────────────── */
.suite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-5);
}

/* ── Styleguide page ──────────────────────────────────────── */
.sg-section {
  margin-bottom: var(--sp-8);
}

.sg-section h2 {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-amber);
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--c-hairline);
}

.sg-palette {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.sg-swatch {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.sg-swatch__color {
  width: 64px;
  height: 48px;
  border-radius: var(--r-card);
  border: 1px solid var(--c-hairline);
}

.sg-swatch__hex {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--c-muted);
}

.sg-swatch__name {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--c-text);
}

.sg-type-row {
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--c-hairline);
}

.sg-type-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--c-muted);
  margin-top: var(--sp-2);
}

.sg-component-row {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--sp-4);
}

/* ── Misc page stubs ─────────────────────────────────────── */
.page-stub {
  padding-block: var(--sp-8);
}

.page-stub h1 {
  margin-bottom: var(--sp-4);
}

.page-stub p {
  color: var(--c-muted);
}

/* ── Blog list ────────────────────────────────────────────── */
.blog-page__heading {
  margin-bottom: var(--sp-6);
}

.post-list {
  list-style: none;
}

.post-entry {
  padding-block: var(--sp-5);
  border-bottom: 1px solid var(--c-hairline);
}

.post-entry:first-child {
  border-top: 1px solid var(--c-hairline);
}

.post-entry__title {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
  text-decoration: none;
  color: var(--c-text);
  margin-bottom: var(--sp-2);
  transition: color var(--t-fast);
}

.post-entry__title:hover {
  color: var(--c-amber);
}

.post-entry__meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.post-entry__date {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--c-muted);
  letter-spacing: 0.03em;
}

.post-entry__author {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--c-muted);
  letter-spacing: 0.03em;
}

.post-entry__desc {
  font-size: 0.9375rem;
  color: var(--c-muted);
  line-height: 1.6;
}

/* ── Mobile header (≤720px) ───────────────────────────────── */
@media (max-width: 720px) {
  .site-header {
    height: auto;
    min-height: 56px;
  }

  .site-header__inner {
    flex-wrap: wrap;
    height: auto;
    padding-block: var(--sp-2);
    gap: var(--sp-2);
  }

  /* Keep logo (order 1 default) and actions on the same first row */
  .site-header__actions {
    order: 2;
    margin-inline-start: auto;
  }

  /* Nav disclosure wraps to a full-width second row at 601-720px */
  .nav-disclosure {
    order: 3;
    flex: 0 0 100%;
  }

  .nav-disclosure .site-header__nav {
    gap: var(--sp-3);
    flex-wrap: wrap;
  }
}

/* ── Mobile nav disclosure (≤600px) ──────────────────────── */
/* Replace two-row nav with CSS-only hamburger disclosure.    */
@media (max-width: 600px) {
  /* Reset second-row wrapping — disclosure becomes a compact item in the first row */
  .site-header__inner {
    flex-wrap: nowrap;
  }

  .nav-disclosure {
    order: initial;
    flex: 0 0 auto;
  }

  /* Show hamburger toggle */
  .nav-disclosure > summary {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--c-muted);
    padding: var(--sp-1) var(--sp-2);
    border: 1px solid var(--c-hairline);
    border-radius: var(--r-btn);
    user-select: none;
    transition: color var(--t-fast), border-color var(--t-fast);
    line-height: 1;
    min-width: 32px;
    min-height: 32px;
  }

  .nav-disclosure > summary:hover {
    color: var(--c-amber);
    border-color: var(--c-amber);
  }

  .nav-disclosure > summary:focus-visible {
    outline: 2px solid var(--c-amber);
    outline-offset: 2px;
  }

  /* Hide nav by default (closed disclosure) */
  .nav-disclosure .site-header__nav {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    flex: initial !important;
    background: var(--c-bg);
    border-bottom: 1px solid var(--c-hairline);
    padding: var(--sp-3) var(--sp-5);
    z-index: 200;
    gap: 0 !important;
  }

  /* Show nav when open */
  .nav-disclosure[open] .site-header__nav {
    display: flex !important;
  }

  /* Larger tap targets for links in the dropdown (≥44px hit area) */
  .nav-disclosure[open] .nav-link {
    display: block;
    padding-block: var(--sp-3);
    border-bottom: 1px solid var(--c-hairline);
  }
  .nav-disclosure[open] .nav-link:last-child {
    border-bottom: none;
  }

  /* No horizontal overflow from nav at this size */
  .site-header__inner {
    overflow: visible;
  }
}

/* ── Secondary nav links — wrap naturally on small screens ──── */
/* (no display:none — all six links remain accessible via flex-wrap) */

/* ── Page-intro (replaces .hero on platform overview) ─────────── */
.page-intro {
  padding-block: var(--sp-7) var(--sp-5);
  border-bottom: 1px solid var(--c-hairline);
}

/* ── Suite grid — 6-col base: first 3 cards span 2, last 2 span 3 ─ */
.page-home .suite-grid {
  grid-template-columns: repeat(6, 1fr);
}

.page-home .suite-grid > *:nth-child(-n+3) {
  grid-column: span 2;
}

.page-home .suite-grid > *:nth-child(n+4) {
  grid-column: span 3;
}

@media (max-width: 768px) {
  .page-home .suite-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .page-home .suite-grid > *:nth-child(-n+3),
  .page-home .suite-grid > *:nth-child(n+4) {
    grid-column: span 1;
  }
}

@media (max-width: 480px) {
  .page-home .suite-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Post navigation ──────────────────────────────────────────── */
.post-nav {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: var(--sp-7);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--c-hairline);
}

.post-nav__prev { flex: 1; }
.post-nav__next { flex: 1; text-align: right; }

.post-nav__link {
  display: inline-flex;
  flex-direction: column;
  gap: var(--sp-1);
  text-decoration: none;
}

.post-nav__dir {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--c-muted);
}

.post-nav__title {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--c-amber);
  transition: text-decoration-color var(--t-fast);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.post-nav__link:hover .post-nav__title {
  text-decoration-color: var(--c-amber);
}

.post-back {
  margin-top: var(--sp-5);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

/* ── Post header ──────────────────────────────────────────────── */
.post-header {
  margin-bottom: var(--sp-7);
}

.post-header__title {
  margin-bottom: var(--sp-3);
}

.post-header__meta {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--c-muted);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.post-header__tags {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ── Draft badge ──────────────────────────────────────────────── */
.draft-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border: 1px solid var(--c-warn);
  border-radius: 1px;
  color: var(--c-warn);
  text-transform: uppercase;
  margin-bottom: var(--sp-3);
}

/* ── LIVE indicator dot ───────────────────────────────────────── */
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-ok);
  vertical-align: middle;
  margin-right: var(--sp-1);
}

/* ── Blog list spacing — reduce dead zone when few posts exist ── */
.page-blog .section {
  padding-block: var(--sp-6) var(--sp-5);
}

/* ── Light-theme: code blocks keep dark treatment for readability ── */
/* syntect emits inline colors tuned for the dark palette; keep code
   block background dark so syntax colors remain legible in light mode.
   Inline code spans (.prose code) stay light-palette styled via the
   base .prose code rule above.                                        */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .prose pre {
    background: #1D1710 !important;
    border-color: #382E20;
    border-left-color: var(--c-amber);
  }
}
:root[data-theme="light"] .prose pre {
  background: #1D1710 !important;
  border-color: #382E20;
  border-left-color: var(--c-amber);
}

/* ── Theme transition — applied temporarily by island ─────────── */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition:
    background-color 200ms ease-out,
    color            200ms ease-out,
    border-color     200ms ease-out !important;
}

/* ── Plumbing comparison table ─────────────────────────────────── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.plumbing-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.plumbing-table th {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-muted);
  text-align: left;
  padding: var(--sp-2) var(--sp-4) var(--sp-2) 0;
  border-bottom: 1px solid var(--c-hairline);
  white-space: nowrap;
}

.plumbing-table td {
  padding: var(--sp-3) var(--sp-4) var(--sp-3) 0;
  border-bottom: 1px solid var(--c-hairline);
  vertical-align: top;
  color: var(--c-muted);
  line-height: 1.5;
}

.plumbing-table td:first-child {
  color: var(--c-text);
  font-weight: 600;
  white-space: nowrap;
  padding-right: var(--sp-5);
}

.plumbing-table .soma-col {
  color: var(--c-amber);
}

.plumbing-aggregate {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--c-muted);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--c-hairline);
  margin-top: 0;
  line-height: 1.6;
}

.plumbing-caveat {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--c-muted);
  margin-top: var(--sp-3);
  line-height: 1.65;
  max-width: 80ch;
  opacity: 0.75;
}

.plumbing-caveat a {
  color: var(--c-muted);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
}

.plumbing-caveat a:hover {
  text-decoration-color: var(--c-muted);
}
