:root {
  --bg: #F7F4EF; --surface: #FFFEFC; --surface-2: #F0ECE5;
  --ink: #1A1410; --ink-2: #3A322C; --muted: #5F5650; --faint: #9A918A;
  --line: #E4DED5; --line-2: #D6CEC3;
  --brand: #FF5B2E; --brand-deep: #D9431A; --brand-soft: #FFE6DC;
  --ok: #1E9E6A; --ok-soft: #DDF3E9; --warn: #A8700E; --warn-soft: #F8EBD1; --risk: #C8402F; --risk-soft: #FBE7E3;
  --dark: #15100D; --dark-line: #2E2520;
  --f-sans: "Geist", "Segoe UI", system-ui, sans-serif; --f-mono: "Geist Mono", ui-monospace, Consolas, monospace;
  --bar-h: 64px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-h) + 20px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.7 var(--f-sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
a { color: var(--brand-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--f-mono); font-size: 12.5px; }
.skip { position: fixed; left: 8px; top: 8px; z-index: 100; padding: 8px 12px; background: var(--ink); color: #fff; border-radius: 8px; transform: translateY(-150%); }
.skip:focus { transform: none; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* bar */
.bar { position: sticky; top: 0; z-index: 30; height: var(--bar-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 clamp(16px, 3vw, 32px); background: rgba(247,244,239,.9); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__mark { width: 30px; height: 30px; display: block; flex: none; }
.brand__mark svg { width: 100%; height: 100%; display: block; }
.brand__word { font-weight: 700; font-size: 21px; letter-spacing: -.04em; }
.brand__tag { padding: 2px 9px; border: 1px dashed var(--line-2); border-radius: 999px; color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: .14em; }
.bar__links { display: flex; align-items: center; gap: 18px; }
.bar__links > a:not(.btn) { color: var(--muted); font-size: 14.5px; }
.bar__links > a:not(.btn):hover { color: var(--ink); text-decoration: none; }
.btn { display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.btn--lime { background: var(--ink); color: #fff; }
.btn--lime:hover { background: #000; text-decoration: none; }
.toc-toggle { display: none; height: 38px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); font-size: 14px; }

/* layout */
.layout { display: grid; grid-template-columns: 230px minmax(0, 760px); gap: clamp(32px, 5vw, 72px); max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px); }
.toc { position: sticky; top: var(--bar-h); align-self: start; max-height: calc(100vh - var(--bar-h)); overflow: auto; padding: 32px 0 40px; display: grid; gap: 2px; }
.toc__title { margin: 18px 0 6px; color: var(--faint); text-transform: uppercase; letter-spacing: .14em; font-size: 10.5px; }
.toc__title:first-child { margin-top: 0; }
.toc a { display: block; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 14.5px; transition: color .2s, background .2s; }
.toc a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.toc a.is-active { color: var(--ink); background: var(--surface); box-shadow: inset 3px 0 0 var(--brand); font-weight: 500; }

.content { padding: 40px 0 80px; min-width: 0; }
.content section { padding: 40px 0; border-bottom: 1px solid var(--line); display: grid; gap: 16px; }
.content section:first-child { padding-top: 8px; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .2em; font-size: 11.5px; }
h1 { font-size: clamp(38px, 6vw, 60px); font-weight: 700; letter-spacing: -.05em; line-height: 1.02; }
h2 { font-size: clamp(26px, 3.4vw, 34px); font-weight: 700; letter-spacing: -.04em; line-height: 1.1; display: flex; align-items: baseline; gap: 12px; }
h2 .mono { color: var(--brand-deep); font-size: 12.5px; font-weight: 400; letter-spacing: 0; }
h3 { font-size: 18px; font-weight: 700; letter-spacing: -.02em; margin-top: 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
p { color: var(--muted); }
p b, li b, td b { color: var(--ink); font-weight: 600; }
em { color: var(--ink); font-style: normal; background: linear-gradient(transparent 62%, var(--brand-soft) 62%); }
.lead { font-size: 19px; line-height: 1.6; color: var(--ink-2); }
.muted { color: var(--faint); font-size: 14.5px; }
code { font-family: var(--f-mono); font-size: 13px; color: var(--ink); background: var(--surface-2); border-radius: 6px; padding: 1px 6px; overflow-wrap: anywhere; }
.kbd { display: inline-block; font-size: 13px; font-weight: 500; color: var(--ink); padding: 0 7px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); line-height: 1.6; }

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.facts div { padding: 14px 16px; display: grid; gap: 2px; }
.facts div + div { border-left: 1px solid var(--line); }
.facts span { color: var(--faint); text-transform: uppercase; letter-spacing: .12em; font-size: 10.5px; }
.facts b { font-weight: 600; }

.callout { position: relative; padding: 16px 18px; border-radius: 14px; background: var(--brand-soft); color: var(--ink-2); font-size: 15px; }
.callout b { color: var(--ink); font-weight: 600; }
.callout--tip { background: var(--ok-soft); }

.steps { counter-reset: s; list-style: none; padding: 0; display: grid; gap: 8px; }
.steps li { counter-increment: s; position: relative; padding: 14px 16px 14px 56px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--muted); }
.steps li::before { content: counter(s); position: absolute; left: 16px; top: 14px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; font-family: var(--f-mono); font-size: 12px; line-height: 1; }
.list { padding-left: 0; list-style: none; display: grid; gap: 10px; }
.list li { position: relative; padding-left: 22px; color: var(--muted); }
.list li::before { content: ""; position: absolute; left: 3px; top: .62em; width: 8px; height: 8px; background: var(--brand); border-radius: 2px; transform: rotate(45deg); }

.table { width: 100%; border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.table tbody, .table thead { display: table; width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child th, .table tr:last-child td { border-bottom: 0; }
.table th { color: var(--faint); font-weight: 400; font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; white-space: nowrap; font-family: var(--f-mono); }
.table tbody th { width: 34%; }
.table td { color: var(--muted); }
.table thead th { background: var(--surface-2); }
.table--cmd td:first-child { width: 42%; }

.stages { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.stages div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 16px; padding: 14px 16px; }
.stages div + div { border-top: 1px solid var(--line); }
.stages dt { color: var(--brand-deep); padding-top: 2px; }
.stages dd { color: var(--muted); font-size: 15px; }

.ca { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: var(--dark); }
.ca code { flex: 1; min-width: 0; background: none; padding: 0; font-size: 13.5px; color: #fff; }
.copy { color: #fff; background: var(--brand); border-radius: 999px; padding: 4px 12px; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; flex: none; }
.copy:hover { background: var(--brand-deep); }

.code { border-radius: 14px; background: var(--dark); overflow: hidden; }
.code__bar { display: flex; justify-content: space-between; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--dark-line); color: #8E8279; text-transform: uppercase; letter-spacing: .1em; font-size: 10.5px; }
.code__bar .copy { padding: 2px 10px; }
.code pre { margin: 0; padding: 16px; overflow-x: auto; }
.code pre code { background: none; border: 0; padding: 0; font-size: 12.5px; line-height: 1.7; white-space: pre; overflow-wrap: normal; color: #EDE4DC; }
.method { padding: 2px 8px; border-radius: 6px; background: var(--ok); color: #fff; font-size: 11px; }

details { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
details + details { margin-top: -8px; }
summary { cursor: pointer; padding: 14px 16px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--brand-deep); font-family: var(--f-mono); }
details[open] summary::after { content: "−"; }
details p { padding: 0 16px 16px; font-size: 15px; }

.st { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); }
.st--pending { color: var(--warn); background: var(--warn-soft); }
.st--success { color: var(--ok); background: var(--ok-soft); }
.st--failed { color: var(--risk); background: var(--risk-soft); }

.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-top: 28px; color: var(--faint); }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .toc { position: fixed; top: var(--bar-h); left: 0; right: 0; bottom: 0; z-index: 25; max-height: none; padding: 20px clamp(16px, 3vw, 32px) 40px; background: var(--bg); display: none; }
  .toc.is-open { display: grid; align-content: start; }
  .toc-toggle { display: inline-flex; align-items: center; }
  .bar__links > a:not(.btn) { display: none; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts div:nth-child(3) { border-left: 0; }
  .facts div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .brand__word { display: none; }
  .stages div { grid-template-columns: 1fr; gap: 4px; }
  .table--cmd td:first-child { width: auto; }
  .lead { font-size: 17px; }
}
