:root {
  color-scheme: light dark;
  --bg: #f6f3ec;
  --bg-elev: #fffcf7;
  --fg: #1c1a16;
  --muted: #5e584e;
  --faint: #8a8376;
  --line: rgba(28, 26, 22, 0.12);
  --accent: #7a5a22;
  --accent-fill: #d4b06a;
  --accent-hover: #e0c184;
  --on-accent: #14120e;
  --accent-dim: rgba(122, 90, 34, 0.12);
  --good: #2d6a3e;
  --term-dot: #3a3a3c;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --wrap: 44rem;
  --nav-h: 3.5rem;
}

html[data-theme="light"] {
  color-scheme: light;
}

/* Dark tokens: keep html[data-theme="dark"] in sync with the auto/media block below. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090a;
  --bg-elev: #121214;
  --fg: #ece8df;
  --muted: #8c8880;
  --faint: #5c5a56;
  --line: rgba(236, 232, 223, 0.12);
  --accent: #d4b06a;
  --accent-fill: #d4b06a;
  --accent-hover: #e0c184;
  --on-accent: #09090a;
  --accent-dim: rgba(212, 176, 106, 0.16);
  --good: #9dcc86;
  --term-dot: #3a3a3c;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --bg: #09090a;
    --bg-elev: #121214;
    --fg: #ece8df;
    --muted: #8c8880;
    --faint: #5c5a56;
    --line: rgba(236, 232, 223, 0.12);
    --accent: #d4b06a;
    --accent-fill: #d4b06a;
    --accent-hover: #e0c184;
    --on-accent: #09090a;
    --accent-dim: rgba(212, 176, 106, 0.16);
    --good: #9dcc86;
    --term-dot: #3a3a3c;
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[id] {
  scroll-margin-top: calc(var(--nav-h) + 1.25rem);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

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

code,
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 20;
  padding: 0.4rem 0.7rem;
  background: var(--bg-elev);
  color: var(--fg);
}

.skip:focus {
  top: 0.75rem;
}

.wrap {
  width: min(var(--wrap), calc(100% - 3rem));
  margin-inline: auto;
}

/* Nav */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--nav-h);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--nav-h);
}

.nav-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.9rem 1.1rem;
}

.wordmark {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--fg);
  text-decoration: none;
}

.wordmark:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.9rem 1.1rem;
}

.nav nav a {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
}

.nav nav a:hover {
  color: var(--fg);
  text-decoration: none;
}

.nav nav a.is-stub {
  opacity: 0.45;
  cursor: default;
}

.nav nav .btn {
  color: var(--on-accent);
}

.nav nav .btn:hover {
  color: var(--on-accent);
}

.theme-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: stretch;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.theme-toggle [data-theme-opt] {
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
}

html[data-theme="light"] .theme-toggle [data-theme-opt="light"],
html[data-theme="dark"] .theme-toggle [data-theme-opt="dark"] {
  background: var(--bg-elev);
  color: var(--fg);
}

@media (prefers-color-scheme: light) {
  html[data-theme="auto"] .theme-toggle [data-theme-opt="light"] {
    background: var(--bg-elev);
    color: var(--fg);
  }
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .theme-toggle [data-theme-opt="dark"] {
    background: var(--bg-elev);
    color: var(--fg);
  }
}

/* Type */

.eyebrow {
  margin: 0 0 0.85rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

h1,
h2,
h3 {
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.4rem, 6.4vw, 3.6rem);
}

h2 {
  margin: 0 0 1.5rem;
  font-size: clamp(1.45rem, 3vw, 1.85rem);
}

h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.lede {
  margin: 0 0 1.75rem;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.5;
}

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

.faint {
  color: var(--faint);
}

.name {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--accent);
}

/* Buttons */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--accent-fill);
  color: var(--on-accent);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.btn code {
  font-size: inherit;
  color: inherit;
}

.btn-sm {
  padding: 0.32rem 0.7rem;
  font-size: 0.78rem;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--fg);
}

.btn-ghost:hover {
  background: var(--bg-elev);
  color: var(--fg);
}

.btn.is-soon {
  position: relative;
  opacity: 0.45;
  cursor: not-allowed;
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.btn.is-soon:hover {
  background: transparent;
  color: var(--muted);
}

.btn.is-soon:hover::after,
.btn.is-soon:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.45rem);
  transform: translateX(-50%);
  padding: 0.28rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-elev);
  color: var(--fg);
  font-size: 0.72rem;
  font-weight: 400;
  white-space: nowrap;
  opacity: 1;
}

/* Terminal */

.term {
  margin: 2.25rem 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.term-dots {
  display: flex;
  gap: 0.35rem;
}

.term-dots span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--term-dot);
}

.term-title {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
}

.term-body {
  margin: 0;
  padding: 1.1rem 1.15rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.7;
  overflow-x: auto;
}

.term-body .prompt {
  color: var(--accent);
}

.term-body .cmt {
  color: var(--faint);
}

/* Sections */

.section {
  padding: 5.5rem 0;
  border-top: 1px solid var(--line);
}

.section:first-of-type {
  border-top: 0;
  padding-top: 5rem;
}

.hero {
  padding: 5.5rem 0 6rem;
}

.quick {
  display: grid;
  gap: 1.35rem;
}

.quick-who {
  margin: 0 0 0.5rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.quick-note {
  margin: 0.35rem 0 0;
  color: var(--faint);
  font-size: 0.88rem;
}

.copy-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.2rem 0 0.15rem;
}

.copy-line .cmd {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
}

.copy-btn {
  flex-shrink: 0;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.copy-btn:hover {
  color: var(--fg);
  border-color: var(--muted);
}

.copy-btn.is-copied {
  color: var(--good);
  border-color: var(--good);
}

/* Cards / beats — used once copy lands */

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.grid > .card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.card,
.beat {
  padding: 1.15rem 1.2rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
}

.card p,
.beat p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.card p code,
.beat p code,
.fine code,
.holes p code {
  color: var(--fg);
}

.cmd {
  display: block;
  margin: 0.35rem 0 0.65rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
}

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

.beat-n {
  display: block;
  margin-bottom: 0.45rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--faint);
}

.holes {
  display: grid;
  gap: 1.25rem;
  margin: 0 0 1.75rem;
}

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

.holes strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--fg);
  font-weight: 500;
}

.holes strong code {
  color: var(--accent);
}

.mesh {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0 0.85rem;
}

.pill {
  padding: 0.28rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.pill .tag {
  margin-left: 0.15rem;
  color: var(--faint);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fine {
  margin: 0;
  color: var(--faint);
  font-size: 0.88rem;
}

.docs-link {
  margin: 1.5rem 0 0;
  font-size: 0.92rem;
}

.dojo {
  margin: 0.55rem 0 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--accent);
}

.dojo code {
  font-size: inherit;
  color: inherit;
}

.alpha {
  margin: 1.75rem 0 0;
  color: var(--faint);
  font-size: 0.9rem;
}

#planet .lede {
  margin-bottom: 2.6rem;
}

/* Footer */

#start {
  min-height: calc(100svh - 8rem);
}

.foot {
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--line);
}

.foot-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.15rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
}

.foot-origin {
  margin: 0.9rem 0 0;
  font-size: 0.72rem;
  color: var(--faint);
}

.foot a {
  color: var(--muted);
}

.foot a.is-stub {
  color: var(--faint);
  cursor: default;
  text-decoration: none;
}

@media (max-width: 720px) {
  .wrap {
    width: min(var(--wrap), calc(100% - 2rem));
  }

  .nav {
    height: auto;
  }

  .nav-inner {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    padding: 0.75rem 0 0.65rem;
    gap: 0.5rem;
  }

  .nav-tools,
  .nav nav {
    justify-content: flex-start;
    gap: 0.55rem 0.9rem;
  }

  [id] {
    scroll-margin-top: 6.25rem;
  }

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

  .grid > .card:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .hero,
  .section {
    padding: 3.5rem 0;
  }

  .hero {
    padding-top: 2.5rem;
  }

  h1 {
    font-size: clamp(2rem, 10vw, 2.6rem);
  }
}

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