/* f1gures - page styles, stage 3 group f) Records hub, stats, Compare.
   Moved verbatim out of css/app.css (Sharp stage 2). Linked from BaseLayout after
   app.css and before site.css; tokens live in app.css. Only the owning group edits
   this file (docs/redesign/inventory.md section 4). */

/* ============================================================
   RECORDS HUB + SUB-PAGES, STATS HUB (Sharp, stage 3 group f)
   Built from the library (PageHeader, Tabs, RecordCard, SectionHead, Grid,
   Timeline, StatGrid, DataTable, LeaderList). Only page layout lives here.
   ============================================================ */

.rec-page > * + * { margin-top: 20px; }
.rec-section > * + * { margin-top: 0; }
.rec-section .s-grid, .hub-featured .s-grid { margin-top: 14px; }

/* Most decorated hero */
.rec-hero .s-card-body { display: grid; gap: 14px; }
.rec-hero-id { display: flex; align-items: center; gap: 14px; }
.rec-hero-tx { min-width: 0; }
.rec-hero-name {
  margin: 0; font-family: var(--f-display); font-weight: 800; text-transform: uppercase;
  font-size: var(--fs-title, 46px); line-height: 0.95;
}
.rec-hero-meta { margin: 6px 0 0; display: flex; align-items: center; gap: 8px; color: var(--fg-3); font-size: 13px; }
.rec-hero-meta .flag-img { height: 13px; }
.rec-hero-blurb { margin: 0; color: var(--fg-2); font-size: 14px; line-height: 1.5; max-width: 68ch; }
@media (max-width: 720px) { .rec-hero-name { font-size: 32px; } }

/* Timeline of eras: one 44px row per record under each era */
.rec-tl > .s-eyebrow { margin: 0 0 8px; }
.s-tl-tx .rec-tl-rows { display: block; margin-top: 4px; }
.s-tl-tx .rec-tl-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; border-top: 1px solid var(--line-1);
  color: var(--fg-1); text-decoration: none;
}
.s-tl-tx .rec-tl-row:first-child { border-top: 0; }
.s-tl-tx .rec-tl-row:hover .rec-tl-name { text-decoration: underline; text-underline-offset: 3px; }
.s-tl-tx .rec-tl-name { font-size: 14px; color: var(--fg-1); }
.s-tl-tx .rec-tl-year { flex: none; font-family: var(--f-mono); font-size: 11px; color: var(--fg-3); }

/* Record cards: the flag before a driver's name in the top-5 bars */
.s-rec-name .rec-bar-flag { height: 11px; width: auto; margin-right: 6px; vertical-align: -1px; }

/* Sub-page: the era tabs come first in the markup (under the toolbar on
   phone); on desktop the header goes back above them. */
@media (min-width: 721px) {
  .rec-topic { display: flex; flex-direction: column; }
  .rec-topic > .s-ph { order: -1; margin-top: 0; }
  .rec-topic > .s-tabs { margin-top: 0; }
}
@media (max-width: 720px) {
  .rec-topic > .s-ph { margin-top: 16px; }
}

/* Sub-page: note, era panels, table cells, the phone list */
.rec-note { margin-top: 12px; }
.rec-sub { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.rec-sub .flag-img { height: 11px; width: auto; flex: none; }
.rec-era-panel { margin-top: 14px; }
.rec-who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.rec-who a { color: inherit; text-decoration: none; }
.rec-who a:hover { text-decoration: underline; }
.rec-who .flag-img { height: 12px; }
.rec-first { color: var(--fg-2); font-weight: 400; }
.rec-code { font-family: var(--f-mono); font-size: 11px; color: var(--fg-3); }
.rec-mobile { display: none; }
.rec-meta {
  display: flex; justify-content: space-between; margin: 0 0 8px;
  font-family: var(--f-display); font-weight: 700; font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--fg-3);
}
@media (max-width: 720px) { .rec-mobile { display: block; } }

/* Stats hub tool cards */
.hub-tools { margin-top: 20px; }
.hub-tool .s-card-body { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.hub-tool .s-eyebrow { margin: 0; }
.hub-tool-title {
  margin: 0; font-family: var(--f-display); font-weight: 800; font-size: 26px;
  text-transform: uppercase; line-height: 1; color: var(--fg-1);
}
.hub-tool-desc { margin: 0; color: var(--fg-2); font-size: 14px; line-height: 1.5; }
.hub-tool-go {
  margin-top: auto; display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-display); font-weight: 700; font-size: 13px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--fg-1);
}
.hub-featured { margin: 28px 0; }

/* ═══════════════════════════════════════════════════════════════════
   Compare Mode: the driver/team "VS" call-to-action (CompareCta.jsx island).
   The picker and the head-to-head open in the library Sheet (bottom sheet on
   phone, modal above 720px). Team colour sits only on the button's left edge
   and the example chips' edge (--tc / --cc), never a panel background.
   ═══════════════════════════════════════════════════════════════════ */

/* ── CTA button: ink, full width, team-colour left edge, under the hero ── */
.cmp-cta {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 12px 18px 12px 22px;
  margin: 0 0 24px;
  background: var(--ink);
  border: none;
  border-left: 6px solid var(--tc, var(--team-fallback));
  color: var(--ink-fg);
  font-family: var(--f-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 15px;
  cursor: pointer;
  transition: background var(--mo, 120ms) ease;
}
.cmp-cta:hover { background: var(--ink-2); }
.cmp-cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cmp-cta-vs {
  font-family: var(--f-mono); font-weight: 700; font-size: 16px; letter-spacing: 0.02em;
  line-height: 1; padding-right: 12px; border-right: 1px solid var(--ink-line); color: var(--ink-fg);
}
.cmp-cta-txt { white-space: nowrap; }
.cmp-cta-sub {
  font-family: var(--f-body); font-weight: 600; text-transform: none;
  letter-spacing: 0.02em; font-size: 12.5px; color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.cmp-cta-arrow { margin-left: auto; font-size: 18px; line-height: 1; color: var(--ink-fg); }
/* The Compare card: the ink button and the one-tap rivals in one unit.
   The card is the page surface with a hairline; team colour stays on the
   button's left edge and each chip's edge. */
.cmp-cta-wrap { margin: 0 0 14px; background: var(--bg-2); border: 1px solid var(--line-1); }
.cmp-cta-wrap .cmp-cta { margin: 0; }
.cmp-cta-egs { display: grid; gap: 8px; padding: 10px 12px 12px; }
.cmp-cta-egs-lbl { font-family: var(--f-mono); font-size: var(--fs-label, 10px); letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-3); }
.cmp-cta-eg-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cmp-cta-eg {
  position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 40px; padding: 6px 10px 6px 13px;
  background: transparent; border: 1px solid var(--line-2); color: var(--fg-1); text-align: left;
  font-family: var(--f-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; font-size: 13px;
  cursor: pointer; transition: border-color var(--mo, 120ms) ease, background var(--mo, 120ms) ease;
}
.cmp-cta-eg::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--cc, var(--team-fallback)); }
.cmp-cta-eg:hover { border-color: var(--line-3); background: var(--bg-hover); }
.cmp-cta-eg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cmp-cta-eg-vs { flex: none; font-family: var(--f-mono); font-weight: 500; font-size: 10px; text-transform: none; color: var(--fg-3); }
.cmp-cta-eg-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-cta-eg--ph { cursor: default; border-style: dashed; }
.cmp-cta-eg--ph::before { background: var(--line-2); }

@media (max-width: 720px) {
  .cmp-cta-eg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmp-cta-eg { min-height: 44px; }
}
@media (max-width: 560px) {
  .cmp-cta-sub { display: none; }
  .cmp-cta { font-size: 14px; padding: 12px 14px 12px 18px; }
}

/* ── Picker and head-to-head sheets ─────────────────────────────────── */
/* The head-to-head needs more room than the default 560px modal. */
@media (min-width: 721px) {
  .cmp-h2h-sheet.s-sheet { max-width: 760px; }
}
/* On a phone the picker list runs to the bottom of the sheet. */
@media (max-width: 720px) {
  .cmp-picker-sheet .cmp-picker-list { max-height: calc(86vh - 150px); }
}
.cmp-x-abs { position: absolute; top: 12px; right: 12px; z-index: var(--z-raised); }
.cmp-empty { padding: 24px 16px; text-align: center; color: var(--fg-3); font-family: var(--f-mono); font-size: 13px; display: flex; gap: 10px; align-items: center; justify-content: center; }

/* ── rival picker (PickerBody, inside a Sheet) ──────────────────── */
.cmp-pick { display: grid; gap: 10px; }
.cmp-picker-list { overflow-y: auto; max-height: 56vh; }
.cmp-group-lbl { margin: 4px 0 6px; }
.cmp-row {
  width: 100%; display: grid; grid-template-columns: 3px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 8px 0 0; background: transparent; border: 0;
  border-bottom: 1px solid var(--line-1); color: var(--fg-1); text-align: left; cursor: pointer;
}
.cmp-row:hover, .cmp-row:focus-visible { background: var(--bg-hover); }
.cmp-row-strip { align-self: stretch; background: var(--tc, var(--line-3)); }
.cmp-row-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-row-meta { font-family: var(--f-mono); font-size: 11.5px; color: var(--fg-3); white-space: nowrap; }
.cmp-row-meta b { color: var(--fg-1); }
.cmp-row-code { font-weight: 700; color: var(--fg-2); margin-right: 4px; }

/* ── 2-way view (CompareView), in the CTA's and the launcher's Sheet ─ */
.cmp-panel { position: relative; width: 100%; display: grid; gap: 14px; }
.cmp-tape-top { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; padding-right: 36px; }
.cmp-h2h-sheet .cmp-tape-top { padding-right: 0; }
.cmp-fighter { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.cmp-fighter.cmp-right { flex-direction: row-reverse; text-align: right; }
a.cmp-fighter:hover .cmp-f-name { text-decoration: underline; }
.cmp-f-text { display: grid; min-width: 0; }
.cmp-f-team { font-family: var(--f-display); font-weight: 700; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: color-mix(in srgb, var(--tc, var(--fg-3)) 58%, var(--fg-1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-f-name { font-family: var(--f-display); font-weight: 800; font-size: 30px; text-transform: uppercase; line-height: 0.95; overflow-wrap: anywhere; }
.cmp-f-sub { font-family: var(--f-mono); font-size: 11px; color: var(--fg-3); }
.cmp-vscol { text-align: center; display: grid; gap: 4px; justify-items: center; }
.cmp-vsbig { font-family: var(--f-display); font-weight: 800; font-size: 26px; color: var(--fg-3); line-height: 1; }
.cmp-verdict { font-size: 12px; color: var(--fg-2); max-width: 12ch; line-height: 1.3; }
.cmp-verdict b { color: var(--fg-1); text-transform: uppercase; }
.cmp-verdict-n { display: block; font-family: var(--f-mono); font-weight: 700; color: var(--fg-1); }
.cmp-shared-drivers { display: block; margin-top: 6px; }
.cmp-group { display: grid; gap: 8px; }
.cmp-group-head { margin: 0; }
.cmp-rows { display: grid; gap: 10px; }
.cmp-extras { margin-top: 2px; }
.cmp-panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line-1); }
.cmp-toast { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--pos); padding: 5px 9px; border: 1px solid color-mix(in srgb, var(--pos) 45%, var(--line-2)); white-space: nowrap; }
@media (max-width: 720px) {
  .cmp-f-name, .cmp-h2h-sheet .cmp-f-name { font-size: 20px; }
  .cmp-fighter { flex-direction: column; align-items: flex-start; gap: 6px; }
  .cmp-fighter.cmp-right { flex-direction: column; align-items: flex-end; }
}

/* ── share preview (inside the Sharp ShareSheet) ─────────────────── */
.cmp-share-preview { position: relative; background: var(--bg-3); display: flex; align-items: center; justify-content: center; padding: 14px; min-height: 280px; }
.cmp-share-preview img { max-width: 100%; max-height: 56vh; box-shadow: var(--shadow-card); }
.cmp-share-busy { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-3); }
.cmp-share-preview .cmp-toast { position: absolute; left: 12px; bottom: 12px; background: var(--bg-2); }

/* ── /compare/ launcher (CompareLauncher.jsx) ─────────────────────── */
.cvs { display: grid; gap: 16px; margin-top: 8px; }
.cvs-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cvs-top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cvs-cards { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.cvs-card { min-width: 0; }
.cvs-card.s-card .s-card-body { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 10px; }
.cvs-card-body { display: grid; gap: 2px; min-width: 0; }
.cvs-card-name { font-family: var(--f-display); font-weight: 800; font-size: 17px; text-transform: uppercase; line-height: 1; color: var(--fg-1); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 18ch; }
.cvs-card-name:hover { text-decoration: underline; }
.cvs-card-body .s-btn { justify-self: start; }
.cvs-add { align-self: stretch; min-height: 56px; }
.cvs-panel .s-card-body { display: grid; gap: 18px; }
.cvs-metric { display: grid; gap: 8px; }
.cvs-metric-label { margin: 0; }
.cvs-metric-unit { color: var(--fg-3); }
.cvs-bar { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: end; }
.cvs-bar.is-lead .s-bar-head b { color: var(--fg-1); }
.cvs-bar:not(.is-lead) .s-bar-head b { color: var(--fg-3); }
.cvs-verdict { margin: 0; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line-1); font-size: 14px; color: var(--fg-2); }
.cvs-verdict b { color: var(--fg-1); text-transform: uppercase; }
.cvs-verdict .s-eyebrow { margin: 0; }
@media (max-width: 720px) {
  .cvs-cards { display: grid; grid-template-columns: 1fr 1fr; }
  .cvs-card-name { font-size: 15px; max-width: none; }
  .cvs-add { grid-column: 1 / -1; }
}

/* ── suggested matchups ───────────────────────────────────────────── */
.cmp-sugg { display: grid; gap: 10px; }
.cmp-sugg-head { display: flex; align-items: center; justify-content: space-between; }
.cmp-sugg-head .s-eyebrow { margin: 0; }
.cmp-sugg-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cmp-sugg-card { width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit; border: 0; }
.cmp-sugg-card .s-card-body { display: grid; gap: 8px; }
.cmp-sugg-card:hover { background: var(--bg-hover); }
.cmp-sugg-tag { margin: 0; }
.cmp-sugg-faces { display: flex; align-items: center; gap: 8px; }
.cmp-sugg-vs { font-family: var(--f-display); font-weight: 800; font-size: 13px; color: var(--fg-3); }
.cmp-sugg-names { font-family: var(--f-display); font-weight: 800; font-size: 16px; text-transform: uppercase; line-height: 1.05; }
.cmp-sugg-names i { font-style: normal; font-weight: 600; color: var(--fg-3); font-size: 12px; }
.cmp-sugg-reason { font-size: 12.5px; color: var(--fg-3); line-height: 1.4; }
@media (max-width: 960px) { .cmp-sugg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .cmp-sugg-grid { grid-template-columns: 1fr; } }

/* Records phone rows: the expanded detail carries text (dates, teams), not
   single numbers, so its values sit smaller than RowDetail's default. */
.rec-rd .s-rd-stats b { font-size: 15px; line-height: 1.15; }
@media (min-width: 721px) { .cmp-h2h-sheet .cmp-f-name { font-size: 24px; } }
