/* ------------------------------------------------------------------ */
/* Ambulists — design tokens                                        */
/* ------------------------------------------------------------------ */
:root {
  --ink: #1b1f1d;
  --slate: #2c3330;
  --slate-light: #2f3835;
  --slate-lighter: #3a4340;
  --moss: #7c9070;
  --moss-dark: #5d7256;
  --paper: #ece6d8;
  --paper-dim: #c9c2b2;
  --muted: #8a9189;
  --border: #3a4340;
  --danger: #b3705f;

  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --sidebar-width: 380px;
  /* Width of the details column beside the map on a shared page (desktop). */
  --share-panel-width: 420px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: 14px;
  --radius-sm: 8px;
  --attribution-bg: rgba(36, 43, 41, 0.7);
}

/* ------------------------------------------------------------------ */
/* Light theme — aged paper, ink text                                   */
/* ------------------------------------------------------------------ */
:root[data-theme="light"] {
  --ink: #f3efe3;
  --slate: #ffffff;
  --slate-light: #ece4d2;
  --slate-lighter: #ddd3ba;
  --moss: #5d7256;
  --moss-dark: #4a5c45;
  --paper: #2c2f2a;
  --paper-dim: #5c5f56;
  --muted: #8a8270;
  --border: #ddd3ba;
  --danger: #a14e3c;
  --attribution-bg: rgba(255, 255, 255, 0.75);
}

/* ------------------------------------------------------------------ */
/* Native widget scheme                                                 */
/* ------------------------------------------------------------------ */
/* Scrollbars, the date picker's calendar icon and the <select> popup are
   painted by the browser, not by us. Without color-scheme they default to
   light, so a scrollbar in the (default) dark theme arrived as a bright
   white strip. Declaring the scheme fixes all of them at once, in Firefox
   and Safari as well as Chromium, and re-resolves the moment applyTheme()
   adds or removes data-theme on <html>.

   Safe for our form controls: input/textarea/select already set their own
   background, colour and border, every checkbox is the opacity:0 input
   behind a custom .toggle-track, and every file input is display:none. */
:root {
  color-scheme: dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

button {
  font-family: var(--font-body);
}

a {
  color: var(--moss);
}

/* ------------------------------------------------------------------ */
/* App shell — full-screen map as background                            */
/* ------------------------------------------------------------------ */
#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ------------------------------------------------------------------ */
/* Persistent background map                                            */
/* ------------------------------------------------------------------ */
#map-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--ink);
}

/* "Dark" tile style reuses the plain OSM raster tiles (no key-gated
   provider) and fakes a dark basemap with a CSS filter instead. */
.map-tiles-dark {
  filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9) saturate(0.7);
}

/* "Parchment" — same OSM tiles, pushed toward a warm aged-map look
   (heavy sepia, tan/brown rather than grey) so it reads as clearly
   different from "Colour" rather than another pale, faintly-tinted map. */
.map-tiles-parchment {
  filter: sepia(0.7) saturate(1.4) brightness(0.95) contrast(1.05) hue-rotate(-8deg);
}

/* ------------------------------------------------------------------ */
/* Guest banner (floating pill, horizontally centred at top)           */
/* ------------------------------------------------------------------ */
#guest-banner {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 16px;
  background: var(--moss-dark);
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  border-radius: var(--radius);
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Unverified-email nudge. Same shape as the guest banner, and it sits below
   that one so both can be on screen at once.

   The geometry is not just "centre it": the sidebar is a floating card pinned
   to the right with z-index 10, so a banner centred on the whole viewport
   slides underneath it and the sidebar swallows the clicks — the Resend and
   Dismiss buttons look fine and do nothing. On desktop this is therefore
   centred within the map area only, to the LEFT of the sidebar, and it also
   sits above the sidebar so a narrow window or a mid-animation overlap can
   still be clicked. */
#verify-banner {
  position: absolute;
  top: 20px;
  left: 20px;
  right: calc(var(--sidebar-width) + 40px);
  margin-inline: auto;
  width: fit-content;
  max-width: calc(100% - 40px);
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 16px;
  background: var(--moss-dark);
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Stack below the guest banner when guest mode is showing one too. */
#guest-banner:not(.hidden) ~ #verify-banner {
  top: 72px;
}

/* Below 760px the sidebar becomes a bottom sheet, so there is nothing on the
   right to avoid and the banner can use the full width. Matches the breakpoint
   the guest banner already uses. */
@media (max-width: 759px) {
  #verify-banner {
    top: 16px;
    left: 16px;
    right: 16px;
    max-width: calc(100vw - 32px);
    white-space: normal;
    text-align: center;
    flex-wrap: wrap;
    justify-content: center;
  }

  #guest-banner:not(.hidden) ~ #verify-banner {
    top: 88px;
  }
}

.guest-banner-exit {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 12px;
  font-family: var(--font-body);
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.guest-banner-exit:active {
  background: rgba(255, 255, 255, 0.25);
}

.guest-account-benefits {
  padding-left: 20px;
  margin: 0 0 4px;
  line-height: 1.8;
}

/* ------------------------------------------------------------------ */
/* Sidebar show button (visible when sidebar is collapsed)              */
/* ------------------------------------------------------------------ */
#sidebar-show-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--slate);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 8px 16px 8px 12px;
  color: var(--paper);
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.15s ease;
}

#sidebar-show-btn .mark {
  color: var(--moss);
  font-size: 20px;
  line-height: 1;
}

#sidebar-show-btn:active {
  background: var(--slate-light);
}

/* ------------------------------------------------------------------ */
/* Sidebar (floating panel — right side, with gap from edges)           */
/* ------------------------------------------------------------------ */
#sidebar {
  position: absolute;
  right: 20px;
  top: 20px;
  bottom: 20px;
  width: var(--sidebar-width);
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--slate);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.3s ease;
}

#sidebar.sidebar-collapsed {
  transform: translateX(calc(100% + 24px));
}

/* Dashboard: a plain full-screen information page, not a floating card
   over the map — no map underneath, no brand/nav header, at any screen
   size. !important on the transform beats the mobile bottom-sheet
   peek/expand states, which don't apply here. */
#sidebar.dashboard-fullscreen {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  border: none;
  box-shadow: none;
  transform: none !important;
}

#sidebar.dashboard-fullscreen #sidebar-header,
#sidebar.dashboard-fullscreen .sidebar-handle {
  display: none;
}

.sidebar-handle {
  display: none;
}

.sidebar-handle::after {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

/* ------------------------------------------------------------------ */
/* Sidebar header — two rows: brand above, actions below                */
/* ------------------------------------------------------------------ */
#sidebar-header {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 8px 4px 8px 16px;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s ease;
  gap: 4px;
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sidebar-brand-row .mark {
  color: var(--moss);
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  display: inline-block;
  transform: scaleX(-1);
}

/* All uses of .mark use the Old Italic Letter A (𐌀) flipped horizontally */
.mark {
  display: inline-block;
  transform: scaleX(-1);
}

.sidebar-brand-row h1 {
  font-size: 20px;
  color: var(--paper);
}

.sidebar-collapse-btn {
  flex-shrink: 0;
}

.sidebar-actions-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
  flex-wrap: nowrap;
}

/* ------------------------------------------------------------------ */
/* View title row: back button + page h1 on one line                    */
/* ------------------------------------------------------------------ */
.view-title-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 18px 4px 6px;
}

.view-title-row .detail-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.content-back-btn:hover {
  color: var(--paper);
  background: var(--slate-light);
}

.content-back-btn:active {
  background: var(--slate-lighter);
}

#sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ------------------------------------------------------------------ */
/* Sidebar footer — always pinned to bottom, outside scroll area        */
/* ------------------------------------------------------------------ */
#sidebar-footer {
  flex-shrink: 0;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

#sidebar-footer:empty {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Guest trip promo (in walk detail, where trip badge would appear)     */
/* ------------------------------------------------------------------ */
.guest-trip-promo {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.guest-trip-promo a {
  color: var(--moss);
}

/* ------------------------------------------------------------------ */
/* Form stats override fields                                           */
/* ------------------------------------------------------------------ */
.form-stats-override {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ------------------------------------------------------------------ */
/* Map style picker (Leaflet custom control)                            */
/* ------------------------------------------------------------------ */
.map-style-control {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.map-style-btn {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  background: var(--slate);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: background-color 0.15s ease;
}

.map-style-btn:active {
  background: var(--slate-light);
}

.map-style-panel {
  background: var(--slate);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  min-width: 150px;
}

.map-style-panel.hidden {
  display: none;
}

.map-style-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 10px 5px 6px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--paper);
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.map-style-pill:hover {
  background: var(--slate-light);
}

.map-style-pill.active {
  background: var(--moss);
  color: var(--ink);
}

.map-style-pill.active .map-style-thumb {
  border-color: var(--ink);
}

/* Sized like a small inline icon, not a photo — just enough to hint at
   the style, same visual weight as the rest of the app's small icons. */
.map-style-thumb {
  width: 22px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background-size: cover;
  background-position: center;
  background-color: var(--slate-lighter);
}

/* "Auto" has no single representative tile — a light/dark split stands
   in for "follows your theme". */
.map-style-thumb-auto {
  background-image: linear-gradient(135deg, #ece4d2 50%, #2c3330 50%);
}

.map-style-pill-label {
  flex: 1;
  min-width: 0;
}

/* Everything but "Auto" is a signed-in perk — greyed out and inert-
   looking for guests (still clickable, so tapping it can explain why
   rather than doing nothing). */
.map-style-pill.locked {
  opacity: 0.4;
}

/* ------------------------------------------------------------------ */
/* Header buttons                                                       */
/* ------------------------------------------------------------------ */
.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.header-btn:hover {
  opacity: 0.65;
}

.header-btn:active {
  background: var(--slate-light);
  opacity: 1;
}

.header-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.header-btn:disabled:active {
  background: transparent;
}

.header-signin {
  background: transparent;
  border: none;
  color: var(--moss);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 4px;
  cursor: pointer;
  white-space: nowrap;
}

.header-signin:active {
  opacity: 0.7;
}

.header-user-email {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  padding: 8px 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.header-user-email:hover { color: var(--ink); }

.settings-account-email {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 12px;
}

/* ------------------------------------------------------------------ */
/* Login modal overlay                                                  */
/* ------------------------------------------------------------------ */
/* The three auth cards share one overlay: the sign-in card, the
   forgotten-password form, and the set-a-new-password form reached from an
   emailed link. Only one is ever visible at a time. */
#view-login,
#view-forgot,
#view-reset {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--slate);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px 28px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.login-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.login-close:hover {
  background: var(--slate-light);
  color: var(--paper);
}

.login-card .mark {
  font-size: 28px;
  margin-bottom: 6px;
}

.login-card h1 {
  font-size: 24px;
  color: var(--paper);
  margin-bottom: 20px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card .error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 20px;
  color: var(--muted);
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.create-account-section {
  text-align: left;
}

.create-account-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.create-account-header strong {
  font-size: 14px;
  font-weight: 500;
  color: var(--paper-dim);
}

.create-account-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.privacy-notice-small {
  margin-top: 20px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Forms                                                                */
/* ------------------------------------------------------------------ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.field label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input, textarea, select {
  width: 100%;
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--paper);
  padding: 13px 14px;
  font-size: 15px;
  font-family: var(--font-body);
  min-height: 48px;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--moss);
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
}

.btn-primary {
  background: var(--moss);
  color: var(--ink);
}

.btn-primary:active {
  background: var(--moss-dark);
}

.btn-secondary {
  background: var(--slate-light);
  color: var(--paper);
  border-color: var(--border);
}

.btn-secondary:active {
  background: var(--slate-lighter);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:active {
  background: rgba(179, 112, 95, 0.12);
}

.btn-kofi {
  background: #ff5e5b;
  color: #fff;
  border-color: transparent;
  text-decoration: none;
}

.btn-kofi:active,
.btn-kofi:hover {
  background: #e04e4b;
  color: #fff;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ------------------------------------------------------------------ */
/* Sidebar list view                                                    */
/* ------------------------------------------------------------------ */
.sidebar-list-actions {
  padding: 12px 16px 4px;
}

/* ------------------------------------------------------------------ */
/* Trip group in list view                                              */
/* ------------------------------------------------------------------ */
.trip-group-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 16px 16px;
}

.trip-group {
  /* no extra margin — gap on .trip-group-list handles spacing */
}

.trip-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  text-align: left;
  color: var(--paper);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.trip-group-header:active {
  background: var(--slate-light);
}

.trip-group-chevron {
  flex-shrink: 0;
  color: var(--muted);
  display: flex;
  align-items: center;
}

.trip-group-header .swatch {
  width: 8px;
  height: 32px;
  border-radius: 4px;
  flex-shrink: 0;
}

.trip-group-info {
  flex: 1;
  min-width: 0;
}

.trip-group-name {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--paper);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}

.trip-group-meta {
  font-size: 12px;
  color: var(--muted);
}

.trip-group-walks {
  padding-left: 16px;
}

/* ------------------------------------------------------------------ */
/* Section heading in list view                                         */
/* ------------------------------------------------------------------ */
.list-section-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 16px 4px;
}

/* ------------------------------------------------------------------ */
/* Hike cards                                                           */
/* ------------------------------------------------------------------ */
.hike-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 16px 16px;
}

.hike-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.hike-card:active {
  background: var(--slate-lighter);
}

/* On a public profile each card is a link to that walk's own shared page,
   so it needs to stop looking like one. */
a.hike-card {
  text-decoration: none;
  color: inherit;
}

.swatch {
  width: 10px;
  height: 44px;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--swatch-color, var(--moss));
}

/* Planned (not-yet-walked) cards set --swatch-color instead of a plain
   background so this dashed pattern can reuse the walk's own colour —
   same dash rhythm as the route's dashed line on the map. */
.hike-card.planned .swatch,
.trip-day-card.planned .swatch {
  background: repeating-linear-gradient(
    to bottom,
    var(--swatch-color, var(--moss)) 0,
    var(--swatch-color, var(--moss)) 7px,
    transparent 7px,
    transparent 12px
  );
}

.hike-card-body {
  flex: 1;
  min-width: 0;
}

.hike-card-title {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--paper);
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hike-card-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12.5px;
}

.hike-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.trip-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--moss);
}

/* Map-hover: sidebar card lights up when pointer is over its map route */
.hike-card.map-hovered,
.trip-group-header.map-hovered,
.trip-day-card.map-hovered {
  background: var(--slate-lighter);
  border-color: var(--moss);
}

/* Planned (not-yet-walked) walk card */
.hike-card.planned,
.trip-day-card.planned {
  border-style: dashed;
  opacity: 0.82;
}

/* "Planned" tag takes the place of the date in the meta row, so a
   planned card's distance/ascent line up in the same spot as a walked
   card's — instead of shifting left into empty space where the date
   would otherwise be. */
.meta-planned-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--moss);
  border: 1.5px dashed var(--moss);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
}

/* Download buttons in walk detail */
.detail-download {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  background: var(--slate-light);
  color: var(--paper);
}

.btn-sm:active {
  background: var(--slate-lighter);
}

.trip-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ------------------------------------------------------------------ */
/* Usage banner (free plan limit)                                       */
/* ------------------------------------------------------------------ */
.usage-banner {
  margin: 0 16px 4px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--slate);
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.usage-banner.usage-full {
  border-color: var(--danger);
  color: var(--danger);
}

/* ------------------------------------------------------------------ */
/* Hike detail view                                                     */
/* ------------------------------------------------------------------ */
.detail-body {
  padding: 18px 18px 32px;
}

.detail-title {
  font-size: 26px;
  margin-bottom: 4px;
}

.detail-date {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.planned-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--moss);
  border: 1.5px dashed var(--moss);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  margin-bottom: 16px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-row.stats-1col {
  grid-template-columns: 1fr;
}

.stat-row.stats-2col {
  grid-template-columns: repeat(2, 1fr);
}

.stat-box {
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--paper);
}

.stat-value-auto {
  color: var(--moss);
}

/* Inputs filled by an automatic calculation rather than typed by hand */
.form-stats-override input.auto-filled {
  color: var(--moss);
  border-color: var(--moss);
}

/* Elevation override is locked (not green) when its value came from the
   uploaded file — the green highlight lives on the stat box instead. */
.form-stats-override input:disabled {
  color: var(--muted);
  background: var(--slate-light);
  border-color: var(--border);
  cursor: not-allowed;
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.detail-notes {
  color: var(--paper-dim);
  white-space: pre-wrap;
  margin-bottom: 24px;
  line-height: 1.65;
}

/* ------------------------------------------------------------------ */
/* Elevation profile chart                                              */
/* ------------------------------------------------------------------ */
.elevation-chart-wrap {
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 20px;
}

.elevation-chart-heading {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.elevation-chart-canvas {
  position: relative;
}

.elevation-chart {
  display: block;
  width: 100%;
  cursor: crosshair;
}

.elevation-chart-marker {
  fill: var(--slate-light);
  stroke: var(--moss-dark);
  stroke-width: 1.5;
}

.elevation-chart-hover-line {
  stroke: var(--danger);
  stroke-width: 1.3;
  stroke-dasharray: 3 3;
  transition: opacity 0.1s ease;
  pointer-events: none;
}

.elevation-chart-hover-dot {
  fill: var(--danger);
  stroke: var(--ink);
  stroke-width: 1.2;
  transition: opacity 0.1s ease;
  pointer-events: none;
}

.elevation-chart-point-label {
  position: absolute;
  transform: translate(-50%, -135%);
  font-size: 10px;
  font-weight: 600;
  color: var(--paper-dim);
  white-space: nowrap;
  pointer-events: none;
}

.elevation-chart-hover-readout {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
  background: var(--slate-lighter);
  color: var(--paper);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.elevation-chart-hover-readout.visible {
  opacity: 1;
}

.elevation-chart-axis {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.3;
}

.elevation-chart-axis-top {
  margin-bottom: 2px;
}

.elevation-chart-axis-bottom {
  margin-top: 2px;
}

.elevation-chart-caption {
  font-size: 12px;
  color: var(--paper-dim);
  margin-top: 6px;
}


.detail-actions {
  display: flex;
  gap: 10px;
}

.detail-actions .btn {
  flex: 1;
}

/* ------------------------------------------------------------------ */
/* Trip detail view                                                     */
/* ------------------------------------------------------------------ */
.trip-day-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.trip-day-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.trip-day-card:active {
  background: var(--slate-lighter);
}

.trip-day-index {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--muted);
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Add / Edit view                                                      */
/* ------------------------------------------------------------------ */
.form-page {
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-x: hidden;
}

.upload-box {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background: var(--slate-light);
}

.upload-box.has-file {
  border-color: var(--moss);
  color: var(--paper-dim);
}

.upload-box.drag-over {
  border-color: var(--moss);
  background: var(--slate);
}

.upload-box .upload-icon {
  margin-bottom: 8px;
  color: var(--moss);
}

.upload-box input[type="file"] {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Trip grouping (Add/Edit form)                                        */
/* ------------------------------------------------------------------ */
.trip-new-input {
  margin-top: 8px;
}

.trip-new-input.hidden {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Empty states                                                         */
/* ------------------------------------------------------------------ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty-state .empty-icon {
  color: var(--moss-dark);
  margin-bottom: 14px;
}

.empty-state h3 {
  color: var(--paper-dim);
  font-size: 18px;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  max-width: 240px;
  margin: 0;
}

/* On desktop the empty state doubles as a file drop target — see
   emptyState() in app.js. Below the breakpoint it stays the plain message
   it has always been: pointer-events keeps the <label> from opening a file
   picker on touch, where there is nothing to drag from anyway. Gating it
   here rather than in JS means a window resized across the breakpoint
   needs no re-render. */
.empty-dropzone {
  pointer-events: none;
}

.empty-dropzone input[type="file"] {
  display: none;
}

.empty-state-drop {
  display: none;
}

@media (min-width: 760px) {
  .empty-dropzone {
    pointer-events: auto;
    cursor: pointer;
    margin: 16px;
    padding: 56px 24px;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    background: var(--slate-light);
    transition: border-color 0.15s ease, background 0.15s ease;
  }

  /* Fill the empty sidebar so the whole panel is the target, not a small
     box with dead space under it. Only when the dropzone is the only thing
     in the body: a user can have trips but no walks, and then it sits
     under the trip list and should take just the room it needs. */
  #sidebar-body > .empty-dropzone:only-child {
    min-height: calc(100% - 32px);
    justify-content: center;
  }

  .empty-dropzone:hover,
  .empty-dropzone.drag-over {
    border-color: var(--moss);
  }

  /* --slate-lighter rather than the --slate that .upload-box uses: in the
     light theme --slate is the sidebar's own colour, so the target would
     blend into the panel at the moment it most needs to stand out. This
     moves away from the background in both themes. */
  .empty-dropzone.drag-over {
    background: var(--slate-lighter);
  }

  .empty-state-drop {
    display: block;
  }

  /* Reads as the link it behaves like, without being an <a>. */
  .empty-state-drop span {
    color: var(--moss);
    text-decoration: underline;
  }

  .empty-state-tap {
    display: none;
  }
}

/* ------------------------------------------------------------------ */
/* Leaflet tweaks                                                       */
/* ------------------------------------------------------------------ */
.leaflet-container {
  background: var(--slate);
  font-family: var(--font-body);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--slate);
  color: var(--paper);
}

.leaflet-control-attribution {
  background: var(--attribution-bg) !important;
  color: var(--muted) !important;
}

.leaflet-control-attribution a {
  color: var(--paper-dim) !important;
}

/* Leaflet's zoom control ships with a hard-coded white background and black
   glyphs. In the default (dark) theme that left a bright white square burned
   into the corner of the map, so restyle it from the same tokens as the map
   style button below it and let it follow the theme. `.leaflet-container`
   prefixes are there to out-specify Leaflet's own `.leaflet-touch` rules,
   which otherwise put a 2px grey border back on mobile. */
.leaflet-container .leaflet-bar {
  border: 1px solid rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  /* Corner rounding for the buttons inside, without having to restate
     Leaflet's per-child first/last radii at every breakpoint. */
  overflow: hidden;
}

.leaflet-container .leaflet-bar a {
  background-color: var(--slate);
  color: var(--paper);
  border-bottom: 1px solid var(--border);
}

.leaflet-container .leaflet-bar a:hover,
.leaflet-container .leaflet-bar a:focus {
  background-color: var(--slate-light);
  color: var(--paper);
}

.leaflet-container .leaflet-bar a.leaflet-disabled {
  background-color: var(--slate);
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Elevation-chart hover marker (shown on the map while hovering the   */
/* elevation profile chart)                                            */
/* ------------------------------------------------------------------ */
.elevation-hover-marker {
  pointer-events: none;
}

.elevation-hover-marker-dot {
  position: absolute;
  left: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.elevation-hover-marker-label {
  position: absolute;
  left: 11px;
  top: -10px;
  background: var(--slate-lighter);
  color: var(--paper);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 6px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ------------------------------------------------------------------ */
/* Toast                                                                */
/* ------------------------------------------------------------------ */
#toast {
  position: fixed;
  bottom: 24px;
  left: calc(50% - var(--sidebar-width) / 2);
  transform: translateX(-50%) translateY(20px);
  background: var(--slate-lighter);
  color: var(--paper);
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 13px;
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  white-space: nowrap;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ------------------------------------------------------------------ */
/* Toggle switch                                                        */
/* ------------------------------------------------------------------ */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-row-label {
  flex: 1;
}

.toggle-row-label strong {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: var(--paper);
  margin-bottom: 2px;
}

.toggle-row-label span {
  font-size: 12.5px;
  color: var(--muted);
}

.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--slate-lighter);
  border-radius: 13px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.toggle input:checked + .toggle-track {
  background: var(--moss);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
}

/* ------------------------------------------------------------------ */
/* Share URL row                                                        */
/* ------------------------------------------------------------------ */
.share-url-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: 10px;
}

.share-url-text {
  flex: 1;
  font-size: 12px;
  color: var(--paper-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.share-copy-btn {
  flex-shrink: 0;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--moss);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.share-copy-btn:active {
  background: var(--slate-lighter);
}

/* "View" beside "Copy" on the public profile row is a link, not a button. */
a.share-copy-btn {
  text-decoration: none;
}

/* A line of explanation under a settings toggle — what the switch will
   actually do, or what it is doing right now. */
.settings-hint {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 8px 0 0;
}

/* ------------------------------------------------------------------ */
/* Share section (inside walk detail)                                  */
/* ------------------------------------------------------------------ */
.share-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.share-section-heading {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

/* ------------------------------------------------------------------ */
/* Settings view                                                        */
/* ------------------------------------------------------------------ */
.settings-body {
  padding: 18px;
}

.settings-section-heading {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
  margin-top: 24px;
}

.settings-section-heading:first-child {
  margin-top: 0;
}

/* Theme / Distance / Altitude — a labelled slider per row, three columns:
   the option on either side of the toggle, whichever is active picked out
   in bold. */
.settings-slider-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.settings-slider-row:last-child {
  border-bottom: none;
}

.settings-slider-heading {
  font-size: 14px;
  font-weight: 500;
  color: var(--paper);
  margin-bottom: 10px;
}

.settings-slider-control {
  display: flex;
  align-items: center;
  gap: 14px;
}

.settings-slider-label {
  flex: 1;
  font-size: 13px;
  color: var(--muted);
  transition: color 0.2s ease, font-weight 0.2s ease;
}

.settings-slider-control .settings-slider-label:last-child {
  text-align: right;
}

.settings-slider-label.active {
  color: var(--paper);
  font-weight: 600;
}

.settings-data-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-data-row .btn {
  flex: 1;
  min-width: 120px;
  font-size: 13.5px;
  min-height: 42px;
  padding: 8px 14px;
}

/* ------------------------------------------------------------------ */
/* Admin dashboard                                                      */
/* ------------------------------------------------------------------ */

/* Centred reading column so the (narrow-sidebar-shaped) content doesn't
   stretch edge-to-edge on a full-screen dashboard. Horizontal padding is
   left to .view-title-row/.detail-body, same as every other view. */
.dash-page {
  max-width: 720px;
  margin: 0 auto;
  padding-top: 12px;
}

.dash-chart-wrap {
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px 6px;
  margin-bottom: 20px;
}

.dash-chart-caption {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.dash-chart {
  display: block;
}

.dash-progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--paper);
  margin-bottom: 6px;
}

.dash-progress-track {
  height: 8px;
  border-radius: 4px;
  background: var(--slate-lighter);
  overflow: hidden;
}

.dash-progress-fill {
  height: 100%;
  border-radius: 4px;
}

.dash-progress-ok {
  background: var(--moss);
}

.dash-progress-warn {
  background: #d4a24c;
}

.dash-progress-danger {
  background: #c0392b;
}

.dash-note {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 8px;
}

/* A standing notice under a share toggle, for a consequence the toggle's
   own label cannot carry — currently that publishing a trip publishes every
   walk inside it. Warning-toned, not error-toned: nothing is wrong. */
.share-warning {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--paper-dim);
  background: var(--slate-light);
  border-left: 2px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 10px 0 0;
}

.share-warning strong {
  color: var(--paper);
  font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* Privacy / Terms                                                      */
/* Long-form reading inside a narrow sidebar: looser leading and more   */
/* space between sections than the rest of the UI, which is scanned.    */
/* ------------------------------------------------------------------ */
.legal-body {
  padding-bottom: 32px;
}

.legal-updated {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 22px;
}

.legal-section {
  margin-bottom: 26px;
}

.legal-heading {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--paper);
  margin: 0 0 8px;
  line-height: 1.3;
}

.legal-para {
  font-size: 14px;
  line-height: 1.65;
  color: var(--paper-dim);
  margin: 0 0 10px;
}

.legal-para:last-child {
  margin-bottom: 0;
}

.legal-para strong {
  color: var(--paper);
  font-weight: 600;
}

.legal-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.settings-legal-links {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.legal-footer-links a {
  font-size: 13.5px;
  color: var(--moss);
  text-decoration: none;
}

.legal-footer-links a:hover,
.legal-footer-links a:focus-visible {
  text-decoration: underline;
}

.privacy-notice-small a {
  color: var(--moss);
  text-decoration: none;
}

.privacy-notice-small a:hover,
.privacy-notice-small a:focus-visible {
  text-decoration: underline;
}

/* The raw counts under a rate on the dashboard, so "62%" is never read
   without the "8 of 13" that produced it. */
.dash-substat {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  margin-top: 4px;
}

.dash-note a {
  color: var(--moss);
}

.settings-inline-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding: 14px;
  background: var(--slate-light);
  border-radius: 8px;
}

.settings-inline-form input[type="password"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  box-sizing: border-box;
}

.settings-inline-form input[type="password"]::placeholder {
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* About / FAQ view                                                     */
/* ------------------------------------------------------------------ */
.about-body {
  padding: 18px;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-q {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--paper);
  margin-bottom: 8px;
}

/* An answer in content/faq.md can be several paragraphs, or a bulleted
   list — each of them carries .faq-a, so space them like paragraphs. */
.faq-a {
  font-size: 14px;
  color: var(--paper-dim);
  line-height: 1.6;
  margin: 0 0 10px;
}

.faq-a:last-child {
  margin-bottom: 0;
}

.faq-a strong {
  color: var(--paper);
  font-weight: 600;
}

ul.faq-a,
ul.legal-para {
  padding-left: 20px;
}

ul.faq-a li,
ul.legal-para li {
  margin-bottom: 6px;
}

.faq-a a,
.legal-para a {
  color: var(--moss);
}

/* ------------------------------------------------------------------ */
/* Share shell (public read-only pages — no auth, no nav)              */
/* ------------------------------------------------------------------ */
#share-shell {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  overflow-y: auto;
}

/* On mobile #share-card is just a transparent passthrough — the shell IS
   the page. On tablets it becomes a floating card, same recipe as #sidebar
   on the map view; on desktop it goes full-bleed and the views inside it
   split into map + details columns (see the breakpoints at the end). */
#share-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#share-header {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#share-header .mark {
  font-size: 22px;
  line-height: 1;
  color: var(--moss);
}

#share-header h1 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--paper);
}

#share-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.view {
  height: 100%;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.view.hidden {
  display: none;
}

.share-footer {
  text-align: center;
  padding: 18px;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.share-footer a {
  color: var(--moss);
  text-decoration: none;
}

.share-footer a:hover {
  text-decoration: underline;
}

.share-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  gap: 10px;
}

.share-error h2 {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--paper);
}

#view-share-list .share-list-body {
  padding: 0 18px 24px;
}

#share-list-map {
  height: 38vh;
  min-height: 220px;
  background: var(--slate-light);
  flex-shrink: 0;
}

.detail-map {
  height: 38vh;
  min-height: 220px;
  background: var(--slate);
}

/* ------------------------------------------------------------------ */
/* Loading spinner                                                      */
/* ------------------------------------------------------------------ */
.spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* View transition animations                                           */
/* ------------------------------------------------------------------ */
@keyframes viewEnterRight {
  from { transform: translateX(36px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes viewEnterBottom {
  from { transform: translateY(44px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.view-enter-right  { animation: viewEnterRight  0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.view-enter-bottom { animation: viewEnterBottom 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94); }

/* ------------------------------------------------------------------ */
/* Responsive: Mobile (< 760px) — sidebar becomes a bottom sheet       */
/* ------------------------------------------------------------------ */
@media (max-width: 759px) {
  #guest-banner {
    top: 16px;
    max-width: calc(100vw - 32px);
    white-space: normal;
    text-align: center;
    flex-wrap: wrap;
    justify-content: center;
  }

  #sidebar-show-btn {
    top: auto;
    bottom: 20px;
    right: 50%;
    transform: translateX(50%);
  }

  #sidebar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: 85vh;
    border-radius: 18px 18px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    /* 78px — exactly the header+notch height, measured, so peeking
       reveals only the header and nothing of the body below it. */
    transform: translateY(calc(100% - 78px));
    /* No transform transition on purpose: on mobile the sheet is driven
       frame by frame by a spring in the JS, which carries the gesture's
       own velocity into the animation and can be interrupted mid-flight.
       The transforms here and below are the resting positions used
       before that takes over. */
    transition: background-color 0.2s ease, border-color 0.2s ease;
  }

  #sidebar.sidebar-collapsed {
    transform: translateY(100%);
  }

  #sidebar.expanded {
    transform: translateY(0);
  }

  /* A small notch floating in the (much smaller) reserved gap above
     the header, rather than a full-width bar with its own padded row
     pushing everything else down — the header's margin-top below is
     the entire reserved gap, and the notch just sits inside it. */
  .sidebar-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 16px;
    cursor: pointer;
    touch-action: none;
    z-index: 1;
  }

  #sidebar-header {
    touch-action: none;
    margin-top: 16px;
  }

  /* The content is its own scroller only at the tallest detent; below
     that there is nothing to scroll, so the whole body becomes drag
     surface for the sheet. `overscroll-behavior` keeps a flick that
     reaches the end of the list from escaping into the page behind. */
  #sidebar-body {
    touch-action: pan-y;
    overscroll-behavior: contain;
  }

  #sidebar.sheet-scroll-locked #sidebar-body {
    overflow-y: hidden;
  }

  /* Collapse button: ↑ when peeking (tap to expand), ↓ when expanded (tap to collapse) */
  #sidebar:not(.expanded) .sidebar-collapse-btn svg {
    transform: rotate(-90deg);
  }
  #sidebar.expanded .sidebar-collapse-btn svg {
    transform: rotate(90deg);
  }

  .form-stats-override {
    grid-template-columns: 1fr;
  }

  #toast {
    left: 50%;
    bottom: 78px;
  }
}

/* ------------------------------------------------------------------ */
/* Responsive: Tablet (760–1023px) — shared pages present as a roomy   */
/* centred card rather than a phone-width column.                      */
/* ------------------------------------------------------------------ */
@media (min-width: 760px) and (max-width: 1023px) {
  #share-shell {
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
  }

  #share-card {
    flex: none;
    width: min(720px, 100%);
    max-height: calc(100vh - 80px);
    background: var(--slate);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
  }

  #share-shell .detail-map,
  #share-list-map {
    height: 44vh;
  }

  #share-shell .detail-body,
  #view-share-list .share-list-body {
    padding: 22px 26px 34px;
  }

  #share-shell .hike-card-list {
    padding-left: 0;
    padding-right: 0;
  }
}

/* ------------------------------------------------------------------ */
/* Responsive: Desktop (>= 1024px) — the shared page fills the window   */
/* like the app itself: a full-height map with the walk's details in a  */
/* column beside it, instead of a phone-shaped card floating in space.  */
/* ------------------------------------------------------------------ */
@media (min-width: 1024px) {
  #share-shell {
    overflow: hidden;
  }

  #share-card {
    flex: 1;
    width: 100%;
    min-height: 0;
    background: var(--ink);
  }

  #share-header {
    padding: 16px 28px 14px;
  }

  #share-main {
    min-height: 0;
    overflow: hidden;
  }

  /* Map on the left, details on the right — both children are already in
     that order in the markup, so the grid needs no reordering. */
  #share-shell .view {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--share-panel-width);
    grid-template-rows: 100%;
    overflow: hidden;
  }

  #share-shell .detail-map,
  #share-list-map {
    height: 100%;
    min-height: 0;
  }

  #share-shell .detail-body,
  #view-share-list .share-list-body {
    min-height: 0;
    overflow-y: auto;
    padding: 20px 24px 40px;
    background: var(--slate);
    border-left: 1px solid var(--border);
  }

  /* The cards already sit inside the panel's own padding. */
  #share-shell .hike-card-list {
    padding-left: 0;
    padding-right: 0;
  }

  .share-footer {
    padding: 14px 18px;
  }
}

@media (min-width: 1600px) {
  #share-shell {
    --share-panel-width: 480px;
  }
}

/* Sign-in card: the forgotten-password route out, and back again from it. */
.login-forgot {
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
}

.login-forgot a {
  color: var(--muted);
  text-decoration: underline;
}

.login-forgot a:hover {
  color: var(--paper);
}
