/* Librología — estilos globales */

:root {
  --bg: #F5EFE0;
  --surface: #FDFAF1;
  --text: #1F2933;
  --text-secondary: #5B5560;
  --accent: #1E88E5;
  --accent-strong: #1565C0;
  --accent-tint: rgba(30,136,229,0.10);
  --accent-red: #E53935;
  --accent-amber: #F5B400;
  --map-blue: #BBDDF5;
  --border: #E8DFC8;
  --shadow: rgba(31, 41, 51, 0.06);
  --footer-bg: #1F2933;
  --cta-glow: rgba(30,136,229,0.28);
  --radius: 16px;
  --max-width: 1100px;
  --font-display: "Gilda Display", Georgia, "Times New Roman", serif;
  --font-body: "Gilda Display", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--text);
  line-height: 1.55;
}

body.menu-open { overflow: hidden; }

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

a, button {
  -webkit-tap-highlight-color: rgba(30, 136, 229, 0.18);
}

/* Cabecera fija */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.2s ease, background 0.2s ease;
}
.site-header.scrolled {
  box-shadow: 0 4px 20px var(--shadow);
  background: rgba(255, 255, 255, 0.98);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  min-height: 44px;
}
.logo-link img { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; }

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}
@media (min-width: 861px) {
  .nav-panel {
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
  }
  .nav-links {
    flex-direction: row;
    gap: 1.5rem;
  }
  .cta-btn--menu {
    margin-left: 0.5rem;
    width: auto;
  }
}
.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.15s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.nav-links a:hover { color: var(--text); }
@media (hover: hover) and (pointer: fine) {
  .nav-links a:hover { color: var(--text); }
}
.nav-links a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.nav-links a:focus-visible,
.cta-btn:focus-visible,
.menu-toggle:focus-visible,
.logo-link:focus-visible,
.footer-social a:focus-visible,
.news-body .read-link:focus-visible,
.news-item a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.85rem 1.6rem;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  min-height: 48px;
  box-shadow: 0 8px 24px var(--cta-glow);
}
.cta-btn:hover { background: var(--accent-strong); }
.cta-btn:active { background: var(--accent-strong); }
@media (hover: hover) and (pointer: fine) {
  .cta-btn:hover { background: var(--accent-strong); }
}
.cta-btn--menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  min-height: 48px;
  width: 100%;
  box-shadow: 0 4px 14px rgba(30,136,229,0.18);
}
.cta-btn--menu:hover { background: var(--accent-strong); }
.cta-btn--menu:active { background: var(--accent-strong); }
@media (hover: hover) and (pointer: fine) {
  .cta-btn--menu:hover { background: var(--accent-strong); }
}

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 41, 51, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 100;
  pointer-events: none;
}
.nav-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.nav-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: 80%;
  max-width: 320px;
  height: 100vh;
  background: var(--surface);
  padding: 5rem 1.5rem 2rem;
  box-shadow: -10px 0 30px rgba(0,0,0,0.12);
  border-left: 1px solid var(--border);
  z-index: 101;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.nav-panel.open {
  right: 0;
}

/* Menú hamburguesa (móvil) */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  min-height: 44px;
  min-width: 44px;
  position: relative;
  z-index: 102;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 5px auto;
  border-radius: 1px;
  transition: 0.2s ease;
  transform-origin: center;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--surface);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 40%, rgba(245, 180, 80, 0.18), transparent 60%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem 1.25rem 4rem;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 1.5rem;
}
.hero-text h1 {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin: 0 0 0.5rem;
  font-weight: 400;
}
.hero-text .hero-logo {
  display: block;
  max-width: 520px;
  width: 100%;
  height: auto;
  margin: 0 0 0.5rem;
}
@media (max-width: 600px) {
  .hero-text .hero-logo { max-width: 360px; }
}
.hero-text {
  text-align: center;
  max-width: 640px;
}
.hero-text .subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin: 0 0 1.75rem;
}
.cta-btn--hero {
  padding: 1rem 2rem;
  font-size: 1.05rem;
  min-height: 52px;
}

/* Carrusel */
.carousel-section {
  background: var(--bg);
}
.carousel {
  position: relative;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 3rem;
}
.carousel-track {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 2rem 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-item {
  flex: 0 0 auto;
  width: 220px;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(31,41,51,0.10);
  scroll-snap-align: center;
  transition: transform 0.35s ease, box-shadow 0.35s ease, opacity 0.35s ease;
  opacity: 0.7;
  background: var(--surface);
}
.carousel-item--center {
  transform: scale(1.25);
  box-shadow: 0 24px 60px rgba(31,41,51,0.22);
  opacity: 1;
  z-index: 2;
  position: relative;
}
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(31,41,51,0.10);
  z-index: 3;
  min-height: 44px;
  min-width: 44px;
  transition: background 0.15s ease, transform 0.15s ease;
}
.carousel-arrow:hover { background: var(--bg); transform: translateY(-50%) scale(1.05); }
.carousel-arrow--left { left: 0.5rem; }
.carousel-arrow--right { right: 0.5rem; }
.carousel-arrow:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

@media (max-width: 600px) {
  .carousel { padding: 0 2.5rem; }
  .carousel-item { width: 170px; }
  .carousel-item--center { transform: scale(1.15); }
  .carousel-arrow { width: 40px; height: 40px; }
}

/* Cómo funciona */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem 1.25rem;
}
.section-header {
  text-align: center;
  margin-bottom: 3rem;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 0.25rem;
  letter-spacing: -0.03em;
  font-weight: 400;
}
.section-header p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 1.05rem;
}

/* Por qué Librología (tarjetas) */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 4px 14px rgba(31,41,51,0.04);
}
.card h3 { font-family: var(--font-display); margin: 0 0 0.5rem; font-size: 1.15rem; font-weight: 400; }
.card p { margin: 0; color: var(--text-secondary); font-size: 0.95rem; }

/* YouTube */
.youtube-section { background: linear-gradient(135deg, #F7F9FC 0%, #FFFFFF 100%); }
.youtube-box {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  box-shadow: 0 4px 14px rgba(31,41,51,0.04);
}
.youtube-box h2 { font-family: var(--font-display); margin: 0 0 0.75rem; font-size: 1.5rem; font-weight: 400; }
.youtube-box p { color: var(--text-secondary); margin: 0 0 1.75rem; }

.yt-embed { margin: 0 0 1.75rem; }
.yt-thumb {
  display: block;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
  box-shadow: 0 16px 48px rgba(0,0,0,0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}
.yt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.yt-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  transition: background 0.2s ease;
}
.yt-play svg {
  width: 72px;
  height: 72px;
  fill: #fff;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.5));
  transition: transform 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .yt-thumb:hover { box-shadow: 0 22px 60px rgba(0,0,0,0.22); }
  .yt-thumb:hover img { transform: scale(1.05); }
  .yt-thumb:hover .yt-play { background: rgba(0,0,0,0.2); }
  .yt-thumb:hover .yt-play svg { transform: scale(1.1); }
}

.yt-card {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: var(--footer-bg);
  color: #fff;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  min-height: 44px;
}
.yt-card:hover { border-color: rgba(255,255,255,0.18); box-shadow: 0 14px 36px rgba(0,0,0,0.18); }
@media (hover: hover) and (pointer: fine) {
  .yt-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.18); box-shadow: 0 14px 36px rgba(0,0,0,0.18); }
}
.yt-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.yt-thumb:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.yt-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: var(--accent-red);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.yt-icon svg { width: 24px; height: 18px; fill: #fff; }
.yt-info { text-align: left; line-height: 1.2; }
.yt-info .label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
  margin-bottom: 4px;
}
.yt-info .name {
  display: block;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

/* Últimas noticias (index) */
.news-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.news-preview a { text-decoration: none; color: inherit; }
.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(31,41,51,0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.news-card:hover { transform: translateY(-3px); box-shadow: 0 14px 40px rgba(31,41,51,0.08); }
@media (hover: hover) and (pointer: fine) {
  .news-card:hover { transform: translateY(-3px); box-shadow: 0 14px 40px rgba(31,41,51,0.08); }
}
.news-card img { width: 100%; height: 200px; object-fit: cover; background: var(--map-blue); }
.news-body { padding: 1.25rem 1.25rem 1.5rem; }
.news-body .date { font-size: 0.8rem; color: var(--accent-red); margin-bottom: 0.25rem; font-weight: 600; }
.news-body h3 { font-family: var(--font-display); font-size: 1.05rem; margin: 0 0 0.5rem; line-height: 1.3; font-weight: 400; }
.news-body p { font-size: 0.9rem; color: var(--text-secondary); margin: 0 0 1rem; }
.news-body .read-link { color: var(--accent-strong); font-weight: 600; text-decoration: none; font-size: 0.9rem; }
.news-body .read-link:hover { text-decoration: underline; }
@media (hover: hover) and (pointer: fine) {
  .news-body .read-link:hover { text-decoration: underline; }
}

/* CTA final */
.cta-final {
  text-align: center;
  padding: 5rem 1.25rem;
  background: linear-gradient(135deg, #1F2933 0%, #2A3743 100%);
  color: #fff;
}
.cta-final h2 { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 0 0 0.75rem; letter-spacing: -0.03em; font-weight: 400; }
.cta-final p { color: #ccc; margin: 0 0 1.5rem; }
.cta-final .badges { display: inline-flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.cta-final .badges img { height: 44px; width: auto; border-radius: 8px; border: 1px solid rgba(255,255,255,0.15); }

/* Footer */
.site-footer {
  background: var(--footer-bg);
  color: #ccc;
  padding: 3rem 1.25rem 1.5rem;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.footer-social {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  justify-content: center;
}
.footer-social a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  text-decoration: none;
  transition: opacity 0.15s ease;
  min-height: 44px;
  padding: 0.25rem 0.5rem;
}
.footer-social a:hover { opacity: 0.8; }
@media (hover: hover) and (pointer: fine) {
  .footer-social a:hover { opacity: 0.8; }
}
.footer-social img { width: 28px; height: 28px; }
.footer-copy { font-size: 0.85rem; color: #777; margin-top: 1rem; width: 100%; text-align: center; }

/* Página de noticias */
.news-page .news-list {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
}
.news-item {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 14px rgba(31,41,51,0.04);
}
.news-item img { width: 100%; height: 160px; object-fit: cover; border-radius: 10px; background: var(--map-blue); }
.news-item h3 { font-family: var(--font-display); margin: 0 0 0.35rem; font-size: 1.15rem; font-weight: 400; }
.news-item .date { font-size: 0.8rem; color: var(--accent-red); margin-bottom: 0.75rem; font-weight: 600; }
.news-item p { color: var(--text-secondary); font-size: 0.95rem; margin: 0 0 0.75rem; }
.news-item a { color: var(--accent-strong); font-weight: 600; text-decoration: none; }
.news-item a:hover { text-decoration: underline; }
@media (hover: hover) and (pointer: fine) {
  .news-item a:hover { text-decoration: underline; }
}

/* Responsive */
@media (max-width: 860px) {
  .nav-links a { min-height: 44px; display: inline-flex; align-items: center; padding: 0.5rem 0; }
  .nav-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  .nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
  .cta-btn--menu {
    margin-top: 0.5rem;
  }
  .menu-toggle { display: block; }
  .news-item { grid-template-columns: 1fr; }
  .news-item img { height: 200px; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-social { justify-content: center; }
}

@media (max-width: 600px) {
  .hero-inner { padding: 3rem 1rem 2.5rem; }
  .hero-text h1 { font-size: clamp(2.2rem, 8vw, 3rem); }
  .hero-text .subtitle { font-size: 1.05rem; }
  .section { padding: 3rem 1rem; }
  .section-header { margin-bottom: 2rem; }
  .cta-final { padding: 3rem 1rem; }
  .cta-final .badges { flex-direction: row; align-items: center; justify-content: center; flex-wrap: nowrap; }
  .cta-final .badges a { width: auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0.25rem 0; }
  .cta-final .badges img { height: clamp(36px, 11vw, 44px); }
  .footer-social a { margin-left: 0; }
  .footer-social { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; justify-content: center; }
  .site-footer { padding: 2rem 1rem 1rem; }
}

@media (max-width: 380px) {
  .nav-panel {
    width: 85%;
    max-width: 320px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 4rem);
  }
}

@media (min-width: 861px) {
  .nav-panel {
    position: static;
    height: auto;
    background: transparent;
    box-shadow: none;
    border-left: none;
    padding: 0;
    overflow: visible;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
  }
  .nav-panel.open {
    right: auto;
  }
  .nav-links {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
  }
  .cta-btn--menu {
    width: auto;
    margin-left: 0.5rem;
  }
}

/* Utilidades */
.skip-link:focus { position: absolute; top: 0; left: 0; z-index: 200; }
.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;
}
.carousel-arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
/* Utilidades */
.text-center { text-align: center; }
.mb-2 { margin-bottom: 2rem; }
