/* report.css — Monthly Report page. Loaded after style.css, which supplies the
   top bar, footer, cards, buttons and toast. Everything here starts with rp-
   so it can never clash with the main page. */

/* Before a report is drawn the page is short, so keep the footer at the bottom
   of the window instead of halfway up it. */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page {
  flex: 1;
  width: 100%;
}

/* ---------- upload form ---------- */
.seo-form input[type='month'],
.seo-form input[type='file'] {
  width: 100%;
  border: none;
  outline: none;
  font: inherit;
  font-size: 15px;
  color: #333;
  background: transparent;
  padding: 4px 2px;
}
.seo-form input[type='file'] {
  cursor: pointer;
}

/* Month dropdown. style.css turns the browser's own arrow off for every
   select, so a small chevron is drawn here — with borders, not an image, so
   this file still has no url(). */
.rp-select-wrap {
  position: relative;
}
.rp-select-wrap::after {
  content: '';
  position: absolute;
  right: 6px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid #666;
  border-bottom: 2px solid #666;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.seo-form .rp-select-wrap select {
  padding-right: 26px;
  text-overflow: ellipsis;
}
.seo-form .rp-select-wrap select:disabled {
  color: #999;
  cursor: progress;
}

/* "Which month?" box, shown only for "Another month". */
.rp-other-month {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e0e0e0;
  font-size: 14px;
  color: #444;
}
.rp-other-month[hidden] {
  display: none;
}
.rp-other-month label {
  white-space: nowrap;
}
.seo-form .rp-other-month input[type='month'] {
  flex: 1;
  min-width: 0;
}

/* Small grey line under a field; red when something went wrong. */
.rp-field-note {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: #777;
}
.rp-field-note:empty {
  display: none;
}
.rp-field-note.is-error {
  color: #b71c1c;
}
.rp-link-btn {
  font: inherit;
  padding: 0;
  border: none;
  background: none;
  color: #2b6cff;
  text-decoration: underline;
  cursor: pointer;
}

/* The sheet upload, while the month is already in the database. */
.seo-form .field:disabled {
  background: #fafafa;
}
.seo-form .field:disabled input[type='file'] {
  opacity: 0.55;
  cursor: not-allowed;
}

.rp-error {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 4px;
  border: 1px solid #f5c2bd;
  background: #fdecea;
  color: #b71c1c;
  font-size: 14px;
}
.rp-error p {
  margin: 0;
}
.rp-error .rp-error-hint {
  margin: 10px 0 6px;
  color: #555;
}

/* ---------- tools bar above the report ---------- */
.rp-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.rp-tools[hidden] {
  display: none;
}
.rp-month-switch {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: #555;
}
.rp-month-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rp-month-row .btn.is-current {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
  cursor: default;
}

/* ---------- the report "paper" ---------- */
.report {
  padding: 40px 52px 44px;
  line-height: 1.55;
  font-size: 15px;
  color: #1a1a1a;
}
.report p {
  margin: 0 0 12px;
}

.rp-masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #ddd;
}
.rp-brand {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.rp-brand b {
  color: #d71f2b;
}
.rp-draft {
  border: 1px solid #ccc;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #555;
}

.rp-kicker {
  margin: 24px 0 8px !important;
  color: #d71f2b;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.rp-headline {
  margin: 0 0 14px;
  font-size: 34px;
  line-height: 1.15;
  font-weight: 800;
}
.rp-standfirst {
  font-size: 18.5px;
  line-height: 1.5;
  color: #555;
}
.rp-period {
  font-size: 13px;
  color: #777;
}

/* stat cards */
.rp-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 24px 0 28px;
}
.rp-stat {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rp-stat-label {
  font-size: 13px;
  color: #555;
}
.rp-stat-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
}
.rp-stat-sub {
  font-size: 12.5px;
  color: #666;
  line-height: 1.4;
}

/* key highlights */
.rp-box {
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 20px 24px 10px;
}
.rp-box h2 {
  margin: 0 0 12px;
  font-size: 22px;
}
.rp-highlights {
  list-style: none;
  margin: 0;
  padding: 0;
}
.rp-highlights li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 10px;
}
.rp-highlights li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.5em;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #d71f2b;
}

/* sections */
.rp-section h2 {
  margin: 36px 0 12px;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 800;
}
.rp-theme h3 {
  margin: 22px 0 8px;
  font-size: 18px;
}

.rp-link {
  color: #1f5fb4;
}
.rp-link:hover {
  text-decoration: underline;
}

/* chips: language, AI, Media, Old */
.rp-chip {
  display: inline-block;
  border: 1px solid #ccc;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 11.5px;
  line-height: 18px;
  color: #444;
  white-space: nowrap;
  vertical-align: 1px;
}
.rp-chip.lang {
  font-weight: 600;
  color: #222;
}
.rp-chip.ai {
  border: 1.5px solid #1a1a1a;
  font-weight: 700;
  color: #1a1a1a;
}
.rp-flags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ---------- charts ---------- */
/* Series colours in a fixed order — the PDF's blue, orange, green and amber,
   with green and amber a step darker so neighbours stay apart for
   colour-blind readers. Every use also has a text legend. */
.rp-c0 { background: #2f7ed8; }
.rp-c1 { background: #e8693a; }
.rp-c2 { background: #159570; }
.rp-c3 { background: #d99400; }
.rp-cother { background: #a8a69e; }

.rp-chart {
  margin: 18px 0 22px;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 18px 20px 14px;
}
.rp-chart h3 {
  margin: 0 0 2px;
  font-size: 17px;
  line-height: 1.3;
}
.rp-chart h4 {
  margin: 14px 0 8px;
  font-size: 14px;
  font-weight: 600;
}
.rp-sub {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px !important;
}
.rp-note {
  font-size: 12.5px;
  color: #777;
  margin: 12px 0 0 !important;
}

/* horizontal bars */
.rp-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.rp-bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 34%) 1fr;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.rp-bar-label {
  text-align: right;
  line-height: 1.25;
}
.rp-bar-track {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rp-bar {
  height: 14px;
  min-width: 2px;
  background: #2f7ed8;
  border-radius: 0 4px 4px 0;
}
.rp-bar-value {
  font-size: 12px;
  color: #555;
}

/* stacked share bar + legend */
.rp-stack {
  display: flex;
  gap: 2px;
  height: 22px;
  border-radius: 4px;
  overflow: hidden;
}
.rp-seg {
  flex-basis: 0;
  min-width: 3px;
}
.rp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 10px;
  font-size: 13px;
  color: #444;
}
.rp-legend-item b {
  color: #1a1a1a;
}
.rp-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: -1px;
}

/* monthly columns */
.rp-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
.rp-cols {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 150px;
  border-bottom: 1px solid #bbb;
}
.rp-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}
.rp-col-bar {
  width: 100%;
  max-width: 30px;
  min-height: 2px;
  background: #d6d4cc;
  border-radius: 4px 4px 0 0;
}
.rp-col.is-selected .rp-col-bar {
  background: #2f7ed8;
}
.rp-col-value {
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
}
.rp-col-labels {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.rp-col-labels span {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: #666;
}
.rp-col-labels .is-selected {
  color: #1a1a1a;
  font-weight: 700;
}

/* dot timeline */
.rp-tl-row {
  display: grid;
  grid-template-columns: minmax(110px, 30%) 1fr;
  gap: 14px;
  align-items: end;
  border-bottom: 1px solid #e2e2e2;
  padding: 6px 0;
}
.rp-tl-row.rp-tl-axis {
  border-bottom: none;
  padding-top: 4px;
}
.rp-tl-label {
  text-align: right;
  font-size: 13px;
  line-height: 1.25;
  padding-bottom: 4px;
}
.rp-tl-label small {
  display: block;
  color: #777;
  font-size: 11.5px;
}
/* The side margins leave room for half a dot on day 1 and the last day. */
.rp-track {
  position: relative;
  margin: 0 6px;
}
.rp-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2f7ed8;
  transform: translateX(-50%);
}
.rp-axis {
  height: 16px;
}
.rp-tick {
  position: absolute;
  transform: translateX(-50%);
  font-size: 11.5px;
  color: #777;
}
.rp-axis-title {
  font-size: 12.5px;
  color: #666;
  margin: 6px 0 0 !important;
}

/* ---------- tables ---------- */
.rp-table-wrap {
  overflow-x: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin: 14px 0 6px;
}
.rp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.4;
}
.rp-table th {
  text-align: left;
  font-weight: 600;
  color: #555;
  padding: 9px 10px;
  border-bottom: 1px solid #ddd;
  white-space: nowrap;
}
.rp-table td {
  padding: 8px 10px;
  border-top: 1px solid #eee;
  vertical-align: top;
}
.rp-table td:first-child {
  white-space: nowrap;
}

/* theme fact-check lists */
.rp-fc-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  font-size: 13.5px;
}
.rp-fc-list li {
  padding: 5px 0;
  border-top: 1px solid #f0f0f0;
}
.rp-fc-date {
  display: inline-block;
  width: 52px;
  color: #666;
}
.rp-fc-list .rp-chip.lang {
  margin-right: 4px;
}

/* methodology box */
.rp-notes {
  margin: 34px 0 10px;
  padding: 16px 22px 8px;
  background: #fff7df;
  border-left: 4px solid #f0a500;
  border-radius: 0 10px 10px 0;
}
.rp-notes h3 {
  margin: 0 0 8px;
  font-size: 17px;
}
.rp-notes ul {
  margin: 0;
  padding-left: 20px;
}
.rp-notes li {
  margin-bottom: 8px;
}

.rp-foot {
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px solid #ddd;
  font-size: 13px;
  color: #666;
}
.rp-foot-meta {
  font-size: 12px;
  color: #999;
}

/* ---------- page with the topics sidebar ---------- */
/* Wider than style.css's 900px, so the sidebar fits beside a full-width
   report. The form card and a report without a sidebar keep the old width. */
.rp-page {
  max-width: 1200px;
}
.rp-form-card,
.rp-layout {
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}
.rp-layout.has-sidebar {
  max-width: none;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* Stays in view while the report scrolls; the list scrolls on its own. */
.rp-sidebar {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 4px;
  padding: 18px 12px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.rp-sidebar[hidden] {
  display: none;
}
.rp-side-title {
  margin: 0 6px 4px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 20px;
}
.rp-side-sub {
  margin: 0 6px 10px;
  font-size: 12.5px;
  line-height: 1.4;
  color: #777;
}
.rp-side-search {
  width: 100%;
  margin-bottom: 8px;
  padding: 7px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font: inherit;
  font-size: 14px;
}
.rp-side-search:focus {
  outline: 2px solid #2b6cff;
  outline-offset: -1px;
}
.rp-side-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
}
.rp-side-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.35;
  color: #222;
}
.rp-side-link:hover,
.rp-side-link:focus-visible {
  background: #f2f2f2;
}
.rp-side-link.is-current {
  background: #1a1a1a;
  color: #fff;
}
.rp-side-count {
  flex: none;
  font-size: 12px;
  color: #888;
  font-variant-numeric: tabular-nums;
}
.rp-side-link.is-current .rp-side-count {
  color: #ccc;
}
.rp-side-empty {
  margin: 6px 8px;
  font-size: 13px;
  color: #888;
}

/* Below this width the sidebar sits above the report instead. */
@media (max-width: 900px) {
  .rp-layout.has-sidebar {
    display: block;
  }
  .rp-sidebar {
    position: static;
    max-height: 320px;
    margin-bottom: 18px;
  }
}

/* ---------- topic page ---------- */
.rp-status {
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
  padding: 22px 26px;
  font-size: 15px;
  color: #444;
}
.rp-status[hidden] {
  display: none;
}
.rp-status.is-error {
  color: #b71c1c;
}
.rp-status p {
  margin: 0;
}
.rp-status p + p {
  margin-top: 10px;
}
.rp-claim {
  margin: 4px 0 0 !important;
  font-size: 12.5px;
  color: #666;
}

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .report {
    padding: 22px 16px 28px;
  }
  .rp-headline {
    font-size: 26px;
  }
  .rp-standfirst {
    font-size: 16.5px;
  }
  .rp-stats {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .rp-stat-value {
    font-size: 26px;
  }
  .rp-two-col {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .rp-bar-row,
  .rp-tl-row {
    grid-template-columns: 38% 1fr;
    gap: 8px;
  }
  .rp-section h2 {
    font-size: 22px;
  }
  .rp-chart {
    padding: 14px 12px 12px;
  }
}

/* ---------- print / Save as PDF ---------- */
/* Page numbers in the margin (Chrome). The left-hand footer with the month
   (and topic) is added by setPrintFooter() in report-common.js, since only the
   page script knows them. */
@page {
  size: A4;
  margin: 16mm 15mm 18mm;
  @bottom-right {
    content: 'Page ' counter(page) ' of ' counter(pages);
    font-size: 8pt;
    color: #777;
  }
  @bottom-left {
    font-size: 8pt;
    color: #777;
  }
}
@media print {
  html,
  body {
    background: #fff;
  }
  .topbar,
  .sitefoot,
  .no-print,
  .toast {
    display: none !important;
  }
  .page {
    max-width: none;
    margin: 0;
    padding: 0;
  }
  .report.card {
    padding: 0;
    margin: 0;
    box-shadow: none;
  }
  /* Browsers drop background colours when printing unless told not to — and
     every bar in the charts is a background colour. */
  .report * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .rp-stats,
  .rp-stat,
  .rp-box,
  .rp-chart,
  .rp-table tr,
  .rp-fc-list li,
  .rp-notes li {
    break-inside: avoid;
  }
  .rp-section h2,
  .rp-theme h3 {
    break-after: avoid;
  }
  .rp-table-wrap {
    overflow: visible;
  }
  /* The sidebar is hidden (no-print), so the report takes the whole page. */
  .rp-layout,
  .rp-layout.has-sidebar {
    display: block;
    max-width: none;
  }
}
