/* Docs + changelog — layered on top of /styles.css.
   Black-and-white spine, mint as accent only, 12px radius across.
   No backdrop blur. No drop shadows. */

.brand-back {
  gap: 10px; padding: 4px 4px 4px 2px;
  border-radius: var(--radius-sm);
  transition: background-color 0.12s;
}
.brand-back:hover { background: rgba(10,10,11,0.04); }
.brand-back .back-arrow {
  width: 18px; height: 18px;
  color: var(--slate);
  transition: color 0.12s, transform 0.12s;
}
.brand-back:hover .back-arrow { color: var(--ink); transform: translateX(-2px); }

.docs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 18px var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.docs-nav { display: flex; gap: 18px; align-items: center; }
.dh-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate);
  padding: 8px 4px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.dh-link:hover { color: var(--ink); }
.dh-link.is-active { color: var(--ink); border-bottom-color: var(--ink); }

.docs-page {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) var(--gutter);
}
.docs-page-wide { max-width: 1180px; }

/* ── Hero — clean white surface, heroic h1. */
.docs-hero {
  padding: clamp(8px, 2vw, 16px) 0 clamp(28px, 4vw, 44px);
  margin-bottom: clamp(20px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
}
.docs-hero h1 {
  font-size: clamp(40px, 6.5vw, 64px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin-bottom: 16px;
  color: var(--ink);
}
.docs-lead {
  color: var(--slate);
  font-size: clamp(15px, 1.5vw, 17px);
  line-height: 1.55;
  max-width: 56ch;
  margin-bottom: 22px;
}

.docs-search-wrap { position: relative; max-width: 520px; }
.docs-search {
  width: 100%;
  padding: 13px 16px;
  font: inherit;
  font-size: 14.5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  outline: none;
  transition: border-color 0.14s;
}
.docs-search::placeholder { color: var(--mute); }
.docs-search:focus {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.docs-search-results {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 20;
  padding: 4px;
  color: var(--ink);
}
.ds-row {
  display: flex; flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
}
.ds-row:hover { background: var(--bg); }
.ds-row .ds-kind {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.ds-row .ds-title { font-size: 14px; font-weight: 600; color: inherit; }
.ds-row .ds-snippet {
  font-size: 12.5px; color: var(--slate);
  line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.ds-empty { padding: 14px 12px; color: var(--slate); font-size: 13px; }

/* ── Index groups + grid. */
.docs-group + .docs-group { margin-top: 36px; }
.docs-group-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 14px;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

/* Doc card — flat white with hairline. */
.doc-card {
  position: relative;
  display: flex; align-items: flex-start; gap: 16px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.14s;
  overflow: hidden;
}
.doc-card:hover { border-color: var(--ink); }

.doc-card-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 0.14s, color 0.14s;
}
.doc-card-icon svg { width: 18px; height: 18px; }
.doc-card:hover .doc-card-icon { background: var(--ink); color: var(--mint); }

.doc-card-text { flex: 1; min-width: 0; }
.doc-card-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
  padding-right: 22px;
}
.doc-card-head h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.018em;
  flex: 1;
  min-width: 0;
  color: var(--ink);
}
.doc-card-desc {
  font-size: 13.5px;
  color: var(--slate);
  line-height: 1.55;
}
.doc-card-arrow {
  position: absolute;
  top: 24px; right: 22px;
  font-size: 14px;
  color: var(--mute);
  transition: color 0.14s, transform 0.14s;
}
.doc-card:hover .doc-card-arrow { color: var(--ink); transform: translateX(3px); }

/* ── Doc detail page. */
.docs-page-doc { max-width: 1180px; }
.docs-page-doc .doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 56px;
}
.docs-page-doc.has-toc .doc-layout {
  grid-template-columns: minmax(0, 1fr) 220px;
}
@media (max-width: 960px) {
  .docs-page-doc.has-toc .doc-layout { grid-template-columns: 1fr; }
}

.doc-toc {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100dvh - 100px);
  overflow-y: auto;
  padding-left: 18px;
  border-left: 1px solid var(--line);
  font-size: 13px;
}
@media (max-width: 960px) { .doc-toc { display: none; } }
.doc-toc-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 12px;
}
.doc-toc-list { list-style: none; padding: 0; margin: 0; }
.doc-toc-list li { line-height: 1.5; margin-bottom: 6px; }
.doc-toc-list .doc-toc-l3 { padding-left: 14px; }
.doc-toc-list a {
  color: var(--slate);
  text-decoration: none;
  display: block;
  padding: 2px 0;
  border-left: 2px solid transparent;
  margin-left: -10px;
  padding-left: 8px;
  transition: color 0.12s, border-color 0.12s;
}
.doc-toc-list a:hover { color: var(--ink); }
.doc-toc-list a.is-active {
  color: var(--ink);
  border-left-color: var(--ink);
  font-weight: 600;
}

.doc-crumbs {
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate);
}
.doc-crumbs a { color: var(--slate); }
.doc-crumbs a:hover { color: var(--ink); }

.doc-article-head {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.doc-article-head h1 {
  font-size: clamp(34px, 4.8vw, 48px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin-bottom: 12px;
  color: var(--ink);
}
.doc-article-desc {
  font-size: clamp(15px, 1.4vw, 17px);
  color: var(--slate);
  line-height: 1.55;
  max-width: 60ch;
}

.doc-article-body { font-size: 16px; line-height: 1.74; color: var(--slate); }
.doc-article-body p { margin: 0 0 16px; }
.doc-article-body h2 {
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 40px 0 14px;
  scroll-margin-top: 80px;
  position: relative;
}
.doc-article-body h3 {
  font-size: clamp(17px, 1.8vw, 20px);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 28px 0 10px;
  scroll-margin-top: 80px;
  position: relative;
}
.doc-article-body h2 .anchor,
.doc-article-body h3 .anchor {
  display: inline-block;
  margin-left: 8px;
  color: var(--mute);
  text-decoration: none;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.14s, color 0.14s;
}
.doc-article-body h2:hover .anchor,
.doc-article-body h3:hover .anchor { opacity: 1; }
.doc-article-body h2 .anchor:hover,
.doc-article-body h3 .anchor:hover { color: var(--ink); }

.doc-article-body strong { color: var(--ink); font-weight: 700; }
.doc-article-body a {
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: border-color 0.12s, color 0.12s;
}
.doc-article-body a:hover { border-bottom-color: var(--ink); }

.doc-article-body ul, .doc-article-body ol { margin: 0 0 16px 24px; }
.doc-article-body li { margin-bottom: 6px; }
.doc-article-body code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 2px 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.doc-article-body pre {
  background: var(--ink);
  color: #fff;
  padding: 18px 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  margin: 18px 0;
}
.doc-article-body pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}
.doc-article-body blockquote {
  border-left: 3px solid var(--ink);
  padding: 4px 16px;
  margin: 18px 0;
  color: var(--slate);
  font-style: italic;
}
.doc-article-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 18px 0;
  font-size: 14px;
}
.doc-article-body th {
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
}
.doc-article-body td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--slate);
}
.doc-article-body img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin: 18px 0;
}
.doc-article-body hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

/* In-content link to an /app/ page renders as a chip pill. */
.doc-article-body a.app-link {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  border: 0;
  font-weight: 600;
  font-size: 13.5px;
}
.doc-article-body a.app-link:hover {
  background: var(--mint); color: var(--ink);
}

/* ─── Changelog (redesigned) ───────────────────────────────────
   Mint pill eyebrow + heroic h1 + filter pills. Timeline rail on
   the left with version + relative date + absolute date; card on
   the right with tag pill + heading + body. Vertical thread
   connects the dots between entries. */
.cl-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 64px) var(--gutter) clamp(56px, 8vw, 96px);
}

/* Hero. */
.cl-hero { margin-bottom: clamp(28px, 4vw, 44px); }

/* Feedback CTA card — sits between the hero and the timeline.
   Mint-tinted card so it pops without being loud. */
.cl-feedback-cta {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 18px;
  align-items: center;
  background: var(--mint-soft, #E8FEEC);
  border: 1px solid rgba(43,192,74,0.18);
  border-radius: 16px;
  padding: 18px 22px;
  margin: 0 0 clamp(28px, 4vw, 44px);
}
.cl-feedback-cta-icon {
  width: 44px; height: 44px;
  background: var(--ink, #16161a);
  color: var(--mint, #75FB90);
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cl-feedback-cta-icon svg { width: 20px; height: 20px; }
.cl-feedback-cta-body { min-width: 0; }
.cl-feedback-cta-body h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 4px;
  line-height: 1.3;
}
.cl-feedback-cta-body p {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--mint-ink, #0a4a18);
  margin: 0;
}
.cl-feedback-cta-actions {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.cl-feedback-cta-btn-primary,
.cl-feedback-cta-btn-ghost {
  display: inline-flex; align-items: center;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.12s, background 0.12s;
}
.cl-feedback-cta-btn-primary {
  background: var(--ink, #16161a);
  color: #fff;
}
.cl-feedback-cta-btn-primary:hover { opacity: 0.9; color: #fff; }
.cl-feedback-cta-btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(10,10,11,0.18);
}
.cl-feedback-cta-btn-ghost:hover { background: rgba(10,10,11,0.05); }
@media (max-width: 720px) {
  .cl-feedback-cta {
    grid-template-columns: 1fr;
    text-align: left;
    padding: 14px;
    gap: 12px;
  }
  .cl-feedback-cta-actions { justify-content: flex-start; }
}
.cl-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--mint, #75FB90);
  color: var(--ink);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 22px;
}
.cl-eyebrow-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink);
}
.cl-h1 {
  font-size: clamp(48px, 7vw, 80px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.95;
  color: var(--ink);
  margin: 0 0 14px;
}
.cl-lead {
  color: var(--slate);
  font-size: clamp(15px, 1.5vw, 17px);
  line-height: 1.55;
  margin: 0 0 26px;
  max-width: 56ch;
}

/* Filter pills. */
.cl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: clamp(24px, 4vw, 40px);
}
.cl-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.cl-filter:hover { border-color: var(--ink); }
.cl-filter.is-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.cl-filter-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--slate);
  letter-spacing: 0.04em;
}
.cl-filter.is-active .cl-filter-count { color: rgba(255,255,255,0.6); }

/* Timeline grid. */
.cl-timeline {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vw, 22px);
}
.cl-entry {
  display: grid;
  grid-template-columns: 140px 24px minmax(0, 1fr);
  gap: clamp(14px, 2vw, 24px);
  align-items: start;
  position: relative;
}
.cl-entry.is-hidden { display: none; }
@media (max-width: 720px) {
  .cl-entry { grid-template-columns: 1fr; gap: 12px; }
  .cl-thread { display: none; }
  .cl-rail { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
}

/* Left rail: version + relative date + absolute date. */
.cl-rail {
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cl-version {
  display: inline-flex;
  align-self: flex-start;
  background: var(--ink);
  color: #fff;
  padding: 4px 10px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.cl-date-rel {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.cl-date-abs {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--slate);
  letter-spacing: 0.04em;
}

/* Vertical thread + dot. */
.cl-thread {
  position: relative;
  align-self: stretch;
  display: flex;
  justify-content: center;
}
.cl-thread::before {
  content: "";
  position: absolute;
  top: 8px; bottom: -22px;
  width: 1px;
  background: var(--line);
}
.cl-entry:last-child .cl-thread::before { bottom: 50%; }
.cl-dot {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--bg);
  flex-shrink: 0;
}
.cl-dot-feature, .cl-dot-added, .cl-dot-improved { background: var(--mint, #75FB90); }
.cl-dot-fix, .cl-dot-fixed { background: var(--ink); }
.cl-dot-removed { background: #c83a3a; }

/* Card. */
.cl-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(22px, 3vw, 30px);
  transition: border-color 0.12s, transform 0.12s;
}
.cl-card:hover { border-color: var(--ink); }
.cl-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.cl-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  background: var(--ink);
  color: #fff;
}
.cl-tag-added, .cl-tag-feature, .cl-tag-improved {
  background: var(--mint, #75FB90);
  color: var(--ink);
}
.cl-tag-fixed, .cl-tag-fix { background: var(--ink); color: #fff; }
.cl-tag-removed { background: #c83a3a; color: #fff; }

.cl-heading {
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 14px;
}
.cl-body {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--slate);
}
.cl-body p { margin: 0 0 10px; }
.cl-body p:last-child { margin-bottom: 0; }
.cl-body strong { color: var(--ink); font-weight: 700; }
.cl-body ul {
  list-style: none;
  padding: 0;
  margin: 8px 0 12px;
}
.cl-body ul li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 6px;
  line-height: 1.55;
}
.cl-body ul li::before {
  content: "";
  position: absolute;
  left: 4px; top: 10px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--mute);
}
.cl-body a {
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.cl-body a:hover { border-bottom-color: var(--ink); }
.cl-body code {
  font-family: var(--font-mono);
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.92em;
}

.cl-empty {
  text-align: center;
  color: var(--slate);
  padding: 48px 22px;
  font-size: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ─── 3-col docs shell (sidebar | article | TOC) ─────────────────
   Sticky left sidebar with grouped doc list + search, sticky
   right TOC, scrollable article in the middle. Mobile collapses
   to single-column with the sidebar above the article. */
.docs-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 32px) var(--gutter);
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
}
@media (max-width: 880px) {
  .docs-shell { grid-template-columns: 1fr; gap: 0; padding-top: 8px; }
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.ds-sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100dvh - 100px);
  overflow-y: auto;
  padding-right: 8px;
  font-size: 13.5px;
}
@media (max-width: 880px) {
  /* Sidebar becomes a full-screen drawer slid in from the left,
     toggled via .ds-mobile-toggle. Hidden by default; shows when
     `is-open` class is added by the docs-shell script. */
  .ds-sidebar {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: #fff;
    padding: 18px var(--gutter);
    margin: 0;
    max-height: none;
    overflow-y: auto;
    border-bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 0 8px 32px rgba(10,10,11,0.12);
  }
  .ds-sidebar.is-open { transform: translateX(0); }
  body.ds-sidebar-open { overflow: hidden; }
  body.ds-sidebar-open::before {
    content: "";
    position: fixed; inset: 0;
    background: rgba(10,10,11,0.4);
    z-index: 55;
    animation: dsBackFade 0.22s ease;
  }
  @keyframes dsBackFade { from { opacity: 0 } to { opacity: 1 } }
}

/* Mobile docs-nav toggle — only visible <880px. Sits at the top of
   the article column, before the breadcrumb. */
.ds-mobile-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 14px 9px 12px;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  margin-bottom: 16px;
  transition: opacity 0.15s;
}
.ds-mobile-toggle svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--mint); }
.ds-mobile-toggle:hover { opacity: 0.9; }
@media (max-width: 880px) { .ds-mobile-toggle { display: inline-flex; } }

/* Close (×) button inside the sidebar — pinned top-right when the
   sidebar is open on mobile. Hidden on desktop. */
.ds-sidebar-close {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  z-index: 5;
  appearance: none;
  font: inherit;
}
.ds-sidebar-close svg { width: 18px; height: 18px; }
.ds-sidebar-close:hover { border-color: var(--ink); }
@media (max-width: 880px) {
  .ds-sidebar.is-open .ds-sidebar-close { display: inline-flex; }
}

/* Search input — pill-shaped, mono, ⌘K kbd badge on the right. */
.ds-search {
  position: relative;
  margin-bottom: 24px;
}
.ds-search-input {
  width: 100%;
  padding: 10px 44px 10px 36px;
  font: inherit;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  outline: 0;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.ds-search-input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(10,10,11,0.06);
}
.ds-search-input::placeholder { color: var(--mute); }
.ds-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate);
  display: inline-flex;
  pointer-events: none;
}
.ds-search-icon svg { width: 14px; height: 14px; }
.ds-search-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--slate);
}
/* No physical keyboard on mobile → the ⌘K hint is just visual
   noise. Hide it on small viewports. */
@media (max-width: 880px) {
  .ds-search-kbd { display: none; }
}
.ds-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(10,10,11,0.08);
  max-height: 360px;
  overflow-y: auto;
  z-index: 20;
}

/* Group sections in the sidebar. */
.ds-group { margin-bottom: 18px; }
.ds-group-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--slate);
  padding: 4px 10px;
  margin: 0 0 4px;
}
.ds-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ds-link {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--slate);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1.4;
  transition: background-color 0.12s, color 0.12s;
}
.ds-link:hover { color: var(--ink); background: rgba(10,10,11,0.03); }
.ds-link.is-current {
  color: var(--ink);
  background: rgba(10,10,11,0.05);
  font-weight: 600;
  border-left: 2px solid var(--ink);
  padding-left: 14px;
}

/* ── Main column ─────────────────────────────────────────────── */
.docs-main {
  min-width: 0;
}

.docs-page-index { max-width: 880px; padding: 0; margin: 0; }
.docs-page-doc   { max-width: none; padding: 0; margin: 0; }

/* Index hero — eyebrow + heroic h1 + lead. */
.docs-page-index .docs-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 12px;
}
.docs-page-index .docs-hero {
  padding: 0 0 clamp(20px, 3vw, 32px);
  margin-bottom: clamp(24px, 3vw, 36px);
  border-bottom: 1px solid var(--line);
}
.docs-page-index .docs-hero h1 {
  font-size: clamp(32px, 4.5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0 0 14px;
  color: var(--ink);
}
.docs-page-index .docs-lead {
  margin: 0 0 0;
  color: var(--slate);
  font-size: clamp(14.5px, 1.4vw, 16px);
  line-height: 1.55;
  max-width: 56ch;
}

/* ── Article doc page ────────────────────────────────────────── */
.doc-crumbs {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.doc-crumbs a { color: var(--slate); text-decoration: none; transition: color 0.12s; }
.doc-crumbs a:hover { color: var(--ink); }
.doc-crumbs .sep { color: var(--mute); }
.doc-crumbs .current { color: var(--ink); }

.doc-article-head {
  padding-bottom: clamp(18px, 2.5vw, 26px);
  margin-bottom: clamp(22px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
}
.doc-article-head h1 {
  font-size: clamp(34px, 4.4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0 0 12px;
  color: var(--ink);
}
.doc-article-desc {
  color: var(--slate);
  font-size: clamp(15px, 1.5vw, 17px);
  line-height: 1.55;
  margin: 0 0 18px;
  max-width: 64ch;
}
.doc-article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--slate);
}
.doc-meta-dot { color: var(--mute); }

/* ── Markdown extensions — content authors use these in raw HTML
       inside the markdown. Same primitives across every doc, so the
       page reads consistent without each author rolling their own. */

/* Callout box — variants: info (default), tip, warn, success.
   Authors write:
     <div class="doc-callout doc-callout-tip">
       <strong>Quick start.</strong> Sentence here.
       <a href="…">Link →</a>
     </div>
*/
/* Callouts use a block layout (was flex). Flex-on-the-parent caused
   raw text fragments and inline children (<strong>, <span>, <code>)
   to each become a separate flex item, which the browser then laid
   out as columns when the content was rich — see the
   "From address has to match the SMTP user" callout in the
   whitelabel-email doc, which rendered as 5+ vertical columns
   before this fix. Block layout lets the content flow as normal
   prose; the icon sits at the top in its own row. */
.doc-callout {
  display: block;
  margin: 22px 0;
  padding: 14px 18px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
  position: relative;
  border-left: 4px solid var(--mute);
}
.doc-callout::before {
  content: "i";
  display: inline-flex;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(10,10,11,0.08);
  color: var(--ink);
  align-items: center; justify-content: center;
  font-style: italic;
  font-weight: 700;
  font-size: 13px;
  font-family: serif;
  margin-bottom: 10px;
}
.doc-callout p { margin: 0; }
.doc-callout p + p { margin-top: 8px; }
.doc-callout a { color: var(--ink); border-bottom: 1px solid var(--ink); text-decoration: none; }

.doc-callout-tip {
  border-left-color: var(--mint, #75FB90);
  background: linear-gradient(to right, rgba(117,251,144,0.08), var(--surface) 60%);
}
.doc-callout-tip::before {
  content: "✓";
  background: var(--mint, #75FB90);
  color: var(--ink);
  font-family: inherit;
  font-style: normal;
}
.doc-callout-warn {
  border-left-color: #FFC400;
  background: linear-gradient(to right, rgba(255,196,0,0.08), var(--surface) 60%);
}
.doc-callout-warn::before {
  content: "!";
  background: #FFC400;
  color: #1a1300;
  font-family: inherit;
  font-style: normal;
}
.doc-callout-success {
  border-left-color: #1ABC4E;
  background: linear-gradient(to right, rgba(26,188,78,0.08), var(--surface) 60%);
}
.doc-callout-success::before {
  content: "✓";
  background: #1ABC4E;
  color: #fff;
  font-family: inherit;
  font-style: normal;
}

/* Feature card grid — used in "What you can do" sections.
   Authors write:
     <div class="doc-cards">
       <a class="doc-cards-card" href="/docs/short-links">
         <span class="doc-cards-icon">…svg…</span>
         <h3>Short links</h3>
         <p>Branded slugs on your domain.</p>
       </a>
       …
     </div>
*/
.doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 24px 0;
}
.doc-cards-card {
  position: relative;
  display: block;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}
.doc-cards-card::after {
  content: "→";
  position: absolute;
  top: 18px; right: 22px;
  color: var(--slate);
  font-size: 16px;
  transition: transform 0.12s, color 0.12s;
}
.doc-cards-card:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}
.doc-cards-card:hover::after { color: var(--ink); transform: translateX(2px); }
.doc-cards-icon {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  margin-bottom: 14px;
}
.doc-cards-icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
/* Use spans (not h3/p) inside the anchor — marked v14 splits an
   <a> when it sees a block-level child like <h3> or <p>. The card
   structure becomes title + desc spans, displayed as blocks. */
.doc-cards-card .doc-cards-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
  color: var(--ink);
}
.doc-cards-card .doc-cards-desc {
  display: block;
  font-size: 13.5px;
  color: var(--slate);
  line-height: 1.5;
}

/* Step list — numbered explanations with a connecting rail.
   Authors write:
     <ol class="doc-steps">
       <li>
         <h3>Claim a subdomain.</h3>
         <p>Pick a handle. We check it's free.</p>
       </li>
       …
     </ol>
*/
.doc-steps {
  list-style: none;
  counter-reset: docstep;
  padding: 0;
  margin: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.doc-steps > li {
  counter-increment: docstep;
  position: relative;
  padding: 18px 18px 18px 64px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.doc-steps > li::before {
  content: counter(docstep);
  position: absolute;
  left: 18px;
  top: 18px;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--mint, #75FB90);
  display: inline-flex;
  align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}
.doc-steps > li h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
  color: var(--ink);
}
.doc-steps > li p {
  font-size: 14px;
  color: var(--slate);
  margin: 0;
  line-height: 1.55;
}
.doc-steps > li p + p { margin-top: 6px; }

/* Code block headers — when paired with <pre>, gives a "SHELL" /
   "JAVASCRIPT" label + Copy button. Authors write:
     <div class="doc-code">
       <header><span class="doc-code-lang">Shell</span><button class="doc-code-copy">Copy</button></header>
       <pre><code>…</code></pre>
     </div>
*/
.doc-code {
  background: #0a0a0b;
  color: #e9e9ea;
  border-radius: 12px;
  overflow: hidden;
  margin: 22px 0;
  border-left: 4px solid var(--mint, #75FB90);
}
.doc-code header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.doc-code-copy {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.7);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.doc-code-copy:hover { color: #fff; background: rgba(255,255,255,0.06); }
.doc-code pre {
  margin: 0;
  padding: 16px;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #e9e9ea;
  font-size: 13px;
  line-height: 1.55;
  overflow-x: auto;
}

/* ──────────────────────────────────────────────────────────────────
   Doc visual library — components for showing how things work, not
   just describing them. Each component is purely decorative; clicks /
   inputs do nothing. The point is the reader sees what they'll see
   in-app, rendered inline at brand-consistent fidelity.
   ────────────────────────────────────────────────────────────────── */

/* Faux UI block — drop a snapshot of an app surface inline. The "PREVIEW"
   ribbon top-right makes clear this is illustrative; the click cursor
   stays default so nothing reads as interactive. */
.doc-preview {
  position: relative;
  margin: 22px 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg, #f6f6f7);
  overflow: hidden;
  cursor: default;
}
.doc-preview * { cursor: default !important; }
.doc-preview::after {
  content: "PREVIEW";
  position: absolute;
  top: 10px; right: 12px;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--slate);
  background: rgba(255,255,255,0.85);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  z-index: 2;
}
.doc-preview-frame {
  background: #fff;
  margin: 28px 18px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 18px;
}
.doc-preview-caption {
  display: block;
  padding: 0 18px 14px;
  font-size: 12.5px;
  color: var(--slate);
  font-style: italic;
}

/* Faux form fields — render at the same scale as the real /app forms.
   Inputs are non-functional (readonly + tabindex=-1 in markup). */
.doc-mock-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.doc-mock-field { flex: 1 1 200px; min-width: 0; }
.doc-mock-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate);
  margin-bottom: 6px;
  display: block;
}
.doc-mock-input,
.doc-mock-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  pointer-events: none;
}
.doc-mock-input.is-empty { color: var(--slate); }
.doc-mock-hint {
  font-size: 11.5px;
  color: var(--slate);
  margin-top: 6px;
}
.doc-mock-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}
.doc-mock-btn.is-secondary { background: #fff; color: var(--ink); }
.doc-mock-btn.is-ghost { background: transparent; border-color: var(--line); color: var(--slate); }

/* Toggle widget mock — visualises an on/off control. */
.doc-mock-toggle {
  display: inline-flex; align-items: center; gap: 10px;
  pointer-events: none;
}
.doc-mock-toggle .t {
  display: inline-block;
  width: 44px; height: 24px;
  border-radius: 999px;
  background: rgba(10,10,11,0.18);
  position: relative;
}
.doc-mock-toggle .t::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
}
.doc-mock-toggle.is-on .t { background: var(--mint, #75FB90); }
.doc-mock-toggle.is-on .t::after { left: 22px; }
.doc-mock-toggle .l {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

/* "What's next" footer — three concrete next moves at the bottom of
   every doc. Replaces vague "see also" lists. Renders as 3 cards. */
.doc-next {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.doc-next-eyebrow {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 14px;
}
.doc-next-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.doc-next-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface, #fff);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.doc-next-card:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(10,10,11,0.06);
}
.doc-next-card .label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mint-deep, #1ABC4E);
  margin-bottom: 6px;
}
.doc-next-card .title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.doc-next-card .desc {
  font-size: 12.5px;
  color: var(--slate);
  line-height: 1.5;
}

/* Inline metadata strip at the top of a doc — audience pill + read
   time + prerequisites. Sits between the H1 description and the body. */
.doc-meta-strip {
  display: flex; flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 22px;
  padding: 8px 0 18px;
  border-bottom: 1px solid var(--line);
}
.doc-meta-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface, #fff);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 11px;
  color: var(--slate);
}
.doc-meta-pill strong { color: var(--ink); font-weight: 600; }
.doc-meta-pill svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.6; }

/* "Open in app" inline-link badge — always points at a /app/* path so
   the reader can jump directly to the surface a doc is describing. */
.doc-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 11px;
  margin: 0 2px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff !important;
  border-bottom: 0 !important;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none !important;
  letter-spacing: -0.005em;
  transition: background 0.15s ease, transform 0.15s ease;
}
.doc-open:hover { background: var(--black, #0A0A0B); transform: translateY(-1px); }
.doc-open::after { content: "↗"; font-weight: 400; opacity: 0.7; }

/* Key/value spec table — for showing config keys, env vars, or any
   "name → value" pair list. Cleaner than a markdown table. */
.doc-kv {
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.doc-kv-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 18px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.doc-kv-row:first-child { border-top: 0; }
.doc-kv-row dt {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 600;
}
.doc-kv-row dd {
  margin: 0;
  color: var(--slate);
  line-height: 1.55;
}

/* Inline "TRY IT" CTA — landed at the end of major how-to sections so
   the reader can leave the doc and go do the thing. */
.doc-try {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 0;
  padding: 16px 20px;
  background: var(--ink);
  color: #fff;
  border-radius: 12px;
  flex-wrap: wrap;
}
.doc-try .doc-try-text {
  flex: 1; min-width: 200px;
}
.doc-try .doc-try-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
}
.doc-try .doc-try-sub {
  font-size: 12.5px;
  color: rgba(255,255,255,0.7);
}
.doc-try-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--mint, #75FB90);
  color: var(--ink) !important;
  border-radius: 8px;
  border-bottom: 0 !important;
  font-weight: 700;
  font-size: 13.5px;
  text-decoration: none !important;
  transition: filter 0.15s ease;
}
.doc-try-btn:hover { filter: brightness(0.95); }
.doc-try-btn::after { content: "→"; }

/* Visual diagram cell — for inline SVG diagrams (light wrapper). */
.doc-diagram {
  margin: 22px 0;
  padding: 18px;
  background: var(--surface, #fff);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.doc-diagram svg { width: 100%; height: auto; max-width: 720px; display: block; margin: 0 auto; }
.doc-diagram-caption {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--slate);
  text-align: center;
  font-style: italic;
}
.doc-code pre code { background: transparent; padding: 0; color: inherit; border: 0; }
