:root {
  color-scheme: dark;
  --bg: #151310;
  --surface: #1c1915;
  --surface-strong: #24201b;
  --text: #f2ede4;
  --muted: #b8afa1;
  --quiet: #a79e92;
  --line: #3b352d;
  --line-strong: #5a5145;
  --accent: #ef6b2d;
  --accent-ink: #1b0f08;
  --focus: #ff945f;
  --radius: 8px;
  --shell: 1180px;
  --reading: 760px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4f0e8;
    --surface: #fffaf1;
    --surface-strong: #ece5d8;
    --text: #241f19;
    --muted: #625a4f;
    --quiet: #6b6257;
    --line: #d5cbbb;
    --line-strong: #ada18f;
    --accent: #b94717;
    --accent-ink: #fff8ef;
    --focus: #8d320e;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f0e8;
  --surface: #fffaf1;
  --surface-strong: #ece5d8;
  --text: #241f19;
  --muted: #625a4f;
  --quiet: #6b6257;
  --line: #d5cbbb;
  --line-strong: #ada18f;
  --accent: #b94717;
  --accent-ink: #fff8ef;
  --focus: #8d320e;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151310;
  --surface: #1c1915;
  --surface-strong: #24201b;
  --text: #f2ede4;
  --muted: #b8afa1;
  --quiet: #a79e92;
  --line: #3b352d;
  --line-strong: #5a5145;
  --accent: #ef6b2d;
  --accent-ink: #1b0f08;
  --focus: #ff945f;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
}

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

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

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

.shell {
  width: min(calc(100% - 40px), var(--shell));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  transform: translateY(-180%);
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius);
  font-weight: 800;
}

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

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.site-header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  min-height: 72px;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.brand b {
  color: var(--accent);
}

.brand img {
  width: 32px;
  height: 32px;
}

.primary-nav {
  display: flex;
  justify-content: center;
  gap: 22px;
}

.primary-nav a,
.header-actions a,
.header-actions button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  background: none;
  border: 0;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
}

.primary-nav a:hover,
.header-actions a:hover,
.header-actions button:hover {
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.search-link {
  color: var(--accent) !important;
}

.nav-toggle {
  display: none;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.breadcrumbs {
  margin-block: 28px 0;
  color: var(--quiet);
  font-size: 0.82rem;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: 8px;
  color: var(--line-strong);
}

.breadcrumbs a:hover {
  color: var(--text);
}

.section-label {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(440px, 1.06fr);
  align-items: center;
  gap: clamp(40px, 7vw, 96px);
  min-height: min(720px, calc(100svh - 73px));
  padding-block: clamp(40px, 4.5vw, 64px);
}

.page-hero--compact {
  min-height: auto;
  padding-block: clamp(48px, 7vw, 88px);
  border-bottom: 1px solid var(--line);
}

.page-hero__copy {
  min-width: 0;
}

.page-hero h1 {
  max-width: 16ch;
  margin: 0;
  font-size: clamp(2.65rem, 6.4vw, 6rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.page-hero--compact h1 {
  max-width: 18ch;
  font-size: clamp(2.5rem, 5.2vw, 4.9rem);
}

.page-hero__intro {
  max-width: 58ch;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.6vw, 1.28rem);
}

.answer-block {
  max-width: 64ch;
  margin-top: 34px;
  padding: 22px 0 0 22px;
  border-top: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
}

.answer-block span {
  display: block;
  margin-bottom: 7px;
  color: var(--quiet);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.answer-block p {
  margin: 0;
  color: var(--text);
  font-weight: 680;
  line-height: 1.55;
}

.page-hero__media {
  margin: 0;
  align-self: stretch;
}

.page-hero__media img {
  width: 100%;
  height: 100%;
  min-height: 420px;
  max-height: min(600px, calc(100svh - 200px));
  object-fit: cover;
  border-radius: var(--radius);
  filter: saturate(0.84) contrast(1.03);
}

.page-hero__media figcaption {
  margin-top: 8px;
  color: var(--quiet);
  font-size: 0.74rem;
}

.home-route,
.hub-directory,
.collection,
.evidence-panel,
.article-sections,
.related-section,
.tool-workspace {
  padding-block: clamp(64px, 9vw, 120px);
}

.home-route,
.hub-directory,
.collection,
.evidence-panel,
.related-section,
.tool-workspace {
  border-top: 1px solid var(--line);
}

.home-route {
  display: grid;
  grid-template-columns: minmax(240px, 0.65fr) minmax(0, 1.35fr);
  gap: clamp(36px, 8vw, 110px);
}

.home-route__heading,
.hub-directory__heading,
.collection__heading,
.related-section__heading,
.tool-workspace__intro {
  max-width: 600px;
}

.home-route h2,
.hub-directory h2,
.collection h2,
.evidence-panel h2,
.related-section h2,
.tool-workspace h2 {
  margin: 0;
  font-size: clamp(2rem, 4.1vw, 3.7rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.home-route__heading > p:last-child,
.collection__heading > p:last-child,
.tool-workspace__intro > p:last-child {
  color: var(--muted);
}

.featured-routes {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  align-items: start;
  border-top: 1px solid var(--line-strong);
}

.featured-route {
  min-height: 210px;
  padding: 28px 24px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.featured-route:first-child {
  grid-row: span 2;
  min-height: 420px;
  padding-left: 0;
  border-right: 1px solid var(--line);
}

.featured-route span,
.collection-list span,
.hub-list span,
.related-link > span,
.result-link > span,
.tool-result-link > span {
  color: var(--accent);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.featured-route strong {
  display: block;
  margin-top: 16px;
  font-size: clamp(1.35rem, 2.8vw, 2.5rem);
  line-height: 1.08;
}

.featured-route p,
.collection-list p,
.hub-list p,
.related-link small,
.result-link p,
.tool-result-link p {
  color: var(--muted);
}

.featured-route:hover,
.collection-list a:hover,
.hub-list a:hover,
.related-link:hover,
.result-link:hover,
.tool-result-link:hover {
  background: var(--surface);
}

.hub-directory {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: clamp(36px, 8vw, 110px);
}

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

.hub-list a {
  display: grid;
  grid-template-columns: 110px 190px 1fr;
  gap: 20px;
  padding: 22px 16px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.hub-list strong {
  font-size: 1.05rem;
}

.hub-list p {
  margin: 0;
  font-size: 0.92rem;
}

.collection {
  display: grid;
  grid-template-columns: 0.65fr 1.35fr;
  gap: clamp(36px, 8vw, 110px);
}

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

.collection-list a {
  display: grid;
  grid-template-columns: 90px 230px 1fr;
  gap: 24px;
  align-items: start;
  padding: 24px 16px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.collection-list strong {
  font-size: 1.05rem;
}

.collection-list p {
  margin: 0;
  font-size: 0.93rem;
}

.evidence-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.28fr);
  gap: clamp(36px, 8vw, 110px);
}

.evidence-panel__heading > p:last-child {
  color: var(--muted);
}

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

.evidence-item {
  display: grid;
  grid-template-columns: 125px 180px 1fr;
  gap: 20px;
  padding: 22px 12px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.evidence-item > span {
  color: var(--accent);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.evidence-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.91rem;
}

.article-sections {
  width: min(100%, var(--reading));
  margin-inline: clamp(0px, 8vw, 130px) auto;
}

.article-section {
  padding-block: clamp(48px, 6vw, 76px);
  border-top: 1px solid var(--line);
}

.article-section:first-child {
  border-top-color: var(--line-strong);
}

.article-section h2 {
  max-width: 18ch;
  margin: 0 0 28px;
  font-size: clamp(1.8rem, 3.2vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.article-section p {
  max-width: 72ch;
  margin: 0 0 20px;
  color: var(--muted);
}

.article-section p:first-of-type {
  color: var(--text);
  font-size: 1.08rem;
}

.article-section ul {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.article-section li {
  position: relative;
  padding: 15px 0 15px 26px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.article-section li::before {
  content: "↳";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.related-section {
  display: grid;
  grid-template-columns: 0.65fr 1.35fr;
  gap: clamp(36px, 8vw, 110px);
}

.related-links {
  border-top: 1px solid var(--line-strong);
}

.related-link {
  display: grid;
  grid-template-columns: 110px 210px 1fr;
  gap: 22px;
  padding: 24px 16px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.related-link small {
  font-size: 0.88rem;
}

.tool-workspace {
  display: grid;
  grid-template-columns: minmax(230px, 0.62fr) minmax(0, 1.38fr);
  gap: clamp(36px, 8vw, 110px);
}

.tool-form,
.search-form,
.tool-result,
.search-results,
.search-status {
  grid-column: 2;
}

.tool-form {
  display: grid;
  gap: 24px;
  padding-top: 4px;
}

.tool-form label,
.search-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 720;
}

.tool-form select,
.search-form input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.tool-form select:hover,
.search-form input:hover {
  border-color: var(--accent);
}

.tool-form__actions,
.search-form > div {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-weight: 780;
  text-decoration: none;
}

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

.button:hover {
  transform: translateY(-1px);
}

.tool-result {
  margin-top: 8px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.tool-result[hidden] {
  display: none;
}

.tool-result h3 {
  max-width: 24ch;
  margin: 0 0 16px;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  line-height: 1.12;
}

.tool-result__risk,
.tool-result > p,
.tool-result > small {
  color: var(--muted);
}

.tool-result > div {
  margin-top: 28px;
  border-top: 1px solid var(--line-strong);
}

.tool-result-link {
  display: grid;
  grid-template-columns: 120px 200px 1fr;
  gap: 18px;
  padding: 18px 8px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.tool-result-link p {
  margin: 0;
  font-size: 0.86rem;
}

.search-workspace {
  align-items: start;
}

.search-form > div {
  display: grid;
  grid-template-columns: 1fr auto;
}

.search-status {
  margin: 20px 0 0;
  color: var(--muted);
}

.search-results {
  margin-top: 12px;
  border-top: 1px solid var(--line-strong);
}

.result-link {
  display: grid;
  grid-template-columns: 130px 230px 1fr;
  gap: 20px;
  padding: 22px 12px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.result-link p {
  margin: 0;
  font-size: 0.9rem;
}

.site-footer {
  margin-top: clamp(70px, 10vw, 140px);
  padding-block: 56px;
  border-top: 1px solid var(--line-strong);
  background: var(--surface);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
}

.site-footer p {
  max-width: 56ch;
  color: var(--muted);
  font-size: 0.86rem;
}

.site-footer nav {
  display: grid;
  grid-template-columns: repeat(2, auto);
  align-content: start;
  gap: 10px 28px;
}

.site-footer nav a {
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 920px) {
  .site-header__inner {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-self: end;
  }

  .primary-nav {
    position: absolute;
    top: 72px;
    right: 20px;
    left: 20px;
    display: none;
    padding: 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .primary-nav[data-open] {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .primary-nav a {
    padding-inline: 12px;
  }

  .header-actions {
    grid-column: 3;
    grid-row: 1;
  }

  .search-link {
    display: none !important;
  }

  .page-hero,
  .home-route,
  .hub-directory,
  .collection,
  .evidence-panel,
  .related-section,
  .tool-workspace {
    grid-template-columns: 1fr;
  }

  .page-hero {
    min-height: auto;
    gap: 42px;
  }

  .page-hero__media {
    min-height: 0;
  }

  .page-hero__media img {
    min-height: 0;
    aspect-ratio: 16 / 10;
  }

  .home-route,
  .hub-directory,
  .collection,
  .evidence-panel,
  .related-section,
  .tool-workspace {
    gap: 42px;
  }

  .tool-form,
  .search-form,
  .tool-result,
  .search-results,
  .search-status {
    grid-column: 1;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(calc(100% - 28px), var(--shell));
  }

  .site-header__inner {
    min-height: 64px;
  }

  .brand span {
    font-size: 0.76rem;
  }

  .theme-toggle {
    width: 44px;
    overflow: hidden;
    color: transparent !important;
  }

  .theme-toggle::before {
    content: "◐";
    color: var(--text);
    font-size: 1.25rem;
  }

  .primary-nav {
    top: 64px;
    right: 14px;
    left: 14px;
  }

  .page-hero {
    padding-block: 44px 58px;
  }

  .page-hero h1,
  .page-hero--compact h1 {
    font-size: clamp(2.45rem, 13vw, 4rem);
  }

  .page-hero__intro {
    margin-top: 20px;
  }

  .answer-block {
    margin-top: 26px;
    padding-left: 16px;
  }

  .featured-routes {
    grid-template-columns: 1fr;
  }

  .featured-route,
  .featured-route:first-child {
    grid-row: auto;
    min-height: 0;
    padding: 24px 4px;
    border-right: 0;
  }

  .hub-list a,
  .collection-list a,
  .evidence-item,
  .related-link,
  .tool-result-link,
  .result-link {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 20px 4px;
  }

  .article-sections {
    margin-inline: 0;
  }

  .search-form > div {
    grid-template-columns: 1fr;
  }

  .site-footer__grid {
    grid-template-columns: 1fr;
  }

  .site-footer nav {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }

  .button:hover {
    transform: none;
  }
}
