:root {
  color-scheme: light;
  --paper: #f5f6f4;
  --surface: #ffffff;
  --surface-2: #eceeea;
  --ink: #171b1c;
  --ink-2: #3d4645;
  --muted: #6b7573;
  --faint: #8b9592;
  --line: #dcdfda;
  --line-strong: #c3c9c2;
  --accent: #1f6f5c;
  --accent-strong: #175648;
  --accent-soft: #e5efea;
  --grid: rgba(23, 27, 28, 0.05);
  --code-bg: #eef0ec;
  --code-ink: #29312f;
  --code-line: #d8ddd6;
  --shadow: 0 1px 2px rgba(23, 27, 28, 0.04), 0 18px 44px rgba(23, 27, 28, 0.07);
  --radius: 6px;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0e1214;
  --surface: #14191b;
  --surface-2: #1a2022;
  --ink: #e6e8e5;
  --ink-2: #c3c9c6;
  --muted: #909a97;
  --faint: #6f7a77;
  --line: #242c2c;
  --line-strong: #374142;
  --accent: #83bfae;
  --accent-strong: #a6d6c8;
  --accent-soft: #16241f;
  --grid: rgba(230, 232, 229, 0.045);
  --code-bg: #111618;
  --code-ink: #cbd5d1;
  --code-line: #222a2b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 20px 48px rgba(0, 0, 0, 0.35);
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

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

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

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

.wrap {
  width: min(1120px, 100% - 56px);
  margin-inline: auto;
}

/* Header --------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  border-radius: 6px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-left: auto;
}

.site-nav a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="true"] {
  color: var(--ink);
}

.site-nav a[aria-current="true"] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 7px;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--line-strong);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-theme="light"] .icon-moon,
[data-theme="dark"] .icon-sun {
  display: none;
}

/* Hero ----------------------------------------------------------------- */

.hero {
  padding: 92px 0 64px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 64px;
  align-items: center;
}

.hero h1 {
  margin: 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(2.15rem, 4vw, 2.95rem);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.lead {
  margin: 26px 0 0;
  max-width: 54ch;
  color: var(--ink-2);
  font-size: 16.5px;
  line-height: 1.8;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 20px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  color: var(--ink);
  border-color: var(--ink-2);
}

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

.btn-primary:hover {
  color: var(--paper);
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 40px;
  margin: 44px 0 0;
  padding: 22px 0 0;
  border-top: 1px solid var(--line);
}

.facts div {
  display: grid;
  gap: 2px;
}

.facts dt {
  color: var(--faint);
  font-size: 12px;
}

.facts dd {
  margin: 0;
  color: var(--ink-2);
  font-size: 13.5px;
}

/* Route card ----------------------------------------------------------- */

.route-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.route-map {
  display: block;
  width: 100%;
  height: auto;
  background: var(--surface);
}

.svg-zone {
  fill: var(--faint);
  font-family: var(--sans);
  font-size: 11.5px;
}

.svg-name {
  fill: var(--ink);
  font-family: var(--sans);
  font-size: 12.5px;
  text-anchor: middle;
}

.svg-port {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  text-anchor: middle;
}

.svg-note {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  text-anchor: middle;
}

.route-line {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1.4;
}

.route-tunnel {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-dasharray: 2 6;
  stroke-linecap: round;
  opacity: 0.55;
}

.node circle:first-child {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 1.6;
}

.node .pulse {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 0.25;
}

.packet {
  fill: var(--accent);
}

.route-config {
  border-top: 1px solid var(--line);
  background: var(--code-bg);
}

.route-config pre {
  margin: 0;
  padding: 16px 20px;
  overflow-x: auto;
  color: var(--code-ink);
  font-size: 12.5px;
  line-height: 1.75;
}

.route-config .tok {
  color: var(--accent-strong);
}

/* Sections ------------------------------------------------------------- */

.section {
  padding: 84px 0;
  border-top: 1px solid var(--line);
}

.section-head {
  max-width: 720px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(1.55rem, 2.5vw, 1.95rem);
  line-height: 1.32;
  letter-spacing: 0.01em;
}

.section-head p {
  margin: 18px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 15.5px;
}

/* Architecture --------------------------------------------------------- */

.architecture {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: stretch;
  gap: 0;
  margin-top: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.arch-node {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 24px 22px;
}

.arch-role {
  color: var(--accent);
  font-size: 12px;
}

.arch-node strong {
  font-size: 15px;
  font-weight: 600;
}

.arch-node span:last-child {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.arch-link {
  display: grid;
  place-items: center;
  padding: 0 14px;
  border-inline: 1px solid var(--line);
  background: var(--surface-2);
}

.arch-link span {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
}

.about-note {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

/* Tabs ----------------------------------------------------------------- */

.tabs {
  margin-top: 40px;
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  border-bottom: 1px solid var(--line);
}

.tab-list [role="tab"] {
  padding: 0 0 12px;
  margin-bottom: -1px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-list [role="tab"]:hover {
  color: var(--ink);
}

.tab-list [role="tab"][aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.tab-panel {
  padding-top: 34px;
}

.feature {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.feature:first-child {
  padding-top: 0;
}

.feature:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.feature h3 {
  margin: 0 0 6px;
  font-size: 15.5px;
  font-weight: 600;
}

.feature p {
  margin: 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.8;
}

#features .tab-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 56px;
}

#features .tab-panel .feature:nth-last-child(2) {
  border-bottom: 0;
}

/* Screenshots ---------------------------------------------------------- */

.shot-tabs .tab-list {
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: thin;
}

.shot-tabs .tab-list [role="tab"] {
  white-space: nowrap;
}

.shot {
  margin: 0;
}

.shot-frame {
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.shot-frame img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.shot figcaption {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

/* Deploy --------------------------------------------------------------- */

.deploy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 56px;
  margin-top: 40px;
}

.deploy-col {
  min-width: 0;
}

.deploy-col h3 {
  margin: 0 0 10px;
  font-family: var(--sans);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.deploy-col h4 {
  margin: 34px 0 8px;
  font-size: 14.5px;
  font-weight: 600;
}

.deploy-col p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.deploy-col p code,
.deploy-links code {
  padding: 1px 5px;
  background: var(--code-bg);
  border-radius: 3px;
  color: var(--code-ink);
  font-size: 0.88em;
}

.code-block {
  position: relative;
  margin: 0 0 18px;
  background: var(--code-bg);
  border: 1px solid var(--code-line);
  border-radius: var(--radius);
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px 6px 18px;
  border-bottom: 1px solid var(--code-line);
}

.code-head span {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.code-block pre {
  margin: 0;
  padding: 14px 18px;
  overflow-x: auto;
  color: var(--code-ink);
  font-size: 12.5px;
  line-height: 1.8;
}

.copy {
  padding: 3px 9px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.copy:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.copy.is-copied {
  color: var(--accent);
  border-color: var(--accent);
}

.deploy-facts {
  display: grid;
  gap: 8px;
  margin: 0 0 20px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.deploy-facts div {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.deploy-facts dt {
  color: var(--faint);
  font-size: 12.5px;
}

.deploy-facts dd {
  margin: 0;
  color: var(--code-ink);
  font-family: var(--mono);
  font-size: 12px;
  text-align: right;
}

.note {
  padding-left: 14px;
  border-left: 2px solid var(--line-strong);
  font-size: 13px !important;
}

.deploy-links {
  margin: 44px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13.5px;
}

.deploy-links a {
  color: var(--accent);
}

/* Footer --------------------------------------------------------------- */

.site-footer {
  padding: 46px 0 54px;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: grid;
  gap: 8px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
}

.footer-brand img {
  border-radius: 5px;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.footer-year {
  color: var(--faint) !important;
}

/* Reveal --------------------------------------------------------------- */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Responsive ----------------------------------------------------------- */

@media (max-width: 980px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 44px;
  }

  .route-card {
    max-width: 640px;
  }

  .deploy-grid {
    grid-template-columns: 1fr;
    gap: 44px;
  }

  .architecture {
    grid-template-columns: 1fr;
  }

  .arch-link {
    border-inline: 0;
    border-block: 1px solid var(--line);
    padding: 8px 22px;
  }
}

@media (max-width: 720px) {
  .wrap {
    width: min(1120px, 100% - 36px);
  }

  .header-inner {
    gap: 16px;
  }

  .site-nav {
    display: none;
  }

  .theme-toggle {
    margin-left: auto;
  }

  .hero {
    padding: 56px 0 44px;
  }

  .hero h1 {
    font-size: clamp(1.9rem, 7.6vw, 2.3rem);
  }

  .facts {
    gap: 14px 28px;
  }

  .section {
    padding: 60px 0;
  }

  #features .tab-panel {
    grid-template-columns: 1fr;
    column-gap: 0;
  }

  #features .tab-panel .feature:nth-last-child(2) {
    border-bottom: 1px solid var(--line);
  }

  .tab-list {
    gap: 2px 20px;
  }

  .deploy-facts div {
    flex-direction: column;
    gap: 2px;
  }

  .deploy-facts dd {
    text-align: left;
  }
}
