:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --paper: #ffffff;
  --ink: #17202a;
  --muted: #5f6d7a;
  --line: #d8e0e8;
  --blue: #2f5f6f;
  --cyan: #4aa3a2;
  --rose: #d94f70;
  --green: #2f9e78;
  --amber: #e59a32;
  --shadow: 0 18px 45px rgba(23, 32, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.6;
}

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

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

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(216, 224, 232, 0.85);
  background: rgba(246, 248, 251, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 760;
}

.brand-mark {
  position: relative;
  width: 28px;
  height: 28px;
  border: 2px solid var(--blue);
  border-radius: 50%;
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: "";
  border-radius: 50%;
  background: var(--rose);
}

.brand-mark::before {
  width: 7px;
  height: 7px;
  left: 5px;
  top: 6px;
}

.brand-mark::after {
  width: 5px;
  height: 5px;
  right: 5px;
  bottom: 6px;
  background: var(--green);
}

.builder-note {
  color: var(--muted);
  font-size: 14px;
  font-weight: 680;
  text-align: right;
}

.builder-note a {
  color: var(--blue);
  font-weight: 820;
}

.builder-note a:hover,
.builder-note a:focus-visible {
  text-decoration: underline;
  outline: none;
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 0.8fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  max-width: 1180px;
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  padding: clamp(44px, 6vw, 76px) 24px;
}

.hero-copy {
  max-width: 680px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 20px;
  font-size: clamp(34px, 4.8vw, 58px);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(30px, 3.2vw, 46px);
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.hero-text {
  max-width: 660px;
  color: var(--muted);
  font-size: 18px;
}

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

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 760;
}

.primary-link {
  background: var(--blue);
  color: #fff;
}

.secondary-link {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.primary-link:hover,
.secondary-link:hover,
.primary-link:focus-visible,
.secondary-link:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(47, 95, 111, 0.17);
  outline: none;
}

.hero-media {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero-media img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.hero-media figcaption {
  padding: 12px 14px 14px;
  color: var(--muted);
  font-size: 13px;
}

.content-band {
  padding: clamp(54px, 7vw, 88px) 24px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.content-band:nth-of-type(odd) {
  background: #f9fbfd;
}

.feature-band {
  background: #eef4f5;
}

.section-heading {
  max-width: 900px;
  margin: 0 auto 30px;
}

.section-heading p:not(.eyebrow) {
  max-width: 760px;
  color: var(--muted);
  font-size: 17px;
}

.section-heading.compact {
  margin-bottom: 24px;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto 22px;
}

.method-step,
.result-card,
.decision-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.method-step {
  min-height: 190px;
  padding: 20px;
}

.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 28px;
  margin-bottom: 18px;
  border-radius: 8px;
  background: #e7f2f1;
  color: var(--blue);
  font-size: 13px;
  font-weight: 820;
}

.method-step p {
  color: var(--muted);
  font-size: 15px;
}

.algorithm-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.44fr) minmax(0, 1fr);
  gap: 22px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111922;
  color: #e9f2f4;
}

.algorithm-panel p {
  color: #b9c9cf;
}

.algorithm-panel .eyebrow {
  color: #84d1cc;
}

.algorithm-panel code {
  color: #e9f2f4;
}

pre {
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  border-radius: 8px;
  background: #0a1118;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

pre code {
  display: block;
  padding: 18px;
  line-height: 1.55;
  white-space: pre;
}

.algo-line {
  display: list-item;
  padding: 1px 6px;
  border-radius: 3px;
  transition: background-color 160ms ease, box-shadow 160ms ease;
}

.algo-line.is-active {
  background: rgba(217, 79, 112, 0.22);
  box-shadow: -3px 0 0 var(--rose);
}

.algo-pseudo {
  margin: 0;
  padding: 18px 18px 18px 52px;
  background: #0a1118;
  border-radius: 8px;
  list-style-position: outside;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  color: #e9f2f4;
  line-height: 1.7;
  counter-reset: algo;
}

.algo-pseudo > li {
  list-style: none;
  position: relative;
  padding-left: 4px;
}

.algo-pseudo > li::before {
  counter-increment: algo;
  content: counter(algo) ":";
  position: absolute;
  left: -36px;
  color: #6b8189;
  width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.algo-pseudo b {
  color: #84d1cc;
  font-weight: 600;
}

.algo-pseudo .algo-comment {
  color: #6b8189;
  font-style: italic;
}

.algo-pseudo .algo-indent-1 { padding-left: 1.5em; }
.algo-pseudo .algo-indent-2 { padding-left: 3em; }
.algo-pseudo .algo-indent-3 { padding-left: 4.5em; }
.algo-pseudo .algo-indent-4 { padding-left: 6em; }
.algo-pseudo .algo-indent-5 { padding-left: 7.5em; }

.demo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}

.tracking-stage {
  min-width: 0;
  border: 1px solid #cbd9dc;
  border-radius: 8px;
  background: #fbfcfd;
  box-shadow: 0 16px 38px rgba(47, 95, 111, 0.13);
}

#trackingCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 7 / 4;
  border-bottom: 1px solid #dbe7e9;
}

.stage-controls {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) minmax(160px, 0.42fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid #cbd9dc;
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
}

.pause-icon,
.play-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
}

.pause-icon::before,
.pause-icon::after {
  position: absolute;
  top: 2px;
  width: 5px;
  height: 14px;
  border-radius: 2px;
  background: var(--blue);
  content: "";
}

.pause-icon::before {
  left: 3px;
}

.pause-icon::after {
  right: 3px;
}

.play-icon {
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid var(--blue);
}

.range-control {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 740;
  text-transform: uppercase;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.demo-side {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.scenario-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid #cbd9dc;
  border-radius: 8px;
  background: #dfeaec;
}

.scenario-button {
  min-height: 38px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #3d5158;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 760;
  line-height: 1.15;
}

.scenario-button.is-active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 5px 14px rgba(47, 95, 111, 0.12);
}

.icon-button:hover,
.scenario-button:hover,
.icon-button:focus-visible,
.scenario-button:focus-visible {
  outline: 2px solid rgba(74, 163, 162, 0.4);
  outline-offset: 2px;
}

.decision-card {
  padding: 18px;
}

.decision-card p:not(.eyebrow) {
  color: var(--muted);
}

.decision-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 0;
}

.decision-metrics div {
  padding: 10px;
  border: 1px solid #e4eaef;
  border-radius: 8px;
  background: #f8fafb;
}

.decision-metrics dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
  text-transform: uppercase;
}

.decision-metrics dd {
  margin: 2px 0 0;
  font-weight: 840;
}

.pipeline-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pipeline-list li {
  padding: 13px 14px;
  border-left: 4px solid #cddbe0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.pipeline-list li.is-active {
  border-left-color: var(--rose);
  background: #fff;
  box-shadow: 0 10px 24px rgba(47, 95, 111, 0.11);
}

.pipeline-list span {
  display: block;
  margin-bottom: 2px;
  font-weight: 820;
}

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

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto;
}

.result-card {
  margin: 0;
  overflow: hidden;
}

.result-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #edf2f6;
}

.result-card figcaption {
  padding: 12px 14px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 980px) {
  .hero-section,
  .algorithm-panel,
  .demo-layout {
    grid-template-columns: 1fr;
  }

  .hero-section {
    min-height: auto;
  }

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

@media (max-width: 720px) {
  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
  }

  .builder-note {
    text-align: left;
  }

  .hero-section,
  .content-band {
    padding-left: 16px;
    padding-right: 16px;
  }

  h1 {
    font-size: 34px;
  }

  .method-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .stage-controls {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .speed-control {
    grid-column: 1 / -1;
  }

  .scenario-control,
  .decision-metrics {
    grid-template-columns: 1fr;
  }
}

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

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

.references-card {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4faf9;
  color: #2c3a40;
  line-height: 1.65;
}

.references-card p {
  margin: 0 0 12px;
  font-size: 14px;
}

.references-card p:last-child {
  margin-bottom: 0;
}

.references-card b {
  color: #155e6a;
  font-weight: 600;
}

.references-card .references-disclaimer {
  font-size: 12.5px;
  color: #5a6e74;
  font-style: italic;
  border-top: 1px solid #c9dadd;
  padding-top: 10px;
  margin-top: 14px;
}
