/* Report styles shared by the web report and the PDF (WeasyPrint).
   Plain CSS on purpose: WeasyPrint can't run the Tailwind CDN script.
   Everything is scoped under .rp so it can't fight the site chrome.

   Design rules (keep them when editing):
   "Shopfront" direction: cool grey page, slate ink, Bricolage Grotesque
   for display type over Geist.

   Design rules (keep them when editing):
   - One accent (--accent, rust), used only for money: the at-risk figure
     that leads the report head and the action-plan amounts. Severity
     colours are semantic state, never decoration; "low" stays neutral
     slate so it doesn't read as a second accent.
   - The dollar figure is the dominant stat in the head; the score ring
     and the other stats support it.
   - Radius scale: 24px head panel, 16px cards and columns, 10px inner
     panels, pill for badges only.
   - No em/en dashes in any copy rendered here. */

@font-face { font-family: Geist; font-weight: 400; src: url("fonts/geist/Geist-Regular.woff2") format("woff2"); }
@font-face { font-family: Geist; font-weight: 500; src: url("fonts/geist/Geist-Medium.woff2") format("woff2"); }
@font-face { font-family: Geist; font-weight: 600; src: url("fonts/geist/Geist-SemiBold.woff2") format("woff2"); }
@font-face { font-family: Geist; font-weight: 700 900; src: url("fonts/geist/Geist-Bold.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 600 800; src: url("fonts/bricolage/BricolageGrotesque-Bold.woff2") format("woff2"); }

.rp {
  --ink: #1c2530;
  --muted: #55606e;
  --faint: #94a3b8;
  --line: #dde2e8;
  --panel: #f3f5f7;
  --surface: #fff;
  --accent: #b8451f;
  --display: "Bricolage Grotesque", Geist, ui-sans-serif, system-ui, sans-serif;
  --critical: #b91c1c;
  --high: #dc2626;
  --medium: #b45309;
  --low: #55606e;
  --info: #64748b;
  --pass: #15803d;
  font-family: Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}
.rp h1, .rp h2, .rp h3 { line-height: 1.2; margin: 0; }
.rp h2 { font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 14px; }
.rp h3 { font-size: 16px; font-weight: 650; }
.rp p { margin: 0 0 10px; }
.rp ul { margin: 0; padding-left: 18px; list-style: disc; }
.rp ol { list-style: decimal; }  /* Tailwind preflight strips both */
.rp li { margin: 3px 0; }
.rp .muted { color: var(--muted); }
.rp .small { font-size: 13px; }
.rp section { margin: 0 0 36px; }

/* --- header -------------------------------------------------------------- */
.rp-head {
  display: flex; align-items: center; gap: 28px;
  padding: 28px; border-radius: 24px; background: var(--surface);
}
.rp-head .who { flex: 1; }
.rp-head .who h1 { font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.rp-head .who .url { color: var(--muted); font-size: 14px; word-break: break-all; }
/* the money: the one figure the owner should leave with */
.rp-risk { margin-top: 16px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.rp-risk b {
  font-family: var(--display); font-size: 60px; font-weight: 700; line-height: 1;
  letter-spacing: -0.035em; color: var(--accent);
}
.rp-risk span { font-size: 16px; color: var(--muted); }
.rp-stats { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.rp-stat { background: var(--panel); border-radius: 10px; padding: 8px 12px; }
.rp-stat b { display: block; font-size: 16px; }
.rp-stat span { font-size: 12px; color: var(--muted); }

/* score ring (SVG) */
.rp-ring { position: relative; flex: none; }
.rp-ring svg { display: block; }
.rp-ring .num {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.rp-ring .num b { font-family: var(--display); font-size: 36px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.rp-ring .num span { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* --- summary + group bars -------------------------------------------------- */
.rp-summary p { font-size: 16px; }
.rp-bars { display: grid; gap: 10px; }
.rp-bar { display: grid; grid-template-columns: 120px 1fr 90px; align-items: center; gap: 12px; }
.rp-bar .track { height: 12px; border-radius: 6px; background: var(--line); overflow: hidden; }
.rp-bar .fill { height: 100%; border-radius: 6px; }
.rp-bar .val { font-size: 13px; color: var(--muted); text-align: right; }

/* --- action plan ---------------------------------------------------------- */
.rp-plan { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.rp-plan .col { border-radius: 16px; padding: 16px; background: var(--surface); }
.rp-plan .col h3 { margin-bottom: 8px; }
.rp-plan ol { margin: 0; padding-left: 18px; }
.rp-plan li { margin: 6px 0; font-size: 14px; }
.rp-plan .amt { color: var(--accent); font-size: 12px; font-weight: 600; white-space: nowrap; }
.rp-plan .empty { color: var(--faint); font-size: 14px; }

/* --- competitor table ------------------------------------------------------ */
.rp-table-wrap { overflow-x: auto; }
.rp-table-wrap table { min-width: 560px; }
.pdf .rp-table-wrap table { min-width: 0; }
.rp table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rp th, .rp td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.rp th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.rp tr.you td { background: var(--surface); font-weight: 600; }

/* --- findings -------------------------------------------------------------- */
.rp-group-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.rp-group-head .gs { font-size: 14px; color: var(--muted); }
.rp-card {
  border-radius: 16px; padding: 16px 18px;
  margin: 0 0 12px; background: var(--surface); break-inside: avoid;
}
.rp-card .top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.rp-card .summary { margin: 6px 0 8px; }
.rp-card .evidence { color: var(--muted); font-size: 13.5px; }
.rp-card .fix { margin-top: 10px; background: var(--panel); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.rp-card .meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
@media (max-width: 720px) { .rp-card .top { flex-direction: column; gap: 2px; } }
.rp-card.cnv { background: transparent; border: 1px dashed var(--faint); }

.rp-badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 2px 8px; border-radius: 999px; color: #fff;
  background: var(--info); vertical-align: middle;
}
.rp-badge.sev-critical { background: var(--critical); }
.rp-badge.sev-high { background: var(--high); }
.rp-badge.sev-medium { background: var(--medium); }
.rp-badge.sev-low { background: var(--low); }
.rp-badge.sev-pass { background: var(--pass); }
.rp-badge.cnv { background: var(--faint); }

.rp-note {
  border: 1px dashed var(--medium); background: #fffbeb; color: #78350f;
  border-radius: 16px; padding: 12px 16px; font-size: 14px;
}

/* --- dark mode (screen only; PDFs always print light) -------------------- */
@media screen and (prefers-color-scheme: dark) {
  body:not(.pdf) .rp {
    --ink: #e8ecf0; --muted: #aab4c0; --faint: #6b7785; --line: #364352;
    --panel: #2a3542; --surface: #1c2530; --accent: #ff9a73; --low: #aab4c0;
  }
  body:not(.pdf) .rp-note { background: #2a1f07; color: #fcd34d; border-color: #b45309; }
}

/* --- web layout tweaks ------------------------------------------------------ */
@media (max-width: 720px) {
  .rp-head { flex-direction: column; align-items: flex-start; padding: 22px; }
  .rp-risk b { font-size: 48px; }
  .rp-plan { grid-template-columns: 1fr; }
  .rp-bar { grid-template-columns: 90px 1fr 70px; }
  .rp table { font-size: 12px; }
}

/* --- PDF (WeasyPrint) --------------------------------------------------------- */
@page {
  size: A4;
  margin: 18mm 16mm 20mm;
  @bottom-left { content: string(business) " · Website and business assessment"; font: 9pt Geist, sans-serif; color: #94a3b8; }
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 9pt Geist, sans-serif; color: #94a3b8; }
}
@page cover { margin: 0; @bottom-left { content: none; } @bottom-right { content: none; } }
body.pdf { margin: 0; }
.pdf .rp { font-size: 10.5pt; }
.pdf .rp h2 { font-size: 16pt; }
.pdf .rp section { margin-bottom: 22px; }
.pdf .rp-cover {
  page: cover; height: 297mm; box-sizing: border-box; padding: 34mm 22mm;
  background: #1c2530; color: #f3f5f7;
  display: flex; flex-direction: column;
}
.pdf .rp-cover .brand { font-family: var(--display); font-size: 17pt; font-weight: 700; letter-spacing: -0.02em; }
.pdf .rp-cover .brand span { color: #ff9a73; }
.pdf .rp-cover h1 { font-family: var(--display); font-size: 32pt; font-weight: 700; letter-spacing: -0.03em; margin-top: 52mm; line-height: 1.05; string-set: business content(); }
.pdf .rp-cover .kind { font-size: 14pt; color: #d5dbe2; margin-top: 6mm; }
.pdf .rp-cover .url { font-size: 11pt; color: #aab4c0; margin-top: 2mm; }
.pdf .rp-cover .risk { margin-top: 38mm; background: #2a3542; border-radius: 18px; padding: 9mm 10mm; }
.pdf .rp-cover .risk b { display: block; font-family: var(--display); font-size: 58pt; font-weight: 700; letter-spacing: -0.035em; line-height: 1; color: #ff9a73; }
.pdf .rp-cover .risk span { display: block; margin-top: 3mm; font-size: 13pt; color: #aab4c0; }
.pdf .rp-cover .score { margin-top: 9mm; display: flex; align-items: center; gap: 6mm; }
.pdf .rp-cover .score b { font-family: var(--display); font-size: 30pt; font-weight: 700; line-height: 1; }
.pdf .rp-cover .score span { font-size: 11pt; color: #d5dbe2; }
.pdf .rp-cover .foot { margin-top: 12mm; font-size: 9.5pt; color: #aab4c0; }
.pdf .page-break { break-before: page; }
/* On paper the page is white, so surfaces are told apart by a hairline. */
.pdf .rp-head { padding: 0 0 8px; border-radius: 0; }
.pdf .rp-risk b { font-size: 40pt; }
.pdf .rp-card { padding: 10px 12px; border: 1px solid var(--line); }
.pdf .rp-plan .col { border: 1px solid var(--line); }
.pdf .rp-card.cnv { border: 1px dashed var(--faint); }
