/* Shared Phase 3 form and gallery repairs. The existing site palette and
   typography remain authoritative. */
.phase3-form {
  max-width: 56rem;
  margin: 0 auto;
}

.phase3-form__notice {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  border-left: 0.3rem solid #a41828;
  background: #f7f7f7;
}

.phase3-form__notice p:last-child {
  margin-bottom: 0;
}

.phase3-tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 1.25rem;
}

.phase3-tab {
  flex: 1 1 12rem;
  min-height: 3rem;
  border: 0;
  padding: 0.75rem 1rem;
  background: #eeeeee;
  color: #222222;
  font: inherit;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.phase3-tab[aria-selected="true"] {
  background: #a41828;
  color: #ffffff;
}

.phase3-panel[hidden] {
  display: none !important;
}

.phase3-amounts {
  margin: 0 0 1.5rem;
  border: 0;
  padding: 0;
}

.phase3-amounts legend {
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.phase3-amount-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.phase3-amount-option {
  position: relative;
  display: flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  border: 2px solid #d8d8d8;
  padding: 0.65rem;
  background: #ffffff;
  color: #222222;
  cursor: pointer;
  font-weight: 700;
}

.phase3-amount-option:has(input:checked),
.phase3-amount-option.is-selected {
  border-color: #a41828;
  background: #a41828;
  color: #ffffff;
}

.phase3-amount-option > span[aria-hidden="true"] {
  color: #444444;
}

.phase3-amount-option:has(input:checked) > span[aria-hidden="true"],
.phase3-amount-option.is-selected > span[aria-hidden="true"] {
  color: #ffffff;
}

.phase3-amount-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.phase3-other-amount {
  margin-top: 0.75rem;
}

.phase3-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.phase3-field--full {
  grid-column: 1 / -1;
}

.phase3-field label,
.phase3-field__label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.phase3-field input,
.phase3-field select,
.phase3-field textarea {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid #747474;
  border-radius: 0;
  padding: 0.65rem 0.75rem;
  background: #ffffff;
  color: #222222;
  font: inherit;
}

.phase3-field textarea {
  min-height: 7rem;
  resize: vertical;
}

.phase3-consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  align-items: start;
}

.phase3-consent input {
  width: 1.25rem;
  min-height: 1.25rem;
  margin-top: 0.15rem;
}

.phase3-error {
  min-height: 1.25rem;
  margin: 0.25rem 0 0;
  color: #9f1425;
  font-size: 0.95rem;
  font-weight: 600;
}

.phase3-status {
  min-height: 1.5rem;
  margin: 1rem 0;
  padding: 0;
  font-weight: 700;
}

.phase3-status--sending {
  color: #333333;
}

.phase3-status--error {
  border-left: 0.3rem solid #a41828;
  padding: 0.75rem 1rem;
  background: #fff3f4;
  color: #7b1020;
}

.phase3-form [aria-invalid="true"] {
  border-color: #a41828;
  box-shadow: 0 0 0 2px rgba(164, 24, 40, 0.18);
}

.phase3-notice a {
  color: #7b1020;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.phase3-form button:focus-visible,
.phase3-form input:focus-visible,
.phase3-form select:focus-visible,
.phase3-form textarea:focus-visible,
.phase3-gallery-item:focus-visible,
.phase3-lightbox button:focus-visible {
  outline: 3px solid #1ea93e;
  outline-offset: 3px;
}

.phase3-honeypot {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.phase3-static-label {
  display: inline-block;
  cursor: default;
}

@media (max-width: 48rem) {
  .phase3-amount-grid,
  .phase3-form-grid {
    grid-template-columns: 1fr;
  }

  .phase3-field--full {
    grid-column: auto;
  }
}

/* Latest gallery and accessible lightbox. */
.phase3-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.phase3-gallery-item {
  border: 2px solid #dddddd;
  padding: 0.45rem;
  background: #ffffff;
  box-shadow: 2px 3px #eeeeee;
  cursor: zoom-in;
}

.phase3-gallery-item img {
  display: block;
  width: 100%;
  height: 18rem;
  object-fit: cover;
}

.phase3-lightbox[hidden] {
  display: none;
}

.phase3-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.88);
}

.phase3-lightbox__dialog {
  position: relative;
  display: grid;
  width: min(70rem, 100%);
  max-height: calc(100vh - 2rem);
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    ". close close"
    "previous image next"
    ". caption .";
  gap: 0.75rem;
  align-items: center;
}

.phase3-lightbox__image {
  grid-area: image;
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 9rem);
  margin: 0 auto;
  object-fit: contain;
}

.phase3-lightbox__figure {
  grid-area: image;
  min-width: 0;
  margin: 0;
}

.phase3-lightbox__close,
.phase3-lightbox__previous,
.phase3-lightbox__next {
  width: 3rem;
  min-width: 3rem;
  min-height: 3rem;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #a41828;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 700;
}

.phase3-lightbox__close {
  grid-area: close;
  justify-self: end;
}

.phase3-lightbox__previous {
  grid-area: previous;
}

.phase3-lightbox__next {
  grid-area: next;
}

.phase3-lightbox__caption {
  grid-area: caption;
  margin: 0;
  color: #ffffff;
  text-align: center;
}

body.phase3-modal-open {
  overflow: hidden;
}

@media (max-width: 48rem) {
  .phase3-gallery {
    grid-template-columns: 1fr;
  }

  .phase3-gallery-item img {
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .phase3-lightbox__dialog {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "close close"
      "image image"
      "previous next"
      "caption caption";
  }

  .phase3-lightbox__previous {
    justify-self: start;
  }

  .phase3-lightbox__next {
    justify-self: end;
  }
}
