/* ==========================================================================
   Montón de Jiloca — hoja de estilos principal
   ========================================================================== */

:root {
  --bg: #faf7f0;
  --surface: #ffffff;
  --ink: #1b2a24;
  --muted: #5c6b64;
  --brand: #2c5d4f;
  --brand-dark: #1e4238;
  --accent: #bf6b3d;
  --line: #e6dfd2;
  --radius: 18px;
  --shadow: 0 12px 34px rgba(27, 42, 36, 0.09);
  --maxw: 1180px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: Georgia, "Times New Roman", "Liberation Serif", serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: normal;
  font-synthesis: none;
  color: var(--ink);
}

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
.container--narrow { max-width: 820px; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--brand); color: #fff; padding: .75rem 1rem; z-index: 200;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* --------------------------------------------------------------------------
   Cabecera y navegación
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 247, 240, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 74px;
}

.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  text-decoration: none;
  color: var(--ink);
}
.brand:hover { color: var(--ink); }

.brand__mark {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  flex: none;
}

.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__name { font-family: var(--font-display); font-size: 1.28rem; font-weight: 700; }
.brand__sub { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.nav__toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .5rem .65rem;
  cursor: pointer;
  color: var(--ink);
}
.nav__toggle svg { display: block; }

.nav__list {
  display: flex;
  align-items: center;
  gap: .15rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__item { position: relative; }

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .6rem .7rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  font-size: .93rem;
  font-weight: 500;
  white-space: nowrap;
}
.nav__link:hover,
.nav__link:focus-visible { background: rgba(44, 93, 79, 0.08); color: var(--brand); }
.nav__link.is-current { color: var(--brand); }

.nav__link .chev { width: 10px; height: 10px; opacity: .7; }

.nav__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 250px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: .45rem;
  list-style: none;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: all .18s ease;
}
.nav__item:hover > .nav__dropdown,
.nav__item:focus-within > .nav__dropdown {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.nav__dropdown a {
  display: block;
  padding: .55rem .7rem;
  border-radius: 9px;
  text-decoration: none;
  color: var(--ink);
  font-size: .9rem;
}
.nav__dropdown a:hover { background: rgba(44, 93, 79, 0.08); color: var(--brand); }

/* --------------------------------------------------------------------------
   Portada (hero)
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: clamp(430px, 60vh, 600px);
  display: grid;
  align-items: end;
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}
.hero__media { position: absolute; inset: 0; z-index: -2; }
.hero__media img { width: 100%; height: 100%; object-fit: cover; }
.hero::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(15, 28, 23, 0.25) 0%, rgba(15, 28, 23, 0.12) 40%, rgba(15, 28, 23, 0.78) 100%);
}
.hero__inner { padding-top: 4rem; padding-bottom: 3rem; }
.hero__kicker {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .78rem; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(255,255,255,.85); margin-bottom: 1rem;
  text-shadow: 0 1px 10px rgba(0,0,0,.55);
}
.hero__kicker::before { content: ""; width: 34px; height: 1px; background: currentColor; }
.hero h1 {
  color: #fff;
  font-size: clamp(3.2rem, 9vw, 7.2rem);
  margin: 0 0 .4rem;
  text-shadow: 0 2px 30px rgba(0,0,0,.25);
}
.hero__lead {
  max-width: 620px;
  font-size: clamp(1.05rem, 2.1vw, 1.35rem);
  color: rgba(255,255,255,.92);
  margin: 0 0 1.8rem;
  text-shadow: 0 1px 12px rgba(0,0,0,.5);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; }

.hero__crest {
  position: absolute;
  top: 1.75rem;
  z-index: 2;
  height: clamp(74px, 8.5vw, 128px);
  width: auto;
  display: block;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.38));
  transition: transform 0.2s ease;
}
.hero__crest img { height: 100%; width: auto; }
.hero__crest--left { left: clamp(1rem, 3vw, 2.5rem); }
.hero__crest--right { right: clamp(1rem, 3vw, 2.5rem); }
.hero__crest:hover { transform: translateY(-2px) scale(1.02); }

/* Portada interior de página */
.page-hero {
  position: relative;
  min-height: 360px;
  display: grid;
  align-items: end;
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}
.page-hero__media { position: absolute; inset: 0; z-index: -2; }
.page-hero__media img { width: 100%; height: 100%; object-fit: cover; }
.page-hero::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(15,28,23,.15), rgba(15,28,23,.72));
}
.page-hero__inner { padding-top: 5.5rem; padding-bottom: 2.6rem; }
.page-hero__kicker {
  font-size: .75rem; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(255,255,255,.8); margin-bottom: .6rem;
}
.page-hero h1 { color: #fff; margin: 0 0 .5rem; font-size: clamp(2.2rem, 5.2vw, 4rem); }
.page-hero p { margin: 0; max-width: 680px; color: rgba(255,255,255,.9); }

/* --------------------------------------------------------------------------
   Botones
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .8rem 1.35rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  border: 1px solid transparent;
  transition: transform .15s ease, background .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); color: #fff; }
.btn--ghost { border-color: rgba(255,255,255,.55); color: #fff; }
.btn--ghost:hover { background: rgba(255,255,255,.14); color: #fff; }
.btn--light { background: #fff; color: var(--brand); }
.btn--light:hover { background: #f3ede2; color: var(--brand-dark); }

/* --------------------------------------------------------------------------
   Secciones y tipografía de contenido
   -------------------------------------------------------------------------- */

.section { padding: clamp(3rem, 6vw, 5rem) 0; }
.section--tight { padding: clamp(2rem, 4vw, 3rem) 0; }
.section--surface { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.section__head { max-width: 700px; margin-bottom: 2.2rem; }
.section__eyebrow {
  font-size: .75rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin: 0 0 .5rem;
}
.section h2 { font-size: clamp(1.8rem, 3.6vw, 2.7rem); margin: 0 0 .6rem; }
.section__intro { color: var(--muted); margin: 0; }

.prose { max-width: 780px; }
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 1.05em 0; line-height: 1.82; }
.prose h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 2em 0 .6em; }
.prose h3 { font-size: 1.3rem; margin: 1.6em 0 .5em; }
.prose strong { font-weight: 650; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: .4em 0; }
.prose blockquote {
  margin: 1.6em 0; padding: .2em 1.2em;
  border-left: 3px solid var(--accent);
  color: var(--muted); font-style: italic;
}
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }

.prose figure,
.gallery figure { margin: 1.4em 0; }

.prose figure img,
.gallery figure img {
  width: 100%;
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.prose figcaption,
.gallery figcaption {
  font-size: .82rem;
  color: var(--muted);
  margin-top: .5rem;
  line-height: 1.4;
}
.prose figure a,
.gallery figure a { display: block; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
  margin: 1.6em 0;
}
.gallery figure { margin: 0; }
.gallery figure img { aspect-ratio: 4 / 3; object-fit: cover; height: 100%; }

.figure--wide { grid-column: 1 / -1; }

.photo-missing {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: .8rem 1rem;
  color: var(--muted);
  font-size: .85rem;
  margin: 1em 0;
}

/* Aviso / caja destacada */
.note {
  background: rgba(44, 93, 79, .07);
  border-left: 3px solid var(--brand);
  border-radius: 0 12px 12px 0;
  padding: 1rem 1.2rem;
  margin: 1.6em 0;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Tarjetas
   -------------------------------------------------------------------------- */

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.25rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(27,42,36,.02);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: var(--ink); }
.card__media { aspect-ratio: 16 / 10; overflow: hidden; background: #ddd6c8; }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card__media img { transform: scale(1.04); }
.card__body { padding: 1.1rem 1.2rem 1.3rem; }
.card__body h3 { margin: 0 0 .35rem; font-size: 1.22rem; }
.card__body p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.55; }

/* --------------------------------------------------------------------------
   Lista de artículos
   -------------------------------------------------------------------------- */

.post-list { display: grid; gap: 1rem; }
.post-card {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 1.2rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .85rem;
  text-decoration: none;
  color: var(--ink);
  transition: transform .18s ease, box-shadow .18s ease;
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--ink); }
.post-card__media { aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: #ddd6c8; }
.post-card__media img { width: 100%; height: 100%; object-fit: cover; }
.post-card__body h3 { margin: 0 0 .3rem; font-size: 1.25rem; }
.post-card__meta { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: .35rem; }
.post-card__body p { margin: 0; color: var(--muted); font-size: .92rem; }

.article-header { max-width: 820px; margin: 0 auto 2rem; }
.article-header h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); margin: .4rem 0 .8rem; }
.article-meta { color: var(--muted); font-size: .9rem; }
.article-back { display: inline-flex; align-items: center; gap: .4rem; font-size: .88rem; text-decoration: none; margin-bottom: 1.2rem; }

/* --------------------------------------------------------------------------
   Datos rápidos / clima
   -------------------------------------------------------------------------- */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 760px) {
  .intro-grid { grid-template-columns: 1fr; }
}
.fact {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem;
}
.fact__label { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.fact__value { font-family: var(--font-display); font-size: 1.5rem; margin-top: .2rem; }

.weather {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  min-height: 96px;
}
.weather__icon { font-size: 2.2rem; line-height: 1; }
.weather__label { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.weather__temp { font-family: var(--font-display); font-size: 1.8rem; line-height: 1.1; }
.weather__desc { font-size: .85rem; opacity: .85; }
.weather a { color: #fff; }

/* --------------------------------------------------------------------------
   Pie de página
   -------------------------------------------------------------------------- */

.site-footer {
  background: var(--brand-dark);
  color: rgba(255,255,255,.82);
  padding: 3.5rem 0 1.5rem;
  margin-top: 4rem;
}
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { color: #f0c9a8; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.5rem;
}
.site-footer h3 { color: #fff; font-size: 1.15rem; margin: 0 0 .8rem; }
.site-footer p { margin: 0 0 .8rem; font-size: .92rem; line-height: 1.7; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; font-size: .92rem; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.14);
  margin-top: 2.5rem; padding-top: 1.2rem;
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem;
  justify-content: space-between;
  font-size: .8rem; color: rgba(255,255,255,.6);
}

/* --------------------------------------------------------------------------
   Widget flotante del tiempo
   -------------------------------------------------------------------------- */

.weather-pill {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--brand);
  color: #fff;
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  box-shadow: 0 10px 30px rgba(15, 28, 23, 0.28);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
}
.weather-pill:hover { transform: translateY(-2px); background: var(--brand-dark); }
.weather-pill.is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  pointer-events: none;
}
.weather-pill__icon { font-size: 1.1rem; }
.weather-pill__temp { letter-spacing: 0.01em; }

@media (max-width: 700px) {
  .weather-pill {
    right: 0.6rem;
    bottom: 0.6rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.78rem;
    gap: 0.35rem;
  }
  .weather-pill__icon { font-size: 0.95rem; }
}

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */

.lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(10, 18, 14, .92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.lightbox.is-open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 10px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.lightbox__close {
  position: absolute; top: 1rem; right: 1rem;
  background: rgba(255,255,255,.12); color: #fff; border: 0;
  width: 44px; height: 44px; border-radius: 50%; font-size: 1.4rem; cursor: pointer;
}
.lightbox__close:hover { background: rgba(255,255,255,.22); }

/* --------------------------------------------------------------------------
   Utilidades
   -------------------------------------------------------------------------- */

.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .nav__toggle { display: inline-flex; }

  .nav__list {
    position: absolute;
    top: 74px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: .1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: .75rem 1.25rem 1.25rem;
    display: none;
    max-height: calc(100vh - 74px);
    overflow: auto;
  }
  .nav__list.is-open { display: flex; }
  .nav__link { padding: .75rem .5rem; font-size: 1rem; }
  .nav__dropdown {
    position: static;
    opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: 0; background: transparent;
    padding: 0 0 .4rem .8rem;
    display: none;
  }
  .nav__item.is-expanded > .nav__dropdown { display: block; }
  .nav__dropdown a { padding: .5rem .5rem; }

  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  .hero { min-height: 64vh; }
  .hero__inner { padding-top: 4rem; padding-bottom: 2.5rem; }
  .hero__kicker { font-size: .68rem; letter-spacing: .14em; }
  .post-card { grid-template-columns: 1fr; }
  .post-card__media { aspect-ratio: 16 / 9; }
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
