@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600&family=Geist+Mono:wght@500&display=swap");
@import "tokens.css";

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

html,
body {
  overflow-x: clip;
}

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

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-body);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}

strong {
  color: var(--color-strong);
  font-weight: 600;
}

a {
  color: inherit;
  text-underline-offset: 0.3em;
  transition: color var(--dur-micro) var(--ease-out);
}

a:hover:not(.button) {
  color: var(--color-strong);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

code,
pre {
  font-family: var(--font-outlier);
  font-size: 0.84em;
}

:not(pre) > code {
  padding: 0.1em 0.35em;
  border: var(--rule);
  border-radius: 0.3rem;
  background: var(--color-paper-3);
  overflow-wrap: anywhere;
}

pre {
  margin: 0 0 var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  overflow-x: auto;
  border: var(--rule);
  border-radius: var(--radius-sm);
  background: var(--color-paper-3);
  line-height: 1.5;
}

pre code {
  font-size: inherit;
}

.page {
  max-width: 44rem;
  margin-inline: auto;
  padding: 0 1.25rem;
}

/* Header */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  position: sticky;
  top: 0;
  z-index: 10;
  margin-bottom: var(--space-md);
  padding-block: var(--space-xs);
}

/* Full-bleed background + rule while the content stays in the .page column. */
.site-header::before,
.site-footer::before {
  content: "";
  position: absolute;
  inset: 0 -100vmax;
  z-index: -1;
}

.site-header::before {
  background: var(--color-paper);
  border-bottom: var(--rule);
}

.site-footer::before {
  border-top: var(--rule);
}

.brand-group {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
}

.version-badge {
  color: var(--color-muted);
  font-size: var(--text-xs);
  text-decoration: none;
  transition: opacity var(--dur-micro) var(--ease-out);
}

.version-badge:hover {
  opacity: 0.8;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--color-ink);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur-micro) var(--ease-out);
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-ink);
}

.nav-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-link svg.fill {
  fill: currentColor;
  stroke: none;
}

/* Theme toggle: show the icon of the theme you would switch to. */
.icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: block;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .icon-moon {
    display: none;
  }
}

/* Content */

main h1,
main h2,
main h3 {
  color: var(--color-ink);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.hero {
  margin: var(--space-lg) 0;
}

.hero h1 {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-xl);
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.hero p {
  margin: 0;
  color: var(--color-muted);
}

section {
  margin: var(--space-xl) 0;
}

section h2 {
  margin: 0 0 var(--space-sm);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

section p {
  margin: 0 0 var(--space-sm);
}

.note {
  margin: var(--space-sm) 0 0;
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.hero .note {
  margin-top: var(--space-lg);
}

.steps + .note {
  margin-top: var(--space-lg);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-lg);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.5rem 1.05rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity var(--dur-micro) var(--ease-out);
}

.button:hover {
  opacity: 0.8;
}

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

.button--secondary {
  border-color: var(--color-rule);
  background: var(--color-paper);
  color: var(--color-ink);
}

.poster {
  display: block;
  width: 100%;
  height: auto;
  border: var(--rule);
  border-radius: var(--radius-card);
}

.poster-button {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: var(--space-md);
  border: 0;
  background: transparent;
  cursor: zoom-out;
}

.lightbox:not([open]) {
  display: none;
}

.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox::backdrop {
  background: oklch(0% 0 0 / 0.85);
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-card);
}

.lightbox[open]::backdrop {
  animation: lightbox-fade var(--dur-short) var(--ease-out);
}

.lightbox[open] img {
  animation: lightbox-zoom var(--dur-short) var(--ease-out);
}

.lightbox[data-closing]::backdrop {
  animation: lightbox-fade var(--dur-short) var(--ease-out) reverse forwards;
}

.lightbox[data-closing] img {
  animation: lightbox-zoom var(--dur-short) var(--ease-out) reverse forwards;
}

@keyframes lightbox-fade {
  from {
    opacity: 0;
  }
}

@keyframes lightbox-zoom {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox[open]::backdrop,
  .lightbox[open] img {
    animation: none;
  }
}

.list {
  margin: 0;
  padding-left: 1.15rem;
}

.list li + li {
  margin-top: var(--space-2xs);
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding-left: 2.25rem;
  counter-increment: step;
}

.steps li + li {
  margin-top: var(--space-xs);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: 0.1rem;
  left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: var(--rule);
  border-radius: var(--radius-pill);
  background: var(--color-paper-2);
  color: var(--color-muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

/* Docs */

kbd {
  padding: 0.1em 0.4em;
  border: var(--rule);
  border-bottom-width: 2px;
  border-radius: 0.3rem;
  background: var(--color-paper-2);
  font-family: var(--font-outlier);
  font-size: 0.8em;
  white-space: nowrap;
}

.toc ul {
  margin: 0 0 var(--space-lg);
  padding: 0;
  list-style: none;
  border-left: var(--rule);
}

.toc a {
  display: block;
  margin-left: -1px;
  padding: var(--space-3xs) var(--space-sm);
  border-left: 1px solid transparent;
  color: var(--color-muted);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color var(--dur-micro) var(--ease-out);
}

.toc a:hover,
.toc a[aria-current] {
  color: var(--color-ink);
}

.toc a[aria-current] {
  border-left-color: var(--color-ink);
  font-weight: 500;
}

.doc {
  margin: var(--space-lg) 0;
  scroll-margin-top: 4.5rem;
}

.docs-content > .doc:first-child {
  margin-top: 0;
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: var(--space-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th,
td {
  padding: var(--space-xs) var(--space-sm) var(--space-xs) 0;
  border-bottom: var(--rule);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--color-muted);
  font-weight: 500;
}

/* Wide screens: the TOC hangs in the right margin; the content column stays aligned with the header. */
@media (min-width: 72rem) {
  .docs-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 11rem;
    column-gap: 2.5rem;
    margin-right: -13.5rem;
  }

  .toc {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 5.5rem;
    align-self: start;
  }

  .toc ul {
    margin-bottom: 0;
  }

  .docs-content {
    grid-column: 1;
    grid-row: 1;
  }
}

/* Footer */

.site-footer {
  position: relative;
  margin-top: var(--space-xl);
  padding: 0.75rem 0;
  color: var(--color-muted);
  font-size: var(--text-sm);
}

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

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
