:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --paper: #ffffff;
  --ink: #16202a;
  --muted: #5c6977;
  --line: #dbe3eb;
  --navy: #26384a;
  --teal: #16837b;
  --coral: #d8584f;
  --violet: #6d5bd0;
  --gold: #c78725;
  --green: #2f9b68;
  --shadow: 0 20px 48px rgba(22, 32, 42, 0.13);
}

* {
  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: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(219, 227, 235, 0.85);
  background: rgba(245, 247, 251, 0.92);
  backdrop-filter: blur(14px);
}

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

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

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: "";
  border-radius: 50%;
}

.brand-mark::before {
  width: 8px;
  height: 8px;
  left: 5px;
  top: 6px;
  background: var(--coral);
}

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

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

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

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

.hero-section {
  position: relative;
  min-height: calc(100vh - 64px);
  overflow: hidden;
  background: #101923;
}

#heroCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(16, 25, 35, 0.9) 0%, rgba(16, 25, 35, 0.72) 45%, rgba(16, 25, 35, 0.25) 100%),
    linear-gradient(0deg, rgba(16, 25, 35, 0.72), rgba(16, 25, 35, 0.1) 48%, rgba(16, 25, 35, 0.4));
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  min-height: calc(100vh - 64px);
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(48px, 7vw, 90px) 24px;
}

.hero-copy {
  max-width: 760px;
  color: #fff;
}

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

.hero-section .eyebrow {
  color: #7ddbd0;
}

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

h1 {
  max-width: 880px;
  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.3vw, 48px);
  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: 690px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
}

.plain-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 760px;
  margin-top: 24px;
}

.plain-summary div {
  min-height: 92px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
}

.plain-summary strong,
.plain-summary span {
  display: block;
}

.plain-summary strong {
  margin-bottom: 6px;
  color: #fff;
  font-size: 14px;
}

.plain-summary span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.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: 770;
}

.primary-link {
  background: #78d4c9;
  color: #0d2023;
}

.secondary-link {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.primary-link:hover,
.secondary-link:hover,
.primary-link:focus-visible,
.secondary-link:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.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;
}

.workflow-band {
  background: #eef5f4;
}

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

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

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

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

.use-case,
.method-step,
.metric-card,
.phase-card,
.outcome-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.use-case,
.method-step,
.metric-card {
  padding: 19px;
}

.use-case-icon,
.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 30px;
  margin-bottom: 18px;
  padding: 0 9px;
  border-radius: 8px;
  background: #e6f4f2;
  color: var(--teal);
  font-size: 13px;
  font-weight: 850;
}

.use-case:nth-child(2) .use-case-icon,
.method-step:nth-child(3) .step-index {
  background: #edf0fb;
  color: var(--violet);
}

.use-case:nth-child(3) .use-case-icon,
.method-step:nth-child(4) .step-index {
  background: #fff1ec;
  color: var(--coral);
}

.use-case:nth-child(4) .use-case-icon,
.method-step:nth-child(2) .step-index {
  background: #f8eddc;
  color: var(--gold);
}

.use-case p,
.method-step p,
.metric-card p {
  color: var(--muted);
  font-size: 15px;
}

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

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

.algorithm-panel .eyebrow {
  color: #7ddbd0;
}

.formula-source {
  margin-bottom: 0;
  font-size: 14px;
}

.formula-grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.formula-card {
  padding: 15px;
  border: 1px solid rgba(125, 219, 208, 0.2);
  border-radius: 8px;
  background: #0a1118;
}

.formula-card > span {
  display: block;
  margin-bottom: 10px;
  color: #7ddbd0;
  font-size: 12px;
  font-weight: 830;
  text-transform: uppercase;
}

.formula-card p {
  margin: 10px 0 0;
  color: #b9c8cf;
  font-size: 14px;
}

.formula {
  overflow-x: auto;
  color: #f2fbfb;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(14px, 1.5vw, 17px);
  line-height: 1.55;
}

.piecewise {
  display: inline-grid;
  gap: 2px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 2px solid rgba(125, 219, 208, 0.45);
  vertical-align: middle;
}

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.58;
  white-space: pre;
}

.algo-line {
  display: inline-block;
  width: 100%;
  border-radius: 5px;
  transition: background-color 180ms ease, color 180ms ease;
}

.algo-line.is-active {
  background: rgba(125, 219, 208, 0.15);
  color: #dffdf9;
}

.mode-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  max-width: 720px;
  margin: 0 auto 16px;
  padding: 4px;
  border: 1px solid #cbdcdd;
  border-radius: 8px;
  background: #dfe9ea;
}

.mode-button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #3d5258;
  cursor: pointer;
  font-size: 14px;
  font-weight: 780;
}

.mode-button.is-active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(22, 32, 42, 0.12);
}

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

.mode-guide article {
  padding: 16px;
  border: 1px solid #cbdcdd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.mode-guide h3 {
  font-size: 17px;
}

.mode-guide p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

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

.demo-stage {
  min-width: 0;
  border: 1px solid #cbdcdd;
  border-radius: 8px;
  background: #fbfdfd;
  box-shadow: 0 16px 38px rgba(22, 32, 42, 0.12);
}

#workflowCanvas {
  display: block;
  width: 100%;
  min-height: 520px;
  height: auto;
  aspect-ratio: 28 / 17;
  border-bottom: 1px solid #dbe7e8;
}

.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 #cbdcdd;
  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(--teal);
  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(--teal);
}

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

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

.demo-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.phase-card,
.outcome-card {
  padding: 18px;
}

.phase-card p:not(.eyebrow),
.outcome-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: 800;
  text-transform: uppercase;
}

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

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

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

.phase-list li.is-active {
  border-left-color: var(--coral);
  background: #fff;
  box-shadow: 0 10px 24px rgba(22, 32, 42, 0.11);
}

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

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

.summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.metric-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 830;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1;
}

@media (max-width: 1020px) {
  .use-case-grid,
  .method-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .algorithm-panel,
  .demo-shell {
    grid-template-columns: 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-inner,
  .content-band {
    padding-left: 16px;
    padding-right: 16px;
  }

  h1 {
    font-size: 34px;
  }

  .plain-summary,
  .use-case-grid,
  .method-grid,
  .summary-grid,
  .mode-control,
  .mode-guide {
    grid-template-columns: 1fr;
  }

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

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

  .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 a {
  color: #2f5f6f;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  word-break: break-word;
}

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