/*
 * Copyright (c) 2026 Contributors to the Eclipse Foundation.
 *
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 */

/* design tokens of the WOGE website (woge.modelatlas.cloud) */
:root {
  --bg: #EDF7F7; --surface: #FFFFFF; --surface-2: #F7FCFC;
  --ink: #0C3740; --muted: #47686E; --line: #CFE4E4;
  --water: #16A3AB; --water-deep: #0E7C86; --water-soft: #BDE7E9;
  --coral: #F4643F; --coral-ink: #FFFFFF; --ok: #2FA84F;
  --shadow: 0 10px 30px rgba(12, 55, 64, 0.10);
  --rounded: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --header-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #062229; --surface: #0C333B; --surface-2: #0A2C33;
    --ink: #E9F5F4; --muted: #9EC2C4; --line: #1B4750;
    --water: #2BC6CE; --water-deep: #57D5DB; --water-soft: #14444D;
    --coral: #FF7B57; --coral-ink: #2A1007;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #062229; --surface: #0C333B; --surface-2: #0A2C33;
  --ink: #E9F5F4; --muted: #9EC2C4; --line: #1B4750;
  --water: #2BC6CE; --water-deep: #57D5DB; --water-soft: #14444D;
  --coral: #FF7B57; --coral-ink: #2A1007;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--water-deep); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 3px solid var(--coral); outline-offset: 2px; border-radius: 6px;
}

/* ---------- header, like the website ---------- */
header.site {
  position: absolute; top: 0; left: 0; right: 0; height: var(--header-h); z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 24px; height: 100%; padding: 0 20px; }
.brand {
  font-family: var(--rounded); font-weight: 800; font-size: 1.25rem; letter-spacing: 0.02em;
  color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px;
}
.brand svg { display: block; }
.brand .sub {
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--water-deep); padding: 3px 10px; border-radius: 999px; background: var(--water-soft);
}
.nav-links { display: flex; gap: 22px; margin-left: auto; }
.nav-links a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.nav-links a:hover { color: var(--water-deep); }
.btn {
  display: inline-block; background: var(--coral); color: var(--coral-ink); border: none; border-radius: 999px;
  padding: 8px 20px; font-weight: 700; font-size: 0.95rem; text-decoration: none; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(244, 100, 63, 0.35); }
@media (prefers-reduced-motion: reduce) { .btn, .btn:hover { transition: none; transform: none; } }
@media (max-width: 860px) { .nav-links { display: none; } .btn { margin-left: auto; } }

/* ---------- map and layer panel ---------- */
#map { position: absolute; top: var(--header-h); left: 0; right: 0; bottom: 0; background: var(--bg); }
#panel {
  position: absolute; top: calc(var(--header-h) + 16px); left: 16px; width: 290px;
  max-height: calc(100% - var(--header-h) - 32px); z-index: 5;
  display: flex; flex-direction: column; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; font-size: 14px;
}
#panel header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 18px 12px; }
#panel h1 { font-family: var(--rounded); font-size: 1.2rem; font-weight: 800; margin: 0; line-height: 1.15; }
#collapse {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 16px;
  cursor: pointer; width: 34px; height: 34px; border-radius: 50%; flex: none;
}
#panel-body { overflow: auto; padding: 0 18px 16px; }
#panel.collapsed #panel-body { display: none; }

.status-chip {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px;
  font-size: 0.82rem; font-weight: 600; color: var(--ink);
}
.status-chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status-chip.ok .dot { background: var(--ok); }
.status-chip.error .dot { background: var(--coral); }
.status-chip[hidden] { display: none; }

.basemap {
  display: flex; gap: 6px 12px; align-items: center; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 4px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; font-size: 0.9rem;
}
.basemap label { white-space: nowrap; }
.basemap select {
  margin-left: 6px; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px;
}
input[type="checkbox"] { accent-color: var(--water); width: 16px; height: 16px; margin: 0; }
.check { display: flex; align-items: center; gap: 6px; }

.group { margin-top: 12px; }
.group .group { margin-left: 12px; margin-top: 6px; }
.group > label { font-weight: 700; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.group.depth-0 > label {
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--water-deep);
}
.layer { display: flex; align-items: center; gap: 8px; padding: 2px 0 2px 24px; }
.layer label { flex: 1; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.swatch {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 2.5px color-mix(in srgb, var(--ink) 30%, transparent);
}
.count {
  color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.78rem; font-weight: 600;
  background: var(--surface-2); border-radius: 999px; padding: 0 8px; min-width: 26px; text-align: center;
}
.muted { color: var(--muted); }
footer { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 0.88rem; color: var(--muted); }
footer a { font-weight: 600; text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ---------- popup ---------- */
.maplibregl-popup-content {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; max-width: 300px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 16px 18px 12px;
}
.maplibregl-popup-close-button { color: var(--muted); font-size: 20px; right: 8px; top: 6px; }
[class*="maplibregl-popup-anchor-top"] .maplibregl-popup-tip { border-bottom-color: var(--surface); }
[class*="maplibregl-popup-anchor-bottom"] .maplibregl-popup-tip { border-top-color: var(--surface); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); }
.popup h2 { font-family: var(--rounded); font-size: 1.1rem; font-weight: 800; margin: 0 20px 2px 0; line-height: 1.2; }
.popup .type {
  display: inline-block; margin-bottom: 8px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--water-deep);
}
.popup h3 {
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin: 4px 0 4px;
}
.popup table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
.popup td { padding: 3px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.popup tr:last-child td { border-bottom: none; }
.popup td:first-child { color: var(--muted); white-space: nowrap; }
.popup table.live {
  margin-bottom: 10px; background: var(--water-soft); border-radius: 12px; overflow: hidden;
}
.popup table.live td { border-bottom-color: color-mix(in srgb, var(--water) 25%, transparent); padding: 4px 10px; }
.popup table.live td:first-child { color: var(--ink); }
.popup table.live td:last-child { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.popup .ago { font-weight: 500; color: var(--muted); font-size: 0.72rem; margin-left: 4px; white-space: nowrap; }
.popup p { margin: 8px 0 0; }
.popup p a { font-weight: 700; text-decoration: none; }

.maplibregl-ctrl-group { border-radius: 14px !important; box-shadow: var(--shadow) !important; overflow: hidden; }

@media (max-width: 600px) {
  #panel { width: calc(100% - 32px); max-height: 45%; }
}
