.candidate-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  width: 100%;
}

.candidate-grid--listing {
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;

  @media (width >= 576px) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (width >= 768px) {
  .candidate-grid,
  .candidate-grid--featured {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .candidate-grid--listing {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
  }
}

@media (width >= 992px) {
  .candidate-grid,
  .candidate-grid--featured {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .candidate-grid--listing {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (width >= 1200px) {
  .candidate-grid,
  .candidate-grid--featured,
  .candidate-grid--listing {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 28px;
  }
}

.candidate-tile.card {
  position: relative;
  min-width: 0;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: hidden;
  background: var(--brand-pale);
  border: 0;
  border-radius: 0;
  cursor: pointer;
  aspect-ratio: auto;

  &::before {
    content: none;
  }
}

.candidate-tile__link {
  display: grid;
  grid-template-rows: auto 1fr;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none;

  &:hover,
  &:focus {
    color: inherit;
    text-decoration: none;
  }

  &:focus {
    outline: 3px solid var(--brand-purple);
    outline-offset: -3px;
  }

  @media (hover: hover) {
    &:hover .candidate-tile__image {
      transform: scale(1.06);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    &:hover .candidate-tile__image {
      transform: none;
    }
  }
}

.candidate-tile__image-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: var(--brand-purple);
}

.candidate-tile__image,
.candidate-tile__image-placeholder {
  display: block;
  width: 100%;
  height: 100%;
}

.candidate-tile__image {
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s ease;

  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}

.candidate-tile__tags-wrapper {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0.5rem;
  left: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  pointer-events: none;

  @media (width >= 768px) {
    bottom: 0.75rem;
  }
}

.candidate-tile__role,
.candidate-tile__region {
  display: block;
  width: fit-content;
  max-width: calc(100% - 0.75rem);
  padding: 0.35rem 0.45rem;
  margin: 0;
  background: var(--brand-purple);
  color: #fff;
  font-family: "Manrope", sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: break-word;

  @media (width >= 768px) {
    padding: 0.45rem 0.5rem;
    font-size: 16px;
  }
}

.candidate-tile__name {
  align-self: start;
  padding: 0;
  margin: 1.25rem 0.75rem 1rem;
  background: var(--brand-pale);
  color: var(--brand-teal);
  font-family: "Reddit Sans Condensed", sans-serif;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  overflow-wrap: break-word;

  @media (width >= 768px) {
    font-size: 1.25rem;
  }

  @media (width >= 1200px) {
    margin-top: 1.5rem;
    font-size: 34px;
  }
}

.candidate-grid--listing .candidate-tile__name {
  margin: 1rem 0.625rem 0.75rem;
  font-size: 1.5em;
  min-block-size: 2em;

  @media (width >= 768px) {
    margin: 1.25rem 0.75rem 1rem;
  }
}


.candidate-template {
  --candidate-donation-pale: #ccf1ef;
  color: var(--brand-purple);
  font-family: Manrope, sans-serif;
}

.candidate-shell {
  width: min(83.25rem, calc(100% - clamp(2rem, 5vw, 4rem)));
  margin-inline: auto;
}

.candidate-hero {
  position: relative;
  display: flex;
  min-height: clamp(26rem, 37vw, 44rem);
  align-items: end;
  padding-block: clamp(2rem, 4vw, 3.5rem);
  overflow: hidden;
  isolation: isolate;
}

.candidate-hero__image {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--candidate-hero-object-position, 50% 30%);
}

.candidate-hero__name,
.candidate-contact__title,
.candidate-donate h2,
.candidate-donate h3 {
  margin: 0;
  font-family: "Reddit Sans Condensed", sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  text-transform: uppercase;
}

.candidate-hero__name {
  display: table;
  padding: 0.9375rem 1.25rem;
  background: var(--brand-teal);
  color: #fff;
  font-size: clamp(3rem, 6vw, 5rem);
}

.candidate-hero__name--split {
  font-size: clamp(1.875rem, 3.4vw, 2.75rem);
  white-space: nowrap;
}

.candidate-hero__name-line {
  white-space: nowrap;
}

.candidate-hero__name-line:not(:last-of-type)::after {
  content: " ";
}

@media (width > 600px) {
  .candidate-hero__name-line {
    white-space: normal;
  }

  .candidate-hero__name-break {
    display: none;
  }
}

.candidate-hero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.25rem;
}

.candidate-hero__tags span {
  padding: 0.6rem 1.25rem;
  background: var(--brand-teal);
  color: #fff;
  font-size: clamp(1.1rem, 1.8vw, 1.75rem);
  font-weight: 700;
  line-height: 1.3;
}

.candidate-hero--split {
  background: var(--brand-teal);
}

.candidate-hero__region-image,
.candidate-hero__tint,
.candidate-hero__cutout {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.candidate-hero__region-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  filter: grayscale(1);
}

.candidate-hero__tint {
  background: var(--brand-teal);
  opacity: 0.8;
  z-index: 1;
}

.candidate-hero__cutout {
  z-index: 2;
  top: 0;
  bottom: 0;
  left: auto;
  right: 0;
  width: 50%;
  height: 100%;
  object-fit: cover;
  object-position: top right;
}

.candidate-hero__content--split {
  position: relative;
  z-index: 3;
  max-width: fit-content;
}

@media (width <= 768px) {
  .candidate-hero__cutout {
    width: 100%;
    object-position: bottom center;
  }

  .candidate-hero__name--split {
    white-space: normal;
  }
}

/* Split-hero overrides (Papa target) */
.candidate-hero--split .candidate-hero__name--split {
  padding: clamp(0.625rem, 1vw, 0.9375rem);
}

.candidate-hero--split .candidate-hero__tags {
  margin-top: 0.5rem;
  gap: 0.5rem;
}

.candidate-hero--split .candidate-hero__tags span {
  background: var(--brand-purple);
  padding: 0.4rem 0.9rem;
}

.candidate-hero--split .candidate-hero__tint {
  opacity: 0.92;
}

.candidate-hero--split .candidate-hero__cutout {
  width: 58%;
  object-position: 70% 25%;
}

.candidate-hero--split .candidate-hero__content--split {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex-grow: 1;
  width: fit-content;
  padding-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

@media (width > 600px) {
  .candidate-hero--split .candidate-hero__cutout {
    transform: scale(1.10);
    transform-origin: 100% 0;
  }

  .candidate-hero--split .candidate-hero__content--split {
    margin-left: 10%;
    padding-bottom: 1.25rem;
  }

  .candidate-hero--split .candidate-hero__name--split {
    width: fit-content;
  }
}

@media (width <= 600px) {
  .candidate-hero--split .candidate-hero__content--split {
    flex-grow: 0;
    margin-left: 2rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    padding-bottom: 0;
  }

  .candidate-hero--split .candidate-hero__cutout {
    top: 1.25rem;
    left: 1rem;
    right: 1rem;
    /* Replaced <img>: width:auto resolves to intrinsic width, not the inset frame */
    width: calc(100% - 2rem);
    height: calc(100% - 1.25rem);
    object-position: bottom center;
  }

  .candidate-hero--split .candidate-hero__name--split {
    width: min-content;
  }
}

.candidate-profile {
  padding: clamp(3rem, 6vw, 5.5rem) 0;
}

.candidate-profile__grid {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 5fr);
  gap: clamp(2rem, 5vw, 6rem);
  align-items: start;
}

.candidate-quote {
  position: relative;
  margin: 0 0 clamp(2rem, 4vw, 3rem);
  padding: clamp(2.25rem, 3vw, 3rem) clamp(1.5rem, 4vw, 4.6rem) clamp(1.75rem, 3vw, 2.5rem);
  border: 4px solid var(--brand-teal);
  background: #fff;
  text-align: center;
}

.candidate-quote::before,
.candidate-quote::after {
  position: absolute;
  top: 0;
  color: var(--brand-purple);
  content: "\201C";
  font-family: "Reddit Sans Condensed", sans-serif;
  font-size: clamp(3rem, 4vw, 4.25rem);
  font-weight: 700;
  line-height: 1;
  text-shadow: -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff, 2px 2px 0 #fff;
  transform: translateY(-30%);
}

.candidate-quote::before {
  left: 7%;
}

.candidate-quote::after {
  right: 7%;
  content: "\201D";
}

.candidate-quote p {
  margin: 0;
  font-size: clamp(1.05rem, 1.5vw, 1.35rem);
  font-weight: 500;
  line-height: 1.5;
}

.candidate-portfolios {
  margin: 0 0 2rem;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--brand-teal);
  background: var(--brand-pale);
}

.candidate-portfolios h2,
.candidate-portfolios p {
  margin: 0;
}

.candidate-portfolios h2 {
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
}

.candidate-portfolios p {
  margin-top: 0.4rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.candidate-profile__bio {
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.55;
}

.candidate-profile__bio p {
  margin: 0 0 1.25rem;
}

.candidate-profile__bio p:last-child {
  margin-bottom: 0;
}

.candidate-profile__bio a,
.candidate-quote a {
  color: var(--brand-purple);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.candidate-profile__bio a:hover,
.candidate-quote a:hover {
  text-decoration-thickness: 2px;
}

.candidate-contact {
  border: 4px solid var(--brand-teal);
  background: #fff;
  text-align: center;
}

.candidate-contact__portrait {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.candidate-contact__body {
  padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1.25rem, 2.5vw, 2rem);
}

.candidate-contact__title {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.candidate-contact__title span {
  color: var(--brand-teal);
}

.candidate-contact__name {
  margin: 1.25rem 0 0.75rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.candidate-contact__role {
  margin: 0 0 1.25rem;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.4;
}

.candidate-contact__email {
  color: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.candidate-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin: 0;
  padding: clamp(1.5rem, 3vw, 2.25rem);
}

.candidate-socials__btn {
  display: grid;
  width: 3.75rem;
  height: 3.75rem;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-purple);
  color: #fff;
  text-decoration: none;
}

.candidate-socials__btn:hover,
.candidate-socials__btn:focus {
  background: var(--brand-teal);
  color: #fff;
}

.candidate-socials__btn img {
  display: block;
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;
  filter: invert(1);
}

.candidate-socials__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.candidate-template .homepage-hero-signup {
  display: block;
  padding: clamp(5rem, 8vw, 7.5rem) 0 clamp(3rem, 6vw, 5rem);
}

.candidate-template .homepage-hero-signup__panel {
  margin-top: 0;
}

.candidate-donate__back {
  display: inline-flex;
  min-height: 3.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding: 0.3125rem 1.5rem 0.3125rem 0.3125rem;
  border-radius: 999px;
  background: var(--brand-purple);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.candidate-donate__back:hover,
.candidate-donate__back:focus {
  background: var(--brand-teal);
  color: #fff;
  text-decoration: none;
}

.candidate-donate {
  position: relative;
  padding: clamp(5rem, 9vw, 8rem) 0 clamp(5.5rem, 10vw, 9rem);
  overflow: hidden;
  background: var(--candidate-donation-pale);
}

.candidate-donate::before {
  position: absolute;
  inset: 0;
  background-color: rgb(0 185 188 / 20%);
  background-image: url("https://cdn.opportunity.org.nz/images/candidate-page/donation-mountains.webp");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: cover;
  content: "";
  mask-image: url("https://cdn.opportunity.org.nz/images/candidate-page/donation-mountains-mask.svg");
  mask-position: center bottom;
  mask-repeat: no-repeat;
  mask-size: cover;
  opacity: 0.8;
  transform: scaleX(-1);
}

.candidate-donate::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(to right, rgb(0 0 0 / 5%) 0%, transparent 70%);
  content: "";
  pointer-events: none;
}

.candidate-donate__grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 8fr);
  gap: clamp(2rem, 5vw, 5.25rem);
  align-items: center;
}

.candidate-donate h2 {
  color: var(--brand-purple);
  font-size: clamp(2.7rem, 3.9vw, 3.125rem);
  line-height: 1.4;
}

.candidate-donate mark {
  padding: 0 0.15em;
  background: var(--brand-teal);
  color: #fff;
}

.candidate-donate__back-icon {
  display: grid;
  width: 3.125rem;
  height: 3.125rem;
  place-items: center;
  border-radius: 50%;
  background: #fff;
}

.candidate-donate__back-icon img {
  display: block;
  width: 0.75rem;
  height: 1.25rem;
}

.candidate-donate__panel {
  padding: clamp(2rem, 4vw, 3.125rem);
  border: 4px solid var(--brand-teal);
  background: #fff;
}

.candidate-donate__panel .donation-width-limit {
  max-width: none;
  padding: 0;
}

.candidate-donate__panel .headline {
  display: none;
}

.candidate-donate__panel .h4 {
  margin: 0;
  color: var(--brand-purple);
  font-family: "Reddit Sans Condensed", sans-serif;
  font-size: clamp(1.8rem, 2.6vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-transform: uppercase;
}

.candidate-donate__panel .donation-row {
  margin: 1.75rem 0 0;
}

.candidate-donate__panel .donation-v2-electorate-amounts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.candidate-donate__panel .donation-v2-electorate-amounts .custom-control {
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.candidate-donate__panel .donation-v2-electorate-amounts label.btn {
  display: grid;
  width: 100%;
  min-height: 3.75rem;
  place-items: center;
  padding: 0.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--brand-purple);
  color: #fff;
  font-size: clamp(1rem, 1.25vw, 1.375rem);
  font-weight: 700;
}

.candidate-donate__panel .donation-v2-electorate-amounts .custom-control-input:checked ~ .custom-control-label {
  background: var(--brand-teal);
  color: #fff;
}

.candidate-donate__panel .donation-row > .custom-control-inline {
  display: block;
  margin: 1.5rem 0 0;
  padding: 0;
}

.candidate-donate__panel .donation-row > .custom-control-inline .btn {
  display: flex;
  min-height: 5rem;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--brand-purple);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 600;
}

.candidate-donate__panel .donation-row > .custom-control-inline .btn:hover,
.candidate-donate__panel .donation-row > .custom-control-inline .btn:focus {
  background: var(--brand-teal);
  color: #fff;
}

@media (max-width: 1000px) {
  .candidate-profile__grid,
  .candidate-donate__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .candidate-donate__grid > div:first-child {
    text-align: center;
  }

  .candidate-contact {
    max-width: 34rem;
    margin-inline: auto;
  }
}

@media (max-width: 600px) {
  .candidate-shell {
    width: min(100% - 2rem, 42rem);
  }

  .candidate-hero {
    min-height: 32rem;
  }

  .candidate-hero__tags {
    gap: 0.625rem;
  }

  .candidate-hero__tags span {
    padding: 0.5rem 0.75rem;
  }

  .candidate-donate__panel .donation-v2-electorate-amounts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
