/**
 * Can I Retire Now? — Scorecard UI shell styling.
 *
 * BRAND-SYSTEM RECONCILIATION PASS: the color/font/border/radius/button/
 * field/header values below are reconciled against the approved free-check
 * visual system in brand-reference/styles.css (brand-reference/ is a
 * read-only copy of the completed, frozen free check — authoritative for
 * visual/brand only, never for product logic/copy). See the delivery
 * report for the full before/after reconciliation table. Two things are
 * DELIBERATELY kept different from the free-check reference, both
 * explicitly required by the Scorecard's own task instructions rather
 * than oversights:
 *   1. No per-verdict red/green/amber/blue result-card colors (free-check
 *      has --color-on-track-bg/--color-gap-bg/etc.) — the Scorecard uses
 *      one neutral coral/dark treatment for all three ratio bands, per
 *      results-copy-updated.md's "Tone is deliberately non-alarming
 *      across all states... no fear-based or urgency language," and per
 *      this task's explicit "Do not create verdict-specific red/green
 *      styling."
 *   2. The baseline result panel keeps a dark fill (.panel-dark, using
 *      free-check's exact --color-shell dark value) even though
 *      free-check itself never uses that dark color as a CONTENT
 *      background (only as the outer decorative shell wrapping its
 *      single form+result). The Scorecard has multiple sibling panels
 *      competing for attention (baseline, 3 scenarios, sensitivity,
 *      country) that free-check doesn't have, and this task explicitly
 *      requires "baseline remains visually dominant" as part of the
 *      Scorecard's own paid-product hierarchy — so the approved dark
 *      color is reused, deliberately, for a role free-check doesn't need.
 *
 * Anton loading: identical method to brand-reference/index.html — Google
 * Fonts CDN link in ui/scorecard.html's <head> (preconnect + stylesheet),
 * no bundled/invented font file. Anton is used only in the same role
 * free-check establishes for it: the single main product-title H1 — not
 * section headings or card titles, which free-check doesn't use Anton
 * for either (its .result-stats dd figures are bold body-font, not
 * Anton). Section/card headings and stat figures below use the regular
 * body font at bold weights instead, matching free-check's own
 * .result-stats dd / .field label / .eyebrow weight conventions.
 */

:root {
  /* Exact values from brand-reference/styles.css :root. */
  --color-bg: #faf1e8;
  --color-panel: #ffffff;
  --color-panel-quiet: #f3eadc; /* Scorecard-only "secondary panel" tint — free-check has no equivalent (no de-emphasized-panel concept); kept close to the family of --color-bg since it still needs to read as part of the same warm cream system. */
  --color-dark-panel: #201a17;       /* = free-check --color-shell */
  --color-dark-panel-text: #faf1e8;  /* = free-check --color-page-bg, reused as text-on-dark */
  --color-text: #1c1712;             /* = free-check --color-text */
  --color-text-muted: #5c6570;       /* = free-check --color-muted */
  --color-border: #e3d9cd;           /* = free-check --color-border */
  --color-border-dark: rgba(250, 241, 232, 0.16);
  --color-coral: #e8734a;            /* = free-check --color-accent */
  --color-coral-dark: #d4623c;       /* = free-check --color-accent-hover */
  --color-focus: #c14f2b;            /* = free-check --color-focus */
  --color-error: #b3261e;            /* = free-check --color-error */

  --font-body: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-headline: 'Anton', 'Arial Narrow', Impact, "Segoe UI", sans-serif;

  --radius: 16px;      /* = free-check --radius-card */
  --radius-sm: 8px;    /* = free-check --radius-field (already matched) */
  --container-width: 1040px; /* wider than free-check's 760px — a deliberate, necessary difference: the Scorecard's baseline+3 scenarios+3 sensitivity+country+disclosure content needs more width than free-check's single compact form, not a brand-color/shape divergence. */
  --section-gap: 1.75rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.5;
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------------------------------------------------------------------
   A. Header — reconciled to sit on the plain cream page background like
   brand-reference's .brand-header (no dark fill/border; free-check
   never puts its header on the dark shell color). Locked strings ("Can
   I Retire Now?" / "Retirement Readiness Scorecard" / the subline) are
   unchanged — only the visual container/typography changed.
   --------------------------------------------------------------------- */

.site-header {
  padding: 2.25rem 0 1.25rem;
}

.header-inner { text-align: center; }

.brand-icon { margin-bottom: 0.6rem; }

.brand-icon img {
  display: block;
  margin: 0 auto;
  height: auto;
}

.brand-kicker {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-coral);
  font-weight: 800;
}

.brand-title {
  margin: 0 0 0.4rem;
  font-family: var(--font-headline);
  font-weight: 400; /* Anton is a single heavy weight; 400 renders correctly (matches brand-reference's own comment on this exact rule). */
  font-size: 2.75rem;
  letter-spacing: 0.02em;
  line-height: 1.05;
  text-transform: none;
  white-space: normal;
}

.brand-sub {
  max-width: 40rem; /* kept — line-length control for the Scorecard's wider container, not a brand-color/shape property. */
  margin: 0 auto;
  color: var(--color-text-muted);
  font-size: 1.2rem;
  line-height: 1.5;
}

/* ---------------------------------------------------------------------
   Panels
   --------------------------------------------------------------------- */

main.container { padding-top: 2.5rem; padding-bottom: 3rem; }

.panel {
  background: var(--color-panel);
  border: 2px solid var(--color-border); /* was 1px — reconciled to free-check's primary-content-card border weight (input/.result-card both use 2px). */
  border-radius: var(--radius);
  padding: 2rem; /* = free-check .calc-card padding */
  margin-bottom: var(--section-gap);
}

.panel-quiet {
  background: var(--color-panel-quiet);
  border-color: var(--color-border);
}

.panel-dark {
  /* See file header comment: dark fill intentionally kept for the
     baseline result only, using the exact approved dark value. */
  background: var(--color-dark-panel);
  color: var(--color-dark-panel-text);
  border: 2px solid var(--color-dark-panel);
  border-left: 6px solid var(--color-coral);
  padding: 2rem;
}

.panel h2 {
  font-family: var(--font-body);
  font-weight: 800; /* matches free-check's .result-stats dd / bold-body convention — Anton is reserved for the main H1 only, see file header comment. */
  text-transform: none;
  letter-spacing: normal;
  font-size: 1.4rem;
  margin: 0 0 1.1rem;
}

.section-note {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin: -0.6rem 0 1.1rem;
}

/* ---------------------------------------------------------------------
   B. Form / inputs — reconciled to brand-reference's field styling
   (border weight, padding, font-size, label weight, focus color).
   --------------------------------------------------------------------- */

.field { margin-bottom: 1.15rem; }

.field:last-of-type { margin-bottom: 1.4rem; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.field-row .field { margin-bottom: 1.15rem; }

.field label {
  display: block;
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.field input,
.field select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-size: 1.1rem;
  border: 2px solid var(--color-border); /* was 1px */
  border-radius: var(--radius-sm);
  background: var(--color-panel);
  color: var(--color-text);
  font-family: inherit;
}

.field input:focus-visible,
.field select:focus-visible,
.field input:focus,
.field select:focus {
  outline: 3px solid var(--color-focus); /* was var(--color-coral) — free-check uses a dedicated, slightly darker focus color distinct from the plain accent. */
  outline-offset: 2px;
}

.field-help {
  margin: 0.4rem 0 0; /* top-margin (help text follows the input here, unlike some free-check fields where it precedes it) — DOM order/behavior unchanged per instructions, only the color/size below is reconciled. */
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.form-error {
  background: #fdeceb;
  border: 1px solid var(--color-error);
  color: var(--color-error); /* was --color-coral-dark — free-check keeps a dedicated error color distinct from the accent-hover color. */
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  margin: 0 0 1.4rem;
  font-weight: 600;
}

.btn {
  display: inline-block;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.95rem 1.5rem;
  border-radius: var(--radius-sm); /* was 999px pill — free-check's .btn-primary/.cta-button both use the 8px field radius, not a pill. */
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none; /* .btn is also used on the Share <a> — no link underline, same look as the Print <button>. */
}

.btn-primary {
  width: 100%; /* matches free-check's .btn-primary sizing */
  border: none;
  background: var(--color-coral);
  color: #ffffff; /* was dark text — free-check uses white text on coral throughout (.btn-primary/.cta-button/.bonus-badge). */
}

.btn-primary:hover { background: var(--color-coral-dark); }

.btn-secondary {
  /* No free-check equivalent exists (it has no secondary/print button) —
     kept as a Scorecard-only quiet action, sized down from the primary
     CTA so it reads as secondary. */
  width: auto;
  background: transparent;
  border-color: var(--color-dark-panel);
  color: var(--color-dark-panel);
  padding: 0.65rem 1.6rem;
  font-size: 1rem;
}

.btn:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   C. Baseline result
   --------------------------------------------------------------------- */

.verdict-badge {
  display: inline-block;
  background: var(--color-coral);
  color: #ffffff; /* was dark text — matches free-check's .bonus-badge (white on coral). */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.9rem;
  border-radius: 999px; /* free-check's .bonus-badge is also a pill — kept here. */
  padding: 0.4rem 1rem;
  margin: 0 0 1rem;
}

.verdict-headline {
  font-size: 1.35rem; /* = free-check .result-headline */
  font-weight: 400;
  line-height: 1.4;
  margin: 0 0 1.5rem;
  max-width: 46rem;
}

.baseline-figures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin: 0;
  padding-top: 1.4rem;
  border-top: 1px solid var(--color-border-dark);
}

.baseline-figures dt {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.75;
  margin: 0 0 0.35rem;
  line-height: 1.35;
}

.baseline-figures dd {
  margin: 0;
  font-size: 1.5rem; /* = free-check .result-stats dd */
  font-weight: 800;  /* Anton dropped, see file header comment. */
}

/* ---------------------------------------------------------------------
   C2. Standalone inflation clarifier / F2. Re-check reminder — small
   informational callouts, neither a warning/alert nor styled like the
   disclosure (no border-top/legal-notice treatment, no recommendation-
   card treatment). Uses the same quiet background/border already
   established for secondary content (country context, how-it-works) so
   they read as part of the same design system, sized and weighted to
   stay secondary to the verdict badge/headline/figures.
   --------------------------------------------------------------------- */

.inflation-clarifier,
.recheck-reminder {
  background: var(--color-panel-quiet);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  margin: 0 0 var(--section-gap);
  font-size: 0.95rem;
  color: var(--color-text);
  line-height: 1.5;
}

/* ---------------------------------------------------------------------
   D/E. Card grids (scenarios, sensitivity)
   --------------------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.card {
  background: var(--color-panel-quiet);
  border: 1px solid var(--color-border); /* unchanged — matches free-check's nested/secondary-element border weight (.result-stats > div, .bonus-field), one tier lighter than the primary .panel border. */
  border-top: 3px solid var(--color-coral); /* kept — Scorecard-only accent device using the approved coral, applied uniformly to all three equal-status cards (no ranking implied). */
  border-radius: var(--radius);
  padding: 1.4rem 1.4rem 1.5rem;
}

.card h3 {
  margin: 0 0 0.75rem;
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: none;
  font-size: 1.05rem;
  color: var(--color-text);
}

.card p {
  margin: 0;
  line-height: 1.55;
}

.sens-card {
  text-align: center;
}

.sens-card .sens-rate {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 1.2rem;
  margin: 0 0 0.75rem;
}

.sens-card dl { margin: 0; }
.sens-card dt {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  opacity: 0.7;
  margin: 0.6rem 0 0.2rem;
}
.sens-card dt:first-of-type { margin-top: 0; }
.sens-card dd {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

/* ---------------------------------------------------------------------
   F. Country context — kept visually secondary to the main scorecard
   (same quiet panel treatment as "How this estimate works" below).
   --------------------------------------------------------------------- */

#country-context-body dl {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.5rem;
}
#country-context-body dt {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  opacity: 0.7;
  flex-basis: 100%;
  margin: 0.4rem 0 0;
}
#country-context-body dt:first-child { margin-top: 0; }
#country-context-body dd {
  margin: 0 1.5rem 0 0;
  font-weight: 700;
  font-size: 1.05rem;
}
#country-context-body .country-note {
  margin-top: 1rem;
  color: var(--color-text-muted);
  line-height: 1.55;
  max-width: 46rem;
}
#country-context-body .resource-guidance {
  margin-top: 0.6rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 46rem;
}

/* Official pension/benefit resource link — kept visually secondary
   (normal weight, smaller than the bold country/pension-term values
   above it) rather than styled as a call-to-action. */
.resource-link {
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--color-coral-dark);
  text-decoration: underline;
}
.resource-link:hover,
.resource-link:focus-visible {
  color: var(--color-coral);
}

/* ---------------------------------------------------------------------
   G. How this estimate works / disclosure

   free-check wraps its equivalent section in a collapsible <details>
   (collapsed by default). The Scorecard deliberately keeps this section
   always visible/expanded instead — required by an earlier, still-valid
   instruction not to "rewrite, shorten, collapse, or hide legal/
   disclosure copy in a way that makes it hard to access." Only the
   typography/color values below are reconciled, not the interaction
   pattern.
   --------------------------------------------------------------------- */

.panel-quiet p,
.panel-quiet li {
  line-height: 1.6;
}

.panel-quiet ul {
  margin: 0.75rem 0 1.25rem;
  padding-left: 1.25rem;
}

.panel-quiet li {
  margin-bottom: 0.35rem;
}
.panel-quiet li:last-child { margin-bottom: 0; }

.disclosure {
  font-size: 0.95rem; /* = free-check .disclosure */
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  padding-top: 1.25rem;
  margin-top: 1.5rem;
  line-height: 1.55;
}

/* ---------------------------------------------------------------------
   H. Action area
   --------------------------------------------------------------------- */

.action-area {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

/* ---------------------------------------------------------------------
   Responsive — stack below ~700px (Scorecard-specific breakpoint for
   its card grids/baseline figures, which free-check has no equivalent
   of). field-row's own breakpoint below matches free-check exactly.
   --------------------------------------------------------------------- */

@media (max-width: 700px) {
  .card-grid { grid-template-columns: 1fr; }
  .baseline-figures { grid-template-columns: 1fr; gap: 1.1rem; }
  .panel { padding: 1.4rem 1.3rem; }
  .panel-dark { padding: 1.6rem 1.4rem 1.6rem 1.2rem; }
  html, body { font-size: 17px; }
}

/* = free-check's exact header breakpoint/values (brand-reference
   styles.css "Header-only breakpoint" comment/rule). */
@media (max-width: 800px) {
  .brand-title { font-size: 2.5rem; }
  .brand-kicker { font-size: 1rem; }
}

/* = free-check's exact field-row breakpoint/values. */
@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
}

/* ---------------------------------------------------------------------
   Print

   Goal: Print / Save-as-PDF should read as a clean report of the exact
   result already rendered on screen — no recalculation, no alternate
   figures, nothing hidden/generated here.

   Colors used below are borders and text (foreground), never
   load-bearing background fills — browsers suppress background-color/
   background-image by default in print unless the user enables
   "print backgrounds," so comprehension must not depend on that
   setting. The header no longer needs a de-darkening override here
   (it now sits on the plain cream background on screen too, matching
   free-check) — only .panel-dark (baseline result, deliberately still
   dark on screen per the file header comment) still needs one: it
   uses a light text color on screen because it sits on a dark fill,
   and that fill silently disappears in print unless "print
   backgrounds" is enabled, so this block removes it deliberately and
   forces dark text in its place.

   No paper-size-specific rules: @page margin plus the existing fluid
   (%/rem/fr) layout adapts to both A4 and US Letter without a second
   layout. Pagination itself is out of scope for this pass (brand
   reconciliation only) — a separate print pass follows.
   --------------------------------------------------------------------- */

@media print {
  @page { margin: 1.3cm; }

  html, body {
    background: #fff;
    color: var(--color-text);
    font-size: 12pt;
    line-height: 1.45;
    /* Print-only tightening of the shared section-gap token (was 1.75rem
       on screen) — this is whitespace between blocks, not body text, and
       is what most of the pagination-density gain below comes from. Body
       font-size/line-height above are unchanged from the original print
       pass; disclosure keeps its own font-size (.disclosure rule,
       untouched) at the same size as the rest of the report body text. */
    --section-gap: 0.9rem;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Nothing interactive/input-only belongs in the report. */
  .no-print,
  #inputs-panel {
    display: none !important;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  main.container {
    padding-top: 0;
    padding-bottom: 0;
  }

  /* Header: the generous screen whitespace/branding size isn't needed on
     a printed report. Logo/kicker/title/subline copy and the logo image
     itself are unchanged — only padding/margins and the two decorative
     heading sizes are tightened, never the body/disclosure text sizes
     addressed further down. */
  .site-header { padding: 0 0 0.5rem; }
  .brand-icon { margin-bottom: 0.3rem; }
  .brand-kicker { margin-bottom: 0.2rem; }
  .brand-title { margin-bottom: 0.2rem; font-size: 2.2rem; }
  .brand-sub { font-size: 1.05rem; }

  /* Panels: drop tinted/dark fills; the existing border already carries
     the grouping without needing ink-heavy backgrounds. Padding and
     heading margins are tightened (whitespace only); paragraph/list/
     disclosure text inside keeps its normal font-size. */
  .panel,
  .panel-quiet,
  .card,
  .inflation-clarifier,
  .recheck-reminder {
    background: #fff !important;
    box-shadow: none;
  }

  .panel { padding: 1rem 1.1rem; }
  .panel h2 { margin-bottom: 0.5rem; }
  .section-note { margin-top: -0.3rem; }
  .panel-quiet ul { margin: 0.4rem 0 0.7rem; }
  .panel-quiet li { margin-bottom: 0.2rem; }

  /* Baseline result: drop the dark fill, force dark text, keep the
     coral left rule as the accent marking this as the product's
     central result (see file header comment on why this panel is
     dark on screen at all). Padding/heading-margin tightened the same
     way as other panels; verdict badge/headline/figure sizes untouched. */
  .panel-dark {
    background: #fff !important;
    border: 2px solid var(--color-border);
    border-left: 5px solid var(--color-coral);
    padding: 1rem 1.1rem;
  }
  .panel-dark,
  .panel-dark * {
    color: var(--color-text) !important;
  }
  .verdict-badge {
    background: #fff !important;
    border: 1.5px solid var(--color-coral);
    color: var(--color-text) !important;
  }
  .verdict-headline { margin-bottom: 0.7rem; }
  .baseline-figures { padding-top: 0.7rem; gap: 1rem; }

  .inflation-clarifier,
  .recheck-reminder {
    padding: 0.5rem 0.9rem;
  }

  /* Scenario cards: the web's 3-column grid gets cramped at A4/Letter
     width once the longer scenario sentences wrap onto many narrow
     lines — stack them instead so each card reads at a normal paragraph
     width (readability over preserving the screen layout). Sensitivity
     and the baseline stat row stay multi-column: their content is short
     (a rate/label plus one number) and benefits from staying easy to
     compare side by side, and fits A4/Letter width without cramping. */
  #scenarios-panel .card-grid {
    grid-template-columns: 1fr;
    gap: 0.4cm;
  }
  #sensitivity-panel .card-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35cm;
  }
  .baseline-figures {
    grid-template-columns: repeat(3, 1fr);
  }

  .card { padding: 0.7rem 0.8rem 0.8rem; }
  .card h3 { margin-bottom: 0.35rem; }

  /* Page-break control: keep each result block intact and avoid
     orphaned headings/card titles, without forcing whole long sections
     (e.g. "How this estimate works") to avoid breaking, which would
     risk large forced blank gaps instead of a normal page turn. */
  #baseline-panel,
  #sensitivity-panel,
  #country-panel,
  .card,
  .disclosure,
  .inflation-clarifier,
  .recheck-reminder {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  h2, h3 {
    break-after: avoid;
    page-break-after: avoid;
  }
  li {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
