:root {
  --ink: #17201d;
  --muted: #5a6762;
  --soft: #eef5f2;
  --paper: #ffffff;
  --line: #d8e3de;
  --teal: #008b91;
  --teal-dark: #00686d;
  --green: #4c7d45;
  --mineral: #9a8a28;
  --yellow: #e5b700;
  --charcoal: #25302d;
  --sand: #f5f1e6;
  --shadow: 0 22px 55px rgba(23, 32, 29, 0.12);
  --heading: "Nunito Sans", "Avenir Next", Arial, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", Arial, sans-serif;
  --max: 1180px;
  --sticky: 5.5rem;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
  scroll-padding-top: var(--sticky);
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.58;
  margin: 0;
  overflow-x: hidden;
}

body.nav-open {
  overflow: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

.skip-link {
  background: var(--yellow);
  color: var(--ink);
  left: 1rem;
  padding: 0.7rem 0.9rem;
  position: absolute;
  text-decoration: none;
  top: -5rem;
  z-index: 50;
}

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

.site-header {
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.nav {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin: 0 auto;
  max-width: var(--max);
  padding: 0.8rem 1.25rem;
}

.brand-mark {
  color: var(--ink);
  display: grid;
  font-family: var(--heading);
  font-size: 1.02rem;
  font-weight: 900;
  line-height: 0.98;
  text-decoration: none;
}

.brand-mark span:last-child {
  color: var(--teal);
}

.nav-links {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 0.9rem;
  justify-content: flex-end;
}

.nav-links a {
  color: var(--muted);
  font-family: var(--heading);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a:focus,
.nav-links a[aria-current="page"] {
  color: var(--teal-dark);
}

.nav-links a[aria-current="page"] {
  border-bottom: 2px solid var(--teal);
}

.nav-toggle {
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: none;
  height: 2.65rem;
  justify-content: center;
  padding: 0;
  width: 2.85rem;
}

.nav-toggle span {
  background: currentColor;
  display: block;
  height: 2px;
  margin: 3px 0;
  width: 1.15rem;
}

.hero {
  padding: 1.35rem 1.25rem 3rem;
}

.hero-inner {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  margin: 0 auto;
  max-width: var(--max);
  min-height: min(680px, calc(100vh - 11rem));
}

.hero-copy {
  align-content: center;
  display: grid;
  padding: 2rem 3rem 2rem 0;
}

h1,
h2,
h3 {
  font-family: var(--heading);
  letter-spacing: 0;
  line-height: 1.04;
  margin: 0;
}

h1 {
  font-size: clamp(3.25rem, 7vw, 5.9rem);
  max-width: 8ch;
}

.page-title {
  font-size: clamp(2.8rem, 6.5vw, 5.6rem);
  max-width: 11ch;
}

h2 {
  font-size: clamp(2rem, 4.5vw, 3.35rem);
}

h3 {
  font-size: 1.45rem;
}

p {
  margin: 0;
}

.lede {
  color: var(--charcoal);
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.45;
  margin-top: 1.35rem;
  max-width: 33rem;
}

.body-copy {
  color: var(--muted);
  max-width: 43rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2rem;
}

.button {
  align-items: center;
  border: 1px solid var(--teal);
  border-radius: 8px;
  display: inline-flex;
  font-family: var(--heading);
  font-size: 0.98rem;
  font-weight: 900;
  justify-content: center;
  min-height: 3.2rem;
  padding: 0.72rem 1.15rem;
  text-decoration: none;
}

.button.primary {
  background: var(--teal);
  color: white;
}

.button.primary:hover,
.button.primary:focus {
  background: var(--teal-dark);
}

.button.secondary {
  background: transparent;
  color: var(--teal-dark);
}

.button.secondary:hover,
.button.secondary:focus {
  background: var(--soft);
}

.hero-media {
  margin: 0;
  min-height: 30rem;
  overflow: hidden;
}

.hero-media img {
  height: 100%;
  object-fit: cover;
  object-position: center;
  width: 100%;
}

.section,
.page-hero,
.site-footer {
  margin: 0 auto;
  max-width: var(--max);
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.page-hero {
  align-items: center;
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 0.86fr) minmax(320px, 1.14fr);
  padding-bottom: 3.5rem;
  padding-top: 4rem;
}

.page-hero .lede {
  max-width: 49rem;
}

.page-hero-copy {
  align-content: center;
  display: grid;
  min-width: 0;
}

.page-hero-media {
  aspect-ratio: 16 / 9;
  background: var(--soft);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 0;
  min-height: 19rem;
  min-width: 0;
  overflow: hidden;
}

.page-hero-media img {
  height: 100%;
  object-fit: cover;
  object-position: center;
  width: 100%;
}

.section {
  padding-bottom: 4.25rem;
  padding-top: 4.25rem;
}

.band {
  background: var(--soft);
}

.band-sand {
  background: var(--sand);
}

.band-dark {
  background: var(--charcoal);
  color: white;
}

.band-dark .body-copy,
.band-dark .lede,
.band-dark .small,
.band-dark .source-note {
  color: #d7e4df;
}

.section-head {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 2rem;
  max-width: 55rem;
}

.section-head.center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.kicker {
  color: var(--teal-dark);
  font-family: var(--heading);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid + .grid {
  margin-top: 1rem;
}

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

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

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

.route-card,
.info-card,
.question-card,
.source-card,
.link-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0.75rem;
  min-height: 100%;
  padding: 1.35rem;
  text-decoration: none;
}

.route-card:hover,
.route-card:focus,
.link-card:hover,
.link-card:focus {
  border-color: rgba(0, 139, 145, 0.45);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.route-card svg,
.info-card svg {
  color: var(--teal);
  height: 2.25rem;
  width: 2.25rem;
}

.route-card p,
.info-card p,
.question-card p,
.source-card p,
.link-card p {
  color: var(--muted);
}

.card-link {
  align-self: end;
  color: var(--teal-dark);
  font-family: var(--heading);
  font-weight: 900;
  margin-top: 0.6rem;
}

.split {
  align-items: center;
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1.05fr);
}

.split.reverse {
  grid-template-columns: minmax(320px, 1.05fr) minmax(0, 0.95fr);
}

.feature-image {
  border-radius: 8px;
  overflow: hidden;
}

.feature-image img {
  aspect-ratio: 16 / 10;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.open-question {
  border-left: 4px solid var(--yellow);
  color: var(--charcoal);
  font-size: 1.18rem;
  margin-top: 1.4rem;
  padding-left: 1rem;
}

.flow {
  display: grid;
  gap: 0.9rem;
}

.flow-step {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 1rem;
  grid-template-columns: 3rem minmax(0, 1fr);
  padding: 1rem 0;
}

.flow-step strong {
  align-items: center;
  background: var(--teal);
  border-radius: 50%;
  color: white;
  display: inline-flex;
  font-family: var(--heading);
  height: 2.4rem;
  justify-content: center;
  width: 2.4rem;
}

.callout {
  background: var(--paper);
  border: 1px solid var(--yellow);
  border-radius: 8px;
  display: grid;
  gap: 0.75rem;
  padding: 1.35rem;
}

.video-frame {
  background: var(--ink);
  border-radius: 8px;
  overflow: hidden;
}

.video-frame iframe {
  aspect-ratio: 16 / 9;
  border: 0;
  display: block;
  width: 100%;
}

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

.link-card .secondary-link {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.source-list {
  display: grid;
  gap: 0.7rem;
}

.source-note,
.small {
  color: var(--muted);
  font-size: 0.95rem;
}

.builder-layout {
  align-items: start;
  display: grid;
  gap: 1.2rem;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1.05fr);
}

.builder-form,
.output-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 1rem;
  padding: 1.35rem;
}

.builder-form fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0.95rem;
  margin: 0;
  padding: 1rem;
}

.builder-form legend,
.output-panel label {
  color: var(--ink);
  font-family: var(--heading);
  font-weight: 900;
}

.builder-form label {
  color: var(--charcoal);
  display: grid;
  font-size: 0.96rem;
  gap: 0.35rem;
}

.builder-form input,
.builder-form select,
.builder-form textarea,
.markdown-output {
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  min-height: 2.8rem;
  padding: 0.75rem 0.8rem;
  width: 100%;
}

.builder-form textarea {
  min-height: 6.5rem;
  resize: vertical;
}

.builder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.status {
  color: var(--teal-dark);
  font-weight: 800;
  min-height: 1.6rem;
}

.output-panel {
  position: sticky;
  top: calc(var(--sticky) + 1rem);
}

.markdown-output {
  min-height: 42rem;
  resize: vertical;
  white-space: pre;
}

.sequence-nav {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 2rem;
  padding-top: 1.2rem;
}

.sequence-nav a {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0.25rem;
  min-height: 5rem;
  padding: 1rem;
  text-decoration: none;
}

.sequence-nav span {
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer {
  color: var(--muted);
  padding-bottom: 2rem;
  padding-top: 2rem;
}

.footer-inner {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 1rem;
  padding-top: 1.4rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1rem;
}

.footer-links a {
  color: var(--teal-dark);
  font-weight: 800;
}

.back-to-top {
  align-items: center;
  background: var(--teal);
  border: 0;
  border-radius: 8px;
  bottom: 1rem;
  box-shadow: var(--shadow);
  color: white;
  cursor: pointer;
  display: inline-flex;
  font-family: var(--heading);
  font-size: 1.4rem;
  font-weight: 900;
  height: 3rem;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  right: 1rem;
  transform: translateY(0.4rem);
  transition: opacity 160ms ease, transform 160ms ease;
  width: 3rem;
  z-index: 40;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 980px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    left: 0;
    padding: 1rem 1.25rem 1.3rem;
    position: absolute;
    right: 0;
    top: 100%;
  }

  body.nav-open .nav-links {
    display: flex;
  }

  .nav-links a {
    font-size: 1rem;
    width: 100%;
  }

  .hero-inner,
  .page-hero,
  .split,
  .split.reverse,
  .builder-layout,
  .grid.three,
  .grid.four,
  .family-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: 2.4rem 0;
  }

  .hero-media {
    min-height: 24rem;
  }

  .page-hero-media {
    min-height: 20rem;
  }

  .output-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .hero {
    min-height: auto;
    padding-bottom: 1rem;
    padding-top: 0.4rem;
  }

  .hero-inner {
    min-height: auto;
  }

  .hero-copy {
    padding: 1.55rem 0 1.2rem;
  }

  h1 {
    font-size: clamp(2.55rem, 13vw, 3.35rem);
    max-width: 9ch;
  }

  .page-title {
    font-size: clamp(2.5rem, 14vw, 3.9rem);
  }

  .lede {
    font-size: 1.08rem;
    line-height: 1.4;
    margin-top: 1rem;
  }

  .button-row {
    gap: 0.65rem;
    margin-top: 1.2rem;
  }

  .button {
    min-height: 2.8rem;
    padding: 0.62rem 0.9rem;
  }

  .button-row,
  .button {
    width: 100%;
  }

  .hero-media {
    min-height: 12rem;
  }

  .page-hero-media {
    min-height: auto;
  }

  .grid.two,
  .sequence-nav {
    grid-template-columns: 1fr;
  }

  .section,
  .page-hero {
    padding-bottom: 3rem;
    padding-top: 3rem;
  }
}
