/* ===========================================================
   ¿Qué se celebra hoy? — Calendario Curioso
   Estilo divertido y colorido
   =========================================================== */

:root {
  --bg-1: #ff9a9e;
  --bg-2: #fecfef;
  --accent: #ff5e7e;
  --ink: #2b2440;
  --ink-soft: #6c6385;
  --card-bg: rgba(255, 255, 255, 0.92);
  --shadow: 0 24px 60px rgba(43, 36, 64, 0.22);
  --radius: 28px;
  --font-head: "Baloo 2", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* El atributo `hidden` debe ganar siempre, incluso sobre display:inline-block */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
  background-size: 200% 200%;
  animation: drift 18s ease infinite;
  transition: background 0.8s ease;
  overflow-x: hidden;
}

@keyframes drift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.app {
  width: min(620px, 100%);
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: relative;
  z-index: 1;
}

/* ---------- Cabecera ---------- */
.topbar { text-align: center; color: var(--ink); }

.logo {
  font-family: var(--font-head);
  font-size: clamp(1.6rem, 5vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5);
}

.tagline {
  margin-top: 6px;
  font-size: 1rem;
  color: var(--ink-soft);
}
.tagline strong { color: var(--accent); }

/* ---------- Tarjeta principal ---------- */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  padding: 36px 28px 40px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 3px solid rgba(255, 255, 255, 0.7);
  position: relative;
  overflow: hidden;
  animation: pop 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% -20%, var(--accent), transparent 60%);
  opacity: 0.16;
  pointer-events: none;
}

@keyframes pop {
  from { transform: scale(0.94) translateY(10px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.card.is-swapping { animation: pop 0.45s cubic-bezier(0.18, 0.89, 0.32, 1.28); }

.card__date {
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 1.05rem;
  letter-spacing: 0.3px;
}

.card__emoji {
  font-size: clamp(4.5rem, 18vw, 7rem);
  line-height: 1;
  margin: 10px 0 6px;
  filter: drop-shadow(0 10px 18px rgba(43, 36, 64, 0.25));
  animation: bob 3s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-10px) rotate(2deg); }
}

.card__kicker {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.card__title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(1.8rem, 6.5vw, 2.7rem);
  line-height: 1.1;
  margin: 4px 0 14px;
  color: var(--ink);
  text-wrap: balance;
}

.card__tags {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.card__badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Chip de confianza: distingue días oficiales de días populares */
.card__trust {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.4px;
  padding: 6px 12px;
  border-radius: 999px;
}
.card__trust--official {
  background: rgba(16, 165, 116, 0.16);
  color: #0a7d55;
}
.card__trust--popular {
  background: rgba(108, 99, 133, 0.14);
  color: var(--ink-soft);
}

.card__desc {
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--ink);
  max-width: 42ch;
  margin: 0 auto;
}

.card__more {
  margin-top: 16px;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.card__more b { color: var(--accent); }

.card__more .more__link {
  font: inherit;
  font-weight: 800;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0 1px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
  transition: opacity 0.15s ease;
}
.card__more .more__link:hover { opacity: 0.7; }
.card__more .more__link:active { opacity: 0.5; }

.card__source {
  display: inline-block;
  margin-top: 18px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: none;
  border: 2px solid rgba(108, 99, 133, 0.25);
  border-radius: 999px;
  padding: 5px 14px;
  transition: color 0.2s, border-color 0.2s, transform 0.15s;
}
.card__source:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 18px;
}
.card__actions .card__source { margin-top: 0; }

.card__affiliate {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 7px 16px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, filter 0.2s ease;
}
.card__affiliate:hover { transform: translateY(-2px); filter: brightness(1.06); }

.footer__donate {
  display: inline-block;
  margin-top: 10px;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
  border: 2px solid rgba(255, 255, 255, 0.8);
}
.footer__donate:hover { background: #fff; }

/* ---------- Controles ---------- */
.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
}

.btn {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  border: 3px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s;
  box-shadow: 0 8px 20px rgba(43, 36, 64, 0.16);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.btn:hover { transform: translateY(-3px) scale(1.03); background: #fff; }
.btn:active { transform: translateY(0) scale(0.98); }

/* Input de fecha oculto: el botón "Otra fecha" lo abre con showPicker() */
.date-hidden {
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
  padding: 0;
  pointer-events: none;
}

/* ---------- Próximos días ---------- */
.upcoming {
  background: rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  padding: 20px 22px;
  border: 3px solid rgba(255, 255, 255, 0.5);
}

.upcoming__title {
  font-family: var(--font-head);
  font-size: 1.2rem;
  margin-bottom: 12px;
  color: var(--ink);
}

.upcoming__list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.upcoming__item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.upcoming__item:hover { transform: translateX(4px); box-shadow: 0 6px 16px rgba(43, 36, 64, 0.14); }

.upcoming__emoji { font-size: 1.8rem; line-height: 1; }
.upcoming__info { display: flex; flex-direction: column; }
.upcoming__name { font-weight: 800; color: var(--ink); }
.upcoming__when { font-size: 0.85rem; color: var(--ink-soft); }

/* ---------- Footer ---------- */
.footer { text-align: center; color: var(--ink-soft); font-size: 0.9rem; padding-bottom: 8px; }
.footer__cal { margin-top: 8px; }
.footer__cal a { color: var(--accent); font-weight: 800; text-decoration: none; }
.footer__cal a:hover { text-decoration: underline; }

/* ---------- Este día en la historia ---------- */
.history {
  background: rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  padding: 20px 22px;
  border: 3px solid rgba(255, 255, 255, 0.5);
}
.history__title { font-family: var(--font-head); font-size: 1.2rem; margin-bottom: 12px; }
.history__list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.history__item { line-height: 1.5; }
.history__year {
  display: inline-block;
  min-width: 3.4em;
  font-family: var(--font-head);
  font-weight: 800;
  color: var(--accent);
}
.history__credit { margin-top: 10px; font-size: 0.8rem; color: var(--ink-soft); opacity: 0.8; }

/* ---------- Publicidad ---------- */
.ad { text-align: center; }
.ad__label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-soft);
  opacity: 0.7;
  margin-bottom: 6px;
}
.ad__box {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.4);
  border: 2px dashed rgba(108, 99, 133, 0.35);
  border-radius: 18px;
  color: var(--ink-soft);
  font-weight: 700;
  padding: 12px;
}

/* ---------- Confeti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.confetti span {
  position: absolute;
  top: -40px;
  font-size: 1.4rem;
  animation: fall linear forwards;
  will-change: transform;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(360deg); opacity: 0.9; }
}

/* ---------- Páginas de ficha (dia/*.html) e índice (calendario.html) ---------- */
.logo__link { color: inherit; text-decoration: none; }

.detail-nav { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.detail-nav__link {
  flex: 1 1 45%;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 6px 16px rgba(43, 36, 64, 0.1);
  transition: transform 0.15s ease;
}
.detail-nav__link:hover { transform: translateY(-2px); }

.related {
  background: rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  padding: 20px 22px;
  border: 3px solid rgba(255, 255, 255, 0.5);
}
.related__title { font-family: var(--font-head); font-size: 1.2rem; margin-bottom: 12px; }
.related__list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.related__list a {
  display: block;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  transition: transform 0.15s ease;
}
.related__list a:hover { transform: translateX(4px); }
.related__list span { color: var(--ink-soft); font-weight: 600; font-size: 0.85rem; }
.related__more { margin-top: 12px; }
.related__more a { color: var(--accent); font-weight: 800; text-decoration: none; }
.footer__home { color: var(--accent); font-weight: 800; text-decoration: none; }

.cal-month {
  background: rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  padding: 18px 22px;
  border: 3px solid rgba(255, 255, 255, 0.5);
}
.cal-month__title { font-family: var(--font-head); font-size: 1.4rem; margin-bottom: 10px; color: var(--ink); }
.cal-list { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
@media (max-width: 560px) { .cal-list { grid-template-columns: 1fr; } }
.cal-list a { text-decoration: none; color: var(--ink); font-weight: 600; }
.cal-list a:hover { color: var(--accent); }
.cal-list span { color: var(--ink-soft); font-weight: 500; font-size: 0.82rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(16px);
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(43, 36, 64, 0.35);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Respeto a preferencias de movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  body, .card__emoji, .card { animation: none; }
  .confetti { display: none; }
}

/* ---------- Enlaces legales en el footer ---------- */
.footer__legal {
  margin-top: 10px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.footer__legal a {
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-decoration: none;
}
.footer__legal a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- Banner de consentimiento de cookies ---------- */
.cc-banner {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(680px, calc(100% - 24px));
  background: #fff;
  color: var(--ink);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 18px 20px;
  z-index: 9999;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  animation: pop 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.cc-banner__text {
  flex: 1 1 280px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.cc-banner__text a { color: var(--accent); font-weight: 700; }
.cc-banner__actions { display: flex; gap: 10px; margin-left: auto; }
.cc-btn {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.92rem;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cc-btn:hover { transform: translateY(-2px); }
.cc-btn--accept {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(255, 94, 126, 0.45);
}
.cc-btn--ghost { background: rgba(43, 36, 64, 0.08); color: var(--ink); }

/* ---------- Páginas legales (texto largo) ---------- */
.legal {
  background: var(--card-bg);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  padding: 32px 30px 38px;
  box-shadow: var(--shadow);
  border: 3px solid rgba(255, 255, 255, 0.7);
  text-align: left;
  line-height: 1.6;
}
.legal h1 {
  font-family: var(--font-head);
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--accent);
  margin-bottom: 6px;
}
.legal h2 { font-family: var(--font-head); font-size: 1.2rem; margin: 24px 0 8px; color: var(--ink); }
.legal p, .legal li { color: var(--ink-soft); margin-bottom: 10px; }
.legal ul { padding-left: 22px; }
.legal a { color: var(--accent); font-weight: 700; }
.legal__updated { font-size: 0.85rem; opacity: 0.8; }
@media (max-width: 480px) {
  .cc-banner__actions { width: 100%; }
  .cc-btn { flex: 1; }
}
