:root {
  --bg: #f6f0e6;
  --bg-deep: #efe5d7;
  --surface: rgba(255, 252, 247, 0.84);
  --surface-strong: #fffdf9;
  --ink: #17313a;
  --muted: #597079;
  --line: rgba(23, 49, 58, 0.12);
  --accent: #1a7b72;
  --accent-soft: #dcefe9;
  --warm: #bb8347;
  --warm-soft: #f3dfc6;
  --shadow: 0 20px 54px rgba(26, 48, 55, 0.12);
  --radius: 28px;
  --radius-sm: 22px;
  --content-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(26, 123, 114, 0.16), transparent 30%),
    radial-gradient(circle at 86% 10%, rgba(187, 131, 71, 0.16), transparent 22%),
    linear-gradient(180deg, #f8f3eb 0%, #f2eadf 48%, #f8f4ee 100%);
  font-family: "Space Grotesk", "Avenir Next", "Trebuchet MS", sans-serif;
}

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

a {
  color: inherit;
}

img {
  max-width: 100%;
}

.page-shell {
  width: min(var(--content-width), calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(26, 48, 55, 0.05);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--warm));
  box-shadow: 0 0 0 4px rgba(26, 123, 114, 0.12);
}

.toplinks {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.toplinks a {
  opacity: 0.82;
  text-decoration: none;
}

.toplinks a:hover,
.toplinks a[aria-current="page"] {
  opacity: 1;
}

.paper-link,
.button,
.footer-link,
.route-cta {
  text-decoration: none;
}

.paper-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(26, 123, 114, 0.18);
  background: linear-gradient(135deg, rgba(243, 223, 198, 0.9), rgba(220, 239, 233, 0.92));
  box-shadow: 0 10px 24px rgba(41, 65, 73, 0.08);
  font-weight: 700;
}

.paper-link:hover,
.button:hover,
.footer-link:hover,
.route-cta:hover,
.toggle-button:hover {
  transform: translateY(-1px);
}

.paper-link-icon {
  position: relative;
  width: 14px;
  height: 16px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.84);
}

.paper-link-icon::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 6px;
  height: 6px;
  background: linear-gradient(135deg, transparent 49%, currentColor 50%);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.78fr);
  gap: 24px;
  align-items: stretch;
  margin-top: 22px;
}

.hero-copy,
.hero-panel,
.section,
.surface-card,
.metric-card,
.route-panel,
.note-card,
.reference-card {
  position: relative;
}

.hero-copy,
.hero-panel > * ,
.section,
.surface-card,
.reference-card {
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.56);
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.hero-copy,
.section,
.surface-card,
.reference-card {
  padding: 30px;
}

.hero-panel {
  display: grid;
  gap: 16px;
  align-content: start;
}

.hero-panel > * {
  padding: 22px;
}

.hero-copy {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(220, 239, 233, 0.34), rgba(243, 223, 198, 0.38)),
    var(--surface-strong);
}

.eyebrow,
.mini-label {
  margin: 0 0 10px;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

h1,
h2,
h3,
h4,
.hero-stat strong,
.callout-title {
  font-family: "Source Serif 4", Georgia, serif;
  letter-spacing: -0.03em;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(2.7rem, 4.8vw, 4.4rem);
  line-height: 0.95;
  max-width: 13ch;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) 190px;
  gap: 20px;
  align-items: center;
}

.hero-copy p {
  line-height: 1.72;
}

.lede {
  margin: 0;
  max-width: 62ch;
  font-size: 1.06rem;
  color: var(--muted);
}

.hero-art {
  justify-self: end;
}

.hero-art img {
  width: min(100%, 190px);
  height: auto;
  display: block;
  filter: drop-shadow(0 18px 32px rgba(23, 49, 58, 0.12));
}

.hero-actions,
.hero-pills,
.footer-links,
.route-actions,
.pill-row,
.method-list {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-actions {
  margin: 24px 0 18px;
}

.button,
.route-cta,
.toggle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 20px;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.button-primary {
  background: var(--ink);
  color: #fff;
}

.button-secondary,
.route-cta,
.toggle-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
}

.hero-pills,
.stat-list,
.key-points,
.reference-list,
.support-list,
.assumption-list,
.api-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.hero-pills li,
.pill {
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  font-size: 0.92rem;
}

.stat-list {
  display: grid;
  gap: 12px;
}

.metric-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.metric-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.22rem;
}

.metric-card span {
  color: var(--muted);
  line-height: 1.62;
}

.panel-note {
  margin: 14px 0 0;
  color: var(--muted);
}

.section {
  margin-top: 26px;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 16px;
  align-items: end;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.96;
}

.section-heading p,
.section-intro,
.note-card p,
.surface-card p,
.reference-card p,
.route-panel p,
.card p,
.callout,
.definition-card p {
  color: var(--muted);
  line-height: 1.68;
}

.section-side-note {
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.grid-2,
.grid-3,
.route-grid,
.card-grid,
.theory-grid,
.api-grid,
.problem-grid,
.reference-grid,
.details-grid {
  display: grid;
  gap: 16px;
}

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

.grid-3,
.card-grid,
.problem-grid,
.theory-grid,
.api-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card,
.route-panel,
.definition-card,
.callout,
.detail-card {
  padding: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.route-panel h3,
.card h3,
.definition-card h3,
.detail-card h3,
.reference-card h3 {
  margin: 0 0 10px;
  font-size: 1.5rem;
}

.route-panel {
  display: grid;
  gap: 12px;
}

.route-panel.is-hidden {
  display: none;
}

.route-cta {
  justify-self: start;
}

.toggle-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.toggle-button {
  appearance: none;
  cursor: pointer;
  font: inherit;
}

.toggle-button.is-active {
  background: var(--ink);
  color: #fff;
}

.code-block {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  line-height: 1.58;
  padding: 18px;
  border-radius: 20px;
  background: rgba(20, 38, 43, 0.94);
  color: #f9f4ec;
}

.inline-code {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  line-height: 1.58;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.code-note {
  margin-top: 12px;
}

.figure-frame {
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(220, 239, 233, 0.34)),
    rgba(255, 255, 255, 0.78);
}

.figure-frame img {
  width: 100%;
  height: auto;
  display: block;
}

.figure-caption {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.key-points,
.support-list,
.assumption-list,
.reference-list,
.api-list {
  display: grid;
  gap: 10px;
}

.key-points li,
.support-list li,
.assumption-list li,
.reference-list li,
.api-list li {
  padding-left: 18px;
  position: relative;
  color: var(--muted);
  line-height: 1.64;
}

.key-points li::before,
.support-list li::before,
.assumption-list li::before,
.reference-list li::before,
.api-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--warm));
}

.callout {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(243, 223, 198, 0.36)),
    rgba(255, 255, 255, 0.8);
}

.callout-title {
  display: block;
  margin-bottom: 10px;
  font-size: 1.35rem;
  color: var(--ink);
}

.surface-card {
  display: grid;
  gap: 16px;
}

.definition-card h3 {
  margin-bottom: 8px;
}

.pill-row {
  margin-top: 10px;
}

.pill-row .pill {
  font-size: 0.88rem;
}

.reference-card {
  margin-top: 24px;
  padding: 24px;
}

.reference-grid a,
.footer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

.footer-links {
  margin-top: 18px;
}

.subtle {
  color: var(--muted);
}

@media (max-width: 1040px) {
  .hero,
  .section-heading,
  .grid-3,
  .problem-grid,
  .theory-grid,
  .api-grid,
  .card-grid,
  .reference-grid,
  .details-grid,
  .route-grid {
    grid-template-columns: 1fr;
  }

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

  h1 {
    max-width: 100%;
  }

  .hero-art {
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100%, calc(100% - 20px));
  }

  .topbar,
  .hero-copy,
  .section,
  .surface-card,
  .reference-card,
  .hero-panel > * {
    border-radius: 24px;
  }

  .topbar {
    align-items: flex-start;
    padding: 16px;
  }

  .hero-copy,
  .section,
  .surface-card,
  .reference-card {
    padding: 22px;
  }

  .hero-panel > * {
    padding: 18px;
  }

  .button,
  .paper-link {
    width: 100%;
  }

  .route-cta {
    width: 100%;
  }
}
