﻿:root {
  --cream: #f6efe1;
  --paper: #fffdf8;
  --ink: #1f160d;
  --muted: #655341;
  --line: #dcc4a1;
  --accent: #bf5f15;
  --accent-soft: #fff0dd;
  --shadow: 0 10px 26px rgba(28, 18, 8, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, sans-serif;
  background: radial-gradient(circle at top right, #ffefdb 0%, var(--cream) 42%, #f2e9d8 100%);
  color: var(--ink);
  overflow-x: hidden;
}

.explorer-header {
  max-width: 1380px;
  margin: 0 auto;
  padding: 18px 20px 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  margin: 6px 0;
  font-family: "Playfair Display", serif;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.02;
}

.subtitle {
  margin: 0;
  color: #493a2a;
  font-size: 18px;
  line-height: 1.35;
}

.header-actions {
  margin-top: 12px;
}

.ghost-btn {
  text-decoration: none;
  display: inline-block;
  border: 1px solid #c9aa81;
  background: #fff2de;
  color: #2b1f14;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
}

.mobile-only-btn {
  display: none;
}

.meta-chip {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 14px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.controls {
  max-width: 1380px;
  margin: 0 auto;
  padding: 8px 20px;
  display: grid;
  grid-template-columns: 1.25fr 0.9fr 1.45fr;
  gap: 12px;
}

.controls-top {
  display: none;
}

.control {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 12px;
  position: relative;
  z-index: 100;
  /* Ensure search items can float over map */
}

.control label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 800;
}

#searchInput {
  width: 100%;
  border: 1px solid #cfb494;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 18px;
}

.search-results {
  position: absolute;
  left: 0;
  top: 100%;
  width: 440px;
  /* Wider than the input for better readability */
  background: #fff;
  border: 1px solid #cfb494;
  border-radius: 12px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
  max-height: 480px;
  overflow: auto;
  z-index: 5000;
  /* Extremely high to clear all map layers */
  animation: slideDown 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-results.hidden {
  display: none;
}

.search-group {
  padding: 8px 10px 2px;
}

.search-group-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7a6144;
  margin-bottom: 6px;
}

.search-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #2f2315;
}

.search-item:hover {
  background: #fff2de;
}

.range-control input[type="range"] {
  width: 100%;
  accent-color: #2f6d74;
  margin-bottom: 8px;
}

.time-label {
  margin: 0;
  font-size: 14px;
  color: #433321;
}

.region-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid #d28138;
  border-radius: 999px;
  background: #ffe8cd;
  color: #2f1f0f;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
}

.chip.active {
  background: #c96212;
  color: #fff;
  border-color: #c96212;
}

.explorer-main {
  max-width: 1380px;
  margin: 0 auto;
  padding: 8px 20px 22px;
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 12px;
}

.map-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 620px;
  position: relative;
  animation: panelIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#mapContainer {
  width: 100%;
  height: 100%;
  min-height: 620px;
}

.leaflet-container {
  background: #d8e4ec;
  font-family: "Inter", system-ui, sans-serif;
}

.place-badge {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #c96212;
  color: #fff;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform-origin: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  animation: popIn 0.22s ease;
}

.place-badge.active {
  transform: scale(1.16);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.26);
  filter: saturate(1.15);
}

.map-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 500;
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(255, 252, 247, 0.93);
  border: 1px solid #d6bb97;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(22, 14, 7, 0.12);
  padding: 8px 10px;
}

.map-hud p {
  margin: 0;
  font-size: 12px;
  color: #4b3b2a;
}

.map-hud button {
  border: 1px solid #caa87e;
  border-radius: 999px;
  background: #fff0dc;
  color: #2f2013;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
}

.map-hover {
  position: absolute;
  z-index: 600;
  min-width: 210px;
  max-width: 260px;
  border: 1px solid #d2b28a;
  border-radius: 12px;
  background: rgba(255, 252, 247, 0.98);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
  padding: 10px;
  pointer-events: none;
}

.map-hover-title {
  margin: 0;
  font-weight: 800;
  font-size: 14px;
}

.map-hover-meta {
  margin: 3px 0 8px;
  font-size: 12px;
  color: #614d38;
}

.map-hover-stats {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.map-hover-stats span {
  font-size: 11px;
  border: 1px solid #ddc4a6;
  border-radius: 999px;
  padding: 3px 8px;
  background: #fff3e2;
  color: #453323;
}

.drawer {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 14px;
  min-height: 620px;
  max-height: 620px;
  overflow: auto;
  animation: panelIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.drawer-kicker {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: #7b6142;
}

.mobile-drawer-toggle {
  display: none;
}

.drawer h2 {
  margin: 6px 0;
  font-size: 30px;
  line-height: 1.08;
  font-family: "Playfair Display", serif;
}

.drawer-meta {
  margin: 0;
  color: #5e4c39;
  font-size: 14px;
  line-height: 1.45;
}

.drawer-nav {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}

.drawer-nav button {
  border: 1px solid #c9aa81;
  border-radius: 10px;
  background: #fff2de;
  color: #2b1f14;
  font-weight: 700;
  padding: 8px 10px;
  cursor: pointer;
}

.drawer-nav button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.place-stats {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.place-stat {
  border: 1px solid #ddc1a0;
  border-radius: 999px;
  background: #fff4e2;
  color: #493626;
  font-size: 12px;
  padding: 4px 10px;
  font-weight: 700;
}

.place-timeline {
  margin-top: 10px;
  border: 1px solid #dfc6a8;
  border-radius: 12px;
  background: #fff8ee;
  padding: 10px;
}

.timeline-labels {
  margin: 0;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #6c5841;
}

.timeline-track {
  margin-top: 7px;
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: #ebdbc8;
}

.timeline-dot {
  position: absolute;
  top: -3px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(20, 10, 0, 0.2);
}

.dish-tabs {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dish-tab {
  border: 1px solid #d7b58e;
  border-radius: 999px;
  background: #fffaf1;
  color: #3a2a19;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}

.dish-tab.active {
  background: #c96212;
  color: #fff;
  border-color: #c96212;
}

.dish-card {
  margin-top: 14px;
  border: 1px solid #ddc4a6;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff9ef 0%, #fff2df 100%);
  padding: 12px;
  animation: fadeLift 0.24s ease;
}

.dish-name {
  margin: 0;
  font-size: 22px;
  font-family: "Playfair Display", serif;
}

.dish-local {
  margin: 4px 0 10px;
  font-size: 14px;
  color: #6b563f;
}

.meta-row {
  margin: 0 0 10px;
  font-size: 13px;
  color: #473626;
}

.story {
  margin: 0 0 10px;
  line-height: 1.5;
  font-size: 14px;
}

.data-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.data-list li {
  font-size: 13px;
  color: #3d2d1e;
}

.hidden {
  display: none !important;
}

.mobile-footer {
  display: none;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popIn {
  from {
    transform: scale(0.88);
  }

  to {
    transform: scale(1);
  }
}

@keyframes fadeLift {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1120px) {
  body {
    background: #f7efdf;
    min-height: 100dvh;
  }

  .explorer-header {
    max-width: none;
    margin: 0;
    padding: 6px 10px;
    position: sticky;
    top: 0;
    z-index: 880;
    background: rgba(247, 239, 223, 0.98);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #e1caaa;
    align-items: center;
    gap: 8px;
  }

  .explorer-header>div:first-child {
    min-width: 0;
    flex: 1;
  }

  .eyebrow {
    display: none;
  }

  .explorer-header h1 {
    margin: 0;
    font-size: 17px;
    line-height: 1.15;
  }

  .subtitle {
    display: none;
  }

  .header-actions {
    margin-top: 3px;
    display: flex;
    gap: 5px;
  }

  .ghost-btn {
    padding: 3px 7px;
    font-size: 10px;
  }

  .mobile-only-btn {
    display: inline-block;
  }

  .meta-chip {
    padding: 4px 8px;
    font-size: 9px;
    max-width: 40%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .explorer-main {
    max-width: none;
    margin: 0;
    padding: 4px 6px 46px;
    grid-template-columns: 1fr;
  }

  .map-panel {
    min-height: calc(100dvh - 96px);
    border-radius: 10px;
  }

  #mapContainer {
    min-height: calc(100dvh - 96px);
    max-height: calc(100dvh - 96px);
  }

  .map-hud {
    top: 6px;
    left: 6px;
    right: auto;
    max-width: 70%;
    padding: 4px 6px;
    gap: 5px;
    border-radius: 8px;
  }

  .map-hud p {
    margin: 0;
    font-size: 9px;
    line-height: 1.2;
  }

  .map-hud button {
    padding: 3px 6px;
    font-size: 9px;
  }

  .controls {
    position: fixed;
    inset: 0;
    z-index: 960;
    max-width: none;
    margin: 0;
    padding: 10px 8px 50px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    background: #f8f1e3;
    transform: translateX(100%);
    transition: transform 0.24s ease;
  }

  body.mobile-filters-open .controls {
    transform: translateX(0);
  }

  .controls-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
  }

  .controls-top p {
    margin: 0;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.03em;
  }

  .controls-top button {
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    padding: 7px 14px;
    font-size: 12px;
  }

  .control {
    padding: 8px;
    border-radius: 14px;
  }

  .control label {
    font-size: 11px;
    margin-bottom: 5px;
  }

  #searchInput {
    font-size: 14px;
    padding: 7px 8px;
    border-radius: 10px;
  }

  .search-results {
    position: static;
    margin-top: 6px;
    max-height: 200px;
  }

  .chip {
    font-size: 10px;
    padding: 4px 7px;
  }

  .region-chips {
    max-height: 180px;
    overflow: auto;
    gap: 5px;
  }

  .drawer {
    position: fixed;
    inset: 0;
    z-index: 955;
    margin: 0;
    border-radius: 0;
    min-height: 0;
    max-height: none;
    padding: 8px 8px 50px;
    transform: translateX(100%);
    transition: transform 0.24s ease;
    box-shadow: none;
    border-left: 0;
    border-right: 0;
  }

  body.mobile-details-open .drawer {
    transform: translateX(0);
  }

  .mobile-drawer-toggle {
    display: none;
  }

  .drawer-kicker {
    font-size: 9px;
  }

  .drawer h2 {
    font-size: 24px;
    line-height: 1.02;
    margin: 4px 0;
  }

  .drawer-meta {
    font-size: 12px;
    line-height: 1.35;
  }

  .drawer-nav {
    margin-top: 8px;
  }

  .drawer-nav button {
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 8px;
  }

  .place-stats {
    margin-top: 8px;
    gap: 5px;
  }

  .place-stat {
    font-size: 10px;
    padding: 3px 7px;
  }

  .place-timeline {
    margin-top: 6px;
    overflow-x: auto;
    padding: 8px;
  }

  .dish-tabs {
    margin-top: 8px;
    max-height: 100px;
    overflow: auto;
    padding-right: 3px;
    gap: 5px;
  }

  .dish-tab {
    font-size: 11px;
    padding: 4px 8px;
  }

  .dish-card {
    margin-top: 8px;
    padding: 10px;
  }

  .dish-name {
    font-size: 18px;
  }

  .dish-local {
    font-size: 12px;
    margin: 2px 0 6px;
  }

  .meta-row {
    font-size: 11px;
  }

  .story {
    font-size: 13px;
    line-height: 1.4;
  }

  .data-list li {
    font-size: 12px;
  }

  .mobile-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    background: rgba(255, 250, 241, 0.98);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border-top: 1px solid #d3b38a;
  }

  .mobile-footer button {
    border: 0;
    background: transparent;
    color: #2e2012;
    font-weight: 800;
    font-size: 10px;
    padding: 7px 4px;
    cursor: pointer;
    letter-spacing: 0.02em;
  }

  body:not(.mobile-filters-open):not(.mobile-details-open) #mobileExploreBtn,
  body.mobile-filters-open #mobileFiltersBtn,
  body.mobile-details-open #mobileDetailsBtn {
    background: #ffe9ce;
  }

  body.mobile-filters-open .leaflet-control-container,
  body.mobile-details-open .leaflet-control-container {
    display: none;
  }

  body.mobile-filters-open .map-hud,
  body.mobile-details-open .map-hud {
    display: none;
  }
}