/* ============================================================
   Samen Duiken — design tokens
   ============================================================ */

:root {
  /* Color: anchored on the Alfa Dive brand blues, cool-tinted
     neutrals (never warm/cream) so the site reads as one system
     with the club logos. */
  --ink:            oklch(0.19 0.055 260);   /* deep navy — headings, hero/footer bg */
  --ink-soft:       oklch(0.28 0.05  258);   /* navy, slightly lifted */
  --brand:          oklch(0.47 0.17  259);   /* primary blue — buttons, links */
  --brand-strong:   oklch(0.40 0.17  259);   /* hover/active state */
  --accent:         oklch(0.63 0.19  250);   /* bright azure — focus, highlights */
  --accent-soft:    oklch(0.90 0.045 245);   /* pale azure wash */

  --surface:        oklch(0.975 0.008 240);  /* page background, cool near-white */
  --surface-card:   oklch(0.995 0.004 235);  /* card background */
  --surface-sunken: oklch(0.955 0.012 240);  /* wells, inputs */
  --border:         oklch(0.89  0.015 240);
  --border-strong:  oklch(0.80  0.02  245);

  --ink-on-light:   oklch(0.19 0.055 260);
  --muted:          oklch(0.44 0.035 250);
  --muted-on-dark:  oklch(0.78 0.03  245);

  --brand-tint:     oklch(0.93 0.03 250);

  --danger:         oklch(0.52 0.19 25);

  /* Type */
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Radius */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px oklch(0.19 0.055 260 / 0.06), 0 1px 1px oklch(0.19 0.055 260 / 0.04);
  --shadow-md: 0 12px 24px -12px oklch(0.19 0.055 260 / 0.22), 0 4px 8px -4px oklch(0.19 0.055 260 / 0.1);
  --shadow-lg: 0 24px 48px -16px oklch(0.19 0.055 260 / 0.32);

  /* z-index scale */
  --z-sticky: 10;
  --z-modal-backdrop: 40;
  --z-modal: 50;
  --z-toast: 60;

  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================================
   Reset & base
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

/* Author `display` rules on components (flex/inline-flex buttons, flex
   lists, ...) otherwise win the cascade over the UA [hidden] rule and
   the element stays visible. Force it everywhere, once. */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-on-light);
  background: var(--surface);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

button, input {
  font: inherit;
  color: inherit;
}

a {
  color: var(--brand);
  text-decoration-thickness: from-font;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 24px;
}

.text-balance { text-wrap: balance; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Decorative full-page underwater gradient, sits behind everything */
.bg-scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--surface);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 22px;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out-quart), background-color 0.2s var(--ease-out-quart), box-shadow 0.2s var(--ease-out-quart), color 0.2s var(--ease-out-quart);
  white-space: nowrap;
}

.btn .icon { width: 18px; height: 18px; }

.btn--primary {
  background: var(--brand);
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: var(--brand-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn--primary:active { transform: translateY(0); }

.btn--ghost {
  background: transparent;
  color: var(--brand);
  border: 1.5px solid var(--border-strong);
}
.btn--ghost:hover { background: var(--brand-tint); border-color: var(--brand); }

.btn--ghost-on-dark {
  background: transparent;
  color: white;
  border: 1.5px solid oklch(1 0 0 / 0.35);
}
.btn--ghost-on-dark:hover { background: oklch(1 0 0 / 0.1); border-color: oklch(1 0 0 / 0.6); }

.btn--whatsapp {
  background: oklch(0.6 0.16 150);
  color: white;
  text-decoration: none;
}
.btn--whatsapp:hover { background: oklch(0.54 0.16 150); box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.btn--large { padding: 15px 28px; font-size: 1.02rem; }
.btn--small { padding: 9px 16px; font-size: 0.88rem; }
.btn--full { width: 100%; }

.link-danger {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px 4px;
  text-align: center;
  transition: color 0.15s var(--ease-out-quart);
}
.link-danger:hover { color: var(--danger); }
.link-danger[data-armed="true"] {
  color: var(--danger);
  font-weight: 600;
}

.link-quiet {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 4px;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: color 0.15s var(--ease-out-quart), text-decoration-color 0.15s var(--ease-out-quart);
}
.link-quiet:hover { color: var(--brand); text-decoration-color: currentColor; }

.modal__settings {
  margin-top: 4px;
  text-align: center;
}

.modal__settings-panel {
  margin-top: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  text-align: center;
}

.modal__settings-hint {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 2px;
}

.checkbox-field input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); flex-shrink: 0; }

.modal__form-error {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: oklch(0.94 0.02 25);
  color: var(--danger);
  font-size: 0.88rem;
}

.modal__form-success {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--brand-tint);
  color: var(--brand-strong);
  font-size: 0.88rem;
}

.modal__switch {
  margin: 4px 0 0;
  text-align: center;
  font-size: 0.85rem;
}

/* ============================================================
   Header
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: oklch(0.19 0.055 260 / 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 14px;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-area__greeting {
  color: white;
  font-size: 0.85rem;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .site-header__inner > a.btn { display: none; }
  .account-area__greeting { display: none; }
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: white;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.wordmark__bubble {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px oklch(0.63 0.19 250 / 0.22);
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
  position: relative;
  background: linear-gradient(165deg, oklch(0.16 0.05 262) 0%, var(--ink) 55%, oklch(0.24 0.07 258) 100%);
  padding-top: clamp(64px, 10vw, 108px);
  padding-bottom: 90px;
  overflow: hidden;
}

.hero__inner {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.hero__kicker {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 18px;
}

.hero__title {
  font-size: clamp(2.4rem, 6vw, 4rem);
  color: white;
  line-height: 1.05;
}

.hero__lead {
  color: var(--muted-on-dark);
  font-size: 1.15rem;
  max-width: 54ch;
  margin: 22px 0 36px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero__wave {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  width: 100%;
  height: 60px;
  z-index: 1;
}

.hero__bubbles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hero__bubbles span {
  position: absolute;
  bottom: -40px;
  width: var(--size, 14px);
  height: var(--size, 14px);
  border-radius: 50%;
  background: oklch(1 0 0 / 0.08);
  border: 1px solid oklch(1 0 0 / 0.16);
  animation: rise var(--duration, 14s) var(--delay, 0s) infinite var(--ease-out-quart);
}

.hero__bubbles span:nth-child(1) { left: 8%;  --size: 18px; --duration: 16s; --delay: 0s; }
.hero__bubbles span:nth-child(2) { left: 22%; --size: 10px; --duration: 12s; --delay: 2s; }
.hero__bubbles span:nth-child(3) { left: 41%; --size: 22px; --duration: 18s; --delay: 1s; }
.hero__bubbles span:nth-child(4) { left: 63%; --size: 13px; --duration: 13s; --delay: 3.5s; }
.hero__bubbles span:nth-child(5) { left: 78%; --size: 16px; --duration: 15.5s; --delay: 0.5s; }
.hero__bubbles span:nth-child(6) { left: 92%; --size: 9px;  --duration: 11s; --delay: 4s; }

@keyframes rise {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: 0.9; }
  90%  { opacity: 0.5; }
  100% { transform: translateY(-620px) translateX(24px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__bubbles span { animation: none; opacity: 0.35; bottom: 20%; }
}

/* ============================================================
   Dive section
   ============================================================ */

.dive-section {
  background: var(--surface);
  padding-block: 64px 96px;
}

.dive-section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 32px;
}

.dive-section__header h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  color: var(--ink);
}

.dive-section__count {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

.dive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 22px;
}

.dive-grid[data-empty="true"] {
  display: block;
}

/* Card entrance */
.dive-card {
  animation: card-in 0.5s var(--ease-out-quart) backwards;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .dive-card { animation: none; }
}

.dive-card {
  display: flex;
  gap: 18px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s var(--ease-out-quart), transform 0.25s var(--ease-out-quart), border-color 0.25s var(--ease-out-quart);
}

.dive-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.dive-card__date {
  flex: none;
  width: 62px;
  height: 62px;
  border-radius: var(--radius-md);
  background: var(--brand-tint);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}

.dive-card__date-day {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
}

.dive-card__date-month {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand);
}

.dive-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dive-card__location {
  font-size: 1.2rem;
  color: var(--ink);
  margin-bottom: 4px;
}

.dive-card__by {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 12px;
}

.specialty-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  /* Reserved even when empty (see fillSpecialtyList's reserveSpace option)
     so cards without specialties still line up with their neighbours. */
  min-height: 24px;
}

.specialty-badge {
  background: var(--brand-tint);
  color: var(--brand-strong);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.dive-card__meta {
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dive-card__meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.dive-card__meta-row dt {
  display: flex;
  flex: none;
  color: var(--brand);
}

.dive-card__meta-row dd {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.icon { width: 19px; height: 19px; flex: none; }

.dive-card__signups {
  background: var(--surface-sunken);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.dive-card__signups-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 10px;
}

.signup-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.signup-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.signup-item__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 4px;
  gap: 8px 10px;
}

.signup-item__comment {
  margin: 0;
  padding-left: 36px;
  font-size: 0.84rem;
  font-style: italic;
  color: var(--muted);
}

.signup-item__avatar {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

.signup-item__name {
  color: var(--ink-soft);
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signup-item__leave {
  flex: none;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: underline;
  text-decoration-color: transparent;
  cursor: pointer;
  padding: 2px;
  margin-left: auto;
  transition: color 0.15s var(--ease-out-quart), text-decoration-color 0.15s var(--ease-out-quart);
}
.signup-item__leave:hover { color: var(--danger); text-decoration-color: currentColor; }

.dive-card__signups-empty {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
}

/* Compact summary trigger (opens the detail dialog). Stacked in two rows
   (avatars+chevron, then the text on its own line) rather than one row —
   squeezing the text into the narrow leftover space beside the avatars is
   what caused it to wrap word-by-word down the card. On its own row the
   text gets the card's full width, which is plenty for "N aanmeldingen". */
.dive-card__summary {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s var(--ease-out-quart), border-color 0.15s var(--ease-out-quart);
}
.dive-card__summary:hover { background: var(--brand-tint); border-color: var(--border-strong); }

.dive-card__summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dive-card__summary-text {
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dive-card__summary-chevron {
  flex: none;
  color: var(--muted);
}

.avatar-stack {
  display: flex;
  flex: none;
}

.avatar-stack__item {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  border: 2px solid var(--surface-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: -8px;
}
.avatar-stack__item:first-child { margin-left: 0; }
.avatar-stack__item--more { background: var(--ink); }

.dive-card__actions {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Mini photo preview on the compact past-dive card */
.photo-strip {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.photo-strip:empty { display: none; }

.photo-strip__item {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
}

/* Empty state */
.empty-state {
  max-width: 440px;
  margin-inline: auto;
  text-align: center;
  padding: 48px 24px;
}
.empty-state__icon { width: 96px; height: 96px; margin: 0 auto 20px; }
.empty-state h3 { font-size: 1.3rem; color: var(--ink); margin-bottom: 8px; }
.empty-state p { color: var(--muted); margin: 0 0 24px; }

/* ============================================================
   Past dives
   ============================================================ */

.past-section {
  background: var(--surface-sunken);
  padding-block: 64px 96px;
  border-top: 1px solid var(--border);
}

.dive-card--past {
  background: var(--surface-card);
}

.dive-card__date--past {
  background: var(--border);
}
.dive-card__date--past .dive-card__date-month { color: var(--muted); }

.photo-section {
  margin-top: auto;
  padding-top: 4px;
}

.photo-section__label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 10px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
}

.photo-thumb__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out-quart);
}
.photo-thumb__img:hover { transform: scale(1.06); }

.photo-thumb__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: oklch(0.12 0.03 260 / 0.6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s var(--ease-out-quart), background-color 0.15s var(--ease-out-quart);
}
.photo-thumb__remove .icon { width: 12px; height: 12px; }
.photo-thumb:hover .photo-thumb__remove,
.photo-thumb__remove:focus-visible { opacity: 1; }
.photo-thumb__remove:hover { background: var(--danger); }

.photo-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 9px 16px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease-out-quart), background-color 0.15s var(--ease-out-quart);
}
.photo-upload-btn:hover { border-color: var(--brand); background: var(--brand-tint); }
.photo-upload-btn:has(input:focus-visible) {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
}
.photo-upload-btn .icon { width: 16px; height: 16px; }

.photo-upload-input {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Lightbox */
.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 92vw;
  max-height: 92vh;
}
.lightbox::backdrop {
  background: oklch(0.08 0.02 260 / 0.82);
  backdrop-filter: blur(4px);
}
.lightbox[open] { animation: modal-in 0.28s var(--ease-out-expo); }
.lightbox[open]::backdrop { animation: backdrop-in 0.28s var(--ease-out-expo); }
@media (prefers-reduced-motion: reduce) {
  .lightbox[open], .lightbox[open]::backdrop { animation: none; }
}

.lightbox__img {
  display: block;
  max-width: 92vw;
  max-height: 92vh;
  border-radius: var(--radius-md);
}

.lightbox__close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: oklch(1 0 0 / 0.14);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  z-index: var(--z-modal);
}
.lightbox__close:hover { background: oklch(1 0 0 / 0.24); }

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  background: var(--ink);
  padding-block: 48px;
}

.site-footer__inner {
  text-align: center;
}

.site-footer__initiative {
  color: var(--muted-on-dark);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 20px;
}

.site-footer__logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.logo--alfa { height: 40px; width: auto; }
.logo--derp { height: 52px; width: auto; }

.site-footer__x {
  color: oklch(1 0 0 / 0.3);
  font-size: 1.2rem;
}

.site-footer__fine {
  color: oklch(1 0 0 / 0.4);
  font-size: 0.82rem;
  margin: 0;
}

/* ============================================================
   Modals
   ============================================================ */

.modal {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(480px, calc(100vw - 40px));
  max-height: min(88vh, 720px);
  box-shadow: var(--shadow-lg);
  background: var(--surface-card);
  overscroll-behavior: contain;
}

.modal::backdrop {
  background: oklch(0.12 0.03 260 / 0.55);
  backdrop-filter: blur(2px);
}

.modal[open] {
  animation: modal-in 0.32s var(--ease-out-expo);
}
.modal[open]::backdrop {
  animation: backdrop-in 0.32s var(--ease-out-expo);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .modal[open], .modal[open]::backdrop { animation: none; }
}

.modal__form {
  padding: 28px;
  overflow-y: auto;
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal__header h2 {
  font-size: 1.35rem;
  color: var(--ink);
}

.modal__subtitle {
  margin: -10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.modal__header .modal__subtitle {
  margin: 4px 0 0;
}

.modal__eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 600;
}

.modal--detail {
  width: min(560px, calc(100vw - 40px));
}

.modal__share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 4px;
}
.modal__share-row .btn { flex: 0 0 auto; }

.modal__actions--detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  margin-top: 4px;
}
.modal__actions--detail .link-danger { align-self: center; }

.modal__close {
  background: var(--surface-sunken);
  border: none;
  border-radius: 50%;
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  cursor: pointer;
  flex: none;
  transition: background-color 0.15s var(--ease-out-quart);
}
.modal__close:hover { background: var(--border); }
.modal__close .icon { width: 16px; height: 16px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.field input,
.field select {
  border: 1.5px solid var(--border-strong);
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.98rem;
  color: var(--ink);
  transition: border-color 0.15s var(--ease-out-quart), background-color 0.15s var(--ease-out-quart);
}

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23445565' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6l6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 38px;
}

.field select:invalid { color: oklch(0.55 0.02 250); }

.field input::placeholder { color: oklch(0.55 0.02 250); }

.field input:hover,
.field select:hover { border-color: var(--muted); }

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--brand);
  background-color: var(--surface-card);
  box-shadow: 0 0 0 3.5px var(--accent-soft);
}

.field input:user-invalid {
  border-color: var(--danger);
}

/* Specialty chip picker (new-dive form) */
.chip-field {
  border: none;
  padding: 0;
  margin: 0;
}

.chip-field legend {
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0;
  margin-bottom: 8px;
}

.chip-select {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-select__option {
  position: relative;
}

.chip-select__option input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.chip-select__option span {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-strong);
  background: var(--surface-sunken);
  color: var(--ink-soft);
  font-size: 0.87rem;
  font-weight: 500;
  transition: background-color 0.15s var(--ease-out-quart), border-color 0.15s var(--ease-out-quart), color 0.15s var(--ease-out-quart);
}

.chip-select__option input:hover + span { border-color: var(--muted); }

.chip-select__option input:checked + span {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.chip-select__option input:focus-visible + span {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
}

.field__error {
  font-size: 0.82rem;
  color: var(--danger);
  margin: 0;
  min-height: 0;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* ============================================================
   Toast
   ============================================================ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  margin: 0;
  border: none;
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: white;
  padding: 13px 22px;
  border-radius: var(--radius-pill);
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-toast);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--ease-out-quart), transform 0.28s var(--ease-out-quart);
}

/* Overrides the Popover API's default display:none-until-shown so the
   fade transition above still runs; showPopover()/data-visible together
   control actual visibility. */
.toast:popover-open {
  display: block;
}

.toast[data-visible="true"] {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  .dive-card { flex-direction: column; }
  .dive-card__date { flex-direction: row; gap: 6px; width: auto; height: auto; padding: 8px 14px; align-self: flex-start; border-radius: var(--radius-pill); }
  .hero__actions .btn { flex: 1 1 auto; }
  .site-footer__logos { gap: 16px; }
}
