@import url("./tokens.css");

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  background-color: var(--bg-page);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.62;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" on, "cv02" on;
}

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

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

button {
  font-family: inherit;
  cursor: pointer;
}

code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--ink-primary);
}

.section-dark code {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

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

/* Scroll Progress Hairline */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2.5px;
  width: 0%;
  z-index: 200;
  background: linear-gradient(90deg, var(--brand-ember), var(--admin-accent), var(--kds-accent-bright));
  pointer-events: none;
  transition: width 80ms linear;
}

/* ========================================================================== */
/* Sticky Top Header                                                          */
/* ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border-light);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 66px;
  gap: 18px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  font-size: 1.16rem;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
  flex-shrink: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, #1e293b, #090d16);
  color: var(--bg-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  position: relative;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
}

.brand-mark::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-ember);
  border: 2px solid var(--bg-surface);
}

.brand-sub {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--ink-muted);
  margin-left: 2px;
  padding-left: 10px;
  border-left: 1px solid var(--border-strong);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--ink-primary);
}

.nav-link.is-active {
  background: var(--ink-primary);
  color: var(--bg-surface);
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.header-github {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--ink-primary);
  color: var(--bg-surface);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 160ms var(--ease-out), transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.header-github:hover {
  background: #1e293b;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.header-github .github-ext {
  opacity: 0.68;
}

/* ========================================================================== */
/* Smart Floating Popover Trigger & Portal                                    */
/* ========================================================================== */
.info-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  font-style: normal;
  background: rgba(15, 23, 42, 0.07);
  color: var(--ink-muted);
  flex-shrink: 0;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.section-dark .info-badge {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink-on-dark-muted);
}

[data-popover] {
  cursor: pointer;
}

[data-popover]:hover .info-badge,
[data-popover]:focus-visible .info-badge,
[data-popover].is-popover-open .info-badge {
  background: var(--admin-accent);
  color: #ffffff;
  transform: scale(1.08);
}

.section-dark [data-popover]:hover .info-badge,
.section-dark [data-popover]:focus-visible .info-badge,
.section-dark [data-popover].is-popover-open .info-badge {
  background: var(--kds-accent-bright);
  color: #052e16;
}

/* Floating Popover Portal (appended to body, never clipped by overflow) */
.floating-popover {
  position: fixed;
  z-index: 950;
  width: min(340px, calc(100vw - 24px));
  padding: 15px 17px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-popover);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
  visibility: hidden;
}

.floating-popover.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  pointer-events: auto;
}

.floating-popover.is-light-theme {
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.floating-popover-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fb923c;
  margin-bottom: 4px;
}

.floating-popover.is-light-theme .floating-popover-eyebrow {
  color: var(--admin-accent);
}

.floating-popover-title {
  font-size: 0.9rem;
  font-weight: 800;
  margin: 0 0 6px;
  line-height: 1.35;
}

.floating-popover-body {
  font-size: 0.83rem;
  line-height: 1.58;
  color: #cbd5e1;
  margin: 0;
}

.floating-popover.is-light-theme .floating-popover-body {
  color: var(--ink-secondary);
}

.floating-popover-arrow {
  position: absolute;
  width: 10px;
  height: 10px;
  background: inherit;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  transform: rotate(45deg);
}

.floating-popover.is-light-theme .floating-popover-arrow {
  border-color: var(--border-strong);
}

.floating-popover[data-placement="top"] .floating-popover-arrow {
  bottom: -6px;
  border-left: none;
  border-top: none;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.floating-popover.is-light-theme[data-placement="top"] .floating-popover-arrow {
  border-right-color: var(--border-strong);
  border-bottom-color: var(--border-strong);
}

.floating-popover[data-placement="bottom"] .floating-popover-arrow {
  top: -6px;
}

/* ========================================================================== */
/* Hero Section — Airy, Visual-First                                          */
/* ========================================================================== */
.hero-section {
  padding: 58px 0 76px;
  position: relative;
  background:
    radial-gradient(circle at 14% 12%, rgba(234, 88, 12, 0.09), transparent 38%),
    radial-gradient(circle at 86% 24%, rgba(37, 99, 235, 0.09), transparent 42%),
    radial-gradient(rgba(15, 23, 42, 0.045) 1px, transparent 1px),
    var(--bg-page);
  background-size: 100% 100%, 100% 100%, 24px 24px, 100% 100%;
  border-bottom: 1px solid var(--border-light);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.24fr);
  gap: 44px;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-secondary);
  box-shadow: var(--shadow-xs);
  margin-bottom: 22px;
}

.status-pill svg {
  width: 15px;
  height: 15px;
  color: var(--brand-ember);
}

.hero-title {
  margin: 0 0 18px;
  font-size: clamp(2.15rem, 3.5vw, 3.15rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 800;
  color: var(--ink-primary);
}

.hero-title-accent {
  background: linear-gradient(120deg, var(--ink-primary) 15%, var(--brand-ember) 78%, var(--admin-accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  margin: 0 0 28px;
  font-size: 1.04rem;
  color: var(--ink-secondary);
  max-width: 44ch;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 30px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-md);
  background: var(--ink-primary);
  color: var(--bg-surface);
  font-size: 0.94rem;
  font-weight: 700;
  border: 1px solid var(--ink-primary);
  box-shadow: 0 10px 24px -8px rgba(15, 23, 42, 0.35);
  transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out), background-color 180ms var(--ease-out);
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: #1e293b;
  box-shadow: 0 14px 28px -8px rgba(15, 23, 42, 0.42);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-size: 0.94rem;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-xs);
  transition: background-color 180ms var(--ease-out), transform 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--ink-muted);
  transform: translateY(-1px);
}

/* Compact Hover-Popover Pillars (Replaces Dense Paragraphs) */
.hero-pillars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hero-pillar-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  text-align: left;
  transition: transform 180ms var(--ease-out), border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.hero-pillar-chip:hover,
.hero-pillar-chip.is-popover-open {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.hero-pillar-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.hero-pillar-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-pillar-label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.25;
}

.hero-pillar-sub {
  display: block;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--ink-muted);
  margin-top: 1px;
}

.hero-hover-hint {
  margin: 12px 0 0;
  font-size: 0.77rem;
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Hero Interactive Four-App Stage */
.hero-stage {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: var(--shadow-lg);
}

.hero-stage-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: var(--bg-subtle);
  margin-bottom: 14px;
}

.hero-tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 0.85rem;
  font-weight: 700;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.hero-tab-btn:hover {
  color: var(--ink-primary);
}

.hero-tab-btn.is-active {
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
}

.hero-tab-btn[data-app="admin"].is-active {
  color: var(--admin-ink);
  border-color: var(--admin-border);
}

.hero-tab-btn[data-app="pos"].is-active {
  color: var(--pos-ink);
  border-color: var(--pos-border);
}

.hero-tab-btn[data-app="mp"].is-active {
  color: var(--mp-ink);
  border-color: var(--mp-border);
}

.hero-tab-btn[data-app="kds"].is-active {
  color: var(--kds-ink);
  border-color: var(--kds-border);
}

.hero-stage-viewport {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-dark);
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
}

.hero-stage-viewport img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: zoom-in;
  transition: opacity 180ms ease;
}

.hero-stage-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 0 4px;
  font-size: 0.83rem;
  color: var(--ink-secondary);
}

.mock-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* ========================================================================== */
/* Sections & Clean Editorial Headers                                         */
/* ========================================================================== */
.section {
  padding: 84px 0;
  scroll-margin-top: 72px;
  border-bottom: 1px solid var(--border-light);
}

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

.section-dark {
  background:
    radial-gradient(circle at 18% 10%, rgba(16, 185, 129, 0.09), transparent 36%),
    radial-gradient(circle at 84% 16%, rgba(37, 99, 235, 0.08), transparent 38%),
    radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    var(--bg-dark);
  background-size: 100% 100%, 100% 100%, 26px 26px, 100% 100%;
  color: var(--ink-on-dark);
  border-bottom-color: var(--border-dark);
}

.section-header {
  max-width: 900px;
  margin-bottom: 40px;
}

.section-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.section-header-row .section-header {
  margin-bottom: 0;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 12px;
}

.section-tag.tag-neutral {
  background: var(--bg-subtle);
  color: var(--ink-secondary);
}

.section-tag.tag-dark {
  background: var(--bg-dark-elevated);
  color: var(--kds-accent-bright);
  border: 1px solid var(--border-dark);
}

.section-tag.tag-admin {
  background: var(--admin-soft);
  color: var(--admin-ink);
}

.section-tag.tag-pos {
  background: var(--pos-soft);
  color: var(--pos-ink);
}

.section-tag.tag-mp {
  background: var(--mp-soft);
  color: var(--mp-ink);
}

.section-tag.tag-kds {
  background: rgba(16, 185, 129, 0.16);
  color: var(--kds-accent-bright);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.section-title {
  margin: 0 0 10px;
  font-size: clamp(1.5rem, 2.35vw, 2.08rem);
  line-height: 1.22;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.section-desc {
  margin: 0;
  font-size: 0.98rem;
  color: var(--ink-secondary);
}

.section-dark .section-desc {
  color: var(--ink-on-dark-muted);
}

.section-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-pill {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--ink-secondary);
}

.section-dark .meta-pill {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-dark);
  color: var(--ink-on-dark-secondary);
}

/* ========================================================================== */
/* System Core Bento — Scannable Metric Cards + Hover Popover Details         */
/* ========================================================================== */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.bento-card {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out), border-color 200ms var(--ease-out);
}

.bento-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.bento-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bento-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
}

.bento-kpi {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink-primary);
}

.bento-card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink-primary);
  line-height: 1.3;
}

.bento-summary {
  margin: 0;
  font-size: 0.87rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

.invariant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--ink-secondary);
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.code-chip[data-popover]:hover,
.code-chip[data-popover].is-popover-open {
  border-color: var(--admin-accent);
  color: var(--admin-ink);
  background: var(--admin-soft);
}

.bento-detail-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--ink-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  transition: border-color 150ms ease, color 150ms ease;
}

.bento-detail-btn:hover,
.bento-detail-btn.is-popover-open {
  border-color: var(--ink-primary);
  color: var(--ink-primary);
}

/* ========================================================================== */
/* Cloud-Edge Topology — Interactive Visual Flow + Collapsible Protocol       */
/* ========================================================================== */
.topology-shell {
  background: rgba(17, 24, 39, 0.82);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-xl);
  padding: 26px;
  box-shadow: var(--shadow-dark-lg);
}

.topology-mode-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.topo-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 17px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-dark);
  background: var(--bg-dark-elevated);
  color: var(--ink-on-dark-muted);
  font-size: 0.86rem;
  font-weight: 700;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.topo-mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

.topo-mode-btn.is-active .topo-mode-dot {
  opacity: 1;
}

.topo-mode-btn.is-active[data-mode="normal"] {
  background: rgba(37, 99, 235, 0.22);
  border-color: #60a5fa;
  color: #ffffff;
}

.topo-mode-btn.is-active[data-mode="failover"] {
  background: rgba(234, 88, 12, 0.24);
  border-color: #fb923c;
  color: #ffffff;
}

.topo-mode-btn.is-active[data-mode="recovery"] {
  background: rgba(16, 185, 129, 0.22);
  border-color: #34d399;
  color: #ffffff;
}

.topology-nodes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.topo-node {
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: rgba(9, 13, 22, 0.85);
  border: 1px solid var(--border-dark);
  opacity: 0.52;
  transition: border-color 220ms var(--ease-out), transform 220ms var(--ease-out), opacity 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
}

.topo-node.is-highlighted {
  opacity: 1;
  border-color: rgba(16, 185, 129, 0.65);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2), 0 10px 28px -12px rgba(16, 185, 129, 0.35);
  transform: translateY(-2px);
}

.topo-node.is-degraded {
  opacity: 1;
  border-color: rgba(251, 146, 60, 0.85);
  box-shadow: 0 0 0 1px rgba(251, 146, 60, 0.25), 0 10px 28px -12px rgba(234, 88, 12, 0.4);
}

.topo-node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.topo-node-role {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-on-dark-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.topo-node-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink-on-dark);
  margin-bottom: 6px;
}

.topo-node-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--kds-accent-bright);
  font-weight: 600;
}

.topo-node.is-degraded .topo-node-tag {
  color: #fdba74;
}

/* Topology Summary Bar + Collapsible Protocol Breakdown */
.topology-explain-bar {
  border-radius: var(--radius-md);
  background: var(--bg-dark-elevated);
  border: 1px solid var(--border-dark);
  border-left: 3.5px solid var(--kds-accent-bright);
  padding: 14px 18px;
}

.topology-explain-bar.is-failover {
  border-left-color: #fb923c;
}

.topology-explain-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topology-explain-summary {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-on-dark);
}

.inline-fold-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-dark-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-on-dark-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 160ms ease, color 160ms ease;
}

.inline-fold-btn:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
}

.inline-fold-btn .chevron {
  transition: transform 220ms var(--ease-out);
}

.inline-fold-btn[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.fold-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 240ms var(--ease-out);
}

.fold-body.is-open {
  grid-template-rows: 1fr;
}

.fold-body-inner {
  overflow: hidden;
}

.topology-explain-detail {
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--border-dark);
  font-size: 0.86rem;
  color: var(--ink-on-dark-muted);
  line-height: 1.65;
}

/* Compact 4-App Dock Cards */
.app-nav-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.app-jump-card {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(17, 24, 39, 0.75);
  border: 1px solid var(--border-dark);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 180ms var(--ease-out), border-color 180ms var(--ease-out), background-color 180ms var(--ease-out);
}

.app-jump-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.28);
  background: var(--bg-dark-elevated);
}

.app-jump-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-jump-num {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-on-dark-muted);
}

.app-jump-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.app-jump-title {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ink-on-dark);
}

.app-jump-stack {
  font-size: 0.77rem;
  color: var(--ink-on-dark-muted);
}

/* ========================================================================== */
/* Scannable Competitor Comparison Tables (1-Line Verdict + Hover Popover)    */
/* ========================================================================== */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.section-dark .table-wrap {
  background: var(--bg-dark-surface);
  border-color: var(--border-dark);
  box-shadow: var(--shadow-dark-lg);
}

.comp-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  text-align: left;
}

.comp-table th,
.comp-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
  vertical-align: middle;
}

.section-dark .comp-table th,
.section-dark .comp-table td {
  border-bottom-color: var(--border-dark);
}

.comp-table th {
  background: var(--bg-subtle);
  font-weight: 800;
  color: var(--ink-primary);
  font-size: 0.85rem;
}

.section-dark .comp-table th {
  background: var(--bg-dark-elevated);
  color: var(--ink-on-dark);
}

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

.comp-table tbody tr {
  transition: background-color 140ms ease;
}

.comp-table tbody tr:hover {
  background: rgba(15, 23, 42, 0.02);
}

.section-dark .comp-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.comp-table tr.is-extra-row {
  display: none;
}

.comp-table.is-expanded tr.is-extra-row {
  display: table-row;
}

.comp-table th.col-opendine,
.comp-table td.col-opendine {
  background: rgba(37, 99, 235, 0.045);
  font-weight: 600;
}

.section-dark .comp-table th.col-opendine,
.section-dark .comp-table td.col-opendine {
  background: rgba(16, 185, 129, 0.08);
}

.comp-table th.col-opendine {
  color: var(--admin-ink);
  border-top: 3px solid var(--admin-accent);
}

.section-dark .comp-table th.col-opendine {
  color: var(--kds-accent-bright);
  border-top: 3px solid var(--kds-accent-bright);
}

.cell-verdict {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.cell-short {
  color: var(--ink-secondary);
  font-size: 0.85rem;
}

.col-opendine .cell-short {
  color: var(--ink-primary);
  font-weight: 600;
}

.section-dark .cell-short {
  color: var(--ink-on-dark-muted);
}

.section-dark .col-opendine .cell-short {
  color: var(--ink-on-dark);
}

.badge-verdict {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-win {
  background: var(--status-win-bg);
  color: var(--status-win);
}

.badge-warn {
  background: var(--status-warn-bg);
  color: var(--status-warn);
}

.badge-miss {
  background: var(--status-miss-bg);
  color: var(--status-miss);
}

.section-dark .badge-win {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.section-dark .badge-warn {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.section-dark .badge-miss {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.table-footer-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: var(--bg-page);
  border-top: 1px solid var(--border-light);
}

.table-footer-hint {
  font-size: 0.79rem;
  color: var(--ink-muted);
}

.table-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-size: 0.82rem;
  font-weight: 700;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.table-expand-btn:hover {
  background: var(--bg-subtle);
}

.table-expand-btn .chevron {
  transition: transform 200ms var(--ease-out);
}

.table-expand-btn[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

/* ========================================================================== */
/* Program Deep-Dive: Visual-First Stage + Accordion + Collapsible Matrix     */
/* ========================================================================== */
.program-showcase {
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(0, 0.84fr);
  gap: 32px;
  align-items: start;
  margin-bottom: 26px;
}

.program-showcase.reverse {
  grid-template-columns: minmax(0, 0.84fr) minmax(0, 1.38fr);
}

.gallery-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: var(--shadow-md);
}

.section-dark .gallery-panel {
  background: var(--bg-dark-surface);
  border-color: var(--border-dark);
  box-shadow: var(--shadow-dark-lg);
}

.gallery-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 4px;
  border-radius: 12px;
  background: var(--bg-subtle);
  margin-bottom: 14px;
}

.section-dark .gallery-tabs {
  background: var(--bg-dark);
}

.gallery-tab {
  padding: 7px 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 0.83rem;
  font-weight: 700;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.section-dark .gallery-tab {
  color: var(--ink-on-dark-muted);
}

.gallery-tab.is-active {
  background: var(--bg-surface);
  color: var(--ink-primary);
  box-shadow: var(--shadow-xs);
}

.section-dark .gallery-tab.is-active {
  background: var(--kds-accent-bright);
  color: #052e16;
}

.device-frame {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  background: #0b0f17;
  position: relative;
}

.section-dark .device-frame {
  border-color: var(--border-dark);
}

.device-frame img {
  width: 100%;
  height: auto;
  cursor: zoom-in;
}

/* Mobile Trio Showcase for Miniprogram */
.mobile-trio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 8px 4px 4px;
}

.phone-bezel {
  background: #141417;
  border-radius: 26px;
  padding: 8px;
  box-shadow: var(--shadow-md);
  border: 1.5px solid #27272a;
  transition: transform 200ms var(--ease-out);
}

.phone-bezel:hover {
  transform: translateY(-4px);
}

.phone-bezel img {
  border-radius: 19px;
  width: 100%;
  aspect-ratio: 585 / 1143;
  object-fit: contain;
  background: #ffffff;
  display: block;
  cursor: zoom-in;
}

.phone-caption {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-secondary);
  margin-top: 8px;
}

.gallery-caption-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 0 4px;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.section-dark .gallery-caption-bar {
  color: var(--ink-on-dark-muted);
}

.zoom-hint-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--ink-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 150ms ease, color 150ms ease;
}

.zoom-hint-btn:hover {
  border-color: var(--ink-primary);
  color: var(--ink-primary);
}

.section-dark .zoom-hint-btn {
  background: var(--bg-dark-elevated);
  border-color: var(--border-dark-strong);
  color: var(--ink-on-dark);
}

/* Interactive Advantage Accordion (Only 1 expanded at a time = Ultra-Clean) */
.advantage-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.acc-item {
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  transition: border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
  overflow: hidden;
}

.section-subtle .acc-item {
  background: var(--bg-page);
}

.section-dark .acc-item {
  background: var(--bg-dark-surface);
  border-color: var(--border-dark);
}

.acc-item.is-open {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.section-subtle .acc-item.is-open {
  background: var(--bg-surface);
}

.section-dark .acc-item.is-open {
  border-color: rgba(16, 185, 129, 0.45);
  background: var(--bg-dark-elevated);
}

.acc-trigger {
  width: 100%;
  border: none;
  background: transparent;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  color: inherit;
}

.acc-trigger-main {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.adv-num {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  flex-shrink: 0;
}

.acc-item.is-open .adv-num {
  background: var(--ink-primary);
  color: #ffffff;
}

.section-dark .adv-num {
  background: rgba(255, 255, 255, 0.08);
  color: var(--kds-accent-bright);
}

.section-dark .acc-item.is-open .adv-num {
  background: var(--kds-accent-bright);
  color: #052e16;
}

.acc-title-wrap {
  min-width: 0;
}

.acc-title {
  display: block;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--ink-primary);
  line-height: 1.35;
}

.section-dark .acc-title {
  color: var(--ink-on-dark);
}

.acc-tagline {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

.section-dark .acc-tagline {
  color: var(--ink-on-dark-muted);
}

.acc-chevron {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 220ms var(--ease-out), background-color 160ms ease, color 160ms ease;
}

.section-dark .acc-chevron {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink-on-dark-muted);
}

.acc-item.is-open .acc-chevron {
  transform: rotate(180deg);
  background: var(--ink-primary);
  color: #ffffff;
}

.section-dark .acc-item.is-open .acc-chevron {
  background: rgba(16, 185, 129, 0.22);
  color: var(--kds-accent-bright);
}

.acc-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 240ms var(--ease-out);
}

.acc-item.is-open .acc-panel {
  grid-template-rows: 1fr;
}

.acc-panel-inner {
  overflow: hidden;
}

.acc-panel-body {
  padding: 0 18px 16px 56px;
  font-size: 0.87rem;
  color: var(--ink-secondary);
  line-height: 1.62;
  margin: 0;
}

.section-dark .acc-panel-body {
  color: var(--ink-on-dark-secondary);
}

/* Collapsible Per-Program Competitor Strip */
.comp-drawer {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.section-subtle .comp-drawer {
  background: var(--bg-page);
}

.section-dark .comp-drawer {
  background: var(--bg-dark-surface);
  border-color: var(--border-dark);
}

.comp-drawer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 15px 20px;
}

.comp-drawer-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.comp-drawer-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--ink-primary);
}

.section-dark .comp-drawer-title {
  color: var(--ink-on-dark);
}

.comp-quick-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.comp-quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-secondary);
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.comp-quick-pill:hover,
.comp-quick-pill.is-popover-open {
  background: var(--status-win-bg);
  border-color: rgba(5, 150, 105, 0.35);
  color: var(--status-win);
}

.section-dark .comp-quick-pill {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-dark);
  color: var(--ink-on-dark-secondary);
}

.section-dark .comp-quick-pill:hover,
.section-dark .comp-quick-pill.is-popover-open {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.comp-drawer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.comp-drawer-toggle:hover {
  background: var(--bg-subtle);
}

.section-dark .comp-drawer-toggle {
  background: var(--bg-dark-elevated);
  border-color: var(--border-dark-strong);
  color: var(--ink-on-dark);
}

.section-dark .comp-drawer-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.comp-drawer-toggle .chevron {
  transition: transform 220ms var(--ease-out);
}

.comp-drawer-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.comp-drawer-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 260ms var(--ease-out);
}

.comp-drawer.is-open .comp-drawer-body {
  grid-template-rows: 1fr;
}

.comp-drawer-inner {
  overflow: hidden;
}

.comp-drawer .table-wrap {
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--border-light);
  box-shadow: none;
}

.section-dark .comp-drawer .table-wrap {
  border-top-color: var(--border-dark);
}

/* ========================================================================== */
/* Lightbox Modal                                                             */
/* ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(9, 13, 22, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-bar {
  width: 100%;
  max-width: 1360px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #f8fafc;
  margin-bottom: 12px;
}

.lightbox-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.lightbox-close {
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
}

.lightbox-img-wrap {
  max-width: 1360px;
  max-height: 82vh;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow-dark-lg);
}

.lightbox-img-wrap img {
  max-height: 80vh;
  width: auto;
  margin: 0 auto;
}

/* ========================================================================== */
/* Footer                                                                     */
/* ========================================================================== */
.site-footer {
  padding: 54px 0 42px;
  background: var(--bg-dark);
  color: var(--ink-on-dark-muted);
  border-top: 1px solid var(--border-dark);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) repeat(3, minmax(0, 1fr));
  gap: 32px;
  padding-bottom: 34px;
  border-bottom: 1px solid var(--border-dark);
}

.footer-col h4 {
  color: var(--ink-on-dark);
  font-size: 0.92rem;
  margin: 0 0 12px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
}

.footer-col a:hover {
  color: #ffffff;
}

.footer-bottom {
  padding-top: 22px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
}

/* ========================================================================== */
/* Responsive Breakpoints                                                     */
/* ========================================================================== */
@media (max-width: 960px) {
  .brand-sub {
    display: none;
  }
}

@media (max-width: 1120px) {
  .bento-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .hero-grid,
  .program-showcase,
  .program-showcase.reverse {
    grid-template-columns: minmax(0, 1fr);
  }

  .topology-nodes,
  .app-nav-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .container {
    padding: 0 18px;
  }

  .header-inner {
    height: auto;
    padding: 10px 18px;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .header-actions {
    margin-left: auto;
    order: 2;
  }

  .site-nav {
    order: 3;
    width: 100%;
    padding-bottom: 2px;
  }

  .header-github {
    padding: 7px 12px;
    font-size: 0.8rem;
  }

  .header-github .github-ext {
    display: none;
  }

  .hero-section {
    padding: 36px 0 52px;
  }

  .status-pill {
    font-size: 0.74rem;
    padding: 5px 11px;
    gap: 6px;
  }

  .section {
    scroll-margin-top: 104px;
  }

  .hero-pillars,
  .hero-stage-tabs,
  .bento-grid,
  .topology-nodes,
  .app-nav-cards,
  .mobile-trio-grid,
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .acc-panel-body {
    padding-left: 18px;
  }

  .section {
    padding: 58px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
