:root {
  --brand-900: #0B3B2C; --brand-700: #0E7A4B; --brand-600: #13955C; --brand-500: #22B36F; --brand-100: #E3F6EC; --brand-50: #F1FBF5;
  --sun: #F5B400;
  --ink: #17191E; --ink-2: #3A3F4A; --ink-3: #5F6673; --ink-4: #9AA1AD;
  --line: rgba(23, 25, 30, 0.08);
  --page: #FAFAF7; --card: #FFFFFF; --sunken: #F3F5F8;
  --link: var(--brand-700);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F2F4F1; --ink-2: #D3D8D4; --ink-3: #A3ABA6; --ink-4: #737B76;
    --line: rgba(255, 255, 255, 0.09);
    --page: #0C1411; --card: #121C18; --sunken: #17221D;
    --brand-100: #15392A; --brand-50: #10261C; --link: #4CD18F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #F2F4F1; --ink-2: #D3D8D4; --ink-3: #A3ABA6; --ink-4: #737B76;
  --line: rgba(255, 255, 255, 0.09);
  --page: #0C1411; --card: #121C18; --sunken: #17221D;
  --brand-100: #15392A; --brand-50: #10261C; --link: #4CD18F;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 400 17px/1.65 "Instrument Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100dvh; display: flex; flex-direction: column;
}
main { flex: 1; width: 100%; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img { display: block; }

/* Floating bar */
.bar {
  position: sticky; top: 12px; z-index: 10; margin: 12px auto 0; width: min(1080px, calc(100% - 24px));
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 8px 8px 8px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--card) 82%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 0 0 1px var(--line), 0 10px 30px -18px rgba(11, 59, 44, 0.35);
}
.mark { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }
.mark img { border-radius: 8px; }
.links { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.links::-webkit-scrollbar { display: none; }
.links a {
  white-space: nowrap; padding: 8px 14px; border-radius: 999px; font-size: 15px; font-weight: 500; color: var(--ink-3); text-decoration: none;
  transition: background-color 300ms var(--ease), color 300ms var(--ease);
}
.links a:hover { color: var(--ink); background: var(--sunken); }
.links a[aria-current="page"] { color: var(--brand-700); background: var(--brand-100); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .links a[aria-current="page"] { color: #6FE0A6; } }

.eyebrow {
  display: inline-block; margin: 0 0 14px; padding: 4px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--brand-700); background: var(--brand-100);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .eyebrow { color: #6FE0A6; } }

/* Document pages */
.doc-head { width: min(1080px, calc(100% - 32px)); margin: 72px auto 40px; }
.doc-head h1 { margin: 0; font-size: clamp(34px, 6vw, 60px); line-height: 1.04; letter-spacing: -0.035em; font-weight: 700; max-width: 16ch; }
.lede { margin: 18px 0 0; max-width: 60ch; font-size: 19px; color: var(--ink-2); }
.meta { margin: 16px 0 0; font-size: 14px; color: var(--ink-4); }

.doc { width: min(1080px, calc(100% - 32px)); margin: 0 auto 96px; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 56px; align-items: start; }
.doc.no-toc { grid-template-columns: minmax(0, 1fr); max-width: 760px; margin-left: max(16px, calc((100% - 1080px) / 2)); }
.toc { position: sticky; top: 96px; font-size: 14px; }
.toc .eyebrow { margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: t; }
.toc li { counter-increment: t; }
.toc a { display: flex; gap: 10px; padding: 6px 0; color: var(--ink-3); text-decoration: none; line-height: 1.35; transition: color 250ms var(--ease); }
.toc a::before { content: counter(t, decimal-leading-zero); color: var(--ink-4); font-variant-numeric: tabular-nums; font-size: 12px; padding-top: 1px; }
.toc a:hover { color: var(--ink); }

.prose {
  background: var(--card); border-radius: 28px; padding: clamp(24px, 5vw, 56px);
  box-shadow: 0 0 0 1px var(--line), 0 30px 60px -40px rgba(11, 59, 44, 0.25);
  max-width: 760px;
}
.prose > :first-child { margin-top: 0; }
.prose h2 { margin: 52px 0 12px; font-size: 24px; line-height: 1.25; letter-spacing: -0.02em; font-weight: 650; }
.prose h3 { margin: 28px 0 6px; font-size: 18px; font-weight: 600; }
.prose p, .prose li { color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--brand-600); }
.prose table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 15px; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 600; color: var(--ink); font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.note { margin: 20px 0; padding: 16px 18px; border-radius: 16px; background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand-100); color: var(--ink-2); }
.note p { margin: 0; }
.contact { list-style: none; padding: 0 !important; margin: 14px 0; }
.contact li { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line); }
.contact li:last-child { border-bottom: 0; }
.steps { counter-reset: s; list-style: none; padding: 0 !important; }
.steps li { counter-increment: s; position: relative; padding: 4px 0 14px 44px; margin: 0; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 2px; width: 30px; height: 30px; border-radius: 999px;
  display: grid; place-items: center; font-size: 14px; font-weight: 600; color: var(--brand-700); background: var(--brand-100);
}

/* Home and simple pages */
.hero { width: min(1080px, calc(100% - 32px)); margin: 88px auto 0; }
.hero h1 { margin: 0; font-size: clamp(40px, 8vw, 88px); line-height: 0.98; letter-spacing: -0.045em; font-weight: 700; max-width: 12ch; }
.hero h1 em { font-style: normal; color: var(--brand-600); }
.hero p { margin: 22px 0 0; max-width: 54ch; font-size: 19px; color: var(--ink-2); }
.grid { width: min(1080px, calc(100% - 32px)); margin: 56px auto 104px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.shell { border-radius: 30px; padding: 6px; background: color-mix(in srgb, var(--brand-900) 5%, transparent); box-shadow: 0 0 0 1px var(--line); }
.core {
  height: 100%; display: flex; flex-direction: column; gap: 10px; padding: 26px; border-radius: 24px; background: var(--card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 20px 40px -32px rgba(11, 59, 44, 0.4); text-decoration: none; color: var(--ink);
  transition: transform 500ms var(--ease), box-shadow 500ms var(--ease);
}
a.core:hover { transform: translateY(-3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 30px 50px -30px rgba(11, 59, 44, 0.45); }
a.core:active { transform: scale(0.985); }
.core h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; font-weight: 650; }
.core p { margin: 0; color: var(--ink-3); font-size: 15px; }
.core .go { margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; color: var(--brand-700); }
.core .go i {
  width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; background: var(--brand-100); font-style: normal;
  transition: transform 500ms var(--ease);
}
a.core:hover .go i { transform: translate(3px, -1px) scale(1.06); }
.span-3 { grid-column: span 3; } .span-2 { grid-column: span 2; } .span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; }
.core.dark { background: var(--brand-900); color: #fff; }
.core.dark p { color: rgba(255, 255, 255, 0.72); }
.core.dark .go { color: #8BE8B6; }
.core.dark .go i { background: rgba(255, 255, 255, 0.1); }
.apps { display: flex; gap: 14px; align-items: center; margin-top: 6px; }
.apps img { border-radius: 14px; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.4); }

.center { width: min(560px, calc(100% - 32px)); margin: 96px auto 120px; text-align: center; }
.center img { margin: 0 auto 26px; border-radius: 22px; box-shadow: 0 20px 40px -20px rgba(11, 59, 44, 0.5); }
.center h1 { margin: 0; font-size: clamp(30px, 6vw, 44px); line-height: 1.08; letter-spacing: -0.03em; }
.center p { color: var(--ink-2); font-size: 18px; }

/* Footer */
.foot { border-top: 1px solid var(--line); }
.foot-in { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 40px; display: flex; flex-wrap: wrap; gap: 14px 28px; justify-content: space-between; font-size: 14px; color: var(--ink-3); }
.foot p { margin: 0; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot a { color: var(--ink-3); text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* Entry motion */
.rise { animation: rise 900ms var(--ease) both; }
.prose.rise { animation-delay: 90ms; }
.grid > * { animation: rise 900ms var(--ease) both; }
.grid > *:nth-child(2) { animation-delay: 70ms; } .grid > *:nth-child(3) { animation-delay: 140ms; }
.grid > *:nth-child(4) { animation-delay: 210ms; } .grid > *:nth-child(5) { animation-delay: 280ms; } .grid > *:nth-child(6) { animation-delay: 350ms; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }

@media (max-width: 860px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .doc.no-toc { margin-left: auto; }
  .toc { position: static; background: var(--card); border-radius: 20px; padding: 18px 20px; box-shadow: 0 0 0 1px var(--line); }
  .grid { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-4, .span-6 { grid-column: span 1; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .bar { top: 8px; margin-top: 8px; width: calc(100% - 16px); }
  .mark span { display: none; }
  .links a { padding: 8px 11px; font-size: 14px; }
  .doc-head { margin-top: 44px; }
  .prose { border-radius: 22px; }
  .hero { margin-top: 56px; }
}
