/* ============================================================
   Alcala Cultural - Diseno global v2
   Inyectado en todas las paginas via /css/global.css
   ============================================================ */

/* ============================================================
   0. VARIABLES GLOBALES
   ============================================================ */
:root {
  --primary: #C75B39;
  --primary-dark: #8B3A1F;
  --primary-light: #E88C6D;
  --accent: #C75B39;
  --bg: #FFF8F0;
  --bg-alt: #FDF0E3;
  --bg-card: #FFFFFF;
  --text: #2D1B13;
  --text-light: #6B4E3D;
  --text-soft: #888888;
  --border: #E8D5C8;
  --shadow: 0 2px 10px rgba(0,0,0,0.05);
  --card-shadow: 0 2px 12px rgba(139,58,31,0.12);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --transition-fast: 0.2s ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ============================================================
   1. HEADER BANNER (fondo blanco, banner panoramico centrado)
   ============================================================ */
.site-header {
  background: #ffffff;
  color: #2D1B13;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  position: static;
}
.header-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 12px 16px 8px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.header-brand {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  color: #2D1B13;
  line-height: 0;
}
.header-logo {
  width: 100%;
  max-width: 1000px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
.header-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  font-size: 13px;
}
.header-nav a { color: #6B4E3D; text-decoration: none; }
.header-nav a:hover, .header-nav a:active { color: #C75B39; }

.menu-btn {
  display: none;
  background: transparent;
  border: 1px solid #E8D5C8;
  color: #2D1B13;
  font-size: 20px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

/* ============================================================
   2. MENU MOVIL
   ============================================================ */
.menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2000;
  align-items: flex-start;
  justify-content: flex-end;
}
.menu-overlay.open { display: flex; }

.menu-panel {
  background: #fff;
  color: #2D1B13;
  width: min(86vw, 360px);
  height: 100%;
  overflow-y: auto;
  padding: 20px;
  box-shadow: -4px 0 20px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: acSlideIn 0.25s ease-out;
  position: relative;
}
@keyframes acSlideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.menu-panel a {
  color: #2D1B13;
  text-decoration: none;
  padding: 12px 8px;
  font-size: 1rem;
  border-bottom: 1px solid #E8D5C8;
}
.menu-panel a:hover { color: #C75B39; }
.menu-panel a:last-of-type { border-bottom: none; }
.menu-close {
  align-self: flex-end;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: #C75B39;
  cursor: pointer;
  padding: 0 6px 10px;
  line-height: 1;
}
.menu-footer {
  margin-top: auto;
  padding-top: 18px;
  font-size: 0.75rem;
  color: #6B4E3D;
  border-top: 1px solid #E8D5C8;
  text-align: center;
}
.menu-footer p { margin: 4px 0; line-height: 1.4; }

@media (max-width: 760px) {
  .header-container { padding: 8px 10px 6px; gap: 6px; }
  .header-logo { border-radius: 6px; }
  .header-nav { display: none; }
  .menu-btn {
    display: block;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  }
}

/* ============================================================
   3. CONTENIDO DE PAGINA
   ============================================================ */
.main-content {
  max-width: 960px;
  margin: 2rem auto 3rem;
  padding: 2rem 1.5rem;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  line-height: 1.7;
}

.article-title {
  text-align: center;
  margin: 0 auto 1.8rem;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  max-width: 800px;
  padding: 0 1rem;
}

.main-content h2,
.main-content h3,
.main-content h4 {
  text-align: center;
  margin: 2rem auto 1rem;
  color: var(--text);
  font-weight: 700;
  max-width: 800px;
}

.article-body {
  text-align: left;
  max-width: 800px;
  margin: 0 auto;
}
.article-body p {
  margin: 0 0 1.1em;
  line-height: 1.75;
}
.article-body h2,
.article-body h3,
.article-body h4 {
  text-align: left;
  margin: 1.8em 0 0.8em;
  color: var(--accent);
  font-weight: 700;
  line-height: 1.3;
}
.article-body h2 { font-size: 1.4rem; }
.article-body h3 { font-size: 1.2rem; }
.article-body h4 { font-size: 1.05rem; }
.article-body ul,
.article-body ol {
  margin: 0 0 1.2em 1.5em;
  padding-left: 1rem;
}
.article-body li { margin-bottom: 0.4em; }
.article-body blockquote {
  margin: 1.2em 0;
  padding: 0.8em 1.2em;
  border-left: 4px solid var(--accent);
  background: var(--bg);
  color: var(--text);
  font-style: italic;
  border-radius: 0 8px 8px 0;
}
.article-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem auto;
  border-radius: 10px;
}
.article-body a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.article-body a:hover { text-decoration: underline; }
.article-body strong,
.article-body b { color: var(--text); font-weight: 700; }

/* Imagen destacada al principio de las paginas generadas */
.main-content > div > img,
.main-content > img {
  display: block;
  margin: 1.5rem auto;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

/* Tablas responsivas */
.article-body table,
.main-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 0.95rem;
}
.article-body th,
.article-body td,
.main-content th,
.main-content td {
  border: 1px solid var(--border);
  padding: 0.55em 0.8em;
  text-align: left;
}
.article-body th,
.main-content th { background: var(--bg); font-weight: 700; }

.tabla-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.2em 0;
}
.tabla-scroll table { margin: 0; }

/* ============================================================
   4. ENLACE VOLVER
   ============================================================ */
.back-link {
  display: block;
  text-align: center;
  margin: 2rem auto 0;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  width: fit-content;
}
.back-link:hover { text-decoration: underline; }

/* ============================================================
   5. BUSCADOR DE CABECERA
   ============================================================ */
.header-search {
  max-width: 760px;
  margin: 10px auto 0;
  padding: 0 16px;
}
.header-search form {
  display: flex;
  gap: 8px;
  background: #fff;
  border-radius: 50px;
  padding: 6px 6px 6px 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  border: 1px solid #E8D5C8;
}
.header-search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  color: #2D1B13;
  background: transparent;
  min-width: 0;
}
.header-search button {
  background: #C75B39;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.header-search button:hover { background: #A84A2E; }

@media (max-width: 600px) {
  .header-search form { padding: 5px 5px 5px 14px; }
  .header-search button { padding: 8px 14px; }
}

/* ============================================================
   6. FOOTER BANNER
   ============================================================ */
.footer {
  background: #ffffff;
  padding: 24px 16px 12px;
  text-align: center;
  margin-top: 40px;
  line-height: 1.6;
  border-top: 1px solid #E8D5C8;
  position: relative;
}
.footer-banner {
  display: block;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  line-height: 0;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.footer-banner:hover { opacity: 0.92; transform: translateY(-2px); }
.footer-banner-img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}
.footer-nav {
  display: none;
  max-width: 1000px;
  margin: 0 auto 18px;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  font-size: 13px;
  text-align: center;
  padding: 0 16px;
}
.footer-nav a {
  color: #6B4E3D;
  text-decoration: none;
  white-space: nowrap;
}
.footer-nav a:hover, .footer-nav a:active { color: #C75B39; text-decoration: underline; }
@media (min-width: 761px) {
  .footer-nav { display: flex; }
}

/* ============================================================
   7. BARRA COMPARTIR REDES
   ============================================================ */
.ac-share {
  position: static;
  z-index: 950;
  background: rgba(255,255,255,0.95);
  border: 1px solid #E8D5C8;
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.18);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: calc(100% - 20px);
  margin: 0 auto 14px;
  overflow-x: auto;
}
.ac-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.ac-share-btn:hover { transform: translateY(-2px); }
.ac-share-btn svg { width: 15px; height: 15px; fill: currentColor; }
.ac-share-fb    { background: #1877f2; }
.ac-share-x     { background: #14171a; }
.ac-share-wa    { background: #25d366; }
.ac-share-tg    { background: #0088cc; }
.ac-share-in    { background: #0a66c2; }
.ac-share-mast  { background: #563acc; }
.ac-share-link  { background: #6B4E3D; cursor: pointer; border: none; }
.ac-share-btn.copied { background: #2e7d32; }
.ac-toast {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: #2D1B13;
  color: #fff;
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 8px;
  z-index: 960;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.ac-toast.show { opacity: 1; }

/* ============================================================
   8. BOTONES RESUMIR CON IA
   ============================================================ */
.ac-toolbar {
  max-width: 1000px;
  margin: 0 auto 16px;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ac-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #E8D5C8;
  border-radius: 12px;
  padding: 8px 12px;
}
.ac-ai-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #E8D5C8;
  background: #FFF8F0;
  color: #2D1B13;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s ease;
}
.ac-toolbar .ac-ai-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
}
.ac-toolbar .ac-ai-btn svg { width: 18px; height: 18px; fill: currentColor; }
.ac-ai-btn:hover {
  border-color: #C75B39;
  color: #C75B39;
  box-shadow: 0 2px 8px rgba(199,91,57,0.15);
  transform: translateY(-2px);
}
@media (max-width: 760px) {
  .ac-toolbar { gap: 6px; padding: 0 10px; }
  .ac-toolbar-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 6px 10px;
    gap: 5px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .ac-toolbar-row::-webkit-scrollbar { display: none; }
  .ac-toolbar .ac-ai-btn { width: 30px; height: 30px; flex-shrink: 0; }
  .ac-toolbar .ac-ai-btn svg { width: 15px; height: 15px; }
}

/* ============================================================
   9. CARDS (indices de seccion)
   ============================================================ */
.cards-grid,
.card-grid,
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  max-width: 1100px;
  margin: 0 auto;
}
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}
.card a { text-decoration: none; color: inherit; }
.card-img,
.card-image {
  height: 150px;
  background: #f0e6e0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a4b2a;
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
}
.card-img img,
.card-image img,
.card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card-title,
.card h2,
.card h3 {
  font-size: 1.02rem;
  color: var(--text);
  margin: 0;
}
.card-text,
.card p {
  font-size: 0.88rem;
  color: var(--text-light);
  line-height: 1.5;
  margin: 0;
}
.card-arrow {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  margin-top: auto;
}
.card-link {
  margin: 0 16px 14px;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
}
.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: auto;
  text-align: center;
}
.btn:hover { background: #A84A2E; }

/* ============================================================
   10. RESPONSIVE PARA CONTENIDO
   ============================================================ */
@media (max-width: 640px) {
  .grid, .cards-grid, .card-grid, .bp-grid {
    grid-template-columns: 1fr !important;
  }
  .grid .card, .cards-grid .card, .card-grid .card, .bp-grid .card {
    width: 100% !important;
  }
}
@media (max-width: 768px) {
  .main-content {
    margin: 1rem auto 2rem;
    padding: 1.2rem 1rem;
    border-radius: 8px;
  }
  .article-title { font-size: 1.5rem; }
  .article-body { font-size: 1rem; }
  .article-body h2 { font-size: 1.25rem; }
  .article-body h3 { font-size: 1.1rem; }
  .article-body table,
  .main-content table { font-size: 0.88rem; }
  .article-body th,
  .article-body td,
  .main-content th,
  .main-content td { padding: 0.4em 0.55em; }
}



/* ============================================================
   TABLAS CONVERTIDAS A CARDS
   ============================================================ */
.cards-tabla {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 1.5em 0;
}
.card-tabla {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card-tabla:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}
.card-tabla h3 {
  font-size: 1.1rem;
  color: var(--accent);
  margin: 0 0 10px;
  font-weight: 700;
}
.card-tabla p {
  font-size: 0.92rem;
  color: var(--text);
  margin: 0 0 6px;
  line-height: 1.5;
}
.card-tabla p:last-child {
  margin-bottom: 0;
}
.card-tabla p strong {
  color: var(--text-light);
  font-weight: 600;
}

@media (max-width: 640px) {
  .cards-tabla {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   11. SUBTÍTULO CON ICONO (IELAT y similares)
   ============================================================ */
.subtitle-line {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin: 8px 0;
}
.subtitle-line .icon {
  font-size: 1.3em;
  line-height: 1;
}
.subtitle-line .subtitle {
  margin: 0;
  font-size: 1em;
}