@import url("styles/tokens.css");

:root {
  --paper-2: var(--paper-deep);
  --shell: min(1280px, calc(100% - 96px));
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Sora", "Segoe UI", sans-serif;
  font-size: 0.9375rem;
  line-height: 1.65;
}
body.menu-open {
  overflow: hidden;
}
img,
svg,
video {
  max-width: 100%;
  height: auto;
}
a {
  color: var(--teal-dark);
}
button,
input {
  font: inherit;
}
.container {
  width: var(--shell);
  margin-inline: auto;
}
.skip-link {
  position: fixed;
  z-index: 9999;
  top: 1rem;
  left: 1rem;
  padding: 0.7rem 1rem;
  color: white;
  background: var(--ink);
  transform: translateY(-180%);
}
.skip-link:focus {
  transform: none;
}
.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;
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
nav {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo a {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.logo a::before {
  content: "";
  display: block;
  width: 36px;
  height: 36px;
  background: var(--blue);
  mask: url("assets/monogram.svg") center / contain no-repeat;
}

.nav-links {
  display: flex;
  gap: 1.8rem;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--action-text);
}
.hamburger {
  display: none;
  border: 0;
  background: transparent;
  width: 44px;
  height: 44px;
}
.hamburger span {
  display: block;
  width: 23px;
  height: 1.5px;
  margin: 6px auto;
  background: var(--ink);
}
.hamburger span {
  transition: transform 0.2s ease;
}
.hamburger[aria-expanded="true"] span:first-child {
  transform: translateY(3.75px) rotate(45deg);
}
.hamburger[aria-expanded="true"] span:last-child {
  transform: translateY(-3.75px) rotate(-45deg);
}

.docs-hero {
  padding: clamp(4.5rem, 8vw, 8rem) 0 3.5rem;
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.docs-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 5rem;
  align-items: end;
}
.docs-hero-grid > * {
  min-width: 0;
}
.docs-hero h1 {
  margin: 0;
  max-width: 840px;
  font-size: clamp(3.1rem, 6vw, 5rem);
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: -0.035em;
}
.docs-hero h1 em {
  color: inherit;
  font-family: inherit;
  font-style: normal;
  font-weight: inherit;
}
.docs-hero-copy p {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 1.05rem;
}
.docs-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.docs-stats div {
  padding: 1rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.docs-stats strong,
.docs-stats span {
  display: block;
}
.docs-stats strong {
  font-size: 1.75rem;
  letter-spacing: -0.035em;
}
.docs-stats span {
  color: var(--muted);
  font-size: 0.875rem;
  text-transform: none;
  letter-spacing: 0;
}

.docs-toolbar {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}
.toolbar-grid {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.search-wrap {
  position: relative;
  flex: 0 1 430px;
}
.search-wrap::before {
  content: "⌕";
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
}
.search-wrap input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  padding: 0.8rem 1rem 0.8rem 2.6rem;
  outline: none;
}
.search-wrap input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(33, 77, 222, 0.15);
}
.filter-list {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.filter-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  background: transparent;
  padding: 0.45rem 0.7rem;
  color: var(--ink);
  cursor: pointer;
  box-shadow: none;
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  transition:
    background-color 0.16s,
    border-color 0.16s,
    box-shadow 0.16s,
    color 0.16s;
}
.filter-button:hover,
.filter-button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
  box-shadow: 0 1px 2px rgba(18, 23, 21, 0.14);
}
.filter-button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.docs-library {
  padding: 4.5rem 0 7rem;
}
.library-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 2rem;
  margin-bottom: 2rem;
}
.library-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -0.035em;
}
.library-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}
.featured-guides {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr) minmax(0, 0.85fr);
  gap: 1rem;
  margin-bottom: 4rem;
}
.featured-guide {
  min-height: 360px;
  padding: 1.7rem;
  display: flex;
  flex-direction: column;
  background: var(--white);
  color: var(--ink);
  border-radius: 12px;
  text-decoration: none;
}
.featured-guide:first-child {
  background: var(--blue);
  color: white;
}
.featured-guide small {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.72;
}
.featured-guide h2,
.featured-guide h3 {
  margin: auto 0 1rem;
  font-size: clamp(1.6rem, 2.6vw, 2.8rem);
  line-height: 1.22;
  font-weight: 500;
  letter-spacing: -0.035em;
}
.featured-guide p {
  margin: 0;
  font-size: 0.875rem;
  opacity: 0.78;
}
.featured-guide b {
  display: block;
  margin-top: 1.3rem;
  font-size: 0.875rem;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.guide-card {
  min-height: 285px;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  background: var(--white);
}
.guide-card[hidden] {
  display: none;
}
.guide-card .guide-category {
  color: var(--teal-dark);
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.guide-card h3 {
  margin: auto 0 0.9rem;
  font-size: 1.3rem;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: -0.035em;
}
.guide-card p {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.guide-card > a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}
.empty-state {
  display: none;
  padding: 4rem 1rem;
  text-align: center;
  border: 1px solid var(--line);
  color: var(--muted);
}
.empty-state.visible {
  display: block;
}

.knowledge-paths {
  padding: 4rem 0;
  background: var(--paper-deep);
  color: var(--ink);
}
.path-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}
.path-card {
  min-height: 300px;
  padding: 2rem;
  border: 0;
  border-radius: 12px;
  background: var(--white);
  display: flex;
  flex-direction: column;
  color: var(--ink);
  text-decoration: none;
}
.path-card:nth-child(2) {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
.path-card small {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.875rem;
}
.path-card h2 {
  margin: auto 0 0.8rem;
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.035em;
}
.path-card p {
  margin: 0 0 1.5rem;
  color: var(--muted);
  max-width: 500px;
}
.path-card:nth-child(2) p {
  color: #dbe1ff;
}
.path-card b {
  font-size: 0.875rem;
}

.docs-container {
  padding: 3rem 0 6rem;
}
.docs-container > h2 {
  margin: 0 0 2rem;
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.035em;
}
.docs-container > .grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.docs-container > .grid > .card {
  min-height: 230px;
  padding: 1.3rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.18);
}
.docs-container > .grid > .card h3 {
  margin: auto 0 1rem;
  font-size: 1.2rem;
  line-height: 1.12;
  letter-spacing: -0.03em;
}
.docs-container > .grid > .card h3 a {
  color: var(--ink);
  text-decoration: none;
}
.docs-container > .grid > .card p {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.875rem;
}
.docs-container > .grid > .card code {
  overflow-wrap: anywhere;
}
.docs-card {
  max-width: 920px;
  margin-inline: auto;
}
.docs-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
}
.docs-breadcrumb a {
  color: var(--teal-dark);
  text-decoration: none;
  font-weight: 500;
}
.docs-content {
  background: var(--white);
  border: 1px solid var(--line);
  padding: clamp(1.25rem, 5vw, 4.5rem);
  border-radius: 12px;
}
.docs-content > h1:first-child {
  margin-top: 0;
  padding-bottom: 1.4rem;
  border-bottom: 4px solid var(--teal);
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.035em;
}
.docs-content h2 {
  margin: 3rem 0 1rem;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}
.docs-content h3 {
  margin: 2.1rem 0 0.75rem;
  font-size: 1.25rem;
  line-height: 1.2;
}
.docs-content h4 {
  margin-top: 1.8rem;
}
.docs-content p,
.docs-content li {
  color: var(--ink-soft);
}
.docs-content a {
  overflow-wrap: anywhere;
}
.docs-content pre {
  max-width: 100%;
  overflow: auto;
  padding: 1rem;
  background: var(--ink);
  color: #eef2ef;
  border-left: 4px solid var(--teal);
  font-size: 0.875rem;
}
.docs-content code {
  overflow-wrap: anywhere;
}
.docs-content :not(pre) > code {
  padding: 0.12rem 0.35rem;
  background: var(--paper-2);
  font-size: max(0.875rem, 0.86em);
}
.docs-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.docs-content th,
.docs-content td {
  min-width: 120px;
  padding: 0.65rem;
  text-align: left;
  border: 1px solid var(--line);
}
.docs-content th {
  background: var(--paper-2);
}
.docs-content blockquote {
  margin: 1.5rem 0;
  padding: 0.6rem 1.5rem;
  border-left: 4px solid var(--teal);
  background: var(--paper);
}
.docs-content .toc,
.docs-content > ul:first-of-type {
  padding: 1rem 1rem 1rem 2rem;
  background: var(--paper);
}

footer {
  padding: 2rem 0;
  border-top: 1px solid var(--line);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  color: var(--muted);
  font-size: 0.875rem;
}
.footer-inner a {
  text-decoration: none;
  font-weight: 500;
}

@media (max-width: 900px) {
  :root {
    --shell: min(100% - 36px, 760px);
  }
  .docs-hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
  }
  .featured-guides {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .featured-guide:first-child {
    grid-column: 1 / -1;
  }
  .guide-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .docs-container > .grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 680px) {
  :root {
    --shell: calc(100% - 28px);
  }
  nav {
    min-height: 64px;
  }
  .has-navigation .hamburger {
    display: block;
    z-index: 2;
  }
  .has-navigation .nav-links {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1;
    background: var(--paper);
    padding: 6rem 1.5rem 2rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .has-navigation .nav-links.open {
    display: flex;
  }
  .nav-links li,
  .nav-links a {
    width: 100%;
  }
  .nav-links a {
    display: block;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 1.25rem;
  }
  .docs-hero {
    padding-top: 3.5rem;
  }
  .docs-hero h1 {
    font-size: clamp(3rem, 13vw, 4.4rem);
    overflow-wrap: anywhere;
  }
  .toolbar-grid {
    align-items: stretch;
    flex-direction: column;
  }
  .search-wrap {
    flex-basis: auto;
  }
  .featured-guides,
  .guide-grid,
  .path-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .featured-guide:first-child {
    grid-column: auto;
  }
  .guide-card {
    min-height: 245px;
  }
  .docs-container > .grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .library-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .docs-content {
    padding: 1.15rem;
  }
  .footer-inner {
    flex-direction: column;
  }
}

[hidden] {
  display: none !important;
}
.docs-toolbar {
  display: none;
}
.has-guide-filters .docs-toolbar {
  display: block;
}
::selection {
  color: var(--white);
  background: var(--ink);
}
html {
  scrollbar-color: var(--teal-dark) var(--paper-deep);
}
a {
  text-underline-offset: 0.18em;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}
input {
  caret-color: var(--action-text);
  font-size: 1rem;
}
.logo {
  min-width: 0;
}
.logo a {
  overflow-wrap: anywhere;
}
.logo a::before {
  flex: none;
}
.nav-links a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  font-size: 0.8125rem;
}
.filter-button {
  font-size: 0.875rem;
}
.filter-button[aria-pressed="true"] {
  text-decoration: underline;
  text-underline-offset: 0.3em;
}
.grid .card h2 {
  font-size: 1.35rem;
  line-height: 1.3;
}
.docs-stats strong {
  font-variant-numeric: tabular-nums;
}
@media (max-width: 680px) {
  header {
    backdrop-filter: none;
    background: var(--paper);
  }
  nav {
    gap: 0.75rem;
  }
  .logo {
    flex: 1;
  }
  .hamburger {
    flex: none;
  }
  .has-navigation .nav-links {
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  html:not(.has-navigation) nav {
    flex-wrap: wrap;
  }
  html:not(.has-navigation) .nav-links {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .hamburger span {
    transition: none;
  }
  .filter-button {
    transition:
      background-color 120ms linear,
      color 120ms linear;
  }
}

.docs-content > p,
.docs-content > ul,
.docs-content > ol {
  max-width: 75ch;
}

/* Pygments tokens share the code block's dark surface. */
.docs-content .codehilite {
  color: #eef2ef;
  background: var(--ink);
}
.docs-content .codehilite span {
  color: inherit;
}
.docs-content .codehilite :is(.c, .ch, .cm, .cp, .cpf, .c1, .cs) {
  color: #adc2b4;
}
.docs-content .codehilite :is(.k, .kc, .kd, .kn, .kp, .kr, .kt, .nb, .bp) {
  color: #e8d17a;
}
.docs-content
  .codehilite
  :is(.s, .sa, .sb, .sc, .dl, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss) {
  color: #9be1c6;
}
.docs-content
  .codehilite
  :is(.na, .nc, .nd, .ne, .nf, .fm, .nn, .no, .nv, .vc, .vg, .vi, .vm) {
  color: #cbbcf1;
}
.docs-content .codehilite :is(.gd, .gr, .gt) {
  color: #ffb5ae;
}
.docs-content .codehilite .gi {
  color: #9be1c6;
}

/* Long prose wraps; code, tables and equations scroll within the article. */
main {
  overflow-wrap: anywhere;
}
main :where(section, article, div) {
  min-width: 0;
}
mjx-container[display="true"] {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}
.guide-card > a {
  min-height: 44px;
  align-items: center;
  padding-block: 0.65rem;
}
.docs-container > .grid > .card :is(h2, h3) a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
