/* 🚐💕 cozy pastel theme — daylight & dusk */

:root {
  --cream: #fffaf4;
  --card-bg: rgba(255, 250, 244, 0.92);
  --blush: #ffd9e3;
  --rose: #f4a9c7;
  --deep-rose: #e58fb1;
  --lavender: #cbb7f0;
  --mint: #bfe8d4;
  --butter: #ffefc1;
  --ink: #6d5a70;
  --ink-soft: #9c8aa0;
  --shadow: 0 10px 30px rgba(178, 141, 180, 0.28);
  --chip-1: #ffd9e3;
  --chip-2: #bfe8d4;
  --chip-3: #ffefc1;
  --chip-4: #ddd0f7;
  --map-bg: #f3ecf7;
  --tile-filter: saturate(0.72) hue-rotate(-6deg) brightness(1.05) contrast(0.9);
}

/* dusk mode 🌙 — deep plum night with the same soft pastels */
@media (prefers-color-scheme: dark) {
  :root {
    --cream: #262031;
    --card-bg: rgba(38, 32, 49, 0.92);
    --blush: #533c55;
    --rose: #e58fb1;
    --deep-rose: #f4a9c7;
    --lavender: #a68fd8;
    --mint: #7fc4a4;
    --butter: #e8cf8f;
    --ink: #ece3f2;
    --ink-soft: #ab9ab8;
    --shadow: 0 10px 30px rgba(10, 5, 15, 0.55);
    --chip-1: #5a3b4a;
    --chip-2: #2f4a3f;
    --chip-3: #55482a;
    --chip-4: #40365c;
    --map-bg: #1b1724;
    --tile-filter: saturate(0.75) brightness(0.92) hue-rotate(-8deg);
  }
}

* { box-sizing: border-box; }

/* the display rules below would otherwise beat the html hidden attribute */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Quicksand", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
}

#map {
  position: fixed;
  inset: 0;
  background: var(--map-bg);
}

/* soften the tiles into pastel land */
.leaflet-tile-pane { filter: var(--tile-filter); }

/* ------------------------------------------------------------- cards --- */

.card {
  position: fixed;
  z-index: 1000;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid var(--blush);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 14px 20px;
}

#title-card {
  top: 16px;
  left: 16px;
  max-width: min(340px, calc(100vw - 32px));
}

#title-card h1 {
  margin: 0;
  font-family: "Gochi Hand", cursive;
  font-size: 1.8rem;
  line-height: 1.1;
  color: var(--deep-rose);
  text-shadow: 2px 2px 0 var(--blush);
}

.stats {
  margin-top: 6px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

#now-card {
  bottom: 26px;
  left: 16px;
  min-width: 230px;
  max-width: min(300px, calc(100vw - 32px));
}

.now-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.now-emoji { font-size: 2.6rem; line-height: 1; }

.now-temp {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--deep-rose);
}

.now-desc {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.chip:nth-child(4n + 1) { background: var(--chip-1); }
.chip:nth-child(4n + 2) { background: var(--chip-2); }
.chip:nth-child(4n + 3) { background: var(--chip-3); }
.chip:nth-child(4n + 4) { background: var(--chip-4); }

.updated {
  margin-top: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
}

#empty-card {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-weight: 600;
  max-width: 300px;
  line-height: 1.5;
}

.empty-emoji { font-size: 2.2rem; margin: 0 0 6px; }

#credit {
  position: fixed;
  z-index: 1000;
  right: 14px;
  top: 14px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--card-bg);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--blush);
}

/* --------------------------------------------------- floating buttons --- */

.float-btn {
  position: fixed;
  z-index: 1000;
  right: 14px;
  border: 2px solid var(--blush);
  background: var(--card-bg);
  color: var(--ink);
  font-family: "Quicksand", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}

.float-btn:hover { transform: scale(1.06); }

#recenter-btn { bottom: 108px; padding: 8px 11px; }
#pile-btn { bottom: 156px; }

/* --------------------------------------------------------- van marker --- */

.van-icon { position: relative; }

.van-icon .van-emoji {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 30px;
  filter: drop-shadow(0 3px 4px rgba(120, 80, 120, 0.4));
  animation: bob 2.6s ease-in-out infinite;
}

.van-icon::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: var(--rose);
  opacity: 0.5;
  animation: pulse 2.2s ease-out infinite;
}

@keyframes pulse {
  0%   { transform: scale(0.5); opacity: 0.55; }
  100% { transform: scale(1.9); opacity: 0; }
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* ------------------------------------------------------- photo marker --- */

/* a polaroid frame shaped like the photo, hovering over its gps dot */
.photo-marker { cursor: pointer; }

.photo-marker .frame {
  position: absolute;
  inset: 0 0 12px 0; /* leaves the stem area for the gps dot */
  border-radius: 12px;
  border: 3px solid #fff;
  background: var(--blush);
  box-shadow: 0 4px 12px rgba(20, 10, 25, 0.45);
  overflow: hidden;
  transform: rotate(var(--tilt, -3deg));
  transform-origin: bottom center;
  transition: transform 0.18s ease;
}

.photo-marker img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-marker:hover .frame {
  transform: rotate(0deg) scale(1.3);
}

.photo-marker:hover {
  z-index: 10000 !important;
}

/* stacks: ghost frames peeking out behind the newest photo, plus a count */
.photo-stack .frame.ghost {
  background: #fff;
  box-shadow: 0 3px 8px rgba(20, 10, 25, 0.3);
}

.photo-stack:hover .frame.ghost { transform: rotate(var(--tilt)); } /* ghosts stay tilted */

.photo-stack .count {
  position: absolute;
  top: -7px;
  right: -7px;
  z-index: 5;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--deep-rose);
  color: #fff;
  font-family: "Quicksand", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(20, 10, 25, 0.35);
  box-sizing: border-box;
}

.photo-marker .gps-dot {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--lavender);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(20, 10, 25, 0.4);
}

/* ------------------------------------------------------------- popups --- */

.leaflet-popup-content-wrapper {
  border-radius: 20px;
  border: 2px solid var(--blush);
  background: var(--cream);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-family: "Quicksand", sans-serif;
}

.leaflet-popup-tip { background: var(--blush); }

.leaflet-popup-content { margin: 10px 12px; }

.photo-pop { max-width: 240px; }

.photo-pop img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  background: var(--blush);
}

.photo-pop .cap {
  font-family: "Gochi Hand", cursive;
  font-size: 1.1rem;
  color: var(--deep-rose);
  margin: 8px 0 2px;
}

.photo-pop .meta,
.point-pop .meta {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 2px 0 0;
}

.point-pop .head {
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0 0 2px;
}

/* -------------------------------------------------- shoebox & lightbox --- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(25, 15, 30, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.gallery-card {
  position: relative;
  max-width: 620px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.gallery-head { display: flex; align-items: baseline; gap: 10px; }

.gallery-head h2 {
  margin: 0;
  font-family: "Gochi Hand", cursive;
  color: var(--deep-rose);
  font-size: 1.4rem;
}

.gallery-head p {
  margin: 0;
  flex: 1;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.close-btn {
  border: none;
  background: var(--blush);
  color: var(--ink);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  font-weight: 700;
  cursor: pointer;
}

.gallery-grid {
  margin-top: 12px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  border: 3px solid #fff;
  box-shadow: 0 3px 10px rgba(20, 10, 25, 0.3);
  cursor: pointer;
  background: var(--blush);
  transition: transform 0.15s ease;
}

.gallery-grid img:hover { transform: scale(1.05) rotate(-1.5deg); }

#lightbox img {
  max-width: min(92vw, 900px);
  max-height: 78vh;
  border-radius: 16px;
  border: 5px solid #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  background: var(--blush);
}

#lightbox .cap {
  font-family: "Gochi Hand", cursive;
  font-size: 1.3rem;
  color: #ffe6ef;
  text-align: center;
  margin: 12px 0 0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

/* the little tooltip that follows route hovers */
.peek-tip {
  background: var(--card-bg);
  border: 2px solid var(--blush);
  border-radius: 999px;
  color: var(--ink);
  font-family: "Quicksand", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.peek-tip::before { display: none; }

/* leaflet chrome, pastel-ified */
.leaflet-bar a {
  background: var(--cream);
  color: var(--deep-rose);
  border-bottom-color: var(--blush);
}

.leaflet-control-attribution {
  background: var(--card-bg) !important;
  color: var(--ink-soft);
  font-size: 0.62rem;
  border-radius: 10px 0 0 0;
}

.leaflet-control-attribution a { color: var(--ink-soft); }

@media (max-width: 640px) {
  #title-card h1 { font-size: 1.4rem; }
  #now-card { bottom: 18px; }
  #credit { display: none; }
  #recenter-btn { bottom: 96px; }
  #pile-btn { bottom: 144px; }
}
