/* ==========================================================================
   RoB Assistant: visual refresh, closer to the Risk of Bias overview (/rob).
   Loaded after styles.css, sidebars.css and dark-mode.css; only restyles.
   - light canvas, white panels with a hairline border (no heavy shadows)
   - dark ink headings instead of blue, square question numbers
   - muted traffic-light colours for the rating buttons and results
   ========================================================================== */

:root {
  --rr-canvas: #f6f9fb;
  --rr-surface: #ffffff;
  --rr-line: rgba(49, 63, 69, 0.12);
  --rr-ink: #24323a;
  --rr-muted: #5f6f78;
  --rr-blue: #0372b7;
  --rr-teal: #3a9fa3;
  /* rating colours (muted traffic light) */
  --rr-low: #5f9e6a;
  --rr-some: #c9a33d;
  --rr-high: #c4625a;
}
html[data-theme="dark"] {
  --rr-canvas: #243038; /* the site's dark .bg-light */
  --rr-surface: #222d32;
  --rr-line: rgba(108, 117, 125, 0.3);
  --rr-ink: #e2e8eb;
  --rr-muted: #9fb0b8;
  --rr-blue: #4f9fd6;
  --rr-teal: #5ebabd;
  --rr-low: #6faf7a;
  --rr-some: #d2ad4c;
  --rr-high: #cf6d64;
}

/* html too: Chrome shows the root's colour when the page is overscrolled */
html,
body,
html[data-theme="dark"] body { /* dark-mode.css sets its own */
  background-color: var(--rr-canvas) !important;
}

/* ---- Panels: sidebar, main card, info boxes ------------------------------ */
#sidebar .bg-light,
#main-div,
[id^="infobox-"] {
  background-color: var(--rr-surface) !important;
  border: 1px solid var(--rr-line);
  border-radius: 0;
  box-shadow: none !important;
}
/* dark mode: the left menu on the page background (the site's dark .bg-light) */
html[data-theme="dark"] #sidebar .bg-light {
  background-color: var(--rr-canvas) !important;
}
/* an info box without content (e.g. on the notes steps): no frame at all */
[id^="infobox-"]:not(:has(*)) {
  border: 0;
}
/* faint glow from the top-right corner, as on the /rob tiles */
#main-div,
[id^="infobox-"] {
  isolation: isolate;
}
#main-div {
  position: relative;
}
#main-div::before,
[id^="infobox-"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    60% 45% at 100% 0%,
    color-mix(in srgb, var(--rr-blue) 9%, transparent),
    transparent 70%
  );
}
[id^="infobox-"]::before {
  background: radial-gradient(
    75% 80% at 100% 0%,
    color-mix(in srgb, var(--rr-teal) 12%, transparent),
    transparent 70%
  );
}
html[data-theme="dark"] #main-div::before,
html[data-theme="dark"] [id^="infobox-"]::before {
  display: none;
}

/* ---- Sidebar ---------------------------------------------------------------- */
.rr-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--rr-muted) !important; /* muted, as before */
  font-weight: 700 !important;
  letter-spacing: -0.01em;
}
.rr-brand:hover,
.rr-brand:focus-visible {
  color: var(--rr-ink) !important;
  outline: none;
}
/* shield sizing matches handbook (1.9rem on a 16-unit grid) */
.rr-brand__icon {
  position: relative;
  flex: none;
  width: 0.95em;
  height: 0.95em;
  font-size: 1.9rem;
}
.rr-brand__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}
/* traffic-light dots: still at rest; convey through the shield on hover */
.rr-brand__dot {
  position: absolute;
  left: calc(50% - 0.07125em);
  top: calc(2.9 * 0.059375em - 0.07125em);
  width: 0.1425em;
  height: 0.1425em;
  border-radius: 50%;
  background: #6aa874;
  animation: rr-dot-flow 2.7s linear infinite;
  animation-delay: -0.459s;
  animation-play-state: paused;
}
.rr-brand__dot:nth-of-type(2) {
  background: #d2ad4c;
  animation-delay: -1.35s;
}
.rr-brand__dot:nth-of-type(3) {
  background: #cf6d64;
  animation-delay: -2.241s;
}
.rr-brand:hover .rr-brand__dot,
.rr-brand:focus-visible .rr-brand__dot {
  animation-play-state: running;
}
@keyframes rr-dot-flow {
  0% {
    transform: translateY(0) scale(0);
  }
  15% {
    transform: translateY(0.0775em) scale(1);
  }
  85% {
    transform: translateY(0.4391em) scale(1);
  }
  100% {
    transform: translateY(0.5166em) scale(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .rr-brand__dot {
    animation: none;
    transform: translateY(0.0861em);
  }
  .rr-brand__dot:nth-of-type(2) {
    transform: translateY(0.2583em);
  }
  .rr-brand__dot:nth-of-type(3) {
    transform: translateY(0.4305em);
  }
}
#v-badge {
  color: var(--rr-muted) !important;
}
.btn-active {
  background-color: color-mix(in srgb, var(--rr-blue) 10%, var(--rr-surface)) !important;
  color: var(--rr-blue) !important;
  border-radius: 0 !important;
}
html[data-theme="dark"] .btn-active {
  background-color: color-mix(in srgb, var(--rr-blue) 18%, var(--rr-surface)) !important;
  color: #cfe3ee !important;
}

/* ---- Headings, question numbers, rules -------------------------------------- */
#main-div h2,
#main-div h4 {
  color: var(--rr-ink) !important;
  font-weight: 600;
  letter-spacing: -0.01em;
}
#main-div .badge {
  background-color: color-mix(in srgb, var(--rr-blue) 12%, var(--rr-surface)) !important;
  color: var(--rr-blue) !important;
  font-weight: 600 !important;
  border-radius: 0;
}
#main-div hr {
  color: var(--rr-line);
  opacity: 1;
}
/* header images that open / close the explanation below them (inline script) */
#main-div img.rr-explain-img {
  cursor: pointer;
}
/* header images: square top, rounded bottom (as elsewhere on the site) */
#main-div img.rounded {
  border-radius: 0 0 0.5rem 0.5rem !important;
}

/* ---- Rating buttons (No/PN · No Information · Yes/PY) ------------------------
   unselected: a light tint with coloured text; selected: the solid colour */
#main-div .btn-group > .btn-danger { --rr-c: var(--rr-high); }
#main-div .btn-group > .btn-warning { --rr-c: var(--rr-some); }
#main-div .btn-group > .btn-success { --rr-c: var(--rr-low); }
#main-div .btn-group > .btn-check + .btn {
  background-color: color-mix(in srgb, var(--rr-c) 14%, var(--rr-surface)) !important;
  border: 1px solid color-mix(in srgb, var(--rr-c) 35%, var(--rr-surface)) !important;
  color: color-mix(in srgb, var(--rr-c) 75%, #000) !important;
  box-shadow: none !important;
  font-weight: 500;
}
html[data-theme="dark"] #main-div .btn-group > .btn-check + .btn {
  color: color-mix(in srgb, var(--rr-c) 70%, #fff) !important;
}
#main-div .btn-group > .btn-check:checked + .btn,
html[data-theme="dark"] #main-div .btn-group > .btn-check:checked + .btn {
  background-color: var(--rr-c) !important;
  border-color: var(--rr-c) !important;
  color: #fff !important;
}
/* square buttons; the last one follows the image's rounded bottom corner */
#main-div .btn-group > .btn {
  border-radius: 0 !important;
}
#main-div .btn-group > .btn:last-child {
  border-bottom-right-radius: 0.5rem !important;
}
#main-div .btn-group > .btn-check:focus-visible + .btn {
  outline: 2px solid color-mix(in srgb, var(--rr-c) 60%, transparent);
  outline-offset: 2px;
}
/* the frame around the floating button group takes the panel colour */
html[data-theme="dark"] #main-div .btn-group {
  background-color: var(--rr-surface) !important;
  border-color: var(--rr-surface) !important;
  border-top-color: var(--rr-surface) !important;
  border-left-color: var(--rr-surface) !important;
}

/* ---- Buttons ---------------------------------------------------------------- */
#main-div .btn-muted {
  background-color: var(--rr-surface) !important;
  border: 1px solid var(--rr-line) !important;
  color: var(--rr-ink) !important;
  box-shadow: none !important;
}
#main-div .btn-muted:hover {
  border-color: color-mix(in srgb, var(--rr-muted) 45%, var(--rr-line)) !important;
}

/* ---- Results: rating squares in the muted traffic-light colours -------------- */
#main-content-results .rating.bg-success {
  background-color: var(--rr-low) !important;
  border-color: var(--rr-low) !important;
}
#main-content-results .rating.bg-warning {
  background-color: var(--rr-some) !important;
  border-color: var(--rr-some) !important;
}
#main-content-results .rating.bg-danger {
  background-color: var(--rr-high) !important;
  border-color: var(--rr-high) !important;
}
#main-content-results .card {
  border-color: var(--rr-line) !important;
  border-radius: 0;
}

/* ==========================================================================
   Results page
   ========================================================================== */

/* ---- Overall verdict card ------------------------------------------------- */
#main-content-results .rr-verdict-img {
  display: block;
  border: 1px solid var(--rr-line);
  border-bottom: 0;
}
#main-content-results .rr-verdict {
  --v: var(--rr-line);
  position: relative;
  border: 1px solid var(--rr-line) !important;
  border-radius: 0 0 0.5rem 0.5rem;
  background-color: var(--rr-surface) !important;
  padding-right: 5rem !important;
}
/* the verdict colour follows what app.js sets on the (hidden) old symbol */
#main-content-results .rr-verdict:has(#rating-overall-symbol[style*="success"]) { --v: var(--rr-low); }
#main-content-results .rr-verdict:has(#rating-overall-symbol[style*="warning"]) { --v: var(--rr-some); }
#main-content-results .rr-verdict:has(#rating-overall-symbol[style*="danger"]) { --v: var(--rr-high); }
#main-content-results #rating-overall-symbol {
  display: none;
}
/* once rated: a faint tint of the verdict colour, and the verdict in it */
#main-content-results .rr-verdict:has(#rating-overall-symbol[style*="var"]),
html[data-theme="dark"] #main-content-results .rr-verdict:has(#rating-overall-symbol[style*="var"]) {
  background-color: color-mix(in srgb, var(--v) 7%, var(--rr-surface)) !important;
}
#main-content-results #overall-rating {
  color: color-mix(in srgb, var(--v) 80%, #000) !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em;
}
html[data-theme="dark"] #main-content-results #overall-rating {
  color: color-mix(in srgb, var(--v) 75%, #fff) !important;
}
#main-content-results .rr-verdict:not(:has(#rating-overall-symbol[style*="var"])) #overall-rating {
  color: var(--rr-ink) !important;
}
/* shield with only the matching dot lit */
.rr-verdict-shield {
  position: absolute;
  top: 50%;
  right: 1.25rem;
  width: 3.25rem;
  height: 3.25rem;
  transform: translateY(-50%);
  color: var(--rr-muted);
}
.rr-verdict-shield circle {
  fill: var(--rr-muted);
  opacity: 0.25;
}
.rr-verdict-shield .rr-dot-low { fill: var(--rr-low); }
.rr-verdict-shield .rr-dot-some { fill: var(--rr-some); }
.rr-verdict-shield .rr-dot-high { fill: var(--rr-high); }
.rr-verdict:has(#rating-overall-symbol[style*="success"]) .rr-dot-low,
.rr-verdict:has(#rating-overall-symbol[style*="warning"]) .rr-dot-some,
.rr-verdict:has(#rating-overall-symbol[style*="danger"]) .rr-dot-high {
  opacity: 1;
}

/* ---- Quieter link and buttons ------------------------------------------------ */
.rr-link-quiet {
  color: var(--rr-muted) !important;
  text-decoration: none;
  font-size: 0.95rem;
}
.rr-link-quiet:hover {
  color: var(--rr-blue) !important;
}
/* export: "Download (long)" stays the primary (blue) action; the rest are quiet */
#main-content-results .rob-export-btn,
#infobox-results .rob-rate-new-btn {
  border-radius: 0 !important;
}
.rr-btn-quiet,
.rr-btn-quiet.btn-primary,
.rr-btn-quiet.btn-secondary {
  background-color: var(--rr-surface) !important;
  border: 1px solid var(--rr-line) !important;
  color: var(--rr-ink) !important;
  box-shadow: none !important;
  transition: border-color 160ms ease, color 160ms ease;
}
.rr-btn-quiet svg {
  color: var(--rr-blue);
}
.rr-btn-quiet:hover,
.rr-btn-quiet:focus-visible {
  border-color: color-mix(in srgb, var(--rr-muted) 45%, var(--rr-line)) !important;
}
/* copied: app.js swaps btn-primary for btn-secondary for 2 s and shows a check */
#btn-clipboard.rr-btn-quiet.btn-secondary,
#btn-clipboard.rr-btn-quiet.btn-secondary svg {
  color: var(--rr-low) !important;
}
#btn-clipboard.rr-btn-quiet.btn-secondary {
  border-color: color-mix(in srgb, var(--rr-low) 50%, var(--rr-line)) !important;
}

/* ==========================================================================
   Step navigation: larger "Proceed" / "Go Back" buttons (easier to hit)
   ========================================================================== */
#main-div [id^="main-content-"] > button.btn-primary.mt-3,
#main-div [id^="main-content-"] > button.btn-muted.mt-3 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0.7rem 1.35rem !important;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.2;
  border-radius: 6px !important;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease,
    transform 90ms ease, box-shadow 90ms ease;
}
/* 3D, as the original buttons: a darker bottom edge and a light top
   highlight; pressing moves the button down onto its edge */
#main-div [id^="main-content-"] > button.btn-primary.mt-3 {
  min-width: 10rem;
  background-color: #0372b7 !important;
  border: 1px solid #035f99 !important;
  border-bottom: 3px solid #024a77 !important;
  color: #fff !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 2px rgba(3, 60, 95, 0.25) !important;
}
#main-div [id^="main-content-"] > button.btn-primary.mt-3:hover,
#main-div [id^="main-content-"] > button.btn-primary.mt-3:focus-visible {
  background-color: #0367a6 !important;
}
#main-div [id^="main-content-"] > button.btn-muted.mt-3 {
  min-width: 8rem;
  border: 1px solid rgba(49, 63, 69, 0.18) !important;
  border-bottom: 3px solid rgba(49, 63, 69, 0.28) !important;
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(36, 50, 58, 0.08) !important;
}
html[data-theme="dark"] #main-div [id^="main-content-"] > button.btn-muted.mt-3 {
  border-color: rgba(108, 117, 125, 0.4) !important;
  border-bottom-color: rgba(0, 0, 0, 0.45) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}
#main-div [id^="main-content-"] > button.mt-3:active {
  transform: translateY(2px);
  border-bottom-width: 1px !important;
  margin-bottom: 2px;
  box-shadow: none !important;
}
/* arrows nudge in their direction */
#main-div [id^="main-content-"] > button.mt-3 svg {
  flex: none;
  transition: transform 200ms ease;
}
#main-div [id^="main-content-"] > button.btn-primary.mt-3:hover svg {
  transform: translateX(0.2rem);
}
#main-div [id^="main-content-"] > button.btn-muted.mt-3:hover svg {
  transform: translateX(-0.2rem);
}
#main-div [id^="main-content-"] > button.mt-3:focus-visible {
  outline: 2px solid color-mix(in srgb, #0372b7 55%, transparent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  #main-div [id^="main-content-"] > button.mt-3:hover svg,
  #main-div [id^="main-content-"] > button.mt-3:active {
    transform: none;
  }
}
