/* Sample report page. Builds on the tokens and components in styles.css. */

/* Nav */
.rnav { border-bottom-color: var(--line); }
.rnav-actions { display: flex; align-items: center; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; font-size: 14px; font-weight: 500; color: var(--ink-2); text-decoration: none; }
.back-link:hover { color: var(--ink); }
.back-link svg { width: 16px; height: 16px; transform: scaleX(-1); }
.btn svg { width: 16px; height: 16px; flex: none; }

/* Intro above the document */
.r-intro { padding-block: clamp(40px, 7vw, 80px) clamp(28px, 4vw, 44px); }
.r-intro-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 48px; align-items: end; }
.r-eyebrow { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 20px; }
.r-eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.r-intro h1 { font-size: clamp(34px, 4.8vw, 58px); line-height: 1.03; letter-spacing: -0.042em; }
.r-lede { margin-top: 20px; font-size: clamp(17px, 1.6vw, 19px); line-height: 1.55; letter-spacing: -0.01em; color: var(--muted); max-width: 34em; }

/* Stage and sheet */
.r-stage { background: var(--panel); border-top: 1px solid var(--line); padding-block: clamp(20px, 4vw, 56px) clamp(56px, 8vw, 96px); }
.doc {
  max-width: 880px; margin: 0 auto; background: var(--paper);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(12,14,18,.04), 0 24px 64px -24px rgba(12,14,18,.14);
  padding: clamp(22px, 6vw, 64px);
}
.r-after { max-width: 880px; margin: 28px auto 0; text-align: center; font-size: 15px; color: var(--muted); }
.r-after a { color: var(--accent); font-weight: 500; text-underline-offset: 3px; }

/* Document head */
.doc-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 16px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.doc-top .brand { font-size: 17px; }
.doc-top .brand-mark { width: 24px; height: 24px; }
.sample-tag {
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); border: 1px dashed rgba(45,88,230,.45);
  padding: 5px 10px; border-radius: 8px; white-space: nowrap;
}
.doc-head { padding-block: clamp(28px, 4vw, 40px) clamp(24px, 3vw, 32px); }
.doc-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.doc-title { font-size: clamp(28px, 3.8vw, 42px); line-height: 1.06; letter-spacing: -0.038em; }
.doc-sub { margin-top: 12px; font-size: 17px; color: var(--muted); letter-spacing: -0.005em; }

.label { font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.meta { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 24px; border-top: 1px solid var(--ink); }
.meta > div { padding: 14px 0 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.meta dd { margin: 5px 0 0; font-size: 15px; font-weight: 500; letter-spacing: -0.005em; font-variant-numeric: tabular-nums; }
.meta .chip { margin-top: -2px; }

.scope { margin-top: 32px; background: var(--panel); border-radius: 12px; padding: clamp(18px, 2.4vw, 24px); }
.scope .label { margin-bottom: 8px; }
.scope p:last-child { font-size: 14.5px; line-height: 1.65; color: var(--ink-2); }

/* Sections */
.sec { margin-top: clamp(40px, 5vw, 56px); padding-top: clamp(26px, 3.4vw, 34px); border-top: 1px solid var(--line); }
.sec-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.sec-num { font-family: var(--mono); font-size: 12px; color: var(--accent); flex: none; }
.sec h3 { font-size: clamp(22px, 2.6vw, 28px); line-height: 1.15; letter-spacing: -0.03em; }
.sec-p { color: var(--ink-2); max-width: 46em; }
.sec-p + .sec-p { margin-top: 14px; }
.sec .rtbl-wrap + .sec-p { margin-top: 18px; }
.sub-h { font-size: 17px; font-weight: 500; letter-spacing: -0.015em; margin: 30px 0 8px; }
.sec-note { margin-top: 12px; max-width: 46em; font-size: 14px; color: var(--muted); padding-left: 14px; border-left: 2px solid var(--line-2); }
.breakdown td:first-child { color: var(--muted); white-space: nowrap; }

.gaps { margin-top: 20px; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--green-soft); }
.gaps svg { width: 18px; height: 18px; color: var(--green); flex: none; margin-top: 3px; }
.gaps p { color: var(--ink-2); }
.gaps strong { color: var(--green); font-weight: 600; }

/* Funds trace */
.tsteps { list-style: none; margin: 24px 0 0; padding: 0; }
.tstep { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 0 18px; position: relative; padding-bottom: 30px; }
.tstep:last-child { padding-bottom: 0; }
.tstep::before { content: ""; position: absolute; left: 15.5px; top: 38px; bottom: 6px; width: 1px; background: var(--line-2); }
.tstep:last-child::before { display: none; }
.tnum { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--accent); background: var(--paper); color: var(--accent); display: grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 500; }
.tstep:last-child .tnum { background: var(--accent); color: #fff; }
.tbody { min-width: 0; padding-top: 4px; }
.ttitle { font-size: 17px; letter-spacing: -0.015em; }
.tdetail { margin-top: 4px; color: var(--ink-2); max-width: 46em; }
.tref { margin-top: 10px; font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.tref + .tref { margin-top: 3px; }
.tref .mono { color: var(--ink-2); }

/* Tables */
.rtbl-wrap { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.rtbl { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.rtbl th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 10px 14px; background: #FAFAFB; border-bottom: 1px solid var(--line); }
.rtbl td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.rtbl tbody tr:first-child td { border-top: 0; }
.rtbl .num { text-align: right; white-space: nowrap; }
.rtbl .src { color: var(--muted); }
.rtbl .mono { color: var(--ink); white-space: nowrap; }
.rtbl tfoot td { background: var(--green-soft); color: var(--green); border-top: 1px solid rgba(17,128,79,.18); vertical-align: middle; }
.rtbl tfoot strong { font-weight: 600; }
.eref { font-family: var(--mono); font-size: 11.5px; color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 6px; white-space: nowrap; }

/* EDD checklist */
.edd { list-style: none; margin: 20px 0 0; padding: 0; border-top: 1px solid var(--line); }
.edd li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 0 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.edd-ic { width: 24px; height: 24px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; margin-top: 1px; }
.edd-ic svg { width: 14px; height: 14px; }
.edd-q { font-weight: 500; font-size: 16px; letter-spacing: -0.01em; }
.edd-a { margin-top: 4px; color: var(--muted); font-size: 15px; max-width: 46em; }

/* Sign-off */
.doc-foot { margin-top: clamp(44px, 6vw, 64px); padding-top: 26px; border-top: 1px solid var(--ink); }
.disclaimer { font-size: 13.5px; line-height: 1.6; color: var(--muted); max-width: 62em; }
.signoff { margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 24px; }
.signoff > div { border-top: 1px solid var(--line-2); padding-top: 12px; }
.signoff dd { margin: 4px 0 0; font-weight: 500; }

/* Site footer */
.r-footer { padding-block: 28px; }
.r-footer .foot-bottom { margin-top: 0; padding-top: 0; border-top: 0; align-items: center; }

/* Responsive (screen only, so print always gets the full layout) */
@media screen and (max-width: 760px) {
  .r-intro-grid { grid-template-columns: minmax(0, 1fr); }
  .meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media screen and (max-width: 560px) {
  .back-link { display: none; }
  .r-intro .btn { width: 100%; }
  .doc-sub { font-size: 16px; }
  .signoff { grid-template-columns: minmax(0, 1fr); }

  /* Trace: number sits beside the title, content runs full width */
  .tstep { grid-template-columns: 28px minmax(0, 1fr); gap: 0 12px; padding: 22px 0 0; margin-top: 22px; border-top: 1px dashed var(--line-2); }
  .tstep:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
  .tstep::before { display: none; }
  .tnum { width: 28px; height: 28px; font-size: 11.5px; }
  .tbody { display: contents; }
  .tbody > * { grid-column: 1 / -1; }
  .tbody > .ttitle { grid-column: 2; align-self: center; }
  .tdetail { margin-top: 10px; }

  /* Tables become stacked records */
  .rtbl { font-size: 14px; }
  .rtbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .rtbl tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 13px 14px; border-top: 1px solid var(--line); }
  .rtbl tbody tr:first-child { border-top: 0; }
  .rtbl td { display: block; padding: 0; border: 0; min-width: 0; }
  .rtbl .num { text-align: left; }
  .rtbl td[data-label]::before { content: attr(data-label); display: block; font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 1px; }
  .rtbl .lead { grid-column: 1 / -1; font-weight: 500; }
  .rtbl.cols-3 tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .rtbl.recon-t tr { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; }
  .rtbl.recon-t .num { text-align: right; }
  .rtbl.recon-t .src { grid-column: 1 / -1; font-size: 13px; }
  .rtbl.recon-t tfoot tr { background: var(--green-soft); border-top: 1px solid rgba(17,128,79,.18); align-items: center; }
  .rtbl.recon-t tfoot td { background: none; border: 0; }
  .rtbl.recon-t tfoot .src { grid-column: 1 / -1; }

  .rtbl.breakdown tr { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; }
  .rtbl.breakdown td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .rtbl.breakdown .num { text-align: right; }

  .rtbl.evid tr { grid-template-columns: 34px minmax(0, 1fr); gap: 2px 12px; }
  .rtbl.evid td:first-child { grid-row: span 2; }
  .rtbl.evid .src { font-size: 13px; }
}

/* Print: A4, document only */
@page {
  size: A4;
  margin: 16mm 15mm 18mm;
  @bottom-left { content: "ClearSource \00B7  SOF-2026-0001 \00B7  Sample report, synthetic data"; font-family: 'IBM Plex Mono', monospace; font-size: 7.5pt; color: #595E69; }
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font-family: 'IBM Plex Mono', monospace; font-size: 7.5pt; color: #595E69; }
}
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, body { background: #fff; }
  body { font-size: 10pt; line-height: 1.5; }
  .nav, .r-intro, .r-after, .r-footer { display: none !important; }
  .r-stage { background: none; border: 0; padding: 0; }
  .r-stage > .wrap { max-width: none; padding: 0; }
  .doc { max-width: none; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
  a { text-decoration: none; }

  .doc-top { padding-bottom: 14px; }
  .doc-head { padding-block: 22px 18px; }
  .doc-title { font-size: 22pt; }
  .doc-sub { font-size: 11pt; }
  .meta dd { font-size: 10pt; }
  .meta > div { padding: 9px 0 10px; }
  .scope { margin-top: 18px; padding: 12px 14px; }
  .scope p:last-child { font-size: 9pt; }

  .sec { margin-top: 26px; padding-top: 18px; }
  .sec-head { margin-bottom: 10px; }
  .sec-head, .sec-head + .sec-p, .tdetail { break-after: avoid; }
  .sec h3 { font-size: 15pt; }
  .sec-p, .tdetail { font-size: 10pt; }
  .ttitle { font-size: 11pt; }
  .tstep { padding-bottom: 18px; }
  .tref { font-size: 8.5pt; }
  .sub-h { font-size: 11pt; margin: 18px 0 6px; break-after: avoid; }
  .sec-note { font-size: 8.5pt; }
  .rtbl { font-size: 9pt; }
  .rtbl th { font-size: 8pt; padding: 6px 10px; }
  .rtbl td { padding: 6px 10px; }
  .rtbl-wrap { overflow: visible; }
  .edd li { padding: 10px 0; }
  .edd-q { font-size: 10pt; }
  .edd-a { font-size: 9.5pt; }
  .disclaimer { font-size: 8.5pt; }
  .doc-foot { margin-top: 30px; }

  .tstep, .edd li, .rtbl tr, .meta > div, .scope, .gaps, .signoff, .doc-foot { break-inside: avoid; }
}

@media (max-width: 560px) {
  .rnav-actions .btn { display: none; }
  .label, .eref, .sample-tag, .doc-kicker, .r-eyebrow, .sec-num, .tnum { font-size: 12px; }
}
