/* ============================================================
   G'S TIKI MAP — design tokens
   ============================================================
   Color:
     --ink        #2B1B12  charred wood / body text
     --parchment  #E8D8B0  aged paper
     --parchment2 #DCC896  parchment shadow tone
     --lagoon     #0F3B3A  deep ocean teal (map chrome, header)
     --lagoon2    #164E4C  lighter lagoon for hover states
     --rust       #A6512C  wax-seal rust, headings accent
     --gold       #C9A227  gold leaf, ratings, treasure

   Type:
     display  "Pirata One"       — wordmark + big numerals only
     body     "IM Fell English"  — everything you read
   ============================================================ */

:root {
  --ink: #2B1B12;
  --parchment: #E8D8B0;
  --parchment2: #DCC896;
  --lagoon: #0F3B3A;
  --lagoon2: #17605C;
  --rust: #A6512C;
  --gold: #C9A227;
  --shadow: rgba(43, 27, 18, 0.35);
}

* { box-sizing: border-box; }

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

body {
  font-family: 'IM Fell English', Georgia, serif;
  color: var(--ink);
  background: var(--lagoon);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

::selection { background: var(--gold); color: var(--ink); }

/* subtle film-grain / paper noise over the whole app */
.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image:
    radial-gradient(circle at 20% 30%, #000 0.5px, transparent 0.5px),
    radial-gradient(circle at 60% 70%, #000 0.5px, transparent 0.5px),
    radial-gradient(circle at 80% 20%, #000 0.5px, transparent 0.5px);
  background-size: 3px 3px, 4px 4px, 5px 5px;
}

/* ---------- masthead ---------- */

.masthead {
  position: relative;
  background: linear-gradient(180deg, var(--lagoon) 0%, #0B2E2D 100%);
  color: var(--parchment);
  padding: 0.9rem 1.5rem 1.1rem;
  text-align: center;
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 4px 12px var(--shadow);
  flex: 0 0 auto;
}

.masthead-inner { max-width: 720px; margin: 0 auto; }

.wordmark {
  font-family: 'Pirata One', serif;
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0;
  letter-spacing: 0.03em;
  color: var(--parchment);
  text-shadow: 0 2px 0 var(--rust), 0 4px 10px rgba(0,0,0,0.5);
}

.tagline {
  margin: 0.15rem 0 0;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--parchment2);
  opacity: 0.9;
}

.compass {
  position: absolute;
  top: 50%;
  right: 1.25rem;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  color: var(--gold);
  opacity: 0.85;
  display: none;
}

.compass-n {
  font-family: 'IM Fell English', serif;
  font-size: 11px;
  fill: var(--gold);
}

@media (min-width: 760px) {
  .compass { display: block; }
}

/* ---------- app layout ---------- */

.app {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  position: relative;
}

.map-wrap {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
  z-index: 0; /* contain the vignette's stacking context to this element */
}

#map {
  width: 100%;
  height: 100%;
  background: #cfd8c8;
}

/* recolor the basemap to a two-tone chart: water -> lagoon, land -> parchment.
   #tikiDuotone (defined inline in index.html) maps each tile pixel's
   luminance onto that gradient; contrast() keeps roads/labels from washing
   out in the middle of the ramp. */
.leaflet-tile-pane {
  filter: url(#tikiDuotone) contrast(1.08);
}

/* vignette so the map fades into the frame like an old chart */
.map-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 90px 20px rgba(20, 12, 6, 0.55);
  z-index: 1000;
}

/* ---------- logbook sidebar ---------- */

.logbook {
  flex: 0 0 320px;
  background: var(--parchment);
  background-image:
    radial-gradient(circle at 10% 15%, rgba(166,81,44,0.06), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(15,59,58,0.07), transparent 50%);
  border-right: 3px solid var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: 4px 0 14px var(--shadow);
  z-index: 10;
}

.stats-strip {
  padding: 0.85rem 1rem 0.6rem;
  font-size: 0.92rem;
  color: var(--lagoon);
  border-bottom: 1px dashed var(--rust);
  line-height: 1.5;
}

.stats-strip b { color: var(--rust); font-size: 1.05em; }

.controls {
  padding: 0.75rem 1rem 0.25rem;
}

#searchInput {
  width: 100%;
  padding: 0.5rem 0.7rem;
  font-family: 'IM Fell English', serif;
  font-size: 1rem;
  border: 1.5px solid var(--ink);
  background: #F4E9CC;
  color: var(--ink);
  border-radius: 3px;
  outline-offset: 2px;
}

#searchInput:focus-visible { outline: 2px solid var(--rust); }

.tabs {
  display: flex;
  margin-top: 0.6rem;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  overflow: hidden;
}

.tab {
  flex: 1;
  padding: 0.4rem 0.5rem;
  background: var(--parchment2);
  border: none;
  font-family: 'IM Fell English', serif;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  border-right: 1.5px solid var(--ink);
}
.tab:last-child { border-right: none; }
.tab.active { background: var(--lagoon); color: var(--parchment); }
.tab:focus-visible { outline: 2px solid var(--rust); outline-offset: -2px; }

.journey-btn {
  margin: 0.7rem 1rem 0.2rem;
  padding: 0.5rem 0.6rem;
  background: var(--rust);
  color: var(--parchment);
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  font-family: 'IM Fell English', serif;
  font-size: 0.98rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.journey-btn:hover { background: #8C4223; }
.journey-btn:active { transform: translateY(1px); }
.journey-btn.on { background: var(--lagoon); }
.journey-btn:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }

.entry-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0 0.6rem 1rem 0.6rem;
  overflow-y: auto;
  flex: 1 1 auto;
}

.entry {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.55rem 0.5rem;
  margin-bottom: 0.35rem;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
}

.entry:hover, .entry:focus-visible {
  background: rgba(15,59,58,0.08);
  border-color: var(--lagoon2);
  outline: none;
}

.entry-num {
  font-family: 'Pirata One', serif;
  font-size: 1.3rem;
  color: var(--rust);
  min-width: 1.6rem;
  text-align: right;
  line-height: 1.1;
}

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

.entry-name {
  font-weight: bold;
  font-size: 1.02rem;
  line-height: 1.2;
}

.entry-place {
  font-size: 0.85rem;
  color: var(--lagoon);
  font-style: italic;
}

.entry-mugs { font-size: 0.8rem; letter-spacing: 1px; }

.empty-note {
  padding: 1.2rem 0.7rem;
  font-style: italic;
  color: var(--lagoon);
  opacity: 0.75;
  text-align: center;
}

/* mobile drawer handle */
.logbook-handle {
  display: none;
  position: absolute;
  z-index: 20;
  left: 0.75rem;
  bottom: 0.75rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--gold);
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--shadow);
}

@media (max-width: 760px) {
  .logbook {
    position: absolute;
    inset: 0 15% 0 0;
    max-width: 320px;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
  }
  .logbook.drawer-open { transform: translateX(0); }
  .logbook-handle { display: block; }
  .masthead { padding: 0.7rem 1rem 0.9rem; }
  .tagline { font-size: 0.85rem; }
}

/* ---------- markers ---------- */

.tiki-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 4px;
  background: radial-gradient(circle at 35% 30%, #5A3A22, #2B1B12);
  border: 2px solid var(--gold);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  font-size: 18px;
  transform: rotate(45deg);
}
.tiki-marker span { transform: rotate(-45deg); }

.wishlist-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: repeating-conic-gradient(var(--parchment) 0 8deg, transparent 8deg 16deg);
  border: 2px dashed var(--rust);
}

.wishlist-marker svg { width: 16px; height: 16px; }

.tiki-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cluster-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #E0B23A, var(--gold) 60%, #8a6b16 100%);
  border: 2px solid var(--ink);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  font-size: 15px;
}
.cluster-small  { width: 34px; height: 34px; }
.cluster-medium { width: 42px; height: 42px; font-size: 17px; }
.cluster-large  { width: 50px; height: 50px; font-size: 19px; }

.cluster-count {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--ink);
  color: var(--parchment);
  font-family: 'IM Fell English', serif;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 1.5px solid var(--gold);
}

/* ---------- postcard popup ---------- */

.leaflet-popup-content-wrapper {
  background: transparent;
  box-shadow: none;
  padding: 0;
}
.leaflet-popup-content { margin: 0; width: 240px !important; }
.leaflet-popup-tip { background: var(--parchment); }

.postcard {
  background: var(--parchment);
  background-image: radial-gradient(circle at 15% 85%, rgba(166,81,44,0.08), transparent 50%);
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  padding: 0.7rem 0.8rem 0.6rem;
  position: relative;
}

.seal {
  position: absolute;
  top: -10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--rust);
  border: 2px solid var(--ink);
}
.seal::after {
  content: "🌺";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.pc-name {
  font-family: 'Pirata One', serif;
  font-size: 1.25rem;
  margin: 0 1.6rem 0.1rem 0;
  color: var(--rust);
  line-height: 1.1;
}

.pc-place {
  margin: 0 0 0.3rem;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--lagoon);
}

.pc-mugs {
  margin: 0 0 0.3rem;
  font-size: 0.95rem;
  letter-spacing: 2px;
}

.pc-notes {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  line-height: 1.35;
}

.pc-date {
  margin: 0;
  font-size: 0.78rem;
  color: var(--lagoon);
  border-top: 1px dashed var(--rust);
  padding-top: 0.3rem;
}

/* ---------- leaflet chrome restyle ---------- */

.leaflet-control-zoom a {
  background: var(--parchment) !important;
  color: var(--ink) !important;
  border-color: var(--ink) !important;
}
.leaflet-control-attribution {
  background: rgba(232,216,176,0.85) !important;
  font-size: 10px !important;
}

/* ---------- footer ---------- */

.credits {
  flex: 0 0 auto;
  background: var(--ink);
  color: var(--parchment2);
  text-align: center;
  font-size: 0.78rem;
  padding: 0.35rem;
}
.credits a { color: var(--gold); }
