/* Focus ring: brand outline with a white inner ring so it keeps 3:1 contrast on
   both light and dark backgrounds (WCAG 1.4.11, 2.4.7). */
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--color-sgs);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px #fff;
}

.tracking-\[-\.01em\],
.tracking-\[-\.02em\] {
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

.study-rich-text > p + p {
  margin-top: 1rem;
}

.nav-location-dropdown {
  position: relative;
}

.nav-location-summary {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-ink);
  cursor: pointer;
  list-style: none;
}

.nav-location-summary::-webkit-details-marker {
  display: none;
}

.nav-location-summary svg {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--color-sgs);
  transition: transform 150ms ease;
}

.nav-location-dropdown[open] .nav-location-summary svg {
  transform: rotate(180deg);
}

.nav-location-dropdown[data-current] .nav-location-summary,
.nav-location-dropdown[open] .nav-location-summary,
.nav-location-summary:hover {
  color: var(--color-sgs);
}

.nav-location-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 1rem);
  left: -1rem;
  display: flex;
  min-width: 15rem;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--color-divider);
  box-shadow: 0 10px 26px rgb(37 37 37 / 16%);
}

.nav-location-menu a {
  padding: 0.75rem 1rem;
  color: var(--color-ink);
  text-decoration: none;
  white-space: nowrap;
}

.nav-location-menu a + a {
  border-top: 1px solid var(--color-divider);
}

.nav-location-menu a:hover,
.nav-location-menu a[aria-current="page"] {
  color: var(--color-sgs);
  background: var(--color-sgs-100);
}

.study-location-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: stretch;
}

.study-location-form {
  margin-bottom: 1.25rem;
}

.study-location-picker {
  position: relative;
  min-width: 0;
}

.study-location-summary {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  color: var(--color-ink);
  background: #fff;
  border: 1px solid var(--color-divider);
  cursor: pointer;
  list-style: none;
}

.study-location-summary::-webkit-details-marker {
  display: none;
}

.study-location-summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-location-summary svg {
  width: 0.875rem;
  height: 0.875rem;
  flex: none;
  margin-left: auto;
  color: var(--color-sgs);
  transition: transform 150ms ease;
}

.study-location-picker[open] .study-location-summary {
  color: var(--color-sgs);
  border-color: var(--color-sgs);
}

.study-location-picker[open] .study-location-summary svg {
  transform: rotate(180deg);
}

.study-location-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.375rem);
  left: 0;
  display: flex;
  width: 100%;
  min-width: 13rem;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--color-divider);
  box-shadow: 0 10px 26px rgb(37 37 37 / 16%);
}

.study-location-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  color: var(--color-ink);
  cursor: pointer;
}

.study-location-option + .study-location-option {
  border-top: 1px solid var(--color-divider);
}

.study-location-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.study-location-option svg {
  display: none;
  width: 1rem;
  height: 1rem;
  color: var(--color-sgs);
}

.study-location-option:hover,
.study-location-option:has(input:focus-visible),
.study-location-option:has(input:checked) {
  color: var(--color-sgs);
  background: var(--color-sgs-100);
}

.study-location-option:has(input:focus-visible) {
  outline: 3px solid var(--color-sgs);
  outline-offset: -3px;
}

.study-location-option:has(input:checked) svg {
  display: block;
}

.study-location-controls .btn {
  min-height: 2.75rem;
  padding-inline: 1rem;
}

.btn[aria-disabled="true"],
.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.study-apply-dialog {
  position: fixed;
  inset: 0;
  width: min(calc(100% - 2rem), 31rem);
  max-width: none;
  margin: auto;
  padding: 0;
  color: var(--color-ink);
  background: #fff;
  border: 1px solid var(--color-divider);
  border-radius: 4px;
  box-shadow: 0 24px 60px rgb(37 37 37 / 24%);
}

.study-apply-dialog::backdrop {
  background: rgb(23 27 38 / 68%);
}

.study-apply-dialog-inner {
  position: relative;
  padding: 2rem;
}

.study-apply-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: var(--color-ink);
  background: var(--color-surface);
  cursor: pointer;
}

.study-apply-close:hover,
.study-apply-close:focus-visible {
  color: var(--color-sgs);
}

.study-apply-close svg {
  width: 1rem;
  height: 1rem;
}

.study-apply-email {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 0.875rem;
  color: var(--color-ink);
  background: #fff;
  border: 1px solid var(--color-divider);
  border-radius: 2px;
}

.study-apply-email:focus {
  border-color: var(--color-sgs);
  outline: 3px solid var(--color-sgs);
  outline-offset: 2px;
}

.study-apply-error {
  min-height: 1.25rem;
  margin: 0.375rem 0 0;
  color: var(--color-sgs);
  font-family: var(--font-body);
  font-size: 0.8125rem;
}

.study-apply-error:empty {
  display: none;
}

/* A study that has closed enrollment but is still running. */
.tag-progress {
  color: #17603a;
  background: #e3f3e8;
}

.study-progress-notice {
  background: #e3f3e8;
  border-color: #17603a;
}

.study-panelist {
  padding: 1.25rem;
  color: #fff;
  background: var(--color-sgs);
}

.study-panelist-wide {
  padding: 1.5rem;
}

.study-panelist .btn {
  color: var(--color-sgs);
  background: #fff;
  border-color: #fff;
}

.study-panelist .btn:hover {
  background: var(--color-sgs-100);
}

.study-panelist .btn:focus-visible {
  outline-color: #fff;
  box-shadow: 0 0 0 3px var(--color-sgs);
}

/* Find a Study general interest box: faint signal rings around the button, which
   ripple outwards once each time the box scrolls into view (main.js adds
   .is-playing). The ripple is over in under 5 seconds (2.2.2), the rings are
   decorative and sit behind the text, and reduced motion keeps only the static
   rings. */
.study-panelist-wide {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.panelist-action {
  position: relative;
  justify-self: start;
}

.panelist-rings {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: -1;
  pointer-events: none;
}

.panelist-rings::before,
.panelist-rings::after,
.panelist-rings span {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50%;
  translate: -50% -50%;
}

.panelist-rings::before {
  width: 15rem;
  height: 15rem;
  border: 1px solid rgb(255 255 255 / 16%);
}

.panelist-rings::after {
  width: 26rem;
  height: 26rem;
  border: 1px solid rgb(255 255 255 / 9%);
}

.panelist-rings span {
  width: 10rem;
  height: 10rem;
  border: 2px solid rgb(255 255 255 / 55%);
  opacity: 0;
}

.study-panelist-wide.is-playing .panelist-rings span {
  animation: panelist-ring 2.6s cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
}

.study-panelist-wide.is-playing .panelist-rings span:nth-child(2) {
  animation-delay: 0.6s;
}

.study-panelist-wide.is-playing .panelist-rings span:nth-child(3) {
  animation-delay: 1.2s;
}

@keyframes panelist-ring {
  0% { opacity: 0; scale: 0.6; }
  15% { opacity: 1; }
  100% { opacity: 0; scale: 3.4; }
}

.panelist-arrow {
  width: 1.1em;
  height: 1.1em;
  margin-left: 0.5em;
  flex: none;
  transition: translate 0.2s ease;
}

.study-panelist-wide .btn:hover .panelist-arrow,
.study-panelist-wide .btn:focus-visible .panelist-arrow {
  translate: 4px 0;
}

.study-panelist-wide.is-playing .panelist-arrow {
  animation: panelist-nudge 0.9s ease-in-out 0.3s 2;
}

@keyframes panelist-nudge {
  50% { translate: 5px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .panelist-rings span,
  .study-panelist-wide.is-playing .panelist-arrow {
    animation: none !important;
  }
}

.study-info-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.25rem;
  margin-top: 2.5rem;
}

.study-info-boxes-only {
  margin-top: 0;
}

.study-info-box {
  padding: 1.5rem;
  color: var(--color-ink);
  background: #fff;
  border: 1px solid var(--color-divider);
}

.study-info-box h3 {
  color: var(--color-ink);
}

.study-info-box-plum,
.study-info-box-plum h3 {
  color: #fff;
}

.study-info-box-plum {
  background: var(--color-sgs);
  border-color: var(--color-sgs);
}

.study-info-box-plum a {
  color: #fff;
}

.study-share-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.study-share-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.375rem 0.75rem;
  color: var(--color-ink);
  background: #fff;
  border: 1px solid var(--color-divider);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.study-share-link:hover {
  color: var(--color-sgs);
  border-color: var(--color-sgs);
  background: var(--color-sgs-100);
}

.study-share-link svg {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
}

/* Texting a link only makes sense on a phone or tablet. */
@media (pointer: fine) {
  .study-share-sms {
    display: none;
  }
}

.study-share-status {
  margin: 0.625rem 0 0;
  color: var(--color-slate);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.study-share-status:empty {
  display: none;
}

[data-location-apply],
.study-apply-form .btn {
  width: 100%;
}

.nav-search-toggle,
.nav-search-submit,
.nav-search-close {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  flex: none;
  place-items: center;
  color: var(--color-ink);
  background: transparent;
  cursor: pointer;
}

.nav-search-toggle {
  transform: translateY(-0.25rem);
}

.nav-search-toggle:hover,
.nav-search-submit:hover,
.nav-search-close:hover {
  color: var(--color-sgs);
}

.nav-search-toggle svg,
.nav-search-submit svg,
.nav-search-close svg,
.nav-search-icon {
  width: 1.15rem;
  height: 1.15rem;
}

.nav-search {
  position: absolute;
  z-index: 60;
  top: 50%;
  right: 0;
  display: flex;
  width: 0;
  height: 2.75rem;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
  color: var(--color-ink);
  background: #fff;
  border-bottom: 2px solid var(--color-sgs);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%);
  transition: width 240ms ease, opacity 80ms ease 160ms, visibility 0s linear 240ms;
}

.nav-search.is-open {
  width: 100%;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: width 240ms ease, opacity 160ms ease;
}

.nav-search-submit {
  flex: none;
  color: var(--color-sgs);
}

.nav-search input {
  min-width: 0;
  flex: 1;
  color: var(--color-ink);
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
}

.nav-search input::placeholder {
  color: var(--color-slate);
}

.search-page-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 2px solid var(--color-sgs);
  padding-bottom: 0.5rem;
}

.search-page-form > svg {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  color: var(--color-sgs);
}

.search-page-form input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  outline: 0;
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 1.1rem;
}

.search-page-form input::placeholder {
  color: var(--color-slate);
}

.search-result-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.search-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 0.65rem;
  border-bottom: 1.5px solid var(--color-ink);
}

.search-section-heading h2 {
  margin: 0;
  font-size: 1.55rem;
}

.search-section-heading span {
  color: var(--color-slate);
  font-family: var(--font-body);
  font-size: 0.8rem;
}

.search-study-results article,
.search-page-results article {
  border-bottom: 1px solid var(--color-divider);
}

.search-study-results article > a,
.search-page-results article > a {
  display: block;
  padding: 1.35rem 0;
  color: var(--color-ink);
  text-decoration: none;
}

.search-study-results article > a {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 1.25rem;
}

.search-study-results img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.search-study-results article > a:hover h3,
.search-page-results article > a:hover h3,
.search-study-results article > a:hover .search-result-link,
.search-page-results article > a:hover .search-result-link {
  color: var(--color-sgs);
}

.search-result-type {
  color: var(--color-spot-otext);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.search-study-results h3,
.search-page-results h3 {
  margin: 0.35rem 0 0;
  font-size: 1.35rem;
  line-height: 1.15;
}

.search-study-results p,
.search-page-results p {
  max-width: 72ch;
  margin: 0.65rem 0 0;
  color: var(--color-slate);
  font-family: var(--font-body);
  font-size: 0.925rem;
  line-height: 1.6;
}

.search-result-link {
  display: inline-block;
  margin-top: 0.8rem;
  color: var(--color-ink);
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 600;
}

.search-empty-column {
  margin: 1.25rem 0 0;
  color: var(--color-slate);
  font-family: var(--font-body);
  font-size: 0.925rem;
}

@media (min-width: 900px) {
  .search-result-columns {
    grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr);
    gap: 3rem;
  }
}

/* The full menu needs about 960px, so tablets get the phone menu. */
@media (max-width: 1023px) {
  /* Its `relative` class wins over the `absolute` that main.js adds. */
  .nav-links.flex {
    position: absolute;
    max-height: calc(100vh - 5rem);
    max-height: calc(100dvh - 5rem);
    gap: 0;
    overflow-y: auto;
  }

  .nav-location-dropdown {
    width: 100%;
  }

  .nav-location-summary {
    justify-content: space-between;
    padding: 0.75rem 0;
  }

  .nav-location-menu {
    position: static;
    min-width: 0;
    box-shadow: none;
  }

  .nav-search-toggle {
    width: 100%;
    height: 2.75rem;
    justify-content: flex-start;
    transform: none;
  }

  .nav-search {
    top: 0;
    bottom: 0;
    height: auto;
    padding-inline: 1rem;
    transform: none;
  }
}

/* Between the phone and full layouts, undo the header's md: utilities. */
@media (min-width: 768px) and (max-width: 1023px) {
  .nav-links.hidden {
    display: none;
  }

  .nav-links > a:not(.btn) {
    padding-block: 0.75rem;
    border-bottom-width: 0;
  }

  .nav-links ~ a.btn {
    margin-left: auto;
  }

  #nav-toggle {
    display: inline-flex;
  }
}

@media (max-width: 767px) {
  /* The menu is hidden and there is no panelist button, so push the menu button right. */
  #nav-toggle {
    margin-left: auto;
  }

  .search-page-form {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .search-page-form input {
    width: calc(100% - 2.25rem);
  }

  .search-page-form .btn {
    width: 100%;
  }

  .search-study-results article > a {
    grid-template-columns: 6.5rem minmax(0, 1fr);
    gap: 1rem;
  }
}

/* Accessibility (WCAG 2.2 AA) */

/* The search fields remove their outline above; give them a visible focus state back. */
/* The search fields show focus by doubling their underline instead of boxing the
   field (2.4.7). A shadow, so the bar's contents do not shift. */
.search-page-form input:focus-visible {
  outline: 0;
}

.search-page-form:has(input:focus-visible),
.nav-search:has(input:focus-visible) {
  box-shadow: 0 2px 0 var(--color-sgs);
}

/* Skip link: off-screen until focused (2.4.1). */
.skip-link {
  position: absolute;
  z-index: 100;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.75rem 1.25rem;
  color: #fff;
  background: var(--color-sgs);
  font-family: var(--font-heading);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

main:focus {
  outline: 0;
}

/* Keep keyboard-focused and anchor-linked content clear of the sticky header (2.4.11). */
html {
  scroll-padding-top: 6rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
/* Form control boundaries need 3:1 contrast against the page (1.4.11). */
.input,
.study-apply-email,
.radio input:not(:checked) + .dot {
  border-color: rgb(37 37 37 / 60%);
}

.input:focus-visible,
.study-apply-email:focus,
.radio:hover input:not(:checked) + .dot {
  border-color: var(--color-sgs);
}

/* The segmented control hides its radios, so show keyboard focus on the option.
   Two-tone so it reads on both the selected (filled) and unselected option. */
.seg-opt:has(input:focus-visible) {
  box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 4px var(--color-sgs);
}

/* Sort applies instantly for mouse and touch; this button is the keyboard route,
   so it only appears when tabbed to. */
.sort-apply:not(:focus-visible) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#results:focus {
  outline: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Find a Study results while a filter change is loading. */
[data-filter-root] {
  transition: opacity 120ms ease;
}

[data-filter-root][aria-busy="true"] {
  opacity: 0.55;
}

/* Homepage filter bar: the chosen value replaces the filter name in its box. */
.find-bar .dd-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.find-bar details.is-set > summary {
  color: var(--color-ink);
  font-weight: 500;
}

/* Homepage hero: on narrower desktop widths the three stats do not fit on one
   line, so the third drops to its own line without a stray divider. */
@media (min-width: 768px) and (max-width: 1099px) {
  .hero-stats-extra-divider {
    display: none;
  }

  .hero-stats-extra {
    flex-basis: 100%;
  }
}

/* Landing page headline: full width on mobile, with lines of even length rather
   than one word left on its own. */
@media (max-width: 767px) {
  .hero-heading {
    max-width: none;
    text-wrap: balance;
  }
}

/* Homepage "How it works": no divider after the last step. */
.home-step:last-child {
  border-right: 0;
}

/* A bar draws across the top of the step under the mouse, over a light tint. The
   steps are not links, so nothing lifts or changes cursor. Skipped on touch screens. */
.home-step {
  position: relative;
}

.home-step::before {
  content: "";
  position: absolute;
  inset: -1.5px 0 auto;
  height: 4px;
  background: var(--color-spot-o);
  transform: scaleX(0);
  transform-origin: left;
}

@media (hover: hover) {
  .home-step:hover {
    background: var(--color-surface);
  }

  .home-step:hover::before {
    transform: scaleX(1);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .home-step {
    transition: background-color 0.25s ease;
  }

  .home-step::before {
    transition: transform 0.3s ease;
  }
}

/* Find a Study "Filtering by" bar: a chip for each applied filter, which removes
   that filter when clicked. */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding-block: 1.125rem;
}

.filter-chips-label {
  font-size: 13px;
  letter-spacing: 0.14em;
}

.filter-chips-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem 0.875rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  padding: 0.25rem 0.875rem;
  border: 1px solid var(--color-sgs);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.2;
}

.filter-chip-on {
  background: #fff;
  color: var(--color-sgs);
}

.filter-chip-on:hover {
  background: var(--color-sgs-100);
}

.filter-chips-clear {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding-inline: 0.5rem;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-slate);
  text-decoration: none;
}

.filter-chips-clear:hover {
  color: var(--color-sgs);
  text-decoration: underline;
}

/* Find a Study and homepage hero. On Find a Study, when a location is chosen its photo sits beside the heading,
   stacked below it on mobile. The clinic's name, address and phone number sit in
   a plum box: beneath the photo on mobile, over its bottom edge on wider screens. */
.study-hero-points {
  display: grid;
  gap: 0.75rem;
  /* As wide as the introduction above, which is set in larger type. */
  max-width: 68ch;
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--color-slate);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.5;
}

.study-hero-points li {
  display: flex;
  gap: 0.625rem;
}

.study-hero-points svg {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.2rem;
  color: var(--color-sgs);
}

.study-hero-points strong {
  color: var(--color-ink);
  font-weight: 700;
}

.study-hero-media {
  display: flex;
  flex-direction: column;
  margin-top: 2rem;
}

.study-hero-photo {
  aspect-ratio: 3 / 2;
}

.study-hero-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--color-sgs);
  color: #fff;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.35;
}

.study-hero-contact a {
  color: #fff;
  text-decoration: none;
}

.study-hero-contact a:hover {
  text-decoration: underline;
}

/* The brand-coloured focus ring would vanish against the plum. */
.study-hero-contact a:focus-visible {
  outline-color: #fff;
  box-shadow: none;
}

.study-hero-contact-name,
.study-hero-contact-address {
  display: block;
}

.study-hero-contact-name {
  font-weight: 700;
  text-transform: uppercase;
}

.study-hero-contact-phone {
  white-space: nowrap;
}

@media (min-width: 768px) {
  .study-hero-has-media {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 2.5rem;
  }

  .study-hero-media {
    position: relative;
    align-self: start;
    margin-top: 0;
  }

  .study-hero-contact {
    position: absolute;
    inset: auto 0 0;
  }
}

/* Text pages (templates/pages/page.twig): the links card beside the body. */
.page-links ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.page-links li + li {
  border-top: 1px solid var(--color-divider);
}

.page-links a {
  display: block;
  padding: 0.8125rem 0;
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
}

.page-links li:last-child a {
  padding-bottom: 0;
}

.page-links a:hover,
.page-links a[aria-current="page"] {
  color: var(--color-sgs);
}

.page-links a[aria-current="page"] {
  font-weight: 500;
}

/* Short pages: the page content takes up the spare height, so the footer stays at the
   bottom of the window. */
.site-shell {
  display: flex;
  flex-direction: column;
}

.site-shell > main {
  flex: 1 0 auto;
}

/* 404 page: centered in that space. */
.site-shell > main:has(> .not-found) {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Study page: the columns may shrink, and words too long for them break. */
.study-detail-grid > * {
  min-width: 0;
}

.study-detail-grid h1,
.search-study-results h3 {
  overflow-wrap: anywhere;
  hyphens: auto;
}

/* On tablets a narrower sidebar leaves the study room to read. */
@media (min-width: 768px) and (max-width: 1023px) {
  .study-detail-grid {
    grid-template-columns: minmax(0, 1fr) 300px;
    column-gap: 2rem;
  }

  .study-detail-grid h1 {
    font-size: 2.25rem;
  }

  .study-detail-grid .study-criteria {
    columns: 1;
  }
}

/* Text pages: editor-written body content, which arrives as plain HTML. */
/* min-width lets it shrink in the two-column grid, so a wide table scrolls. */
.page-rich-text {
  min-width: 0;
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: break-word;
}

.page-rich-text > * + * {
  margin-top: 1rem;
}

.page-rich-text h2,
.page-rich-text h3,
.page-rich-text h4 {
  line-height: 1.15;
}

.page-rich-text h2 {
  font-size: 1.75rem;
}

.page-rich-text h3 {
  font-size: 1.375rem;
}

.page-rich-text h4 {
  font-size: 1.125rem;
}

.page-rich-text > * + h2 {
  margin-top: 2.75rem;
}

.page-rich-text > * + h3,
.page-rich-text > * + h4 {
  margin-top: 2rem;
}

.page-rich-text a {
  color: var(--color-sgs);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.page-rich-text a:hover {
  color: var(--color-sgs-700);
}

.page-rich-text ul,
.page-rich-text ol {
  padding-left: 1.5rem;
}

.page-rich-text ul {
  list-style: disc;
}

.page-rich-text ol {
  list-style: decimal;
}

.page-rich-text li + li,
.page-rich-text li > ul,
.page-rich-text li > ol {
  margin-top: 0.375rem;
}

.page-rich-text blockquote {
  padding-left: 1.25rem;
  border-left: 3px solid var(--color-sgs);
  color: var(--color-slate);
}

.page-rich-text blockquote > * + * {
  margin-top: 1rem;
}

/* CKEditor wraps tables in a figure; wide ones scroll rather than break the page. */
/* Its `table` class is also a Tailwind utility (display: table), which cannot scroll. */
.page-rich-text figure.table {
  display: block;
  overflow-x: auto;
}

.page-rich-text table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
}

.page-rich-text th,
.page-rich-text td {
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--color-divider);
  text-align: left;
  vertical-align: top;
}

.page-rich-text th {
  background: var(--color-surface);
  font-weight: 700;
}

@media (min-width: 768px) {
  .page-rich-text h2 {
    font-size: 2rem;
  }
}

/* Cookie choices: a bar along the bottom until the visitor answers. The dialog
   for per-category choices reuses the apply dialog's frame. */
.consent-banner {
  position: fixed;
  inset: auto 0 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1.25rem 1.5rem;
  background: #fff;
  border-top: 3px solid var(--color-sgs);
  box-shadow: 0 -8px 30px rgb(37 37 37 / 14%);
}

.consent-banner[hidden] {
  display: none;
}

.consent-banner-text {
  flex: 1 1 28rem;
  max-width: 60rem;
}

.consent-banner h2 {
  margin: 0;
  font-size: 1.375rem;
}

.consent-banner p,
.consent-option,
.consent-note {
  margin: 0.375rem 0 0;
  color: var(--color-slate);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
}

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.consent-actions .btn,
.consent-form .btn {
  min-height: 2.75rem;
  padding-inline: 1rem;
}

.consent-form {
  margin-top: 1rem;
}

.consent-form .btn {
  width: 100%;
  margin-top: 1.25rem;
}

.consent-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  margin: 0;
  padding: 0.875rem 0;
  border-top: 1px solid var(--color-divider);
}

.consent-option input {
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.125rem;
  accent-color: var(--color-sgs);
}

.consent-option strong {
  display: block;
  color: var(--color-ink);
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgb(255 255 255 / 16%);
  font-family: var(--font-body);
  font-size: 13px;
}

.footer-legal:not(:has(> :not([hidden]))) {
  display: none;
}

.footer-legal a,
.footer-legal button {
  color: rgb(255 255 255 / 75%);
  text-decoration: underline;
  cursor: pointer;
}

.footer-legal a:hover,
.footer-legal button:hover {
  color: #fff;
}

.footer-social {
  display: flex;
  gap: 0.25rem;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
}

.footer-social svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Contact page */
.contact-form {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.contact-field-row {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .contact-field-row {
    grid-template-columns: 1fr 1fr;
  }
}

.contact-field label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--color-slate);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.contact-optional {
  font-weight: 400;
  text-transform: none;
}

.contact-field input,
.contact-field select,
.contact-field textarea {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 0.875rem;
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 1rem;
  background: #fff;
  border: 1px solid var(--color-slate);
  border-radius: 2px;
}

.contact-field textarea {
  resize: vertical;
}

.contact-field :is(input, select, textarea):focus {
  border-color: var(--color-sgs);
  outline: 3px solid var(--color-sgs);
  outline-offset: 2px;
}

.contact-field [aria-invalid="true"] {
  border-color: var(--color-sgs);
  border-width: 2px;
}

.contact-hint,
.contact-error {
  margin: 0.375rem 0 0;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.contact-hint {
  color: var(--color-slate);
}

.contact-error {
  color: var(--color-sgs);
  font-weight: 500;
}

.contact-error-summary {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  background: var(--color-sgs-100);
  border-left: 3px solid var(--color-sgs);
}

.contact-form .btn {
  justify-self: start;
}

/* Off screen rather than display:none, which some spam scripts skip. */
.contact-ref {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Clear of the sticky header when the page reloads at the form. */
.contact-form-wrap {
  scroll-margin-top: 6.5rem;
}

.contact-locations {
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-locations li {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--color-divider);
}

/* As tall as the clinic's details beside it; the image is cropped to fit. */
.contact-location-photo {
  flex: none;
  align-self: stretch;
  width: 7rem;
}

@media (min-width: 480px) {
  .contact-location-photo {
    width: 12rem;
  }
}

.contact-locations p {
  display: flex;
  gap: 0.625rem;
  margin: 0.625rem 0 0;
  color: var(--color-slate);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.contact-locations svg {
  flex: none;
  width: 1rem;
  height: 1rem;
  margin-top: 0.25rem;
  color: var(--color-sgs);
}

/* Landing page steps: the large step number beside its title and text. */
.landing-step {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 1rem;
  align-items: start;
}

@media (min-width: 768px) {
  .landing-step {
    grid-template-columns: 5.75rem 1fr;
    gap: 2.5rem;
  }
}

/* The photo fills its frame (.photo is absolutely positioned), so the frame sets the shape. */
.landing-hero-media {
  aspect-ratio: 3 / 2;
}

/* Landing page reasons: one column on phones, two side by side, then every box
   in one row on wide screens (--boxes is set by the template, at most 4). */
.landing-reasons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .landing-reasons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .landing-reasons {
    grid-template-columns: repeat(var(--boxes, 4), minmax(0, 1fr));
  }
}

.landing-reason-title {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
}

.landing-reason-title svg {
  flex: none;
  translate: 0 0.15em;
}

/* The Find a Study apply box, narrowed to a column: the button sits at the bottom. */
.landing-panelist {
  display: flex;
  flex-direction: column;
}

.landing-panelist .panelist-action {
  margin-top: auto;
  padding-top: 1.5rem;
}

/* Criteria read down each column, so a long one leaves no gap beside it. */
.study-criteria {
  list-style: none;
  padding: 0;
  margin-bottom: 0;
  column-gap: 34px;
}

.study-criteria > li {
  break-inside: avoid;
  padding-bottom: 0.75rem;
}

.study-criteria-points {
  list-style: disc;
  margin: 0.375rem 0 0;
  padding-left: 1.125rem;
}

.study-criteria-points > li + li {
  margin-top: 0.25rem;
}

@media (min-width: 768px) {
  .study-criteria {
    columns: 2;
  }
}

/* Find a Study results: the photo fills the card's edge with no frame of its own.
   Photos are composed with the person on the right, so crops lean that way. */
.study-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}

.study-result-photo {
  position: relative;
  aspect-ratio: 3 / 2;
}

.study-result-photo .photo {
  object-position: 70% center;
}

.study-result-text {
  min-width: 0;
  padding: 20px 24px 0;
}

.study-result-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

.study-result-side {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px 24px;
}

/* Tablets: photo beside the text, with compensation under the text. */
@media (min-width: 768px) {
  .study-result {
    grid-template-columns: 170px minmax(0, 1fr);
    grid-template-rows: 1fr auto;
  }

  .study-result-photo {
    grid-row: 1 / -1;
    aspect-ratio: auto;
  }
}

@media (min-width: 1100px) {
  .study-result {
    grid-template-columns: 240px minmax(0, 1fr) 190px;
    grid-template-rows: auto;
    min-height: 240px;
  }

  .study-result-photo {
    grid-row: auto;
  }

  .study-result-text {
    padding: 24px 0 24px 28px;
  }

  .study-result-side {
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 24px;
    text-align: right;
  }
}

/* Find a Study "Show more", under the results. */
.results-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding-block: 0.75rem;
}

.results-more p {
  margin: 0;
  color: var(--color-slate);
  font-family: var(--font-body);
  font-size: 14px;
}

.results-more-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

/* Homepage featured study cards */
.study-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.study-card-photo {
  position: relative;
  display: block;
  flex: none;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  text-decoration: none;
}

.study-card-photo .photo {
  object-position: 70% center;
}

.study-card-body {
  flex: 1;
}

.study-card-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

/* Keeps the details and button level across a row of cards. */
.study-card .study-card-facts {
  margin-top: auto;
}

/* An open phone menu sits above the cookie bar; the bar shows again below the
   menu, and in full once the menu closes. */
.nav-open header.sticky {
  z-index: 55;
}
