/* app.css — Road Trip's look: the iOS app on the web (design: design-prototypes/apple, direction C).
   Mirrors the iOS/iPadOS app (ios-swift/RoadTrip): system font, system
   colors, translucent materials, 49px round map controls, 92px filmstrip
   thumbnails, 40px round photo pins, a photo card over a dimmed map.
   Layout files position things; this file only says what they look like. */

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* SF on Apple devices; Inter (closest open match) everywhere else. */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;

  /* iOS system colors, light */
  --blue: rgb(0 122 255);
  --blue-soft: rgb(0 122 255 / .14);
  --red: rgb(255 59 48);
  --green: rgb(52 199 89);
  --orange: rgb(255 149 0);
  --label: rgb(0 0 0);
  --label-2: rgb(60 60 67 / .6);
  --label-3: rgb(60 60 67 / .3);
  --sep: rgb(60 60 67 / .2);
  --bg: rgb(255 255 255);
  --bg-grouped: rgb(242 242 247);
  --cell: rgb(255 255 255);
  --fill: rgb(120 120 128 / .2);
  --fill-2: rgb(120 120 128 / .16);
  --fill-3: rgb(118 118 128 / .12);
  --fill-4: rgb(116 116 128 / .08);

  /* Materials (regular / thin / thick), as SwiftUI's .regularMaterial etc. */
  --mat: rgb(249 249 251 / .82);
  --mat-thin: rgb(252 252 253 / .7);
  --mat-thick: rgb(246 246 248 / .92);
  --mat-blur: blur(26px) saturate(180%);
  --mat-edge: inset 0 0 0 .5px rgb(255 255 255 / .55), 0 0 0 .5px rgb(0 0 0 / .06);
  --shadow-float: 0 1px 3px rgb(0 0 0 / .08), 0 6px 20px rgb(0 0 0 / .12);
  --shadow-card: 0 12px 44px rgb(0 0 0 / .38);
  --dim: rgb(0 0 0 / .55);

  --r-bar: 16px;
  --r-panel: 24px;
  --r-thumb: 12px;
  --r-card: 16px;
  --r-cell: 12px;
  --ctrl: 49px;
  --thumb: 92px;
  --pin: 40px;
  --ease: cubic-bezier(.32, .72, 0, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --blue: rgb(10 132 255);
  --blue-soft: rgb(10 132 255 / .22);
  --red: rgb(255 69 58);
  --green: rgb(48 209 88);
  --orange: rgb(255 159 10);
  --label: rgb(255 255 255);
  --label-2: rgb(235 235 245 / .6);
  --label-3: rgb(235 235 245 / .3);
  --sep: rgb(84 84 88 / .6);
  --bg: rgb(0 0 0);
  --bg-grouped: rgb(0 0 0);
  --cell: rgb(28 28 30);
  --fill: rgb(120 120 128 / .36);
  --fill-2: rgb(120 120 128 / .32);
  --fill-3: rgb(118 118 128 / .24);
  --fill-4: rgb(118 118 128 / .18);
  --mat: rgb(37 37 40 / .8);
  --mat-thin: rgb(44 44 47 / .68);
  --mat-thick: rgb(30 30 32 / .92);
  --mat-edge: inset 0 0 0 .5px rgb(255 255 255 / .1), 0 0 0 .5px rgb(0 0 0 / .4);
  --shadow-float: 0 1px 3px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .35);
}

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 400 15px/1.4 var(--font);
  color: var(--label);
  background: var(--bg-grouped);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -.01em;
}
h1, h2, h3, p, figure, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--blue); text-decoration: none; }
img { display: block; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
body[data-role="viewer"] [data-owner] { display: none !important; }
body[data-role="owner"] [data-viewer-only] { display: none !important; }

/* Icons (SF-Symbol-like strokes from the sprite in app.js) */
.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 17px; height: 17px; }
.i-fill { fill: currentColor; stroke: none; }

/* Type scale (iOS Dynamic Type, "Large" size) */
.t-large { font: 700 34px/1.2 var(--font-display); letter-spacing: .01em; }
.t-title1 { font: 700 28px/1.2 var(--font-display); }
.t-title2 { font: 700 22px/1.25 var(--font-display); }
.t-title3 { font: 600 20px/1.25 var(--font-display); }
.t-headline { font: 600 17px/1.3 var(--font); }
.t-body { font: 400 17px/1.3 var(--font); }
.t-sub { font: 400 15px/1.33 var(--font); }
.t-foot { font: 400 13px/1.38 var(--font); }
.t-cap { font: 400 12px/1.33 var(--font); }
.t-2 { color: var(--label-2); }

/* ── Materials ────────────────────────────────────────────────────────── */
.glass {
  background: var(--mat);
  -webkit-backdrop-filter: var(--mat-blur);
  backdrop-filter: var(--mat-blur);
  box-shadow: var(--mat-edge), var(--shadow-float);
}
.glass.thick { background: var(--mat-thick); }
.glass-thin {
  background: var(--mat-thin);
  -webkit-backdrop-filter: var(--mat-blur);
  backdrop-filter: var(--mat-blur);
  box-shadow: var(--mat-edge);
}

/* ── Floating title bar (TripDetailView.floatingTopBar) ───────────────── */
.bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 52px; padding: 0 6px; border-radius: var(--r-bar);
}
.bar-title { min-width: 0; max-width: 100%; text-align: center; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font: 600 17px/1.2 var(--font); padding: 0 8px; }
.bar-sub { display: block; font: 400 12px/1.3 var(--font); color: var(--label-2); }
.bar-lead, .bar-trail { display: flex; align-items: center; gap: 2px; min-width: 0; }
.bar-trail { justify-content: flex-end; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center;
  color: var(--blue); transition: background .15s;
}
.icon-btn:hover { background: var(--fill-3); }
.icon-btn:active { background: var(--fill); }
.icon-btn[aria-pressed="true"] { background: var(--blue-soft); }

/* ── Round map controls (mapControlIcon: 29pt glyph + 10pt padding) ─────── */
.map-ctrls { display: flex; flex-direction: column; gap: 10px; }
.map-ctrl {
  width: var(--ctrl); height: var(--ctrl); border-radius: 50%;
  display: grid; place-items: center; color: var(--label);
  transition: transform .15s var(--ease), color .15s;
}
.map-ctrl:hover { transform: scale(1.05); }
.map-ctrl:active { transform: scale(.95); }
.map-ctrl[aria-pressed="false"] { color: var(--label-3); }
.map-ctrl.tinted { color: var(--blue); }
.map-ctrl .i { width: 24px; height: 24px; }

/* While a photo is open, the map's own controls step back under the dim. */
.map-ctrls { transition: opacity .2s; }
body[data-viewer="open"] .map-ctrls { opacity: 0; pointer-events: none; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  font: 600 16px/1 var(--font); white-space: nowrap; transition: filter .15s, background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-filled { background: var(--blue); color: #fff; }
.btn-filled:hover { filter: brightness(1.08); }
.btn-gray { background: var(--fill-3); color: var(--blue); }
.btn-gray:hover { background: var(--fill-2); }
.btn-plain { color: var(--blue); padding: 0 10px; }
.btn-block { width: 100%; }
.btn-lg { min-height: 50px; font-size: 17px; }
.btn[disabled] { opacity: .4; pointer-events: none; }

/* ── Filmstrip (photoStrip: 92pt rounded thumbs on thin material) ──────── */
.strip {
  display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain;
  padding: 12px 16px; scroll-padding-inline: 16px; scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.thumb {
  position: relative; flex: none; width: var(--thumb); height: var(--thumb);
  border-radius: var(--r-thumb); overflow: hidden; background: var(--fill-3);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover { transform: translateY(-2px); }
/* Selection ring drawn inside the photo, so neighbours and scroll edges can't clip it. */
.thumb::after, .tile::after {
  content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; pointer-events: none;
  transition: box-shadow .2s;
}
.thumb:focus-visible, .tile:focus-visible { outline: none; }
.thumb:focus-visible::after, .tile:focus-visible::after { box-shadow: inset 0 0 0 3px var(--blue); }
.thumb[aria-current="true"]::after, .tile[aria-current="true"]::after {
  box-shadow: inset 0 0 0 3px var(--blue), inset 0 0 0 5px rgb(255 255 255 / .85);
}
.thumb .num {
  position: absolute; z-index: 2; left: 6px; top: 6px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; display: grid; place-items: center;
  font: 600 12px/1 var(--font); color: #fff; background: rgb(0 0 0 / .55);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}

/* ── Photo pins on the map (PinThumbnail: 40pt circle, 2pt white ring) ─── */
.pin {
  position: relative; width: var(--pin); height: var(--pin); border-radius: 50%; padding: 0;
  background: var(--fill); box-shadow: 0 0 0 2px #fff, 0 2px 6px rgb(0 0 0 / .35);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.pin img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.pin:hover, .pin[data-hot] { transform: scale(1.18); z-index: 2; }
.pin[aria-current="true"] { transform: scale(1.3); box-shadow: 0 0 0 3px var(--blue), 0 3px 10px rgb(0 0 0 / .4); z-index: 3; }
.pin .badge {
  position: absolute; top: -6px; right: -8px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; display: grid; place-items: center;
  font: 600 12px/1 var(--font); color: #fff; background: var(--blue);
  box-shadow: 0 0 0 2px #fff;
}
.pin .badge.num { background: rgb(0 0 0 / .72); right: auto; left: -8px; }
.maplibregl-marker:has(.pin[aria-current="true"]), .maplibregl-marker:has(.pin[data-hot]) { z-index: 3; }

/* ── Viewer: card over the dimmed map (PhotoPopupView) ────────────────── */
.viewer {
  position: fixed; z-index: 40; display: grid; place-items: center;
  inset: var(--viewer-top, 0) var(--viewer-right, 0) var(--viewer-bottom, 0) var(--viewer-left, 0);
  padding: var(--viewer-pad-top, 72px) 16px var(--viewer-pad-bottom, 24px);
  animation: fade-in .2s ease-out;
}
.viewer-dim { position: absolute; inset: 0; background: var(--dim); transition: background .25s; }
.viewer-card {
  position: relative; display: grid; place-items: center;
  animation: card-in .28s var(--ease);
  touch-action: pan-y pinch-zoom;
}
.viewer-card img {
  max-width: min(680px, 100%); max-height: min(70vh, var(--viewer-max-h, 70vh));
  width: auto; height: auto; border-radius: var(--r-card); box-shadow: var(--shadow-card);
  cursor: zoom-in; user-select: none; -webkit-user-drag: none;
  transition: transform .2s var(--ease), opacity .2s;
}
.viewer-card img.swap { opacity: 0; transform: translateX(var(--swap-dx, 24px)); }
.viewer-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; z-index: 3; }
.viewer-nav { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center;
  justify-content: space-between; padding: 0 14px; z-index: 2; }
.viewer-nav .round { pointer-events: auto; }
.round {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; background: rgb(30 30 32 / .5);
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  box-shadow: inset 0 0 0 .5px rgb(255 255 255 / .18);
  transition: background .15s, transform .1s;
}
.round:hover { background: rgb(30 30 32 / .7); }
.round:active { transform: scale(.94); }
.viewer-meta { display: none; }
.viewer[data-immersive="true"] .viewer-tools { top: max(12px, env(safe-area-inset-top)); bottom: auto; right: 12px; transform: none; }

/* Immersive: tap the photo → full black, details pinned to the bottom. */
.viewer[data-immersive="true"] { inset: 0; padding: 0; z-index: 90; }
.viewer[data-immersive="true"] .viewer-dim { background: #000; }
.viewer[data-immersive="true"] .viewer-card img {
  max-width: 100vw; max-height: 100vh; max-height: 100dvh; border-radius: 0; box-shadow: none; cursor: zoom-out;
}
.viewer[data-immersive="true"] .viewer-meta {
  display: flex; flex-direction: column; gap: 5px; position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 48px max(20px, calc((100% - 700px) / 2)) max(28px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgb(0 0 0 / .65)); color: #fff; pointer-events: none;
}
.viewer-meta .m-title { font: 600 17px/1.3 var(--font); }
.viewer-meta .m-cap { font: 400 15px/1.35 var(--font); color: rgb(255 255 255 / .9); }
.viewer-meta .m-row { display: flex; align-items: center; gap: 7px; font: 400 15px/1.3 var(--font); color: rgb(255 255 255 / .85); }
.viewer-meta .m-row.small { font-size: 13px; }

/* ── Menus (iOS context-menu style) ───────────────────────────────────── */
.menu {
  position: fixed; z-index: 120; min-width: 240px; padding: 6px 0; border-radius: 14px;
  background: var(--mat-thick); -webkit-backdrop-filter: var(--mat-blur); backdrop-filter: var(--mat-blur);
  box-shadow: var(--mat-edge), 0 10px 40px rgb(0 0 0 / .22);
  animation: menu-in .18s var(--ease); transform-origin: top right;
}
.menu-item {
  width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 16px; font: 400 17px/1.2 var(--font); color: var(--label); text-align: left;
}
.menu-item:hover { background: var(--fill-3); }
.menu-item.destructive { color: var(--red); }
.menu-item .i { width: 20px; height: 20px; }
.menu-sep { height: 8px; background: var(--fill-4); margin: 6px 0; }
.menu-label { padding: 6px 16px 4px; font: 400 13px/1.3 var(--font); color: var(--label-2); }
.menu-item[aria-checked="true"]::after { content: "✓"; font-weight: 600; color: var(--blue); }
.menu-item[aria-checked] .i { display: none; }

/* ── Sheets (iPad form sheet / iPhone page sheet) ─────────────────────── */
dialog.sheet {
  width: min(560px, calc(100vw - 32px)); max-height: min(860px, calc(100dvh - 48px));
  padding: 0; border: 0; border-radius: 26px; overflow: hidden;
  background: var(--bg-grouped); color: var(--label);
  box-shadow: 0 20px 70px rgb(0 0 0 / .35);
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheet-in .32s var(--ease); }
dialog.sheet::backdrop { background: rgb(0 0 0 / .3); animation: fade-in .25s; }
:root[data-theme="dark"] dialog.sheet { background: rgb(28 28 30); }
:root[data-theme="dark"] dialog.sheet .cell, :root[data-theme="dark"] dialog.sheet .group { background-color: rgb(44 44 46); }
.sheet-bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 56px; padding: 6px 8px;
  flex: none;
}
.sheet-bar h2 { font: 600 17px/1.2 var(--font); text-align: center; }
.sheet-bar .btn-plain { justify-self: start; font-weight: 400; font-size: 17px; }
.sheet-bar .btn-plain.confirm { justify-self: end; font-weight: 600; }
.sheet-body { overflow: auto; padding: 4px 20px 24px; display: flex; flex-direction: column; gap: 22px; }

/* Inset grouped list */
.group { background: var(--cell); border-radius: var(--r-cell); overflow: hidden; }
.group-head { font: 400 13px/1.3 var(--font); color: var(--label-2); padding: 0 16px 7px; }
.group-foot { font: 400 13px/1.38 var(--font); color: var(--label-2); padding: 7px 16px 0; }
.cell { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 16px; background-color: var(--cell); }
/* Inset separator between rows, starting at the text's leading edge */
.cell + .cell { background-image: linear-gradient(var(--sep), var(--sep)); background-repeat: no-repeat; background-size: calc(100% - 16px) 1px; background-position: right top; }
.cell input, .cell textarea { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 400 17px/1.3 var(--font); padding: 0; resize: none; }
.cell input::placeholder, .cell textarea::placeholder { color: var(--label-3); }
/* iOS switch: a checkbox with role="switch". The knob is a background gradient, not
   ::after, because Firefox doesn't reliably draw pseudo-elements on inputs. */
.cell input.switch {
  appearance: none; -webkit-appearance: none; flex: none; width: 51px; height: 31px; margin: 0;
  border-radius: 16px; cursor: pointer; background-color: var(--fill);
  background-image: radial-gradient(circle, #fff 12.5px, transparent 13.5px);
  background-size: 31px 31px; background-repeat: no-repeat; background-position: 0 0;
  transition: background-color .2s, background-position .2s;
}
.cell input.switch:checked { background-color: var(--green); background-position: 20px 0; }
.cell input.switch:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.cell .cell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cell code { font: 400 13px/1.35 ui-monospace, "SF Mono", Menlo, monospace; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell .leading-icon { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: #fff; flex: none; }
.cell .leading-icon .i { width: 18px; height: 18px; }

/* ── Toast (TripDetailView toastMessage capsule) ──────────────────────── */
.toasts { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 150; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 999px; font: 400 15px/1.3 var(--font); animation: toast-in .3s var(--ease); }
.toast.out { opacity: 0; transform: translateY(12px); transition: .3s; }

/* ── MapLibre chrome, Apple-style ─────────────────────────────────────── */
.maplibregl-map { font: 400 12px/1.3 var(--font); }
.maplibregl-ctrl-attrib.maplibregl-compact {
  background: var(--mat) !important; -webkit-backdrop-filter: var(--mat-blur); backdrop-filter: var(--mat-blur);
  border-radius: 999px !important; box-shadow: var(--mat-edge); color: var(--label-2); min-height: 24px;
}
.maplibregl-ctrl-attrib.maplibregl-compact a { color: var(--label-2); }
.maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show) { background: transparent !important; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show) .maplibregl-ctrl-attrib-button { background-color: var(--mat) !important; border-radius: 50%; box-shadow: var(--mat-edge); }
.maplibregl-ctrl-attrib-button { background-color: transparent !important; background-repeat: no-repeat !important; background-position: center !important; min-width: 24px !important; min-height: 24px !important; width: 24px !important; height: 24px !important; }
:root[data-theme="dark"] .maplibregl-ctrl-attrib-button { filter: invert(1); }
.maplibregl-popup-content { border-radius: 12px !important; padding: 10px 14px !important; background: var(--mat-thick) !important;
  -webkit-backdrop-filter: var(--mat-blur); backdrop-filter: var(--mat-blur); color: var(--label); box-shadow: var(--shadow-float) !important; }
.maplibregl-popup-tip { display: none; }

/* ── Motion ───────────────────────────────────────────────────────────── */
@keyframes fade-in { from { opacity: 0; } }
@keyframes card-in { from { opacity: 0; transform: scale(.94) translateY(8px); } }
@keyframes menu-in { from { opacity: 0; transform: scale(.92); } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(40px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* Phone: sheets rise from the bottom edge like an iPhone page sheet. */
@media (max-width: 639.98px) {
  dialog.sheet {
    width: 100vw; max-width: 100vw; max-height: calc(100dvh - 12px); height: calc(100dvh - 12px);
    margin: auto 0 0; border-radius: 14px 14px 0 0;
  }
  @keyframes sheet-in { from { transform: translateY(100%); } }
  .viewer-nav { display: none; }
}

/* Composer (PhotoPreviewView) */
.composer-photo { width: 100%; height: 260px; object-fit: cover; border-radius: var(--r-cell); background: var(--fill-3); }
.composer-map { height: 220px; }
.composer-map-wrap { position: relative; }

/* Shown on the map only when it fails to start */
.map-problem { position: absolute; z-index: 5; left: 50%; top: 45%; transform: translate(-50%, -50%); max-width: min(440px, 90%);
  display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; border-radius: 14px; font: 400 14px/1.4 var(--font); color: var(--label); }

/* Stand-in map (no WebGL): image tiles, an SVG route, the same HTML pins */
.static-map { position: absolute; overflow: hidden; touch-action: none; cursor: grab; user-select: none; }
.static-map.dragging { cursor: grabbing; }
.sm-world { position: absolute; inset: 0; will-change: transform; }
.sm-tiles, .sm-pins { position: absolute; inset: 0; }
.sm-tiles img { position: absolute; width: 256px; height: 256px; max-width: none; }
.sm-route { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.sm-route polyline { fill: none; stroke: var(--blue); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 2 10; }
.sm-pin { position: absolute; width: 0; height: 0; z-index: 1; }
.sm-pin:has(.pin[aria-current="true"]), .sm-pin:has(.pin[data-hot]), .sm-pin:hover { z-index: 3; }
.sm-pin > .pin { position: absolute; left: calc(var(--pin) / -2); top: calc(var(--pin) / -2); }
.sm-pin.sm-anchor-bottom > * { position: absolute; left: 0; bottom: 0; transform: translateX(-50%); }
.sm-credit { position: absolute; z-index: 4; right: 6px; bottom: 6px; max-width: calc(100% - 12px); padding: 3px 9px; border-radius: 999px;
  font: 400 11px/1.4 var(--font); color: var(--label-2); background: var(--mat); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-center-pin { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: var(--blue); box-shadow: 0 0 0 3px #fff, 0 2px 6px rgb(0 0 0 / .35); }
.composer-map.static-map { position: relative; }

/* ── Trips list pieces (Home, and C's My Trips pane) ─────────────────── */
.brand { display: flex; align-items: center; gap: 12px; }
.app-icon {
  width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(160deg, rgb(64 156 255), var(--blue)); box-shadow: 0 2px 8px rgb(0 122 255 / .35);
}
.app-icon .i { width: 26px; height: 26px; stroke-width: 2; }

.section-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-row .btn-plain { padding: 0 4px; font-weight: 600; font-size: 16px; }
.trip-cards { display: flex; flex-direction: column; gap: 10px; }
.trip-card {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; color: var(--label);
  background: var(--cell); box-shadow: 0 1px 2px rgb(0 0 0 / .06);
  transition: transform .15s var(--ease), box-shadow .15s;
}
.trip-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgb(0 0 0 / .1); }
.tc-collage { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; width: 76px; height: 76px; border-radius: 12px; overflow: hidden; flex: none; }
.tc-collage img { width: 100%; height: 100%; object-fit: cover; }
.tc-collage img:first-child { grid-row: span 2; }
.tc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tc-text > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-chev { color: var(--label-3); }

.pitch { display: flex; flex-direction: column; gap: 18px; }
.how { display: flex; flex-direction: column; gap: 14px; }
.how li { display: flex; align-items: flex-start; gap: 12px; font: 400 15px/1.4 var(--font); }
.how-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.how-icon .i { width: 18px; height: 18px; }

.open-link .cell { padding-right: 6px; }
.open-link .link-icon { color: var(--label-2); }
.open-link input { font-size: 16px; }
.open-btn { font-weight: 600; padding: 0 10px; }

.home-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.home-foot a { color: var(--label-2); text-decoration: underline; text-underline-offset: 2px; }

/* The trip on the map: its cover photo with a name tag */
.trip-marker { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--label); }
.trip-marker img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px #fff, 0 4px 14px rgb(0 0 0 / .35); transition: transform .2s var(--ease); }
.trip-marker span { padding: 5px 11px; border-radius: 999px; font: 600 13px/1.2 var(--font); white-space: nowrap; }
.trip-marker:hover img { transform: scale(1.06); }

/* Create sheet: the "Trip Created" confirmation */
.created { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding-top: 6px; }
.created-check { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--green); margin-bottom: 6px; }
.created-check .i { width: 30px; height: 30px; stroke-width: 2.5; }
dialog.create .cell textarea { min-height: 52px; }

/* ── Layout: the split view (direction C) ─────────────────────────────── */
body { overflow: hidden; background: var(--bg); }
.split { position: fixed; inset: 0; --panel-w: clamp(360px, 34vw, 480px); }
.split-map { position: absolute; top: 0; bottom: 0; left: var(--panel-w); right: 0; background: var(--fill-3); }
.split-ctrls { position: absolute; z-index: 20; top: 10px; right: 10px; }
.split-mapbar { display: none; }

.split-panel {
  position: absolute; z-index: 30; top: 0; bottom: 0; left: 0; width: var(--panel-w);
  overflow: hidden; background: var(--bg); box-shadow: .5px 0 0 var(--sep);
}

/* Two levels: My Trips slides in from the left, the trip from the right. */
.pane { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; background: var(--bg); }
body.panes-ready .pane { transition: transform .4s var(--ease), opacity .3s, visibility .4s; }
body[data-pane="trip"] .pane-trips { transform: translateX(-28%); opacity: 0; visibility: hidden; }
body[data-pane="trips"] .pane-trip { transform: translateX(100%); visibility: hidden; }
.pane-trips { display: flex; flex-direction: column; gap: 22px; padding: 6px 20px 18px; }
.pane-trips .split-tools { margin: 0 -10px -16px; }
.pane-trips .new-trip { font-weight: 600; font-size: 16px; padding: 0 10px; }
.trip-card { width: 100%; text-align: left; background: var(--fill-4); box-shadow: none; }
.trip-card:hover { background: var(--fill-3); box-shadow: none; }
/* On the white panel, fields need their own fill to be seen (iOS text-field style). */
.pane-trips .group, .pane-trips .cell { background-color: var(--fill-3); }
/* iOS large-title bar: the page's own color at rest, frosted with a
   hairline once the list scrolls under it. */
.split-head {
  position: sticky; top: 0; z-index: 3; padding: 6px 20px 14px; background: var(--bg);
  transition: background .2s, box-shadow .2s;
}
.pane-trip.scrolled .split-head {
  background: var(--mat-thick); -webkit-backdrop-filter: var(--mat-blur); backdrop-filter: var(--mat-blur);
  box-shadow: 0 .5px 0 var(--sep);
}
/* Add Photo is the owner's main action, so it's a filled capsule, not a bare icon. */
.add-pill { min-height: 34px; padding: 0 14px 0 11px; margin-left: 6px; font-size: 15px; gap: 5px; }
.add-pill .i { width: 18px; height: 18px; stroke-width: 2.2; }
.split-tools { display: flex; align-items: center; margin: 0 -12px 2px; }
body[data-role="viewer"] .split-tools { margin-left: 0; }
.split-tools-gap { flex: 1; }

/* Days */
.days { padding: 0 20px; }
.day { padding-bottom: 18px; }
.day-head {
  position: sticky; top: var(--head-h, 112px); z-index: 2; display: flex; flex-direction: column; gap: 1px;
  padding: 12px 0 10px; background: var(--bg); font-weight: inherit;
}
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tile {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--fill-3);
  transition: transform .18s var(--ease), box-shadow .18s;
}
.tile img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: transform .3s var(--ease), opacity .35s ease-out; }
.tile img.in { opacity: 1; }
.tile:hover img, .tile[data-hot] img { transform: scale(1.05); }
.tile[data-hot]:not([aria-current="true"])::after { box-shadow: inset 0 0 0 3px var(--blue); }
.tile-time {
  position: absolute; z-index: 2; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 8px;
  font: 600 11px/1.4 var(--font); color: #fff; background: rgb(0 0 0 / .45);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); opacity: 0; transition: opacity .15s;
}
.tile:hover .tile-time, .tile[data-hot] .tile-time, .tile:focus-visible .tile-time { opacity: 1; }
.split-end { text-align: center; padding: 8px 20px 40px; }

/* Viewer dims the map side only; the journal stays readable. */
.split { --viewer-left: var(--panel-w); }
.viewer { --viewer-pad-top: 70px; --viewer-pad-bottom: 40px; }

.flip { display: none; }

@media (max-width: 1023.98px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

/* Phone: one at a time */
@media (max-width: 639.98px) {
  .split { --panel-w: 100vw; --viewer-left: 0px; }
  .split-map { left: 0; }
  .split-panel { width: 100%; transition: transform .35s var(--ease), visibility .35s; }
  body[data-phone-view="map"] .split-panel { transform: translateY(8%); opacity: 0; visibility: hidden; }
  .split-head { padding: 4px 16px 12px; }
  .days { padding: 0 16px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 3px; }
  .tile { border-radius: 6px; }
  .split-end { padding-bottom: 100px; }
  .pane-trips { padding: 4px 16px 100px; }
  .split-mapbar { display: grid; position: absolute; z-index: 25; top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; }
  .split-ctrls { top: calc(max(8px, env(safe-area-inset-top)) + 52px + 12px); right: 8px; }
  .flip {
    display: inline-flex; align-items: center; gap: 7px; position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
    bottom: max(20px, env(safe-area-inset-bottom)); height: 48px; padding: 0 20px; border-radius: 999px;
    font: 600 16px/1 var(--font); color: var(--label);
  }
  body[data-viewer="open"] .flip { display: none; }
}

/* ── Production additions ─────────────────────────────────────────────── */

/* Map paint tokens read by MapStyles.routePaint()/parkPaint() */
:root {
  --map-route-color: rgb(0 122 255); --map-route-width: 3.5; --map-route-opacity: 1; --map-route-dash: 0.6, 2.6;
  --map-park-fill: rgba(52, 199, 89, .13); --map-park-line: rgba(36, 138, 61, .45);
}
:root[data-theme="dark"] { --map-route-color: rgb(10 132 255); --map-park-fill: rgba(48, 209, 88, .12); --map-park-line: rgba(48, 209, 88, .45); }

/* Only one level of the panel is in the tab order / visible to the trip-only bits */
body[data-pane="trips"] [data-trip-only] { visibility: hidden; }
body[data-pane="trips"] .split-mapbar .bar-title { visibility: hidden; }

/* Trip header extras */
.trip-desc { margin-top: 6px; color: var(--label); }
.split-head h1:empty::before { content: "\00a0"; }

/* Failure-only upload banner (the iOS app's UploadBanner) */
.upload-banner {
  display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 10px 10px 14px; border-radius: 14px;
  background: rgb(255 149 0 / .12); color: var(--label);
}
.upload-banner[hidden] { display: none; }
.banner-icon { color: var(--orange); display: grid; }
.banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font: 400 15px/1.3 var(--font); }
.upload-banner .btn { min-height: 34px; padding: 0 12px; font-size: 15px; }

/* Tiles of photos still uploading (and failed ones) */
.tile.pending img { opacity: .55 !important; filter: saturate(.7); }
.tile-badge { position: absolute; z-index: 2; right: 6px; bottom: 6px; color: var(--blue); display: grid; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .35)); }
.tile-badge .i { width: 22px; height: 22px; }
.tile.failed .tile-badge { color: var(--orange); background: rgb(255 255 255 / .92); border-radius: 50%; padding: 3px; }
.tile.failed .tile-badge .i { width: 18px; height: 18px; }
.pin[data-pending] img { opacity: .7; }
.pin-upload { position: absolute; right: -4px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 2px #fff; }

/* Loading placeholders */
.skel { background: var(--fill-3); border-radius: 8px; animation: skel 1.4s ease-in-out infinite; }
.skel-line { display: block; height: 14px; width: 60%; margin: 2px 0 6px; }
.skel-line.short { width: 40%; height: 11px; }
.tile.skel { border-radius: 10px; }
@keyframes skel { 50% { opacity: .5; } }

/* Messages in the panel (empty trip, errors) */
.pane-message { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 48px 12px; }
.pane-message .btn { margin-top: 10px; }
.empty-icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; color: var(--label-2); background: var(--fill-4); margin-bottom: 6px; }
.empty-icon .i { width: 32px; height: 32px; }

/* My Trips */
.trip-cards { gap: 8px; }
.trip-card { padding: 10px; }
a.trip-card:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.tc-collage:empty { background: var(--fill-3); }
.form-error { color: var(--red); font: 400 13px/1.38 var(--font); padding: 6px 16px 0; }
dialog.sheet .form-error { padding-top: 10px; }
.composer-photo.short { height: 140px; }
.composer-map.tall { height: 300px; }
.use-here { margin-top: 4px; font-size: 15px; padding: 0 16px; }

/* MapLibre popups from the POI and park layers */
.poi-action-popup, .photo-map-popup { font: 400 14px/1.4 var(--font); }
.poi-action-name { font-weight: 600; margin-bottom: 6px; }
.poi-action-popup button { display: block; width: 100%; min-height: 36px; margin-top: 4px; border-radius: 10px; background: var(--fill-3); color: var(--blue); font: 600 14px/1 var(--font); }

/* Toast types */
.toast-error { color: var(--red); }

/* Nothing to fit or trace until a trip is loaded (fresh home page) */
body:not([data-has-trip]) [data-action="fit"], body:not([data-has-trip]) [data-action="route"] { display: none; }

/* ── /join/{token}: the invite page (join.html) ───────────────────────── */
body.join-page {
  overflow: auto; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background: var(--bg-grouped);
}
.join-card {
  width: min(440px, 100%); padding: 32px 28px 24px; border-radius: var(--r-panel); background: var(--cell);
  box-shadow: 0 1px 3px rgb(0 0 0 / .06), 0 12px 40px rgb(0 0 0 / .08);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
}
:root[data-theme="dark"] .join-card { background: rgb(28 28 30); box-shadow: none; }
.join-icon { width: 64px; height: 64px; border-radius: 15px; margin-bottom: 8px; }
.join-icon .i { width: 36px; height: 36px; stroke-width: 2; }
.join-lede { max-width: 32ch; }
.join-actions { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.join-bad { color: var(--red); margin-top: 8px; }
.join-foot { margin-top: 14px; max-width: 34ch; }
