/* IslaTodo Trips — matches the palette and type of the /app shell */
:root {
  --ink: #1A3C4D;
  --ocean: #1A3C4D;
  --ocean-2: #245A6E;
  --sand: #FAF5ED;
  --surface: #FFFFFF;
  --surface-2: #F6F0E4;
  --sunset: #E8913A;
  --sunset-dk: #D4792A;
  --seafoam: #2D9F83;
  --seafoam-dk: #248366;
  --coral: #F07A5F;
  --muted: #5D7178;
  --muted-2: #8A9BA1;
  --line: #F0E8DA;
  --route: #F07A5F;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(26,60,77,.05), 0 8px 22px rgba(26,60,77,.07);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

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

html, body { margin: 0; padding: 0; overflow-x: hidden; max-width: 100vw; }
body {
  background: var(--sand);
  color: var(--ink);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
}
body.has-nav { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
.serif { font-family: 'DM Serif Display', Georgia, serif; font-style: italic; font-weight: 400; }
a { color: var(--seafoam); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* top bar ---------------------------------------------------------------- */
.app-top {
  background: linear-gradient(135deg, var(--ocean) 0%, var(--ocean-2) 100%);
  color: #fff;
  padding: calc(12px + env(safe-area-inset-top)) 16px 16px;
  position: sticky; top: 0; z-index: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.app-top .inner { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; color: #fff; font-family: 'DM Serif Display', serif; font-size: 21px; font-style: italic; }
.brand:hover { text-decoration: none; }
.brand .tt { font-style: normal; font-weight: 400; }
.brand .tt em { color: var(--sunset); font-style: italic; margin-left: 1px; }
.brand svg { width: 24px; height: 24px; flex: none; }
.app-top .spacer { flex: 1; }
.app-top h1 { font-size: 21px; color: #fff; }
.app-top .sub { color: rgba(255,255,255,.72); font-size: 12.5px; margin-top: 3px; }
.back { color: rgba(255,255,255,.85); font-size: 20px; line-height: 1; padding: 4px 8px 4px 0; }
.back:hover { color: #fff; text-decoration: none; }

/* bottom nav ------------------------------------------------------------- */
.bot-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 700;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(26,60,77,.06);
}
.bot-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 2px 8px; font-size: 10.5px; font-weight: 600; color: var(--muted);
  text-decoration: none; min-width: 0;
}
.bot-nav a span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bot-nav a.active { color: var(--seafoam); }
.bot-nav .em { font-size: 19px; line-height: 1; }

/* buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 15px; border-radius: 999px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: .14s ease; white-space: nowrap;
  min-height: 40px;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--seafoam); border-color: var(--seafoam); color: #fff; }
.btn.primary:hover { background: var(--seafoam-dk); }
.btn.sun { background: var(--sunset); border-color: var(--sunset); color: #fff; }
.btn.sun:hover { background: var(--sunset-dk); }
.btn.ghost { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.28); color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.24); }
.btn.sm { padding: 6px 12px; font-size: 13px; min-height: 34px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

input[type=text], textarea, input[type=search], input[type=email] {
  font-family: inherit; font-size: 15px; color: var(--ink);
  border: 1px solid var(--line); background: #fff;
  border-radius: 12px; padding: 11px 14px; width: 100%;
}
input:focus, textarea:focus { outline: none; border-color: var(--seafoam); box-shadow: 0 0 0 3px rgba(45,159,131,.14); }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.tiny { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.section { margin: 24px 0; }
.section > h2 { margin-bottom: 12px; }

/* stats ------------------------------------------------------------------ */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 1px; background: var(--line); border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--line);
}
.stat { background: #fff; padding: 13px 14px; }
.stat .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-2); font-weight: 700; }
.stat .v { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .v small { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-left: 2px; }

/* map -------------------------------------------------------------------- */
#map { height: 420px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; z-index: 1; }
.leaflet-container { font-family: inherit; background: #DDE6E3; }
.stop-pin {
  background: var(--sunset); color: #fff; width: 27px; height: 27px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.pop img { width: 190px; border-radius: 8px; display: block; margin-bottom: 6px; }
.pop b { display: block; font-size: 13.5px; }
.pop .v { color: var(--seafoam); font-size: 12px; font-weight: 600; }


/* waypoints flagged during a ride ---------------------------------------- */
.wp-pin {
  background: var(--seafoam); color: #fff; width: 26px; height: 26px;
  border-radius: 50% 50% 50% 2px; transform: rotate(-45deg);
  display: flex; align-items: center; justify-content: center;
  border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35);
  font-size: 12px; font-weight: 700;
}
.wp-pin span { transform: rotate(45deg); }
/* Hollow until a photo is pinned to the flag — at a glance, what is still owed. */
.wp-pin.no-photo { background: #fff; color: var(--seafoam); border-color: var(--seafoam); }

/* The same number as the pin, on the card, so the two read as one thing. */
.wp-num {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--seafoam); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.wp-num.no-photo { background: #fff; color: var(--seafoam); box-shadow: inset 0 0 0 2px var(--seafoam); }
.wp-card { scroll-margin-top: 78px; }
.wp-add {
  width: 58px; height: 58px; flex: none; border-radius: 10px; cursor: pointer;
  border: 1.5px dashed var(--muted-2); background: var(--surface-2); color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; font-size: 18px; line-height: 1; padding: 0;
}
.wp-add span { font-size: 10px; font-weight: 600; letter-spacing: .01em; }

/* timeline --------------------------------------------------------------- */
.timeline { position: relative; padding-left: 30px; }
.timeline:before { content: ''; position: absolute; left: 11px; top: 12px; bottom: 12px; width: 2px; background: var(--line); }
.tl-stop { position: relative; margin-bottom: 24px; }
.tl-dot {
  position: absolute; left: -30px; top: 1px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--sunset); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; border: 3px solid var(--sand);
}
.tl-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.tl-title { font-weight: 700; font-size: 15.5px; }
.tl-shots { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.tl-shots img { width: 92px; height: 92px; object-fit: cover; border-radius: 11px; border: 1px solid var(--line); cursor: pointer; transition: .15s; }
.tl-shots img:hover { transform: scale(1.04); }
.leg { display: flex; align-items: center; gap: 8px; margin: 0 0 20px -6px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.leg .bar { width: 2px; height: 18px; background: var(--line); margin-left: -18px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
}
.chip.vendor { background: rgba(45,159,131,.13); color: var(--seafoam-dk); }
.chip.warn { background: rgba(240,122,95,.15); color: #B8492F; }
.chip.stamp { background: rgba(232,145,58,.16); color: var(--sunset-dk); }

/* grids ------------------------------------------------------------------ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.tile { position: relative; border-radius: 13px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.tile img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; transition: .2s; }
.tile:hover img { transform: scale(1.04); }
.tile .badge { position: absolute; top: 6px; right: 6px; background: rgba(26,60,77,.8); color: #fff; font-size: 10.5px; padding: 3px 7px; border-radius: 999px; font-weight: 600; }
.tile.no-gps { border-color: rgba(240,122,95,.5); }

/* lightbox --------------------------------------------------------------- */
/* Bottom sheets. Lived only inside track.html's own <style>, so any other
   page that built one appended an unstyled div below the footer and the
   button appeared to do nothing. */
.sheet {
  position: fixed; inset: 0; background: rgba(12,26,32,.55); z-index: 1500;
  display: none; align-items: flex-end;
}
.sheet.on { display: flex; }
.sheet > .card {
  width: 100%; border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0,0,0,.25);
  max-height: 88vh; overflow: auto;
}
.sheet h3 { margin-bottom: 4px; }

.lb { position: fixed; inset: 0; background: rgba(12,26,32,.95); display: none; align-items: center; justify-content: center; z-index: 2000; }
.lb.on { display: flex; }
.lb img { max-width: 92vw; max-height: 80vh; border-radius: 8px; }
.lb .capwrap { position: absolute; bottom: calc(20px + env(safe-area-inset-bottom)); left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 20px; }
.lb .cap { text-align: center; color: #EFEAE1; font-size: 13.5px; opacity: .75; }
/* The photo's own story, as the owner wrote it — bigger than the coordinates,
   because it is the part a person actually came to read. */
.lb .cap-note { text-align: center; color: #fff; font-size: 16px; line-height: 1.45;
  max-width: 60ch; font-family: 'DM Serif Display', Georgia, serif; }
.lb .cap-in { width: min(60ch, 88vw); text-align: center; color: #fff; font-size: 15px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.22);
  border-radius: 10px; padding: 10px 14px; font-family: inherit; outline: none; }
.lb .cap-in::placeholder { color: rgba(255,255,255,.45); }
.lb .cap-in:focus { background: rgba(255,255,255,.14); border-color: var(--sunset); }
/* On pages with the bottom nav, clear it — the caption is a text field and
   must not sit on top of a tab bar. */
body.has-nav .lb .capwrap { bottom: calc(84px + env(safe-area-inset-bottom)); }
/* Describe the trip as a whole. Sits with the trip, shows at the top of the
   shared album. */
.about { width: 100%; resize: vertical; min-height: 74px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 12px 14px; font: inherit; font-size: 15px; line-height: 1.5; }
.about:focus { outline: none; border-color: var(--seafoam); }
.about-state { font-size: 12px; color: var(--muted-2); margin-top: 6px; min-height: 15px; }
.lb .nav { position: absolute; top: 50%; transform: translateY(-50%); color: #fff; font-size: 34px; cursor: pointer; padding: 14px 18px; user-select: none; opacity: .6; }
.lb .nav:hover { opacity: 1; }
.lb .prev { left: 2px; } .lb .next { right: 2px; }
.lb .x { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 18px; color: #fff; font-size: 28px; cursor: pointer; opacity: .7; }

/* dropzone --------------------------------------------------------------- */
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 30px 18px; text-align: center; background: #fff; transition: .16s; cursor: pointer; }
.drop.hot { border-color: var(--seafoam); background: rgba(45,159,131,.06); }
.drop h3 { margin-bottom: 4px; }
.bar-outer { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-top: 12px; }
.bar-inner { height: 100%; background: var(--seafoam); width: 0; transition: width .2s; }

/* gate ------------------------------------------------------------------- */
.gate { max-width: 420px; margin: 60px auto; text-align: center; padding: 32px 24px; }
.gate .em { font-size: 44px; display: block; margin-bottom: 12px; }
.gate h2 { margin-bottom: 8px; }

/* reel ------------------------------------------------------------------- */
.reel-box { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 16px; }
.reel-box video { width: 220px; border-radius: 12px; background: #000; display: block; }
.reel-copy { flex: 1; min-width: 200px; }

@media (max-width: 640px) {
  h1 { font-size: 22px; }
  #map { height: 320px; }
  .tl-shots img { width: 74px; height: 74px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
}

/* basemap switcher ------------------------------------------------------- */
.basemap-switch {
  display: flex; flex-direction: column; gap: 3px;
  background: rgba(255,255,255,.94); padding: 4px; border-radius: 11px;
  box-shadow: 0 2px 8px rgba(26,60,77,.28); font-family: inherit;
}
.basemap-switch button {
  border: 0; background: none; cursor: pointer; font-family: inherit;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  padding: 5px 9px; border-radius: 8px; white-space: nowrap; text-align: left;
}
.basemap-switch button.on { background: var(--ocean); color: #fff; }

/* "tap the map" mode ----------------------------------------------------- */
.drop-bar {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 1600;
  display: flex; align-items: center; gap: 12px;
  background: rgba(26,60,77,.97); color: #fff;
  border-radius: 14px; padding: 11px 14px; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 22px rgba(0,0,0,.3);
}
