/* Red Rock Atlas — clean, modern, lots of white space */
:root {
  --bg: #F6F3EE;
  --paper: #FFFFFF;
  --ink: #1E1A16;
  --ink-soft: #5C564E;
  --ink-faint: #8A847A;
  --line: #E7E1D8;
  --sand: #F3EBE3;
  --accent: #C0562F;
  --accent-soft: #F3E4DC;
  --header-h: 64px;
  --shadow: 0 10px 40px rgba(40, 30, 20, 0.09);
  --shadow-soft: 0 2px 10px rgba(40, 30, 20, 0.05);
  --radius: 18px;
  --font: "Outfit", "Helvetica Neue", system-ui, sans-serif;
  --panel-w: 352px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input { font-family: inherit; }

/* ---- Header ---- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 16px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 32px; height: 32px; flex: none; display: block; }
.brand-text h1 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.placeholder-tag {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 1px;
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.basemap {
  display: flex;
  background: var(--sand);
  border-radius: 999px;
  padding: 3px;
}
.seg {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.2;
}
.seg.is-on {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}
.seg:hover:not(.is-on) { color: var(--ink); }

.filters-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.filters-toggle:hover { border-color: #d4cdc3; }

/* ---- Map ---- */
#map {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: #e8e4de;
}
.leaflet-container { font-family: var(--font); background: #e8e4de; }
.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow) !important;
  border-radius: 12px !important;
  overflow: hidden;
  margin-right: 16px !important;
  margin-bottom: 16px !important;
}
.leaflet-control-zoom a {
  width: 34px !important;
  height: 34px !important;
  line-height: 34px !important;
  color: var(--ink) !important;
  border-bottom-color: var(--line) !important;
  font-size: 16px !important;
}
.leaflet-control-attribution {
  background: rgba(255,255,255,0.78) !important;
  color: var(--ink-faint) !important;
  font-size: 10px !important;
  max-width: 50vw;
}

/* Markers */
.rra-pin { background: none !important; border: none !important; }
.rra-pin .pin {
  width: 32px;
  height: 32px;
  background: var(--c);
  border: 2.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(30,20,10,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.rra-pin .pin svg { width: 15px; height: 15px; fill: #fff; }
.rra-pin.is-active .pin,
.rra-pin:hover .pin { transform: scale(1.14); }

.approx-badge {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--c, var(--accent));
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
  font-family: var(--font);
  pointer-events: none;
}
.approx-wrap {
  background: none !important;
  border: none !important;
  overflow: visible !important;
  width: auto !important;
  height: auto !important;
}

/* ---- Panel ---- */
.panel {
  position: fixed;
  top: calc(var(--header-h) + 16px);
  left: 16px;
  width: var(--panel-w);
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
  z-index: 30;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
  scrollbar-width: thin;
  scrollbar-color: #d8d0c6 transparent;
}
.panel-handle { display: none; }
.panel-head { margin-bottom: 6px; position: relative; padding-right: 20px; }
.panel-head h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.panel-sub { font-size: 13px; color: var(--ink-soft); margin-top: 4px; line-height: 1.4; }
.panel-close {
  display: none;
  position: absolute;
  top: -4px; right: -6px;
  width: 32px; height: 32px;
  border: 0; background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 8px;
}
.spot-count {
  font-size: 12px;
  color: var(--ink-faint);
  margin: 14px 0 4px;
  font-weight: 500;
}

.section { margin-top: 22px; }
.section h3,
.respect h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 10px;
}
.hint { font-size: 12px; color: var(--ink-soft); margin: -4px 0 10px; line-height: 1.4; }

.layer-list { display: flex; flex-direction: column; gap: 2px; }
.layer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
}
.layer-row:hover { background: var(--bg); }
.layer-swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.layer-swatch svg { width: 11px; height: 11px; fill: #fff; }
.layer-name { flex: 1; font-size: 14px; font-weight: 500; }
.switch {
  width: 36px; height: 20px;
  background: #ddd6cc;
  border-radius: 999px;
  position: relative;
  flex: none;
  transition: background 0.15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.15s;
}
.layer-row.is-on .switch { background: var(--accent); }
.layer-row.is-on .switch::after { transform: translateX(16px); }
.layer-row input { position: absolute; opacity: 0; pointer-events: none; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.chip:hover { border-color: #cfc7bb; }
.chip.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 11px;
  background: var(--bg);
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.search:focus-within { border-color: #cbb9ad; background: #fff; color: var(--ink-soft); }
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 13px;
  padding: 9px 0;
  color: var(--ink);
  outline: none;
}
.search input::placeholder { color: var(--ink-faint); }

.interest-list {
  max-height: 208px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 2px 0;
  scrollbar-width: thin;
  scrollbar-color: #d8d0c6 transparent;
}
.interest-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 6px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 450;
  user-select: none;
}
.interest-row:hover { background: var(--bg); }
.interest-row.is-hidden { display: none; }
.check {
  width: 16px; height: 16px;
  border: 1.5px solid #c9c1b6;
  border-radius: 4px;
  flex: none;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
}
.interest-row.is-on .check {
  background: var(--accent);
  border-color: var(--accent);
}
.interest-row.is-on .check::after {
  content: "";
  width: 8px; height: 5px;
  border-left: 1.8px solid #fff;
  border-bottom: 1.8px solid #fff;
  transform: rotate(-45deg) translate(0.5px, -0.5px);
}
.interest-empty {
  font-size: 13px;
  color: var(--ink-faint);
  padding: 10px 6px;
}

.respect {
  margin-top: 24px;
  background: var(--sand);
  border-radius: 12px;
  padding: 14px 14px 13px;
}
.respect h3 { color: #8a5a32; }
.respect p { font-size: 12.5px; line-height: 1.5; color: var(--ink-soft); }

.panel-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.panel-foot p { font-size: 11px; line-height: 1.55; color: var(--ink-faint); }
.panel-foot p + p { margin-top: 8px; }
.text-btn {
  border: 0; background: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  letter-spacing: 0.02em;
}
.text-btn:hover { text-decoration: underline; }

/* ---- Card ---- */
.card {
  position: fixed;
  top: calc(var(--header-h) + 16px);
  right: 16px;
  width: 360px;
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
  z-index: 35;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.card[hidden] { display: none !important; }
.card-close {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 2;
  width: 32px; height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  color: var(--ink);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-soft);
}
.card-close:hover { background: #fff; }
.card-photo {
  height: 200px;
  background: var(--sand);
  flex: none;
  overflow: hidden;
  position: relative;
}
.card-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.card-photo .ph {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(160deg, #efe6dc, #e3d4c6);
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 500;
}
.card-photo .ph svg { width: 36px; height: 36px; opacity: 0.45; }
.card-body { padding: 16px 20px 20px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--sand);
  color: var(--ink-soft);
}
.tag.is-layer { color: #fff; background: var(--c, var(--accent)); }
.card-body h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.approx-flag {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 8px;
  border-radius: 6px;
}
.approx-flag[hidden] { display: none !important; }
.card-vehicles { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.v-chip {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--bg);
}
.card-desc {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  font-weight: 400;
}
.card-meta {
  margin-top: 14px;
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.45;
}

/* ---- Modal ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(30, 26, 22, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none !important; }
.modal-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(560px, 100%);
  max-height: min(80vh, 720px);
  overflow-y: auto;
  padding: 24px 26px 28px;
  position: relative;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.modal-head h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.modal-head .card-close { position: static; }
.modal-lead { font-size: 13px; color: var(--ink-soft); line-height: 1.5; margin-bottom: 16px; }
.credits-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.credits-list li { font-size: 12.5px; line-height: 1.45; color: var(--ink-soft); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.credits-list li strong { color: var(--ink); font-weight: 600; display: block; margin-bottom: 2px; }
.credits-list a { color: var(--accent); text-decoration: none; }
.credits-list a:hover { text-decoration: underline; }

.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(30,26,22,0.25);
}

/* ---- Mobile ---- */
@media (max-width: 840px) {
  :root { --header-h: 58px; }
  .filters-toggle { display: inline-flex; }
  .brand-text h1 { font-size: 15px; }
  .basemap .seg { padding: 6px 10px; font-size: 12px; }
  .site-header { padding: 0 12px 0 12px; }

  .panel {
    top: auto;
    left: 0; right: 0; bottom: 0;
    width: 100%;
    max-height: 86vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(110%);
    transition: transform 0.28s ease;
    padding-top: 10px;
  }
  .panel.is-open { transform: translateY(0); }
  .panel-handle {
    display: block;
    width: 36px; height: 4px;
    background: #d8d0c6;
    border-radius: 4px;
    margin: 4px auto 10px;
  }
  .panel-close { display: flex; align-items: center; justify-content: center; }
  .backdrop.is-on { display: block; }

  .card {
    top: auto;
    right: 0; left: 0; bottom: 0;
    width: 100%;
    max-height: 72vh;
    border-radius: 20px 20px 0 0;
  }
  .card-photo { height: 168px; }

  .leaflet-control-zoom { margin-bottom: 20px !important; margin-right: 12px !important; }
  .leaflet-control-attribution { max-width: 70vw; }
}

@media (max-width: 420px) {
  .placeholder-tag { display: none; }
}
