/* ============================================================
   CommSim distribution site — calm, black-based theme
   ============================================================ */

:root {
  --bg:        #0a0a0b;
  --bg-alt:    #101013;
  --surface:   #16161a;
  --surface-2: #1d1d22;
  --border:    #26262c;
  --border-2:  #34343c;

  --text:      #e7e7ea;
  --text-dim:  #a1a1aa;
  --text-mute: #6b6b75;

  --accent:      #5ed3c4;   /* muted teal */
  --accent-soft: #7fe0d4;
  --accent-dim:  rgba(94, 211, 196, 0.12);

  --rx: #7fb8ff;
  --tx: #5ed3c4;
  --sys: #c2a3ff;
  --tag: #f0b67f;

  --radius:    14px;
  --radius-sm: 10px;
  --maxw:      1120px;

  --font: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "Consolas", "SFMono-Regular", ui-monospace, monospace;

  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

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

/* Subtle radial glow at top */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 70% -10%, rgba(94, 211, 196, 0.07), transparent 60%),
    radial-gradient(700px 400px at 10% 0%, rgba(127, 184, 255, 0.05), transparent 55%);
  z-index: 0;
}

main, .site-header, .site-footer { position: relative; z-index: 1; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-soft); }

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.98rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-sm { padding: 9px 16px; font-size: 0.88rem; }

.btn-primary {
  background: var(--accent);
  color: #06201d;
}
.btn-primary:hover { background: var(--accent-soft); color: #06201d; }
.btn-primary .btn-sub {
  font-weight: 500;
  font-size: 0.78rem;
  opacity: 0.7;
  padding-left: 10px;
  margin-left: 2px;
  border-left: 1px solid rgba(6, 32, 29, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-2);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-soft); }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 11, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.brand:hover { color: var(--text); }
.brand-text { font-size: 1.12rem; white-space: nowrap; }
@media (max-width: 480px) { .brand-text { font-size: 0.98rem; } }
@media (max-width: 380px) { .brand-text { font-size: 0.9rem; } }

.site-nav {
  display: flex;
  gap: 28px;
  margin-left: auto;
}
.site-nav a {
  color: var(--text-dim);
  font-size: 0.94rem;
  font-weight: 500;
}
.site-nav a:hover { color: var(--text); }
.nav-cta { margin-left: 4px; }

/* ===== Hero ===== */
.hero { padding: 96px 0 64px; }
.hero-inner { text-align: center; max-width: 820px; margin: 0 auto 56px; }

.eyebrow {
  display: inline-block;
  margin: 0 0 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent-soft);
  background: var(--accent-dim);
  border: 1px solid rgba(94, 211, 196, 0.2);
  border-radius: 999px;
}
.hero-title {
  margin: 0 0 24px;
  font-size: clamp(2.1rem, 5.2vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.hero-lead {
  margin: 0 auto 36px;
  max-width: 640px;
  font-size: 1.12rem;
  color: var(--text-dim);
}
.hero-lead strong { color: var(--text); font-weight: 600; }

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-meta {
  margin-top: 22px;
  font-size: 0.86rem;
  color: var(--text-mute);
}

/* ===== Hero mock window ===== */
.hero-window {
  max-width: 940px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.hw-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.hw-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: #3a3a42;
}
.hw-dot:nth-child(1) { background: #e06c5a; }
.hw-dot:nth-child(2) { background: #e0b15a; }
.hw-dot:nth-child(3) { background: #6cc06c; }
.hw-title {
  margin-left: 12px;
  font-size: 0.82rem;
  color: var(--text-mute);
  font-family: var(--mono);
}
.hw-body { display: flex; min-height: 280px; }
.hw-side {
  width: 230px;
  flex-shrink: 0;
  padding: 14px 10px;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
}
.hw-session {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.84rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.hw-session.active { background: var(--surface-2); color: var(--text); }
.hw-led {
  width: 8px; height: 8px; border-radius: 50%;
  background: #44444c; flex-shrink: 0;
}
.hw-led.on {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.hw-log {
  flex: 1;
  padding: 16px 18px;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.85;
  overflow: hidden;
  text-align: left;
}
.hw-log p { margin: 0; white-space: pre; color: var(--text-dim); }
.l-ts { color: var(--text-mute); }
.l-rx { color: var(--rx); }
.l-tx { color: var(--tx); }
.l-sys { color: var(--sys); }
.l-tag {
  color: var(--tag);
  font-size: 0.72rem;
  background: rgba(240, 182, 127, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ===== Sections ===== */
.section { padding: 88px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-head { text-align: center; max-width: 640px; margin: 0 auto 52px; }
.section-head h2 {
  margin: 0 0 12px;
  font-size: clamp(1.7rem, 3.5vw, 2.3rem);
  font-weight: 700;
}
.section-head p { margin: 0; color: var(--text-dim); font-size: 1.05rem; }

/* ===== Feature grid ===== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.card:hover {
  border-color: var(--border-2);
  transform: translateY(-3px);
  background: var(--surface-2);
}
.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  margin-bottom: 18px;
  font-size: 1.3rem;
  color: var(--accent-soft);
  background: var(--accent-dim);
  border-radius: 11px;
}
.card h3 { margin: 0 0 10px; font-size: 1.12rem; }
.card p { margin: 0; color: var(--text-dim); font-size: 0.95rem; }

/* ===== Modes ===== */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}
.mode-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 30px 24px;
}
.mode-card h3 {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 14px;
  font-size: 1.3rem;
}
.mode-num {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 10px;
  border-radius: 8px;
}
.mode-card p { margin: 0 0 18px; color: var(--text-dim); }
.diagram {
  margin: 0;
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent-soft);
  white-space: pre;
  overflow-x: auto;
}

/* ===== Mode capability list (landing) ===== */
.mode-card .relay-diagram { margin: 18px 0 4px; }
.mode-can { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 9px; }
.mode-can li { position: relative; padding-left: 26px; color: var(--text-dim); font-size: 0.94rem; }
.mode-can li::before { content: "✓"; position: absolute; left: 2px; top: 0; color: var(--accent); font-weight: 700; }
.mode-can strong { color: var(--text); font-weight: 600; }
.mode-card .mode-when {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--border-2);
  font-size: 0.88rem;
  color: var(--text-mute);
}
.mode-card .mode-when strong { color: var(--accent-soft); font-weight: 600; margin-right: 8px; }

/* ===== CTA band (landing) ===== */
.cta-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 40px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.cta-band .cta-text h2 { margin: 0 0 6px; font-size: 1.5rem; }
.cta-band .cta-text p { margin: 0; color: var(--text-dim); }
@media (max-width: 560px) { .cta-band { flex-direction: column; align-items: flex-start; padding: 26px 24px; } }

/* ===== Download page blocks ===== */
.container.narrow { max-width: 760px; }
.block-title { margin: 40px 0 14px; font-size: 1.35rem; }
.block-title:first-child { margin-top: 0; }
.block-lead { margin: 0 0 16px; color: var(--text-dim); }

/* ===== Steps ===== */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.step {
  display: flex;
  gap: 16px;
  padding: 26px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.step-num {
  flex-shrink: 0;
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #06201d;
  background: var(--accent);
  border-radius: 50%;
}
.step h3 { margin: 4px 0 8px; font-size: 1.08rem; }
.step p { margin: 0; color: var(--text-dim); font-size: 0.94rem; }

/* ===== Gallery / screenshots ===== */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}
.shot { margin: 0; }
.shot-wide { grid-column: span 2; }
.shot-link {
  display: block;
  position: relative;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  aspect-ratio: 16 / 9;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.shot-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.shot-link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
}
/* Placeholder shown when the screenshot image fails to load */
.shot-placeholder {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: var(--text-mute);
  font-size: 1.05rem;
  font-weight: 600;
  background:
    repeating-linear-gradient(45deg, var(--surface) 0 14px, var(--surface-2) 14px 28px);
}
.shot-placeholder small {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-mute);
  opacity: 0.7;
}
.shot-link.is-missing img { display: none; }
.shot-link.is-missing .shot-placeholder { display: flex; }
.shot figcaption {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--text-dim);
  text-align: center;
}

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(5, 5, 6, 0.9);
  backdrop-filter: blur(4px);
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow);
}
.lightbox-close {
  position: absolute;
  top: 24px; right: 28px;
  width: 44px; height: 44px;
  font-size: 1.6rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
}
.lightbox-close:hover { border-color: var(--accent); }

/* ===== Download ===== */
.download-latest {
  max-width: 720px;
  margin: 0 auto 22px;
  padding: 34px 36px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.dl-loading { text-align: center; color: var(--text-mute); margin: 0; }

.dl-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px 24px;
}
.dl-version-block { flex: 1; min-width: 220px; }
.dl-badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-soft);
  background: var(--accent-dim);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.dl-version { font-size: 1.5rem; font-weight: 700; }
.dl-version small { font-size: 0.92rem; font-weight: 500; color: var(--text-mute); margin-left: 10px; }
.dl-meta { margin: 6px 0 0; font-size: 0.86rem; color: var(--text-mute); }
.dl-meta .dot { margin: 0 8px; opacity: 0.5; }

.dl-notes {
  margin: 22px 0 0;
  padding: 18px 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.dl-notes h4 { margin: 0 0 8px; font-size: 0.82rem; letter-spacing: 0.04em; color: var(--text-dim); text-transform: uppercase; }
.dl-notes ul { margin: 0; padding-left: 18px; color: var(--text-dim); font-size: 0.92rem; }
.dl-notes li { margin: 3px 0; }

.dl-sha {
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text-mute);
  word-break: break-all;
}

.dl-requirements {
  max-width: 720px;
  margin: 26px auto 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-mute);
}

/* ===== Version history ===== */
.version-history {
  max-width: 720px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.version-history summary {
  cursor: pointer;
  padding: 16px 22px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-dim);
  list-style: none;
}
.version-history summary::-webkit-details-marker { display: none; }
.version-history summary::before { content: "▸ "; color: var(--accent); }
.version-history[open] summary::before { content: "▾ "; }
.version-history summary:hover { color: var(--text); }

.version-list { border-top: 1px solid var(--border); }
.version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}
.version-row:last-child { border-bottom: none; }
.vr-info { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.vr-version { font-weight: 600; font-family: var(--mono); }
.vr-date { font-size: 0.84rem; color: var(--text-mute); }
.vr-size { font-size: 0.84rem; color: var(--text-mute); }

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 40px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-tagline { margin: 8px 0 0; font-size: 0.86rem; color: var(--text-mute); }
.footer-nav { display: flex; gap: 22px; }
.footer-nav a { color: var(--text-dim); font-size: 0.9rem; }
.footer-nav a:hover { color: var(--text); }
.footer-copy { margin: 0; font-size: 0.85rem; color: var(--text-mute); }

/* ===== Mobile nav (hamburger) ===== */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 40px;
  margin-left: auto;
  padding: 0 11px;
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: 9px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 100%; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  display: none;
  flex-direction: column;
  padding: 8px 24px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 11, 0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  padding: 13px 6px;
  color: var(--text-dim);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.mobile-menu a:hover { color: var(--text); }
.mobile-menu .btn { margin-top: 14px; justify-content: center; }
.mobile-menu .btn:hover { color: #06201d; }
@media (min-width: 861px) {
  .mobile-menu { display: none !important; }
}

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .site-nav { display: none; }
  .nav-cta { display: none; }
  .nav-toggle { display: flex; }
}
@media (max-width: 680px) {
  .feature-grid { grid-template-columns: 1fr; }
  .modes-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr; }
  .shot-wide { grid-column: span 1; }
  .hw-side { display: none; }
  .hero { padding: 64px 0 48px; }
  .section { padding: 64px 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; transition: none !important; }
}

/* ============================================================
   Sub-pages (features / guide) — documentation layout
   ============================================================ */

.subhero {
  padding: 64px 0 36px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-mute);
  margin: 0 0 16px;
}
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--accent-soft); }
.subhero h1 {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  font-weight: 700;
}
.subhero p {
  margin: 0;
  max-width: 680px;
  color: var(--text-dim);
  font-size: 1.08rem;
}

/* Page layout: sticky TOC + content */
.doc-layout {
  display: grid;
  grid-template-columns: 232px 1fr;
  gap: 48px;
  padding: 48px 0 88px;
  align-items: start;
}
.toc {
  position: sticky;
  top: 84px;
  font-size: 0.9rem;
}
.toc h2 {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin: 0 0 12px;
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 2px 0; }
.toc a {
  display: block;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-dim);
  border-left: 2px solid transparent;
}
.toc a:hover { background: var(--surface); color: var(--text); }
.toc a.active { color: var(--accent-soft); border-left-color: var(--accent); background: var(--surface); }

.doc { min-width: 0; max-width: 760px; }
.doc-section { padding-top: 28px; margin-bottom: 44px; }
.doc-section:first-child { padding-top: 0; }
.doc-section > h2 {
  font-size: 1.6rem;
  margin: 0 0 6px;
  scroll-margin-top: 84px;
}
.doc-section > .lead {
  color: var(--text-dim);
  font-size: 1.02rem;
  margin: 0 0 22px;
}
.doc h3 {
  font-size: 1.12rem;
  margin: 30px 0 12px;
  color: var(--text);
}
.doc p { color: var(--text-dim); }
.doc ul, .doc ol { color: var(--text-dim); padding-left: 22px; }
.doc li { margin: 5px 0; }
.doc strong { color: var(--text); font-weight: 600; }
.doc a:not(.btn) { color: var(--accent); }

/* inline code + code blocks */
.doc code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--accent-soft);
}
.doc pre {
  margin: 16px 0;
  padding: 16px 18px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
.doc pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.7;
}

/* doc tables */
.dtable {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.9rem;
}
.dtable th, .dtable td {
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.dtable thead th {
  color: var(--text);
  font-weight: 600;
  border-bottom: 1px solid var(--border-2);
  background: var(--surface);
}
.dtable td { color: var(--text-dim); }
.dtable tbody tr:hover { background: var(--surface); }
.dtable code { white-space: nowrap; }

/* callout / note box */
.callout {
  margin: 18px 0;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  font-size: 0.92rem;
  color: var(--text-dim);
}
.callout.warn { border-left-color: var(--tag); }
.callout strong { color: var(--text); }

/* recipe card */
.recipe {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 22px 24px;
  margin: 18px 0;
}
.recipe h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.recipe .tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-soft);
  background: var(--accent-dim);
  padding: 2px 9px;
  border-radius: 999px;
}
.recipe p { margin: 0 0 12px; font-size: 0.94rem; }

/* inline screenshot in docs */
.doc-figure { margin: 22px 0; }
.doc-figure a {
  display: block;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.doc-figure a:hover { border-color: var(--accent); }
.doc-figure img { display: block; width: 100%; }
.doc-figure figcaption {
  margin-top: 10px;
  font-size: 0.86rem;
  color: var(--text-mute);
  text-align: center;
}

/* "more" link on landing sections */
.section-more { text-align: center; margin-top: 36px; }
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.98rem;
}
.link-arrow::after { content: "→"; transition: transform 0.15s ease; }
.link-arrow:hover::after { transform: translateX(3px); }

.doc-cta {
  margin-top: 18px;
  padding: 22px 24px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.doc-cta p { margin: 0; color: var(--text-dim); }
.doc-cta strong { color: var(--text); }

@media (max-width: 880px) {
  .doc-layout { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
}

/* ============================================================
   Expressive components (used on feature / guide pages)
   ============================================================ */

/* reveal-on-scroll */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* pill / mini-cards grid for enumerations (triggers, steps, ...) */
.pill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.pillcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.pillcard:hover { border-color: var(--border-2); transform: translateY(-2px); }
.pillcard .pc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--accent-dim);
  color: var(--accent-soft);
  font-size: 1rem;
  margin-bottom: 10px;
}
.pillcard h4 { margin: 0 0 4px; font-size: 0.98rem; color: var(--text); }
.pillcard p { margin: 0; font-size: 0.86rem; color: var(--text-dim); }
.pillcard code { font-size: 0.82em; }

/* byte-frame diagram */
.frame {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 18px 0;
  padding: 18px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
}
.byte {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  font-size: 0.84rem;
  color: var(--text);
  min-width: 56px;
  flex: 1 0 auto;
}
.byte small {
  font-family: var(--font);
  font-size: 0.68rem;
  color: var(--text-mute);
  letter-spacing: 0.02em;
}
.byte.b-sync { border-color: rgba(127,184,255,0.5); color: var(--rx); }
.byte.b-key  { border-color: rgba(94,211,196,0.5); color: var(--accent-soft); }
.byte.b-len  { border-color: rgba(240,182,127,0.5); color: var(--tag); }
.byte.b-pay  { background: var(--surface); }
.byte.b-crc  { border-color: rgba(194,163,255,0.5); color: var(--sys); }
.byte.grow   { flex: 3 1 auto; }

/* vertical flow / pipeline */
.flow { list-style: none; counter-reset: flow; margin: 18px 0; padding: 0; }
.flow > li {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 0 0 22px 0;
}
.flow > li::before {
  counter-increment: flow;
  content: counter(flow);
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
  color: #06201d; background: var(--accent);
  border-radius: 50%;
  z-index: 1;
}
.flow > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 15px; top: 32px; bottom: 0;
  width: 2px;
  background: var(--border-2);
}
.flow .flow-body { padding-top: 4px; }
.flow h4 { margin: 0 0 4px; font-size: 1rem; color: var(--text); }
.flow p { margin: 0; font-size: 0.92rem; color: var(--text-dim); }
.flow .branch {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  margin-top: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent-soft);
}
.flow .branch.alt { background: rgba(240,182,127,0.12); color: var(--tag); }

/* horizontal mode diagram */
.relay-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0;
  padding: 22px 18px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.rd-node {
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}
.rd-node.accent { border-color: var(--accent); color: var(--accent-soft); }
.rd-node small { display: block; font-weight: 400; font-size: 0.72rem; color: var(--text-mute); margin-top: 2px; }
.rd-arrow { color: var(--text-mute); font-size: 1.1rem; }

/* code block with copy button */
.code-block { position: relative; }
.code-block .copy-btn {
  position: absolute;
  top: 8px; right: 8px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-family: var(--font);
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.code-block:hover .copy-btn { opacity: 1; }
.code-block .copy-btn:hover { color: var(--accent-soft); border-color: var(--accent); }
.code-block .copy-btn.done { color: var(--accent); border-color: var(--accent); }

/* inline chips */
.chip-line { display: inline-flex; flex-wrap: wrap; gap: 6px; vertical-align: middle; }
.chip {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-dim);
}
.chip-rx { color: var(--rx); border-color: rgba(127,184,255,0.4); }
.chip-tx { color: var(--tx); border-color: rgba(94,211,196,0.4); }
.chip-sys { color: var(--sys); border-color: rgba(194,163,255,0.4); }
.chip-err { color: #f08a7f; border-color: rgba(240,138,127,0.4); }
.chip-proxy { color: var(--tag); border-color: rgba(240,182,127,0.4); }

/* recipe step list (replaces raw pre for multi-step) */
.steps-mini { list-style: none; margin: 12px 0 0; padding: 0; counter-reset: sm; }
.steps-mini li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px dashed var(--border);
  font-size: 0.9rem;
  color: var(--text-dim);
}
.steps-mini li:first-child { border-top: none; }
.steps-mini .sm-kind {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent-soft);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 6px;
  min-width: 92px;
  text-align: center;
}
.steps-mini code { background: none; border: none; padding: 0; color: var(--text); }

/* recipe grid */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 16px;
  margin: 18px 0;
}
.recipe-grid .recipe { margin: 0; }
.recipe .can {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin: 0 0 12px;
}
.recipe .can b { color: var(--accent-soft); font-weight: 600; }

/* scenario-first recipe (when → how) */
.recipe .when {
  font-size: 0.92rem;
  color: var(--text);
  margin: 0 0 14px;
  padding: 12px 14px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}
.recipe .when-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-soft);
  margin-bottom: 4px;
}
.recipe .how-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-mute);
  margin: 0 0 6px;
}

/* sample cards (purpose / config / features) */
.sample {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin: 22px 0;
}
.sample-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 6px;
}
.sample-head h3 { margin: 0; font-size: 1.2rem; }
.sample-purpose { color: var(--text-dim); margin: 8px 0 18px; font-size: 0.96rem; }
.sample-purpose b { color: var(--text); font-weight: 600; }
.sample-figure { margin: 0 0 18px; border: 1px solid var(--border-2); border-radius: var(--radius); overflow: hidden; display: block; }
.sample-figure:hover { border-color: var(--accent); }
.sample-figure img { display: block; width: 100%; }
.sample-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.sample-row h4 {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em;
  color: var(--text-mute); margin: 0 0 8px;
}
.sample-row ul { margin: 0; padding-left: 18px; font-size: 0.9rem; color: var(--text-dim); }
.sample-row ul li { margin: 4px 0; }
@media (max-width: 680px) { .sample-rows { grid-template-columns: 1fr; } }

/* sequence (communication flow) */
.seq { list-style: none; margin: 18px 0; padding: 0; }
.seq li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin: 4px 0;
  background: var(--surface);
  border: 1px solid var(--border);
}
.seq .dir {
  flex-shrink: 0;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.8rem;
  width: 96px;
}
.seq li.tx { border-left: 3px solid var(--tx); }
.seq li.rx { border-left: 3px solid var(--rx); }
.seq li.sys { border-left: 3px solid var(--sys); }
.seq li.tx .dir { color: var(--tx); }
.seq li.rx .dir { color: var(--rx); }
.seq li.sys .dir { color: var(--sys); }
.seq .msg { color: var(--text-dim); }
.seq .msg code { font-size: 0.82em; }
.seq .note { color: var(--text-mute); font-size: 0.82rem; margin-left: auto; padding-left: 12px; }

/* sample index cards (landing) */
.sample-index { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 22px 0; }
.sample-link {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.sample-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.sample-link h3 { margin: 0 0 6px; font-size: 1.1rem; color: var(--text); }
.sample-link p { margin: 10px 0 0; font-size: 0.9rem; color: var(--text-dim); }
.sample-link .go { display: inline-block; margin-top: 12px; font-size: 0.88rem; font-weight: 600; color: var(--accent-soft); }
.sample-link .go::after { content: " →"; }
@media (max-width: 680px) { .sample-index { grid-template-columns: 1fr; } }

/* tier / decision cards (which to use) */
.tier-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin: 18px 0; }
.tier {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 18px 16px;
}
.tier.featured { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(94,211,196,0.25); }
.tier .tier-badge {
  display: inline-block; font-size: 0.7rem; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; margin-bottom: 10px;
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border-2);
}
.tier.featured .tier-badge { background: var(--accent-dim); color: var(--accent-soft); border-color: rgba(94,211,196,0.3); }
.tier h4 { margin: 0 0 6px; font-size: 1rem; }
.tier p { margin: 0; font-size: 0.88rem; color: var(--text-dim); }
@media (max-width: 720px) { .tier-grid { grid-template-columns: 1fr; } }

/* interactive recipe tabs */
.tabs { margin: 18px 0; }
.tab-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tab-btn {
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: #06201d; background: var(--accent); border-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadein 0.25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* use-case cards (sample-based) */
.usecase {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0;
  margin: 22px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.usecase.flip { grid-template-columns: 1fr 1.1fr; }
.usecase .uc-media { background: var(--bg-alt); display: flex; align-items: center; justify-content: center; }
.usecase .uc-media a { display: block; width: 100%; height: 100%; }
.usecase .uc-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.usecase.flip .uc-media { order: 2; }
.usecase .uc-body { padding: 26px 28px; }
.usecase .uc-tag {
  display: inline-block;
  font-size: 0.72rem; font-weight: 600;
  color: var(--accent-soft); background: var(--accent-dim);
  padding: 3px 10px; border-radius: 999px; margin-bottom: 12px;
}
.usecase h3 { margin: 0 0 8px; font-size: 1.18rem; }
.usecase p { margin: 0 0 12px; font-size: 0.92rem; color: var(--text-dim); }
.usecase ul { margin: 0; padding-left: 18px; font-size: 0.88rem; color: var(--text-dim); }
.usecase .uc-meta { margin-top: 14px; font-size: 0.8rem; color: var(--text-mute); font-family: var(--mono); }
@media (max-width: 720px) {
  .usecase, .usecase.flip { grid-template-columns: 1fr; }
  .usecase.flip .uc-media { order: 0; }
  .usecase .uc-media { aspect-ratio: 16/9; }
}
