/* FotoSierra.com — Nature Design v4 */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --green:      #7ab648;
  --green-d:    #2c5f1a;
  --green-mid:  #4a7a2a;
  --green-l:    #a8d880;
  --green-bg:   #f0f7ee;
  --green-bg2:  #f8fcf5;
  --green-bd:   #d8eecc;
  --green-bd2:  #c0e0a0;
  --sky:        #4a9ab8;
  --amber:      #e8a030;
  --white:      #ffffff;
  --ink:        #2c3e2c;
  --ink-m:      #4a6a3a;
  --ink-l:      #7a9a6a;
  --r:          10px;
  --r-sm:       6px;
  --sidebar-w:  210px;
  --topbar-h:   58px;
  --font:       'Nunito', system-ui, sans-serif;
  --sh:         0 2px 10px rgba(80,160,40,.1);
  --sh-md:      0 4px 18px rgba(80,160,40,.16);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--green-bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.65;
}

/* ── TIPOGRAFÍA ── */
h1 { font-size: clamp(1.4rem,2.8vw,1.9rem); font-weight: 800; color: var(--green-d); letter-spacing: -.02em; margin-bottom: .25em; }
h2 { font-size: clamp(1.1rem,2.2vw,1.5rem); font-weight: 800; color: var(--green-d); margin-bottom: .3em; }
h3 {
  font-size: .78rem; font-weight: 800; color: var(--green-mid);
  text-transform: uppercase; letter-spacing: .09em;
  display: flex; align-items: center; gap: 8px; margin: 22px 0 10px;
}
h3::after { content: ''; flex: 1; height: 1.5px; background: var(--green-bd); }
p  { font-size: .9rem; color: var(--ink-m); margin-bottom: .85em; }
strong, b { color: var(--ink); font-weight: 700; }
a:link, a:visited { color: var(--green-mid); font-weight: 700; text-decoration: none; transition: color .15s; }
a:hover { color: var(--green); text-decoration: underline; }
img { max-width: 100%; height: auto; border: 0; display: block; }
hr  { border: none; border-top: 1.5px solid var(--green-bd); margin: 24px 0; }

/* ── TOPBAR ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 2px solid var(--green);
  display: flex; align-items: center; padding: 0 20px; gap: 12px;
  box-shadow: 0 2px 12px rgba(80,160,40,.12);
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px; flex: 1;
  text-decoration: none !important;
}
.topbar-brand:hover { text-decoration: none !important; }
.brand-icon {
  width: 38px; height: 38px; background: var(--green);
  border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 20px; flex-shrink: 0;
}
.brand-name {
  font-size: 1.15rem; font-weight: 800; color: var(--green-d);
  letter-spacing: -.02em;
}
.brand-name span { color: var(--green); }
.brand-tagline {
  font-size: .62rem; color: var(--ink-l); display: block;
  font-weight: 700; letter-spacing: .05em; margin-top: -1px;
}
.topbar-pills { display: flex; gap: 5px; }
.topbar-pill {
  background: var(--green-bg); color: var(--green-mid);
  border: 1.5px solid var(--green-bd2); border-radius: 20px;
  padding: 5px 12px; font: 700 .7rem var(--font);
  cursor: pointer; transition: all .15s; text-decoration: none !important;
  display: inline-flex; align-items: center; gap: 4px;
}
.topbar-pill:hover {
  background: var(--green); color: var(--white);
  border-color: var(--green); text-decoration: none !important;
}

/* ── HERO ── */
.site-hero {
  position: relative; width: 100%;
  height: clamp(140px, 20vw, 240px); overflow: hidden;
  background: var(--green-bg);
}
.site-hero img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 38%;
  display: block; filter: brightness(.88) saturate(1.15);
}
.site-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(20,60,10,.6) 100%);
  pointer-events: none;
}
.site-hero-text {
  position: absolute; bottom: 14px; left: 24px;
}
.site-hero-text h2 {
  color: #fff; font-size: clamp(1rem,2.5vw,1.5rem); font-weight: 800;
  text-shadow: 0 1px 6px rgba(0,0,0,.35); margin: 0 0 2px;
}
.site-hero-text p {
  color: rgba(255,255,255,.82); font-size: .75rem;
  font-weight: 700; margin: 0;
}

/* ── LAYOUT ── */
.site-wrapper {
  display: flex; align-items: stretch; width: 100%;
  min-height: calc(100vh - var(--topbar-h) - clamp(140px,20vw,240px) - 90px);
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--white); border-right: 2px solid var(--green-bd);
  flex-shrink: 0;
  position: sticky; top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto; scrollbar-width: thin;
  scrollbar-color: var(--green-bd) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--green-bd2); border-radius: 2px; }

.menu-toggle {
  display: none; width: 100%; padding: 12px 16px;
  background: var(--green-bg); color: var(--green-mid);
  border: none; border-bottom: 1.5px solid var(--green-bd);
  font: 800 .82rem var(--font); text-align: left; cursor: pointer;
  align-items: center; gap: 8px;
}
.menu-toggle:hover { background: var(--green-bg2); }

.sidebar-content { padding: 8px 0 20px; }
.nav-section { margin-bottom: 2px; }
.nav-heading {
  font-size: .6rem; text-transform: uppercase; letter-spacing: .1em;
  font-weight: 800; color: var(--green); padding: 14px 14px 4px;
}
.nav-section:first-child .nav-heading { padding-top: 10px; }

.sidebar-content ul { list-style: none; padding: 0; margin: 0; }
.sidebar-content li { margin: 0; }

.sidebar-content > .nav-section > ul > li > a {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: .8rem; font-weight: 700;
  color: var(--ink-m); border-left: 3px solid transparent;
  transition: all .13s; text-decoration: none;
}
.sidebar-content > .nav-section > ul > li > a:hover {
  background: var(--green-bg); color: var(--green-d);
  border-left-color: var(--green); text-decoration: none;
}
.sidebar-content ul ul { padding-left: 0; }
.sidebar-content ul ul a {
  display: flex; align-items: center;
  padding: 4px 14px 4px 30px; font-size: .75rem; font-weight: 600;
  color: var(--ink-l); border-left: 3px solid transparent;
  transition: color .13s, background .13s; text-decoration: none;
}
.sidebar-content ul ul a::before { content: '›'; margin-right: 5px; color: var(--green-l); }
.sidebar-content ul ul a:hover { color: var(--green-mid); background: var(--green-bg); text-decoration: none; }

/* ── MAIN ── */
.main-content {
  flex: 1 1 auto; background: var(--green-bg2);
  padding: 28px 36px; min-width: 0;
}

/* ── BREADCRUMB ── */
.breadcrumb {
  display: flex; align-items: center; gap: 5px;
  font-size: .7rem; color: var(--ink-l); margin-bottom: 16px; font-weight: 700;
}
.breadcrumb a { color: var(--green-mid); }
.breadcrumb a:hover { color: var(--green); }

/* ── TAGS ── */
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--green-bg); color: var(--green-mid);
  border: 1.5px solid var(--green-bd2);
  border-radius: 20px; font-size: .68rem; font-weight: 800;
  padding: 3px 10px; letter-spacing: .02em;
}

/* ── GALERÍA ── */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px; margin: 0 0 24px;
}
.gallery figure {
  margin: 0; background: var(--white);
  border: 1.5px solid var(--green-bd);
  border-radius: var(--r); overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color .17s, box-shadow .17s, transform .17s;
  cursor: pointer;
}
.gallery figure:hover {
  border-color: var(--green);
  box-shadow: var(--sh-md); transform: translateY(-3px);
}
.gallery figure > a {
  display: block; overflow: hidden; height: 130px;
  background: #cce8b0; flex-shrink: 0;
}
.gallery figure > a > img {
  width: 100%; height: 130px; object-fit: cover;
  transition: transform .38s;
}
.gallery figure:hover > a > img { transform: scale(1.07); }
.gallery figcaption {
  font-size: .7rem; padding: 6px 8px 7px; color: var(--ink-l);
  line-height: 1.3; flex: 1; font-weight: 600;
}

/* ── ARTÍCULOS FLOTANTES ── */
.article-img {
  max-width: min(280px, 42%); height: auto;
  border-radius: var(--r); box-shadow: var(--sh-md);
}
.float-left  { float: left;  margin: 4px 22px 12px 0; }
.float-right { float: right; margin: 4px 0 12px 22px; }
.clearfix::after { content: ''; display: table; clear: both; }

/* ── ARTICLE CARD ── */
.article-card {
  display: flex; gap: 18px; align-items: flex-start;
  background: var(--white); border: 1.5px solid var(--green-bd);
  border-radius: 12px; padding: 16px; margin-bottom: 18px;
  box-shadow: var(--sh);
}
.article-card img {
  width: 170px; min-width: 170px; height: 110px;
  object-fit: cover; border-radius: var(--r-sm); flex-shrink: 0;
}
.article-card h4 { font-size: .9rem; font-weight: 800; color: var(--green-d); margin-bottom: 5px; }
.article-card p  { font-size: .8rem; color: var(--ink-m); margin: 0; line-height: 1.6; }

/* ── INFO-BOX ── */
.info-box {
  background: #e8f5d8; border: 1.5px solid #b0dc88;
  border-radius: var(--r); padding: 12px 16px;
  font-size: .82rem; color: var(--green-d); font-weight: 700;
  display: flex; align-items: center; gap: 10px; margin: 18px 0;
}

/* ── MAPA ── */
#mapa-sierra {
  width: 100%; height: clamp(300px, 42vw, 480px);
  border-radius: var(--r); border: 1.5px solid var(--green-bd);
  box-shadow: var(--sh);
}
.map-wrap { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; margin: 14px 0; }
.map-wrap .map-box { flex: 1 1 340px; min-width: 0; }
.map-legend {
  flex: 0 0 200px; background: var(--white);
  border: 1.5px solid var(--green-bd); border-radius: var(--r);
  padding: 16px; box-shadow: var(--sh);
}
.map-legend h3 { font-size: .68rem; margin: 0 0 12px; }
.legend-list { list-style: none; padding: 0; margin: 0; }
.legend-list li {
  font-size: .78rem; font-weight: 700; margin: 7px 0;
  display: flex; align-items: center; gap: 8px; color: var(--ink-m);
}

/* ── PIE ── */
.site-footer {
  background: var(--green-d); padding: 24px 32px;
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 14px;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 3px; }
.footer-nav a {
  color: var(--green-l); font-size: .72rem; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
  border: 1px solid transparent; transition: all .15s;
  text-decoration: none;
}
.footer-nav a:hover {
  background: rgba(255,255,255,.08); color: var(--white);
  border-color: rgba(255,255,255,.12); text-decoration: none;
}
.footer-copy { color: #6aaa4a; font-size: .72rem; line-height: 1.8; text-align: right; }
.footer-copy strong { color: var(--green-l); }
.footer-copy a { color: #6aaa4a; text-decoration: none; }
.footer-copy a:hover { color: var(--white); }

/* ── ERRORES ── */
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 6rem; color: var(--green-bd); margin: 0; }
.error-page h2 { color: var(--green-d); }
.error-page p  { color: var(--ink-l); max-width: 480px; margin: 10px auto; }
.btn-home {
  display: inline-block; margin-top: 24px; padding: 11px 28px;
  background: var(--green); color: var(--white) !important;
  border-radius: 20px; font-weight: 800; font-size: .88rem;
  text-decoration: none !important; transition: background .15s;
}
.btn-home:hover { background: var(--green-mid); }


/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-thumb { background: var(--green-bd2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--green); }

/* ── OVERFLOW GLOBAL: evitar scroll horizontal ── */
html, body { overflow-x: hidden; }

/* ── CONTENIDO LEGADO: normalizar HTML antiguo ── */
/* Tablas con anchos fijos en pt/cm -> scroll horizontal */
.main-content table {
  max-width: 100%;
  width: auto !important;
  overflow-x: auto;
  display: block;
  border-collapse: collapse;
}
/* Imágenes con width/height hardcodeados */
.main-content img    { max-width: 100% !important; height: auto !important; }
/* <font size="X"> -> tamaño normalizado */
.main-content font   { font-size: inherit !important; font-family: inherit !important; }
/* align="center" en <p> */
.main-content p[align="center"] { text-align: center; }
/* <center> */
.main-content center { display: block; text-align: center; }

/* ── TÁCTIL: áreas mínimas de 44px en menú ── */
.sidebar-content a,
.footer-nav a,
.topbar-pill       { min-height: 36px; display: inline-flex; align-items: center; }
.sidebar-content > .nav-section > ul > li > a { min-height: 40px; }

/* ─────────── TABLET (≤ 960px) ─────────── */
@media (max-width: 960px) {
  .main-content { padding: 22px 24px; }
  .topbar-pill  { padding: 5px 9px; font-size: .65rem; }
}

/* ─────────── TABLET PORTRAIT (≤ 860px) ─────────── */
@media (max-width: 860px) {
  /* Layout */
  .site-wrapper   { flex-direction: column; }
  .sidebar        { width: 100%; min-width: 0; position: static;
                    max-height: none; overflow: visible; border-right: none;
                    border-bottom: 2px solid var(--green-bd); }
  .menu-toggle    { display: flex; min-height: 44px; }
  .sidebar-content { display: none; }
  .sidebar-content.open { display: block; }
  .main-content   { padding: 18px 20px; }

  /* Imágenes flotantes */
  .float-left, .float-right { float: none !important; max-width: 100%; margin: 0 0 14px; display: block; }
  .article-img  { max-width: 100%; }

  /* Galería */
  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .gallery figure > a { height: 115px; }
  .gallery figure > a > img { height: 115px; }

  /* Home cards */
  .home-card, .home-card--reverse { flex-direction: column; }
  .home-card img { width: 100%; height: 200px; }

  /* Article card */
  .article-card { flex-direction: column; }
  .article-card img { width: 100%; min-width: 0; height: 160px; }

  /* Mapa */
  .map-wrap   { flex-direction: column; }
  .map-legend { flex: none; width: 100%; }

  /* Footer */
  .site-footer  { padding: 18px 16px; flex-direction: column; text-align: center; }
  .footer-nav   { justify-content: center; }
  .footer-copy  { text-align: center; }

  /* Tabla legado */
  .main-content table { font-size: .82rem; }
}

/* ─────────── MÓVIL (≤ 600px) ─────────── */
@media (max-width: 600px) {
  :root { --topbar-h: 52px; }

  /* Topbar */
  .topbar           { padding: 0 12px; gap: 8px; height: var(--topbar-h); }
  .brand-icon       { width: 32px; height: 32px; font-size: 17px; }
  .brand-name       { font-size: 1rem; }
  .brand-tagline    { display: none; }
  .topbar-pills     { gap: 3px; }
  .topbar-pill      { padding: 4px 7px; font-size: .6rem; }
  /* Ocultar pills menos usadas en pantallas muy pequeñas */
  .topbar-pill:nth-child(n+4) { display: none; }

  /* Hero */
  .site-hero      { height: 110px; }
  .site-hero-text { left: 12px; bottom: 8px; }
  .site-hero-text h2 { font-size: .95rem; }
  .site-hero-text p  { display: none; }

  /* Contenido */
  .main-content { padding: 14px 13px; }

  /* Galería: 2 columnas fijas */
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .gallery figure > a        { height: 100px; }
  .gallery figure > a > img  { height: 100px; }
  .gallery figcaption        { font-size: .65rem; padding: 4px 6px 5px; }

  /* Tipografía */
  h1 { font-size: 1.3rem; }
  h2 { font-size: 1.1rem; }

  /* Mapa */
  #mapa-sierra { height: 280px; }

  /* Lightbox en móvil */
  .lb-outerContainer { max-width: 96vw !important; }
  .lb-image          { max-width: 96vw !important; }

  /* Menu toggle más grande */
  .menu-toggle { padding: 13px 16px; font-size: .85rem; }

  /* Botones cookie */
  #cookie-banner { padding: 12px 14px; }
}

/* ─────────── MÓVIL PEQUEÑO (≤ 380px) ─────────── */
@media (max-width: 380px) {
  .topbar-pill { display: none; }
  .main-content { padding: 11px 10px; }
  .gallery { gap: 6px; }
}

/* ── LIGHTBOX: normalizar en todos los tamaños ── */
.lightbox             { text-align: center; }
.lb-image             { max-width: none !important;
                        width: auto  !important;
                        height: auto !important;
                        cursor: zoom-out !important; }
.lb-outerContainer    { overflow: visible; }

/* ── LEAFLET MARKERS: anular display:block del reset global ── */
.leaflet-marker-icon,
.leaflet-marker-shadow { display: inline-block !important;
                         max-width: none       !important;
                         height: auto          !important; }
.leaflet-tile          { display: inline-block !important;
                         max-width: none       !important; }
