/* Tandrio landing — documentation page. Layout and typography on top of the tokens in styles.css. */

.docs-wrap {
  width: min(1160px, 100% - 32px);
  margin-inline: auto;
  padding: 32px 0 clamp(72px, 10vw, 120px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

/* ---- Table of contents ---- */
.docs-toc { font-size: 14px; min-width: 0; }
.docs-toc details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-raised); }
.docs-toc summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 0 16px; list-style: none; cursor: pointer;
  color: var(--fg); font-weight: 600;
}
.docs-toc summary::-webkit-details-marker { display: none; }
.docs-toc summary::after {
  content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px); transition: transform .15s;
}
.docs-toc details[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.toc-list { margin: 0; padding: 4px 8px 12px; list-style: none; counter-reset: toc; }
.toc-list li:not(.unnumbered) { counter-increment: toc; }
.toc-list a {
  display: flex; gap: 8px; padding: 7px 10px; border-left: 2px solid transparent; border-radius: 0 8px 8px 0;
  color: var(--fg-muted); text-decoration: none; line-height: 1.35;
}
.toc-list li:not(.unnumbered) a::before {
  content: counter(toc); flex: none; min-width: 2ch; color: var(--fg-faint); font-variant-numeric: tabular-nums; text-align: right;
}
.toc-list a:hover { color: var(--fg); background: rgb(255 255 255 / .05); }
.toc-list a[aria-current="location"] { color: var(--fg); border-left-color: var(--accent); background: rgb(99 245 130 / .07); }
.toc-list a:focus-visible { outline-offset: -2px; }

@media (min-width: 960px) {
  .docs-wrap { grid-template-columns: 264px minmax(0, 760px); justify-content: center; gap: 56px; align-items: start; padding-top: 40px; }
  .docs-toc { position: sticky; top: 88px; max-height: calc(100vh - 112px); overflow-y: auto; overscroll-behavior: contain; }
  .docs-toc details { border: 0; background: none; }
  .docs-toc summary { min-height: 0; padding: 0 10px 10px; cursor: default; pointer-events: none; color: var(--fg-faint); font-size: 12.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
  .docs-toc summary::after { display: none; }
  .toc-list { padding: 0; }
}

/* ---- Content ---- */
.docs { min-width: 0; counter-reset: sec; }
.docs h1 { font-size: clamp(32px, 6vw, 52px); font-weight: 800; letter-spacing: -.04em; overflow-wrap: anywhere; }
.docs .lead { margin-top: 20px; color: var(--fg-muted); font-size: clamp(17px, 2.4vw, 19px); }
.docs .docs-note {
  margin-top: 20px; padding: 12px 16px; border: 1px solid var(--border); border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm); background: var(--bg-raised); color: var(--fg-muted); font-size: 14.5px;
}

.docs-section[id] { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--border); scroll-margin-top: 84px; }
.docs-section:not(.is-words) { counter-increment: sec; }
.docs-section > h2 {
  display: flex; align-items: baseline; gap: 14px;
  font-size: clamp(23px, 3.4vw, 30px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere;
}
.docs-section:not(.is-words) > h2::before {
  content: counter(sec); flex: none; min-width: 2.1ch; padding: 3px 8px; border-radius: 8px;
  background: rgb(99 245 130 / .12); color: var(--accent); font-size: .6em; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums;
}
.docs h3 {
  margin-top: 28px; color: var(--accent); font-size: 12.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; line-height: 1.3;
}
.docs h3 + p, .docs h3 + ol, .docs h3 + ul { margin-top: 10px; }
.docs-section > h2 + p { margin-top: 12px; }
.docs .problem-title {
  margin-top: 32px; color: var(--fg); font-size: 18px; letter-spacing: -.01em; text-transform: none; font-weight: 600;
}

.docs p, .docs li, .docs dd { color: var(--fg-muted); overflow-wrap: anywhere; }
.docs p, .docs li { line-height: 1.65; }
.docs .ui { color: var(--fg); font-weight: 600; }
.docs code {
  padding: 1px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--card-2);
  color: var(--fg); font-size: .88em; overflow-wrap: anywhere; word-break: break-word;
}

.docs ol, .docs ul { display: grid; gap: 10px; margin: 0; padding-left: 26px; }
.docs ol li::marker { color: var(--accent); font-weight: 600; }
.docs ul li::marker { color: var(--accent); }
.docs .problem p + ul { margin-top: 10px; }
.docs .problem p { margin-top: 8px; }

.docs dl.words { display: grid; gap: 14px 24px; margin: 20px 0 0; }
.docs dl.words dt { color: var(--fg); font-weight: 600; }
.docs dl.words dd { margin: 4px 0 0; }
@media (min-width: 640px) {
  .docs dl.words { grid-template-columns: max-content minmax(0, 1fr); }
  .docs dl.words dd { margin: 0; }
}

.docs .watch {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-top: 28px; padding: 12px 16px;
  border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--bg-raised); font-size: 14.5px;
}
.docs .watch.is-none { border-left-color: var(--border-strong); }
.docs .watch-label { color: var(--accent); font-size: 12.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.docs .watch.is-none .watch-label { color: var(--fg-faint); }
.docs .watch-ids { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.docs .watch-ids + .watch-gloss::before { content: "— "; color: var(--fg-faint); }
.docs .watch-gloss { min-width: 0; color: var(--fg-muted); }

.docs .back { display: inline-block; margin-top: 56px; color: var(--accent); text-underline-offset: 3px; }
.docs .back:hover { color: var(--accent-strong); }

/* ---- Contrast, forced colors, print ---- */
@media (prefers-contrast: more) {
  .docs p, .docs li, .docs dd, .docs .lead, .docs .watch-gloss, .toc-list a { color: var(--fg); }
  .docs-section, .docs-toc details, .docs .watch, .docs code { border-color: var(--border-strong); }
  .toc-list li:not(.unnumbered) a::before, .docs h3 { color: var(--fg); }
}
@media (forced-colors: active) {
  .toc-list a[aria-current="location"] { border-left-color: Highlight; }
  .docs .watch, .docs .docs-note { border-color: CanvasText; }
  .docs code { border-color: CanvasText; }
}
@media print {
  .site-header, .docs-toc, .site-footer, .docs .back { display: none; }
  .docs-wrap { display: block; width: 100%; padding: 0; }
  body, .docs p, .docs li, .docs dd, .docs .ui, .docs code, .docs h1, .docs h2, .docs .lead { background: #fff; color: #000; }
  .docs-section { break-inside: auto; border-top-color: #999; }
  .docs h3 { color: #000; }
}
