/* Docs + changelog page styles. Layered on top of /styles.css. */

.brand-back { gap: 10px; padding: 4px 4px 4px 2px; border-radius: 8px; 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(--muted);
  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(--border-soft);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(120%) blur(8px);
}
.docs-nav { display: flex; gap: 18px; align-items: center; }
.dh-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.005em;
  padding: 8px 4px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.dh-link:hover { color: var(--text-2); }
.dh-link.is-active { color: var(--ink); border-bottom-color: var(--ink); }

.docs-page {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(32px, 6vw, 64px) var(--gutter);
}

.docs-hero { margin-bottom: clamp(28px, 4vw, 44px); }
.docs-hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.035em;
  margin-bottom: 8px;
}
.docs-lead {
  color: var(--muted);
  font-size: clamp(15px, 1.5vw, 17px);
  max-width: 56ch;
  margin-bottom: 22px;
}

/* ── Search ─────────────────────────────────────────────────────── */
.docs-search-wrap { position: relative; max-width: 480px; }
.docs-search {
  width: 100%;
  padding: 12px 16px;
  font: inherit;
  font-size: 14.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
}
.docs-search::placeholder { color: var(--muted-2); }
.docs-search:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(10,10,11,0.08); }

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

/* ── Index groups + grid ────────────────────────────────────────── */
.docs-group + .docs-group { margin-top: 36px; }
.docs-group-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.doc-card {
  position: relative;
  display: flex; align-items: flex-start; gap: 16px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.14s, transform 0.06s, box-shadow 0.14s;
  overflow: hidden;
}
.doc-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--brand-accent, #75FB90) 0%, transparent 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.doc-card:hover {
  border-color: rgba(10,10,11,0.22);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.doc-card:hover::after { opacity: 0.06; }
.doc-card:active { transform: none; }

.doc-card-icon {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: #f4f4f6;
  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: 19px; height: 19px; }
.doc-card:hover .doc-card-icon { background: var(--ink); color: #fff; }

.doc-card-text { flex: 1; min-width: 0; }
.doc-card-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
  padding-right: 18px;
}
.doc-card-head h3 {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.018em;
  flex: 1;
  min-width: 0;
  color: var(--ink);
}
.doc-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}
.doc-card-arrow {
  position: absolute;
  top: 22px; right: 18px;
  font-size: 14px;
  color: var(--muted-2);
  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: 48px;
}
.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(--border-soft);
  font-size: 13px;
}
@media (max-width: 960px) { .doc-toc { display: none; } }
.doc-toc-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  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(--muted);
  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-size: 13px;
  color: var(--muted);
}
.doc-crumbs a { color: var(--muted); }
.doc-crumbs a:hover { color: var(--ink); }

.doc-article-head { margin-bottom: 28px; padding-bottom: 22px; border-bottom: 1px solid var(--border-soft); }
.doc-article-head h1 {
  font-size: clamp(32px, 4.5vw, 42px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin-bottom: 10px;
}
.doc-article-desc {
  font-size: clamp(15px, 1.4vw, 17px);
  color: var(--muted);
  line-height: 1.55;
  max-width: 60ch;
}

.doc-article-body { font-size: 15.5px; line-height: 1.72; color: var(--text-2); }
.doc-article-body p { margin: 0 0 16px; }
.doc-article-body h2 {
  font-size: clamp(20px, 2.4vw, 24px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 36px 0 12px;
  scroll-margin-top: 80px;
  position: relative;
}
.doc-article-body h3 {
  font-size: clamp(16px, 1.8vw, 18px);
  font-weight: 700;
  letter-spacing: -0.01em;
  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(--muted-2);
  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(--border);
  padding-bottom: 1px;
  transition: border-color 0.12s;
}
.doc-article-body a:hover { border-bottom-color: var(--ink); }

.doc-article-body ul, .doc-article-body ol { margin: 0 0 18px 1.4em; }
.doc-article-body li { margin-bottom: 6px; }

.doc-article-body code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  background: #f4f4f6;
  color: var(--ink);
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--border-soft);
}
.doc-article-body pre {
  background: #0a0a0b;
  color: #e8e8ea;
  padding: 16px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 18px;
}
.doc-article-body pre code {
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.doc-article-body .table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 18px;
}
.doc-article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.doc-article-body th, .doc-article-body td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.doc-article-body th { background: #fafafa; font-weight: 600; color: var(--ink); }
.doc-article-body tbody tr:last-child td { border-bottom: 0; }

/* ── Callouts ───────────────────────────────────────────────────── */
.callout {
  margin: 18px 0;
  padding: 14px 18px;
  border-left: 3px solid var(--ink);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #fafafa;
}
.callout p { margin: 0 0 8px; }
.callout p:last-child { margin-bottom: 0; }
.callout-info    { border-left-color: #4b6bff; background: #eef1ff; }
.callout-tip     { border-left-color: #0a8a4f; background: var(--mint-soft); }
.callout-success { border-left-color: #0a8a4f; background: var(--mint-soft); }
.callout-warn    { border-left-color: #c98300; background: #fff8e6; }
.callout-danger  { border-left-color: var(--danger); background: var(--danger-soft); }

/* ── Audience badge ─────────────────────────────────────────────── */
.aud-badge {
  display: inline-flex; align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: #f4f4f6;
  color: var(--text-2);
  margin-left: 8px;
  vertical-align: middle;
}
/* Business + admin badges pick up the tenant's accent on their domain. */
.aud-business { background: var(--brand-accent); color: var(--ink); }
.aud-user     { background: #eef1ff; color: #2c44b0; }
.aud-admin    { background: #fff8e6; color: #8a5b00; }

/* ── Changelog timeline ─────────────────────────────────────────── */
.docs-page-wide { max-width: 1040px; }

/* Filter pills */
.cl-filters {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 22px;
  padding: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-pill);
  width: fit-content;
}
.cl-filter {
  background: transparent;
  border: 0;
  padding: 7px 14px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: 6px;
  text-transform: capitalize;
  transition: background-color 0.12s, color 0.12s;
}
.cl-filter:hover { color: var(--ink); }
.cl-filter.is-active { background: var(--ink); color: #fff; }
.cl-filter-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font-size: 10.5px; font-weight: 700;
  background: rgba(0,0,0,0.06);
  border-radius: 999px;
  color: inherit;
}
.cl-filter.is-active .cl-filter-count { background: rgba(255,255,255,0.18); color: #fff; }

/* Timeline */
.cl-timeline {
  position: relative;
  display: flex; flex-direction: column;
  gap: 28px;
  padding-left: 0;
}

.cl-entry {
  position: relative;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  transition: opacity 0.18s;
}
.cl-entry.is-hidden { display: none; }

/* Vertical rail line — drawn between dots, runs through the rail column. */
.cl-timeline::before {
  content: "";
  position: absolute;
  left: 138px;          /* 132 (rail) + 6 (half dot) */
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--border) 12px, var(--border) calc(100% - 12px), transparent);
  pointer-events: none;
}

.cl-rail {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 4px;
  padding-top: 2px;
  padding-right: 18px;
  text-align: right;
}
.cl-rail .cl-version {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: #f4f4f6;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}
.cl-date {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: -0.005em;
}

/* Dot — bridges the rail line to the card. */
.cl-dot {
  position: absolute;
  right: -7px; top: 8px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--border);
  z-index: 1;
}
.cl-dot-added    { background: var(--brand-accent); }
.cl-dot-changed  { background: #4b6bff; }
.cl-dot-improved { background: var(--ink); }
.cl-dot-fixed    { background: #c98300; }
.cl-dot-removed  { background: var(--danger); }
.cl-dot-default  { background: var(--muted); }

/* Card */
.cl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.14s, box-shadow 0.14s;
}
.cl-card:hover { border-color: rgba(10,10,11,0.18); }

.cl-head { margin-bottom: 14px; }
.cl-head h2 {
  font-size: clamp(17px, 2.1vw, 20px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 8px;
}
.cl-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cl-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: #f4f4f6;
  color: var(--text-2);
}
/* `added` picks up the agency's accent. Others use semantic colours. */
.cl-tag-added    { background: var(--brand-accent); color: var(--ink); }
.cl-tag-changed  { background: #eef1ff; color: #2c44b0; }
.cl-tag-improved { background: #f4f4f6; color: var(--text-2); }
.cl-tag-fixed    { background: #fff8e6; color: #8a5b00; }
.cl-tag-removed  { background: var(--danger-soft); color: var(--danger); }
.cl-version { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.cl-body { font-size: 14.5px; line-height: 1.7; color: var(--text-2); }
.cl-body p { margin: 0 0 12px; }
.cl-body p:last-child { margin-bottom: 0; }
.cl-body ul, .cl-body ol { margin: 0 0 14px 1.4em; }
.cl-body strong { color: var(--ink); font-weight: 700; }
.cl-body a { color: var(--ink); border-bottom: 1px solid var(--border); }
.cl-body a:hover { border-bottom-color: var(--ink); }
.cl-body code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: #f4f4f6;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--border-soft);
  color: var(--ink);
}

/* Mobile — collapse rail under the card. */
@media (max-width: 720px) {
  .cl-timeline::before { display: none; }
  .cl-entry {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .cl-rail {
    flex-direction: row; align-items: center;
    text-align: left;
    padding: 0;
    gap: 10px;
  }
  .cl-dot { position: static; right: auto; top: auto; flex-shrink: 0; }
}

/* ── Footer ─────────────────────────────────────────────────────── */
.docs-footer {
  border-top: 1px solid var(--border-soft);
  padding: 24px var(--gutter);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
