/* Spectrum drawers */
.spectrum { min-width: 0; }
.spectrum [role="tablist"], .spectrum-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 22px;
  padding: 6px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--code-bg);
  color: var(--text);
}
.spectrum :is([role="tab"], .spectrum-tab) {
  --stripe: var(--link-on-light);
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 7px 15px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--clear);
  color: var(--text);
  font: 600 .9rem/1.3 var(--font-body);
  white-space: nowrap;
}
.spectrum :is([role="tab"], .spectrum-tab):nth-child(3n+2) { --stripe: var(--accent); }
.spectrum :is([role="tab"], .spectrum-tab):nth-child(3n) { --stripe: var(--pink); }
.spectrum :is([role="tab"], .spectrum-tab)::before {
  content: "";
  flex: 0 0 3px;
  height: 14px;
  border-radius: var(--r-pill);
  background: var(--stripe);
}
.spectrum [role="tab"]:hover { background: var(--panel); color: var(--text); }
.spectrum :is([aria-selected="true"], .spectrum-tab.is-current) { background: var(--accent); color: var(--text-on-accent); }
.spectrum :is([aria-selected="true"], .spectrum-tab.is-current)::before { background: var(--text); }
.spectrum [role="tab"]:focus-visible { outline-offset: -3px; }
.spectrum-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: start;
  gap: clamp(20px, 4vw, 48px);
}
.spectrum-panel::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  top: -6px;
  inset-inline-end: 24px;
  border-radius: var(--r-round);
  background: var(--accent);
}
.spectrum-panel p:last-child, .spectrum-panel pre { margin: 0; }
.spectrum-code { padding: 18px; border-radius: var(--r-btn); background: var(--code-bg); color: var(--text); }
.protocols { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.protocols .badge { background: var(--panel); color: var(--text); font-family: var(--font-mono); }

/* In-page navigation, long reads, FAQs */
.toc { width: fit-content; max-width: 100%; }
.toc ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.toc a {
  display: block;
  min-height: 44px;
  padding: 8px 13px;
  border-radius: var(--r-btn);
  background: var(--code-bg);
  color: var(--text);
  text-decoration: none;
}
.toc a:hover, .toc a[aria-current="location"] { background: var(--accent); color: var(--text-on-accent); text-decoration: underline; }
.toc--sticky { position: sticky; top: 20px; z-index: 2; }
.longform {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
  gap: clamp(24px, 5vw, 68px);
  align-items: start;
}
.longform > .toc { position: sticky; top: 20px; }
.longform > .toc ul { display: grid; }
.longform [id] { scroll-margin-top: 24px; }
.toc.is-static, .longform > .toc.is-static { position: static; }
.step-mark {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  max-width: 100%;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--color-primary);
  color: var(--text-on-dark);
  font: 600 .84rem/1.4 var(--font-mono);
}
.section--ink .step-mark { background: var(--accent); color: var(--text-on-accent); }
.step-mark b { flex-shrink: 0; }
.faq-stack {
  --focus: var(--link-on-light);
  border: 1px solid var(--border);
  border-radius: var(--r-pop);
  background: var(--panel);
  color: var(--text);
}
.faq-item { color: var(--text); }
.faq-item + .faq-item { border-top: 1px solid var(--border); }
.faq-item > summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 52px;
  list-style: none;
  padding: 12px 48px 12px 18px;
  font-weight: 600;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary:focus-visible { outline-offset: -4px; }
.faq-item > summary::after {
  content: "";
  position: absolute;
  inset-inline-end: 22px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-inline-end: 2px solid var(--link-on-light);
  border-bottom: 2px solid var(--link-on-light);
  transform: translateY(-70%) rotate(45deg);
}
.faq-item[open] > summary::after { transform: translateY(-30%) rotate(225deg); }
.faq-answer { padding: 0 18px 17px; }
.faq-answer > :last-child { margin-bottom: 0; }
.term-card dt { color: var(--text); font: 600 1rem/1.4 var(--font-mono); }
.term-card dd { margin: 10px 0 0; text-align: start; color: var(--text-muted); }
.callout {
  --link-ink: var(--link-on-light);
  --focus: var(--link-on-light);
  margin: 1.4em 0;
  padding: 16px 20px;
  border-inline-start: 4px solid var(--link-on-light);
  border-radius: 0 var(--r-btn) var(--r-btn) 0;
  background: var(--code-bg);
  color: var(--text);
}
.callout > :last-child { margin-bottom: 0; }

/* Acquisition: OS detection and package values are owned by getapp.js. */
.get-actions, .cta, .plat-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 14px;
}
.get-actions, .cta { margin-bottom: 18px; }
.get-actions > *, .cta > *, .plat-actions > * { min-width: 0; max-width: 100%; }
.get-note {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
  margin: 0;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-menu);
  background: var(--code-bg);
  color: var(--text-muted);
  font-size: var(--size-small);
}
.get-note .ver { font: 400 12.5px var(--font-mono); overflow-wrap: break-word; }
.get-note .sep { flex: 0 0 3px; height: 3px; border-radius: var(--r-round); background: var(--link-on-light); }
.get-note .version-part:has(>[data-pkg-ver]:empty), .get-note .version-part:has(>[data-pkg-ver]:empty) + .sep { display: none; }
:is(.shell, .section--ink) .get-note { border-color: var(--hair-dark); background: var(--fill-dark); color: var(--text-on-dark); }
:is(.shell, .section--ink) .get-note .sep { background: var(--sky); }
.app-store-btn {
  min-height: 52px;
  padding-inline: 18px;
  background: var(--bg-deep);
  color: var(--text-on-dark);
  box-shadow: var(--shadow-mark);
  text-align: start;
}
.app-store-btn:hover { background: var(--shadow-deep); color: var(--text-on-dark); }
.app-store-btn svg { width: 23px; height: 23px; }
.app-store-btn small { display: block; font-size: .75em; font-weight: 400; }
.app-store-btn strong { display: block; font-weight: 600; }
.plat-grid { display: flex; flex-wrap: wrap; gap: var(--gap); }
.plat-card {
  position: relative;
  display: flex;
  flex: 1 1 calc((100% - var(--gap) * 2) / 3);
  flex-direction: column;
  align-items: start;
  justify-content: flex-start;
  gap: 9px;
  min-width: 0;
  max-width: calc((100% - var(--gap)) / 2);
}
.plat-card h3, .plat-card p { margin: 0; }
.plat-card .plat-hint { order: 1; }
.plat-card .plat-actions { order: 2; margin-top: auto; padding-top: 10px; }
.plat-actions .btn { padding-inline: 16px; }
html[data-visitor-os="ios"] .plat-card[data-plat="ios"] { order: -1; }
html[data-visitor-os="mac"] .plat-card[data-plat="mac"] { order: -1; }
html[data-visitor-os="windows"] .plat-card[data-plat="windows"] { order: -1; }
html[data-visitor-os="android"] .plat-card[data-plat="android"] { order: -1; }
html[data-visitor-os="linux"] .plat-card[data-plat="linux"] { order: -1; }
html[data-visitor-os="ios"] .plat-card[data-plat="ios"]::before,
html[data-visitor-os="mac"] .plat-card[data-plat="mac"]::before,
html[data-visitor-os="windows"] .plat-card[data-plat="windows"]::before,
html[data-visitor-os="android"] .plat-card[data-plat="android"]::before,
html[data-visitor-os="linux"] .plat-card[data-plat="linux"]::before {
  content: attr(data-mine);
  align-self: start;
  padding: 3px 11px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: var(--size-small);
}
.wx-open-tip {
  position: fixed;
  z-index: 25;
  inset-inline: 0;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: max-content;
  max-width: min(34rem, calc(100% - var(--gutter) * 2));
  max-height: 65vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin-inline: auto;
  padding: 13px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-menu);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-pop);
}

/* Facts and editorial cards */
.fact-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.fact-pill {
  max-width: 100%;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--code-bg);
  color: var(--text);
  font-size: var(--size-small);
  overflow-wrap: break-word;
}
:is(.section--ink, .shell, .facts) .fact-pill { border-color: var(--hair-dark); background: var(--fill-dark); color: var(--text-on-dark); }
.shot-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--gap); }
.official-shot { width: min(100%, 280px); flex-shrink: 0; margin: 0; }
.official-shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-shot);
}
.official-shot :is(img, .shot-sample) { outline: 1px solid var(--border); outline-offset: -1px; }
.official-shot figcaption { margin-top: 9px; color: var(--muted-ink); font-size: .88rem; }
.shot-sample {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 750 / 1334;
  border-radius: var(--r-shot);
  background: var(--code-bg);
  color: var(--text-muted);
  text-align: center;
}
.device-card, .article-card {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 12px;
}
.device-card {
  text-decoration: none;
  border-inline-start: 4px solid var(--link-on-light);
}
.device-card:hover h3 { text-decoration: underline; }
.device-card > svg { width: 36px; height: 36px; flex-shrink: 0; color: var(--link-on-light); }
.device-card :is(p, h3), .article-card :is(p, h3) { margin: 0; }
.article-card { box-shadow: var(--shadow-mark); }
.article-card .article-meta { font-size: var(--size-small); color: var(--text-muted); }
.article-card .article-next { margin-top: auto; }
.article-store-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
}
.article-store-card > div { flex: 1 1 24ch; }
.article-store-card p:last-child { margin-bottom: 0; }

/* Scrollable comparison tables, including nested bare tables in prose. */
.table-scroll,
:is(.prose, .doc-body, .wrap) table:not(.table-scroll table),
.data-table:not(.table-scroll .data-table) {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  max-width: 100%;
  min-width: 0;
}
.table-scroll { border: 1px solid var(--border); border-radius: var(--r-btn); }
:is(.prose, .doc-body, .wrap, #install) table, .data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: start;
}
:is(.prose, .doc-body, .wrap, #install) :is(th, td), .data-table :is(th, td) {
  min-width: 7em;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  overflow-wrap: normal;
  word-break: normal;
  vertical-align: top;
  text-align: start;
  background: var(--panel);
  color: var(--text);
}
:is(.prose, .doc-body, .wrap, #install) th, .data-table th { background: var(--code-bg); color: var(--text); }
th[scope="row"] { width: 1%; white-space: nowrap; }
:is(.prose, .doc-body, .wrap) td > code, .data-table td > code { overflow-wrap: anywhere; }
:is(.prose, .doc-body, .wrap) caption { padding: 8px 14px; text-align: start; }

.dl-fab {
  position: fixed;
  z-index: 10;
  inset-inline-end: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 52px;
  max-width: calc(100% - 32px);
  padding: 8px 18px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-pop);
  font-weight: 600;
  text-decoration: none;
}
.dl-fab:hover { background: var(--accent-hi); color: var(--text-on-accent); }
.dl-fab svg { width: 21px; height: 21px; flex-shrink: 0; }
.with-dl-fab .site-footer { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

/* Static preview utilities. Swatches keep captions off their fill. */
.swatch-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 145px), 1fr));
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.swatch { padding: 7px; border: 1px solid var(--border); border-radius: var(--r-btn); font: .76rem/1.5 var(--font-mono); }
.swatch::before { content: ""; display: block; height: 35px; margin-bottom: 5px; border-radius: var(--r-code); background: var(--sample); }
.sw-bg { --sample: var(--bg); }
.sw-top { --sample: var(--bg-top); }
.sw-deep { --sample: var(--bg-deep); }
.sw-panel { --sample: var(--panel); }
.sw-tint { --sample: var(--tint); }
.sw-cream { --sample: var(--cream); }
.sw-code { --sample: var(--code-bg); }
.sw-border { --sample: var(--border); }
.sw-c1 { --sample: var(--curve-1); }
.sw-c2 { --sample: var(--curve-2); }
.sw-c3 { --sample: var(--curve-3); }
.sw-accent { --sample: var(--accent); }
.sw-a2 { --sample: var(--accent-2); }
.sw-ahi { --sample: var(--accent-hi); }
.sw-ad { --sample: var(--accent-dark); }
.sw-ar { --sample: var(--accent-ring); }
.sw-sky { --sample: var(--sky); }
.sw-shi { --sample: var(--sky-hi); }
.sw-pink { --sample: var(--pink); }
.sw-phi { --sample: var(--pink-hi); }
.sw-p2 { --sample: var(--pink-2); }
.sw-link { --sample: var(--link-on-light); }
.sw-text { --sample: var(--text); }
.sw-muted { --sample: var(--text-muted); }
.sw-on { --sample: var(--text-on-dark); }
.sw-onm { --sample: linear-gradient(var(--text-on-dark-muted), var(--text-on-dark-muted)), var(--bg-deep); }
.sw-success { --sample: var(--success); }
.sw-warn { --sample: var(--warn); }
.sw-error { --sample: var(--error); }
.sw-white { --sample: var(--white); }
.sw-shadow { --sample: var(--shadow-deep); }
.sw-shadowi { --sample: var(--shadow-ink); }
.sw-hair { --sample: linear-gradient(var(--hair-dark), var(--hair-dark)), var(--bg-deep); }
.sw-hairs { --sample: linear-gradient(var(--hair-strong), var(--hair-strong)), var(--bg-deep); }
.sw-fill { --sample: linear-gradient(var(--fill-dark), var(--fill-dark)), var(--bg-deep); }
.sw-hover { --sample: linear-gradient(var(--fill-dark-hover), var(--fill-dark-hover)), var(--bg-deep); }
.sw-sheen { --sample: linear-gradient(var(--sheen), var(--sheen)), var(--bg-deep); }
.sw-glows { --sample: linear-gradient(var(--glow-sky), var(--glow-sky)), var(--bg-deep); }
.sw-gloww { --sample: linear-gradient(var(--glow-warm), var(--glow-warm)), var(--bg-deep); }
.sw-glowb { --sample: var(--glow-btn); }
.sw-dot { --sample: linear-gradient(var(--dot), var(--dot)), var(--bg-deep); }
.sw-mask { --sample: var(--mask); }
.sw-veil { --sample: var(--veil); }
.sw-clear { --sample: var(--clear); }
.preview-stack { display: grid; gap: 24px; }

@media (max-width: 960px) {
  .plat-card { flex-basis: calc((100% - var(--gap)) / 2); max-width: 100%; }
  .spectrum-panel { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .get-actions .btn, .cta .btn { flex: 1 1 100%; }
  .plat-card { flex-basis: 100%; }
  .toc--sticky, .longform > .toc { position: static; }
  .longform { grid-template-columns: minmax(0, 1fr); }
  .longform > .toc ul { display: flex; }
  .fact-pills { justify-content: center; }
  .shot-row { flex-direction: column; align-items: center; }
  .shot-row .official-shot, .prose .official-shot { margin-inline: auto; }
  #install :is(table, tbody, tr, td, th[scope="row"]) { display: block; }
  #install thead { display: none; }
  #install :is(td, th) { width: auto; min-width: 0; white-space: normal; }
  #install tr + tr { border-top: 3px solid var(--border); }
  #install code { word-break: normal; overflow-wrap: normal; }
  #install :not(pre) > code {
    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
    vertical-align: middle;
    white-space: normal;
  }
  .with-dl-fab main { padding-inline-end: 52px; }
  .dl-fab { width: 52px; height: 52px; min-height: 52px; padding: 0; border-radius: var(--r-round); }
  .dl-fab .dl-fab-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}