/* Shared article system for guides, comparisons and legal pages. */
.seo-page,
.legal.article-page { padding-bottom: 92px; }
body:has(.article-page) .brand { min-height: 44px; }
body:has(.article-page) .site-foot a { display: inline-flex; align-items: center; min-height: 44px; }

.article-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  padding-bottom: 48px;
}
.article-hero h1 { max-width: 18ch; margin-bottom: 20px; }
.article-hero .lead { max-width: 68ch; }
.seo-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.seo-nav a { display: inline-flex; align-items: center; min-height: 44px; font-size: .88rem; }
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 24px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
}
.article-meta span { display: inline-flex; align-items: center; gap: 8px; }
.article-meta span + span::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }

.article-toc {
  align-self: start;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}
.article-toc-mobile { display: none; }
.toc-title {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.article-toc summary { list-style: none; }
.article-toc summary::-webkit-details-marker { display: none; }
.article-toc summary::after { content: "+"; float: right; color: var(--accent-deep); font-size: 1rem; }
.article-toc[open] summary::after { content: "−"; }
.article-toc-mobile:not([open]) ol { display: none; }
.article-toc ol { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.article-toc a {
  display: block;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: .86rem;
  text-decoration: none;
}
.article-toc a:hover { background: var(--accent-soft); color: var(--accent-deep); }

.article-body,
.legal-body { display: grid; gap: 32px; min-width: 0; max-width: 72ch; }
.article-body > *,
.legal-body > * { min-width: 0; max-width: 100%; }
.article-body section,
.legal-body section { scroll-margin-top: 96px; }
.article-body h2,
.legal-body h2 { margin-bottom: 12px; font-size: clamp(1.45rem, 4vw, 2rem); }
.article-body h3,
.legal-body h3 { margin: 20px 0 8px; }
.article-body p:last-child,
.legal-body p:last-child { margin-bottom: 0; }
.article-body ul,
.legal-body ul { margin: 0 0 16px; padding-inline-start: 22px; }
.article-body li,
.legal-body li { margin: 8px 0; }
.article-body a,
.legal-body a { overflow-wrap: anywhere; }

.short-answer {
  border-inline-start: 3px solid var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
}
.callout { margin: 4px 0; }
.source-section {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.source-list {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding-inline-start: 22px;
  list-style: none;
  counter-reset: source-note;
}
.source-list li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 4px; margin: 0; padding-inline-start: 0; counter-increment: source-note; }
.source-list li::before { content: counter(source-note); color: var(--accent-deep); font-weight: 700; }
.source-list a { display: inline-flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
.last-reviewed { color: var(--muted); font-size: .86rem; }

.article-table { width: 100%; min-width: 100%; border-collapse: collapse; font-size: .92rem; }
.article-table th,
.article-table td {
  min-width: 150px;
  padding: 12px;
  border-top: 1px solid var(--line);
  text-align: start;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: normal;
}
.article-table th:first-child,
.article-table td:first-child { min-width: 160px; }
.article-table th:first-child,
.article-table td:first-child {
  width: 128px;
  min-width: 128px;
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: var(--card);
  box-shadow: 8px 0 10px -10px var(--ink);
}
.article-table th {
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.table-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 16px 0 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: inset -16px 0 14px -18px var(--ink);
}
.table-wrap::before {
  content: "Swipe to see more";
  display: none;
  padding: 8px 12px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
}
.table-wrap::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset-block: 0;
  inset-inline-end: 0;
  width: 24px;
  background: linear-gradient(to left, var(--card) 8%, transparent);
  pointer-events: none;
}
.table-wrap:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.table-wrap table { margin: 8px 0 0; }
.compare-page .table-wrap table { min-width: 720px; }
.table-hint { margin: 0; padding: 8px 12px 0; color: var(--muted); font-size: .78rem; }

.related-section {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.related-section h2 { margin-bottom: 16px; }
.related-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.related-grid a { color: var(--ink); text-decoration: none; }
.related-grid a:hover { color: var(--accent); }
.related-grid .card.tap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  grid-template-rows: auto auto;
  align-items: center;
  min-height: 96px;
  padding: 14px 14px 14px 16px;
  box-shadow: none;
}
.related-grid .card strong { grid-column: 1; font-family: var(--heading); font-size: 1.04rem; }
.related-grid .card > span:not(.related-arrow) { grid-column: 1; color: var(--muted); font-size: .88rem; font-weight: 500; line-height: 1.45; }
.related-arrow { grid-column: 2; grid-row: 1 / -1; align-self: center; display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--accent-deep); font-size: 1.25rem; }
.related-grid .card.tap:hover .related-arrow { border-color: var(--accent); background: var(--accent-soft); }

.article-cta {
  display: grid;
  gap: 16px;
  padding: 24px;
  background: var(--ink-panel);
  color: #FFFFFF;
  border-color: var(--ink-panel);
  box-shadow: none;
}
.article-cta h2 { color: #FFFFFF; max-width: 18ch; }
.article-cta .btn { justify-self: start; }

.index-page .article-hero { padding-bottom: 32px; }
.index-page .article-body { max-width: none; }
.index-page .article-body > section:not(.source-section):not(.article-cta) { max-width: 72ch; }
.index-page .article-body > section:has(.related-grid) { max-width: none; }
.index-page .related-grid { max-width: 100%; }
.index-page .related-grid .card.tap { align-items: flex-start; min-height: 112px; flex-direction: column; justify-content: space-between; }

.article-content-grid { display: grid; gap: 40px 64px; align-items: start; }
.article-content-grid > .article-toc-desktop { grid-column: 2; grid-row: 1; position: sticky; top: 92px; }
.article-content-grid .article-body { display: contents; max-width: none; }
.article-content-grid .article-body > * { grid-column: 1; min-width: 0; }
.article-content-grid .article-body > .article-cta { grid-column: 1 / -1; width: auto; max-width: none; }

.legal.article-page .hero { padding-bottom: 48px; }
.legal.article-page .hero h1 { max-width: none; }
.legal.article-page .hero .muted { max-width: 42ch; }
.article-page summary { min-height: 44px; }
.legal-body { gap: 0; }
.legal-body h2 { margin-top: 32px; }
.legal-body h2:first-child { margin-top: 0; }
.legal-body + .disclaimer { max-width: 72ch; margin-top: 32px; }
.legal.article-page .site-foot { padding-top: 48px; }

@media (min-width: 600px) {
  .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .legal.article-page .article-hero { padding-bottom: 96px; }
  .seo-page .article-hero { padding-bottom: 24px; }
  .seo-page .article-content-grid { display: block; }
  .seo-page .article-content-grid > .article-toc-desktop { display: none; }
  .seo-page .article-content-grid > .article-toc-mobile { display: block; position: static; margin-bottom: 24px; padding: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .seo-page .article-content-grid > .article-toc-mobile[open] { padding-bottom: 8px; }
  .seo-page .article-content-grid > .article-toc-mobile .toc-title { min-height: 44px; display: flex; align-items: center; margin: 0; padding: 0 4px; }
  .seo-page .article-content-grid > .article-toc-mobile ol { padding-bottom: 4px; }
  .seo-page .article-content-grid > .article-toc-mobile:not([open]) ol { display: none; }
  .seo-page .table-wrap::before { display: block; }
  .seo-page .article-content-grid .article-body { display: grid; gap: 32px; max-width: 72ch; }
  .seo-page .article-content-grid .article-body > .article-cta { grid-column: auto; }
  .seo-page .article-content-grid .article-cta { margin-top: 0; }
  .seo-page .related-grid .card.tap { min-height: 88px; }
}

@media (min-width: 768px) {
  .article-hero { grid-template-columns: minmax(0, 1fr); gap: 64px; }
  .article-content-grid { grid-template-columns: minmax(0, 72ch) 240px; }
  .article-body,
  .legal-body { gap: 40px; }
  .index-page .article-body { gap: 40px; }
  .index-page .related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .index-page .article-hero { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .article-content-grid { display: block; }
  .article-content-grid > .article-toc-desktop { position: static; margin-bottom: 32px; }
  .article-content-grid .article-body { display: grid; gap: 40px; max-width: 72ch; }
  .article-content-grid .article-body > .article-cta { grid-column: auto; }
}

/* Keep this owned footer aligned with the shared page measure until SHELL's container fix lands. */
.seo-page ~ .site-foot { max-width: 1160px; margin-inline: auto; padding: 48px 20px 12px; border-top: 1px solid var(--line); }
@media (min-width: 768px) {
  .seo-page ~ .site-foot { padding-inline: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .article-toc a { scroll-behavior: auto; }
}
