/* ============================================================
   Dribs topic pages (/private-expense-tracker, /alternatives/…)
   Extends dribs-landing.css; generated by scripts/build-pages.mjs.
   ============================================================ */

html, body { margin: 0; background: var(--bg); }
body { -webkit-text-size-adjust: 100%; }

.dribs :focus-visible { outline: 2px solid var(--primary-display); outline-offset: 3px; border-radius: 6px; }
.dribs .d-btn:focus-visible { border-radius: 999px; }

.d-skip {
  position: absolute; left: 16px; top: -60px; z-index: 20;
  padding: 10px 16px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--card-border);
  font-size: 14px; font-weight: 600;
}
.d-skip:focus { top: 16px; }

/* ── Nav additions ── */
.d-brand-link { color: var(--text-primary) !important; }

/* ── Breadcrumb ── */
.d-crumbs { font-size: 13.5px; color: var(--text-tertiary); margin: 0 0 22px; }
.d-crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.d-crumbs li + li::before { content: "›"; margin-right: 6px; color: var(--text-tertiary); }
.d-crumbs a { color: var(--text-secondary) !important; }
.d-crumbs a:hover { color: var(--text-primary) !important; }
.d-crumbs [aria-current] { color: var(--text-tertiary); }

/* Topic hero is shorter than the homepage one */
.d-topic-hero .d-hero-split-grid { min-height: 520px; }
.d-topic-hero .d-h1 { font-size: clamp(36px, 4.8vw, 58px); }
.d-hero-sub strong { color: var(--text-primary); font-weight: 600; }

/* ── Section headings & prose ── */
.d-h2 { font-size: clamp(30px, 3.6vw, 42px); margin: 14px 0 0; }
.d-section-head { max-width: 680px; }
.d-section-head .d-sub { margin: 18px 0 0; }
.d-section-tight { padding-top: 40px; padding-bottom: 40px; }

.d-prose { max-width: 720px; }
.d-prose h3 { font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -0.01em; margin: 36px 0 10px; }
.d-prose p, .d-prose li { font-size: 16.5px; line-height: 1.7; color: var(--text-secondary); text-wrap: pretty; }
.d-prose p { margin: 14px 0 0; }
.d-prose ul, .d-prose ol { margin: 14px 0 0; padding-left: 22px; }
.d-prose li { margin: 8px 0; }
.d-prose strong { color: var(--text-primary); font-weight: 600; }
/* Links inside running text: underlined, and in dark mode the lighter brand
   indigo, since --primary-display is under 4.5:1 on the dark cards. */
.dribs { --link: var(--primary-lighter); }
@media (prefers-color-scheme: light) { .dribs { --link: var(--primary-display); } }
.d-prose a, .d-faq a, .d-table a, .d-callout a, .d-steps a, .d-sources a {
  color: var(--link) !important;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}

/* ── Feature grid variants ── */
.d-feature-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.d-feature-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
.d-feature .d-pro { margin-left: 8px; vertical-align: 2px; }
.d-pro {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--link); background: var(--overlay-light); border: 1px solid var(--card-border);
}

/* ── How it works: steps beside a screenshot ── */
.d-how { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 64px; align-items: center; margin-top: 56px; }
.d-how.flip { grid-template-columns: 0.9fr 1.1fr; }
.d-how.flip .d-how-art { order: -1; }
.d-how-art { display: flex; justify-content: center; }
.d-steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: flex; flex-direction: column; gap: 26px; }
.d-steps li { counter-increment: step; display: grid; grid-template-columns: 44px 1fr; gap: 18px; align-items: start; }
.d-steps li::before {
  content: counter(step);
  width: 44px; height: 44px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  color: var(--primary-display); background: var(--overlay-medium); border: 1px solid var(--hairline);
}
.d-steps h3 { margin: 2px 0 6px; font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.d-steps p { margin: 0; font-size: 15.5px; line-height: 1.6; color: var(--text-secondary); }
.d-shot-caption { margin: 18px auto 0; max-width: 280px; text-align: center; font-size: 13.5px; line-height: 1.5; color: var(--text-tertiary); }
.d-how-art figure { margin: 0; display: flex; flex-direction: column; align-items: center; }

/* <picture>-based screenshots: only the active color scheme is downloaded */
.d-phone-screen picture, .d-phone-screen picture img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ── Tables ── */
.d-table-wrap { margin-top: 36px; overflow-x: auto; border-radius: 24px; border: 1px solid var(--card-border); background: var(--card); }
.d-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.55; min-width: 620px; }
.d-table caption { text-align: left; padding: 20px 24px 6px; font-size: 13px; color: var(--text-tertiary); }
.d-table th, .d-table td { text-align: left; vertical-align: top; padding: 15px 24px; border-top: 1px solid var(--section-divider); color: var(--text-secondary); }
.d-table thead th { border-top: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-tertiary); }
.d-table tbody th { color: var(--text-primary); font-weight: 600; width: 24%; }
.d-table td.num, .d-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.d-table tr.total th, .d-table tr.total td { color: var(--text-primary); font-weight: 700; border-top: 1px solid var(--hairline); }
.d-table .neg { color: var(--expense-display); }
.d-table .pos { color: var(--income-display); }

/* ── Two-column "who is it for" ── */
.d-split { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 44px; }
.d-split .d-feature ul { margin: 0; padding-left: 20px; }
.d-split .d-feature li { font-size: 15px; line-height: 1.6; color: var(--text-secondary); margin: 6px 0; }

/* ── Callout ── */
.d-callout { padding: 26px 30px; margin-top: 40px; display: grid; grid-template-columns: 50px 1fr; gap: 20px; align-items: start; }
.d-callout h3 { margin: 4px 0 8px; font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.d-callout p { margin: 0; font-size: 15.5px; line-height: 1.65; color: var(--text-secondary); }
.d-callout p + p { margin-top: 10px; }

/* ── FAQ (always expanded: content is plain HTML, not behind JS) ── */
.d-faq { max-width: 820px; margin-top: 44px; border-top: 1px solid var(--section-divider); }
.d-faq-item { padding: 26px 0; border-bottom: 1px solid var(--section-divider); }
.d-faq h3 { margin: 0; font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.35; }
.d-faq p { margin: 10px 0 0; font-size: 16px; line-height: 1.7; color: var(--text-secondary); text-wrap: pretty; }

/* ── Related pages ── */
.d-related { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 36px; }
.d-related a {
  display: flex; flex-direction: column; gap: 8px; padding: 24px 26px; border-radius: 22px;
  background: var(--card); border: 1px solid var(--card-border);
  color: var(--text-primary) !important; transition: background .15s, border-color .15s;
}
.d-related a:hover { background: var(--overlay-medium); border-color: var(--hairline); }
.d-related strong { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.d-related span { font-size: 14.5px; line-height: 1.55; color: var(--text-secondary); }

/* ── Final CTA ── */
.d-final { text-align: center; padding: 64px 32px; }
.d-final .d-h2 { margin: 0 auto; max-width: 720px; }
.d-final .d-sub { margin: 16px auto 0; max-width: 560px; }
.d-final .d-cta { margin-top: 30px; }

/* ── Sources & review date (comparison pages) ── */
.d-sources { margin-top: 28px; }
.d-sources li { font-size: 14.5px; word-break: break-word; }
.d-reviewed { margin-top: 22px; font-size: 14px; color: var(--text-tertiary); }

/* ── Responsive ── */
@media (max-width: 940px) {
  .d-topic-hero .d-hero-split-grid { min-height: 0; }
  .d-crumbs ol { justify-content: center; }
  .d-how, .d-how.flip { grid-template-columns: 1fr; gap: 48px; }
  .d-how.flip .d-how-art { order: 0; }
  .d-split, .d-feature-grid.cols-2, .d-feature-grid.cols-4 { grid-template-columns: 1fr; }
  .d-related { grid-template-columns: 1fr; }
  .d-callout { grid-template-columns: 1fr; padding: 24px 22px; gap: 14px; }
  .d-final { padding: 48px 22px; }
  .d-table th, .d-table td { padding: 13px 16px; }
}
@media (max-width: 640px) {
  .d-hero-copy .d-cta-row, .d-final .d-cta-row { margin: 0 auto; }
  .d-cta-row .d-btn { white-space: normal; text-align: center; height: auto; min-height: 52px; padding: 12px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .dribs *, .dribs *::before, .dribs *::after { transition: none !important; animation: none !important; }
  .d-btn-primary:hover { transform: none; }
}
