:root{
  /* Sendero de noche: dark is the identity now, light is the opt-out. */
  --ground:#0A0F0A;
  --ground-raised:#131C10;
  --ink:#EAF5E2;
  --ink-dim:#8FA382;
  --teal:#2FE0F5;
  --teal-soft:rgba(47,224,245,.14);
  --violet:#A6FF4D;
  --violet-soft:rgba(166,255,77,.14);
  --line: rgba(234,245,226,.16);
}
:root[data-theme="light"]{
  --ground:#F4F7EF;
  --ground-raised:#E8EEE0;
  --ink:#16210F;
  --ink-dim:#57624A;
  --teal:#006E86;
  --teal-soft:#CFE9EF;
  --violet:#3A6B15;
  --violet-soft:#DEEFC9;
  --line: rgba(22,33,15,.14);
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
/* Without this, <picture> (an unstyled inline box) sits between an <img>
   and its flex/grid/absolute-positioning parent, breaking every layout
   that depends on the img being a direct child. display:contents removes
   the wrapper from the box tree so the img behaves as if picture weren't there. */
picture{display:contents;}
body{
  background:var(--ground);
  color:var(--ink);
  font-family:'Karla',system-ui,sans-serif;
  -webkit-font-smoothing:antialiased;
}
::selection{ background:var(--teal); color:var(--ground); }

.page{ max-width:760px; margin:0 auto; padding:0 0 90px; }
@media (min-width:1024px){ .page{ max-width:1100px; } }

.masthead{
  display:flex; align-items:baseline; justify-content:space-between;
  padding:28px 24px 0;
  font-family:'IBM Plex Mono',monospace;
  font-size:11px; letter-spacing:.1em; text-transform:uppercase;
  color:var(--ink-dim);
}
.masthead .place{ color:var(--ink); font-weight:600; }
/* Small phones: the masthead carries brand + place + language + theme, which
   stops fitting on one line once the language switch is there. */
@media (max-width:400px){
  .masthead{ flex-wrap:wrap; gap:10px 12px; }
  .masthead-right{ margin-left:auto; }
}

.lang-switch{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:26px; height:26px; padding:0 7px; border-radius:13px;
  border:1px solid var(--line); background:none;
  color:var(--ink-dim); text-decoration:none;
  font-family:'IBM Plex Mono',monospace; font-size:10.5px; font-weight:600;
  letter-spacing:.06em; flex-shrink:0;
}
.lang-switch:hover{ border-color:var(--teal); color:var(--teal); box-shadow:0 0 14px -2px var(--teal); }
.theme-toggle{
  display:inline-flex; align-items:center; justify-content:center;
  width:26px; height:26px; border-radius:50%;
  border:1px solid var(--line); background:none; color:var(--ink-dim);
  cursor:pointer; flex-shrink:0; padding:0;
}
.theme-toggle:hover{ border-color:var(--teal); color:var(--teal); }
.theme-toggle .icon-sun{ display:none; }
:root[data-theme="light"] .theme-toggle .icon-sun{ display:block; }
:root[data-theme="light"] .theme-toggle .icon-moon{ display:none; }
.masthead-right{ display:flex; align-items:center; gap:10px; }
.back-link{
  display:inline-flex; align-items:center; gap:5px;
  color:var(--ink-dim);
  text-decoration:none;
  font-family:'IBM Plex Mono',monospace;
  font-size:11px; letter-spacing:.1em; text-transform:uppercase;
  cursor:pointer;
  border:none; background:none; padding:0;
}
.back-link:hover{ color:var(--teal); }
.back-home{ margin:56px 24px 0; }
.back-home-link{
  display:inline-flex; align-items:center; gap:8px;
  font-family:'IBM Plex Mono',monospace; font-size:12.5px; font-weight:600;
  letter-spacing:.03em; text-transform:uppercase;
  color:var(--ground); background:var(--teal);
  padding:12px 19px; text-decoration:none;
  transition:background .2s ease;
}
.back-home-link:hover{ background:var(--violet); }
.map-section{ margin:56px 24px 0; }
.map-section > .eyebrow{ margin-bottom:14px; }
.route-map-box{
  position:relative;
  border:1px solid var(--line);
  aspect-ratio:4/3;
  background:var(--ground-raised);
  overflow:hidden;
}
@media (min-width:640px){ .route-map-box{ aspect-ratio:16/9; } }
.route-map-box.is-expanded{ aspect-ratio:auto; height:80vh; }
.route-map-box .leaflet-container{ width:100%; height:100%; background:var(--ground-raised); font-family:'Karla',sans-serif; }
.map-expand-btn{
  position:absolute; z-index:400; top:10px; right:10px;
  display:flex; align-items:center; justify-content:center;
  width:32px; height:32px; padding:0; border:1px solid var(--line); border-radius:8px;
  background:var(--ground); color:var(--ink); opacity:.85; cursor:pointer;
  transition:opacity .2s ease, transform .2s ease;
  background:color-mix(in srgb, var(--ground) 72%, transparent);
  backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px);
}
.map-expand-btn:hover{ opacity:1; }
.map-expand-btn.is-active svg{ transform:rotate(180deg); }
.wikiloc-credit{
  margin-top:10px;
  font-family:'IBM Plex Mono',monospace; font-size:10.5px; color:var(--ink-dim);
}
.wikiloc-credit a{ color:var(--teal); text-decoration:none; }
.wikiloc-credit a:hover{ text-decoration:underline; }

.hero{ padding:22px 24px 0; }
.hero-chart{
  position:relative;
  overflow:hidden;
  background:var(--ground-raised);
  border:1px solid var(--line);
  opacity:0;
  animation: rise .9s .1s cubic-bezier(.2,.7,.2,1) forwards;
}
.hero-chart svg{ display:block; width:100%; height:auto; }
.elev-tags{
  display:flex; justify-content:space-between; align-items:flex-start;
  padding:10px 20px 0;
  font-family:'IBM Plex Mono',monospace;
  font-size:11px;
  color:var(--ink-dim);
}
.elev-tags .end{ display:flex; flex-direction:column; gap:2px; }
.elev-tags .end.right{ align-items:flex-end; text-align:right; }
.elev-tags .end .v{ font-weight:600; color:var(--ink); font-size:13px; }
.elev-tags .end .k{ text-transform:uppercase; letter-spacing:.06em; font-size:9.5px; }
.elev-tags .mid{ align-self:center; }
.elev-marker{ cursor:default; }
.elev-legend{
  display:flex; flex-wrap:wrap; gap:6px 14px;
  padding:12px 20px 0;
  font-family:'IBM Plex Mono',monospace; font-size:10.5px; color:var(--ink-dim);
}
.elev-legend-item{ display:inline-flex; align-items:center; gap:6px; }
.elev-legend-item .num{
  display:inline-flex; align-items:center; justify-content:center;
  width:15px; height:15px; border-radius:50%;
  background:var(--teal); color:var(--ground);
  font-size:9px; font-weight:700;
  flex-shrink:0;
}
.hero-label{ padding:18px 26px 26px; }
.eyebrow{
  font-family:'IBM Plex Mono',monospace;
  font-size:11px; letter-spacing:.13em; text-transform:uppercase;
  color:var(--ink-dim);
  display:flex; flex-wrap:wrap; gap:8px; align-items:center;
  margin:0 0 10px;
}
.eyebrow .sep{ opacity:.5; }
h1{
  font-family:'Fraunces',serif;
  font-weight:900;
  font-size:clamp(2.4rem, 9vw, 4.4rem);
  line-height:.94;
  letter-spacing:-.01em;
  text-wrap:balance;
  margin:0;
}
h1 em{ font-style:italic; font-weight:600; color:var(--teal); }
.full-name{
  font-family:'IBM Plex Mono',monospace;
  font-size:11px; color:var(--ink-dim);
  margin:10px 0 0; line-height:1.5; max-width:60ch;
}

@keyframes rise{ from{ opacity:0; transform:translateY(10px); } to{ opacity:1; transform:translateY(0); } }
@media (prefers-reduced-motion: reduce){ .hero-chart{ animation:none; opacity:1; } }

.photo-slot{
  position:relative;
  margin:14px 24px 0;
  border:1px solid var(--line);
  aspect-ratio: 15/7;
  overflow:hidden;
  padding:0; background:none;
  display:block; width:calc(100% - 48px);
  cursor:zoom-in;
}
.photo-slot img{ width:100%; height:100%; object-fit:cover; display:block; filter:contrast(1.1) saturate(1.28); }
.photo-zoom{
  position:absolute; right:10px; bottom:10px;
  font-family:'IBM Plex Mono',monospace; font-size:10.5px;
  color:#fff; background:rgba(20,23,15,.6);
  padding:5px 10px; letter-spacing:.03em;
  backdrop-filter: blur(2px);
}

.lightbox{
  position:fixed; inset:0; z-index:100;
  background:rgba(10,12,8,.92);
  display:none; align-items:center; justify-content:center;
  padding:24px;
}
.lightbox.open{ display:flex; }
.lightbox img{ max-width:100%; max-height:100%; box-shadow:0 20px 60px rgba(0,0,0,.5); }
.lightbox-close{
  position:absolute; top:18px; right:18px;
  width:38px; height:38px; border-radius:50%;
  background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.3);
  color:#fff; font-size:16px; cursor:pointer;
}

.gallery-grid{
  margin:14px 24px 0; display:grid; grid-template-columns:1fr 1fr; gap:8px;
}
.gallery-item{
  position:relative; aspect-ratio:4/3; overflow:hidden;
  border:1px solid var(--line); padding:0; background:none; cursor:zoom-in;
}
.gallery-item img{ width:100%; height:100%; object-fit:cover; display:block; filter:contrast(1.1) saturate(1.28); }
.gallery-item .photo-zoom{
  position:absolute; right:8px; bottom:8px;
  font-family:'IBM Plex Mono',monospace; font-size:11px;
  color:#fff; background:rgba(20,23,15,.6); width:22px; height:22px;
  display:flex; align-items:center; justify-content:center;
}

.wikiloc-row{
  margin:14px 24px 0; display:flex; flex-wrap:wrap; gap:10px;
}
.wikiloc-link{
  display:inline-flex; align-items:center; gap:7px;
  font-family:'IBM Plex Mono',monospace; font-size:12px; font-weight:500;
  color:var(--ground); background:var(--teal);
  padding:9px 14px; text-decoration:none;
}
.wikiloc-link.ghost{
  color:var(--ink); background:none; border:1px solid var(--line);
}
.wikiloc-link svg{ flex-shrink:0; }

.facts{ display:flex; flex-wrap:wrap; gap:9px; margin:40px 24px 0; }
.fact{ border:1px solid var(--line); padding:11px 15px; min-width:96px; background:var(--ground-raised); }
.fact .v{ font-family:'IBM Plex Mono',monospace; font-weight:600; font-size:19px; font-variant-numeric:tabular-nums; display:block; color:var(--ink); }
.fact .k{ font-family:'IBM Plex Mono',monospace; font-size:10px; letter-spacing:.07em; text-transform:uppercase; color:var(--ink-dim); }
.facts-note{ margin:8px 24px 0; font-family:'IBM Plex Mono',monospace; font-size:10.5px; color:var(--ink-dim); }
.facts-note b{ color:var(--teal); }

.body-copy{ margin:42px 24px 0; max-width:60ch; }
.body-copy p{ font-family:'Karla',sans-serif; font-size:17px; line-height:1.7; color:var(--ink); margin:0 0 18px; }
.body-copy a{ color:var(--teal); text-decoration:underline; text-underline-offset:2px; }
.body-copy a:hover{ color:var(--violet); }
.body-copy p:first-of-type::first-letter{
  font-family:'Fraunces',serif; font-weight:900; font-size:3.1em; float:left; line-height:.78;
  padding:.05em .07em 0 0; color:var(--teal);
}

.parada{
  margin:42px 24px 0;
  background:var(--violet-soft);
  border-left:3px solid var(--violet);
  padding:22px 24px 24px;
  display:flex; flex-direction:column; gap:8px;
}
.parada .k{ font-family:'IBM Plex Mono',monospace; font-size:11px; letter-spacing:.12em; text-transform:uppercase; color:var(--violet); }
.parada h2{ font-family:'Fraunces',serif; font-weight:600; font-style:italic; font-size:1.5rem; margin:0; color:var(--ink); }
.parada p{ font-family:'Karla',sans-serif; font-size:14.5px; color:var(--ink-dim); line-height:1.6; margin:2px 0 0; max-width:52ch; }

footer{
  margin:50px 24px 0; padding-top:22px; border-top:1px solid var(--line);
  display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px 20px;
  font-family:'IBM Plex Mono',monospace; font-size:11px; color:var(--ink-dim);
}
footer b{ color:var(--ink); font-weight:600; }

@media (max-width:480px){
  .facts{ gap:7px; }
  .fact{ min-width:calc(50% - 4px); flex:1 1 calc(50% - 4px); }
}
.to-top{
  position:fixed; right:18px; bottom:18px; z-index:60;
  width:46px; height:46px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background:var(--teal); color:var(--ground); border:none; cursor:pointer;
  box-shadow:0 6px 20px rgba(20,23,15,.25);
  opacity:0; transform:translateY(8px); pointer-events:none;
  transition:opacity .25s ease, transform .25s ease, background .2s ease;
}
.to-top.visible{ opacity:1; transform:translateY(0); pointer-events:auto; }
.to-top:hover{ background:var(--violet); }
@media (prefers-reduced-motion: reduce){ .to-top{ transition:opacity .01ms; } }

/* ---- Sendero de noche: glow + rounded language ---- */
.theme-toggle{ border-radius:50%; }
.theme-toggle:hover{ box-shadow:0 0 14px -2px var(--teal); }
.to-top{ box-shadow:0 4px 16px rgba(0,0,0,.5), 0 0 26px -8px var(--teal); }
.logo-photo{ box-shadow:0 0 0 4px var(--ground), 0 0 18px -4px var(--teal); }

.wikiloc-link, .directions-cta, .back-home-link, .feat-cta{
  border-radius:12px;
  box-shadow:0 0 24px -10px var(--teal);
}
.wikiloc-link:hover, .directions-cta:hover, .back-home-link:hover, .feat-cta:hover{
  box-shadow:0 0 30px -8px var(--violet);
}
.wikiloc-link.ghost{ box-shadow:none; }
.wikiloc-link.ghost:hover{ box-shadow:0 0 20px -10px var(--teal); }

.feat-panel{ border-radius:22px; }
.feat-panel[data-activity="bici"]{ box-shadow:0 0 0 1px var(--line), 0 0 40px -16px var(--teal); }
.feat-panel[data-activity="senderismo"]{ box-shadow:0 0 0 1px var(--line), 0 0 40px -16px var(--violet); }

.fact{ border-radius:14px; }
.fact .v{ text-shadow:0 0 14px currentColor; }
.feat-facts .fact .v{ text-shadow:0 0 12px currentColor; }
.readout-item .v{ text-shadow:0 0 18px currentColor; }
.elev-tags .v{ text-shadow:0 0 14px currentColor; }

.activity-chip.active{ box-shadow:0 0 18px -3px currentColor; }
.range-filter input[type="range"]::-webkit-slider-thumb{ box-shadow:0 0 0 3px var(--ground), 0 0 14px var(--teal); }
.range-filter input[type="range"]::-moz-range-thumb{ box-shadow:0 0 0 3px var(--ground), 0 0 14px var(--teal); }

.photo-slot, .gallery-item, .mini-gallery .gallery-item{ border-radius:16px; }
.route-map-box, .map-box{ border-radius:20px; }
.hero-chart{ border-radius:20px; }
.hero-chart svg path[fill="none"], .feat-chart svg path[fill="none"]{ filter:drop-shadow(0 0 6px var(--teal)); }
.elev-marker circle{ filter:drop-shadow(0 0 5px var(--teal)); }

.parada{ border-radius:0 16px 16px 0; box-shadow:0 0 32px -16px var(--violet); }
