/* Island Lab: shared day/night tokens and the toggle.
 *
 * Each page keeps its own night palette in its inline <style> :root (the site's
 * deep tidal green). This file adds the shared tokens both palettes need, the
 * day palette (the San Juan water-blue), and the toggle button. Linked after
 * each page's inline styles so these win where they overlap.
 */

/* Shared tokens, night defaults. Pages already set --bg/--text/--accent etc. */
:root {
  --card-bg: rgba(30, 40, 32, 0.18);
  --card-bg-hover: rgba(30, 40, 32, 0.28);
  --ring: rgba(74, 124, 104, 0.12);
  --accent-soft: rgba(74, 124, 104, 0.40);
  --accent-line: rgba(74, 124, 104, 0.30);
  --accent-hover: #6fae93;
  --menu-shadow: rgba(0, 0, 0, 0.38);
}

/* Day: the San Juan water-blue palette. */
:root[data-theme="day"] {
  --bg: #cfe1ea;
  --surface: #eef4f3;
  --text: #17323b;
  --muted: #4f6b75;
  --accent: #2f6f7a;
  --faint: rgba(47, 111, 122, 0.13);
  --line: #2f6f7a;
  --card-bg: rgba(255, 255, 255, 0.32);
  --card-bg-hover: rgba(255, 255, 255, 0.55);
  --ring: rgba(47, 111, 122, 0.15);
  --accent-soft: rgba(47, 111, 122, 0.26);
  --accent-line: rgba(47, 111, 122, 0.24);
  --accent-hover: #3a8794;
  --menu-shadow: rgba(47, 111, 122, 0.14);
}

/* Day gets the layered water-to-land wash from the voyage page. */
:root[data-theme="day"] body {
  background: linear-gradient(180deg, #cfe1ea 0%, #dbe8e6 52%, #e9efe2 100%);
  background-attachment: fixed;
}

/* Smooth crossfade when the theme changes. Zero specificity so any element
 * with its own transition keeps it; first paint never animates. */
:where(body, body *) {
  transition: background-color 0.45s ease, border-color 0.45s ease, color 0.45s ease;
}

/* The sun/moon toggle, sat in the nav. */
.theme-toggle {
  flex: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--faint);
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: color 0.3s, border-color 0.3s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { display: block; }

/* ---- Dropdown nav (single Menu) ---- */
.nav-right { display: flex; align-items: center; gap: 0.85rem; position: relative; }

.nav-menu-btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: 1px solid var(--faint);
  border-radius: 2px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  -webkit-appearance: none; appearance: none;
  transition: color 0.3s, border-color 0.3s;
}
.nav-menu-btn:hover,
.nav-menu-btn[aria-expanded="true"] { color: var(--text); border-color: var(--accent); }
.nav-menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-burger { display: block; }

.nav-menu {
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 0;
  min-width: 230px;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--faint);
  border-radius: 5px;
  padding: 0.5rem;
  box-shadow: 0 18px 44px var(--menu-shadow);
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
}
.nav-menu.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.nav-menu a {
  font-family: 'DM Mono', monospace;
  font-size: 0.66rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  padding: 0.72rem 0.85rem; border-radius: 3px;
  transition: color 0.2s, background 0.2s;
}
.nav-menu a:hover,
.nav-menu a:focus-visible { color: var(--text); background: var(--card-bg); outline: none; }
.nav-menu a.here { color: var(--text); }
.nav-menu a.here::before { content: '· '; color: var(--accent); }

/* Desktop shows "Menu" with the icon; mobile shows the icon alone. */
@media (max-width: 600px) {
  .nav-menu-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .nav-menu-btn { padding: 0.5rem 0.65rem; }
  .nav-menu { right: 0; left: auto; min-width: 200px; }
}
