/* =============================================
   LA MÁQUINA DE SUEÑOS — Estilos Globales
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
  --noche:    #0F0A1E;
  --purpura:  #1E1245;
  --violeta:  #6D28D9;
  --violeta-claro: #8B5CF6;
  --rosa:     #D946EF;
  --rosa-suave: #F0ABFC;
  --dorado:   #F59E0B;
  --dorado-claro: #FCD34D;
  --luna:     #EFF6FF;
  --luna-dim: #BFDBFE;
  --verde:    #10B981;
  --verde-claro: #6EE7B7;
  --rojo:     #EF4444;
  --azul:     #3B82F6;
  --blanco:   #FFFFFF;
  --texto:    #E8F0FF;
  --texto-dim: #A5B4FC;
}

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

html { scroll-behavior: smooth; font-size: 17px; }

body {
  background: var(--noche);
  color: var(--texto);
  font-family: 'Nunito', sans-serif;
  font-size: 19px;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- FONDO ESTRELLADO ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at  8% 12%, rgba(255,255,255,0.90) 0%, transparent 100%),
    radial-gradient(1px   1px   at 18% 35%, rgba(252,211,77, 0.70) 0%, transparent 100%),
    radial-gradient(2px   2px   at 30%  6%, rgba(255,255,255,0.85) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 45% 22%, rgba(216,180,254,0.80) 0%, transparent 100%),
    radial-gradient(1px   1px   at 58%  9%, rgba(255,255,255,0.90) 0%, transparent 100%),
    radial-gradient(2px   2px   at 72% 18%, rgba(252,211,77, 0.60) 0%, transparent 100%),
    radial-gradient(1px   1px   at 85% 28%, rgba(255,255,255,0.75) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 92%  5%, rgba(216,180,254,0.70) 0%, transparent 100%),
    radial-gradient(1px   1px   at 12% 55%, rgba(255,255,255,0.65) 0%, transparent 100%),
    radial-gradient(1px   1px   at 25% 70%, rgba(252,211,77, 0.50) 0%, transparent 100%),
    radial-gradient(2px   2px   at 40% 82%, rgba(255,255,255,0.80) 0%, transparent 100%),
    radial-gradient(1px   1px   at 65% 75%, rgba(216,180,254,0.60) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 80% 62%, rgba(255,255,255,0.70) 0%, transparent 100%),
    radial-gradient(1px   1px   at 90% 85%, rgba(252,211,77, 0.65) 0%, transparent 100%),
    radial-gradient(1px   1px   at  5% 90%, rgba(255,255,255,0.55) 0%, transparent 100%),
    radial-gradient(2px   2px   at 50% 95%, rgba(216,180,254,0.55) 0%, transparent 100%);
  background-color: transparent;
}

/* ---- CIELO ANIMADO (lo inyecta main.js) ---- */
.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* Estrella que titila */
.sky .twinkle {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px 1px currentColor;
  opacity: 0.2;
  animation: twinkle var(--dur, 3s) ease-in-out var(--delay, 0s) infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.12; transform: scale(0.6); }
  50%      { opacity: 1;    transform: scale(1); }
}

/* Estrella fugaz / meteorito (posición y dirección las pone el JS) */
.sky .shooting {
  position: absolute;
  width: 150px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.95) 100%);
  filter: drop-shadow(0 0 6px rgba(191,219,254,0.9));
  opacity: 0;
}
.sky .shooting::after {
  content: '';
  position: absolute;
  right: -2px;
  top: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px 3px rgba(255,255,255,0.9);
}
.sky .shooting.meteor {
  height: 3px;
  width: 175px;
  background: linear-gradient(90deg, rgba(245,158,11,0) 0%, rgba(252,211,77,0.95) 100%);
  filter: drop-shadow(0 0 8px rgba(245,158,11,0.9));
}
.sky .shooting.meteor::after {
  background: #FCD34D;
  box-shadow: 0 0 12px 3px rgba(245,158,11,0.9);
}
@keyframes shoot {
  0%   { opacity: 0; transform: rotate(var(--ang, 20deg)) translateX(0); }
  10%  { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--ang, 20deg)) translateX(var(--dist, 700px)); }
}

/* Satélite: puntito de luz que cruza despacio */
.sky .satellite {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #BFDBFE;
  box-shadow: 0 0 8px 2px rgba(147,197,253,0.9), 0 0 2px 0 #fff;
  opacity: 0;
}
@keyframes sat-blink {
  0%, 100%   { opacity: 0; }
  8%, 92%    { opacity: 1; }
  46%, 54%   { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .sky { display: none; }
}

/* ---- NAV ---- */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(15, 10, 30, 0.95);
  backdrop-filter: blur(16px);
}

/* Contenido del nav: limitado y centrado; menú en el centro real */
.nav-inner {
  max-width: 1520px;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

.nav-logo {
  justify-self: start;
  display: flex;
  align-items: center;
  padding: 0.45rem 0;
  text-decoration: none;
}

.nav-logo img {
  height: 104px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(217,70,239,0.30));
}

/* Enlaces del menú: centrados de verdad (columna central de la rejilla) */
.nav-links {
  justify-self: center;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.25rem;
}

/* Logo institucional (pastilla blanca, a la derecha) */
.nav-junta {
  justify-self: end;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 9px;
  padding: 2px 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.30);
}

.nav-junta img {
  height: 80px;
  width: auto;
  max-width: 270px;
  display: block;
}

.nav a:not(.nav-logo) {
  color: var(--luna-dim);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
  padding: 0.9rem 0.9rem;
  border-radius: 8px;
  transition: color 0.18s, background 0.18s;
  white-space: nowrap;
}

.nav a:not(.nav-logo):hover  { color: var(--dorado-claro); background: rgba(109,40,217,0.15); }
.nav a:not(.nav-logo).active { color: var(--dorado-claro); background: rgba(109,40,217,0.25); }

/* ---- PÁGINA WRAPPER ---- */
.page {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 4rem 2rem 6rem;
}

.page-wide {
  position: relative;
  z-index: 1;
  max-width: 1300px;
  margin: 0 auto;
  padding: 4rem 2rem 6rem;
}

/* ---- ENCABEZADOS DE SECCIÓN ---- */
.page-eyebrow {
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rosa);
  margin-bottom: 0.5rem;
}

.page-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  color: var(--blanco);
  line-height: 1.1;
  margin-bottom: 0.8rem;
}

.page-desc {
  font-size: 1.15rem;
  color: var(--luna-dim);
  max-width: 680px;
  line-height: 1.75;
  margin-bottom: 3rem;
  font-weight: 600;
}

/* ---- DIVISOR ---- */
.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(109,40,217,0.6), rgba(217,70,239,0.4), transparent);
  margin: 0;
  position: relative; z-index: 1;
}

/* ---- BOTONES ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  padding: 0.8rem 1.8rem;
  border-radius: 999px;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--violeta), var(--rosa));
  color: var(--blanco);
  box-shadow: 0 4px 20px rgba(217,70,239,0.35);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(217,70,239,0.5); }

.btn-ghost {
  background: transparent;
  color: var(--luna);
  border: 2px solid rgba(109,40,217,0.6);
}
.btn-ghost:hover { border-color: var(--rosa-suave); color: var(--rosa-suave); transform: translateY(-2px); }

.btn-gold {
  background: linear-gradient(135deg, var(--dorado), #F97316);
  color: #1a0a00;
  font-weight: 900;
}
.btn-gold:hover { transform: translateY(-3px); box-shadow: 0 6px 24px rgba(245,158,11,0.45); }

.btn-sm {
  font-size: 0.9rem;
  padding: 0.5rem 1.2rem;
}

/* ---- CARDS GENÉRICAS ---- */
.card {
  background: rgba(30, 18, 69, 0.65);
  border: 1px solid rgba(109, 40, 217, 0.35);
  border-radius: 20px;
  padding: 1.8rem;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(217, 70, 239, 0.5);
  box-shadow: 0 8px 32px rgba(109, 40, 217, 0.2);
}

.card-icon { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; }

.card h3 {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  color: var(--dorado-claro);
  margin-bottom: 0.6rem;
}

.card p {
  font-size: 1rem;
  color: var(--luna-dim);
  line-height: 1.65;
  font-weight: 600;
}

/* ---- GRIDS ---- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.4rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.4rem; }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4, .grid-auto { grid-template-columns: 1fr; }
  .page, .page-wide { padding: 2rem 1.2rem 4rem; }
  .nav-inner { padding: 0 1rem; }
}

/* ===== Nav responsive: el menú NUNCA se parte; logo y texto se reducen por
   tramos para que todo quepa en una sola línea hasta que toque apilar ===== */
@media (max-width: 1500px) {
  .nav-logo img { height: 78px; }
  .nav-junta img { height: 62px; }
  .nav a:not(.nav-logo) { font-size: 0.96rem; padding: 0.65rem 0.45rem; }
  .nav-inner { gap: 0.5rem; }
}
@media (max-width: 1250px) {
  /* ya no cabe en una línea: fila centrada que puede envolver */
  .nav-inner { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1rem; }
  .nav-links { flex-wrap: wrap; }
  .nav-logo img { height: 72px; }
  .nav-junta img { height: 60px; }
}
@media (max-width: 600px) {
  .nav-logo img { height: 56px; }
  .nav-junta img { height: 46px; }
}

/* ---- TAGS / BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(109,40,217,0.25);
  border: 1px solid rgba(109,40,217,0.5);
  color: var(--luna);
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 800;
}

.tag-selectable {
  display: inline-block;
  background: rgba(109,40,217,0.2);
  border: 1.5px solid rgba(109,40,217,0.45);
  color: var(--luna);
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  user-select: none;
}
.tag-selectable:hover  { background: rgba(217,70,239,0.2); border-color: var(--rosa); color: var(--blanco); }
.tag-selectable.active { background: rgba(217,70,239,0.35); border-color: var(--rosa-suave); color: var(--blanco); }

/* ---- AVISO / CALLOUT ---- */
.callout {
  border-radius: 16px;
  padding: 1.3rem 1.6rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin: 1.5rem 0;
}

.callout-icon { font-size: 1.8rem; flex-shrink: 0; line-height: 1; }
.callout-body { font-size: 1rem; font-weight: 600; line-height: 1.65; }
.callout-body strong { font-weight: 900; }

.callout-gold   { background: rgba(245,158,11,0.10); border: 1px solid rgba(245,158,11,0.35); color: #FDE68A; }
.callout-green  { background: rgba(16,185,129,0.10); border: 1px solid rgba(16,185,129,0.35); color: var(--verde-claro); }
.callout-red    { background: rgba(239,68,68,0.10);  border: 1px solid rgba(239,68,68,0.35);  color: #FCA5A5; }
.callout-purple { background: rgba(109,40,217,0.15); border: 1px solid rgba(139,92,246,0.4);  color: var(--luna-dim); }

/* ---- PROMPT BOX ---- */
.prompt-box {
  background: rgba(10, 6, 25, 0.85);
  border: 2px dashed rgba(245,158,11,0.4);
  border-radius: 16px;
  padding: 1.4rem 1.8rem;
}

.prompt-box .pb-label {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dorado);
  margin-bottom: 0.6rem;
}

.prompt-box p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--luna);
  font-weight: 600;
}

/* ---- FORM FIELDS ---- */
.field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--dorado-claro);
  letter-spacing: 0.04em;
  margin-bottom: 0.45rem;
}

.field select,
.field input[type="text"],
.field textarea {
  width: 100%;
  background: rgba(10, 6, 25, 0.80);
  border: 1.5px solid rgba(109,40,217,0.5);
  color: var(--luna);
  padding: 0.75rem 1.1rem;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  appearance: none;
  transition: border-color 0.2s;
}

.field select:focus,
.field input:focus,
.field textarea:focus { border-color: var(--rosa); }

.field select option { background: #1E1245; }

/* ---- FOOTER ---- */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(109,40,217,0.3);
  padding: 2.5rem 2rem;
  text-align: center;
  background: rgba(15,10,30,0.6);
}

.site-footer .footer-logo {
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  color: var(--dorado-claro);
  margin-bottom: 0.4rem;
}

.site-footer p {
  font-size: 0.92rem;
  color: rgba(165,180,252,0.5);
  font-weight: 600;
}

/* ---- UTILS ---- */
.text-gold   { color: var(--dorado-claro); }
.text-pink   { color: var(--rosa-suave); }
.text-green  { color: var(--verde-claro); }
.text-dim    { color: var(--luna-dim); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 3rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.flex  { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.text-center { text-align: center; }
.full { grid-column: 1 / -1; }

/* ---- ANIMACIONES ---- */
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%       { transform: translateY(-16px) rotate(2deg); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(217,70,239,0.3); }
  50%       { box-shadow: 0 0 40px rgba(217,70,239,0.6); }
}
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}
@keyframes float-soft {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

/* ===========================================
   CABECERA CON PERSONAJE QUE HABLA (greeter)
   =========================================== */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2.5rem;
  flex-wrap: wrap;
  margin-bottom: 2.75rem;
}

.page-head-text {
  flex: 1 1 340px;
  max-width: 600px;
  min-width: 0;
}

.greeter {
  flex: 0 0 auto;
  width: 350px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
}

.greeter-img {
  width: 310px;
  height: auto;
  filter: drop-shadow(0 12px 26px rgba(0,0,0,0.45));
  animation: float-soft 5s ease-in-out infinite;
  order: 2;
}

.greeter-name {
  order: 3;
  margin-top: 0.7rem;
  font-family: 'Fredoka One', cursive;
  font-size: 0.95rem;
  color: var(--dorado-claro);
  background: rgba(109,40,217,0.25);
  border: 1px solid rgba(109,40,217,0.5);
  padding: 0.2rem 0.9rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* Burbuja de diálogo */
.speech {
  order: 1;
  position: relative;
  background: var(--luna);
  color: #2A1A4A;
  font-weight: 800;
  font-size: 0.98rem;
  line-height: 1.4;
  text-align: center;
  border-radius: 18px;
  padding: 0.9rem 1.1rem;
  min-height: 3.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-shadow: 0 8px 22px rgba(0,0,0,0.35);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.speech.show { opacity: 1; transform: translateY(0); }

/* Pico de la burbuja apuntando al personaje */
.speech::after {
  content: "";
  position: absolute;
  bottom: -11px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 12px 11px 0 11px;
  border-style: solid;
  border-color: var(--luna) transparent transparent transparent;
}

@media (max-width: 600px) {
  .greeter { width: 250px; }
  .greeter-img { width: 210px; }
}
@media (prefers-reduced-motion: reduce) {
  .greeter-img { animation: none; }
}

/* ===========================================
   PESTAÑA "VOLVER" (lateral izq.) + BOTÓN PANTALLA COMPLETA
   =========================================== */
.volver-tab {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 250;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  background: #2E78F0;
  color: #fff;
  font-family: 'Fredoka One', cursive;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  text-decoration: none;
  padding: 1.3rem 0.55rem;
  border-radius: 0 16px 16px 0;
  box-shadow: 3px 3px 14px rgba(0,0,0,0.45);
  transition: padding-left 0.18s, background 0.18s;
}
.volver-tab:hover { background: #1f63d6; padding-left: 0.9rem; }
.volver-tab:focus-visible { outline: 3px solid var(--dorado-claro); outline-offset: 2px; }

.fs-btn {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 250;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(30,18,69,0.92);
  border: 1.5px solid rgba(109,40,217,0.6);
  color: var(--luna-dim);
  font-family: 'Fredoka One', cursive;
  font-size: 0.92rem;
  padding: 0.6rem 1.05rem;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  transition: color 0.18s, border-color 0.18s, transform 0.12s;
}
.fs-btn:hover { color: var(--dorado-claro); border-color: var(--rosa); transform: translateY(-2px); }
.fs-btn .fs-ico { font-size: 1.1rem; line-height: 1; }

@media (max-width: 600px) {
  .volver-tab { font-size: 0.9rem; padding: 1rem 0.4rem; }
  .fs-btn { font-size: 0.82rem; padding: 0.55rem 0.7rem; }
  .fs-btn .fs-txt { display: none; }
}
