/**
 * guides.css — Global styles for all long-form guide pages.
 *
 * Applied via guide-base.njk template. Every guide automatically
 * inherits these styles — no per-guide CSS needed unless truly
 * one-off.
 *
 * Import order: tokens.css → reset.css → layout.css → components.css → guides.css
 *
 * Class map:
 *   .guide-hero          — page hero wrapper (breadcrumb + badges + H1 + byline)
 *   .guide-h1            — main display headline (Fraunces, fluid type)
 *   .guide-h1-accent     — teal-colored subtitle line inside H1
 *   .guide-byline        — E-E-A-T author / sources bar
 *   .guide-callout       — "Short answer" AI-extractable answer box
 *   .guide-layout        — 2-column grid: article LEFT, TOC RIGHT
 *   .guide-toc           — sticky right-column sidebar
 *   .guide-toc__label    — "On this page" uppercase label
 *   .guide-toc__nav      — vertical TOC link list
 *   .guide-toc__card     — sidebar info cards (calcs, related guides)
 *   .guide-toc__card-title — card heading label
 *   .guide-article       — left-column article body
 *   .guide-formula       — teal/mono code-style formula block
 *   .guide-formula__label — "The formula" label inside formula block
 *   .guide-sources       — sources section list
 *   .guide-faq details   — FAQ accordion items
 *   .guide-faq summary   — FAQ question trigger
 */

/* ═══════════════════════════════════════════════════════════════
   HERO
═══════════════════════════════════════════════════════════════ */

.guide-hero {
  padding-block: var(--space-12) var(--space-6);
}

.guide-hero__badges {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-block: var(--space-5);
}

/* Main headline — Fraunces display, fluid from 36px → 60px */
.guide-h1 {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  max-width: 20ch;
  margin-bottom: var(--space-5);
}

/* Teal accent line — second line of the H1 */
.guide-h1-accent {
  color: var(--teal);
}

/* Lead paragraph below H1 */
.guide-lead {
  max-width: 60ch;
  margin-bottom: var(--space-6);
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--ink);
}

/* E-E-A-T author / sources bar */
.guide-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--teal-ghost);
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--text-sm);
  color: var(--ink-muted);
  max-width: 680px;
}

.guide-byline__name {
  color: var(--ink);
  font-weight: 600;
}

.guide-byline__sep {
  color: var(--rule);
}

/* ═══════════════════════════════════════════════════════════════
   DIRECT-ANSWER CALLOUT
   Designed for AI extraction (Google SGE, Perplexity, Bing AI)
═══════════════════════════════════════════════════════════════ */

.guide-callout-wrap {
  padding-block: 0 var(--space-6);
}

/* ═══════════════════════════════════════════════════════════════
   2-COLUMN LAYOUT  (article LEFT · TOC RIGHT)
   Overrides the base .content-with-sidebar which puts sidebar left.
═══════════════════════════════════════════════════════════════ */

.guide-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: var(--space-12);
  align-items: start;
}

/* Article goes first visually (left) */
.guide-article {
  order: 1;
  min-width: 0; /* prevent grid blowout */
}

/* TOC goes second visually (right) */
.guide-toc {
  order: 2;
}

/* ═══════════════════════════════════════════════════════════════
   STICKY TABLE-OF-CONTENTS SIDEBAR
═══════════════════════════════════════════════════════════════ */

.guide-toc__inner {
  position: sticky;
  top: calc(var(--nav-height, 60px) + var(--space-6));
}

/* "On this page" label */
.guide-toc__label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--space-4);
}

/* TOC link list */
.guide-toc__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.guide-toc__nav a {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  text-decoration: none;
  transition: color var(--duration-sm, 150ms) ease;
}

.guide-toc__nav a:hover {
  color: var(--teal);
}

/* Sidebar info cards */
.guide-toc__card {
  margin-top: var(--space-8);
  padding: var(--space-5);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.guide-toc__card--teal {
  background: var(--teal-ghost);
  border-left: 3px solid var(--teal);
}

.guide-toc__card--bordered {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}

.guide-toc__card-title {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}

.guide-toc__card--teal .guide-toc__card-title {
  color: var(--teal);
}

.guide-toc__card--bordered .guide-toc__card-title {
  color: var(--ink-muted);
}

.guide-toc__card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.guide-toc__card a {
  font-size: var(--text-sm);
  text-decoration: none;
  color: var(--ink-muted);
  transition: color var(--duration-sm, 150ms) ease;
}

.guide-toc__card a:hover {
  color: var(--teal);
}

/* ═══════════════════════════════════════════════════════════════
   ARTICLE HEADING HIERARCHY
   H2 → teal top border   H3 → gold left bar   H4 → uppercase label
═══════════════════════════════════════════════════════════════ */

/* H2 — major section break */
.guide-article h2.h2-editorial {
  margin-top: var(--space-20);
  margin-bottom: var(--space-6);
  padding-top: var(--space-8);
  border-top: 2px solid var(--teal);
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.2vw, 2.5rem);  /* 28px → 40px fluid */
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;
}

/* First H2 — no top border (it follows the callout) */
.guide-article h2.h2-editorial:first-of-type {
  margin-top: var(--space-8);
  padding-top: 0;
  border-top: none;
}

/* H3 — subsection with gold left accent bar */
.guide-article h3 {
  position: relative;
  padding-left: var(--space-4);
  margin-top: var(--space-16);
  margin-bottom: var(--space-5);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.4vw, 1.75rem);  /* 21px → 28px fluid */
  font-weight: 600;
  line-height: var(--leading-snug);
  text-wrap: balance;
}

.guide-article h3::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.2em;
  bottom: 0.2em;
  width: 3px;
  background: var(--gold);
  border-radius: 2px;
}

/* H4 — tight sub-subsection, uppercase small label style */
.guide-article h4 {
  font-family: var(--font-body);
  font-size: var(--text-base, 1rem);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: var(--space-10);
  margin-bottom: var(--space-3);
}

/* ═══════════════════════════════════════════════════════════════
   ARTICLE BODY TYPOGRAPHY
═══════════════════════════════════════════════════════════════ */

.guide-article p {
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--ink);
  margin-top: 0;
  margin-bottom: var(--space-8);   /* 32px between paragraphs — clearer breathing room */
}

.guide-article ul,
.guide-article ol {
  padding-left: var(--space-6);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-5);
}

.guide-article li {
  font-size: var(--text-md);
  color: var(--ink);
  margin-bottom: var(--space-3);
}

.guide-article strong {
  font-weight: 600;
  color: var(--ink);
}

/* Inline numbers / monospace values */
.guide-article code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--teal-ghost);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

/* ═══════════════════════════════════════════════════════════════
   FORMULA / CODE BLOCK
═══════════════════════════════════════════════════════════════ */

.guide-formula {
  background: var(--teal-ghost);
  border-left: 3px solid var(--teal);
  padding: var(--space-5);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-block: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--ink);
}

.guide-formula__label {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-2);
}

/* ═══════════════════════════════════════════════════════════════
   FAQ ACCORDION
═══════════════════════════════════════════════════════════════ */

.guide-faq {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.guide-faq details {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.2s ease;
}

.guide-faq details[open] {
  border-color: var(--teal);
}

.guide-faq summary {
  padding: var(--space-5) var(--space-6);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  user-select: none;
}

.guide-faq summary::-webkit-details-marker { display: none; }

/* Chevron indicator */
.guide-faq summary::after {
  content: '+';
  font-size: var(--text-xl);
  font-weight: 300;
  color: var(--teal);
  flex-shrink: 0;
  transition: transform 0.2s ease;
  line-height: 1;
}

.guide-faq details[open] summary::after {
  content: '−';
}

.guide-faq details > div {
  padding: 0 var(--space-6) var(--space-5);
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--ink-muted);
}

.guide-faq details > div p:last-child {
  margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════════
   SOURCES SECTION
═══════════════════════════════════════════════════════════════ */

.guide-sources {
  border-top: 1px solid var(--rule);
  margin-top: var(--space-12);
  padding-top: var(--space-8);
}

.guide-sources ol {
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.guide-sources li {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  line-height: var(--leading-normal);
}

.guide-sources a {
  color: var(--teal);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s ease;
}

.guide-sources a:hover {
  text-decoration-color: var(--teal);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — collapse to single column on tablet/mobile
═══════════════════════════════════════════════════════════════ */

@media (max-width: 860px) {
  .guide-layout {
    grid-template-columns: 1fr;
  }

  /* Move TOC above article on mobile */
  .guide-toc {
    order: 1;
  }

  .guide-article {
    order: 2;
  }

  .guide-toc__inner {
    position: static;
  }

  .guide-toc__card {
    display: none; /* hide sidebar cards on mobile — they're inline in content */
  }

  .guide-h1 {
    font-size: clamp(1.875rem, 7vw, 2.5rem);
  }
}

/* ═══════════════════════════════════════════════════════════════
   GUIDE ARTICLE — DATA TABLES
   Applies to every <table> inside .guide-article (via .table-scroll wrapper).
   No class needed on individual tables — all guides inherit this.
═══════════════════════════════════════════════════════════════ */

.guide-article .table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-block: var(--space-5) var(--space-6);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}

.guide-article .table-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  min-width: 420px;
  background: var(--surface);
}

/* Header row */
.guide-article .table-scroll thead tr {
  background: var(--teal);
}

.guide-article .table-scroll th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  color: #fff;
  border-right: 1px solid rgba(255,255,255,0.15);
  white-space: nowrap;
}

.guide-article .table-scroll th:last-child {
  border-right: none;
}

/* Body cells */
.guide-article .table-scroll td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  color: var(--ink);
  vertical-align: top;
}

.guide-article .table-scroll td:last-child {
  border-right: none;
}

.guide-article .table-scroll tr:last-child td {
  border-bottom: none;
}

/* Zebra striping */
.guide-article .table-scroll tbody tr:nth-child(even) td {
  background: var(--paper);
}

.guide-article .table-scroll tbody tr:hover td {
  background: var(--teal-ghost, rgba(15,118,110,0.06));
}

/* First column: slightly bolder — acts as row label */
.guide-article .table-scroll td:first-child {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

/* Total / summary row (class="table-total" on tr) */
.guide-article .table-scroll tr.table-total td {
  background: var(--teal-ghost, rgba(15,118,110,0.08)) !important;
  font-weight: 700;
  border-top: 2px solid var(--teal);
  color: var(--ink);
}

/* Center-align utility used inside tables */
.guide-article .table-scroll td.tc,
.guide-article .table-scroll th.tc { text-align: center; }

/* Table caption / source note (p.table-note below table) */
.guide-article .table-note {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  margin-top: calc(-1 * var(--space-4));
  margin-bottom: var(--space-6);
  line-height: var(--leading-normal);
}

/* ═══════════════════════════════════════════════════════════════
   DARK THEME
═══════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Formula block */
    --guide-formula-bg: rgba(15, 118, 110, 0.12);
  }
}

:root[data-theme="dark"] {
  --guide-formula-bg: rgba(15, 118, 110, 0.12);
}

/* ═══════════════════════════════════════════════════════════════
   GUIDES HUB — CARDS + PAGINATION
   Used by /guides/ paginated hub page (index.njk)
═══════════════════════════════════════════════════════════════ */

/* ── Guide Hub Cards ── */
.guide-hub-card {
  display: block;
  text-decoration: none;
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}
.guide-hub-card:hover,
.guide-hub-card--hover {
  border-color: var(--teal);
  box-shadow: 0 2px 8px rgba(15,118,110,0.12);
}
.guide-hub-card--soon {
  background: var(--paper);
  opacity: 0.72;
  cursor: default;
}
.guide-hub-card__num {
  display: block;
  font-size: var(--text-xs);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--ink-muted);
  margin-bottom: var(--space-2);
  letter-spacing: var(--tracking-wide);
}
.guide-hub-card__badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  background: var(--rule);
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: var(--space-2);
}
.guide-hub-card__title {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-2);
  line-height: 1.3;
  font-size: var(--text-md);
}
.guide-hub-card--soon .guide-hub-card__title {
  color: var(--ink-muted);
}
.guide-hub-card__desc {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  line-height: 1.55;
  margin-bottom: 0;
}
.guide-hub-card__cta {
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--teal);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: 0;
}

/* ── Pagination Nav ── */
.guides-pagination {
  padding-block: var(--space-10) var(--space-14);
  border-top: 1px solid var(--rule);
  margin-top: var(--space-10);
}
.guides-pagination__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.guides-pagination__btn {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-5);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.guides-pagination__btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.guides-pagination__btn--disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}
.guides-pagination__pages {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
  justify-content: center;
}
.guides-pagination__page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.guides-pagination__page:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.guides-pagination__page--active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  font-weight: 700;
  cursor: default;
  pointer-events: none;
}
.guides-pagination__ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  font-size: var(--text-sm);
  color: var(--ink-muted);
  user-select: none;
}


/* ── Category Navigation Bar ── */
.guides-cat-nav {
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.guides-cat-nav__scroll {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-block: var(--space-3);
}
.guides-cat-nav__chip {
  display: inline-block;
  padding: 0.35em 0.9em;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid var(--rule);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  scroll-snap-align: start;
}
.guides-cat-nav__chip:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.guides-cat-nav__chip--active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  font-weight: 700;
}
.guides-cat-nav__chip--active:hover {
  color: #fff;
}
