:root {
  --gutter: calc(clamp(16px, 3vw, 32px) + 10px);
  --badge-h: clamp(34px, 4.6vw, 50px);
  --row: #111215;
  --card-r: 20px;
  --text: rgba(255, 255, 255, 0.78);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
body.doc { background: #000; }

a { position: relative; outline: 2px solid transparent; outline-offset: 4px; }
a::after {
  content: ''; position: absolute; inset: -6px; padding: 2px; pointer-events: none;
  border-radius: calc(var(--ring-r, 3px) + 6px);
  background: linear-gradient(90deg, #1a1f70, #5900f0, #c200eb);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0; transition: opacity 0.2s ease;
}
a:focus-visible::after { opacity: 1; }

.doc-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--gutter) var(--gutter) 0;
}
.doc-logo {
  display: block; width: clamp(96px, 26vw, 132px); aspect-ratio: 429 / 165;
  -webkit-mask: url("logo-full.svg") center / 100% 100% no-repeat;
  mask: url("logo-full.svg") center / 100% 100% no-repeat;
}
.doc-logo span { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, #1a1f70, #5900f0, #c200eb); }
.doc-badge { display: block; height: var(--badge-h); border-radius: 8px; --ring-r: 8px; }
.doc-badge img { display: block; height: 100%; width: auto; }

body.doc .wrap { max-width: calc(720px + 32px); padding: 0 16px; min-height: 0; }
.article { padding: clamp(28px, 5vw, 48px) 0 0; }

.article h1 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  font-weight: 700; font-size: clamp(34px, 5vw, 44px); line-height: 1.1; letter-spacing: -0.01em;
  padding: 0 4px;
}
.article .updated { color: rgba(255, 255, 255, 0.55); font-size: 13px; margin-top: 6px; padding: 0 4px; }
.article > p:not(.updated) { color: var(--text); font-size: 16px; margin-top: 16px; padding: 0 4px; }

.group { margin-top: 34px; }

.group h2 {
  font-family: var(--mono); font-weight: 700; font-size: 11.5px; line-height: 1.4;
  letter-spacing: 0.13em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7);
  margin: 0 0 8px; padding: 0 18px;
}
.card {
  background: #000; border-radius: var(--card-r); overflow: hidden;
  display: flex; flex-direction: column; gap: 1px;
}
.card + .card { margin-top: 12px; }

.card > p, .rows > li { background: var(--row); padding: 15px 18px; }
.card p, .rows li { color: var(--text); font-size: 15.5px; line-height: 1.55; margin: 0; }
.card strong, .rows strong { color: #fff; font-weight: 600; }
.article a { color: var(--cyan); text-decoration: none; }
.article a:hover { text-decoration: underline; text-underline-offset: 3px; }

.article .rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }

.row-title { display: block; }
.row-text { display: block; margin-top: 4px; }
.row-meta {
  display: block; margin-top: 8px;
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: rgba(255, 255, 255, 0.5);
}

.links > li { padding: 0; }
.links a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px; color: #fff; --ring-r: 0px;
}
.links a::before {
  content: "\203A"; order: 2; font-size: 20px; line-height: 1;
  color: rgba(255, 255, 255, 0.3);
}
.links a:hover { text-decoration: none; background: #17181c; }

.links a::after { inset: 3px; border-radius: 6px; }

body.doc footer.site-footer {
  position: static; text-align: left;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  margin-top: 72px;
  padding: 0 var(--gutter) calc(var(--gutter) + env(safe-area-inset-bottom));
  font-size: 14px; color: rgba(255, 255, 255, 0.7);
}
.site-footer p { margin: 0; }
.ext-icon {
  display: inline-block; margin-left: 4px; font-size: 0.85em;
  font-family: -apple-system, "Segoe UI Symbol", sans-serif;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 22px; }
footer .footer-links a {
  color: rgba(255, 255, 255, 0.9); text-decoration: none;
  font-family: inherit; font-size: inherit; letter-spacing: normal;
}
footer .footer-links a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 900px) and (orientation: portrait) {
  body.doc footer.site-footer { font-size: 13px; }
  .footer-links { gap: 6px 14px; }
}

@media (max-width: 700px) {
  .article h1, .article .updated, .article > p:not(.updated) { padding: 0 calc(var(--gutter) - 16px); }
}

@media (prefers-reduced-motion: no-preference) {
  .stage-inner { transform-origin: 50% 50vh; }
  html.blinds .stage-inner { transform: scale(1.1); }
  html.blinds-go .stage-inner { animation: blinds-settle 1.45s ease-out both;    }
}
@keyframes blinds-settle { from { transform: scale(1.1); } to { transform: none; } }
.article h1:focus { outline: none; }

.to-top {
  position: fixed; z-index: 40; right: var(--gutter); bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px;
  padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: #fff;
  --ring-r: 24px;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
}
.to-top.is-shown { opacity: 1; visibility: visible; transform: none; transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s; }
html.blinds-fade .to-top, html.blinds .to-top { opacity: 0; visibility: hidden; }
.to-top-label {
  font-size: 13px; font-weight: 600; letter-spacing: 0.01em; color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}
.to-top-arrow {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: background-color 0.2s ease;
}
.to-top:hover .to-top-arrow { background: rgba(255, 255, 255, 0.16); }
.to-top svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

button.to-top { outline: 2px solid transparent; outline-offset: 4px; }
button.to-top::after {
  content: ''; position: absolute; inset: -6px; padding: 2px; pointer-events: none;
  border-radius: calc(var(--ring-r) + 6px);
  background: linear-gradient(90deg, #1a1f70, #5900f0, #c200eb);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0; transition: opacity 0.2s ease;
}
button.to-top:focus-visible::after { opacity: 1; }
