*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  --cream:#fbf7ef;
  --gold:#d7b674;
  --gold-l:#eccb89;
  --gold-d:#b8954f;
  --ink:#2c2416;
  --muted:#6b5d4a;
  --white:#fff;
  --sage:#8a9a7b;
  --line:rgba(44,36,22,.1);
  --radius:16px;
}
html,body{height:100%}
body{
  font-family:'Outfit',system-ui,sans-serif;
  background:var(--cream);
  color:var(--ink);
  line-height:1.55;
  overflow:hidden;
}
a{color:inherit;text-decoration:none}

#app{display:flex;height:100vh;width:100%}

#panel{
  width:380px;min-width:380px;max-width:100%;
  background:var(--white);
  border-right:1px solid var(--line);
  display:flex;flex-direction:column;
  z-index:1000;
  overflow:hidden;
}
.panel-scroll{flex:1;overflow-y:auto;padding:0 20px 20px}

.panel-head{
  padding:18px 20px 14px;
  border-bottom:1px solid var(--line);
  background:var(--white);
  flex-shrink:0;
}
.back{
  display:inline-flex;align-items:center;gap:6px;
  font-size:.72rem;font-weight:600;color:var(--muted);
  letter-spacing:.04em;text-transform:uppercase;margin-bottom:10px;
  transition:color .2s;
}
.back:hover{color:var(--ink)}
.logo{font-family:'Fraunces',serif;font-size:1.05rem;font-weight:600}
.logo em{font-style:italic;color:var(--gold-d)}
.sub{font-size:.78rem;color:var(--muted);margin-top:4px;line-height:1.45}

.section-label{
  font-size:.62rem;font-weight:700;letter-spacing:.16em;
  text-transform:uppercase;color:var(--gold-d);margin:18px 0 8px;
}

.filtros{display:flex;flex-direction:column;gap:4px}
.filtro{
  display:flex;align-items:center;gap:10px;
  padding:8px 10px;border-radius:10px;cursor:pointer;
  font-size:.82rem;color:var(--ink);transition:background .15s;
  border:1px solid transparent;
}
.filtro:hover{background:rgba(215,182,116,.08)}
.filtro input{accent-color:var(--gold-d);width:15px;height:15px;flex-shrink:0}
.filtro .dot{width:10px;height:10px;border-radius:50%;flex-shrink:0;border:1.5px solid rgba(44,36,22,.15)}
.filtro .count{margin-left:auto;font-size:.72rem;color:var(--muted);font-weight:600}

.stats{
  display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin-top:4px;
}
@media(max-width:400px){.stats{grid-template-columns:repeat(2,1fr)}}
.stat{
  background:var(--cream);border-radius:10px;padding:10px 8px;text-align:center;
  border:1px solid var(--line);
}
.stat b{display:block;font-size:1.1rem;color:var(--gold-d);font-weight:700}
.stat span{font-size:.62rem;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}

.corredores{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
.chip{
  font-size:.72rem;padding:5px 10px;border-radius:100px;
  border:1px solid var(--line);background:var(--cream);
  cursor:pointer;transition:all .15s;color:var(--muted);
}
.chip:hover,.chip.active{
  border-color:var(--gold);background:rgba(215,182,116,.15);color:var(--ink);
}

.detail{
  margin-top:16px;padding:16px;border-radius:var(--radius);
  background:var(--cream);border:1px solid var(--line);
  display:none;
}
.detail.visible{display:block;animation:fadeIn .3s ease}
@keyframes fadeIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
.detail h3{font-family:'Fraunces',serif;font-size:1.15rem;margin-bottom:4px}
.detail .meta{font-size:.72rem;color:var(--muted);margin-bottom:10px}
.detail .badge{
  display:inline-block;font-size:.62rem;font-weight:700;
  letter-spacing:.08em;text-transform:uppercase;
  padding:3px 9px;border-radius:100px;margin-bottom:10px;color:var(--white);
}
.detail p{font-size:.82rem;color:var(--muted);margin-bottom:12px;line-height:1.55}
.detail .capas{display:grid;gap:6px}
.detail .capa{
  display:flex;justify-content:space-between;gap:8px;
  font-size:.75rem;padding:6px 0;border-bottom:1px solid var(--line);
}
.detail .capa span:first-child{color:var(--muted);text-transform:capitalize}
.detail .capa span:last-child{text-align:right;font-weight:500;max-width:58%}
.conf{
  display:block;margin-top:10px;font-size:.65rem;
  letter-spacing:.06em;text-transform:uppercase;color:var(--gold-d);
}

#map-wrap{flex:1;position:relative;min-width:0}
#map{height:100%;width:100%;background:#e8e0d4}

.map-legend{
  position:absolute;bottom:20px;left:20px;z-index:500;
  background:rgba(255,255,255,.94);backdrop-filter:blur(8px);
  border:1px solid var(--line);border-radius:12px;
  padding:12px 14px;font-size:.72rem;max-width:220px;
  box-shadow:0 8px 24px rgba(44,36,22,.08);
}
.map-legend h4{
  font-size:.62rem;font-weight:700;letter-spacing:.12em;
  text-transform:uppercase;color:var(--gold-d);margin-bottom:8px;
}
.map-legend div{display:flex;align-items:center;gap:8px;margin-bottom:5px;color:var(--muted)}
.map-legend i{width:8px;height:8px;border-radius:50%;flex-shrink:0}

.leaflet-popup-content-wrapper{
  background:var(--white);border-radius:12px;
  border:1px solid var(--line);box-shadow:0 12px 32px rgba(44,36,22,.12);
  font-family:'Outfit',sans-serif;
}
.leaflet-popup-tip{background:var(--white)}
.leaflet-popup-content{margin:14px 16px;min-width:220px}
.pop h3{font-family:'Fraunces',serif;font-size:1rem;margin-bottom:2px}
.pop .prov{font-size:.72rem;color:var(--muted);margin-bottom:8px}
.pop .est{
  display:inline-block;font-size:.62rem;font-weight:700;
  letter-spacing:.06em;text-transform:uppercase;
  padding:2px 8px;border-radius:100px;color:var(--white);margin-bottom:8px;
}
.pop .hab{font-size:.78rem;margin-bottom:8px}
.pop .lect{font-size:.78rem;color:var(--muted);line-height:1.45;margin-bottom:10px}
.pop .more{
  font-size:.75rem;font-weight:600;color:var(--gold-d);cursor:pointer;
  border:none;background:none;padding:0;font-family:inherit;
}
.pop .more:hover{text-decoration:underline}

.mobile-toggle{
  display:none;position:absolute;top:12px;left:12px;z-index:600;
  background:var(--white);border:1px solid var(--line);border-radius:10px;
  padding:10px 14px;font-size:.78rem;font-weight:600;cursor:pointer;
  box-shadow:0 4px 16px rgba(44,36,22,.1);
}

@media(max-width:860px){
  #app{flex-direction:column}
  #panel{
    width:100%;min-width:0;max-height:45vh;
    border-right:none;border-bottom:1px solid var(--line);
    transform:translateY(0);transition:max-height .3s;
  }
  #panel.collapsed{max-height:52px;overflow:hidden}
  #panel.collapsed .panel-scroll{display:none}
  .mobile-toggle{display:block}
  #map-wrap{min-height:55vh}
}

.panel-note{
  margin-top:16px;padding:12px;border-radius:10px;
  background:rgba(215,182,116,.1);border:1px solid rgba(215,182,116,.25);
  font-size:.72rem;color:var(--muted);line-height:1.5;
}
.panel-note a{color:var(--gold-d);font-weight:600}

.foto{margin:0 0 12px;border-radius:10px;overflow:hidden;background:var(--cream)}
.foto img{display:block;width:100%;aspect-ratio:16/10;object-fit:cover}
.foto-credit{
  display:block;padding:6px 10px;font-size:.58rem;color:var(--muted);
  line-height:1.35;background:rgba(44,36,22,.04);
}
.foto--broken img{display:none}
.foto--broken::after{content:'Imagen no disponible';display:block;padding:24px;text-align:center;font-size:.78rem;color:var(--muted);background:var(--cream)}
.foto-detail{margin:-4px -4px 14px}
.pop .foto-pop img{aspect-ratio:16/9}
.leaflet-popup-content .foto{margin-bottom:8px}
.leaflet-popup-content .foto-pop{margin:0 0 10px;border-radius:8px}
