/* 00-base.css */
/* Site-wide additions that every generated page relies on. Concatenated first into /pages.css. */

/* Nav: five links no longer fit beside the wordmark on a phone, so the row wraps and scrolls instead of vanishing. */
.masthead nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.35em; }
@media (max-width: 640px) {
  .masthead .wrap { flex-wrap: wrap; row-gap: 0; padding-block: 0.75rem 0; min-height: 0; }
  .masthead nav { width: 100%; gap: 1.25rem; overflow-x: auto; padding-block: 0.6rem 0.75rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .masthead nav::-webkit-scrollbar { display: none; }
  .masthead nav .navlink { display: inline; white-space: nowrap; }
}

/* Score bars on static pages grow in with CSS only (the homepage keeps its scroll-triggered version). */
@keyframes bar-grow { from { width: 0; } }
.fill-in { animation: bar-grow 800ms cubic-bezier(0.4, 0, 0.2, 1) both; }

.crumb-here { color: var(--muted); }
.tp-quote-note { margin-left: auto; font-style: italic; }
.calc-note { font-size: 0.75rem; margin: 0.6rem 0 0; }
.calc-field input { width: 5rem; }

/* Page header used by generated reference pages */
.pg-head { padding-top: 1.25rem; }
.pg-head h1 { font-size: clamp(2rem, 1.4rem + 2.5vw, 3rem); line-height: 1.1; }

/* Plain data tables */
.table-scroll { overflow-x: auto; margin-top: 1.5rem; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.data-table caption { text-align: left; font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding-bottom: 0.6rem; }
.data-table th, .data-table td { text-align: left; padding: 0.6rem 1rem 0.6rem 0; border-bottom: 1px solid var(--rule-2); white-space: nowrap; }
.data-table thead th { font-weight: 500; font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--rule); }
.data-table tbody th { font-family: var(--serif); font-weight: 400; font-size: 1rem; }
.data-table tbody th a { text-decoration: none; }
.data-table tbody th a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.data-table .num { text-align: right; padding-right: 0; padding-left: 1rem; }

/* Changelog */
.changelog-entry { padding-block: 2rem; border-top: 1px solid var(--rule); }
.changelog-entry h2 { font-size: 1.5rem; margin: 0.5rem 0 1rem; }
.changelog-entry ul { margin: 0; padding-left: 1.2rem; color: var(--ink-2); font-size: 1rem; }
.changelog-entry li { margin-bottom: 0.6rem; }

/* The scoring formula must never widen the page: let its column shrink and the equation wrap on small screens. */
.formula > * { min-width: 0; }
@media (max-width: 720px) { .formula .eq { white-space: normal; } }

/* 10-components.css */
/* Shared components for category, comparison and tool pages. */

:root { --neg: #8b5c3a; --b-tool: #6d7f94; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --neg: #b07a52; --b-tool: #93a7bf; } }
:root[data-theme="dark"] { --neg: #b07a52; --b-tool: #93a7bf; }

.pg-hero { background: var(--paper-2); padding-block: clamp(1.5rem, 4vw, 3rem) clamp(2.5rem, 5vw, 4rem); }
.pg-hero .tp-crumb { padding-top: 0; margin-bottom: 1.5rem; }
.pg-hero h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.25rem); line-height: 1.08; letter-spacing: -0.012em; max-width: 22ch; text-wrap: balance; margin-bottom: 1.1rem; }
.pg-hero .lede { max-width: var(--measure); }
.pg-stamp { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); margin-top: 1.25rem; }
.pg-section { padding-block: clamp(2.5rem, 5vw, 4rem); }
.pg-section + .pg-section { border-top: 1px solid var(--rule-2); }
.pg-section.tint { background: var(--paper-2); border-top: 0; }
.pg-section.tint + .pg-section { border-top: 0; }
.pg-section > .wrap > h2 { margin-bottom: 0.6rem; }
.pg-section > .wrap > .sec-dek { color: var(--ink-2); max-width: var(--measure); margin-bottom: 1.75rem; }

/* Answer box */
.answer { background: var(--paper); border: 1px solid var(--rule); border-left: 4px solid var(--accent); border-radius: 8px; padding: 1.25rem 1.5rem; max-width: 52rem; margin-top: 2rem; }
.answer .label { margin-bottom: 0.6rem; }
.answer p:not(.label) { font-size: 1.0625rem; margin-bottom: 0.6rem; }
.answer ul { margin: 0.5rem 0 0; padding-left: 1.15rem; font-family: var(--sans); font-size: 0.9375rem; color: var(--ink-2); }
.answer li { margin-bottom: 0.3rem; }
.answer strong { font-weight: 600; }

.entry-meta { margin: 0.5rem 0 0; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.entry-meta .tie { color: var(--ink-2); }
.ledger-static .entry:first-child { background: var(--accent-soft); }

/* Topic bars */
.topic-bars { display: grid; gap: 0.5rem; max-width: 52rem; }
.tb-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 4rem; align-items: center; gap: 0.9rem; font-family: var(--sans); font-size: 0.875rem; }
.tb-label { color: var(--ink-2); }
.tb-n, .tm-n { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-n { text-align: right; }
.tb-none, .tm-none { grid-column: 2 / -1; font-size: 0.8125rem; color: var(--muted); font-style: italic; }
.tb-bar, .tm-bar { display: flex; height: 1.75rem; border-radius: 5px; overflow: hidden; background: var(--rule-2); }
.tb-seg { height: 100%; display: flex; align-items: center; justify-content: center; font-family: var(--sans); font-size: 0.6875rem; font-weight: 600; min-width: 0; overflow: hidden; }
.tb-seg[data-s="positive"] { background: var(--accent); color: var(--accent-ink); }
.tb-seg[data-s="neutral"] { background: var(--muted); opacity: 0.35; }
.tb-seg[data-s="negative"] { background: var(--neg); color: #f6f3ec; }
.chart-key { margin: 1rem 0 0; font-size: 0.75rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.9rem; max-width: 52rem; }
.key-dot { display: inline-block; width: 0.625rem; height: 0.625rem; border-radius: 50%; margin-right: -0.5rem; }
.key-dot[data-s="positive"] { background: var(--accent); }
.key-dot[data-s="neutral"] { background: var(--muted); opacity: 0.4; }
.key-dot[data-s="negative"] { background: var(--neg); }
.key-note { flex-basis: 100%; }
.key-line { display: inline-block; width: 1.25rem; height: 3px; border-radius: 2px; margin-right: -0.4rem; vertical-align: middle; }
.key-line.tc-s0 { background: var(--accent); }
.key-line.tc-s1 { background: var(--b-tool); }

/* Mirrored topic comparison */
.topic-mirror { max-width: 60rem; font-family: var(--sans); }
.tm-head, .tm-row { display: grid; grid-template-columns: minmax(0, 1fr) 11rem minmax(0, 1fr); gap: 1rem; align-items: center; }
.tm-head { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-bottom: 0.6rem; border-bottom: 1px solid var(--rule); }
.tm-head span:first-child { text-align: right; }
.tm-row { padding: 0.55rem 0; border-bottom: 1px solid var(--rule-2); }
.tm-side { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.tm-side-a { flex-direction: row-reverse; }
.tm-bar { flex: 1; min-width: 0; }
.tm-bar.tm-a { flex-direction: row-reverse; }
.tm-mid { text-align: center; display: grid; gap: 0.1rem; }
.tm-label { font-size: 0.875rem; color: var(--ink); }
.tm-state { font-size: 0.6875rem; color: var(--muted); }
.tm-row[data-state="lead"] .tm-state { color: var(--accent); font-weight: 600; }
.tm-none { grid-column: auto; flex: 1; }
.tm-side-a .tm-none { text-align: right; }

/* Preference split */
.split { display: flex; height: 2.25rem; border-radius: 6px; overflow: hidden; background: var(--rule-2); max-width: 52rem; }
.split-seg { display: flex; align-items: center; justify-content: center; font-family: var(--sans); font-size: 0.8125rem; font-weight: 600; min-width: 0; overflow: hidden; }
.split-seg[data-k="a"] { background: var(--accent); color: var(--accent-ink); }
.split-seg[data-k="none"] { background: color-mix(in srgb, var(--muted) 35%, transparent); color: var(--ink-2); }
.split-seg[data-k="b"] { background: var(--b-tool); color: #fff; }
.split-key { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.75rem; color: var(--muted); margin-top: 0.5rem; max-width: 52rem; }
.split-key span:nth-child(2) { text-align: center; }
.split-key span:last-child { text-align: right; }

/* Trend chart */
.trend { margin: 0; max-width: 52rem; }
.trend svg { width: 100%; height: auto; display: block; }
.tc-grid { stroke: var(--rule-2); stroke-width: 1; }
.tc-axis { font-family: var(--sans); font-size: 10px; fill: var(--muted); }
.tc-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.tc-line.tc-s0 { stroke: var(--accent); }
.tc-line.tc-s1 { stroke: var(--b-tool); }
.tc-dot.tc-s0 { fill: var(--accent); }
.tc-dot.tc-s1 { fill: var(--b-tool); }
.tc-val { font-family: var(--sans); font-size: 11px; font-weight: 600; }
.tc-val.tc-s0 { fill: var(--accent); }
.tc-val.tc-s1 { fill: var(--b-tool); }
.trend figcaption { font-size: 0.75rem; margin-top: 0.5rem; }
.chart-data { margin-top: 0.75rem; font-family: var(--sans); font-size: 0.8125rem; }
.chart-data summary { cursor: pointer; color: var(--accent); }

/* Cards and link grids */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.link-card { display: flex; flex-direction: column; gap: 0.3rem; background: var(--paper); padding: 1rem 1.15rem; text-decoration: none; color: var(--ink); transition: background 120ms; }
.link-card:hover { background: var(--paper-2); }
.lc-title { font-family: var(--serif); font-size: 1.0625rem; line-height: 1.25; }
.lc-meta { font-family: var(--sans); font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.lc-note { font-family: var(--sans); font-size: 0.8125rem; color: var(--ink-2); }
.lc-tie { color: var(--muted); }
.lc-lead { color: var(--accent); }

.method-note { font-size: 0.8125rem; color: var(--muted); max-width: var(--measure); margin: 0; }
.method-note a { color: var(--accent); }
.flag { display: inline-block; font-family: var(--sans); font-size: 0.625rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.12em 0.5em; border-radius: 999px; border: 1px solid var(--rule); color: var(--muted); vertical-align: middle; }
.plain-list { margin: 0; padding-left: 1.15rem; color: var(--ink-2); max-width: var(--measure); }
.plain-list li { margin-bottom: 0.5rem; }
.data-table td.wrap-cell { white-space: normal; min-width: 10rem; }
.quote-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; max-width: 60rem; }
.quote-cols .tp-quote { background: var(--paper-2); }

@media (max-width: 720px) {
  .tb-row { grid-template-columns: 1fr auto; gap: 0.25rem 0.75rem; }
  .tb-row .tb-bar { grid-column: 1 / -1; grid-row: 2; }
  .tb-none { grid-column: 1 / -1; }
  .tm-head, .tm-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.35rem 0.75rem; }
  .tm-head span:nth-child(2) { display: none; }
  .tm-head span:first-child { text-align: left; }
  .tm-mid { grid-column: 1 / -1; grid-row: 1; text-align: left; display: flex; justify-content: space-between; align-items: baseline; }
  .tm-side-a { flex-direction: row; }
  .tm-bar.tm-a { flex-direction: row; }
  .tm-side-a .tm-none { text-align: left; }
  .quote-cols { grid-template-columns: 1fr; }
  .split-key { font-size: 0.6875rem; }
}

/* 40-best.css */
/* Category ranking pages and the /best hub */
.hub .hub-group { font-family: var(--sans); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 2.25rem 0 0.9rem; }
.hub .hub-group:first-child { margin-top: 0; }
