/*
 * The scan report on screen (/r/<id>, body.rw), in the same language as the PDF (report-print.css):
 * an ink cover with a red glow, the score ring and the mascot, then numbered sections on paper.
 * One accent (Kolabaja red), one warm gray family, General Sans with tabular figures for numbers.
 */

@media screen {
  .rw {
    --rw-ink: #12110e;
    --rw-ink-2: #1c1a16;
    --rw-paper: #f6f2ea;
    --rw-soft: rgba(246, 242, 234, 0.72);
    --rw-faint: rgba(246, 242, 234, 0.14);
    --rw-glow: #e0716b;
    background:
      radial-gradient(1200px 520px at 85% -120px, rgba(181, 42, 42, 0.07), transparent 70%),
      var(--bg);
  }

  /* Paper grain over the whole page, never in the way. */
  .rw::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.35;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.07 0 0 0 0 0.06 0 0 0 0 0.05 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }

  .rw main,
  .rw .shared-top,
  .rw .staff-bar { position: relative; z-index: 1; }

  .rw .panel.result {
    background: transparent;
    border: 0;
    overflow: visible;
  }

  .rw .panel.result > .panel-in {
    padding: clamp(12px, 2vw, 20px) var(--gutter) clamp(48px, 7vw, 88px);
  }

  .rw .lede,
  .rw .rx p,
  .rw .rcard p { text-wrap: pretty; }

  .rw b,
  .rw .pillar b,
  .rw .ring b,
  .rw .rx-table td,
  .rw .st-big b { font-variant-numeric: tabular-nums; }

  /* ---------------- cover ---------------- */

  .rw-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: clamp(22px, 3.4vw, 40px) clamp(20px, 4vw, 48px) clamp(24px, 3.4vw, 36px);
    border-radius: 32px;
    background: var(--rw-ink);
    color: var(--rw-paper);
    box-shadow: 0 30px 60px -36px rgba(60, 20, 12, 0.55);
  }

  .rw-hero::before {
    content: '';
    position: absolute;
    z-index: -1;
    right: -14%;
    top: -55%;
    width: 70%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(181, 42, 42, 0.55), rgba(181, 42, 42, 0) 66%);
  }

  .rw-hero::after {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    background-image:
      linear-gradient(rgba(246, 242, 234, 0.035) 1px, transparent 1px),
      linear-gradient(90deg, rgba(246, 242, 234, 0.035) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: linear-gradient(120deg, transparent 20%, #000 60%, transparent 95%);
  }

  .rw-kicker {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 16px;
    margin: 0 0 clamp(22px, 4vw, 40px);
    padding-bottom: 16px;
    border-bottom: 1px solid var(--rw-faint);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--rw-soft);
  }

  .rw-kicker span:first-child { color: var(--rw-glow); }

  .rw-mascot {
    position: absolute;
    z-index: 0;
    right: clamp(8px, 3vw, 40px);
    bottom: 0;
    width: clamp(120px, 15vw, 190px);
    height: auto;
    pointer-events: none;
    filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.35));
  }

  .rw-hero > :not(.rw-mascot) { position: relative; z-index: 1; }

  .rw .rw-hero .result-top { padding-right: clamp(0px, 14vw, 200px); }
  .rw .rw-hero .pill { display: none; }

  .rw .rw-hero h2 {
    margin: 0 0 12px;
    font-size: clamp(30px, 4.4vw, 54px);
    font-weight: 600;
    line-height: 1.02;
    letter-spacing: -0.035em;
    color: var(--rw-paper);
    text-wrap: balance;
  }

  .rw .rw-hero .hl {
    display: block;
    color: var(--rw-glow);
    background: none;
    overflow-wrap: break-word;
  }

  .rw .rw-hero .lede {
    max-width: 52ch;
    margin: 0;
    font-size: clamp(16px, 1.4vw, 18px);
    color: var(--rw-soft);
  }

  .rw .rw-hero .r-partial { color: var(--rw-soft); }

  /* Score ring on ink. */
  .rw .rw-hero .ring {
    width: clamp(140px, 16vw, 188px);
    height: clamp(140px, 16vw, 188px);
    background: conic-gradient(var(--red) calc(var(--v) * 1%), rgba(246, 242, 234, 0.1) 0);
    box-shadow: 0 0 0 1px var(--rw-faint), 0 0 60px -10px rgba(181, 42, 42, 0.6);
  }

  .rw .rw-hero .ring::before { inset: 11px; background: var(--rw-ink-2); }
  .rw .rw-hero .ring span { color: var(--rw-soft); font-size: 13px; letter-spacing: 0.04em; }
  .rw .rw-hero .ring b { color: var(--rw-paper); font-size: clamp(44px, 5vw, 60px); font-weight: 600; }

  /* Pillars: one ruled strip instead of four boxes. */
  .rw .rw-hero .pillars {
    gap: 0;
    margin-top: clamp(24px, 4vw, 40px);
    border-top: 1px solid var(--rw-faint);
    padding-right: clamp(0px, 14vw, 200px);
  }

  .rw .rw-hero .pillar {
    padding: 16px 18px 4px 0;
    border: 0;
    border-radius: 0;
    background: none;
  }

  .rw .rw-hero .pillar + .pillar { padding-left: 18px; border-left: 1px solid var(--rw-faint); }
  .rw .rw-hero .pillar span { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--rw-soft); }
  .rw .rw-hero .pillar b { margin-top: 4px; font-size: clamp(28px, 3vw, 38px); font-weight: 600; color: var(--rw-paper); }
  .rw .rw-hero .bar { height: 3px; background: rgba(246, 242, 234, 0.1); }
  .rw .rw-hero .bar i { background: var(--rw-glow); }

  .rw .rw-hero .report-tools {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 22px;
  }

  .rw .rw-hero .report-tools .btn {
    padding: 6px 20px;
    background: var(--rw-paper);
    color: var(--rw-ink);
    border-color: transparent;
    transition: transform 0.2s, background 0.2s;
  }

  .rw .rw-hero .report-tools .btn:hover { background: #fff; transform: translateY(-1px); }
  .rw .rw-hero .report-tools .btn:active { transform: translateY(1px) scale(0.98); }
  .rw-id { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(246, 242, 234, 0.45); }

  /* ---------------- numbered sections ---------------- */

  .rw-h {
    display: flex;
    align-items: baseline;
    gap: 14px;
    margin: clamp(48px, 7vw, 80px) 0 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line-2);
    font-size: clamp(24px, 2.6vw, 34px);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.1;
  }

  .rw-h i {
    font-style: normal;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--red);
    transform: translateY(-4px);
  }

  /* ---------------- priorities: a ranked list, like the PDF ---------------- */

  .rw .issues {
    counter-reset: prio;
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 0;
    border-radius: 22px;
    background: var(--panel);
    border: 1px solid var(--line);
    overflow: hidden;
  }

  .rw .issues li {
    counter-increment: prio;
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    column-gap: 14px;
    padding: 18px 22px;
    border: 0;
    border-radius: 0;
    background: none;
    font-size: 15.5px;
    line-height: 1.55;
    transition: background 0.2s;
  }

  .rw .issues li + li { border-top: 1px solid var(--line); }
  .rw .issues li:hover { background: var(--panel-2); }

  .rw .issues li::before {
    content: counter(prio, decimal-leading-zero);
    grid-row: 1 / span 2;
    align-self: start;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(181, 42, 42, 0.09);
    color: var(--red);
    font-weight: 600;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
  }

  .rw .issues li.warn::before { background: rgba(163, 101, 0, 0.1); color: var(--warn); }
  .rw .issues li.ok::before { content: '✓'; background: rgba(26, 127, 75, 0.1); color: var(--ok); }
  .rw .issues li b { grid-column: 2; margin: 2px 0 2px; font-size: 16.5px; font-weight: 600; }
  .rw .issues li b::before { display: none; }
  .rw .issues li > :not(b) { grid-column: 2; }
  .rw .issues li i { font-size: 11px; letter-spacing: 0.12em; padding: 3px 8px; border-radius: 6px; background: var(--chip); }

  /* ---------------- cards and stories ---------------- */

  .rw .rcards { margin-top: 0; gap: 16px; align-items: start; }

  .rw .rcard,
  .rw .rx-card,
  .rw .rchecks .psec {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  }

  .rw .rcard { padding: clamp(18px, 2.4vw, 26px); }
  .rw .rcard h3,
  .rw .rx-h { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }

  .rw .rx { margin: 0 0 28px; }
  .rw .rx-stories .rx-story { margin-top: 0; padding: clamp(20px, 2.6vw, 30px); }
  .rw .rx-stories .rx-story + .rx-story { margin-top: 16px; }

  .rw .rchecks .psec { padding: clamp(16px, 2vw, 22px); margin-bottom: 14px; }

  .rw .result-cta,
  .rw .pro-ask {
    margin-top: 32px;
    padding: clamp(20px, 3vw, 28px);
    border: 0;
    border-radius: 22px;
    background: var(--rw-ink);
    color: var(--rw-paper);
  }

  .rw .result-cta p,
  .rw .pro-ask p { color: var(--rw-soft); }
  .rw .result-cta .btn { background: var(--red); color: var(--on-red); border-color: transparent; padding: 6px 20px; }
  .rw .pro-ask .btn { background: var(--rw-paper); color: var(--rw-ink); border-color: transparent; }

  .rw .unlock { border-radius: 22px; }

  /* Small screens: the mascot steps back, pillars go 2 × 2. */
  @media (max-width: 760px) {
    .rw .rw-hero .result-top { grid-template-columns: 1fr; padding-right: 0; }
    .rw .rw-hero .pillars { grid-template-columns: repeat(2, 1fr); padding-right: 0; }
    .rw .rw-hero .pillar:nth-child(3) { padding-left: 0; border-left: 0; }
    .rw-mascot { width: 96px; top: 64px; bottom: auto; opacity: 0.9; }
    .rw .issues li { grid-template-columns: 36px minmax(0, 1fr); padding: 16px; }
    .rw .issues li::before { width: 36px; height: 36px; }
  }

  @media (prefers-reduced-motion: reduce) {
    .rw * { transition: none !important; animation: none !important; }
  }
}
