:root {
  color-scheme: light;
  --bg: #f7f1e8;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #fffaf3;
  --text: #1f1a17;
  --muted: #6e6259;
  --line: rgba(95, 72, 58, 0.14);
  --accent: #2f6f5e;
  --accent-dark: #234f44;
  --accent-soft: #dcefe8;
  --shadow: 0 18px 50px rgba(50, 32, 22, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.75), transparent 26%),
    linear-gradient(180deg, #f7f1e8 0%, #fbf6ef 48%, #efe3d3 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

h1,
h2,
h3 {
  font-family: "Fraunces", serif;
  line-height: 1.05;
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
  font-size: clamp(1.4rem, 2vw, 2rem);
}

h3 {
  font-size: 1.2rem;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(28px);
  opacity: 0.24;
  pointer-events: none;
  z-index: -1;
}

.ambient-one {
  top: 2rem;
  left: -4rem;
  width: 16rem;
  height: 16rem;
  background: #9bcfbf;
}

.ambient-two {
  right: -3rem;
  top: 12rem;
  width: 18rem;
  height: 18rem;
  background: #d8b68c;
}

.hero {
  width: min(1400px, calc(100% - 1.2rem));
  margin: 0 auto;
  padding: 0.7rem 0 0.9rem;
}

.topbar-cta,
.intro-strip .button {
  display: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0 0.4rem;
}


.brand {
  margin: 0;
  font-weight: 700;
  color: var(--accent-dark);
}

.topbar p:last-child,
.intro {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.topbar-cta,
.button,
.filter,
.spot-link {
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.topbar-cta:hover,
.button:hover,
.filter:hover,
.spot-link:hover {
  transform: translateY(-1px);
}

.topbar-cta,
.button,
.filter,
.spot-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.75rem 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 700;
}

.topbar-cta,
.button-primary,
.filter.is-active {
  background: var(--accent);
  color: #fff;
}

.button-secondary,
.filter,
.spot-link {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

.intro-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.intro {
  max-width: 68ch;
  font-size: 0.98rem;
}

.workspace {
  width: min(1400px, calc(100% - 1.2rem));
  margin: 0 auto 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

.controls-panel,
.map-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.map-shell {
  position: relative;
}

.controls-panel {
  display: grid;
  gap: 0.55rem;
  padding: 0.7rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter {
  cursor: pointer;
  padding: 0.46rem 0.62rem;
  font-size: 0.88rem;
}

.spot-search {
  display: grid;
  gap: 0.35rem;
}

.spot-search span,
.spot-counter,
.map-legend {
  color: var(--muted);
  font-size: 0.92rem;
}

.controls-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Desktop: keep only category filters above the map */
@media (min-width: 641px) {
  .hero {
    display: none;
  }

  .spot-search,
  .spot-counter,
  .map-legend,
  .controls-help {
    display: none !important;
  }

  .controls-panel {
    padding: 0.5rem;
    gap: 0;
  }
}

.spot-counter {
  margin: 0;
  font-weight: 700;
}

.spot-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.62rem 0.75rem;
  background: rgba(255, 255, 255, 0.86);
  outline: none;
}

.spot-search input:focus {
  border-color: rgba(47, 111, 94, 0.45);
  box-shadow: 0 0 0 4px rgba(47, 111, 94, 0.12);
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.8rem;
  align-items: center;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  display: inline-block;
}

.legend-dot.nature { background: #2f6f5e; }
.legend-dot.mer { background: #246b8f; }
.legend-dot.patrimoine { background: #c97d32; }
.legend-dot.famille { background: #6378d6; }
.legend-dot.velo { background: #a85c89; }

.map-shell {
  padding: 0.7rem;
  display: grid;
  gap: 0.5rem;
}

.map {
  min-height: 88vh;
  height: 88vh;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.marker {
  width: 18px !important;
  height: 18px !important;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.marker span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
}

.marker-nature { background: #2f6f5e; }
.marker-mer { background: #246b8f; }
.marker-patrimoine { background: #c97d32; }
.marker-famille { background: #6378d6; }
.marker-velo { background: #a85c89; }

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(255, 250, 242, 0.98);
}

.leaflet-popup-content {
  margin: 0.9rem 1rem;
  font-family: "Inter", sans-serif;
}

.leaflet-popup-content h3 {
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
}

.leaflet-popup-content p {
  margin: 0 0 0.4rem;
  color: var(--muted);
}

.spot-tooltip {
  border: 1px solid rgba(95, 72, 58, 0.14);
  background: rgba(255, 250, 242, 0.98);
  color: var(--text);
  box-shadow: var(--shadow);
  border-radius: 16px;
  padding: 0.1rem;
}

.spot-tooltip .leaflet-tooltip-content {
  margin: 0;
}

.spot-tooltip-content {
  display: grid;
  gap: 0.25rem;
  max-width: 240px;
}

.spot-tooltip-title {
  font-weight: 800;
  color: var(--accent-dark);
}

.spot-tooltip-description {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.92rem;
}

.spot-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 26, 23, 0.35);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 1200;
}

.spot-modal-backdrop[hidden] {
  display: none;
}

.spot-modal {
  width: min(560px, 100%);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 28px 60px rgba(38, 25, 15, 0.28);
  padding: 1rem;
  display: grid;
  gap: 0.65rem;
}

.spot-modal-close {
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  font-weight: 700;
}

.spot-modal-meta,
.spot-modal-badges,
.spot-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.spot-modal-tag,
.spot-modal-badges span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.62rem;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.spot-modal-title {
  margin: 0;
}

.spot-modal-description {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.spot-modal-actions .button {
  padding: 0.5rem 0.8rem;
}

.popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.popup-actions a {
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 700;
}

.footer {
  width: min(1400px, calc(100% - 1.2rem));
  margin: 0 auto;
  padding: 0.6rem 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 980px) {
  .topbar,
  .intro-strip {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    justify-content: stretch;
  }

  .workspace {
    width: min(100% - 1rem, 1400px);
  }

  .map {
    height: 66vh;
    min-height: 66vh;
  }
}

@media (max-width: 640px) {
  .workspace,
  .footer {
    width: min(100% - 0.75rem, 1400px);
  }

  .hero,
  .ambient {
    display: none;
  }

  .controls-panel,
  .map-shell {
    border-radius: 14px;
  }

  .controls-panel {
    padding: 0.45rem;
    gap: 0.3rem;
  }

  .spot-search,
  .spot-counter,
  .map-legend,
  .controls-help {
    display: none;
  }

  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.35rem;
    padding-bottom: 0.1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .filter {
    flex: 0 0 auto;
    font-size: 0.8rem;
    padding: 0.36rem 0.56rem;
  }

  .map-shell {
    padding: 0.35rem;
  }

  .map {
    height: calc(100vh - 5.8rem);
    min-height: calc(100vh - 5.8rem);
    border-radius: 12px;
  }

  .spot-modal-backdrop {
    align-items: end;
    padding: 0;
    background: rgba(31, 26, 23, 0.24);
  }

  .spot-modal {
    width: 100%;
    max-height: 86vh;
    overflow: auto;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    padding: 0.95rem;
  }
}
