/* MVTLoop study brand (studyBrand.js). Only applies when a study sets its own secondary or
   tertiary colour, so studies with a single accent colour look exactly as before. */

/* Primary: solid buttons in the brand colour (brand systems rarely use gradients). */
html[data-study-brand="custom"] body:not(.marketing-mode) .btn-primary {
  background-image: none; background-color: var(--brand-primary); border-color: var(--brand-primary);
}
html[data-study-brand="custom"] body:not(.marketing-mode) .btn-primary:hover:not(:disabled) {
  background-image: none; background-color: var(--accent-hover);
}
/* A dark primary also colours headings, as government and corporate brands usually do. */
html[data-study-brand="custom"][data-study-brand-dark] body:not(.marketing-mode) .screen-title { color: var(--brand-primary); }

/* Secondary: links, hover and focus. */
html[data-study-brand="custom"] body:not(.marketing-mode) .card a:not(.btn) { color: var(--brand-secondary); }
html[data-study-brand="custom"] body:not(.marketing-mode) :focus-visible { outline-color: var(--brand-secondary); }

/* Tertiary: small highlights – required markers, the step pill dot, the progress bar end. */
html[data-study-brand="custom"] .question-label .required,
html[data-study-brand="custom"] .question-label span[aria-hidden],
html[data-study-brand="custom"] .required-tag { color: var(--brand-highlight, var(--brand-tertiary)); }
html[data-study-brand="custom"] .step-indicator::before { background: var(--brand-highlight, var(--brand-tertiary)); }
html[data-study-brand="custom"] #progress-bar { background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary) 70%, var(--brand-highlight, var(--brand-tertiary))); }

/* Selection ring in the brand colour rather than the default purple. */
html[data-study-brand="custom"] .choice-item.selected,
html[data-study-brand="custom"] .choice-item:has(input:checked) { box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .16); }


/* Square corners (Setup → Brand → Corner style): no rounded buttons, text boxes, radio buttons, checkboxes,
   cards, chips or pop-ups anywhere in the participant view. */
html[data-study-corners="square"] *,
html[data-study-corners="square"] *::before,
html[data-study-corners="square"] *::after { border-radius: 0 !important; }

/* Radio buttons and checkboxes are drawn by the browser, which keeps them round (or slightly rounded)
   whatever border-radius says, so square corners draw them ourselves: a square box with a square mark. */
html[data-study-corners="square"] input[type="radio"],
html[data-study-corners="square"] input[type="checkbox"] {
  -webkit-appearance: none; appearance: none;
  width: 1.15rem; height: 1.15rem; flex: none; margin: 0; vertical-align: middle;
  display: inline-grid; place-content: center;
  border: 2px solid var(--brand-primary, #5146D8); background: #fff;
}
html[data-study-corners="square"] input[type="radio"]::before,
html[data-study-corners="square"] input[type="checkbox"]::before {
  content: ""; width: .55rem; height: .55rem; background: var(--brand-primary, #5146D8);
  transform: scale(0); transition: transform .1s ease-out;
}
html[data-study-corners="square"] input[type="radio"]:checked::before,
html[data-study-corners="square"] input[type="checkbox"]:checked::before { transform: scale(1); }

/* Every selected choice shows a tick, for checkboxes and for pick-one (radio) questions alike. */
html[data-study-corners="square"] input[type="checkbox"]::before,
html[data-study-corners="square"] input[type="radio"]::before {
  width: .3rem; height: .6rem; margin-top: -.1rem; background: none;
  border: solid var(--brand-primary, #5146D8); border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
}
html[data-study-corners="square"] input[type="checkbox"]:checked::before,
html[data-study-corners="square"] input[type="radio"]:checked::before { transform: rotate(45deg) scale(1); }

/* Welcome / consent screen, "Banner" layout (Setup → Brand → Welcome screen): a header in the brand colour with the
   logo and title, then a body tinted from the same colour. Every colour comes from the study's brand colour. */
.card.welcome-banner { padding: 0; overflow: hidden; border: 0; background: color-mix(in srgb, var(--brand-primary) 7%, #fff); }
.welcome-banner-head { display: flex; align-items: center; gap: 24px; padding: 44px 48px 40px; background: var(--brand-primary); color: #1d2433; }
html[data-study-brand-dark] .welcome-banner-head { color: #fff; }
.welcome-banner-head .brand-logo-hero { flex: none; height: 104px; width: auto; max-width: 160px; object-fit: contain; margin: 0; padding: 4px; background: #fff; }
.welcome-banner-head .screen-title { margin: 0; color: inherit !important; font-weight: 400; font-size: clamp(1.5rem, 3.2vw, 2.4rem); line-height: 1.2; text-align: left; }
.welcome-banner-body { padding: 26px 48px 34px; background: color-mix(in srgb, var(--brand-primary) 7%, #fff); }
.welcome-banner-body .welcome-rich-text { margin-top: 0; }
.welcome-banner-body .preview-banner { margin: 0 0 16px; }
/* Body text is dark, not the default muted grey, so it reads clearly on the tinted background. */
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .screen-subtitle,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .welcome-rich-text,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .welcome-rich-text p,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .welcome-rich-text li,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .participant-intro-text,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .participant-intro-note,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .consent-hint { color: #1d2433; }
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .consent-subtle { color: #2c3547; }
@media (max-width: 640px) {
  .welcome-banner-head { flex-direction: column; align-items: flex-start; gap: 16px; padding: 28px 22px; }
  .welcome-banner-body { padding: 20px 22px 26px; }
}

/* Banner layout, logo background: "None" lets a transparent logo sit directly on the header colour. */
.welcome-banner-head.logo-plain .brand-logo-hero { background: transparent; padding: 0; }

/* Banner layout: all body copy is at least 18px (it grows with the study's text-size setting, never shrinks below 18px). */
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body p,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body li,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body label,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .screen-subtitle,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .welcome-rich-text,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .consent-subtle,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .consent-hint,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .participant-intro-text,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .participant-intro-note,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .response-requirement,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body .text-input { font-size: max(18px, 1rem); }
/* Headings inside the banner body (for example "Stay anonymous, or share your details") stay larger than the body copy. */
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body h2,
body:not(.marketing-mode) .card.welcome-banner .welcome-banner-body h3 { font-size: max(20px, 1.15rem); }
