/* ============================================================
   GS Basecamp — "Basecamp" theme
   Adventure-touring mood: anthracite, alpine blue, signal orange.
   Display serif Fraunces + body Nunito.
   Fully self-contained (local fonts, no CDN calls).
   Default: dark mode.
   Token NAMES (--sea/--coral/--gold) are kept from the shared family so the
   AA-tuned on-colour pairings carry over; only the hues shift to the GS palette.
   ============================================================ */

@font-face { font-family: "Fraunces"; font-weight: 600; font-display: swap;
  src: url("/static/fonts/fraunces-600.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-weight: 700; font-display: swap;
  src: url("/static/fonts/fraunces-700.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-weight: 900; font-display: swap;
  src: url("/static/fonts/fraunces-900.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400; font-display: swap;
  src: url("/static/fonts/nunito-400.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 600; font-display: swap;
  src: url("/static/fonts/nunito-600.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap;
  src: url("/static/fonts/nunito-700.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap;
  src: url("/static/fonts/nunito-800.woff2") format("woff2"); }

/* ── Dark tokens (default) ────────────────────────────────────────────────── */
:root {
  color-scheme: dark;

  /* Backgrounds — anthracite */
  --paper:    #12171d;   /* deep anthracite */
  --paper-2:  #1a2129;   /* raised surface */
  --paper-3:  #232c36;   /* card level */
  --card:     #1d252e;   /* elevated surface */
  --topbar-bg: linear-gradient(180deg, rgba(18,23,29,.96), rgba(18,23,29,.88));

  /* Text */
  --ink:       #e9eef2;  /* near-white, slight cool tint */
  --ink-soft:  #a6b3c0;
  --ink-faint: #8b99a9;  /* AA (4.6+) on --card/--paper for small text */
  --ink-label: #8ea0b0;

  /* Primary accent — alpine blue */
  --sea:       #3fa2d4;
  --sea-deep:  #277396;  /* filled-button bg: white text clears AA (5.0) in dark */
  --sea-soft:  #0e2230;
  --sea-on-soft: #93cff0;  /* AA-readable accent text on the dark --sea-soft tint */
  /* On-colour for a filled --sea button. In the dark default, --sea is bright, so
     a dark label clears AA; the light theme (darker --sea) flips it to white
     (see [data-theme="light"]). */
  --on-sea: #06151f;
  /* Floated float-field label: --sea is surface-legible in BOTH themes. */
  --float-label-accent: var(--sea);

  /* Action accent — signal orange */
  --coral:     #f5843a;
  --coral-deep:#d1631d;
  --coral-soft:#3a2211;
  --coral-on-soft: #f5843a;  /* orange TEXT legible on its bg in BOTH themes: bright here (dark), deep in light */

  /* Warning / due-soon — amber bioluminescence */
  --gold:      #f5c842;
  --gold-soft: #2e2600;
  --gold-on-soft: #f5c842;  /* amber TEXT legible on --gold-soft in both themes: bright here (dark, 9.49), deep in light (brand --gold #c89000 is only 2.5:1 as text) */

  /* Separator */
  --line: #26313d;

  /* Extended tokens */
  --mint:       #2f6f56;  /* badge secondary */
  --sand-deep:  rgba(245, 200, 66, .15);
  --sand-dark:  #f5c842;

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Nunito", ui-rounded, "Segoe UI", system-ui, sans-serif;

  --r-lg: 20px;
  --r-md: 13px;
  --r-sm: 8px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow:    0 6px 20px -6px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-lg: 0 18px 40px -12px rgba(0, 0, 0, .7);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  /* Role-token aliases consumed by the foundation-ui shell (top app bar, drawer,
     bottom nav, settings chrome). Map the shell's generic accents to scuba's
     palette so its chrome is teal/coral, not the shell's sea/coral fallbacks.
     These reference --sea/--coral/--topbar-bg, which are redefined under
     [data-theme="light"], so they re-resolve automatically per theme. */
  --acc: var(--sea);  --acc-deep: var(--sea-deep);  --acc-soft: var(--sea-soft);
  --a2: var(--coral);  --a2-soft: var(--coral-soft);
  --tb: var(--topbar-bg);
}

/* ── Light override ───────────────────────────────────────────────────────── */
:root[data-theme="light"] {
  color-scheme: light;
  --paper:    #eef3f7;
  --paper-2:  #dde7ef;
  --paper-3:  #cbdae7;
  --card:     #ffffff;
  --topbar-bg: linear-gradient(180deg, rgba(238,243,247,.96), rgba(221,231,239,.88));
  --ink:       #101a24;
  --ink-soft:  #3a5666;
  --ink-faint: #4a6675;  /* darkened for WCAG AA on white */
  --ink-label: #47606f;
  --sea:       #1a79a8;
  --sea-deep:  #0d5a7a;
  --sea-soft:  #c9e6f4;
  /* Light --sea is darker, so a filled --sea button takes white. */
  --on-sea: #fff;
  --sea-on-soft: #0d5a7a;  /* AA-readable accent text on the light --sea-soft tint */
  --coral:     #dd5a1c;
  --coral-deep:#b23d08;
  --coral-on-soft: #b23d08;  /* deep orange — AA as text on the light coral-soft & white */
  --coral-soft:#fde2d0;
  --gold:      #c89000;
  --gold-soft: #fef3c0;
  --gold-on-soft: #806400;  /* deep amber — AA as text on the light --gold-soft #fef3c0 (5.02) and white (5.61) */
  --line:      #b6d4e4;
  --shadow-sm: 0 1px 2px rgba(0, 50, 80, .08);
  --shadow:    0 6px 18px -8px rgba(0, 50, 80, .2), 0 2px 5px rgba(0, 50, 80, .06);
  --shadow-lg: 0 18px 38px -14px rgba(0, 50, 80, .28);
}

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
  /* Subtle depth background */
  background-image:
    radial-gradient(ellipse at 30% 0%, rgba(63,162,212,.12) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(44,128,176,.08) 0%, transparent 50%);
  background-attachment: fixed;
}

/* Depth-grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

a { color: var(--sea); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; margin: 0; }
p { margin: 0; }

/* ── Skip link ────────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute; left: -9999px; top: auto;
  &:focus { position: static; }
}

/* Topbar, brand and top nav are owned by the foundation-ui shell (shell.css).
   gs-app's legacy `.topbar { z-index: 100 }` used to override the shell and sit
   ABOVE the drawer — so the drawer opened *behind* the top app bar. Removed:
   the shell's own z-index layering (drawer/scrim above topbar) now applies. */

/* ── Main container ───────────────────────────────────────────────────────── */
.main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
  position: relative;
  z-index: 1;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-4);  /* stacked cards were touching (e.g. settings) */
}
/* Inside a card grid, the grid `gap` handles spacing — don't double it. */
.card-grid .card { margin-bottom: 0; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

/* ── Dive-sites map (Leaflet) ─────────────────────────────────────────────── */
.sites-map-wrap { position: relative; margin-bottom: var(--space-5); }
.sites-map {
  height: 320px; width: 100%; border-radius: var(--r-md);
  border: 1px solid var(--line);
  overflow: hidden;  /* clip Leaflet tiles within the map box */
  z-index: 0;        /* stay below the sticky topbar (z 20) + bottom nav (z 30) */
}
/* Skeleton overlay covering the map until tiles first paint (sites-map.js adds
   .is-hidden), bridging the worldwide-catalogue load. */
.sites-map-skeleton {
  position: absolute; inset: 0; z-index: 1; border-radius: var(--r-md);
  transition: opacity var(--dur-long) var(--ease-emphasized);
}
.sites-map-skeleton.is-hidden { opacity: 0; pointer-events: none; }
/* Imported OSM sites can have very long unbreakable names/notes (no spaces);
   wrap them so a card can't push the page wider than the viewport. */
/* Long unbreakable user/OSM text (cert numbers, site names, gear models) must
   wrap, not blow the card out. overflow-wrap inherits to all card text. */
.card { min-width: 0; overflow-wrap: anywhere; }
/* flex rows inside cards must let their children shrink so long text wraps
   instead of forcing horizontal overflow. */
.card .form-row, .card .btn-row, .card > div { min-width: 0; }

/* Dive-site search + result cards */
.site-search { margin-bottom: var(--space-4); }
a.site-card { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform var(--dur-medium) var(--spring-bouncy); }
a.site-card:hover { border-color: var(--sea); }
a.site-card:active { transform: scale(.96); transition: transform 90ms var(--ease-emphasized-accel); }
.site-card h3 { font-size: 1.02rem; font-weight: 700; margin: 0 0 .35rem; }
.site-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .85rem; color: var(--ink-soft); }
.leaflet-container { background: var(--paper-2); font-family: var(--body); }
.leaflet-popup-content a { color: var(--sea); font-weight: 700; }

/* ── Stat tiles (dashboard) ───────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.stat-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--space-4);
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-tile .stat-val {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--sea);
  line-height: 1;
}
.stat-tile .stat-label {
  font-size: .75rem;
  color: var(--ink-faint);
  margin-top: var(--space-1);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ── Alert / due-now banner ───────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-md);
  font-size: .9rem;
  margin-bottom: var(--space-4);
}
.alert-warn {
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  color: var(--gold-on-soft);
}
.alert-danger {
  background: var(--coral-soft);
  border: 1px solid var(--coral);
  color: var(--coral-on-soft);
}

/* ── Dive list item ───────────────────────────────────────────────────────── */
.dive-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.dive-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.dive-item:hover { border-color: var(--sea); box-shadow: var(--shadow); text-decoration: none; }
.dive-num {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--sea);
  min-width: 3rem;
  text-align: right;
  flex-shrink: 0;
}
.dive-meta { flex: 1; min-width: 0; }
.dive-meta strong { display: block; font-weight: 700; font-size: 1rem; }
.dive-meta span { font-size: .85rem; color: var(--ink-soft); }
.dive-depth { font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: var(--sea); margin-left: auto; }

/* Stars */
.stars { color: var(--gold); font-size: .85rem; letter-spacing: 1px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-section { margin-bottom: var(--space-5); }
.form-section-title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-faint);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--line);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-4); }
@media (max-width: 600px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
.form-group { display: flex; flex-direction: column; gap: var(--space-1); }
.form-label { font-size: .85rem; font-weight: 700; color: var(--ink-soft); }
.form-input, .form-select, .form-textarea {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  padding: var(--space-2) var(--space-3);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
  min-height: 44px;  /* WCAG/M3 tap target */
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--sea);
  box-shadow: 0 0 0 3px rgba(63,162,212,.2);
}
.form-input::placeholder { color: var(--ink-faint); }
.form-hint { font-size: .78rem; color: var(--ink-faint); }
.form-textarea { min-height: 80px; resize: vertical; }
select.form-select option { background: var(--paper-2); color: var(--ink); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--r-pill);
  font-family: var(--body);
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background .15s, box-shadow .15s, transform var(--dur-medium) var(--spring-bouncy);
  text-decoration: none;
  min-height: 44px;  /* WCAG/M3 tap target */
}
/* inline add-form disclosures (gear/certs/sites/log-service) */
.add-toggle {
  display: inline-flex; align-items: center; min-height: 44px; min-width: 44px;
  padding: 0 6px; cursor: pointer; font-weight: 700; color: var(--sea-on-soft);
}
.add-toggle::-webkit-details-marker { display: none; }
/* <summary> isn't an <a>, so the generic a:focus-visible ring didn't apply and the
   browser default was < 3:1. Give it the same visible focus ring as buttons. */
.add-toggle:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; border-radius: var(--r-sm); }
.btn:active { transform: scale(.92); transition: transform 90ms var(--ease-emphasized-accel); }
.btn:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; }

.btn-primary { background: var(--sea-deep); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--sea-deep); text-decoration: none; color: #fff; }

.btn-secondary {
  background: var(--paper-3);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.btn-secondary:hover { background: var(--sea-soft); color: var(--sea-on-soft); text-decoration: none; }

.btn-danger { background: var(--coral-soft); color: var(--coral-on-soft); border: 1px solid var(--coral); }
.btn-danger:hover { background: var(--coral); color: #fff; text-decoration: none; }

.btn-sm { padding: var(--space-1) var(--space-3); font-size: .8rem; }
/* icon-only buttons must stay square — a pill min-height + tiny width made the
   single-glyph delete button a vertical oval. */
.btn-icon { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; flex: none; }

.btn-row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--r-pill);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.badge-sea { background: var(--sea-soft); color: var(--sea-on-soft); }
.badge-coral { background: var(--coral-soft); color: var(--coral-on-soft); }
.badge-gold { background: var(--gold-soft); color: var(--gold-on-soft); }
.badge-faint { background: var(--paper-3); color: var(--ink-soft); }  /* --ink-soft clears AA on --paper-3 in both themes (--ink-faint was 4.27 in light) */

/* ── Page heading ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.page-title { font-size: 1.6rem; font-weight: 900; }

/* ── Detail page ──────────────────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
  margin: var(--space-4) 0;
}
.detail-cell { }
.detail-cell .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin-bottom: 2px; }
.detail-cell .value { font-weight: 700; font-size: 1rem; }
.detail-cell .value.big { font-family: var(--display); font-size: 1.4rem; color: var(--sea); }

/* ── Image grid (photos, cert cards) ─────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-3);
  margin: var(--space-4) 0;
}
.photo-item {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--paper-2);
  aspect-ratio: 1;
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-item:hover .photo-overlay { opacity: 1; }
.photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
}

/* ── Gear category icon pill ──────────────────────────────────────────────── */
.gear-cat {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--r-pill);
  background: var(--sea-soft);
  color: var(--sea-on-soft);
  font-size: .8rem;
  font-weight: 700;
}

/* ── Service due indicator ────────────────────────────────────────────────── */
.due-now { color: var(--coral-on-soft); }
.due-soon { color: var(--gold-on-soft); }

/* ── Cert card ────────────────────────────────────────────────────────────── */
.cert-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.cert-images {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.cert-img {
  flex: 1 1 180px;
  max-width: 260px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.cert-img img { width: 100%; display: block; }

/* ── SAC chip ─────────────────────────────────────────────────────────────── */
.sac-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--sea-soft);
  border: 1px solid var(--sea);
  border-radius: var(--r-md);
  padding: var(--space-2) var(--space-4);
  margin: var(--space-4) 0;
}
.sac-chip .sac-val { font-family: var(--display); font-size: 1.4rem; font-weight: 900; color: var(--sea-on-soft); }
.sac-chip .sac-label { font-size: .75rem; color: var(--ink-soft); }

/* ── Table ────────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th {
  text-align: left;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-faint);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--line);
}
.data-table td { padding: var(--space-3); border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--paper-2); }

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-page {
  min-height: calc(100dvh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5) var(--space-4);
}
.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--space-6);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-heading { font-size: 1.6rem; text-align: center; margin-bottom: var(--space-5); }
.login-tabs {
  display: flex;
  gap: 2px;
  background: var(--paper-2);
  border-radius: var(--r-pill);
  padding: 3px;
  margin-bottom: var(--space-4);
}
.login-tab {
  flex: 1;
  padding: var(--space-2);
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--body);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.login-tab.active { background: var(--sea); color: var(--on-sea); }
.login-form { display: flex; flex-direction: column; gap: var(--space-4); }
.login-error { color: var(--coral-on-soft); font-size: .85rem; text-align: center; }
.login-success { color: var(--sea); font-size: .85rem; text-align: center; }
.forgot-link { font-size: .8rem; color: var(--ink-faint); align-self: flex-end; }
.login-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--ink-faint);
  font-size: .85rem;
  margin: var(--space-4) 0;
}
.login-divider::before, .login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  font-family: var(--body);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.google-btn:hover { background: var(--paper-3); border-color: var(--sea); text-decoration: none; color: var(--ink); }
.primary-btn {
  width: 100%;
  padding: var(--space-3);
  border-radius: var(--r-pill);
  border: none;
  background: var(--sea);
  color: var(--on-sea);
  font-family: var(--body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.primary-btn:hover { background: var(--sea-deep); color: #fff; }
.primary-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--ink-soft);
}
.empty-state .empty-icon { font-size: 3rem; display: block; margin-bottom: var(--space-3); }
.empty-state h3 { font-size: 1.1rem; margin-bottom: var(--space-2); }
.empty-state p { font-size: .9rem; color: var(--ink-faint); }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--sea);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-lg);
  font-weight: 700;
  font-size: .9rem;
  z-index: 1000;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .topbar-nav .nav-link { font-size: .78rem; padding: var(--space-1) var(--space-2); }
  .page-title { font-size: 1.3rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Springy press on interactive controls (Material 3 motion) ─────────────── *
 * Appended last so the transform-spring wins the cascade. Covers the controls
 * the shared shell press doesn't already reach; the motion-coverage gate
 * enforces it. The reduced-motion block below collapses it to instant.        */
.dive-item, .add-toggle, .ghost-btn, .icon-btn, .site-card {
  transition: background .15s ease, border-color .15s ease, color .15s ease,
    box-shadow .15s ease, transform var(--dur-medium) var(--spring-bouncy);
}
.dive-item:active, .add-toggle:active, .ghost-btn:active, .icon-btn:active, .site-card:active {
  transform: scale(.97); transition: transform 90ms var(--ease-emphasized-accel);
}

/* ── Accessibility ────────────────────────────────────────────────────────── */
/* Rating stars: the bright gold reads fine on the dark default, but fails AA on
   the light theme's white — use a deeper gold there (still gold, just AA). */
:root[data-theme="light"] .stars { color: #946200; }

/* Active bottom-nav tab label: --acc-deep (--sea-deep) is too dark on the dark
   nav (3.57:1) and plain --sea is just under AA on the light nav (4.14:1). Use
   --sea-on-soft, the surface-legible accent that flips per theme (bright #7fd0e0
   in dark, deep #0d5a6e in light) — AA on the nav in BOTH. UNSCOPED so the default
   dark (:root, no data-theme attribute) is covered, not just the explicit toggle. */
.tab[aria-current="page"] { color: var(--sea-on-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- Discernible form fields (WCAG 1.4.11, gentle treatment) ------------- *
 * Whisper of fill tint + a hair more border than the hairline default, theme-
 * aware via color-mix. (Below full AA by product decision.)                  */
input[type=text], input[type=search], input[type=number], input[type=email],
input[type=password], input[type=tel], input[type=date], input:not([type]),
textarea, select, .form-input, .form-select, .form-textarea {
  /* Border-only discernibility (WCAG 1.4.11): fill is transparent everywhere so
     fields read against any surface with no shading seam (this makes the
     floating-label notch seamless). The border carries the boundary on its own,
     kept a touch stronger (ink 38%). */
  border-color: color-mix(in srgb, var(--ink) 38%, var(--line));
  background: transparent;
}

/* ---- Container transform: dashboard dive row <-> detail hero ------------- *
 * The clicked .dive-item and the detail .dive-hero share view-transition-name
 * "dive-hero", so on Chromium the row morphs into the hero (and back). The
 * cross-fade still applies elsewhere; collapsed under the motion preference.   */
.dive-hero { view-transition-name: dive-hero; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1rem 1.1rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.dive-hero-top { display: flex; align-items: center; gap: .7rem; margin-bottom: .4rem; }
.dive-hero-top strong { font-family: var(--display); font-size: 1.3rem; flex: 1; min-width: 0; line-height: 1.2; }
.dive-hero-meta { color: var(--ink-soft); font-size: .9rem; }

/* =================== Tools: calculator results =================== */
.nx-results {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3);
  margin-top: var(--space-2);
}
.nx-stat {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--space-3) var(--space-4); text-align: center;
}
.nx-stat--wide { grid-column: 1 / -1; }
.nx-val { font: 700 1.5rem/1.1 var(--display); color: var(--sea-on-soft); letter-spacing: -.01em; }
.nx-lbl { font-size: .72rem; color: var(--ink-soft); margin-top: .25rem;
  text-transform: uppercase; letter-spacing: .05em; }
.nx-warn {
  margin: var(--space-3) 0 0; padding: var(--space-3); border-radius: var(--r-sm);
  background: var(--coral-soft); color: var(--coral-on-soft);
  border: 1px solid var(--coral); font-size: .85rem; font-weight: 600;
}
.nx-disclaimer { font-size: .76rem; color: var(--ink-faint); text-align: center;
  margin: var(--space-4) auto var(--space-6); max-width: 44ch; line-height: 1.5; }

/* Tools launcher on the dashboard */
.tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.tool-card {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  padding: var(--space-4); border-radius: var(--r-md);
  background: var(--paper-2); border: 1px solid var(--line); color: var(--ink);
  text-decoration: none;
  /* Spring transform transition so the motion gate recognises it (matches the
     .dive-item/.site-card interaction pattern). */
  transition: border-color .15s ease, transform var(--dur-medium) var(--spring-bouncy);
}
.tool-card:hover { border-color: var(--sea); transform: translateY(-2px); text-decoration: none; }
.tool-card:active { transform: scale(.97); transition: transform 90ms var(--ease-emphasized-accel); }
.tool-card:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; }
.tool-card .tool-emoji { font-size: 1.4rem; }
.tool-card .tool-name { font-weight: 700; }
.tool-card .tool-sub { font-size: .76rem; color: var(--ink-soft); }

/* NDL reference table */
.ndl-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.ndl-table th, .ndl-table td { padding: .55rem .5rem; text-align: left; border-bottom: 1px solid var(--line); }
.ndl-table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); font-weight: 800; }
.ndl-table td:last-child, .ndl-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.ndl-table tbody tr:last-child td { border-bottom: 0; }

/* Links inside alerts: the default --sea link colour is just under AA on the
   light alert tints; --sea-on-soft is surface-legible in both themes. */
.alert a { color: var(--sea-on-soft); font-weight: 700; }

/* Dive-flag map markers (divIcon) — strip Leaflet's default box, add depth. */
.dive-flag-marker { background: none; border: 0; }
.dive-flag-marker svg { filter: drop-shadow(0 2px 2.5px rgba(0,0,0,.5)); display: block; }

/* ============================================================
   GS Basecamp — domain components
   ============================================================ */

/* ── Map box (Leaflet, reused for tours/POIs/basecamps) ───────────────────── */
.map-box {
  height: 340px; width: 100%; border-radius: var(--r-md);
  border: 1px solid var(--line); overflow: hidden; z-index: 0;
  background: var(--paper-2); margin-bottom: var(--space-5);
}
.leaflet-container { background: var(--paper-2); font-family: var(--body); }
.leaflet-popup-content a { color: var(--sea-on-soft); font-weight: 700; }
.poi-marker, .basecamp-marker { background: none; border: 0; }
.poi-marker svg, .basecamp-marker svg { filter: drop-shadow(0 2px 2.5px rgba(0,0,0,.5)); display: block; }

/* ── Tour / generic list rows ─────────────────────────────────────────────── */
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.list-item {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); text-decoration: none; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease,
    transform var(--dur-medium) var(--spring-bouncy);
}
.list-item:hover { border-color: var(--sea); box-shadow: var(--shadow); text-decoration: none; }
.list-item:active { transform: scale(.97); transition: transform 90ms var(--ease-emphasized-accel); }
.list-item { min-width: 0; overflow-wrap: anywhere; }
.list-meta { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list-meta strong { display: block; font-weight: 700; font-size: 1rem; }
.list-meta span { font-size: .85rem; color: var(--ink-soft); }
.list-figure { font-family: var(--display); font-weight: 900; font-size: 1.2rem; color: var(--sea); margin-left: auto; flex-shrink: 0; }

/* ── Motorcycle cards (garage) ────────────────────────────────────────────── */
.moto-card {
  display: block; text-decoration: none; color: inherit; overflow: hidden;
  padding: 0;
  transition: border-color .15s ease, transform var(--dur-medium) var(--spring-bouncy);
}
.moto-card:hover { border-color: var(--sea); }
.moto-card:active { transform: scale(.97); transition: transform 90ms var(--ease-emphasized-accel); }
.moto-photo { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: var(--paper-2); }
.moto-body { padding: var(--space-4); }
.moto-body h3 { font-size: 1.05rem; font-weight: 700; margin: 0 0 .3rem; }
.moto-odo { font-family: var(--display); font-weight: 900; color: var(--sea); }

/* ── Difficulty dots (1–5) ────────────────────────────────────────────────── */
.diff-dots { display: inline-flex; gap: 3px; }
.diff-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); display: inline-block; }
.diff-dots i.on { background: var(--coral); }

/* ── Pre-ride checklist ───────────────────────────────────────────────────── */
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.checklist li { margin: 0; }
.check-row {
  display: flex; align-items: center; gap: var(--space-3); min-height: 48px;
  padding: var(--space-2) var(--space-3); border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--card); cursor: pointer;
  transition: border-color .15s ease, background .15s ease,
    transform var(--dur-medium) var(--spring-bouncy);
}
.check-row:active { transform: scale(.98); transition: transform 90ms var(--ease-emphasized-accel); }
.check-row input { width: 22px; height: 22px; accent-color: var(--sea); flex-shrink: 0; }
.check-row.done { border-color: var(--mint); }
.check-row.done .check-label { text-decoration: line-through; color: var(--ink-faint); }
.check-label { font-weight: 600; }

/* ── Payload calculator ───────────────────────────────────────────────────── */
.payload-total {
  display: flex; align-items: baseline; gap: var(--space-2);
  font-family: var(--display); font-weight: 900; font-size: 2rem; color: var(--sea);
}
.payload-total small { font-size: .9rem; color: var(--ink-soft); font-family: var(--body); font-weight: 700; }
.payload-bar { height: 12px; border-radius: var(--r-pill); background: var(--paper-2); overflow: hidden; margin: var(--space-3) 0; }
.payload-bar > span { display: block; height: 100%; background: var(--sea); transition: width .25s var(--ease-emphasized), background .25s ease; }
.payload-bar.over > span { background: var(--coral); }

/* ── Weather chip ─────────────────────────────────────────────────────────── */
.weather-chip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 2px var(--space-2); border-radius: var(--r-pill);
  background: var(--paper-3); color: var(--ink-soft); font-size: .78rem; font-weight: 700;
}

/* ── Milestones ───────────────────────────────────────────────────────────── */
.ms-card { display: flex; gap: var(--space-3); align-items: flex-start; }
.ms-icon {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 50%; background: var(--sea-soft); color: var(--sea-on-soft);
}
.ms-icon svg { width: 22px; height: 22px; }
/* Locked state is signalled by the greyed icon + "Locked" badge — NOT by dimming
   the whole card, which would drop text below AA (the contrast gate catches it). */
.ms-off .ms-icon { background: var(--paper-3); color: var(--ink-faint); }

/* Celebration overlay — a 2D motorcycle riding across on unlock. Gated by the
   global prefers-reduced-motion rule (which zeroes animation), leaving just the
   banner when motion is off. */
.ms-celebrate {
  position: fixed; inset: 0; z-index: 1200; pointer-events: none;
  display: grid; place-items: center; overflow: hidden;
}
.ms-rider {
  position: absolute; left: 0; bottom: 22%; width: 120px; color: var(--sea);
  animation: ms-ride 2.6s var(--ease-standard) forwards, ms-bob .5s ease-in-out infinite;
}
.ms-rider svg { width: 100%; height: auto; filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); }
@keyframes ms-ride { from { transform: translateX(-25vw); } to { transform: translateX(118vw); } }
@keyframes ms-bob  { 0%,100% { margin-bottom: 0; } 50% { margin-bottom: 5px; } }
.ms-banner {
  background: var(--sea-deep); color: #fff; font-family: var(--display);
  font-weight: 900; font-size: 1.3rem; padding: var(--space-3) var(--space-5);
  border-radius: var(--r-pill); box-shadow: var(--shadow-lg);
  animation: ms-pop .35s var(--spring-bouncy, ease) both;
}
@keyframes ms-pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── Login lockup: app-logo entrance (G2 Berge & Passstraße) ────────────────
 * App-owned per the shell contract; mechanical-outdoors character: the
 * ridge rises, the road draws itself across. */
.login-brand .product-logo .pl-peaks { animation: pl-pop 420ms var(--ease-emphasized-decel) both; transform-origin: 50% 100%; }
.login-brand .product-logo .pl-road { --np-len: 12; stroke-dasharray: 12; animation: np-draw 420ms var(--ease-emphasized) 380ms both; }
