:root {
  color-scheme: light dark;
  --page: #f4f7ff;
  --surface: #ffffff;
  --surface-soft: #eef2ff;
  --surface-code: #172033;
  --text: #182033;
  --muted: #59647a;
  --line: #cbd3e5;
  --brand: #425ed8;
  --brand-strong: #2f46aa;
  --brand-soft: #e1e7ff;
  --accent: #0f766e;
  --accent-soft: #d9f4ef;
  --warning: #8a4b08;
  --warning-soft: #fff1cc;
  --shadow: 0 18px 45px rgb(45 65 120 / 12%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #101522;
    --surface: #192132;
    --surface-soft: #202a40;
    --surface-code: #0a0f1a;
    --text: #edf1fb;
    --muted: #b4bed2;
    --line: #39445d;
    --brand: #9aabff;
    --brand-strong: #bac6ff;
    --brand-soft: #29355d;
    --accent: #75d6ca;
    --accent-soft: #183e3c;
    --warning: #ffd18b;
    --warning-soft: #4a3519;
    --shadow: 0 18px 45px rgb(0 0 0 / 28%);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  margin: 0;
  overflow-x: clip;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--brand) 13%, transparent), transparent 28rem),
    var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

a {
  color: var(--brand-strong);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.13em;
}

a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
  border-radius: 0.2rem;
}

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

code {
  padding: 0.12rem 0.34rem;
  border-radius: 0.35rem;
  background: var(--surface-soft);
  font-size: 0.92em;
}

pre {
  overflow-x: auto;
  margin: 1rem 0;
  padding: 1rem 1.15rem;
  border-radius: 0.8rem;
  color: #f5f7ff;
  background: var(--surface-code);
  line-height: 1.55;
}

pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  max-width: 16ch;
  margin: 0.6rem 0 1rem;
  font-size: clamp(2.3rem, 7vw, 4.4rem);
}

h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
}

h3 {
  margin: 0 0 0.6rem;
  font-size: 1.2rem;
}

p,
ul,
ol {
  margin-top: 0;
}

.skip-link {
  position: absolute;
  top: -5rem;
  left: 1rem;
  z-index: 20;
  padding: 0.65rem 0.9rem;
  border-radius: 0.5rem;
  background: var(--surface);
}

.skip-link:focus {
  top: 1rem;
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: color-mix(in srgb, var(--page) 86%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.app-bar-inner,
.page-shell,
.footer-inner {
  width: min(72rem, calc(100% - 2rem));
  margin-inline: auto;
}

.app-bar-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 4.25rem;
  gap: 1rem;
}

.app-bar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  color: var(--text);
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.app-bar-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: none;
  place-items: center;
  border-radius: 0.6rem;
  color: #ffffff;
  background: linear-gradient(145deg, #5b7cfa, #2f46aa);
  box-shadow: 0 7px 18px rgb(66 94 216 / 35%);
}

.app-bar-sections {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-width: 0;
  overflow: hidden;
  font-size: 0.92rem;
}

.app-bar-sections a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.app-bar-sections a:hover {
  color: var(--text);
}

.app-bar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  min-width: 0;
}

.app-bar-github {
  padding: 0.38rem 0.58rem;
  border-radius: 0.65rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.app-bar-github:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.app-bar-languages {
  display: inline-flex;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 99rem;
  background: var(--surface);
}

.app-bar-languages a {
  padding: 0.26rem 0.6rem;
  border-radius: 99rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.app-bar-languages a:hover,
.app-bar-languages a[aria-current="page"] {
  color: var(--text);
  background: var(--brand-soft);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.75fr);
  align-items: center;
  min-height: 35rem;
  gap: clamp(2rem, 6vw, 5rem);
  padding: 5rem 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: var(--brand-strong);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-copy {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.12rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.7rem;
}

.button {
  display: inline-flex;
  min-height: 2.8rem;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  color: var(--text);
  background: var(--surface);
  font-weight: 750;
  text-decoration: none;
}

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

@media (prefers-color-scheme: dark) {
  .button-primary {
    color: #11172a;
  }
}

.hero-map {
  position: relative;
  display: grid;
  gap: 0.75rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 1.3rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
}

.hero-map::before {
  position: absolute;
  inset: -0.7rem auto auto -0.7rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--accent-soft);
  content: "";
  z-index: -1;
}

.mini-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.6rem;
}

.mini-node {
  padding: 0.75rem;
  border-radius: 0.7rem;
  background: var(--surface-soft);
  font-weight: 700;
  text-align: center;
}

.mini-node-strong {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.mini-arrow {
  color: var(--brand);
  font-size: 1.3rem;
  font-weight: 900;
}

.section {
  padding: 5rem 0;
  border-top: 1px solid var(--line);
}

.section-intro {
  max-width: 68ch;
  margin-bottom: 2rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.callout {
  margin: 1.4rem 0;
  padding: 1rem 1.2rem;
  border-inline-start: 0.35rem solid var(--brand);
  border-radius: 0.25rem 0.75rem 0.75rem 0.25rem;
  background: var(--brand-soft);
}

.callout-warning {
  border-inline-start-color: var(--warning);
  background: var(--warning-soft);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 2rem 0;
  padding: 0;
  list-style: none;
  counter-reset: guide-step;
}

.steps > li {
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  counter-increment: guide-step;
}

.steps > li::before {
  display: grid;
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.9rem;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--brand-strong);
  content: counter(guide-step);
  font-weight: 800;
}

@media (prefers-color-scheme: dark) {
  .steps > li::before {
    color: #11172a;
  }
}

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

.diagram {
  margin: 2rem 0 3rem;
  padding: clamp(1rem, 3vw, 1.8rem);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  background: var(--surface);
  box-shadow: 0 12px 34px rgb(45 65 120 / 8%);
}

.diagram figcaption {
  margin-bottom: 1.4rem;
  font-weight: 800;
}

.hub-flow {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) auto minmax(11rem, 1.1fr) auto minmax(9rem, 1fr);
  align-items: center;
  gap: 0.8rem;
}

.node-stack {
  display: grid;
  gap: 0.65rem;
}

.diagram-node {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface-soft);
  text-align: center;
}

.diagram-node strong,
.diagram-node span {
  display: block;
}

.diagram-node span {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.83rem;
}

.diagram-node-primary {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  background: var(--brand-soft);
}

.diagram-node-accent {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: var(--accent-soft);
}

.flow-arrow {
  color: var(--brand);
  font-size: 1.5rem;
  font-weight: 900;
  text-align: center;
}

.flow-list {
  display: grid;
  grid-template-columns: repeat(var(--flow-columns, 4), minmax(0, 1fr));
  gap: 1.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-list > li {
  position: relative;
  min-width: 0;
}

.flow-list > li:not(:last-child)::after {
  position: absolute;
  top: 50%;
  left: calc(100% + 0.45rem);
  width: 0.8rem;
  color: var(--brand);
  content: "→";
  font-size: 1.35rem;
  font-weight: 900;
  transform: translateY(-50%);
}

.lane + .lane {
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  border-top: 1px dashed var(--line);
}

.lane-label {
  display: inline-block;
  margin-bottom: 0.7rem;
  color: var(--brand-strong);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.timeline > li {
  position: relative;
  min-width: 0;
  padding: 2rem 0.4rem 0;
  border-top: 0.25rem solid var(--line);
  text-align: center;
}

.timeline > li::before {
  position: absolute;
  top: -0.67rem;
  left: 50%;
  width: 1rem;
  height: 1rem;
  border: 0.18rem solid var(--surface);
  border-radius: 50%;
  background: var(--brand);
  content: "";
  transform: translateX(-50%);
}

.timeline > li.audio::before {
  background: var(--accent);
}

.timeline strong,
.timeline span {
  display: block;
}

.timeline span {
  color: var(--muted);
  font-size: 0.82rem;
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.legend-key::before {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-inline-end: 0.35rem;
  border-radius: 50%;
  background: var(--brand);
  content: "";
}

.legend-key-audio::before {
  background: var(--accent);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  min-width: 0;
  padding: 1.3rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
}

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

.resource-table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: start;
  vertical-align: top;
}

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

details {
  border-bottom: 1px solid var(--line);
}

summary {
  padding: 1rem 0;
  cursor: pointer;
  font-weight: 750;
}

details > div {
  padding: 0 0 1rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 0;
}

.footer-inner p {
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 56rem) {
  .app-bar-sections {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 4rem 0;
  }

  .hero-map {
    width: min(100%, 32rem);
  }

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

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

  .hub-flow > .flow-arrow {
    transform: rotate(90deg);
  }

  .flow-list {
    grid-template-columns: 1fr;
    gap: 1.8rem;
  }

  .flow-list > li:not(:last-child)::after {
    top: calc(100% + 0.18rem);
    left: 50%;
    transform: translateX(-50%) rotate(90deg);
  }

  .timeline {
    grid-template-columns: 1fr;
    gap: 0;
    padding-inline-start: 1rem;
  }

  .timeline > li {
    padding: 0.35rem 0 1.2rem 1.3rem;
    border-top: 0;
    border-inline-start: 0.25rem solid var(--line);
    text-align: start;
  }

  .timeline > li::before {
    top: 0.45rem;
    left: -0.12rem;
    transform: translateX(-50%);
  }

  .timeline-legend {
    justify-content: flex-start;
  }
}

@media (max-width: 40rem) {
  .app-bar-inner,
  .page-shell,
  .footer-inner {
    width: min(100% - 1.2rem, 72rem);
  }

  .app-bar-inner {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.5rem;
  }

  .app-bar-label {
    display: none;
  }

  .app-bar-actions {
    grid-column: 2;
  }

  .app-bar-languages a {
    padding-inline: 0.5rem;
    font-size: 0.78rem;
  }

  .hero {
    padding: 3rem 0;
  }

  .section {
    padding: 3.5rem 0;
  }

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

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

  .mini-arrow {
    transform: rotate(90deg);
  }
}

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