/* 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; }

/* Wordmark logo in the nav (home + subpages). */
.nav-logo { height: 2.4rem; width: auto; 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; }
}

/* Horizontal menu on wide screens (Sean, 2026-09-30): the links sit in a row beside the theme toggle; the dropdown stays for phones. */
@media (min-width: 821px) {
  .nav-menu-btn { display: none; }
  .nav-menu {
    position: static; display: flex; flex-direction: row; align-items: center; gap: .15rem;
    opacity: 1; transform: none; pointer-events: auto; visibility: visible;
    background: transparent; border: 0; box-shadow: none; padding: 0; margin: 0; min-width: 0; width: auto;
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .nav-menu > a, .nav-group-link { display: inline-flex; align-items: center; line-height: 1; padding: .45rem .7rem; border-radius: 6px; white-space: nowrap; }
  .nav-menu > a:hover, .nav-group:hover .nav-group-link { background: color-mix(in srgb, var(--card-bg) 50%, transparent); }
  .nav-right { display: flex; align-items: center; gap: .6rem; }
}

/* The menu's shape (Sean, 2026-09-30): Who we are, Our work (Problems, Solutions, Gatherings, Log, Thought pieces), Contact. */
.nav-group { position: relative; }
.nav-sub { display: flex; flex-direction: column; padding-left: .85rem; }
@media (min-width: 821px) {
  .nav-group { display: flex; align-items: center; }
  .nav-sub {
    display: none; position: absolute; top: 100%; right: 0; min-width: 200px;
    /* the gap under the link is part of the menu, so the pointer never leaves it on the way down */
    padding: .5rem; border: 1px solid var(--faint); border-top: .45rem solid transparent; border-radius: 5px;
    background: color-mix(in srgb, var(--surface) 50%, transparent); background-clip: padding-box; backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1);
    box-shadow: 0 18px 44px var(--menu-shadow); z-index: 200;
  }
  .nav-group::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: .5rem; }
  .nav-group:hover .nav-sub, .nav-group:focus-within .nav-sub { display: flex; }
  .nav-group-link::after { content: "\25BE"; display: inline-flex; align-items: center; line-height: 1; font-size: .8em; margin-left: .3em; }
}
