:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --surface: #fffdf8;
  --ink: #171717;
  --muted: #67635c;
  --line: #d9d4ca;
  --product: #6842c2;
  --product-soft: #eee9ff;
  --max: 1180px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
:focus-visible { outline: 3px solid rgba(104, 66, 194, .38); outline-offset: 3px; }

.nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 68px; padding: 0 max(24px, calc((100vw - var(--max)) / 2)); border-bottom: 1px solid rgba(217, 212, 202, .85); background: rgba(245, 243, 238, .9); backdrop-filter: blur(18px); }
.nav-left { display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: baseline; gap: 9px; }
.brand-mark { width: 30px; height: 30px; flex: 0 0 auto; align-self: center; object-fit: contain; mix-blend-mode: multiply; }
.brand strong { font-size: 18px; line-height: 1; letter-spacing: -.035em; }
.brand span { color: var(--muted); font-size: 11px; line-height: 1; font-weight: 650; }
.home-link { color: var(--ink); font-size: 14px; font-weight: 750; }
.home-link:hover { color: var(--product); }
.nav-links { display: flex; align-items: center; gap: 24px; color: var(--muted); font-size: 14px; font-weight: 650; }
.nav-links > a:hover, .nav-links > a.active { color: var(--ink); }

.language-menu { position: relative; }
.language-trigger { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; list-style: none; }
.language-trigger::-webkit-details-marker { display: none; }
.language-trigger svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.language-trigger:hover, .language-menu[open] .language-trigger { border-color: var(--product); color: var(--product); }
.language-options { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; min-width: 132px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 16px 42px rgba(23, 23, 23, .12); }
.language-options a { display: block; padding: 8px 10px; border-radius: 4px; color: var(--muted); font-size: 13px; font-weight: 700; }
.language-options a:hover { background: var(--bg); color: var(--ink); }
.language-options a[aria-current="page"] { background: var(--product-soft); color: var(--product); }

main, .footer { width: min(var(--max), calc(100% - 48px)); margin: 0 auto; }
.docs-hero { padding: clamp(48px, 6vw, 76px) 0 clamp(42px, 5vw, 64px); }
.eyebrow { margin-bottom: 20px; color: var(--product); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1 { max-width: 900px; margin-bottom: 24px; font-size: clamp(43px, 5.4vw, 68px); font-weight: 800; line-height: 1.02; letter-spacing: -.05em; overflow-wrap: anywhere; }
.hero-lead { max-width: 740px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.6; }

.docs-section { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; padding: clamp(44px, 5vw, 64px) 0; border-top: 1px solid var(--line); }
.section-label { color: var(--ink); font-size: 14px; font-weight: 750; }
.section-label span { display: inline-block; width: 42px; color: var(--product); font-size: 12px; }
.section-content { max-width: 760px; }
h2 { margin-bottom: 18px; font-size: clamp(30px, 3.2vw, 43px); line-height: 1.1; letter-spacing: -.04em; }
.section-content > p { max-width: 700px; color: var(--muted); font-size: 17px; line-height: 1.7; }
.section-content > p:last-child { margin-bottom: 0; }
.section-content > .note { margin-top: 20px; padding-left: 15px; border-left: 3px solid var(--product); font-size: 14px; }

.flow-list { margin: 28px 0 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.flow-list li { display: grid; grid-template-columns: 82px 1fr; gap: 20px; padding: 19px 0; border-bottom: 1px solid var(--line); }
.flow-list li > span { color: var(--product); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.flow-list h3 { margin-bottom: 7px; font-size: 20px; line-height: 1.3; }
.flow-list p { margin: 0; color: var(--muted); line-height: 1.65; }

.definition-list { display: grid; grid-template-columns: 1fr 1fr; margin-top: 28px; border-top: 1px solid var(--line); }
.definition-list article { min-height: 124px; padding: 20px 22px 20px 0; border-bottom: 1px solid var(--line); }
.definition-list article:nth-child(even) { padding-left: 26px; border-left: 1px solid var(--line); }
.definition-list h3 { margin-bottom: 8px; color: var(--product); font-size: 21px; }
.definition-list p { margin: 0; color: var(--muted); line-height: 1.65; }
.final-section { border-bottom: 1px solid var(--line); }

.footer { display: flex; justify-content: space-between; gap: 22px; padding: 30px 0; color: var(--muted); font-size: 13px; }
.footer strong { color: var(--ink); }

@media (max-width: 820px) {
  .nav-links > a:not([data-route="changelog"]) { display: none; }
  main, .footer { width: min(100% - 32px, var(--max)); }
  .docs-section { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 560px) {
  .nav { padding-inline: 16px; }
  .nav-left { gap: 14px; }
  .nav-links { gap: 12px; }
  .brand span { display: none; }
  h1 { font-size: 42px; }
  h2 { font-size: 32px; }
  .docs-hero { padding: 44px 0 38px; }
  .docs-section { padding: 38px 0; }
  .hero-lead, .section-content > p { font-size: 16px; }
  .flow-list { margin-top: 22px; }
  .flow-list li { grid-template-columns: 1fr; gap: 6px; padding: 17px 0; }
  .definition-list { grid-template-columns: 1fr; }
  .definition-list article { min-height: 0; padding: 18px 0; }
  .definition-list article:nth-child(even) { padding-left: 0; border-left: 0; }
  .footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
