:root,
:root[data-theme="dark"] {
  --bg: #0b0b0d;
  --surface: #141317;
  --fg: #e8e6df;
  --muted: #9a9790;
  --accent: #d4af37;
  --accent-contrast: #14120a;
  --link: #d4af37;
  --border: #232228;
  --ring: rgba(212, 175, 55, 0.14);
  --shadow: rgba(0, 0, 0, 0.5);
  --max-width: 960px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #faf7f0;
  --surface: #ffffff;
  --fg: #211e18;
  --muted: #6b675e;
  --accent: #a67c00;
  --accent-contrast: #fffdf5;
  --link: #8a6d1f;
  --border: #e2ddd0;
  --ring: rgba(166, 124, 0, 0.12);
  --shadow: rgba(90, 75, 30, 0.12);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a {
  color: var(--link);
}

h2 {
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

.section-lede {
  max-width: 44rem;
  color: var(--muted);
  margin: 0 0 2rem;
}

/* ---- nav ---- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1.5rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-brand img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  font-size: 0.92rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--fg);
}

.nav-links .nav-github {
  color: var(--link);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--fg);
  border-color: var(--muted);
}

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

/* ---- hero ---- */

.hero {
  position: relative;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  overflow: hidden;
}

.hero-rings {
  position: absolute;
  inset: -40% 0 auto 0;
  display: flex;
  justify-content: center;
  color: var(--ring);
  pointer-events: none;
}

.hero-rings svg {
  width: min(640px, 120vw);
  stroke-width: 1;
}

.hero-mark {
  position: relative;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: 0 0 0 6px var(--ring), 0 12px 40px var(--shadow);
}

.hero h1 {
  position: relative;
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 3.4rem);
  letter-spacing: -0.03em;
}

.tagline {
  position: relative;
  margin: 0.25rem 0 1.5rem;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.lede {
  position: relative;
  max-width: 42rem;
  margin: 0 auto;
  color: var(--fg);
  font-size: 1.05rem;
}

.cta {
  position: relative;
  margin-top: 2.25rem;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.button {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  text-decoration: none;
  font-weight: 600;
}

.button:hover {
  filter: brightness(1.08);
}

.button-ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}

.button-ghost:hover {
  border-color: var(--muted);
  filter: none;
}

/* ---- main sections ---- */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.gallery-section,
.practice,
.quick-start {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

/* ---- gallery ---- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.25rem;
}

.gallery figure {
  margin: 0;
  text-align: center;
}

.gallery img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  border: 1px solid var(--border);
  /* fixed paper tone: line-art examples assume a light ground in any theme */
  background: #f4f1e8;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.gallery figure:hover img {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 14px 30px var(--shadow);
}

.gallery figcaption {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  line-height: 1.35;
}

.gallery figcaption b {
  display: block;
  font-weight: 600;
  color: var(--fg);
}

.gallery figcaption span {
  color: var(--muted);
}

/* ---- in practice ---- */

.practice-example {
  margin-top: 2.5rem;
}

.practice-example h3 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

.practice-example h3 a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.practice-example h3 a:hover {
  color: var(--link);
  border-color: var(--link);
}

.pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.25rem;
  align-items: center;
}

.pair figure {
  margin: 0;
}

.pair img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f4f1e8;
  display: block;
}

.pair figcaption {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  line-height: 1.4;
  text-align: center;
}

.pair figcaption b {
  display: block;
  color: var(--fg);
  font-weight: 600;
}

.pair figcaption span {
  color: var(--muted);
}

.pair-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: var(--accent);
  padding-bottom: 2.5rem;
}

.pair-arrow code {
  font-size: 0.75rem;
  color: var(--muted);
}

.practice pre {
  margin-top: 2.5rem;
}

@media (max-width: 720px) {
  .pair {
    grid-template-columns: 1fr;
  }

  .pair-arrow {
    padding-bottom: 0;
  }

  .pair-arrow svg {
    transform: rotate(90deg);
  }
}

/* ---- quick start / code ---- */

.quick-start h2 {
  margin-top: 0;
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.55;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---- footer ---- */

footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  border-top: 1px solid var(--border);
}

/* ---- small screens ---- */

@media (max-width: 640px) {
  .nav-links {
    gap: 0.8rem;
    font-size: 0.85rem;
  }

  .nav-links a:not(.nav-github) {
    display: none;
  }

  .hero {
    padding-top: 3.5rem;
  }
}
