/* =========================================================
   Our Blue Planet's Refuges
   ========================================================= */
:root {
  --ink: #123e63;
  --ink-soft: #375d7d;
  --sea: #2f78a8;
  --sea-deep: #1f5b85;
  --mist: #dce8f2;
  --mist-strong: rgba(234, 241, 247, 0.94);
  --panel: #edf4f8;
  --accent: #d82c66;
  --grid: rgba(18, 62, 99, 0.12);
  --shadow: 0 18px 45px rgba(18, 62, 99, 0.12);
  --radius: 18px;
  --max-width: 1600px;
}

*,
*:before,
*:after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 30%),
    linear-gradient(180deg, #dbe7f1 0%, #d4e3ee 52%, #dce8f2 100%);
  -webkit-font-smoothing: antialiased;
}

#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1200;
  width: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--sea-deep), var(--accent));
  transition: width 120ms linear;
}

.noscript-banner {
  padding: 0.9rem 1.2rem;
  background: #fff5da;
  color: #6b4d00;
  border-bottom: 1px solid rgba(107, 77, 0, 0.15);
  text-align: center;
  font-size: 0.95rem;
}

.scrolly-container {
  display: grid;
  grid-template-columns: minmax(340px, 500px) 1fr;
  max-width: var(--max-width);
  margin: 0 auto;
}

.scrolly-text {
  position: relative;
  z-index: 10;
  padding: 2.5rem 2.2rem 10rem;
}

.scrolly-text .step {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0.28;
  transform: translateY(12px);
  transition: opacity 400ms ease, transform 400ms ease;
  margin-bottom: 1.8rem;
}

.scrolly-text .step.is-active {
  opacity: 1;
  transform: translateY(0);
}

.scrolly-text p.eyebrow {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: none;
  box-shadow: none;
  border: 0;
  padding: 0;
  backdrop-filter: none;
  max-width: none;
}

.scrolly-text h1,
.scrolly-text h2 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.02em;
}

.scrolly-text h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.7rem, 5vw, 4.7rem);
  line-height: 0.95;
  max-width: 8ch;
}

.scrolly-text h2 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.7rem, 2.5vw, 2.3rem);
  line-height: 1.1;
}

.scrolly-text p.authors {
  margin: 0 0 3rem;
  padding: 0;
  background: none;
  box-shadow: none;
  border: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  backdrop-filter: none;
  max-width: none;
}

.scrolly-text p {
  margin: 0;
  max-width: 34rem;
  padding: 1.35rem 1.5rem;
  line-height: 1.68;
  font-size: 1.06rem;
  background: var(--mist-strong);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.scrolly-text strong {
  color: var(--sea-deep);
}

.step.center {
  min-height: 62vh;
  text-align: center;
  align-items: center;
}

.step.center p {
  max-width: 42rem;
}

#hawaii-intro {
  text-align: left;
  align-items: flex-start;
}

#hawaii-intro p {
  max-width: 34rem;
}

.scrolly-vis {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #edf4f8 0%, #e4eef5 100%);
  border-left: 1px solid var(--grid);
}

.vis-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms ease-in-out;
  z-index: 1;
}

.vis-layer.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

#map-wrapper {
  background: var(--mist);
}

#map {
  width: 100%;
  height: 100%;
}

.leaflet-container {
  background: var(--mist);
}

.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.82) !important;
  color: var(--ink-soft) !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  box-shadow: 0 12px 28px rgba(18, 62, 99, 0.15);
}

.map-legend,
.vis-status {
  position: absolute;
  z-index: 450;
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.map-legend {
  left: 24px;
  bottom: 28px;
  width: 240px;
  padding: 14px 18px;
  background: rgba(237, 244, 248, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.map-legend h4 {
  margin: 0 0 12px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 0.95rem;
}

.legend-item input {
  margin: 0;
  transform: scale(1.08);
  accent-color: var(--sea);
}

.legend-item label {
  cursor: pointer;
  flex: 1;
}

.legend-sub-items {
  margin-left: 28px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.key-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.park {
  background: #256a9e;
}

.dot.reserve {
  background: #e5a731;
}

.dot.other {
  background: #6caad8;
}

.dot.notake-outline {
  background: transparent;
  border: 2px solid var(--accent);
}

.legend-divider {
  border: 0;
  border-top: 1px solid var(--grid);
  margin: 12px 0;
}

.vis-status {
  top: 24px;
  right: 24px;
  max-width: 320px;
  padding: 0.85rem 1rem;
  background: rgba(18, 62, 99, 0.84);
  color: white;
  font-size: 0.95rem;
  line-height: 1.5;
}

.vis-status:empty,
.vis-status.is-hidden {
  display: none;
}

#graph-wrapper,
#vega-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 28px;
  background: linear-gradient(180deg, #edf4f8 0%, #e7f0f5 100%);
}

#graph-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 45px rgba(18, 62, 99, 0.12);
  background: white;
}

#vega-wrapper {
  overflow: hidden;
}

#vega-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.vega-embed {
  max-width: 100%;
  max-height: 100%;
  overflow: auto;
}

footer {
  padding: 4rem 2rem 4.5rem;
  background: linear-gradient(180deg, rgba(219, 231, 241, 0.95), rgba(237, 244, 248, 0.98));
  border-top: 1px solid var(--grid);
}

.footer-content {
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
  color: var(--ink-soft);
}

.footer-heading {
  margin: 0 0 0.8rem;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.footer-content p {
  margin: 0 0 1.25rem;
  line-height: 1.75;
}

.footer-content a {
  color: var(--sea-deep);
}

.disclaimer {
  font-size: 0.92rem;
  opacity: 0.88;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  #progress-bar,
  .scrolly-text .step,
  .vis-layer {
    transition: none;
  }
}

@media (max-width: 980px) {
  .scrolly-container {
    grid-template-columns: 1fr;
  }

  .scrolly-vis {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.22;
    border-left: 0;
  }

  .scrolly-text {
    padding-top: 42vh;
    padding-left: 1.2rem;
    padding-right: 1.2rem;
  }

  .scrolly-text p {
    background: rgba(244, 248, 251, 0.96);
  }

  .map-legend {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }

  .vis-status {
    left: 16px;
    right: 16px;
    top: 16px;
    max-width: none;
  }
}
