/* =====================================================================
   EnlaMancha.com — Sistema de diseño (rediseño 2026)
   Estética editorial cálida inspirada en Castilla-La Mancha.
   Mobile-first.
   ===================================================================== */

/* ==== TOKENS ==== */
:root {
  /* Paleta cálida (tierra manchega) */
  --bg: #fdfbf7;
  --surface: #ffffff;
  --surface-alt: #f6f1e9;
  --ink: #2b2622;
  --muted: #6f6a63;
  --accent: #b3541e;        /* terracota */
  --accent-dark: #8f4216;
  --accent-soft: #f3e6da;
  --gold: #c08a2d;          /* sol / azafrán */
  --border: #e7e0d6;
  --shadow: 0 1px 2px rgba(43, 38, 34, .06), 0 8px 24px rgba(43, 38, 34, .06);
  --shadow-hover: 0 4px 8px rgba(43, 38, 34, .08), 0 16px 40px rgba(43, 38, 34, .12);

  --font-title: 'Playfair Display', Georgia, serif;
  --font-body: 'Lora', Georgia, serif;

  --maxw: 1080px;
  --maxw-text: 70ch;
  --radius: 14px;
  --radius-sm: 8px;
}

/* ==== RESET ==== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  font-size: 18px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-dark); text-decoration: underline; }

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

/* ==== TIPOGRAFÍA ==== */
h1, h2, h3, h4 { font-family: var(--font-title); line-height: 1.2; color: var(--ink); }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 700; margin-bottom: .75rem; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.25rem); font-weight: 700; margin: 2.25rem 0 1rem; }
h3 { font-size: clamp(1.3rem, 2.6vw, 1.6rem); font-weight: 700; margin: 1.75rem 0 .75rem; }
h4 { font-size: 1.15rem; font-weight: 700; margin: 1.25rem 0 .5rem; }
p { margin-bottom: 1.25rem; }

hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ==== HEADER ==== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: .9rem;
}

.branding { font-family: var(--font-title); font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; }
.branding a { color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.branding a:hover { color: var(--accent); text-decoration: none; }
.branding .dot { color: var(--accent); }

/* Selector de idioma */
.language-flags { display: flex; gap: .4rem; align-items: center; }
.language-flags button {
  background: none; border: 1px solid transparent; border-radius: 50%;
  padding: 2px; cursor: pointer; line-height: 0; transition: border-color .15s ease, transform .15s ease;
}
.language-flags button:hover { border-color: var(--accent); transform: translateY(-1px); }
.flag-icon { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }

/* Barra de provincias */
.province-bar-wrapper { border-top: 1px solid var(--border); background: var(--surface-alt); }
.province-bar {
  display: flex; gap: .5rem; list-style: none; padding-block: .6rem;
  overflow-x: auto; scrollbar-width: none;
}
.province-bar::-webkit-scrollbar { display: none; }
.province-bar a {
  display: inline-block; white-space: nowrap;
  padding: .35rem .9rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--ink); font-size: .95rem; font-weight: 600; text-decoration: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.province-bar a:hover, .province-bar a[aria-current="page"] {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* Breadcrumbs */
.breadcrumb-wrapper { padding-block: .6rem 0; }
.breadcrumb {
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
  font-size: .9rem; color: var(--muted);
}
.breadcrumb a { color: var(--muted); font-weight: 600; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--border); }
.breadcrumb [aria-current="page"] { color: var(--ink); }

/* ==== MAIN / LAYOUT ==== */
main { flex: 1 0 auto; padding-block: 2rem 3rem; }
/* Páginas de contenido simple (legales): acota la lectura sin envoltorio extra */
main > h1, main > h2, main > h3, main > p, main > ul, main > ol { max-width: var(--maxw-text); margin-inline: auto; }
.prose { max-width: var(--maxw-text); margin-inline: auto; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose img, .prose figure img { border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.prose figure { margin: 1.75rem 0; text-align: center; }
.prose figcaption { font-size: .9rem; color: var(--muted); margin-top: .5rem; }

/* ==== HERO HOME ==== */
.hero {
  border-radius: var(--radius); overflow: hidden; position: relative;
  background: linear-gradient(120deg, #b3541e, #c08a2d);
  color: #fff; margin-bottom: 2.5rem; box-shadow: var(--shadow);
}
.hero img { width: 100%; height: clamp(220px, 38vw, 420px); object-fit: cover; }
.hero-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  justify-content: flex-end; padding: clamp(1.25rem, 4vw, 2.5rem);
  background: linear-gradient(to top, rgba(20,14,8,.7), rgba(20,14,8,.05) 60%, transparent);
}
.hero-overlay h1 { color: #fff; max-width: 18ch; }
.hero-overlay p { color: rgba(255,255,255,.92); margin-bottom: 0; max-width: 52ch; font-size: 1.1rem; }

/* ==== SECCIONES ==== */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.section-head h2 { margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 700; color: var(--accent); font-family: var(--font-body); }

/* ==== GRID DE TARJETAS ==== */
.card-grid {
  display: grid; gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card a.card-link { color: inherit; text-decoration: none; display: flex; flex-direction: column; height: 100%; }
.card a.card-link:hover { text-decoration: none; }

.card-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.card:hover .card-media img { transform: scale(1.04); }

/* Placeholder elegante cuando no hay imagen */
.card-media--placeholder {
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-soft), #efe2cf);
  color: var(--accent);
}
.card-media--placeholder svg { width: 38%; height: auto; opacity: .55; }

.card-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.card-tag {
  align-self: flex-start; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  font-weight: 700; color: var(--accent); background: var(--accent-soft);
  padding: .2rem .6rem; border-radius: 999px; font-family: var(--font-body);
}
.card-title { font-family: var(--font-title); font-size: 1.25rem; font-weight: 700; line-height: 1.25; }
.card-excerpt { font-size: .95rem; color: var(--muted); line-height: 1.6; }

/* ==== ARTÍCULO ==== */
.article-hero {
  border-radius: var(--radius); overflow: hidden; margin-bottom: 1.75rem;
  position: relative; box-shadow: var(--shadow);
}
.article-hero img { width: 100%; height: clamp(220px, 40vw, 460px); object-fit: cover; }
.article-hero--placeholder {
  height: clamp(160px, 28vw, 300px);
  background: linear-gradient(135deg, var(--accent), var(--gold));
  display: grid; place-items: center;
}
.article-hero--placeholder svg { width: clamp(70px, 12vw, 120px); opacity: .85; }

.article-meta { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; color: var(--muted); font-size: .95rem; margin-bottom: 1.5rem; }
.article-meta .pill {
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
  padding: .2rem .7rem; border-radius: 999px; font-size: .85rem;
}
.article-meta time { font-variant-numeric: tabular-nums; }

.article-body { font-size: 1.08rem; }
.article-body h2 { border-bottom: 2px solid var(--accent-soft); padding-bottom: .35rem; }
.article-body strong { color: var(--ink); }
.article-body ul, .article-body ol { margin: 0 0 1.25rem 1.25rem; }
.article-body li { margin-bottom: .4rem; }

/* Bloques HTML insertados (anuncios) */
.bloque-html { margin: 2rem auto; padding: 1rem 1.25rem; max-width: var(--maxw-text); text-align: center; background: var(--surface-alt); border-radius: var(--radius-sm); }
.bloque-html:empty { display: none; }
.bloque-global { margin: 1rem auto; max-width: var(--maxw-text); text-align: center; }
.bloque-global:empty { display: none; }

/* Relacionados */
.related { margin-top: 3rem; }
.related h2 { margin-bottom: 1.25rem; }

/* ==== FOOTER ==== */
.site-footer {
  flex-shrink: 0; margin-top: 3rem; background: var(--ink); color: #e9e2d8;
  padding-block: 2rem; font-size: .95rem;
}
.site-footer .container { display: flex; flex-direction: column; gap: 1rem; align-items: center; text-align: center; }
.footer-links { display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: center; }
.footer-links a { color: #e9e2d8; }
.footer-links a:hover { color: #fff; }
.footer-links .sep { color: #6f6a63; }
.site-footer .copyright { color: #b3a99c; font-size: .85rem; }

/* ==== BANNER COOKIES ==== */
#cookie-consent-banner {
  position: fixed; bottom: 0; left: 0; width: 100%;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 -2px 16px rgba(0,0,0,.12); z-index: 9999;
  padding: 1rem 1.25rem; display: none;
}
#cookie-consent-banner .container { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
#cookie-consent-banner p { margin: 0; font-size: .9rem; color: var(--muted); flex: 1; min-width: 240px; }
#cookie-consent-banner button {
  background: var(--accent); color: #fff; border: none; padding: .55rem 1.4rem;
  border-radius: 999px; font-size: .95rem; font-weight: 700; cursor: pointer; transition: background .15s ease;
}
#cookie-consent-banner button:hover { background: var(--accent-dark); }

/* ==== ACCESIBILIDAD ==== */
.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--accent); color: #fff;
  padding: .6rem 1rem; z-index: 100; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ==== RESPONSIVE ==== */
@media (max-width: 600px) {
  body { font-size: 17px; }
  .header-top { padding-block: .7rem; }
  .article-body { font-size: 1.02rem; }
}
