/* SGIP site. Tokens first; dark mode follows the system unless the visitor picks one. */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --text: #14171c;
  --muted: #5b616b;
  --line: #e6e2da;
  --accent: #14936a;
  --accent-soft: #e3f4ec;
  --accent-2: #2b5fd9;
  --code-bg: #10151b;
  --code-text: #e6edf3;
  --shadow: 0 1px 2px rgba(20, 23, 28, 0.04), 0 8px 24px -12px rgba(20, 23, 28, 0.12);
  --radius: 16px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0f13; --surface: #12161c; --surface-2: #181d24; --text: #e9ecef; --muted: #9aa3ad; --line: #232a33;
    --accent: #3ecf8e; --accent-soft: #11291f; --accent-2: #7c9cff; --code-bg: #0a0d11;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c0f13; --surface: #12161c; --surface-2: #181d24; --text: #e9ecef; --muted: #9aa3ad; --line: #232a33;
  --accent: #3ecf8e; --accent-soft: #11291f; --accent-2: #7c9cff; --code-bg: #0a0d11;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 0.08em 0.38em; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.015em; margin: 0; }
img, svg { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 16px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.bar { max-width: 1240px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; letter-spacing: 0.02em; }
.brand:hover { color: var(--text); }
.brand small { font-weight: 600; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; letter-spacing: 0; }
.logo { width: 28px; height: 28px; color: var(--text); }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 550; padding: 8px 12px; border-radius: 10px; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.nav .gh { color: var(--text); }
.theme, .menu { cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 10px; height: 36px; min-width: 36px; font-size: 16px; }
.theme:hover, .menu:hover { background: var(--surface-2); }
.menu { display: none; margin-left: auto; position: relative; }
.menu span, .menu span::before, .menu span::after { position: absolute; left: 50%; width: 16px; height: 2px; margin-left: -8px; background: currentColor; border-radius: 2px; content: ""; }
.menu span { top: 50%; margin-top: -1px; }
.menu span::before { top: -5px; }
.menu span::after { top: 5px; }

/* Layouts */
main { max-width: 1240px; margin: 0 auto; padding: 0 24px 96px; }
main.doc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; padding-top: 40px; }
main.doc .content { max-width: 800px; min-width: 0; }
main.plain { padding-top: 40px; }
.toc { position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; font-size: 13.5px; }
.toc p { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.toc nav { display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.toc a { color: var(--muted); text-decoration: none; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 2px solid transparent; line-height: 1.35; }
.toc a.d3 { padding-left: 26px; font-size: 13px; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--text); border-left-color: var(--accent); }

/* Prose */
.prose { font-size: 16.5px; }
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: clamp(32px, 4vw, 44px); margin: 0 0 20px; }
.prose h2 { font-size: 26px; margin: 56px 0 14px; padding-top: 8px; }
.prose h3 { font-size: 19px; margin: 36px 0 10px; }
.prose h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 28px 0 10px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 650; }
.prose blockquote { margin: 20px 0; padding: 12px 18px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; }
.anchor { float: left; margin-left: -1.1em; width: 1.1em; color: var(--line); text-decoration: none; font-weight: 400; opacity: 0; transition: opacity 0.15s; }
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor { opacity: 1; }
.anchor:hover { color: var(--accent); }
.edit { margin-top: 48px; font-size: 14px; }
.edit a { color: var(--muted); }
.muted { color: var(--muted); }

.table { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; font-weight: 650; font-size: 12.5px; letter-spacing: 0.03em; color: var(--muted); background: var(--surface-2); }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }

/* Code */
.code { margin: 0 0 20px; border-radius: 14px; overflow: hidden; background: var(--code-bg); border: 1px solid color-mix(in srgb, var(--code-bg) 70%, var(--line)); }
.code figcaption { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; font: 600 12px/1.4 var(--sans); color: #8b96a3; border-bottom: 1px solid #1d252e; letter-spacing: 0.02em; }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; }
.code code { background: none; border: 0; padding: 0; color: var(--code-text); font-size: 13.5px; line-height: 1.65; white-space: pre; }
.copy { cursor: pointer; font: 600 11.5px var(--sans); color: #c7d0da; background: #1b232c; border: 1px solid #2a343f; border-radius: 7px; padding: 3px 9px; }
.copy:hover { background: #24303b; }
.t-key { color: #7cc4ff; } .t-str { color: #a5e3b1; } .t-num { color: #f5b971; } .t-lit { color: #e59bd9; } .t-kw { color: #c9a7ff; } .t-com { color: #6d7a88; font-style: italic; }

/* Buttons and chips */
.button { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px; box-shadow: var(--shadow); transition: transform 0.15s, background 0.15s; }
.button:hover { color: var(--text); transform: translateY(-1px); background: var(--surface-2); }
.button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.button.primary:hover { background: var(--text); color: var(--bg); opacity: 0.92; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; font-size: 13px; font-weight: 650; color: var(--accent); letter-spacing: 0.02em; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.tag.strong { color: var(--text); }
.tag.new { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag.proposed { background: #fff4d6; color: #8a5a00; border-color: transparent; }
.tag.deprecated { background: #fde8e8; color: #a12828; border-color: transparent; }
.badge { margin: 0 0 10px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }

/* Home */
main.wide { max-width: 1240px; }
main.wide section { padding: 88px 0 0; }
.hero { position: relative; isolation: isolate; display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; padding-top: 72px !important; }
.hero::before { content: ""; position: absolute; inset: 0 -16px -40px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42% 60% at 78% 42%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(36% 50% at 12% 20%, color-mix(in srgb, var(--accent-2) 9%, transparent), transparent 70%),
    radial-gradient(circle, color-mix(in srgb, var(--text) 13%, transparent) 1px, transparent 1.5px) 0 0 / 22px 22px;
  -webkit-mask-image: radial-gradient(75% 85% at 50% 40%, #000 35%, transparent 80%); mask-image: radial-gradient(75% 85% at 50% 40%, #000 35%, transparent 80%); }
.hero .mark { background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 22%, transparent) 62%, color-mix(in srgb, var(--accent) 22%, transparent) 92%, transparent 92%); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.hero h1 { font-size: clamp(40px, 6vw, 68px); letter-spacing: -0.035em; line-height: 1.02; }
.hero .tagline { font-size: clamp(20px, 2.4vw, 26px); font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; margin: 18px 0 0; }
.lede { font-size: 19px; color: var(--muted); max-width: 40em; margin: 20px 0 0; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.facts { display: flex; gap: 28px; padding: 0; margin: 36px 0 0; list-style: none; color: var(--muted); font-size: 14px; }
.facts b { display: block; font-size: 26px; color: var(--text); letter-spacing: -0.02em; }
.facts li + li { padding-left: 28px; border-left: 1px solid var(--line); }
.hero-code { box-shadow: 0 30px 60px -30px rgba(20, 23, 28, 0.45), 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent), 0 40px 90px -40px color-mix(in srgb, var(--accent) 45%, transparent); transform: rotate(0.6deg); }
.lights { display: inline-flex; gap: 6px; margin-right: auto; padding-right: 12px; }
.lights i { width: 10px; height: 10px; border-radius: 50%; background: #2a333d; }
.lights i:first-child { background: #ff5f57; } .lights i:nth-child(2) { background: #febc2e; } .lights i:last-child { background: #28c840; }
.hero-code figcaption { justify-content: flex-start; gap: 0; }
.hero-code .copy { margin-left: auto; }
.section-title { font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -0.025em; }
.section-lede { color: var(--muted); font-size: 17.5px; max-width: 46em; margin: 12px 0 32px; }
.band { position: relative; }
.band::before { content: ""; position: absolute; inset: 40px 0 -48px; background: var(--surface-2); z-index: -1; box-shadow: 0 0 0 100vmax var(--surface-2); clip-path: inset(0 -100vmax); }
.band + section { padding-top: 120px !important; }
.steps { list-style: none; padding: 0; margin: 0 0 36px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s; }
.steps li:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgba(20, 23, 28, 0.04), 0 16px 32px -16px rgba(20, 23, 28, 0.18); }
.steps h3 { font-size: 17px; margin: 14px 0 8px; }
.steps p { margin: 0; color: var(--muted); font-size: 15px; }
.num { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-weight: 750; font-size: 14px; }
.diagram { display: block; width: 100%; max-width: 820px; height: auto; margin: 8px auto 0; }
.diagram .node rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.diagram .node.hub rect { fill: var(--text); stroke: var(--text); }
.diagram text { text-anchor: middle; font: 650 16px var(--sans); fill: var(--text); }
.diagram .hub text { fill: var(--bg); }
.diagram text.sub { font: 500 12.5px var(--mono); fill: var(--muted); }
.diagram .hub text.sub { fill: color-mix(in srgb, var(--bg) 70%, transparent); }
.diagram text.label { font: 600 12px var(--sans); fill: var(--accent); }
.diagram .wire { fill: none; stroke: var(--accent); stroke-width: 2; }
.diagram .wire.dashed { stroke-dasharray: 6 6; stroke: var(--accent-2); animation: travel 1.6s linear infinite; }
.diagram .node.hub rect { filter: drop-shadow(0 10px 18px color-mix(in srgb, var(--accent) 30%, transparent)); }
@keyframes travel { to { stroke-dashoffset: -24; } }
.diagram .player circle { fill: var(--accent-2); }
.diagram .player text { font: 700 12px var(--sans); fill: #fff; }
.diagram .chip rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.2; }
.diagram .chip text { font: 600 12px var(--mono); }
.diagram .chip.home rect { fill: var(--accent-soft); stroke: color-mix(in srgb, var(--accent) 40%, transparent); }
.grid { display: grid; gap: 16px; }
.section-title + .grid { margin-top: 28px; }
.features { grid-template-columns: repeat(3, 1fr); }
.features article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; transition: border-color 0.2s, transform 0.2s; }
.features article:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); transform: translateY(-2px); }
.icon { display: grid; place-items: center; width: 40px; height: 40px; margin: 0 0 16px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.icon svg { width: 22px; height: 22px; }
.features h3 { font-size: 18px; margin: 0 0 8px; }
.features p { margin: 0; color: var(--muted); font-size: 15px; }
.vocab-teaser { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.chain { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 18px; margin: 0 0 28px; }
.chain code { font-size: 16px; padding: 6px 12px; background: var(--surface); }
.chain span { color: var(--accent); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 14.5px; }
.chip span { font: 600 12px var(--mono); color: var(--muted); }
.chip { transition: border-color 0.15s, background 0.15s, transform 0.15s; }
.chip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text); transform: translateY(-1px); }
.three { grid-template-columns: repeat(3, 1fr); }
.card-link { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; color: var(--text); text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
.card-link:hover { color: var(--text); border-color: var(--accent); transform: translateY(-2px); }
.card-link h3 { font-size: 18px; margin: 0 0 6px; }
.card-link .arrow { display: inline-block; color: var(--accent); transition: transform 0.15s; }
.card-link:hover .arrow { transform: translateX(4px); }
.card-link p:not(.badge) { margin: 0; color: var(--muted); font-size: 15px; }

/* Reference pages */
.page-head { margin: 0 0 40px; }
.page-head h1 { font-size: clamp(34px, 4.4vw, 48px); letter-spacing: -0.03em; }
.page-head .proposals { margin-top: 28px; }
.op { padding: 8px 0 32px; border-bottom: 1px solid var(--line); }
.op:last-child { border-bottom: 0; }
.op h3 { margin-top: 28px; font-size: 20px; }
.op h3 code { font-size: 1em; background: none; border: 0; padding: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.fields td:nth-child(2) { white-space: nowrap; font-family: var(--mono); font-size: 13px; }
.req { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--accent); }
details.example { margin: 8px 0 0; }
details.example summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent-2); margin: 0 0 12px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.schema-link { font-size: 13.5px; margin: 6px 0 0; }
.schema-link a { color: var(--muted); }
.search { position: sticky; top: 76px; z-index: 5; display: flex; align-items: center; gap: 14px; margin-top: 24px; }
.search input { flex: 1; font: inherit; font-size: 16px; padding: 13px 16px 13px 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%238a919b' stroke-width='2'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='m13 13 4 4'/%3E%3C/svg%3E") no-repeat 16px center; color: var(--text); box-shadow: var(--shadow); }
.search input:focus { outline: none; border-color: var(--accent); }
#vocab-count { color: var(--muted); font-size: 14px; white-space: nowrap; }
.domain { margin: 0 0 56px; }
.domain h2 { font-size: 26px; margin: 40px 0 8px; }
.domain > p { color: var(--muted); }
.count { font: 600 13px var(--mono); color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; vertical-align: middle; }
.meta { display: grid; gap: 6px; margin: 16px 0 20px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 14px; }
.meta div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; }
.meta dt { color: var(--muted); font-weight: 600; }
.meta dd { margin: 0; }
.terms { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.term { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.term:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.term-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.term .id { font-weight: 650; background: var(--accent-soft); border-color: transparent; color: var(--text); }
.term .label { font-weight: 600; }
.term .since { margin-left: auto; font-size: 12px; color: var(--muted); }
.term p { margin: 6px 0 0; font-size: 14.5px; color: var(--muted); }
.term .broader, .term .aliases, .term .osm { font-size: 13px; }
.aliases span { display: inline-block; margin: 0 0 0 6px; padding: 0 7px; border-radius: 6px; background: var(--surface-2); font-family: var(--mono); font-size: 12px; color: var(--text); }
.term[hidden], .domain[hidden] { display: none; }

/* Footer */
.foot { border-top: 1px solid var(--line); max-width: 1240px; margin: 0 auto; padding: 48px 24px 64px; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; font-size: 14.5px; color: var(--muted); }
.foot p { margin: 12px 0 0; max-width: 32em; }
.foot nav { display: flex; flex-direction: column; gap: 8px; }
.foot nav p { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text); }
.foot nav a { color: var(--muted); text-decoration: none; }
.foot nav a:hover { color: var(--text); }

/* Small screens */
@media (max-width: 980px) {
  main.doc { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .hero, .vocab-teaser { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .features, .three { grid-template-columns: repeat(2, 1fr); }
  .pair { grid-template-columns: minmax(0, 1fr); }
  .menu { display: inline-block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; padding: 12px 16px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .top.open .nav { display: flex; }
  .nav a { padding: 12px; font-size: 16px; }
  .theme { align-self: flex-start; margin-top: 6px; }
}

@media (max-width: 720px) {
  .bar, main, .foot { padding-left: 16px; padding-right: 16px; }
  .steps, .features, .three, .terms { grid-template-columns: minmax(0, 1fr); }
  .facts { gap: 20px; }
  .hero-code { transform: none; }
  .diagram { display: none; }
  .meta div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .foot { grid-template-columns: minmax(0, 1fr); }
  .search { top: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .diagram .wire.dashed { animation: none; }
  .diagram .player, .diagram .chip { display: none; }
}
