/* ========================================
   DISTRICT REPORT - Homepage card + viewer overlay
   Mobile First
   ======================================== */

/* -------------------------------------------------
   HOMEPAGE SECTION
   ------------------------------------------------- */
.district-report-section {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 50px 16px;
}

.district-report-title {
  font-family: "Unbounded", sans-serif;
  font-size: 20px;
  font-weight: 500;
  line-height: 115%;
  letter-spacing: -3%;
  color: #ffffff;
  margin: 0;
  text-align: center;
}

.district-report-card {
  position: relative;
  display: block;
  width: 100%;
  max-width: 1100px;
  padding: 0;
  border: 1px solid rgba(255, 241, 235, 0.2);
  border-radius: 16px;
  background: #0f3d2e;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.district-report-card__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

/* Mobile: button sits under the cover so it never covers the artwork */
.district-report-card__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px;
  background-color: #adebe7;
  color: #1d1d1d;
  font-family: "Rethink Sans", sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.district-report-card__cta svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.district-report-card:focus-visible {
  outline: 3px solid #adebe7;
  outline-offset: 3px;
}

@media (hover: hover) {
  .district-report-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  }

  .district-report-card:hover .district-report-card__cta {
    transform: translateX(2px);
  }
}

@media (min-width: 768px) {
  .district-report-section {
    padding: 64px 32px;
    gap: 32px;
  }

  .district-report-card {
    border-radius: 24px;
  }

  /* Tablet+: button floats over the bottom-right of the cover */
  .district-report-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0) 40%);
    pointer-events: none;
  }

  .district-report-card__cta {
    position: absolute;
    right: 24px;
    bottom: 24px;
    z-index: 1;
    display: inline-flex;
    margin: 0;
    font-size: 16px;
    padding: 16px 24px;
  }
}

/* -------------------------------------------------
   VIEWER OVERLAY
   ------------------------------------------------- */
.district-viewer {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  background: rgba(10, 10, 10, 0.96);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  font-family: "Rethink Sans", sans-serif;
  color: #ffffff;
}

.district-viewer.is-open {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.district-viewer__bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.district-viewer__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.85;
}

.district-viewer__count {
  flex: none;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.district-viewer__btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 241, 235, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.district-viewer__btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.district-viewer__btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.district-viewer__btn:focus-visible {
  outline: 2px solid #adebe7;
  outline-offset: 2px;
}

.district-viewer__stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  touch-action: pan-y pinch-zoom;
}

.district-viewer__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: 8px;
  background: #0f3d2e;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.15s ease;
}

.district-viewer.is-loading .district-viewer__img {
  opacity: 0.35;
}

.district-viewer__spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #adebe7;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  animation: district-viewer-spin 0.8s linear infinite;
}

.district-viewer.is-loading .district-viewer__spinner {
  opacity: 1;
}

@keyframes district-viewer-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Mobile: prev/next live in a bottom bar */
.district-viewer__nav {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
}

.district-viewer__nav .district-viewer__btn {
  min-width: 56px;
  height: 44px;
}

.district-viewer__btn[disabled] {
  opacity: 0.35;
  cursor: default;
}

.district-viewer__btn[disabled]:hover {
  background: rgba(255, 255, 255, 0.06);
}

.district-viewer__hint {
  flex: none;
  margin: 0;
  padding: 0 16px 8px;
  text-align: center;
  font-size: 12px;
  opacity: 0.6;
}

/* Only useful on a phone held upright */
@media (min-width: 768px), (orientation: landscape) {
  .district-viewer__hint {
    display: none;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .district-viewer__bar {
    padding: 6px 12px;
  }

  .district-viewer__nav {
    position: absolute;
    top: 50%;
    left: 8px;
    right: 8px;
    padding: 0;
    justify-content: space-between;
    pointer-events: none;
    transform: translateY(-50%);
  }

  .district-viewer__nav .district-viewer__btn {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.55);
  }
}

@media (min-width: 768px) {
  .district-viewer__bar {
    padding: 16px 24px;
  }

  .district-viewer__title,
  .district-viewer__count {
    font-size: 15px;
  }

  .district-viewer__stage {
    padding: 0 24px;
  }

  .district-viewer__nav {
    padding-top: 16px;
  }
}

@media (min-width: 1024px) {
  /* Desktop: arrows float over the sides of the stage */
  .district-viewer__nav {
    position: absolute;
    top: 50%;
    left: 24px;
    right: 24px;
    padding: 0;
    justify-content: space-between;
    pointer-events: none;
    transform: translateY(-50%);
  }

  .district-viewer__nav .district-viewer__btn {
    pointer-events: auto;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
  }

  .district-viewer__stage {
    padding: 0 96px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .district-report-card,
  .district-report-card__cta,
  .district-viewer,
  .district-viewer__img {
    transition: none;
  }

  .district-viewer__spinner {
    animation-duration: 2s;
  }
}
