/* ── Variables ─────────────────────────────────────────────── */
:root {
  --brand: #053F53;
  --header-h: 60px;
  --text: #1a1a1a;
  --font: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
  --max-w: 1200px;
  --section-pad: 2rem;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ──────────────────────────────────────────────────── */
body {
  font-family: var(--font);
  color: var(--text);
  background: #fff;
  padding-top: var(--header-h);
  line-height: 1.6;
}

a { color: var(--brand); }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Header ────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  background: var(--brand);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  z-index: 100;
  gap: 1rem;
}

.header-logo img {
  height: 38px;
  width: auto;
}

.site-nav {
  flex: 1;
  display: flex;
  justify-content: center;
}

.site-nav ul {
  display: flex;
  list-style: none;
  gap: 3rem;
}

.site-nav a {
  color: #fff;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: bold;
  opacity: 0.85;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.site-nav a:hover { opacity: 1; text-decoration: none; }
.site-nav a[aria-current="page"] { opacity: 1; text-decoration: underline; }

/* ── Hamburger ─────────────────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}

@media (orientation: portrait) {
  .nav-hamburger { display: flex; }

  .site-nav {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--brand);
    padding: 0.5rem 0 1rem;
    justify-content: flex-start;
    z-index: 99;
  }

  .site-nav.open { display: flex; }

  .site-nav ul {
    flex-direction: column;
    gap: 0;
    width: 100%;
    align-items: center;
  }

  .site-nav ul li { width: 100%; text-align: center; }

  .site-nav a {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
  }
}

/* ── Science page ──────────────────────────────────────────── */

/* Hero is sticky so it stays at the top while sections slide over it */
.science-hero {
  position: sticky;
  top: var(--header-h);
  height: 40vh;
  z-index: 0;
  overflow: hidden;
}

.science-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.science-hero-label {
  position: absolute;
  bottom: 1.75rem;
  left: 2rem;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 600;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.65);
}

/* ── Science sections ──────────────────────────────────────── */

/* White background slides over the sticky hero as the user scrolls */
.science-sections {
  position: relative;
  z-index: 1;
  background: #fff;
}

.science-section {
  padding: 1.5rem var(--section-pad) 3rem;
}

.science-section + .science-section {
  border-top: 1px solid #e0e0e0;
}

/* Each section heading sticks just below the header and gets replaced
   by the next section's heading as the user scrolls down */
.section-heading {
  position: sticky;
  top: var(--header-h);
  background: #fff;
  z-index: 3;
  padding: 1.25rem 0 0.75rem;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--brand);
  border-bottom: 2px solid var(--brand);
  margin-bottom: 2rem;
}

.section-body {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 3rem;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-bottom: 4rem;
  align-items: start;
}

.section-body--reversed {
  grid-template-columns: 2fr 3fr;
}

.section-body--reversed .section-text { order: 2; }
.section-body--reversed .section-media { order: 1; }

.section-text p { margin-bottom: 1rem; font-size: 1.4rem; }
.section-text p:last-child { margin-bottom: 0; }
.section-text a { font-weight: 600; }

.section-media {
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.section-media img {
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: 4px;
}

.media-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.media-pair img {
  height: 400px;
  width: 600px;
}

.folium-map {
  width: 100%;
  flex: 1;
  min-height: 420px;
  border: none;
  border-radius: 4px;
}

.section-iframe {
  width: 100%;
  height: 420px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* ── Generic page content (data, contact) ──────────────────── */
.page-content {
  max-width: var(--max-w);
  margin: 3rem auto;
  padding: 0 var(--section-pad);
}

.page-content h1 {
  color: var(--brand);
  font-size: 2rem;
  margin-bottom: 1rem;
}

/* ── Data visualisation toggles ────────────────────────────── */
.data-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.toggle-row-label {
  font-weight: 600;
  color: var(--brand);
  min-width: 6rem;
  font-size: 0.95rem;
}

.toggle-group {
  display: flex;
  gap: 0.4rem;
}

.toggle-btn {
  padding: 0.35rem 1.1rem;
  border: 2px solid var(--brand);
  border-radius: 3px;
  background: #fff;
  color: var(--brand);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.toggle-btn:hover { background: rgba(5, 63, 83, 0.08); }

.toggle-btn.active {
  background: var(--brand);
  color: #fff;
}

.plot-item { margin-bottom: 1.5rem; }

.plots-loading,
.plots-empty {
  color: #666;
  font-style: italic;
  padding: 2rem 0;
}

/* ── Scroll progress indicator ─────────────────────────────── */
.scroll-indicator {
  position: fixed;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
}

.scroll-indicator ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* vertical connecting line between dots */
.scroll-indicator ol::before {
  content: '';
  position: absolute;
  right: 5px;
  top: 16px;
  bottom: 16px;
  width: 2px;
  background: rgba(5, 63, 83, 0.25);
}

.scroll-indicator-item {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 10px 0;
  position: relative;
}

.scroll-indicator-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--brand);
  background: #fff;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s;
  z-index: 1;
}

.scroll-indicator-item.active .scroll-indicator-dot {
  background: var(--brand);
  transform: scale(1.25);
}

.scroll-indicator-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand);
  background: rgba(255, 255, 255, 0.95);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.scroll-indicator-item:hover .scroll-indicator-label {
  opacity: 1;
  transform: translateX(0);
}

/* ── Responsive ────────────────────────────────────────────── */

/* Stack media below text on portrait viewports */
@media (orientation: portrait) {
  .section-body,
  .section-body--reversed {
    grid-template-columns: 1fr;
  }

  .section-body--reversed .section-text,
  .section-body--reversed .section-media {
    order: unset;
  }

  .scroll-indicator { display: none; }
}

/* Visual tweaks for small screens */
@media (max-width: 768px) {
  .science-hero-label { font-size: 1rem; left: 1rem; }
  .section-heading { font-size: 1.25rem; }
  .site-header { padding: 0 1rem; }
  .science-section { padding: 1rem 1rem 2rem; }
}
