:root {
  color-scheme: light;
  --page: #fbfaf8;
  --surface: #ffffff;
  --ink: #524c63;
  --ink-strong: #302b3a;
  --muted: #716b7b;
  --line: #dedddb;
  --accent: #487a7b;
  --accent-strong: #315f61;
  --focus: #bd1a5d;
  --max-width: 1160px;
  --gutter: clamp(1.1rem, 3vw, 2.5rem);
  font-family: Aptos, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #1f1b28;
  --surface: #292433;
  --ink: #e6e0e9;
  --ink-strong: #fffaf3;
  --muted: #c2bbc7;
  --line: #4a4456;
  --accent: #75b7b5;
  --accent-strong: #9fd0ce;
  --focus: #ff79af;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--ink-strong);
  letter-spacing: -0.025em;
  line-height: 1.15;
}

h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2.25rem, 3.6vw, 3.15rem);
  font-weight: 680;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2vw, 1.9rem);
  font-weight: 650;
}

h3 {
  margin-bottom: 0.2rem;
  font-size: 1.04rem;
  font-weight: 680;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.6rem 0.8rem;
  transform: translateY(-160%);
  background: var(--ink-strong);
  color: var(--surface);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.site-header,
main,
footer {
  width: min(100%, calc(var(--max-width) + 2 * var(--gutter)));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 3.65rem;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--page) 94%, transparent);
  backdrop-filter: blur(12px);
}

.wordmark {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  color: var(--ink-strong);
  font-weight: 720;
  text-decoration: none;
}

nav {
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 1.8vw, 1.4rem);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  min-width: 3.6rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  background: var(--surface);
  color: var(--ink-strong);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.theme-toggle:active {
  transform: translateY(1px);
}

nav a {
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

nav a:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.page-heading {
  max-width: 49rem;
  padding-block: clamp(2.25rem, 4vw, 3.25rem);
}

.page-heading > p:last-child {
  max-width: 43rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
}

.meta {
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 760;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.resource-section,
.next-routes {
  padding-block: clamp(1.75rem, 3vw, 2.5rem);
  border-top: 1px solid var(--ink);
}

.section-heading {
  margin-bottom: 1.1rem;
}

.section-heading p {
  max-width: 39rem;
  margin-bottom: 0;
  color: var(--muted);
}

.resource-list {
  border-top: 1px solid var(--line);
}

.resource-item {
  display: grid;
  padding-block: 0.85rem;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: start;
  border-bottom: 1px solid var(--line);
}

.resource-item h3 a {
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.resource-item h3 a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

.resource-item p {
  max-width: 42rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.resource-item .meta {
  padding-top: 0.25rem;
  color: var(--accent-strong);
  line-height: 1.5;
}

.next-routes {
  margin-top: 1rem;
}

.route-list {
  border-top: 1px solid var(--line);
}

.route-list > a {
  display: flex;
  padding-block: 1rem;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
  color: var(--accent-strong);
  text-decoration: none;
}

.route-list > a:hover strong {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.route-list strong,
.route-list small {
  display: block;
}

.route-list strong {
  margin-bottom: 0.25rem;
  color: var(--ink-strong);
  font-size: 1.2rem;
}

.route-list small {
  color: var(--muted);
  font-size: 0.9rem;
}

footer {
  display: flex;
  padding-block: 1.25rem 1.75rem;
  justify-content: space-between;
  gap: 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

footer p {
  margin-bottom: 0;
}

@media (max-width: 840px) {
  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    gap: 0.4rem;
    padding-block: 0.65rem;
  }

  .header-actions,
  nav {
    width: 100%;
  }

  .header-actions {
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
  }

  nav {
    padding-bottom: 0.15rem;
    flex-wrap: wrap;
    gap: 0.55rem 1.15rem;
  }

  .resource-item {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}

@media (max-width: 580px) {
  .page-heading {
    padding-block: 2.25rem;
  }

  .route-list > a {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.8rem;
  }

  footer {
    flex-direction: column;
    gap: 0.5rem;
  }
}

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