/* Disjoncto Docs — "Read" mode on top of site.css (see DESIGN.md).
   Paper reading surface, graphite header, one living colour (amber) for current/active.
   Elevation: fine neutral border OR soft shadow, never both. No coloured side borders, no gradients. */

:root { --head: 64px; --side: 264px; --tocw: 220px; --dur: 200ms; --tx: cubic-bezier(.2, .8, .2, 1); }
html { scroll-padding-top: calc(var(--head) + 20px); overflow-x: hidden; }
body.docs { background: var(--paper); overflow-x: hidden; }
body.docs.lock { overflow: hidden; }

/* ---------- Header ---------- */
.docs .top .bar { display: flex; align-items: center; gap: 12px; height: var(--head); padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-left)); }
.docs .brand { font-size: 19px; gap: 10px; color: #f5f3ee; flex: none; transform-origin: left center; transition: transform 260ms var(--tx); }
.docs .brand img { width: 32px; height: 32px; border-radius: 0; transition: transform 260ms var(--tx); }
.docs .brand:hover img { transform: rotate(-6deg); }
.docs .top.scrolled .brand { transform: scale(.93); }
.docs-tag { position: relative; font-family: "Plex Mono", monospace; font-size: 12.5px; font-weight: 500; letter-spacing: 0; color: var(--ink-d2); padding: 3px 8px; border: 1px solid var(--line-d); border-radius: 6px; margin-left: -2px; text-decoration: none; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.docs-tag:hover, .docs-tag[aria-current="page"] { color: #f5f3ee; border-color: var(--ink-d2); }
/* Living header: fixed 64 px box, only opacity/transform change on scroll (shadow layer + brand scale). */
.docs .top { background: rgba(20, 23, 28, .78); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px); border-bottom-color: rgba(255, 255, 255, .06); }
.docs .top::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: rgba(20, 23, 28, .16); box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .55); opacity: 0; transition: opacity 320ms var(--tx); }
.docs .top.scrolled::after { opacity: 1; }
.docs .top .bar { position: relative; z-index: 1; }
/* Animated underline for text links in the chrome (transform only). */
.u-link { position: relative; text-decoration: none; }
.u-link::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1.5px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform 240ms var(--tx); }
.u-link:hover::after, .u-link:focus-visible::after { transform: scaleX(1); transform-origin: left; }
.docs .top .grow { flex: 1; min-width: 0; }
.search-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; min-width: 40px; padding: 0 10px 0 12px; border-radius: var(--r10); border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .04); color: var(--ink-d2); font: inherit; font-size: 15px; cursor: pointer; transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.search-btn:hover { border-color: rgba(255, 255, 255, .34); color: var(--paper); }
.search-btn span { min-width: 120px; text-align: left; }
.search-btn kbd { font-size: 12px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-d); color: var(--ink-d2); background: transparent; }
.side-btn { display: none; min-width: 44px; min-height: 44px; margin-left: -6px; align-items: center; justify-content: center; border-radius: var(--r10); border: 0; background: transparent; color: var(--paper); cursor: pointer; }
.side-btn:hover { background: rgba(255, 255, 255, .06); }

/* Language picker with SVG flags. Animated dropdown (open AND close): opacity/transform only, 200 ms. */
.flag { width: 20px; height: 15px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); }
.docs .lang > button { gap: 8px; padding: 0 10px 0 10px; min-height: 40px; }
.docs .lang > button .chev { opacity: .7; transition: transform 200ms var(--tx); }
.docs .lang.open > button .chev { transform: rotate(180deg); }
.docs .lang ul { min-width: 220px; padding: 6px; }
.docs .lang li a { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; padding: 9px 10px; min-height: 42px; }
.docs .lang li a .ln { font-size: 15px; }
.docs .lang li a .lc { font-family: "Plex Mono", monospace; font-size: 12.5px; color: var(--ink-d2); }
.docs .lang li a[aria-current="true"] { background: var(--slate-2); }
.docs .lang li a[aria-current="true"]::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); margin-left: 6px; }
.docs .lang li a[aria-current="true"] { grid-template-columns: 20px 1fr auto auto; }
.lang ul { display: block; opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.97); transform-origin: top right; pointer-events: none;
  transition: opacity 160ms var(--tx), transform 160ms var(--tx), visibility 0s linear 160ms; }
.lang.open ul { opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition: opacity 220ms var(--tx), transform 220ms var(--tx), visibility 0s; }
.lang.up ul { bottom: calc(100% + 8px); top: auto; right: 0; left: auto; transform-origin: bottom right; transform: translateY(8px) scale(.97); }
.lang.up.open ul { transform: none; }
.lang li a { position: relative; overflow: hidden; }
.lang li a:hover { background: var(--slate-2); }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: var(--side) minmax(0, 1fr) var(--tocw); gap: 0 clamp(24px, 3vw, 48px); max-width: 1440px; margin: 0 auto; padding: 0 clamp(16px, 2.5vw, 32px); align-items: start; }
.layout.is-home { grid-template-columns: var(--side) minmax(0, 1fr); }
.main { min-width: 0; padding: clamp(28px, 4vw, 56px) 0 64px; }
.doc { max-width: var(--measure); }
.is-home .doc { max-width: 920px; }

/* Sidebar */
.side { position: sticky; top: var(--head); max-height: calc(100vh - var(--head)); max-height: calc(100dvh - var(--head)); overflow-y: auto; overscroll-behavior: contain; padding: 28px 8px 40px 0; scrollbar-width: thin; }
.side .grp { margin-bottom: 22px; }
.side h2 { font-size: 12.5px; font-stretch: 108%; letter-spacing: .04em; text-transform: uppercase; font-weight: 640; color: var(--ink-2); margin: 0 0 6px 12px; line-height: 1.4; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side a { display: block; padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 15.5px; line-height: 1.35; transition: background var(--dur) var(--ease); }
.side a:hover { background: var(--paper-2); }
.side a[aria-current="page"] { background: var(--graphite); color: var(--paper); font-weight: 600; }
.scrim { display: none; }

/* On-page TOC */
.toc { position: sticky; top: var(--head); padding: 56px 0 40px; font-size: 14px; max-height: calc(100vh - var(--head)); overflow-y: auto; }
.toc h2 { font-size: 12.5px; font-stretch: 108%; letter-spacing: .04em; text-transform: uppercase; font-weight: 640; color: var(--ink-2); margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-l); }
.toc a { display: block; padding: 7px 0; text-decoration: none; color: var(--ink-2); line-height: 1.35; border-bottom: 1px solid var(--line-l); transition: color var(--dur) var(--ease); }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--ink); font-weight: 600; }
.toc a.on::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); margin: 0 8px 2px 0; vertical-align: middle; }

/* ---------- Article ---------- */
.doc-head { margin-bottom: 28px; }
.kicker { font-size: 13.5px; font-weight: 620; color: var(--amber-text); margin: 0 0 12px; letter-spacing: .01em; }
.doc-head h1 { font-size: clamp(34px, 4.4vw, 52px); line-height: 1.05; }
.doc-head .lead { margin-top: 16px; max-width: 62ch; }
.doc-body { font-size: 17.5px; line-height: 1.7; max-width: none; }
.doc-body > :first-child { margin-top: 0; }
.doc-body h2 { font-size: clamp(24px, 2.6vw, 30px); margin: 2em 0 .55em; line-height: 1.15; }
.doc-body h3 { font-size: 20px; margin: 1.6em 0 .45em; }
.doc-body p, .doc-body li { text-wrap: pretty; }
.doc-body a { color: var(--ink); text-decoration-color: rgba(154, 98, 0, .55); }
.doc-body a:hover { text-decoration-color: var(--amber); }
.anchor { margin-left: .35em; font-weight: 400; color: var(--line-l); text-decoration: none !important; opacity: 0; transition: opacity var(--dur) var(--ease); }
h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
.anchor:hover { color: var(--amber-text); }
kbd { display: inline-block; min-width: 1.7em; padding: .05em .45em; margin: 0 .08em; font-size: .82em; line-height: 1.5; text-align: center; border: 1px solid var(--line-l); border-bottom-width: 2px; border-radius: 6px; background: var(--white); color: var(--ink); font-weight: 500; white-space: nowrap; vertical-align: .05em; }
.mono { font-size: .92em; }
.soon { display: inline-block; font-size: 12.5px; font-weight: 620; line-height: 1.5; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-l); color: var(--ink-2); background: var(--white); vertical-align: .12em; white-space: nowrap; letter-spacing: .01em; }

/* Callout: fine neutral border, no coloured side. */
.callout { border: 1px solid var(--line-l); background: var(--white); border-radius: var(--r14); padding: 16px 20px; margin: 1.6em 0; font-size: 16.5px; line-height: 1.6; }
.callout p { margin: 0; }
.callout p + p { margin-top: .6em; }
.callout b { font-weight: 640; }

/* Steps on home */
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; border-top: 1px solid var(--line-l); }
.steps li { counter-increment: s; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 0 12px; padding: 14px 0; border-bottom: 1px solid var(--line-l); margin: 0; }
.steps li::before { content: counter(s); font-family: "Plex Mono", monospace; font-size: 14px; color: var(--amber-text); padding-top: 3px; grid-row: span 2; }
.steps li b { font-weight: 640; }

/* Tables */
.tbl { overflow-x: auto; margin: 1.2em 0 1.6em; border: 1px solid var(--line-l); border-radius: var(--r10); background: var(--white); -webkit-overflow-scrolling: touch; }
.tbl table { margin: 0; font-size: 15.5px; min-width: 100%; }
.doc-body .tbl th, .doc-body .tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line-l); }
.doc-body .tbl tr:last-child td { border-bottom: 0; }
.doc-body .tbl th { background: var(--paper-2); font-size: 14px; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.num, th.num { text-align: right !important; }
.kbd-table td.keys { white-space: nowrap; width: 1%; }
.kbd-table .or { color: var(--ink-2); font-size: 13px; padding: 0 2px; }
.prices-table td:first-child { white-space: nowrap; }

/* Rules */
.rules-list { list-style: none; padding: 0; margin: 1.2em 0; counter-reset: r; }
.rules-list > li { counter-increment: r; border-top: 1px solid var(--line-l); padding: 18px 0 8px; margin: 0; }
.rules-list > li:last-child { border-bottom: 1px solid var(--line-l); }
.rules-list .rh { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13.5px; }
.rules-list .rh::before { content: counter(r, decimal-leading-zero); font-family: "Plex Mono", monospace; color: var(--ink-2); }
.rules-list .ref { color: var(--ink); background: var(--paper-2); padding: 1px 8px; border-radius: 6px; }
.rules-list .sev { color: var(--ink-2); font-weight: 600; }
.rules-list h3 { margin: 8px 0 6px !important; font-size: 19px; }
.rules-list .rd > :last-child { margin-bottom: .6em; }

/* Figures: tablet-faithful screenshots */
.shot { margin: 1.8em 0 2em; }
.shot img { width: 100%; height: auto; border-radius: var(--r14); box-shadow: 0 22px 44px -26px rgba(27, 31, 37, .45), 0 2px 6px rgba(27, 31, 37, .06); background: var(--paper-2); }
.shot figcaption { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); margin-top: 12px; max-width: 62ch; }
.shot.pair .duo { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.shot.pair .duo > div { position: relative; }
.shot .tag { position: absolute; left: 10px; top: 10px; font-size: 12.5px; font-weight: 620; padding: 2px 9px; border-radius: 999px; background: rgba(20, 23, 28, .82); color: var(--paper); }
@media (min-width: 1240px) { .doc .shot:not(.pair) { margin-right: -6ch; } }

/* Home */
.hero-draw { margin: 0 0 8px; border: 1px solid var(--line-l); border-radius: var(--r14); background: var(--white); padding: clamp(12px, 3vw, 28px); }
.hero-draw svg { width: 100%; height: auto; }
.hero-draw .grid path { stroke: rgba(91, 98, 112, .10); stroke-width: 1; }
.hero-draw .walls path { stroke: var(--ink); stroke-dasharray: 1; stroke-dashoffset: 1; animation: dj-wall 9s var(--ease) infinite; }
.hero-draw .walls path + path { animation-delay: .25s; }
.hero-draw .cable path { stroke-width: 2.2; stroke-dasharray: 1; stroke-dashoffset: 1; animation: dj-cable 9s var(--ease) infinite; }
.hero-draw .cable .c1 { stroke: var(--copper); animation-delay: .1s; }
.hero-draw .cable .c2 { stroke: #4a93c9; animation-delay: .35s; }
.hero-draw .cable .c3 { stroke: #2e9c8f; animation-delay: .6s; }
.hero-draw .p { fill: var(--white); stroke: var(--ink); stroke-width: 1.8; opacity: 0; animation: dj-pt 9s var(--ease) infinite; }
.hero-draw .p2 { animation-delay: .1s; } .hero-draw .p3 { animation-delay: .2s; } .hero-draw .p4 { animation-delay: .3s; }
.hero-draw .board { fill: var(--amber); opacity: 0; animation: dj-pt 9s var(--ease) infinite; animation-delay: -.3s; }
@keyframes dj-wall { 0% { stroke-dashoffset: 1; } 22%, 88% { stroke-dashoffset: 0; opacity: 1; } 96% { opacity: 0; stroke-dashoffset: 0; } 100% { opacity: 0; stroke-dashoffset: 1; } }
@keyframes dj-pt { 0%, 24% { opacity: 0; } 32%, 88% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes dj-cable { 0%, 34% { stroke-dashoffset: 1; opacity: 1; } 60%, 88% { stroke-dashoffset: 0; opacity: 1; } 96% { opacity: 0; stroke-dashoffset: 0; } 100% { opacity: 0; stroke-dashoffset: 1; } }
@media (prefers-reduced-motion: reduce) {
  .hero-draw .walls path, .hero-draw .cable path { animation: none; stroke-dashoffset: 0; }
  .hero-draw .p, .hero-draw .board { animation: none; opacity: 1; }
}
.cards { margin-top: 2.4em; }
.cards h2 { font-size: 22px !important; margin: 0 0 .6em !important; }
.cards ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cards li { margin: 0; }
.cards a { display: block; height: 100%; padding: 16px 18px 18px; border: 1px solid var(--line-l); border-radius: var(--r14); background: var(--white); text-decoration: none; transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.cards a:hover { border-color: var(--ink-2); transform: translateY(-1px); }
.cards b { display: block; font-size: 17.5px; font-weight: 640; font-stretch: 106%; margin-bottom: 4px; }
.cards span { display: block; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.big-link { font-size: clamp(22px, 3vw, 30px); font-weight: 640; font-stretch: 110%; }

/* Prev / next */
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line-l); }
.pn a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line-l); border-radius: var(--r14); text-decoration: none; font-weight: 600; min-height: 64px; transition: border-color var(--dur) var(--ease); min-width: 0; }
.pn a:hover { border-color: var(--ink-2); }
.pn a span { min-width: 0; overflow-wrap: anywhere; }
.pn small { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.pn .next { justify-content: flex-end; text-align: right; grid-column: 2; }
.pn svg { flex: none; color: var(--amber-text); }

/* ---------- Search dialog (animated open/close) ---------- */
.search { position: fixed; inset: 0; z-index: 80; background: rgba(20, 23, 28, .48); display: flex; justify-content: center; align-items: flex-start; padding: max(12px, 9vh) 16px 16px;
  opacity: 0; visibility: hidden; transition: opacity 180ms var(--ease), visibility 0s linear 180ms; }
.search.open { opacity: 1; visibility: visible; transition: opacity 200ms var(--ease), visibility 0s; }
.search-box { width: 100%; max-width: 640px; max-height: min(640px, 82vh); display: flex; flex-direction: column; background: var(--white); border-radius: var(--r14); box-shadow: 0 30px 70px rgba(0, 0, 0, .35); overflow: hidden;
  transform: translateY(-8px) scale(.985); transition: transform 200ms var(--ease); }
.search.open .search-box { transform: none; }
.search-field { display: flex; align-items: center; gap: 10px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--line-l); color: var(--ink-2); }
.search-field input { flex: 1; min-width: 0; font: inherit; font-size: 17px; min-height: 56px; border: 0; outline: 0; background: transparent; color: var(--ink); -webkit-appearance: none; appearance: none; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-close { border: 0; background: transparent; cursor: pointer; padding: 8px; min-height: 44px; }
.results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; overscroll-behavior: contain; }
.results li { margin: 0; }
.results a { display: block; padding: 10px 12px; border-radius: var(--r10); text-decoration: none; color: var(--ink); }
.results a[aria-selected="true"], .results a:hover { background: var(--paper-2); }
.results .rt { font-weight: 620; font-size: 16px; }
.results .rg { font-size: 12.5px; color: var(--ink-2); margin-left: 6px; font-weight: 500; }
.results .rx { display: block; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.results mark { background: rgba(255, 176, 32, .32); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-empty { margin: 0; padding: 18px 18px 8px; color: var(--ink-2); font-size: 15.5px; }
.search-hint { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line-l); font-size: 13px; color: var(--ink-2); }

/* Cookie banner: animated show/hide */
.docs .cookies { display: block; opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity 200ms var(--ease), transform 200ms var(--ease), visibility 0s linear 200ms; }
.docs .cookies.show { opacity: 1; visibility: visible; transform: none; transition: opacity 220ms var(--ease), transform 220ms var(--ease), visibility 0s; }

/* Footer */
.docs .foot { font-size: 14px; }
.docs .foot .legal { padding-top: 24px; padding-bottom: calc(28px + env(safe-area-inset-bottom)); max-width: 1440px; border-top: 0; }
.docs .foot .links { display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 1239px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); --side: 240px; }
  .toc { display: none; }
}
@media (max-width: 899px) {
  .layout, .layout.is-home { display: block; padding: 0 16px; }
  .side-btn { display: inline-flex; }
  .side { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(320px, 86vw); max-height: none; height: 100%; background: var(--paper); padding: calc(16px + env(safe-area-inset-top)) 12px 32px 16px; box-shadow: 0 0 60px rgba(0, 0, 0, .3);
    transform: translateX(-104%); visibility: hidden; transition: transform 240ms var(--ease), visibility 0s linear 240ms; }
  .side.open { transform: none; visibility: visible; transition: transform 240ms var(--ease), visibility 0s; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(20, 23, 28, .45); opacity: 0; visibility: hidden; transition: opacity 200ms var(--ease), visibility 0s linear 200ms; }
  .scrim.open { opacity: 1; visibility: visible; transition: opacity 220ms var(--ease), visibility 0s; }
  .open-app { display: none !important; }
  .main { padding-top: 28px; }
}
@media (max-width: 560px) {
  .search-btn span, .search-btn kbd { display: none; }
  .search-btn { padding: 0; justify-content: center; width: 44px; min-height: 44px; }
  .docs-tag { display: none; }
  .docs .lang > button { min-height: 44px; padding: 0 10px; }
  .doc-body { font-size: 17px; }
  .cards ul { grid-template-columns: 1fr; }
  .shot.pair .duo { grid-template-columns: 1fr; }
  .pn { grid-template-columns: 1fr; }
  .pn .next { grid-column: 1; }
  .doc-body .tbl th, .doc-body .tbl td { padding: 9px 10px; }
  .tbl table { font-size: 14.5px; }
  .kbd-table td.keys { white-space: normal; }
  .search { padding: 8px; align-items: stretch; }
  .search-box { max-height: none; }
  .docs .foot .legal { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 360px) {
  .docs .brand { font-size: 17px; }
  .docs .top .bar { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .lang ul, .lang.open ul, .search, .search.open, .search-box, .side, .side.open, .scrim, .scrim.open, .docs .cookies, .docs .cookies.show, .cards a, .anchor { transition-duration: 1ms !important; transition-delay: 0s !important; }
  .cards a:hover { transform: none; }
}


/* ---------- Footer ---------- */
.docs .foot { background: var(--paper-2); border-top: 1px solid var(--line-l); }
.docs .foot .legal { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px 40px; padding-top: 40px; padding-bottom: calc(32px + env(safe-area-inset-bottom)); max-width: 1440px; border-top: 0; align-items: start; }
.foot-brand a { display: inline-flex; align-items: center; gap: 10px; font-weight: 680; font-stretch: 112%; font-size: 19px; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); }
.foot-brand img { width: 28px; height: 28px; }
.foot-brand .sym-d { display: none; }
.foot-brand p { margin: 10px 0 0; font-size: 14px; color: var(--ink-2); max-width: 52ch; line-height: 1.5; }
.docs .foot .links { display: flex; flex-wrap: wrap; gap: 8px 22px; align-content: start; padding-top: 6px; }
.docs .foot .links a { position: relative; text-decoration: none; color: var(--ink); font-size: 14.5px; line-height: 1.5; padding: 2px 0; }
.docs .foot .links a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px; background: var(--amber-text); transform: scaleX(0); transform-origin: right; transition: transform 240ms var(--tx); }
.docs .foot .links a:hover::after, .docs .foot .links a:focus-visible::after { transform: scaleX(1); transform-origin: left; }
.foot-end { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line-l); padding-top: 18px; margin-top: 8px; }
.foot-end .rights { font-size: 13.5px; color: var(--ink-2); }
.docs .foot .lang > button { border-color: var(--line-l); color: var(--ink); background: var(--white); }

/* ---------- FAQ ---------- */
.faq { border-top: 1px solid var(--line-l); margin: .4em 0 1.6em; }
.qa { border-bottom: 1px solid var(--line-l); }
.qa summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; font-weight: 640; font-stretch: 106%; font-size: 18px; line-height: 1.35; color: var(--ink); }
.qa summary::-webkit-details-marker { display: none; }
.qa summary svg { flex: none; color: var(--ink-2); transition: transform 240ms var(--tx); }
.qa[open] summary svg { transform: rotate(180deg); }
.qa summary:hover { color: var(--amber-text); }
.qa-a { padding: 0 0 18px; font-size: 16.5px; line-height: 1.65; color: var(--ink); max-width: 64ch; }
.qa-a p { margin: 0; }
.qa[open] .qa-a { animation: qa-in 260ms var(--tx); }
@keyframes qa-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Appear on scroll (JS adds .in; without JS everything is visible) ---------- */
html.js .rv { opacity: 0; transform: translateY(14px); transition: opacity 520ms var(--tx), transform 520ms var(--tx); }
html.js .rv.in { opacity: 1; transform: none; }
html.js .cards li { opacity: 0; transform: translateY(10px); transition: opacity 420ms var(--tx), transform 420ms var(--tx); }
html.js .cards.in li { opacity: 1; transform: none; }
.cards.in li:nth-child(2) { transition-delay: 50ms; } .cards.in li:nth-child(3) { transition-delay: 100ms; } .cards.in li:nth-child(4) { transition-delay: 150ms; }
html.js .doc-head > * { animation: rise 460ms var(--tx) both; }
html.js .doc-head > :nth-child(2) { animation-delay: 60ms; } html.js .doc-head > :nth-child(3) { animation-delay: 120ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Page transitions: View Transitions when supported, class-based fade otherwise ---------- */
@view-transition { navigation: auto; }
.docs .top { view-transition-name: dj-top; }
::view-transition-old(root) { animation: vt-out 150ms var(--tx) both; }
::view-transition-new(root) { animation: vt-in 220ms var(--tx) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
html.js body.leaving .layout, html.js body.leaving .foot { opacity: 0; transform: translateY(-6px); transition: opacity 150ms var(--tx), transform 150ms var(--tx); }
@supports not (view-transition-name: x) { html.js .layout { animation: vt-in 220ms var(--tx) both; } }

/* ---------- Dark appearance (follows the system) ---------- */
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark;
    --paper: #14171c; --paper-2: #1a1e25; --white: #1e232a; --line-l: #343b46;
    --ink: #f1efe9; --ink-2: #a3aab6; --amber-text: #ffb020; --green-text: #2fbf71; --red-text: #e5484d; }
  .docs .top { background: rgba(20, 23, 28, .72); border-bottom-color: rgba(255, 255, 255, .08); }
  .side a[aria-current="page"] { background: var(--white); color: var(--amber); }
  .doc-body a { text-decoration-color: rgba(255, 176, 32, .5); }
  .shot img { box-shadow: 0 22px 44px -26px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .06); }
  kbd { background: var(--paper-2); border-color: var(--line-l); }
  .results mark { background: rgba(255, 176, 32, .3); }
  .foot-brand .sym-l { display: none; } .foot-brand .sym-d { display: block; }
  .flag { box-shadow: 0 0 0 1px rgba(255, 255, 255, .14); }
  .hero-draw .grid path { stroke: rgba(163, 170, 182, .12); }
  .hero-draw .walls path { stroke: var(--ink); }
  .hero-draw .p { fill: var(--white); stroke: var(--ink); }
  .docs .foot .lang > button { background: var(--white); border-color: var(--line-l); }
  .docs .foot .lang ul { background: var(--white); }
  .search-btn { background: rgba(255, 255, 255, .06); }
}

/* ---------- Mobile refinements ---------- */
@media (max-width: 899px) {
  .docs .foot .legal { grid-template-columns: 1fr; padding-top: 32px; }
  .docs .foot .links { padding-top: 0; }
}
@media (max-width: 560px) {
  .docs .lang > button .lc { display: none; }
  .docs .lang > button { padding: 0 8px; gap: 6px; }
  .foot-end { flex-direction: column; align-items: flex-start; }
  .qa summary { font-size: 17px; padding: 14px 0; }
  .qa-a { font-size: 16px; }
}
@media (max-width: 400px) {
  .cookies .acts { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
  .docs .top .bar { padding-left: 12px; padding-right: 12px; gap: 4px; }
  .docs .brand { gap: 8px; }
  .docs .brand img { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  html.js .rv, html.js .cards li, .docs .brand, .docs .brand img, .docs .top::after, .qa summary svg, .u-link::after, .docs .foot .links a::after { transition: none !important; }
  html.js .rv, html.js .cards li { opacity: 1; transform: none; }
  html.js .doc-head > *, html.js .layout, .qa[open] .qa-a { animation: none !important; }
  @view-transition { navigation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  html.js body.leaving .layout, html.js body.leaving .foot { opacity: 1; transform: none; }
}

/* Chrome colours independent of the page scheme (header and cookie banner are always graphite). */
.docs .top, .docs .top .lang > button, .docs .top .lang li a, .docs .side-btn, .docs .search-btn:hover { color: #f5f3ee; }
.docs .top .lang li a .lc, .docs .top .search-btn, .docs .top .search-btn kbd { color: #a3aab6; }
.docs .top .search-btn:hover { color: #f5f3ee; }
.docs .top .lang ul { background: #1e232a; border-color: #343b46; }
.docs .top .lang li a:hover, .docs .top .lang li a[aria-current="true"] { background: #272d36; }
.docs .cookies, .docs .cookies h2, .docs .cookies .acts .btn-c { color: #f5f3ee; }
.docs .cookies p, .docs .cookies .prefs small { color: #a3aab6; }
.docs .cookies .acts .btn-c { background: #272d36; border-color: #343b46; }
.docs .cookies .prefs label { color: #f5f3ee; }
.docs .foot .lang ul { background: var(--white); border-color: var(--line-l); box-shadow: 0 18px 40px rgba(0, 0, 0, .18); }
.docs .foot .lang li a { color: var(--ink); }
.docs .foot .lang li a .lc { color: var(--ink-2); }
.docs .foot .lang li a:hover, .docs .foot .lang li a[aria-current="true"] { background: var(--paper-2); }
.docs .foot .legal { padding-left: clamp(16px, 2.5vw, 32px); padding-right: clamp(16px, 2.5vw, 32px); }
.docs .lang li a .ln { font-family: inherit; font-size: 15px; }
