:root {
  color-scheme: light;
  --ink: #10151d;
  --muted: #5a6676;
  --soft: #eef3f6;
  --paper: #ffffff;
  --line: #d8e0e8;
  --blue: #0e6f9f;
  --cyan: #14a7b8;
  --green: #16825d;
  --amber: #a46606;
  --magenta: #a43d79;
  --deep: #08111c;
  --deep-2: #0f1c2b;
  --shadow: 0 18px 50px rgba(15, 28, 43, 0.14);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: #f7f9fb;
  letter-spacing: 0;
}

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

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

p {
  line-height: 1.78;
}

code,
pre {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(216, 224, 232, 0.9);
  backdrop-filter: blur(14px);
}

.nav-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 780;
  font-size: 19px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background:
    linear-gradient(135deg, #0e6f9f, #16825d 54%, #a46606);
  box-shadow: 0 10px 26px rgba(14, 111, 159, 0.24);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: #344253;
}

.main-nav a {
  padding: 9px 10px;
  border-radius: 6px;
}

.main-nav a:hover,
.main-nav a.active {
  color: #07111d;
  background: #eaf1f4;
}

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

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 3px;
  font-size: 12px;
  font-weight: 720;
}

.language-switch a {
  min-width: 34px;
  text-align: center;
  padding: 5px 7px;
  border-radius: 4px;
  color: #4b5968;
}

.language-switch a.active {
  color: #fff;
  background: #0e6f9f;
}

.menu-button {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  width: 38px;
  height: 38px;
  cursor: pointer;
}

.button,
.button-secondary,
.text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 6px;
  font-weight: 690;
  font-size: 14px;
}

.button {
  color: #fff;
  background: #0e6f9f;
  box-shadow: 0 12px 28px rgba(14, 111, 159, 0.25);
}

.button:hover {
  background: #0b5d86;
}

.button-secondary {
  color: #102033;
  background: #fff;
  border: 1px solid var(--line);
}

.button-secondary:hover {
  border-color: #9fb1c0;
}

.hero {
  position: relative;
  min-height: min(78vh, 760px);
  color: #fff;
  background:
    linear-gradient(90deg, rgba(3, 10, 18, 0.9) 0%, rgba(5, 14, 25, 0.78) 36%, rgba(5, 14, 25, 0.16) 75%),
    url("./klink-hero.png") center / cover no-repeat;
  display: flex;
  align-items: center;
}

.hero-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 92px 0 86px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #9ee9e7;
  font-size: 13px;
  font-weight: 760;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #36d39a;
}

.hero h1,
.page-hero h1 {
  margin: 16px 0 18px;
  max-width: 760px;
  font-size: clamp(48px, 8vw, 88px);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 660px;
  margin: 0 0 28px;
  color: #d7e4ee;
  font-size: 19px;
}

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

.hero .button-secondary {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
  color: #d7e4ee;
}

.chip {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
}

.section {
  padding: 76px 0;
  background: #fff;
}

.section.alt {
  background: #f0f5f7;
}

.section.dark {
  background: var(--deep);
  color: #e8f0f4;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.section-head h2,
.content h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.12;
  letter-spacing: 0;
}

.section-head p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
}

.dark .section-head p,
.dark .muted {
  color: #b8c6d2;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 1px 0 rgba(16, 21, 29, 0.02);
}

.dark .card {
  background: var(--deep-2);
  border-color: rgba(255, 255, 255, 0.13);
}

.card h3 {
  margin: 0 0 10px;
  font-size: 20px;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.dark .card p {
  color: #c7d3dd;
}

a.card {
  display: block;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

a.card:hover {
  border-color: var(--blue);
  box-shadow: 0 12px 32px rgba(14, 111, 159, 0.14);
  transform: translateY(-2px);
}

.dark a.card:hover {
  border-color: rgba(158, 233, 231, 0.6);
}

.card-more {
  display: inline-block;
  margin-top: 14px;
  color: var(--blue);
  font-weight: 700;
  font-size: 14px;
}

.dark .card-more {
  color: #9ee9e7;
}

.feature-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 5px;
  color: #fff;
  background: #0e6f9f;
  font-size: 12px;
  font-weight: 720;
  margin-bottom: 14px;
}

.feature-kicker.green { background: #16825d; }
.feature-kicker.amber { background: #a46606; }
.feature-kicker.magenta { background: #a43d79; }

.command-panel {
  background: #10151d;
  color: #d9e8ee;
  border: 1px solid #253142;
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.command-panel .terminal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #94a9ba;
  font-size: 13px;
  margin-bottom: 12px;
}

.dots {
  display: inline-flex;
  gap: 5px;
}

.dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: block;
}

.dots i:nth-child(1) { background: #d76666; }
.dots i:nth-child(2) { background: #d7a84b; }
.dots i:nth-child(3) { background: #4eb576; }

pre {
  position: relative;
  margin: 0;
  overflow: auto;
  padding: 16px;
  border-radius: 8px;
  background: #10151d;
  color: #d9e8ee;
  line-height: 1.6;
  font-size: 13px;
}

.content pre {
  margin: 16px 0 24px;
}

.copy-code {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #3b4a5d;
  background: #172231;
  color: #d9e8ee;
  border-radius: 5px;
  cursor: pointer;
}

.steps {
  counter-reset: step;
  display: grid;
  gap: 14px;
}

.step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.step::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #dff1ee;
  color: #12654b;
  font-weight: 800;
}

.step h3 {
  margin: 0 0 6px;
}

.step p {
  margin: 0;
  color: var(--muted);
}

.page-hero {
  color: #fff;
  background:
    linear-gradient(90deg, rgba(5, 12, 20, 0.96), rgba(12, 32, 45, 0.88)),
    url("./klink-hero.png") center / cover no-repeat;
  padding: 86px 0 64px;
}

.page-hero h1 {
  font-size: clamp(38px, 7vw, 70px);
}

.page-hero p {
  max-width: 760px;
  margin: 0;
  color: #d7e4ee;
  font-size: 18px;
}

.docs-layout {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 42px;
  padding: 56px 0 80px;
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 92px;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.sidebar a {
  padding: 9px 10px;
  border-radius: 6px;
  color: #4b5968;
  font-size: 14px;
}

.sidebar a:hover,
.sidebar a.active {
  background: #eaf1f4;
  color: #0c1824;
}

.content {
  min-width: 0;
}

.content h2 {
  margin-top: 44px;
  margin-bottom: 12px;
  font-size: clamp(26px, 4vw, 38px);
}

.content h2:first-child {
  margin-top: 0;
}

.content h3 {
  margin-top: 28px;
  margin-bottom: 8px;
  font-size: 21px;
}

.content p,
.content li {
  color: #3d4a59;
  line-height: 1.8;
}

.content ul,
.content ol {
  padding-left: 22px;
}

.note,
.warning {
  margin: 20px 0;
  padding: 16px 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f5f8fa;
}

.warning {
  border-color: #efcf99;
  background: #fff7e8;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: table;
}

.data-table th,
.data-table td {
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  line-height: 1.55;
}

.data-table th {
  background: #eef3f6;
  color: #253142;
  font-size: 13px;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.flow-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.flow-item strong {
  display: block;
  margin-bottom: 6px;
}

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

/* ---- Tool reference helpers ---- */
.content code,
.data-table code {
  background: #eef3f6;
  border: 1px solid #dde5ec;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.88em;
  color: #0c3350;
  white-space: nowrap;
}

.content pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
  white-space: pre;
}

.domain-intro {
  margin: 8px 0 20px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #f5f9fb;
}

.domain-intro .token {
  display: inline-block;
  margin-bottom: 8px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  color: #0b5d86;
  background: #e3eef4;
  border-radius: 5px;
  padding: 3px 8px;
}

.domain-intro p {
  margin: 0;
  color: #33465a;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge.read { color: #0b5d86; background: #e3eef4; }
.badge.write { color: #12654b; background: #dff1ee; }
.badge.verify { color: #8a5300; background: #fdeecf; }
.badge.escape { color: #8f2f6a; background: #f6e2ee; }
.badge.mutates { color: #9a3838; background: #f7e2e2; }
.badge.long { color: #4b4368; background: #e8e6f2; }

.tool-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
}

.reftable td:first-child code {
  white-space: nowrap;
}

.reftable td:nth-child(2) {
  color: var(--muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.anchor-h {
  scroll-margin-top: 92px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 22px;
}

.pill-row a {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  color: #3d4a59;
  font-weight: 600;
}

.pill-row a:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.demo-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 22px 20px;
  margin: 22px 0;
  background: #fff;
}

.demo-card .tier {
  display: inline-block;
  margin: 18px 0 0;
  font-size: 12px;
  font-weight: 700;
  border-radius: 5px;
  padding: 3px 9px;
}

.tier.offline { color: #12654b; background: #dff1ee; }
.tier.live { color: #0b5d86; background: #e3eef4; }
.tier.photonics { color: #8f2f6a; background: #f6e2ee; }

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 4px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  background: #f7fafb;
  min-width: 90px;
}

.metric b {
  display: block;
  font-size: 19px;
  color: #0c1824;
}

.metric span {
  font-size: 12px;
  color: var(--muted);
}

.source-list {
  display: grid;
  gap: 10px;
}

.source-list a {
  color: #0e6f9f;
  font-weight: 680;
}

.footer {
  background: #07111d;
  color: #d7e4ee;
  padding: 38px 0;
}

.footer-grid {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 28px;
}

.footer h2,
.footer h3 {
  margin-top: 0;
}

.footer a {
  color: #9ee9e7;
}

.footer p {
  color: #b8c6d2;
}

@media (max-width: 920px) {
  .main-nav {
    position: absolute;
    left: 16px;
    right: 16px;
    top: 70px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    box-shadow: var(--shadow);
  }

  .main-nav.open {
    display: flex;
  }

  .menu-button {
    display: inline-grid;
    place-items: center;
  }

  .nav-actions .button-secondary {
    display: none;
  }

  .language-switch {
    margin-left: auto;
  }

  .grid.three,
  .grid.two,
  .footer-grid,
  .flow {
    grid-template-columns: 1fr;
  }

  .docs-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .sidebar {
    position: static;
  }

  .sidebar nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .sidebar a {
    white-space: nowrap;
  }

  .section-head {
    display: block;
  }

  .section-head p {
    margin-top: 12px;
  }
}

@media (max-width: 620px) {
  .nav-shell,
  .container,
  .docs-layout,
  .footer-grid {
    width: min(100% - 24px, 1180px);
  }

  .hero {
    min-height: 78vh;
    background-position: 62% center;
  }

  .hero-inner {
    padding: 74px 0 58px;
  }

  .hero h1,
  .page-hero h1 {
    font-size: clamp(42px, 15vw, 58px);
  }

  .hero-copy,
  .page-hero p {
    font-size: 16px;
  }

  .section {
    padding: 54px 0;
  }

  .data-table {
    display: block;
    overflow-x: auto;
  }
}
