/* ============================================================
   Fisheries Ecosystem Monitor — styles.css
   "Bright Nautical" theme — glass panels over an animated
   daylight-ocean backdrop.
   ============================================================ */

:root {
  /* ── Bright Nautical design tokens (OKLCH) ───────────────── */
  --bg-deep:        oklch(0.95 0.018 220);
  --text-primary:   oklch(0.24 0.05 250);
  --text-secondary: oklch(0.32 0.05 248);
  --text-tertiary:  oklch(0.4 0.045 245);
  --text-muted:     oklch(0.55 0.03 240);

  --accent:         oklch(0.55 0.16 235);
  --accent-dark:    oklch(0.42 0.17 235);

  --amber:          oklch(0.72 0.13 85);
  --amber-mid:      oklch(0.55 0.13 85);
  --amber-dark:     oklch(0.55 0.15 75);

  --status-healthy:     oklch(0.5 0.14 150);
  --status-approaching: oklch(0.55 0.15 75);
  --status-overfished:  oklch(0.55 0.18 25);

  --border:         oklch(0.83 0.025 228);

  --glass-white:    oklch(0.99 0.006 220);
  --glass-white-2:  oklch(0.955 0.014 222);

  --header-gradient: linear-gradient(135deg, oklch(0.6 0.12 240) 0%, oklch(0.72 0.1 225) 55%, oklch(0.95 0.018 220) 100%);

  /* Legacy aliases kept so any un-migrated selector below still resolves
     sensibly rather than falling back to browser defaults. */
  --bg-panel:      var(--glass-white);
  --bg-panel-alt:  var(--glass-white-2);

  --chart-height-desktop: 280px;
  --chart-height-mobile:  200px;
  --map-height-desktop:   400px;
  --map-height-mobile:    250px;

  --radius:    22px;
  --radius-sm: 8px;
  --shadow:    0 12px 44px oklch(0.28 0.05 250 / 0.22), inset 0 1px 0 oklch(1 0 0 / 0.55);

  --font-heading: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  --font-body:    -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.5;
  min-width: 320px;
  position: relative;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout wrapper ───────────────────────────────────────── */
.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  background: var(--header-gradient);
  border-bottom: 1px solid oklch(1 0 0 / 0.35);
  padding: 20px 0 0;
  position: relative;
  z-index: 2;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
}

.header-icon {
  font-size: 1.6rem;
  line-height: 1;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: oklch(1 0 0 / 0.22);
  border: 1px solid oklch(1 0 0 / 0.4);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.header-icon:hover { background: oklch(1 0 0 / 0.32); transform: scale(1.05); }

.header-text h1 {
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  font-weight: 700;
  color: oklch(0.99 0.006 220);
  letter-spacing: -0.02em;
}

.header-text p {
  font-size: 0.85rem;
  color: oklch(0.95 0.02 220 / 0.85);
  margin-top: 2px;
}

.header-badge {
  margin-left: auto;
  background: oklch(0.72 0.13 85 / 0.18);
  border: 1px solid oklch(0.72 0.13 85 / 0.5);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.75rem;
  color: oklch(0.99 0.006 220);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Pill nav ─────────────────────────────────────────────── */
.site-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: oklch(1 0 0 / 0.16);
  backdrop-filter: blur(10px);
  border: 1px solid oklch(1 0 0 / 0.35);
  border-radius: 14px;
  padding: 6px;
  margin-bottom: -20px;
  transform: translateY(50%);
  position: relative;
  z-index: 3;
  animation: shadowPassAlt 9s ease-in-out infinite;
}

.site-nav a {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.site-nav a:hover { background: oklch(1 0 0 / 0.5); text-decoration: none; }

.site-nav a[aria-current="page"] {
  background: var(--accent);
  color: oklch(0.99 0.006 220);
}

/* ── Main content ─────────────────────────────────────────── */
main {
  padding: 44px 0 48px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: relative;
  z-index: 1;
}

/* ── Glass panels ─────────────────────────────────────────── */
.panel {
  background: oklch(0.99 0.006 220 / 0.4);
  backdrop-filter: blur(14px) saturate(190%);
  -webkit-backdrop-filter: blur(14px) saturate(190%);
  border: 1px solid oklch(1 0 0 / 0.6);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  animation: shadowPass 13s ease-in-out infinite;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 14px;
}

/* Opaque bordered box treatment for live chart/map widgets — deliberately
   NOT the glass pattern, and NOT the dashed-placeholder-stripe look from
   the design prototype, since these host real Chart.js/Leaflet content
   that needs full legibility. */
.chart-container,
.whatif-chart-wrap,
#map,
#draw-map,
#submit-map,
#detail-map {
  background: oklch(0.99 0.006 220 / 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ── Stock selector ───────────────────────────────────────── */
.selector-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.selector-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

select,
input[type="text"],
input[type="number"],
input[type="date"],
textarea {
  background: oklch(0.95 0.018 220);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 0.95rem;
  font-family: var(--font-body);
  transition: border-color 0.2s;
}

select:focus,
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

#stock-select,
#region-select {
  flex: 1;
  min-width: 200px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23385a7a' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.api-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.api-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-approaching);
  flex-shrink: 0;
}

.api-status-dot.live { background: var(--status-healthy); }

/* ── Status cards row ─────────────────────────────────────── */
.status-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.status-card {
  background: oklch(0.99 0.006 220 / 0.55);
  backdrop-filter: blur(14px) saturate(190%);
  border: 1px solid oklch(1 0 0 / 0.6);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  border-left: 4px solid var(--border);
  transition: border-color 0.3s;
  box-shadow: var(--shadow);
  animation: shadowPassAlt 9s ease-in-out infinite;
}

.status-card.healthy      { border-left-color: var(--status-healthy); }
.status-card.approaching  { border-left-color: var(--status-approaching); }
.status-card.overfished   { border-left-color: var(--status-overfished); }

.card-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-value {
  font-family: var(--font-heading);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.card-unit {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.card-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 6px;
}

.badge-healthy    { background: oklch(0.5 0.14 150 / 0.16);  color: var(--status-healthy); }
.badge-approaching{ background: oklch(0.55 0.15 75 / 0.16);  color: var(--status-approaching); }
.badge-overfished { background: oklch(0.55 0.18 25 / 0.16);  color: var(--status-overfished); }

/* ── Charts grid ──────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.chart-container {
  position: relative;
  height: var(--chart-height-desktop);
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── What-if panel ────────────────────────────────────────── */
.whatif-panel {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}

.whatif-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.slider-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.slider-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  min-width: 60px;
  text-align: right;
}

input[type="range"]#fm-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) 50%, var(--border) 50%);
  outline: none;
  cursor: pointer;
}

input[type="range"]#fm-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-deep);
  box-shadow: 0 0 0 2px var(--accent-dark);
  cursor: pointer;
  transition: transform 0.1s;
}

input[type="range"]#fm-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]#fm-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-deep);
  cursor: pointer;
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.disclaimer {
  background: oklch(0.55 0.16 235 / 0.08);
  border: 1px solid oklch(0.55 0.16 235 / 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.disclaimer strong { color: var(--accent); }

.disclaimer-citizen-science {
  background: oklch(0.55 0.15 75 / 0.08);
  border-color: oklch(0.55 0.15 75 / 0.3);
}

.disclaimer-citizen-science strong { color: var(--status-approaching); }

.disclaimer-structured-citizen-science {
  background: oklch(0.5 0.14 150 / 0.08);
  border-color: oklch(0.5 0.14 150 / 0.3);
}

.disclaimer-structured-citizen-science strong { color: var(--status-healthy); }

.stock-search-results {
  margin-top: 8px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: oklch(0.99 0.006 220 / 0.7);
}

.search-result-item {
  padding: 8px 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: oklch(0.55 0.16 235 / 0.1); color: var(--text-primary); }

.search-result-region-btn {
  font-size: 0.72rem;
  padding: 2px 8px;
}

.stock-unavailable-panel {
  background: oklch(0.955 0.014 222 / 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.stock-unavailable-panel h3 { margin: 0 0 6px; color: var(--text-primary); font-size: 1rem; }
.stock-unavailable-panel p { color: var(--text-secondary); font-size: 0.85rem; margin: 0 0 8px; }
.stock-unavailable-panel ul { margin: 0; padding-left: 18px; font-size: 0.8rem; color: var(--text-secondary); }

.whatif-chart-wrap {
  position: relative;
  height: var(--chart-height-desktop);
}

.whatif-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Map ──────────────────────────────────────────────────── */
#map {
  height: var(--map-height-desktop);
  z-index: 0;
}

.leaflet-control-attribution {
  background: oklch(0.99 0.006 220 / 0.85) !important;
  color: var(--text-muted) !important;
  font-size: 0.65rem !important;
}
.leaflet-control-attribution a { color: var(--accent) !important; }
.leaflet-control-zoom a {
  background: var(--glass-white) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: oklch(0.99 0.006 220 / 0.5);
  backdrop-filter: blur(14px) saturate(190%);
  border-top: 1px solid oklch(1 0 0 / 0.6);
  padding: 20px 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
  position: relative;
  z-index: 1;
}

.site-footer a { color: var(--text-secondary); }

/* ── Loading / skeleton ───────────────────────────────────── */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: oklch(0.99 0.006 220 / 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.loading-overlay.active { opacity: 1; pointer-events: auto; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Glass shadow-pass ambient animations ────────────────── */
@keyframes shadowPass {
  0%, 100% { box-shadow: 0 12px 44px oklch(0.28 0.05 250 / 0.18), inset 0 1px 0 oklch(1 0 0 / 0.5); }
  50%      { box-shadow: 0 16px 54px oklch(0.28 0.05 250 / 0.28), inset 0 1px 0 oklch(1 0 0 / 0.6); }
}

@keyframes shadowPassAlt {
  0%, 100% { box-shadow: 0 8px 28px oklch(0.28 0.05 250 / 0.14); }
  50%      { box-shadow: 0 10px 36px oklch(0.28 0.05 250 / 0.22); }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .status-cards {
    grid-template-columns: 1fr;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .whatif-panel {
    grid-template-columns: 1fr;
  }

  .chart-container,
  .whatif-chart-wrap {
    height: var(--chart-height-mobile);
  }

  #map {
    height: var(--map-height-mobile);
  }

  .header-badge { display: none; }

  .panel { padding: 18px; }
}

@media (max-width: 480px) {
  .header-inner { gap: 10px; }
  .header-icon { font-size: 1.3rem; }
}

/* ── Review queue ─────────────────────────────────────────── */
#status-filter {
  cursor: pointer;
}

.queue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.queue-table th {
  text-align: left;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.queue-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.queue-table tr:hover td {
  background: oklch(0.55 0.16 235 / 0.06);
}

.coverage-cell-hit {
  color: var(--status-healthy);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.coverage-cell-miss {
  color: var(--status-overfished);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  opacity: 0.7;
}

.qc-flag-badge {
  display: inline-block;
  min-width: 20px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: oklch(0.55 0.03 240 / 0.15);
  color: var(--text-secondary);
}

.qc-flag-badge-warn {
  background: oklch(0.55 0.15 75 / 0.18);
  color: var(--status-approaching);
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge-pending        { background: oklch(0.55 0.15 75 / 0.18);  color: var(--status-approaching); }
.status-badge-accepted       { background: oklch(0.5 0.14 150 / 0.18);  color: var(--status-healthy); }
.status-badge-rejected       { background: oklch(0.55 0.18 25 / 0.18);  color: var(--status-overfished); }
.status-badge-info_requested { background: oklch(0.55 0.16 235 / 0.18); color: var(--accent); }

.review-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-heading);
  cursor: pointer;
  background: oklch(0.99 0.006 220 / 0.7);
  color: var(--text-primary);
  transition: border-color 0.2s, background 0.2s;
}

.review-btn:hover { border-color: var(--accent); background: oklch(0.99 0.006 220); }

.review-btn-view    { padding: 4px 10px; font-size: 0.78rem; }
.review-btn-accept  { border-color: var(--status-healthy);    color: var(--status-healthy); }
.review-btn-reject  { border-color: var(--status-overfished); color: var(--status-overfished); }
.review-btn-info    { border-color: var(--accent);            color: var(--accent); }
.review-btn-close   { color: var(--text-muted); }

/* ============================================================
   Custom dropdown (progressive enhancement of <select>)
   ============================================================ */
.dc-dropdown {
  position: relative;
  flex: 1;
  min-width: 200px;
  display: inline-block;
}

.dc-dropdown-narrow { flex: initial; min-width: 160px; }

/* Visually hide the underlying <select> without display:none, so it stays
   in the tab order / keeps firing native events. */
.dc-dropdown select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.0001;
  pointer-events: none;
}

.dc-dropdown-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: oklch(0.95 0.018 220);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 0.95rem;
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
}

.dc-dropdown-btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px oklch(0.55 0.16 235 / 0.25);
}

.dc-dropdown-btn-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dc-dropdown-chevron {
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text-secondary);
  transition: transform 0.15s ease;
}

.dc-dropdown[data-open="true"] .dc-dropdown-chevron {
  transform: rotate(180deg);
}

.dc-dropdown-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: oklch(0.99 0.006 220 / 0.9);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  border: 1px solid oklch(1 0 0 / 0.7);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px oklch(0.28 0.05 250 / 0.28);
  z-index: 41;
  padding: 4px;
}

.dc-dropdown-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 6px 10px 2px;
}

.dc-dropdown-option {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--text-primary);
  cursor: pointer;
}

.dc-dropdown-option:hover,
.dc-dropdown-option.dc-active {
  background: oklch(0.55 0.16 235 / 0.12);
}

.dc-dropdown-option[aria-selected="true"] {
  background: oklch(0.55 0.16 235 / 0.18);
  color: var(--accent-dark);
  font-weight: 600;
}

.dc-dropdown-option[aria-disabled="true"] {
  color: var(--text-muted);
  cursor: default;
  opacity: 0.7;
}

/* ============================================================
   Ambient ocean background (background.js)
   ============================================================ */
#bg-ocean {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

/* Fixed sibling of #bg-ocean, not a child — needs its own z-index one
   level deeper (-2) than the ambient fish/school/shark layer (-1), which
   an absolutely-positioned child can't do within the parent's own
   stacking context. */
#bg-ocean-backdrop {
  position: fixed;
  inset: -10%;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 15%, oklch(0.8 0.1 220 / 0.7) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, oklch(0.6 0.16 240 / 0.6) 0%, transparent 50%),
    radial-gradient(circle at 50% 45%, oklch(0.85 0.1 200 / 0.35) 0%, transparent 55%),
    linear-gradient(180deg, oklch(0.92 0.05 215) 0%, oklch(0.74 0.1 230) 55%, oklch(0.55 0.13 240) 100%);
  background-size: 140% 140%;
  animation: oceanDrift 24s ease-in-out infinite alternate;
}

@keyframes oceanDrift {
  0%   { background-position: 0% 0%, 100% 100%, 50% 50%, 0% 0%; }
  100% { background-position: 12% 8%, 88% 92%, 42% 58%, 0% 6%; }
}

/* ── Fish shapes (pure CSS: blob body + triangle tail) ───── */
.dc-fish {
  position: absolute;
  will-change: transform;
}

.dc-fish-shape {
  display: block;
  width: 26px;
  height: 13px;
  overflow: visible;
}

.dc-fish-body-path,
.dc-fish-tail-path,
.dc-fish-fin-path {
  fill: currentColor;
}

.dc-fish-eye-dot {
  fill: oklch(0.24 0.05 250 / 0.55);
}

.dc-fish-blue  { color: oklch(0.55 0.16 235 / 0.5); }
.dc-fish-amber { color: oklch(0.72 0.13 85 / 0.5); }
.dc-fish-green { color: oklch(0.5 0.14 150 / 0.5); }

@keyframes fishBob {
  0%, 100% { margin-top: 0; }
  50%      { margin-top: -10px; }
}

/* The base fish shape (eye on the left, tail trailing to the right)
   faces left, so swimming rightward (LTR) needs a horizontal flip to
   face the direction of travel; swimming leftward (RTL) doesn't. */
/* calc() buffer for the same reason as the school/shark: vw alone can
   shrink below the fish's own width (up to 26px) at narrow viewports. */
@keyframes fishSwimLTR {
  from { transform: translateX(calc(-8vw - 40px)) scaleX(-1); }
  to   { transform: translateX(108vw) scaleX(-1); }
}

@keyframes fishSwimRTL {
  from { transform: translateX(108vw) scaleX(1); }
  to   { transform: translateX(calc(-8vw - 40px)) scaleX(1); }
}

/* ── School of fish ───────────────────────────────────────── */
.dc-school {
  position: absolute;
  top: 30%;
  /* vw alone isn't enough at narrow viewport widths — the cluster is
     ~105px wide, and 12vw can shrink below that, leaking into view
     while "idle". The fixed px term guarantees clearance regardless
     of viewport width. */
  left: calc(-15vw - 140px);
  animation: schoolSwim 85s ease-in-out infinite;
}

.dc-school.dc-school-dart {
  animation: schoolDart 3.5s ease-in forwards;
}

.dc-school .dc-fish-shape {
  width: 18px;
  height: 9px;
  color: oklch(0.7 0.08 220 / 0.55);
  /* The school only ever drifts rightward — flip to face travel direction. */
  transform: scaleX(-1);
}

/* Holds position through 55%, dashes across 55%-78%, exits 78%-100%. */
@keyframes schoolSwim {
  0%   { transform: translateX(0); }
  55%  { transform: translateX(0); }
  78%  { transform: translateX(100vw); }
  100% { transform: translateX(130vw); }
}

@keyframes schoolDart {
  0%   { transform: translateX(0); }
  100% { transform: translateX(130vw); }
}

/* ── Shark — same SVG silhouette design as the fish, scaled up,
   plus a belly-highlight shape to read as a shark rather than a
   giant fish. ─────────────────────────────────────────────── */
.dc-shark {
  position: absolute;
  top: 65%;
  animation: sharkCross 240s linear infinite;
}

.dc-shark-shape {
  display: block;
  width: 96px;
  height: 48px;
  overflow: visible;
  color: oklch(0.4 0.02 240 / 0.62);
  /* sharkCross only ever moves rightward — flip to face travel direction,
     same as the school (base shape faces left, like the ambient fish). */
  transform: scaleX(-1);
}

.dc-shark-belly {
  fill: oklch(0.6 0.02 235 / 0.35);
}

/* Holds off-screen for 92% of the 240s cycle, crosses in the last 8%
   (visible ~19s every 4 minutes). vw alone isn't enough clearance at
   narrow viewport widths — the shark is 96px wide, and 20vw can shrink
   below that — so add a fixed px buffer via calc(). */
@keyframes sharkCross {
  0%   { left: calc(-20vw - 120px); }
  92%  { left: calc(-20vw - 120px); }
  100% { left: 110vw; }
}

/* ── Cursor-following fish ────────────────────────────────── */
#dc-cursor-fish {
  position: fixed;
  top: 0;
  left: 0;
  /* Unlike the ambient background fish, this one is meant to swim over
     top of every page element, including panels/dropdowns. */
  z-index: 9999;
  pointer-events: none;
  will-change: transform;
}

#dc-cursor-fish .dc-fish-shape {
  width: 22px;
  height: 11px;
  color: oklch(0.72 0.13 85 / 0.85);
}

/* ── Overscroll bubbles ───────────────────────────────────── */
#bg-bubbles {
  position: fixed;
  inset: 0;
  /* Unlike the ambient fish/school/shark (behind panels, z-index:-1),
     bubbles rise over top of everything, same tier as the cursor-fish. */
  z-index: 16;
  overflow: hidden;
  pointer-events: none;
}

.dc-bubble {
  position: absolute;
  bottom: -20px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%,
    oklch(1 0 0 / 1) 0%,
    oklch(1 0 0 / 0.55) 18%,
    oklch(0.8 0.07 220 / 0.25) 55%,
    transparent 100%);
  border: 1px solid oklch(0.97 0.02 220 / 0.85);
  box-shadow: 0 0 4px oklch(1 0 0 / 0.6), inset 0 0 3px oklch(1 0 0 / 0.9);
  animation: bubbleRise 4s ease-out forwards;
}

@keyframes bubbleRise {
  0%   { transform: translateY(0) scale(0.85); opacity: 0; }
  12%  { opacity: 0.85; }
  80%  { opacity: 0.5; }
  100% { transform: translateY(-72vh) scale(1.15); opacity: 0; }
}

/* Prefers-reduced-motion — background.js also skips injecting motion
   elements entirely; these rules are a defensive backstop. */
@media (prefers-reduced-motion: reduce) {
  .dc-fish, .dc-school, .dc-shark, #dc-cursor-fish, .dc-bubble { animation: none !important; }
  #bg-ocean-backdrop { animation: none !important; }
}
