:root {
  color-scheme: light;
  --gutter: clamp(18px, 4vw, 48px);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --type-meta: 0.75rem;
  --type-small: 0.8125rem;
  --type-body: 0.875rem;
  scroll-behavior: smooth;
  scroll-padding-top: 86px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ks-white);
  color: var(--ks-ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: var(--type-body);
  line-height: 1.65;
}

:lang(en) {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1, h2, h3, p, figure, pre { margin: 0; }
a { color: inherit; text-underline-offset: 0.23em; }
button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 2px solid var(--ks-action);
  outline-offset: 4px;
}

.shell {
  width: min(1200px, calc(100% - 2 * var(--gutter)));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: var(--gutter);
  z-index: 3;
  padding: 8px 16px;
  border-radius: 6px;
  background: var(--ks-action);
  color: white;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--ks-white);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.6vw, 36px);
  min-height: 64px;
  border-bottom: 1px solid var(--ks-line);
}

.wordmark {
  color: var(--ks-action-hover);
  font-size: 1.25rem;
  font-weight: 670;
  letter-spacing: -0.032em;
  text-decoration: none;
  line-height: 1.3;
}

.main-nav, .header-actions {
  display: flex;
  align-items: center;
}

.main-nav {
  margin-inline-start: auto;
  gap: clamp(14px, 2.25vw, 30px);
}

.main-nav a, .header-github {
  font-size: var(--type-small);
  font-weight: 550;
  white-space: nowrap;
  text-decoration: none;
}

.main-nav a:is(:hover, [aria-current="page"]), .header-github:hover, .footer-nav a:hover {
  color: var(--ks-action);
  text-decoration: underline;
}

.header-actions { gap: clamp(12px, 2.25vw, 24px); }

.lang-button, .copy-button {
  border: 1px solid var(--ks-line);
  border-radius: 7px;
  background: transparent;
  color: var(--ks-action-hover);
  cursor: pointer;
  font-weight: 560;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.lang-button { min-width: 42px; min-height: 34px; padding: 4px 8px; font-size: var(--type-meta); }

.lang-button:hover, .copy-button:hover {
  background: var(--ks-white);
  border-color: var(--ks-action);
}

.hero { text-align: center; }

.hero-copy {
  padding-top: clamp(36px, 5.5vw, 76px);
}

.hero h1 {
  position: relative;
  max-inline-size: 1000px;
  margin-inline: auto;
  color: var(--ks-action-hover);
  font-size: clamp(1.75rem, 4.15vw, 3.4rem);
  font-weight: 650;
  letter-spacing: -0.028em;
  line-height: 1.17;
  text-shadow: 0 -1px #b5d7e3, 0 1px #f0faff, 0 2px #9dc9d8, 0 3px #d9edf4;
  text-wrap: balance;
}

.hero h1:lang(en) { max-inline-size: 24ch; letter-spacing: -0.036em; }

.hero h1::after {
  position: absolute;
  inset: 0;
  color: #2b708e;
  text-shadow: 0 -1px #9bc7d8;
  /* Follow each line box so the gloss moves with the heading as it wraps. */
  clip-path: polygon(
    0 0, 100% 0, 100% .47lh, 0 .56lh,
    0 1lh, 100% 1lh, 100% 1.47lh, 0 1.56lh,
    0 2lh, 100% 2lh, 100% 2.47lh, 0 2.56lh,
    0 3lh, 100% 3lh, 100% 3.47lh, 0 3.56lh
  );
  pointer-events: none;
  user-select: none;
  content: attr(data-zh) / "";
}

.hero h1:lang(en)::after { content: attr(data-en) / ""; }

@media (forced-colors: active) {
  .hero h1 { text-shadow: none; }
  .hero h1::after { content: none; }
}

.hero-copy > p {
  max-inline-size: 740px;
  margin: 13px auto 0;
  color: var(--ks-muted);
  font-size: clamp(var(--type-body), 1.3vw, 1rem);
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  column-gap: clamp(14px, 3vw, 28px);
  row-gap: 8px;
  margin-top: 20px;
}

.primary-action, .text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 7px;
  font-weight: 580;
}

.primary-action {
  padding: 7px 18px;
  background: var(--ks-action);
  color: white;
  text-decoration: none;
  transition: background-color 180ms ease, transform 180ms ease;
}

.primary-action:hover {
  background: var(--ks-action-hover);
  transform: translateY(-2px);
}

.text-action {
  padding: 4px 5px;
  color: var(--ks-action-hover);
  text-decoration-color: var(--ks-line);
}

.text-action:hover { text-decoration-color: currentColor; }

.system-diagram {
  width: min(1060px, 100%);
  margin: clamp(28px, 4vw, 44px) auto clamp(28px, 4.4vw, 55px);
  text-align: start;
}

.system-apps {
  --application-gap: clamp(6px, 1.5vw, 16px);
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--application-gap);
  width: min(830px, 100%);
  margin-inline: auto;
}

.system-app {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 47px;
  padding: 5px;
  border: 1px solid var(--ks-line);
  border-radius: 8px;
  background: var(--ks-cyan-wash);
  color: var(--ks-ink);
  font-weight: 630;
  line-height: 1.25;
  text-align: center;
}

.system-icon {
  position: relative;
  flex: none;
  width: 18px;
  height: 15px;
  border: 1.5px solid;
  border-radius: 2px;
  color: var(--ks-accent);
}

.system-icon::before, .system-icon::after {
  position: absolute;
  content: "";
}

.system-icon--database {
  height: 18px;
  border-radius: 50% / 4px;
}

.system-icon--database::before, .system-icon--database::after {
  inset-inline: -1.5px;
  top: -1.5px;
  height: 7px;
  border: 1.5px solid;
  border-radius: 50%;
}

.system-icon--database::after { top: 3px; border-top-color: transparent; }

.system-icon--warehouse::before, .system-icon--warehouse::after {
  inset-inline: 3px;
  top: 3px;
  border-top: 1.5px solid;
}

.system-icon--warehouse::after { top: 7px; }

.system-icon--objects {
  width: 8px;
  height: 8px;
  margin: 0 6px 7px;
}

.system-icon--objects::before, .system-icon--objects::after {
  top: 6px;
  left: -6.5px;
  width: 8px;
  height: 8px;
  border: 1.5px solid;
  border-radius: 2px;
}

.system-icon--objects::after { left: 4px; }

.system-icon--folder::before {
  top: -4.5px;
  left: -1.5px;
  width: 8px;
  height: 4px;
  border: 1.5px solid;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: var(--ks-cyan-wash);
}

.system-app::after, .system-sdk::before, .system-sdk::after {
  position: absolute;
  left: 50%;
  border-inline-start: 1px solid var(--ks-accent);
  content: "";
}

.system-app::after { top: 100%; height: 11px; }

.system-apps::after {
  position: absolute;
  inset-inline: calc((100% - 3 * var(--application-gap)) / 8);
  top: calc(100% + 10px);
  border-top: 1px solid var(--ks-accent);
  content: "";
}

.system-sdk {
  position: relative;
  width: fit-content;
  margin: 22px auto 19px;
  padding: 6px 25px;
  border-radius: 6px;
  background: var(--ks-action);
  color: var(--ks-white);
  font-family: var(--mono);
  font-weight: 650;
  line-height: 1.45;
}

.system-sdk::before { bottom: 100%; height: 12px; }
.system-sdk::after { top: 100%; height: 19px; }

.system-core {
  padding: clamp(8px, 1.6vw, 18px);
  border: 1px solid var(--ks-line);
  border-radius: 10px;
  background: #e6f3f8;
}

.system-core > h2 {
  position: relative;
  margin-bottom: 18px;
  color: var(--ks-ink);
  font-size: clamp(1rem, 1.85vw, 1.38rem);
  font-weight: 660;
  line-height: 1.25;
  text-align: center;
}

.system-core > h2::after {
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  height: 8px;
  border-inline-start: 1px solid var(--ks-accent);
  content: "";
}

.system-planes {
  --control-width: max(224px, calc((100% - 12px) * 0.31));
  position: relative;
  display: grid;
  grid-template-columns: var(--control-width) minmax(0, 1fr);
  gap: 12px;
}

.system-planes::before, .system-planes::after {
  position: absolute;
  top: -8px;
  border-top: 1px solid var(--ks-accent);
  content: "";
}

.system-planes::before {
  inset-inline: 50% calc((100% - var(--control-width) - 12px) / 2);
}

.system-planes::after {
  inset-inline: calc(var(--control-width) / 2) 50%;
  border-top-style: dashed;
}

.system-plane {
  position: relative;
  min-width: 0;
  padding: clamp(9px, 1.3vw, 15px);
  border: 1px solid var(--ks-line);
  border-radius: 8px;
  background: #f5fafc;
}

.system-plane::before {
  position: absolute;
  bottom: 100%;
  left: 50%;
  height: 8px;
  border-inline-start: 1px solid var(--ks-accent);
  content: "";
}

.system-control::before { border-inline-start-style: dashed; }

.system-plane-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 3px 8px;
  margin-bottom: 12px;
}

.system-plane-heading h3 {
  color: var(--ks-ink);
  font-size: var(--type-body);
  font-weight: 680;
}

.system-plane-heading > span, .system-data-note {
  color: var(--ks-muted);
  font-size: var(--type-meta);
  line-height: 1.35;
}

.system-services {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.system-service, .system-metastore {
  position: relative;
  display: grid;
  place-content: center;
  padding: 6px 3px;
  border: 1px solid var(--ks-accent);
  border-radius: 5px;
  background: var(--ks-cyan-wash);
  color: var(--ks-ink);
  text-align: center;
}

.system-service { min-height: 44px; }

.system-service strong, .system-metastore strong {
  font-size: var(--type-small);
  font-weight: 670;
}

.system-services::after, .system-service::after, .system-metastore::before {
  position: absolute;
  background: var(--ks-accent);
  content: "";
}

.system-service::after { left: 50%; top: 100%; width: 1px; height: 10px; }
.system-services::after { inset-inline: calc((100% - 8px) / 4); top: calc(100% + 9px); height: 1px; }
.system-metastore::before { left: 50%; bottom: 100%; width: 1px; height: 11px; }

.system-metastore {
  width: min(152px, 100%);
  min-height: 57px;
  margin-inline: auto;
}

.system-metastore span { color: var(--ks-muted); font-size: var(--type-meta); }

.system-racks, .system-rack-hosts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.system-rack {
  padding: 7px;
  border: 1px solid var(--ks-line-soft);
  border-radius: 6px;
  background: var(--ks-cyan-wash);
}

.system-rack h4 {
  margin: 0 0 6px;
  color: var(--ks-ink);
  font-size: var(--type-small);
  font-weight: 655;
  line-height: 1.35;
  text-align: center;
}

.system-host { min-width: 0; }

.system-host-name {
  display: block;
  margin-block: 0 4px;
  color: var(--ks-action-hover);
  font-size: var(--type-meta);
  font-weight: 650;
  line-height: 1.3;
  text-align: center;
}

.system-host-chassis {
  position: relative;
  padding: 17px 4px 4px;
  border: 1px solid var(--ks-accent);
  border-radius: 5px;
  background: var(--ks-white);
}

.system-host-chassis::before, .system-host-chassis::after {
  position: absolute;
  border-radius: 2px;
  background: var(--ks-accent);
  content: "";
}

.system-host-chassis::before {
  top: 5px;
  left: 6px;
  width: 2px;
  height: 7px;
  box-shadow: 4px 0 var(--ks-accent), 8px 0 var(--ks-accent), 12px 0 var(--ks-accent);
}

.system-host-chassis::after { top: 6px; right: 6px; width: 5px; height: 5px; }

.system-disks {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.system-disks li { min-width: 0; }

.system-chunks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 3px;
  padding: 2px;
  border: 1px solid var(--ks-line);
  border-radius: 3px;
}

.system-chunks > span {
  height: 11px;
  border: 1px solid var(--ks-line-soft);
  border-radius: 2px;
  background: var(--ks-cyan-wash);
}

.system-data-note {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 12px;
  margin-top: 8px;
}

.system-key { display: inline-flex; align-items: center; gap: 5px; }
.system-key i { width: 14px; height: 8px; border: 1px solid var(--ks-line); border-radius: 2px; background: var(--ks-white); }
.system-key--chunk i { width: 9px; border-color: var(--ks-line-soft); background: var(--ks-cyan-wash); }

.ec-write {
  --ec-accent: var(--ks-action);
  --ec-stripe: var(--ks-cyan-wash);
  --ec-track: var(--ks-accent);
  --ec-cycle: 5.6s;
  --ec-play-state: running;
  isolation: isolate;
  width: min(800px, 100%);
  margin: clamp(18px, 2.4vw, 32px) auto clamp(22px, 3vw, 40px);
  padding: 8px clamp(10px, 2vw, 20px);
  border: 1px solid var(--ks-line);
  border-radius: 12px;
  background: var(--ks-white);
  text-align: start;
}

.ec-write.is-paused { --ec-play-state: paused; }

.ec-header {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--ks-line-soft);
}

.ec-title {
  color: var(--ks-action-hover);
  font-size: var(--type-small);
  font-weight: 640;
}

.ec-mode, .ec-stripe, .ec-shard, .ec-chunk {
  font-family: var(--mono);
  font-size: var(--type-meta);
  font-variant-numeric: tabular-nums;
}

.ec-mode {
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--ks-cyan-wash);
  color: var(--ks-action-hover);
  white-space: nowrap;
}

.ec-playback {
  min-height: 26px;
  margin-inline-start: auto;
  padding: 1px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--ks-action);
  font-size: var(--type-meta);
  white-space: nowrap;
  cursor: pointer;
}

.ec-playback:hover {
  border-color: var(--ks-line-soft);
  background: var(--ks-cyan-wash);
}

.ec-playback:focus-visible { outline-offset: 1px; }

.ec-plot {
  --ec-stage-width: 136px;
  --ec-stage-gap: clamp(16px, 3vw, 30px);
  --ec-origin: calc(50% + (var(--ec-stage-width) + var(--ec-stage-gap)) / 2);
  padding-block: 9px 7px;
}

.ec-pipeline {
  display: grid;
  grid-template-columns: var(--ec-stage-width) var(--ec-stage-gap) var(--ec-stage-width);
  align-items: center;
  justify-content: center;
}

.ec-stage {
  display: grid;
  align-self: stretch;
  align-content: center;
  justify-items: center;
  gap: 3px;
  min-width: 0;
  min-height: 44px;
  padding: 5px 7px;
  border: 1px solid var(--ks-line);
  border-radius: 6px;
  background: var(--ks-cyan-wash);
  text-align: center;
}

.ec-stage-title {
  color: var(--ks-action-hover);
  font-size: var(--type-small);
  font-weight: 640;
  line-height: 1.2;
}

.ec-stage-label {
  color: var(--ks-muted);
  font-size: var(--type-meta);
  line-height: 1.25;
}

.ec-stripe {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  line-height: 1.3;
}

.ec-stripe span, .ec-shard {
  border-radius: 3px;
  background: var(--ec-stripe);
  color: var(--ec-accent);
  font-weight: 650;
}

.ec-wire {
  position: relative;
  height: 1px;
  background: var(--ec-track);
}

.ec-feed {
  display: block;
  width: 1px;
  height: 11px;
  margin-inline-start: var(--ec-origin);
}

.ec-wire::after, .ec-packet {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 0;
  width: 8px;
  height: 4px;
  transform: translate(-50%, -50%);
  border-radius: 2px;
  background: var(--ec-accent);
  opacity: 0;
  pointer-events: none;
  content: "";
}

.ec-feed::after { top: 0; left: 50%; width: 4px; height: 7px; }

.ec-hosts {
  --ec-columns: 6;
  --ec-gap: clamp(5px, 0.8vw, 8px);
  --ec-spine: 0px;
  --ec-drop: 13px;
  --ec-host-height: 88px;
  --ec-row-gap: 7px;
  --ec-second-rail: calc(var(--ec-host-height) + var(--ec-row-gap));
  /* Derive the rail endpoints and packet destinations from the same grid. */
  --ec-card-width: calc((100% - var(--ec-spine) - (var(--ec-columns) - 1) * var(--ec-gap)) / var(--ec-columns));
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--ec-columns), minmax(0, 1fr));
  grid-auto-rows: var(--ec-host-height);
  gap: var(--ec-row-gap) var(--ec-gap);
  margin: 0;
  padding: 0;
  padding-inline-start: var(--ec-spine);
  list-style: none;
}

.ec-hosts::before {
  position: absolute;
  inset-inline: calc(var(--ec-spine) + var(--ec-card-width) / 2) calc(var(--ec-card-width) / 2);
  top: 0;
  height: 1px;
  background: var(--ec-track);
  content: "";
}

.ec-host {
  --ec-column: 0;
  --ec-rail-y: 0px;
  --ec-destination: calc(var(--ec-spine) + var(--ec-card-width) / 2 + var(--ec-column) * (var(--ec-card-width) + var(--ec-gap)));
  display: grid;
  grid-template-rows: var(--ec-drop) minmax(0, 1fr);
  min-width: 0;
}

.ec-host:nth-child(2) { --ec-column: 1; }
.ec-host:nth-child(3) { --ec-column: 2; }
.ec-host:nth-child(4) { --ec-column: 3; }
.ec-host:nth-child(5) { --ec-column: 4; }
.ec-host:nth-child(6) { --ec-column: 5; }

.ec-stem {
  width: 1px;
  height: 100%;
  justify-self: center;
  background: var(--ec-track);
}

.ec-parity {
  --ec-accent: var(--ks-indigo);
  --ec-stripe: var(--ks-indigo-wash);
  --ec-track: var(--ks-indigo);
}

.ec-parity .ec-stem {
  border-inline-start: 1px dashed var(--ec-track);
  background: none;
}

.ec-host-card {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--ks-line);
  border-radius: 6px;
  background: var(--ks-white);
}

.ec-host-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  color: var(--ks-action-hover);
  font-size: var(--type-meta);
  font-weight: 620;
  line-height: 1.15;
  white-space: nowrap;
}

.ec-shard { padding: 1px 3px; }

.ec-disks, .ec-chunks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.ec-disk {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 3px 2px;
  border: 1px solid var(--ks-line-soft);
  border-radius: 4px;
  background: var(--ks-cyan-wash);
  text-align: center;
}

.ec-disk-label {
  color: var(--ks-muted);
  font-size: var(--type-meta);
  line-height: 1.1;
  white-space: nowrap;
}

.ec-chunks { gap: 2px; }

.ec-chunk {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 16px;
  border: 1px solid var(--ks-line-soft);
  border-radius: 3px;
  background: var(--ks-white);
  color: var(--ks-muted);
  line-height: 1;
}

.ec-disk-target { border-color: var(--ec-track); background: var(--ec-stripe); }

.ec-chunk-target {
  border-color: var(--ec-track);
  color: var(--ec-accent);
  font-weight: 700;
}

.ec-chunk-target::after {
  position: absolute;
  inset-inline: 1px;
  bottom: 1px;
  height: 2px;
  border-radius: 1px;
  background: var(--ec-accent);
  transform-origin: left;
  content: "";
}

.ec-caption {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2px 11px;
  padding-top: 4px;
  border-top: 1px solid var(--ks-line-soft);
  color: var(--ks-muted);
  font-size: var(--type-meta);
  line-height: 1.35;
}

.ec-legend { display: flex; flex-wrap: wrap; gap: 1px 11px; }
.ec-disk-key { justify-self: center; }
.ec-key, .ec-confirmed { display: inline-flex; align-items: center; gap: 5px; }

.ec-key::before {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--ec-accent);
  content: "";
}

.ec-confirmed::before {
  flex: none;
  width: 8px;
  height: 4px;
  transform: translateY(-1px) rotate(-45deg);
  border-bottom: 1px solid var(--ks-action);
  border-left: 1px solid var(--ks-action);
  content: "";
}

/* Share one loop so packet arrival, disk writes and acknowledgements stay aligned. */
.ec-write.is-animated .ec-stripe { animation: ec-split var(--ec-cycle) linear infinite var(--ec-play-state); }
.ec-write.is-animated .ec-send::after { animation: ec-send var(--ec-cycle) linear infinite var(--ec-play-state); }
.ec-write.is-animated .ec-encoder { animation: ec-encode var(--ec-cycle) linear infinite var(--ec-play-state); }
.ec-write.is-animated .ec-feed::after { animation: ec-feed var(--ec-cycle) linear infinite var(--ec-play-state); }
.ec-write.is-animated .ec-packet { animation: ec-distribute var(--ec-cycle) linear infinite var(--ec-play-state); }
.ec-write.is-animated .ec-disk-target { animation: ec-disk-write var(--ec-cycle) linear infinite var(--ec-play-state); }
.ec-write.is-animated .ec-chunk-target::after { animation: ec-chunk-write var(--ec-cycle) linear infinite var(--ec-play-state); }
.ec-write.is-animated .ec-confirmed::before { animation: ec-confirm var(--ec-cycle) linear infinite var(--ec-play-state); }

@keyframes ec-split {
  0%, 3% { gap: 0; }
  11%, 100% { gap: 4px; }
}

@keyframes ec-send {
  0%, 8% { left: 0; opacity: 0; }
  10%, 18% { opacity: 1; }
  21%, 100% { left: 100%; opacity: 0; }
}

@keyframes ec-encode {
  0%, 15%, 30%, 100% { border-color: var(--ks-line); box-shadow: none; }
  24% { border-color: var(--ec-accent); box-shadow: inset 0 0 14px #6c987c28; }
}

@keyframes ec-feed {
  0%, 26% { top: 0; opacity: 0; }
  28%, 34% { opacity: 1; }
  36%, 100% { top: 100%; opacity: 0; }
}

@keyframes ec-distribute {
  0%, 33% { left: var(--ec-origin); top: 0; opacity: 0; }
  35% { opacity: 1; }
  49% { left: var(--ec-destination); top: var(--ec-rail-y); opacity: 1; }
  57% { opacity: 1; }
  60%, 100% { left: var(--ec-destination); top: calc(var(--ec-rail-y) + var(--ec-drop)); opacity: 0; }
}

@keyframes ec-distribute-second-row {
  0%, 33% { left: var(--ec-origin); top: 0; opacity: 0; }
  35% { opacity: 1; }
  41% { left: 0; top: 0; opacity: 1; }
  49% { left: 0; top: var(--ec-rail-y); opacity: 1; }
  56% { left: var(--ec-destination); top: var(--ec-rail-y); opacity: 1; }
  59% { opacity: 1; }
  62%, 100% { left: var(--ec-destination); top: calc(var(--ec-rail-y) + var(--ec-drop)); opacity: 0; }
}

@keyframes ec-disk-write {
  0%, 59%, 100% { border-color: var(--ks-line-soft); background: var(--ks-cyan-wash); }
  66%, 97% { border-color: var(--ec-track); background: var(--ec-stripe); }
}

@keyframes ec-chunk-write {
  0%, 64% { transform: scaleX(0); }
  75%, 97% { transform: scaleX(1); }
  100% { transform: scaleX(0); }
}

@keyframes ec-confirm {
  0%, 76%, 100% { opacity: 0; }
  81%, 97% { opacity: 1; }
}

.content-section {
  position: relative;
  padding-block: clamp(28px, 4.15vw, 52px);
  border-top: 1px solid var(--ks-line);
}

.content-section h2 {
  margin-bottom: clamp(15px, 2.15vw, 25px);
  font-size: clamp(1.375rem, 2.55vw, 2rem);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.027em;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 1.6vw, 18px);
}

.feature-card {
  --feature-accent: var(--ks-accent);
  --feature-surface: var(--ks-cyan-wash);
  min-width: 0;
  padding: clamp(15px, 2vw, 22px);
  border: 1px solid var(--ks-line-soft);
  border-top: 2px solid var(--feature-accent);
  border-radius: 8px;
  background: var(--feature-surface);
}

.feature-card:nth-child(2) {
  --feature-accent: var(--ks-indigo);
  --feature-surface: var(--ks-indigo-wash);
}

.feature-card:nth-child(3) {
  --feature-accent: var(--ks-action);
  --feature-surface: var(--ks-blue-wash);
}

.feature-card:nth-child(4) {
  --feature-accent: var(--ks-line);
  --feature-surface: var(--ks-slate-wash);
}

.feature-card h3 {
  color: var(--ks-ink);
  font-size: clamp(1rem, 1.7vw, 1.2rem);
  font-weight: 655;
  line-height: 1.32;
}

.feature-card p, .section-note {
  max-width: 72ch;
  margin-top: 7px;
  color: var(--ks-muted);
}

.feature-ec {
  margin-top: clamp(14px, 2.5vw, 24px);
  container: ec-feature / inline-size;
}

.feature-ec .ec-write { margin: 0 auto; }

.anchor { position: absolute; inset-block-start: 0; }

.section-note { margin-bottom: 14px; }

.sdk-tabs {
  display: flex;
  align-items: stretch;
  gap: 5px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--ks-line);
}

.sdk-tab {
  min-width: 58px;
  min-height: 40px;
  padding: 5px 12px;
  border: 0;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--ks-action-hover);
  font-weight: 620;
  cursor: pointer;
}

.sdk-tab:hover { background: var(--ks-blue-wash); }
.sdk-tab[aria-selected="true"] { background: var(--ks-action); color: white; }

.example-panels { display: grid; gap: 12px; }

.example {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ks-line);
  border-radius: 10px;
  background: var(--ks-slate-wash);
}

.example-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 6px clamp(13px, 1.65vw, 20px);
  border-bottom: 1px solid var(--ks-line-soft);
  background: var(--ks-blue-wash);
  color: var(--ks-action-hover);
}

.example-header h3 { font-size: var(--type-body); font-weight: 620; }
.copy-button { min-width: 62px; min-height: 32px; padding: 2px 8px; font-size: var(--type-meta); }
.copy-button:focus-visible { outline-offset: 2px; }

.example pre {
  padding: 14px clamp(10px, 1.65vw, 20px);
  overflow: auto;
  font: 400 clamp(0.78125rem, 1.25vw, var(--type-body))/1.55 var(--mono);
}

.example pre:focus-visible { outline-offset: -2px; }

.example code { font-family: var(--mono); }
.code-keyword { color: var(--ks-indigo); }
.code-call { color: var(--ks-action-hover); font-weight: 650; }

.technology-panel {
  overflow: hidden;
  border: 1px solid var(--ks-line);
  border-radius: 10px;
}

.technology-table {
  width: 100%;
  border-collapse: collapse;
  text-align: start;
}

.technology-table th, .technology-table td {
  padding: 11px clamp(12px, 2vw, 20px);
  text-align: start;
  vertical-align: baseline;
}

.technology-table thead {
  background: var(--ks-blue-wash);
  color: var(--ks-action-hover);
  font-size: var(--type-small);
}

.technology-table tbody tr { border-top: 1px solid var(--ks-line-soft); }
.technology-table tbody th { width: 24%; min-width: 110px; color: var(--ks-ink); font-weight: 650; }
.technology-table td { color: var(--ks-muted); }
.api-list { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-bottom: 6px; }
.api-list code {
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--ks-cyan-wash);
  color: var(--ks-action-hover);
  font-family: var(--mono);
  font-size: var(--type-meta);
}

.reference-link { color: var(--ks-action); font-weight: 600; }

.docs-main { max-width: 860px; font-size: 1rem; }

.docs-intro { padding-block: clamp(36px, 6vw, 68px) 25px; }
.docs-intro h1 { font-size: clamp(1.9rem, 4vw, 3rem); font-weight: 660; line-height: 1.16; }
.docs-intro p { max-width: 62ch; margin-top: 12px; color: var(--ks-muted); }

.docs-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 18px;
  margin-bottom: 24px;
  padding: 9px 14px;
  border: 1px solid var(--ks-line-soft);
  border-radius: 7px;
  background: var(--ks-cyan-wash);
}

.docs-section > p { max-width: 72ch; margin-block: 12px; color: var(--ks-muted); }
.docs-section > .example { margin-block: 12px; }
.docs-section li + li { margin-top: 6px; }
.docs-section :is(li, p) code { overflow-wrap: anywhere; color: var(--ks-action-hover); font-family: var(--mono); }
.docs-section h3 { margin-block: 16px 6px; font-size: 1rem; }

.site-footer {
  padding-block: 25px 20px;
  border-top: 1px solid var(--ks-line);
  background: var(--ks-slate-wash);
}

.footer-main, .legal, .footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 22px;
}

.footer-main, .legal { justify-content: space-between; }
.footer-main p { margin-top: 5px; color: var(--ks-action-hover); font-size: var(--type-small); }

.footer-nav a {
  color: var(--ks-muted);
  font-size: var(--type-small);
  text-decoration: none;
}

.footer-nav .github-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ks-action-hover);
  font-weight: 650;
}

.legal {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--ks-line);
  color: var(--ks-muted);
  font-size: var(--type-meta);
}

@media (max-width: 850px) {
  :root { scroll-padding-top: 18px; }
  .site-header { position: static; }

  .header-inner { flex-wrap: wrap; gap: 0 14px; padding-top: 12px; }
  .header-actions { margin-inline-start: auto; }
  .main-nav {
    order: 1;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
    min-height: 42px;
    margin: 5px 0 0;
    gap: 0 7px;
  }

  .main-nav a { padding-block: 7px; }
  .lang-button { min-height: 42px; }
}

@media (max-width: 880px) {
  .system-core > h2 { margin-bottom: 12px; }
  .system-planes { grid-template-columns: minmax(0, 1fr); }
  .system-core > h2::after, .system-planes::before, .system-planes::after, .system-plane::before { display: none; }
  .system-services { max-width: 340px; margin-inline: auto; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 630px) {
  .hero-copy > p { margin-top: 11px; }
  .hero-actions { margin-top: 16px; }
  .primary-action, .text-action, .sdk-tab { min-height: 44px; }
  .system-app { flex-direction: column; gap: 6px; min-height: 58px; font-size: var(--type-meta); }
  .system-app > span:last-child { overflow-wrap: anywhere; }
}

@container ec-feature (max-width: 650px) {
  .ec-write { margin-block: 11px 17px; padding: 4px 8px; }
  .ec-header { gap: 6px; min-height: 27px; padding-bottom: 2px; }
  .ec-title { font-size: var(--type-meta); }
  .ec-playback { min-height: 24px; }

  .ec-plot {
    --ec-origin: calc(75% + var(--ec-stage-gap) / 4);
    padding-block: 5px;
  }

  .ec-pipeline { grid-template-columns: minmax(0, 1fr) var(--ec-stage-gap) minmax(0, 1fr); }
  .ec-stage { min-height: 39px; padding: 3px 5px; }
  .ec-stage-title { font-size: var(--type-meta); }
  .ec-feed { height: 8px; }

  .ec-hosts {
    --ec-columns: 3;
    --ec-spine: 7px;
    --ec-gap: 4px;
    --ec-drop: 9px;
    --ec-host-height: 70px;
    --ec-row-gap: 6px;
  }

  .ec-hosts::before {
    inset-inline-start: 0;
    height: calc(var(--ec-second-rail) + 1px);
    border-top: 1px solid var(--ec-track);
    border-inline-start: 1px solid var(--ec-track);
    background: transparent;
  }

  .ec-hosts::after {
    position: absolute;
    inset-inline: 0 calc(var(--ec-card-width) / 2);
    top: var(--ec-second-rail);
    height: 1px;
    background: var(--ec-track);
    content: "";
  }

  .ec-host:nth-child(n + 4) { --ec-rail-y: var(--ec-second-rail); }
  .ec-host:nth-child(4) { --ec-column: 0; }
  .ec-host:nth-child(5) { --ec-column: 1; }
  .ec-host:nth-child(6) { --ec-column: 2; }
  .ec-write.is-animated .ec-host:nth-child(n + 4) .ec-packet { animation-name: ec-distribute-second-row; }

  .ec-host-card { gap: 3px; padding: 3px; }
  .ec-disks { gap: 3px; }
  .ec-disk { padding: 2px 1px; }
  .ec-disk-label { letter-spacing: -0.024em; }
  .ec-chunk { min-height: 14px; }

  .ec-caption { grid-template-columns: 1fr auto; }
  .ec-confirmed { grid-column: 2; grid-row: 1; }
  .ec-disk-key { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 470px) {
  .technology-table tbody th { min-width: 92px; }
  .technology-table th, .technology-table td { padding-inline: 9px; }
}

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

  .ec-playback { display: none; }
  .primary-action:hover { transform: none; }
}
