:root {
  --ink: #101c28;
  --muted: #516273;
  --paper: #eef3f5;
  --paper-2: #e3ecee;
  --line: #c5d2db;
  --teal: #0b6e71;
  --teal-deep: #06494c;
  --teal-mid: #128083;
  --sand: #e9dcc7;
  --sand-hot: #f3ead8;
  --accent: #b34a1e;
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;
  --max: 1120px;
  --header-h: 4rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 100% -10%, rgba(11, 110, 113, 0.08), transparent 60%),
    radial-gradient(700px 400px at 0% 30%, rgba(233, 220, 199, 0.35), transparent 55%),
    var(--paper);
  line-height: 1.55;
  overflow-x: hidden;
}

a { color: var(--teal); }
code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.9em;
  background: rgba(11, 110, 113, 0.1);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
}

/* —— Header —— */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  background: transparent;
  color: #eef6f5;
  transition: background 0.35s ease, color 0.35s ease, box-shadow 0.35s ease;
}
.site-header.scrolled,
.site-header.open {
  background: rgba(238, 243, 245, 0.94);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--line);
  backdrop-filter: blur(12px);
}
.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  color: inherit;
  text-decoration: none;
  letter-spacing: -0.03em;
  z-index: 2;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1rem;
  flex: 1;
  justify-content: center;
}
.nav a {
  text-decoration: none;
  color: inherit;
  opacity: 0.78;
  font-size: 0.86rem;
  font-weight: 600;
  transition: opacity 0.2s ease;
}
.nav a:hover { opacity: 1; }
.cta-nav {
  text-decoration: none;
  font-weight: 700;
  font-size: 0.84rem;
  background: var(--sand);
  color: var(--ink) !important;
  padding: 0.5rem 0.95rem;
  border-radius: 6px;
  z-index: 2;
  transition: background 0.2s ease, transform 0.2s ease;
}
.site-header.scrolled .cta-nav,
.site-header.open .cta-nav {
  background: var(--teal);
  color: #fff !important;
}
.cta-nav:hover { transform: translateY(-1px); background: var(--sand-hot); }
.site-header.scrolled .cta-nav:hover,
.site-header.open .cta-nav:hover { background: var(--teal-deep); }

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  z-index: 2;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 1.35rem;
  background: currentColor;
  transition: transform 0.25s ease;
}
.site-header.open .nav-toggle span:first-child { transform: translateY(4px) rotate(45deg); }
.site-header.open .nav-toggle span:last-child { transform: translateY(-4px) rotate(-45deg); }

/* —— Hero —— */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: flex-end;
  color: #f4faf9;
  isolation: isolate;
}
.hero-visual {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.hero-art {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 40, 44, 0.25) 0%, transparent 32%, rgba(8, 22, 30, 0.78) 76%, #0b161e 100%),
    linear-gradient(90deg, rgba(8, 28, 32, 0.88) 0%, rgba(8, 28, 32, 0.45) 38%, transparent 62%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: min(var(--max), 100%);
  margin: 0 auto;
  padding: calc(var(--header-h) + 2rem) 1.5rem 3.75rem;
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1), transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.hero-inner.is-in { opacity: 1; transform: none; }
.brand {
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 9vw, 5.25rem);
  font-weight: 800;
  margin: 0 0 0.85rem;
  letter-spacing: -0.045em;
  line-height: 0.95;
  color: #f7f3ea;
  text-wrap: balance;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.15rem, 2.5vw, 1.65rem);
  line-height: 1.28;
  margin: 0 0 0.75rem;
  max-width: 24ch;
  color: #dceceb;
  letter-spacing: -0.02em;
}
.lede {
  margin: 0;
  max-width: 38ch;
  color: #a8c0bf;
  font-size: 1.05rem;
  font-weight: 500;
}
.cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.85rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.78rem 1.25rem;
  border-radius: 6px;
  border: 1.5px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible {
  outline: 2px solid var(--sand);
  outline-offset: 3px;
}
.btn-solid { background: var(--sand); color: var(--ink); }
.btn-solid:hover { background: var(--sand-hot); }
.btn-solid.dark { background: var(--teal); color: #fff; }
.btn-solid.dark:hover { background: var(--teal-deep); }
.btn-line {
  border-color: rgba(255, 255, 255, 0.4);
  color: #f4faf9;
  background: transparent;
}
.btn-line:hover { border-color: #fff; background: rgba(255, 255, 255, 0.08); }
.btn-line.dark {
  border-color: var(--teal);
  color: var(--teal-deep);
}
.btn-line.dark:hover { background: rgba(11, 110, 113, 0.08); }

/* —— Sections —— */
.section {
  width: min(var(--max), 100%);
  margin: 0 auto;
  padding: 5rem 1.5rem;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.75s ease, transform 0.75s ease;
}
.section.is-visible { opacity: 1; transform: none; }
.section-inner {
  width: min(var(--max), 100%);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.eyebrow {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-mid);
}
.section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.4vw, 2.45rem);
  margin: 0 0 0.7rem;
  letter-spacing: -0.03em;
  font-weight: 700;
  line-height: 1.15;
  text-wrap: balance;
}
.section-lede {
  margin: 0 0 2rem;
  color: var(--muted);
  max-width: 52ch;
  font-size: 1.08rem;
  font-weight: 500;
}

.section-flow,
.section-rules,
.section-int {
  width: 100%;
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}
.section-flow { background: linear-gradient(180deg, #dfe9eb 0%, #e8f0f1 100%); }
.section-rules {
  background:
    linear-gradient(135deg, #0b3d40 0%, #12202f 55%, #163038 100%);
  color: #eef6f5;
}
.section-rules .eyebrow { color: #9fd0d2; }
.section-rules .section-lede,
.section-rules .rules li { color: #b7c9c8; }
.section-rules .rules strong { color: #f4f1ea; }
.section-int { background: #e7eef0; }

/* Flow track */
.flow-track {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.25rem;
  position: relative;
}
.flow-track::before {
  content: "";
  position: absolute;
  top: 1.15rem;
  left: 4%;
  right: 4%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal) 15%, var(--teal) 85%, transparent);
  opacity: 0.35;
}
.flow-track li {
  position: relative;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.flow-track li.is-visible { opacity: 1; transform: none; }
.flow-track li:nth-child(2) { transition-delay: 0.06s; }
.flow-track li:nth-child(3) { transition-delay: 0.12s; }
.flow-track li:nth-child(4) { transition-delay: 0.18s; }
.flow-track li:nth-child(5) { transition-delay: 0.24s; }
.step-n {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--teal);
  letter-spacing: -0.04em;
  margin-bottom: 0.55rem;
  line-height: 1;
}
.flow-track h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
.flow-track p { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* Modules — editorial, not cards */
.modules {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
}
.modules article {
  padding: 1.35rem 1.1rem 1.5rem 0;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding-right: 1.25rem;
  padding-left: 1.1rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease, background 0.25s ease;
}
.modules article:nth-child(3n) { border-right: 0; padding-right: 0; }
.modules article:nth-child(3n+1) { padding-left: 0; }
.modules article.is-visible { opacity: 1; transform: none; }
.modules article:hover { background: rgba(11, 110, 113, 0.04); }
.modules span {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: 0.04em;
}
.modules h3 {
  margin: 0.3rem 0 0.4rem;
  font-size: 1.12rem;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
.modules p { margin: 0; font-size: 0.92rem; color: var(--muted); }

.rules {
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 58ch;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.rules li {
  padding-left: 1.15rem;
  border-left: 2px solid rgba(159, 208, 210, 0.45);
  font-size: 1.02rem;
}

/* KPI visual */
.kpi-visual {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 2.5rem;
  align-items: end;
}
.kpi-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  align-items: end;
  min-height: 220px;
  padding: 1.25rem 1rem 0;
  background:
    linear-gradient(180deg, transparent 0%, transparent 99%, var(--line) 99%),
    repeating-linear-gradient(
      to top,
      transparent 0,
      transparent 43px,
      rgba(197, 210, 219, 0.55) 44px
    );
}
.bar {
  height: var(--h);
  background: linear-gradient(180deg, var(--teal-mid), var(--teal-deep));
  border-radius: 4px 4px 0 0;
  position: relative;
  transform-origin: bottom;
  transform: scaleY(0);
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.section.is-visible .bar { transform: scaleY(1); }
.bar:nth-child(2) { transition-delay: 0.08s; background: linear-gradient(180deg, #3a8f8a, #0b5558); }
.bar:nth-child(3) { transition-delay: 0.16s; background: linear-gradient(180deg, #c4b396, #8a7a5e); }
.bar:nth-child(4) { transition-delay: 0.24s; background: linear-gradient(180deg, #6aa8a5, #2d6260); }
.bar span {
  position: absolute;
  bottom: -1.6rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}
.kpi-copy {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  padding-bottom: 1.6rem;
}
.kpi-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.3rem;
}
.kpi-copy p { margin: 0; color: var(--muted); }

.mono-line {
  margin: 0;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.92rem;
  background: var(--ink);
  color: #d7ebea;
  padding: 1.1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.5;
}
.tok-m { color: #9fd0d2; font-weight: 700; }
.tok-c { color: #e9dcc7; }

.inout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
}
.inout-col {
  padding: 1.5rem 1.5rem 0.5rem 0;
}
.inout-col:first-child {
  padding-right: 2rem;
  border-right: 1px solid var(--line);
}
.inout-col:last-child { padding-left: 2rem; }
.inout h3 {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.inout .in h3 { color: var(--teal-deep); }
.inout .out h3 { color: var(--accent); }
.inout ul { margin: 0; padding-left: 1.05rem; color: var(--muted); }
.inout li { margin: 0.45rem 0; }

.section-cta {
  background:
    radial-gradient(600px 280px at 10% 0%, rgba(11, 110, 113, 0.1), transparent 70%),
    linear-gradient(180deg, transparent, rgba(11, 110, 113, 0.05));
}
.creds-panel {
  max-width: 520px;
  margin-bottom: 1.75rem;
  border-top: 1px solid var(--line);
}
.cred-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.cred-row code {
  background: transparent;
  padding: 0;
  color: var(--teal-deep);
  font-size: 0.88rem;
}
.cred-row span {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2.5rem 1.5rem;
  background: #e4ecee;
}
.footer-inner {
  width: min(var(--max), 100%);
  margin: 0 auto;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.footer-inner .logo {
  display: inline-block;
  color: var(--teal-deep);
  margin-bottom: 0.5rem;
}
.site-footer a { color: var(--teal-deep); font-weight: 600; }

@media (max-width: 960px) {
  .flow-track {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .flow-track::before {
    top: 0;
    bottom: 0;
    left: 0.55rem;
    right: auto;
    width: 2px;
    height: auto;
    background: linear-gradient(180deg, transparent, var(--teal) 10%, var(--teal) 90%, transparent);
  }
  .flow-track li { padding-left: 1.75rem; }
  .modules { grid-template-columns: repeat(2, 1fr); }
  .modules article:nth-child(3n) { border-right: 1px solid var(--line); padding-right: 1.25rem; }
  .modules article:nth-child(3n+1) { padding-left: 1.1rem; }
  .modules article:nth-child(2n) { border-right: 0; padding-right: 0; }
  .modules article:nth-child(2n+1) { padding-left: 0; }
  .kpi-visual { grid-template-columns: 1fr; gap: 2.75rem; }
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .nav, .cta-nav { display: none; }
  .site-header.open .nav {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    background: rgba(238, 243, 245, 0.98);
    padding: calc(var(--header-h) + 1.5rem) 1.5rem 2rem;
    gap: 0.35rem;
    justify-content: flex-start;
  }
  .site-header.open .nav a {
    font-size: 1.35rem;
    font-family: var(--font-display);
    font-weight: 700;
    padding: 0.55rem 0;
    opacity: 1;
    color: var(--ink);
  }
  .site-header.open .cta-nav {
    display: inline-flex;
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    justify-content: center;
    padding: 0.9rem;
  }
  .modules { grid-template-columns: 1fr; }
  .modules article,
  .modules article:nth-child(n) {
    border-right: 0;
    padding-left: 0;
    padding-right: 0;
  }
  .inout { grid-template-columns: 1fr; }
  .inout-col:first-child {
    border-right: 0;
    padding-right: 0;
    padding-bottom: 1.5rem;
  }
  .inout-col:last-child { padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-inner, .section, .flow-track li, .modules article, .bar {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
