:root {
  color-scheme: light dark;
  --bg: #f4f7fb;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --text: #172033;
  --muted: #55637a;
  --line: #d8e0ec;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --success: #047857;
  --warning: #b45309;
  --code: #111827;
  --code-text: #e5e7eb;
  --shadow: 0 24px 70px rgba(37, 99, 235, 0.12);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090d16;
    --surface: rgba(17, 24, 39, 0.88);
    --surface-solid: #111827;
    --text: #f1f5f9;
    --muted: #a9b5c8;
    --line: #283449;
    --accent: #60a5fa;
    --accent-soft: #172554;
    --success: #34d399;
    --warning: #fbbf24;
    --code: #030712;
    --code-text: #e5e7eb;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  }
}

body.light {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --text: #172033;
  --muted: #55637a;
  --line: #d8e0ec;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --success: #047857;
  --warning: #b45309;
  --code: #111827;
  --code-text: #e5e7eb;
  --shadow: 0 24px 70px rgba(37, 99, 235, 0.12);
}

body.dark {
  color-scheme: dark;
  --bg: #090d16;
  --surface: rgba(17, 24, 39, 0.88);
  --surface-solid: #111827;
  --text: #f1f5f9;
  --muted: #a9b5c8;
  --line: #283449;
  --accent: #60a5fa;
  --accent-soft: #172554;
  --success: #34d399;
  --warning: #fbbf24;
  --code: #030712;
  --code-text: #e5e7eb;
  --shadow: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1.7;
}

a {
  color: var(--accent);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

main {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 56px 0 96px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 48px;
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
  transition: color 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.back:hover {
  color: var(--accent);
  transform: translate3d(-2px, 0, 0);
}

.hero {
  max-width: 900px;
  padding: 28px 0 48px;
  animation: hero-enter 700ms var(--ease-out) both;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin-top: 0;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

h1 {
  max-width: 980px;
  margin-bottom: 24px;
  font-size: clamp(2.5rem, 7vw, 5.4rem);
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(1.65rem, 3.5vw, 2.5rem);
}

h3 {
  margin-bottom: 10px;
  font-size: 1.12rem;
}

p,
li {
  color: var(--muted);
}

.lede {
  max-width: 800px;
  margin: 0;
  font-size: clamp(1.08rem, 2vw, 1.3rem);
  line-height: 1.75;
}

.actions,
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.button,
.tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
}

.button {
  border-radius: 7px;
  padding: 10px 16px;
  background: var(--surface-solid);
  color: var(--text);
  font-weight: 650;
  transition: border-color 180ms var(--ease-out), background-color 180ms var(--ease-out), color 180ms var(--ease-out), transform 140ms var(--ease-out);
}

.button:active {
  transform: scale(0.97);
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

@media (hover: hover) and (pointer: fine) {
  .button:hover {
    border-color: var(--accent);
  }

  .button.primary:hover {
    filter: brightness(0.92);
  }
}

.tag {
  padding: 5px 11px;
  color: var(--muted);
  font-size: 0.8rem;
}

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

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 12px 0 72px;
  border-block: 1px solid var(--line);
}

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

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

.card,
.metric,
figure,
.callout {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
}

.card,
.callout {
  padding: 24px;
}

.metric {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 24px;
  background: transparent;
  box-shadow: none;
}

.metric:last-child {
  border-right: 0;
}

.metric strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  line-height: 1.1;
}

.metric span {
  color: var(--muted);
  font-size: 0.86rem;
}

section {
  margin-top: 80px;
  scroll-margin-top: 24px;
}

.section-intro {
  max-width: 760px;
  margin: -6px 0 28px;
}

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

.flow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  align-items: stretch;
  margin-top: 28px;
}

.flow div {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 90px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-solid);
  color: var(--text);
  font-weight: 700;
  text-align: center;
}

.flow div:not(:last-child)::after {
  position: absolute;
  right: -12px;
  z-index: 1;
  content: "›";
  color: var(--accent);
  font-size: 1.5rem;
}

figure {
  margin: 28px 0;
  overflow: hidden;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
}

@keyframes hero-enter {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes figure-focus {
  from {
    transform: scale(0.985);
  }
  to {
    transform: scale(1);
  }
}

@supports (animation-timeline: view()) {
  figure img {
    animation: figure-focus linear both;
    animation-range: entry 0% cover 42%;
    animation-timeline: view();
  }
}

figcaption {
  padding: 14px 18px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--text);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.table-wrap {
  overflow-x: auto;
  border-radius: 16px;
}

.good {
  color: var(--success);
  font-weight: 700;
}

.caution {
  color: var(--warning);
  font-weight: 700;
}

pre {
  margin: 24px 0;
  overflow-x: auto;
  border-radius: 18px;
  padding: 20px;
  background: var(--code);
  color: var(--code-text);
  font:
    0.88rem/1.65 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.callout {
  border-color: var(--accent);
}

.footer-note {
  margin-top: 88px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 820px) {
  .metrics,
  .grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow {
    grid-template-columns: 1fr;
  }

  .flow div:not(:last-child)::after {
    right: auto;
    bottom: -21px;
    transform: rotate(90deg);
  }
}

@media (max-width: 560px) {
  main {
    width: min(100% - 28px, 1120px);
    padding-top: 30px;
  }

  .back {
    margin-bottom: 26px;
  }

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

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric:last-child {
    border-bottom: 0;
  }

  section {
    margin-top: 60px;
  }

  th,
  td {
    padding: 11px 12px;
  }
}

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

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

  .hero,
  figure img {
    animation: none !important;
    transform: none !important;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .back {
    display: none;
  }

  .card,
  .metric,
  figure,
  .callout {
    box-shadow: none;
  }
}
