:root {
  --bg: #fdf6e3;
  --bg-alt: #f7f0dc;
  --card: #eee8d5;
  --card-raised: #fdf6e3;
  --border: #d8d2c0;
  --border-strong: #93a1a1;
  --fg: #657b83;
  --heading: #586e75;
  --muted: #93a1a1;
  --link: #268bd2;
  --accent: #2aa198;
  --yellow: #b58900;
  --orange: #cb4b16;
  --red: #dc322f;
  --green: #859900;
  --violet: #6c71c4;
  --brand-gradient: linear-gradient(90deg, #b58900, #cb4b16, #2aa198, #268bd2);
  --shadow: 0 1px 2px rgba(88, 110, 117, 0.08), 0 8px 24px rgba(88, 110, 117, 0.06);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --measure: 68ch;
  --radius: 8px;
  --radius-sm: 4px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #002b36;
    --bg-alt: #00252e;
    --card: #073642;
    --card-raised: #06303b;
    --border: #12414f;
    --border-strong: #586e75;
    --fg: #839496;
    --heading: #93a1a1;
    --muted: #657b83;
    --link: #6cb6e8;
    --accent: #3fc0b4;
    --yellow: #d3a319;
    --orange: #e0653a;
    --red: #ef5350;
    --green: #a3b81f;
    --violet: #8b8fdc;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="dark"] {
  --bg: #002b36;
  --bg-alt: #00252e;
  --card: #073642;
  --card-raised: #06303b;
  --border: #12414f;
  --border-strong: #586e75;
  --fg: #839496;
  --heading: #93a1a1;
  --muted: #657b83;
  --link: #6cb6e8;
  --accent: #3fc0b4;
  --yellow: #d3a319;
  --orange: #e0653a;
  --red: #ef5350;
  --green: #a3b81f;
  --violet: #8b8fdc;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--card);
  border: 1px solid var(--border-strong);
  padding: 0.6rem 0.9rem;
  z-index: 100;
}

.skip-link:focus {
  left: 0.75rem;
  top: 0.75rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  background: var(--brand-gradient);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.brand img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.brand:hover {
  animation: drift 6s ease-in-out infinite;
}

@keyframes drift {
  0% {
    background-position: 0% center;
  }
  50% {
    background-position: 100% center;
  }
  100% {
    background-position: 0% center;
  }
}

.nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-left: auto;
  font-size: 0.85rem;
}

.nav a {
  color: var(--fg);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.nav a:hover {
  color: var(--heading);
  border-bottom-color: var(--accent);
}

.nav a[aria-current="page"] {
  color: var(--heading);
  border-bottom-color: var(--yellow);
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

.prose {
  max-width: var(--measure);
}

section {
  margin: 3.5rem 0;
}

section:first-of-type {
  margin-top: 2rem;
}

h1,
h2,
h3,
h4 {
  color: var(--heading);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
}

h1 {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem);
}

h2 {
  font-size: clamp(1.2rem, 1.05rem + 0.7vw, 1.5rem);
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

h3 {
  font-size: 1.05rem;
  margin-top: 1.75rem;
}

h4 {
  font-size: 0.95rem;
  margin-top: 1.25rem;
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.35rem;
  margin: 0 0 1rem;
}

li {
  margin-bottom: 0.4rem;
}

li > ul,
li > ol {
  margin-top: 0.4rem;
}

strong {
  color: var(--heading);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.eyebrow {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.lede {
  font-size: 1.05rem;
  color: var(--fg);
  max-width: var(--measure);
}

.badge {
  display: inline-block;
  background: var(--card-raised);
  border: 1px solid var(--border-strong);
  color: var(--yellow);
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  margin: 0 0.35rem 0.35rem 0;
  white-space: nowrap;
}

.badge.accent {
  color: var(--accent);
}

.badge.violet {
  color: var(--violet);
}

.hero {
  padding: 2rem 0 0;
}

.hero-ascii {
  font-size: clamp(0.3rem, 0.1rem + 0.72vw, 0.6rem);
  line-height: 1.15;
  white-space: pre;
  display: block;
  overflow-x: auto;
  margin: 0 0 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--brand-gradient);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: drift 8s ease-in-out infinite;
}

.hero h1 {
  font-size: clamp(1.6rem, 1.25rem + 1.8vw, 2.35rem);
}

.hero-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: 1.5rem 0 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--heading);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  border-color: var(--accent);
  opacity: 0.95;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fdf6e3;
}

:root[data-theme="dark"] .btn.primary {
  color: #002b36;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary {
    color: #002b36;
  }
}

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

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid.three {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card h3 {
  margin-top: 0;
}

.card p:last-child,
.card ul:last-child {
  margin-bottom: 0;
}

.card.raised {
  background: var(--card-raised);
  box-shadow: var(--shadow);
}

.card .icon {
  font-size: 1.1rem;
  display: block;
  margin-bottom: 0.35rem;
}

pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.83rem;
  line-height: 1.6;
  margin: 0 0 1rem;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.34rem;
  color: var(--heading);
  word-break: break-word;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 1em;
  color: inherit;
  word-break: normal;
}

pre .c {
  color: var(--muted);
}

pre .k {
  color: var(--yellow);
}

pre .s {
  color: var(--accent);
}

.terminal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 1rem;
  overflow: hidden;
}

.terminal-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  font-size: 0.75rem;
  color: var(--muted);
}

.terminal-title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 13px 0 0 var(--yellow), 26px 0 0 var(--green);
  margin-right: 26px;
}

.terminal pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
}

caption {
  caption-side: top;
  text-align: left;
  padding: 0.6rem 0.85rem;
  color: var(--muted);
  font-size: 0.78rem;
}

th,
td {
  text-align: left;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--heading);
  background: var(--bg-alt);
  font-weight: 600;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.callout {
  border: 1px solid var(--border-strong);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--card);
  padding: 0.9rem 1.1rem;
  margin: 0 0 1.25rem;
  font-size: 0.92rem;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout .callout-title {
  display: block;
  color: var(--heading);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.callout.info {
  border-left-color: var(--link);
}

.callout.ok {
  border-left-color: var(--green);
}

.callout.warn {
  border-left-color: var(--orange);
}

.callout.danger {
  border-left-color: var(--red);
}

.steps {
  list-style: none;
  padding: 0;
  counter-reset: step;
  max-width: var(--measure);
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 2.4rem;
  margin-bottom: 1.35rem;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.steps > li > :last-child {
  margin-bottom: 0;
}

.flow {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre;
  color: var(--fg);
}

dl.faq {
  max-width: var(--measure);
}

dl.faq dt {
  color: var(--heading);
  font-weight: 700;
  margin-top: 1.5rem;
}

dl.faq dt:first-child {
  margin-top: 0;
}

dl.faq dd {
  margin: 0.35rem 0 0;
}

details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 0.75rem 1rem;
  margin-bottom: 0.6rem;
  max-width: var(--measure);
}

details[open] {
  background: var(--card-raised);
}

summary {
  cursor: pointer;
  color: var(--heading);
  font-weight: 700;
  font-size: 0.95rem;
  list-style-position: outside;
}

summary::marker {
  color: var(--accent);
}

details > *:last-child {
  margin-bottom: 0;
}

details > p:first-of-type {
  margin-top: 0.6rem;
}

.breadcrumb {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 1.5rem 0 1rem;
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  gap: 0.45rem;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.45rem;
  color: var(--border-strong);
}

.page-head {
  padding-top: 1.5rem;
}

.page-head h1 {
  margin-bottom: 0.5rem;
}

.toc {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 1rem 1.25rem;
  max-width: var(--measure);
}

.toc ul {
  margin-bottom: 0;
  columns: 2;
  column-gap: 1.5rem;
}

@media (max-width: 600px) {
  .toc ul {
    columns: 1;
  }
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  margin-top: 4rem;
}

.site-footer .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  font-size: 0.82rem;
}

.site-footer h2 {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border: 0;
  padding: 0;
  margin: 0 0 0.6rem;
}

.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer li {
  margin-bottom: 0.3rem;
}

.site-footer a {
  color: var(--fg);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--link);
  text-decoration: underline;
}

.site-footer .colophon {
  flex-basis: 100%;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .nav {
    gap: 0.75rem;
    font-size: 0.8rem;
  }

  section {
    margin: 2.5rem 0;
  }
}

@media print {
  .site-header,
  .site-footer,
  .hero-actions {
    display: none;
  }

  body {
    background: #fff;
  }
}
