/* =========================================================================
   COPERNICUS-ALIGNED — light, institutional, and not a dashboard.
   =========================================================================
   The dark console with coloured accents reads as a product demo whatever the
   accents are. This page's claim is that it is a TECHNICAL RECORD, and the
   register a European due-diligence reader expects for that is a document:
   paper ground, black-blue text, hairline rules, one institutional blue, and
   colour only where it carries meaning.

   The blue is Copernicus Marine's own. That is not decoration by association —
   the sargassum product, the currents, the waves and the licence quoted in the
   footer are all theirs. Borrowing the agency's visual language is the honest
   move where inventing a house palette would be pretending the data is ours.

   CONTRAST MEASURED AGAINST BOTH GROUNDS, not eyeballed. Every token below
   clears 3.0:1 for graphics and all but four clear 4.5:1 for body text; the
   four that do not (muted, assumed, sev-0) are never body text. Audited
   2026-09-11.

   THE TWO SEPARATIONS SURVIVE, as they did through the dark palette:
     · `synthetic` sits off the severity ramp and off measured/modelled.
     · `unknown` sits off the ramp too — an unobserved coast must never borrow
       a pale severity colour, which is how "nobody looked" becomes "nothing
       there".
   ========================================================================= */
:root {
  /* ground ---------------------------------------------------------------- */
  --nm-ground:   #FFFFFF;
  --nm-panel:    #F2F6F9;
  --nm-panel-2:  #E8EEF3;
  --nm-rule:     #C9D6E0;
  --nm-rule-soft:#E1E9EF;

  /* text ------------------------------------------------------------------ */
  --nm-ink:      #0B2B40;
  --nm-ink-2:    #4A6274;
  --nm-muted:    #6B7D8C;

  /* provenance — the four words, as colour --------------------------------- */
  --nm-measured: #0E5AA7;   /* Copernicus blue */
  --nm-modelled: #41729B;
  --nm-assumed:  #71808E;
  --nm-synthetic:#6B4E8A;   /* off both axes, on purpose */

  /* marks ----------------------------------------------------------------- */
  --nm-accent:   #9A5B00;   /* sargassum ochre, dark enough to read on paper */
  --nm-signal:   #B3121C;

  /* severity ramp: grey -> green -> amber -> burnt -> red -------------------- */
  --nm-sev-0:    #71808E;
  --nm-sev-1:    #2F6B44;
  --nm-sev-2:    #8A6000;
  --nm-sev-3:    #A8451A;
  --nm-sev-4:    #B3121C;
  --nm-unknown:  #41729B;   /* off the ramp: not a severity, a missing one */
}

/* Dark stays available behind the toggle — a crew opening this on a beach at
   05:00 is a real case and a white screen there is hostile. It keys on the
   ABSENCE of .theme-light rather than a class of its own, because rx-tokens.css
   already flips 45 tokens on that class and two competing theme classes is one
   more than any page needs. Light is now applied by default at boot. */
html:not(.theme-light) {
  /* the chrome has to come with it: without these the palette went dark
     while the panels stayed white, which is worse than either theme */
  --stage-bg: var(--nm-ground);
  --panel-bg: rgba(26, 33, 40, 0.82);
  --panel-bg-solid: rgba(26, 33, 40, 0.96);
  --panel-border: rgba(42, 51, 60, 0.85);
  --panel-border-strong: rgba(62, 73, 84, 0.95);
  --panel-shadow: none;
  --nm-ground:   #12171C;
  --nm-panel:    #1A2128;
  --nm-panel-2:  #161C22;
  --nm-rule:     #2A333C;
  --nm-rule-soft:#1F262D;
  --nm-ink:      #E6E8EA;
  --nm-ink-2:    #97A1AA;
  --nm-muted:    #6B747D;
  --nm-measured: #6FA3D0;
  --nm-modelled: #6E93A8;
  --nm-assumed:  #8A857C;
  --nm-synthetic:#9C86AB;
  --nm-accent:   #C08F4A;
  --nm-signal:   #D8615C;
  --nm-sev-0:    #68757F;
  --nm-sev-1:    #6FA37E;
  --nm-sev-2:    #C0A05A;
  --nm-sev-3:    #C4794A;
  --nm-sev-4:    #D8615C;
  --nm-unknown:  #6E93A8;
}

/* cuenca.css — RX-OS chrome for the basin-scale sargassum animation.
 *
 * Shares the panel / chip / btn / select / toast rules with playas.css
 * (the RX-OS Fleet idiom) so this screen sits beside the beach console
 * without a second visual language. Depends on rx-tokens.css.
 *
 * ONE DELIBERATE DEPARTURE FROM playas.css
 *   There the panels float ON TOP of a full-bleed map. Here they do not: the
 *   canvas is a contained card and the panels dock in the margins around it.
 *   The reason is the export. What paint() draws is exactly what the GIF
 *   encoder receives — title, colour bar, source line and the DATOS SIMULADOS
 *   badge are inside the picture, not in the page chrome. A panel parked over
 *   a corner of that picture would hide the very marker the export exists to
 *   carry, and would tempt someone to move the marker out of the frame to fix
 *   the collision. So the picture keeps its whole area and the chrome stays out.
 */

/* --- second token layer: the panel chrome, dark default ------------------ */
:root {
  --panel-bg: rgba(255, 255, 255, 0.94);
  --panel-bg-solid: rgba(255, 255, 255, 0.99);
  --panel-border: rgba(11, 43, 64, 0.12);
  --panel-border-strong: rgba(11, 43, 64, 0.24);
  --panel-shadow: none;
  --panel-radius: 10px;
  --stage-bg: #EDF2F6;
  --sim-flag: var(--nm-synthetic);
  --meas-flag: var(--nm-measured);
}

html.theme-light {
  --panel-bg: rgba(255, 255, 255, 0.90);
  --panel-bg-solid: rgba(255, 255, 255, 0.98);
  --panel-border: rgba(15, 20, 25, 0.10);
  --panel-border-strong: rgba(15, 20, 25, 0.20);
  --panel-shadow: none;
  --stage-bg: #E7ECF1;
  --sim-flag: #A4661B;
  --meas-flag: #0E7A57;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--rx-ff-sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage { position: fixed; inset: 0; background: var(--stage-bg); overflow: hidden; }

/* ---------- THE PICTURE ---------- */
.canvas-wrap {
  position: absolute;
  left: 16px; right: 316px; top: 96px; bottom: 90px;
  display: flex; align-items: center; justify-content: center;
  z-index: 0;
}
#stage-canvas {
  /* width/height are written by fitCanvas() in cuenca.js from the container
     box; aspect-ratio is only the pre-script fallback. */
  max-width: 100%; max-height: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 2px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 30px 70px -30px rgba(0,0,0,0.8);
  display: block;
}
html.theme-light #stage-canvas { box-shadow: 0 24px 60px -30px rgba(15,20,25,0.45); }

/* ---------- PANELS ---------- */
.panel {
  position: absolute;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow);
  color: var(--fg);
  z-index: 5;
}
.panel-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--panel-border);
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--fg-2); min-height: 38px;
}
.panel-header .marker { color: var(--accent); font-size: 12px; letter-spacing: 0; }
.panel-header .title { color: var(--fg-1); }
.panel-header .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.field-label {
  padding: 0 14px 6px; font-size: 9px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--fg-3);
}
.sel-row { display: flex; gap: 6px; padding: 0 14px 10px; }
select.rx-select {
  flex: 1; min-width: 0;
  background: var(--bg-sunk); color: var(--fg);
  border: 1px solid var(--panel-border-strong); border-radius: 2px;
  padding: 6px 8px; font-family: var(--rx-ff-sans); font-size: 11px;
  outline: 0;
}
select.rx-select:focus { border-color: var(--rx-signal-500); }
html.theme-light select.rx-select:focus { border-color: var(--rx-deep-500); }

.btn {
  background: transparent; border: 1px solid var(--panel-border-strong);
  border-radius: 2px; padding: 5px 10px;
  font-family: var(--rx-ff-sans); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-1);
  cursor: pointer; transition: all var(--rx-dur-fast) var(--rx-ease);
  text-decoration: none; display: inline-flex; align-items: center; gap: 5px;
}
.btn:hover { color: var(--fg); border-color: var(--line-strong); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: var(--rx-signal-500); color: var(--on-status); border-color: var(--rx-signal-500); }
.btn.primary:hover { background: var(--rx-signal-600); }
.btn.primary:disabled:hover { background: var(--rx-signal-500); }
html.theme-light .btn.primary { background: var(--rx-deep-500); border-color: var(--rx-deep-500); color: var(--rx-paper); }

/* ---------- top-left: brand ---------- */
.panel.brand-panel { left: 16px; top: 16px; width: 350px; padding-bottom: 12px; }
.brand-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 12px 14px 0;
  font-size: 12px; letter-spacing: 0.06em; color: var(--fg-2);
}
.brand-row .brand-strong { color: var(--fg); font-weight: 600; letter-spacing: -0.01em; font-size: 13px; }
.brand-row .sep { color: var(--rx-signal-500); }
.brand-row .info-btn {
  margin-left: auto; background: transparent; cursor: pointer;
  border: 1px solid var(--panel-border-strong); border-radius: 50%;
  width: 17px; height: 17px; padding: 0; flex: 0 0 auto;
  font-family: var(--rx-ff-sans); font-size: 9px; font-style: italic; line-height: 1;
  color: var(--fg-3);
  transition: color var(--rx-dur-fast) var(--rx-ease), border-color var(--rx-dur-fast) var(--rx-ease);
}
.brand-row .info-btn:hover { color: var(--fg); border-color: var(--fg-3); }
.brand-panel .path {
  padding: 6px 14px 0; font-size: 10px; letter-spacing: 0.1em; color: var(--fg-3);
}

/* The page's own restatement of the marker. It is NOT the marker of record —
   that one lives in the pixels of every frame (see paint() in cuenca.js). */
.sim-strip {
  margin: 10px 14px 0; padding: 7px 10px;
  border: 1px solid var(--sim-flag); border-radius: 2px;
  background: color-mix(in srgb, var(--sim-flag) 12%, transparent);
  color: var(--sim-flag);
  font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px; line-height: 1.4;
}
/* Measured is the normal state, so the strip stops shouting in amber and
   states the provenance in teal instead. It never disappears: the reader still
   has to be told what they are looking at. */
.sim-strip.measured {
  border-color: var(--meas-flag);
  background: color-mix(in srgb, var(--meas-flag) 12%, transparent);
  color: var(--meas-flag);
}
.sim-strip.measured .sim-dot { background: var(--meas-flag); }
.sim-strip .sim-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--sim-flag);
  flex: 0 0 7px; animation: pulse 2.4s var(--rx-ease) infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.3 } }

/* ---------- top-centre: view toggles ---------- */
.panel.screen-nav-panel {
  left: 50%; top: 16px; transform: translateX(-50%);
  display: flex; align-items: stretch; padding: 0; z-index: 5;
}
.panel.screen-nav-panel button {
  background: transparent; border: 0;
  font-family: var(--rx-ff-sans); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-2);
  padding: 13px 11px 11px; border-bottom: 2px solid transparent;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  cursor: pointer;
  transition: color var(--rx-dur-fast) var(--rx-ease), border-color var(--rx-dur-fast) var(--rx-ease);
}
.panel.screen-nav-panel button:hover { color: var(--fg); }
.panel.screen-nav-panel button.active { color: var(--fg); border-bottom-color: var(--rx-signal-500); }
html.theme-light .panel.screen-nav-panel button.active { border-bottom-color: var(--rx-deep-500); }

/* ---------- top-right: provenance ---------- */
.panel.source-panel { right: 16px; top: 16px; width: 284px; }
.src-body { padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.src-row { display: flex; align-items: baseline; gap: 10px; font-size: 10px; }
.src-row .k {
  color: var(--fg-3); letter-spacing: 0.14em; text-transform: uppercase;
  flex: 0 0 78px;
}
.src-row .v {
  color: var(--fg-1); font-family: var(--rx-ff-mono); font-size: 10px;
  text-align: right; margin-left: auto; word-break: break-word;
}
.src-note {
  margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--panel-border);
  font-size: 9px; color: var(--fg-3); line-height: 1.6; letter-spacing: 0.03em;
}

/* One row per layer, each carrying its own basis. The colour is the whole
   message: teal = an observation, amber = generated here. */
.layers { display: flex; flex-direction: column; gap: 6px; }
.layer-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.basis-chip {
  font-size: 8px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 2px; font-weight: 600; white-space: nowrap;
}
.basis-chip.measured { background: var(--meas-flag); color: #04140E; }
.basis-chip.simulated { background: var(--sim-flag); color: #141008; }
.layer-name { font-size: 10px; color: var(--fg-1); }
.layer-src { font-size: 9px; color: var(--fg-3); flex: 1 1 100%; font-family: var(--rx-ff-mono); }

/* ---------- right: export ---------- */
.panel.export-panel {
  right: 16px; top: 200px; width: 284px;
  display: flex; flex-direction: column; overflow: hidden;
  max-height: calc(100vh - 300px);
}
.exp-body { padding: 12px 0 12px; overflow: auto; }
.panel.export-panel.collapsed .exp-body { display: none; }

/* The one immovable control in this panel: a statement, not a switch. */
.exp-lock {
  margin: 0 14px 12px; padding: 9px 11px;
  border: 1px solid var(--sim-flag); border-radius: 2px;
  background: color-mix(in srgb, var(--sim-flag) 10%, transparent);
  color: var(--fg-1);
  font-size: 9px; line-height: 1.6; letter-spacing: 0.02em;
  display: flex; gap: 9px; align-items: flex-start;
}
.exp-lock .lock-icon { color: var(--sim-flag); font-size: 12px; line-height: 1.3; flex: 0 0 auto; }

.exp-actions { display: flex; gap: 8px; padding: 4px 14px 0; }
.exp-actions .btn { flex: 1; justify-content: center; padding: 8px 6px; }

.exp-progress { padding: 12px 14px 0; }
.exp-progress .bar {
  height: 4px; border-radius: 2px; background: var(--bg-sunk);
  border: 1px solid var(--panel-border); overflow: hidden;
}
.exp-progress .fill {
  height: 100%; width: 0%; background: var(--rx-signal-500);
  transition: width var(--rx-dur-fast) linear;
}
html.theme-light .exp-progress .fill { background: var(--rx-deep-500); }
.exp-status {
  margin-top: 7px; font-size: 9px; color: var(--fg-3);
  letter-spacing: 0.08em; text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.exp-result {
  margin: 12px 14px 0; padding: 9px 11px;
  border: 1px solid var(--panel-border-strong); border-radius: 2px;
  font-size: 9px; color: var(--fg-2); line-height: 1.7;
}
.exp-result a { color: var(--accent); text-decoration: none; }
.exp-result a:hover { text-decoration: underline; }
.exp-result .fname { font-family: var(--rx-ff-mono); color: var(--fg-1); word-break: break-all; }

/* ---------- bottom-centre: transport ---------- */
.panel.transport {
  left: 16px; right: 316px; bottom: 16px;
  padding: 10px 14px;
}
.tr-row { display: flex; align-items: center; gap: 12px; }
.tr-btn {
  background: transparent; border: 1px solid var(--panel-border-strong);
  border-radius: 2px; color: var(--fg-1);
  font-family: var(--rx-ff-sans); font-size: 10px; letter-spacing: 0.06em;
  padding: 7px 10px; cursor: pointer; min-width: 40px;
  transition: all var(--rx-dur-fast) var(--rx-ease);
}
.tr-btn:hover { color: var(--fg); border-color: var(--line-strong); }
.tr-btn.play {
  background: var(--rx-signal-500); border-color: var(--rx-signal-500);
  color: var(--on-status); min-width: 46px;
}
html.theme-light .tr-btn.play { background: var(--rx-deep-500); border-color: var(--rx-deep-500); color: var(--rx-paper); }

#tr-scrub {
  flex: 1; min-width: 60px; height: 4px; -webkit-appearance: none; appearance: none;
  background: var(--bg-sunk); border-radius: 2px; outline: 0; cursor: pointer;
  border: 1px solid var(--panel-border);
}
#tr-scrub::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--rx-signal-500); border: 2px solid var(--panel-bg-solid);
  cursor: pointer;
}
#tr-scrub::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--panel-bg-solid);
  background: var(--rx-signal-500); cursor: pointer;
}
html.theme-light #tr-scrub::-webkit-slider-thumb { background: var(--rx-deep-500); }
html.theme-light #tr-scrub::-moz-range-thumb { background: var(--rx-deep-500); }

.tr-read { display: flex; flex-direction: column; gap: 2px; min-width: 168px; text-align: right; }
.tr-read .tr-count {
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
.tr-read .tr-date {
  font-family: var(--rx-ff-mono); font-size: 11px; color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.tr-speed { flex: 0 0 74px; }

/* A single observation is a still. The controls go inert rather than looping
   one frame, which would read as motion that was never measured. */
.panel.transport.single .tr-btn,
.panel.transport.single #tr-scrub,
.panel.transport.single .tr-speed { opacity: 0.35; pointer-events: none; }

/* ---------- toast ---------- */
.toast {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 96px;
  padding: 9px 14px; font-size: 11px; letter-spacing: 0.06em;
  display: none; z-index: 9;
}
.toast.show { display: block; }
.toast.err { border-color: var(--rx-guard-500); color: var(--rx-guard-500); }

/* ---------- credits · licences ---------- */
.panel.credits-panel {
  left: 16px; bottom: 84px; width: 380px; max-width: calc(100vw - 32px);
  display: none; flex-direction: column; overflow: hidden; z-index: 6;
  max-height: calc(100vh - 180px);
}
.panel.credits-panel.open { display: flex; }
.credits-body { padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 8px; overflow: auto; }
.credits-body .credit-owner {
  font-size: 10px; color: var(--fg-2); line-height: 1.5;
  padding-bottom: 8px; border-bottom: 1px solid var(--panel-border);
}
.credits-body .credit-item { font-size: 9px; color: var(--fg-3); letter-spacing: 0.04em; line-height: 1.7; }
.credits-body .credit-item strong { color: var(--fg-2); font-weight: 500; }
.credits-body a { color: var(--fg-2); }

/* ---------- scrollbars ---------- */
.exp-body::-webkit-scrollbar, .credits-body::-webkit-scrollbar { width: 8px; }
.exp-body::-webkit-scrollbar-track, .credits-body::-webkit-scrollbar-track { background: transparent; }
.exp-body::-webkit-scrollbar-thumb, .credits-body::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: 2px;
}

/* ---------- narrow screens ---------------------------------------------- */
@media (max-width: 1360px) {
  .panel.source-panel { width: 250px; }
  .panel.export-panel { width: 250px; }
  .canvas-wrap { right: 282px; }
  .panel.transport { right: 282px; }
}

@media (max-width: 1100px) {
  /* Three columns of chrome do not fit. The provenance panel goes first:
     everything it says is already burned into the picture, so losing it
     costs nothing a viewer needs. */
  .panel.source-panel { display: none; }
  .panel.export-panel { top: 16px; max-height: calc(100vh - 130px); }
}

@media (max-width: 900px) {
  .panel.screen-nav-panel { display: none; }
}

@media (max-width: 820px) {
  .panel.brand-panel { width: calc(100vw - 24px); left: 12px; top: 12px; }
  /* Export becomes a sheet above the transport bar. It overlays the picture
     when open, which is fine — it is an action, not a view — and it starts
     collapsed so the picture is what you land on. */
  /* top / bottom / max-height are set by layout() in cuenca.js, which
     measures the panels — the picture must not end up under one. */
  .panel.export-panel { left: 12px; right: 12px; width: auto; }
  .canvas-wrap { left: 12px; right: 12px; }
  .panel.transport { left: 12px; right: 12px; bottom: 12px; padding: 8px 10px; }
  .tr-read { min-width: 0; flex: 1 1 auto; }
  .tr-read .tr-date { font-size: 10px; }
  .tr-btn { min-width: 34px; padding: 7px 7px; }
  .tr-speed { flex: 0 0 62px; }
  #tr-scrub { display: none; }
  .panel.credits-panel { left: 12px; right: 12px; width: auto; bottom: 74px; }
  .toast { bottom: 140px; }
}

@media (max-width: 480px) {
  .canvas-wrap { top: 138px; bottom: 122px; }
  .brand-panel .path { display: none; }
  .exp-actions { flex-direction: column; }
}

/* THE WAY BACK. vbk.html links out to this console and this console linked
   nowhere — every sub-page was a dead end, so a reader who followed a link
   from the record had to use the browser's back button or retype the URL.
   The brand lockup is the way home, which is where a reader already looks. */
.brand-row .home-link {
  color: inherit;
  text-decoration: none;
  border-radius: 2px;
  outline-offset: 2px;
}
.brand-row .home-link:hover,
.brand-row .home-link:focus-visible { text-decoration: underline; }
