/**
 * Report stylesheet — screen and print.
 *
 * Styles the markup emitted by reportToHtml() in lib/report-format.js. Every
 * class here is produced by that serialiser, so one stylesheet covers all
 * report types and no report needs CSS of its own. Colours come from the Dawn
 * Vedic palette as literal values rather than tokens, because a report is also
 * printed and emailed, where the design system's custom properties are absent.
 */

.rpt {
  --rpt-ink: #2A2117;
  --rpt-soft: #6B5A44;
  --rpt-faint: #9C8D75;
  --rpt-paper: #FFFDF8;
  --rpt-sunk: #F6F1E7;
  --rpt-rule: #E6DCC6;
  --rpt-maroon: #8C2A3A;
  --rpt-gold: #854F0B;

  max-width: 46rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  color: var(--rpt-ink);
  background: var(--rpt-paper);
  font-family: "Work Sans", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

/* ── Masthead ── */
.rpt-head { padding-bottom: 1.4rem; border-bottom: 2px solid var(--rpt-maroon); }

.rpt-head h1 {
  margin: 0 0 0.3rem;
  font-family: Fraunces, Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.rpt-subtitle { margin: 0 0 1.1rem; color: var(--rpt-soft); font-size: 0.95rem; }

/* Provenance grid — the block that makes a report auditable months later. */
.rpt-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.55rem 1.4rem;
  margin: 0;
}
.rpt-meta dt {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--rpt-faint);
}
.rpt-meta dd {
  margin: 0.1rem 0 0;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.rpt-caveat {
  margin: 1rem 0 0;
  padding: 0.6rem 0.85rem;
  border-left: 3px solid var(--rpt-gold);
  background: #FFF8EC;
  font-size: 0.85rem;
  color: var(--rpt-soft);
}

/* ── Answer-first summary ── */
.rpt-summary {
  margin: 1.8rem 0 0;
  padding: 1.2rem 1.35rem;
  border: 1px solid var(--rpt-rule);
  border-radius: 10px;
  background: var(--rpt-sunk);
}
.rpt-summary h2 {
  margin: 0 0 0.4rem;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.15;
}
.rpt-summary p { margin: 0; color: var(--rpt-soft); }
.rpt-confidence {
  margin-top: 0.6rem !important;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--rpt-gold) !important;
}

/* ── Sections ── */
.rpt-section { margin-top: 2.4rem; }
.rpt-section > h2 {
  margin: 0 0 0.2rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--rpt-rule);
  font-family: Fraunces, Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
}
.rpt-kicker {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--rpt-gold);
}

/* ── Blocks ── */
.rpt-block { margin-top: 1.3rem; }
.rpt-block h3 {
  margin: 0 0 0.4rem;
  font-size: 0.97rem;
  font-weight: 650;
}
.rpt-block p { margin: 0 0 0.5rem; color: var(--rpt-soft); }
.rpt-block p:last-child { margin-bottom: 0; }

.rpt-prediction p b,
.rpt-guidance b { color: var(--rpt-ink); }

.rpt-insight .rpt-result { color: var(--rpt-ink); font-weight: 600; }
.rpt-insight[data-status="good"]    { border-left: 3px solid #4B7B4E; padding-left: 0.85rem; }
.rpt-insight[data-status="mixed"]   { border-left: 3px solid #C97A2B; padding-left: 0.85rem; }
.rpt-insight[data-status="low"],
.rpt-insight[data-status="sensitive"] { border-left: 3px solid #A33B3B; padding-left: 0.85rem; }

.rpt-list ul { margin: 0; padding-left: 1.1rem; }
.rpt-list li { margin: 0.25rem 0; color: var(--rpt-soft); }
.rpt-list li::marker { color: var(--rpt-gold); }

.rpt-keyvalue dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.5rem 1.2rem;
  margin: 0;
}
.rpt-keyvalue dt {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--rpt-faint);
}
.rpt-keyvalue dd { margin: 0.1rem 0 0; font-size: 0.9rem; }

.rpt-table { overflow-x: auto; }
.rpt-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
  font-variant-numeric: tabular-nums;
}
.rpt-table th,
.rpt-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--rpt-rule);
  text-align: left;
  vertical-align: top;
}
.rpt-table th {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--rpt-faint);
}
.rpt-table tbody tr:last-child td { border-bottom: 0; }

.rpt-timeline ul { margin: 0; padding: 0; list-style: none; }
.rpt-timeline li {
  display: grid;
  grid-template-columns: minmax(6.5rem, auto) 1fr;
  gap: 0.2rem 0.9rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rpt-rule);
  font-size: 0.89rem;
  color: var(--rpt-soft);
}
.rpt-timeline li:last-child { border-bottom: 0; }
.rpt-when {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--rpt-gold);
  font-variant-numeric: tabular-nums;
}
.rpt-timeline li b { color: var(--rpt-ink); }

/* ── Footer ── */
.rpt-foot {
  margin-top: 2.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rpt-rule);
}
.rpt-foot p { margin: 0; font-size: 0.78rem; line-height: 1.55; color: var(--rpt-faint); }

/* ── Print / PDF ──
   The same document, laid out for paper: no page background, sections kept off
   page breaks, and the summary box flattened so it does not waste toner. */
@media print {
  @page { margin: 16mm 14mm; }

  .rpt {
    max-width: none;
    margin: 0;
    padding: 0;
    font-size: 10.5pt;
    background: #FFFFFF;
  }

  .rpt-summary { background: none; border-width: 1px; }
  .rpt-caveat { background: none; }

  .rpt-section { break-inside: auto; }
  .rpt-section > h2,
  .rpt-kicker { break-after: avoid; }
  .rpt-block,
  .rpt-timeline li,
  .rpt-table tr { break-inside: avoid; }

  .rpt-head { break-after: avoid; }
  .rpt-foot { break-before: avoid; }
}

/* ── Print-only mount ──
   life-report.html renders the formatted document into #life-report-print when
   Print / Save PDF is pressed. It is inert on screen; on paper it replaces the
   page so the PDF is the report, not a screenshot of the interface. */
#life-report-print { display: none; }

@media print {
  body.is-printing-report > *:not(#life-report-print) { display: none !important; }

  body.is-printing-report #life-report-print {
    display: block;
    position: static;
    margin: 0;
    padding: 0;
  }
}
