/* RESET */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

/* BODY */
body {
  min-height: 100vh;
  background-image: linear-gradient(rgba(47, 23, 15, 0.65), rgba(47, 23, 15, 0.65)),
    url("../img/ahoratodos.webp");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  font-family: "Raleway", sans-serif;
  color: #333;
}

/* HEADER */
.hhhhh {
  background: linear-gradient(rgba(245, 138, 138, 0.5), rgba(0, 0, 0, 0.5));
  padding: 2rem 1rem;
  text-align: center;
}

.site-heading-lower {
  color: #facc8f;
  font-size: 2.5rem;
}

/* NAVBAR */
#mainNav {
  background-color: rgba(47, 23, 15, 0.9);
  padding: 1rem 0;
  text-align: center;
}

.navbar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-item {
  display: inline-block;
}

.nav-link {
  text-decoration: none;
  color: rgba(235, 201, 201, 0.8);
  font-weight: 700;
  padding: 8px 14px;
  text-transform: uppercase;
  transition: 0.3s;
}

.nav-link:hover {
  color: #e7c598;
}

/* BOTON HAMBURGUESA */
.navbar-toggler {
  background: none;
  border: none;
  cursor: pointer;
  display: block;
  margin: auto;
}

.navbar-toggler-icon {
  display: block;
  width: 30px;
  height: 3px;
  background-color: white;
  position: relative;
}

.navbar-toggler-icon::before,
.navbar-toggler-icon::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 3px;
  background-color: white;
  left: 0;
}

.navbar-toggler-icon::before {
  top: -8px;
}

.navbar-toggler-icon::after {
  top: 8px;
}

/* MENU COLAPSABLE */
.navbar-collapse {
  display: none;
  text-align: center;
}

.navbar-collapse.show {
  display: block;
}

/* DESKTOP */
@media (min-width: 768px) {
  .navbar-collapse {
    display: flex !important;
    justify-content: center;
  }

  .navbar-toggler {
    display: none;
  }
}

/* CONTENEDOR */
.container {
  width: 90%;
  max-width: 1200px;
  margin: auto;
}

/* INTRO HOME */
.intro {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.intro-img {
  max-width: 120px;
  width: 60%;
  border-radius: 8px;
  flex-shrink: 0;
}

.intro-text {
  max-width: 500px;
  width: 100%;
  text-align: center;
  flex-shrink: 0;
}

.bg-faded {
  background: rgba(255, 255, 255, 0.9);
  padding: 2rem;
  border-radius: 12px;
}

/* SECCIONES */
section, .page-section {
  padding: 60px 20px;
}

/* CTA */
.cta {
  background: rgba(0, 0, 0, 0.3);
}

.cta-inner {
  padding: 2rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  text-align: center;
}

/* FOOTER */
.footer {
  background: rgba(47, 23, 15, 0.9);
  text-align: center;
  padding: 1.5rem;
}

.footer p {
  color: #f6e1c5;
  font-size: 0.9rem;
  margin: 0;
}

/* BOTON PERSONALIZADO */
.btn-custom {
  background-color: #793917;
  color: rgb(243, 224, 224);
  border: none;
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: 5px;
  cursor: pointer;
}

.btn-custom:hover {
  background-color: #5a321f;
  color: white;
}

/* UTILIDADES */
.text-center { text-align: center; }
.text-white { color: #fff; }
.text-uppercase { text-transform: uppercase; }
.img-fluid { max-width: 100%; height: auto; }
.rounded { border-radius: 8px; }
.rounded-circle { border-radius: 50%; }

/* GRID BASICO */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.col {
  flex: 1;
  min-width: 280px;
}

.col-12 {
  width: 100%;
}

/* LIBRO CARD */
.libro-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.libro-card h2, .libro-card h3 {
  color: #2c2c2c;
}

.libro-card p {
  color: #555;
  text-align: left;
}

.btn-link {
  display: inline-block;
  margin-top: 0.8rem;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: 0.3s;
}

.btn-link:hover {
  background: rgba(0, 0, 0, 0.15);
}

/* MASTHEAD */
.masthead {
  padding: 3rem 1rem;
  text-align: center;
}

.masthead-heading {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.masthead-subheading {
  font-size: 1.1rem;
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.6;
}

.section-heading {
  margin-bottom: 1rem;
}

.section-heading-upper {
  display: block;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #888;
}

.section-heading-lower {
  display: block;
  font-size: 1.8rem;
  color: #2c2c2c;
}

/* RESPONSIVE MOVIL */
@media (max-width: 768px) {
  body {
    font-size: 0.95rem;
    overflow-x: hidden;
  }

  .site-heading-lower {
    font-size: 1.8rem;
    text-align: center;
  }

  .navbar-nav {
    flex-direction: column;
    align-items: center;
    gap: 5px;
  }

  .nav-link {
    font-size: 0.9rem;
    padding: 8px;
  }

  .navbar-toggler {
    display: block;
    margin: 10px auto;
  }

  .navbar-collapse {
    display: none;
  }

  .navbar-collapse.show {
    display: block;
  }

  .intro {
    flex-wrap: wrap;
    flex-direction: column;
    text-align: center;
  }

  .intro-img {
    max-width: 90%;
  }

  .intro-text {
    max-width: 100%;
    width: 100%;
    padding: 1rem;
  }

  h1 {
    font-size: 1.5rem;
    text-align: center;
  }

  h2 {
    font-size: 1.2rem;
  }

  p {
    font-size: 0.95rem;
  }

  section, .page-section {
    padding: 40px 10px;
  }

  .btn-custom {
    width: 100%;
    max-width: 300px;
    font-size: 0.95rem;
  }

  img {
    max-width: 90%;
  }

  .footer p {
    font-size: 0.8rem;
  }

  .row {
    flex-direction: column;
  }
}

@media (max-width: 576px) {
  .site-heading-lower {
    font-size: 1.8rem;
  }

  .nav-link {
    display: block;
    padding: 10px;
  }

  section, .page-section {
    padding: 40px 10px;
  }

  .intro {
    flex-direction: column;
  }

  /* JUEGOS - CELULAS MUY CHICAS */
  #wordSearchGame td {
    width: 22px !important;
    height: 22px !important;
    font-size: 0.7rem !important;
  }

  #wordList {
    font-size: 0.7rem !important;
  }

  .match-card {
    font-size: 0.7rem !important;
    padding: 6px !important;
    min-height: 32px !important;
  }

  #quizContainer > div {
    font-size: 0.8rem !important;
    padding: 0.5rem !important;
  }

  .juego-card {
    padding: 1rem !important;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    border-radius: 12px !important;
  }

  .games-title {
    font-size: 1.8rem !important;
  }
}

.pirate-font {
  font-family: 'Pirata One', cursive;
}

.pergamino {
  background: linear-gradient(rgba(139, 90, 43, 0.85), rgba(101, 67, 33, 0.9));
  background-size: cover;
  padding: 2.5rem;
  border-radius: 18px;
  border: 4px solid #d4af37;
  box-shadow:
    0 0 8px rgba(212, 175, 55, 0.5),
    0 0 20px rgba(212, 175, 55, 0.3),
    0 0 40px rgba(255, 215, 0, 0.15),
    inset 0 0 30px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
  color: #f5e6c8;
}

.pergamino::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(212, 175, 55, 0.6);
  border-radius: 12px;
  pointer-events: none;
}

.pergamino .brillo-dorado {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 40%,
    rgba(255, 215, 0, 0.15) 45%,
    rgba(255, 215, 0, 0.3) 50%,
    rgba(255, 215, 0, 0.15) 55%,
    transparent 60%
  );
  animation: brillo 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes brillo {
  0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.pergamino .esquina {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 3px solid #d4af37;
  z-index: 2;
}
.pergamino .esquina-tl { top: 12px; left: 12px; border-right: none; border-bottom: none; }
.pergamino .esquina-tr { top: 12px; right: 12px; border-left: none; border-bottom: none; }
.pergamino .esquina-bl { bottom: 12px; left: 12px; border-right: none; border-top: none; }
.pergamino .esquina-br { bottom: 12px; right: 12px; border-left: none; border-top: none; }

.pergamino h2 {
  font-family: 'Pirata One', cursive;
  color: #ffd700;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.7), 0 0 15px rgba(255, 215, 0, 0.3);
  font-size: 2rem;
  position: relative;
  z-index: 1;
}

.pergamino .section-heading-upper {
  font-family: 'Pirata One', cursive;
  color: #ffecb3;
  font-size: 1rem;
  letter-spacing: 3px;
}

.pergamino .section-heading-lower {
  font-family: 'Pirata One', cursive;
  color: #ffd700;
  font-size: 2.2rem;
}

.pergamino p {
  font-family: 'Merriweather', serif;
  color: #f5e6c8;
  font-size: 1.1rem;
  line-height: 1.8;
  position: relative;
  z-index: 1;
  text-align: justify;
}

.intro .pergamino {
  max-width: 500px;
  flex-shrink: 0;
}

/* RESPONSIVE JUEGOS - SOPA DE LETRAS */
#wordSearchGame {
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 1rem;
}

#wordSearchGame table {
  font-size: 0.7rem !important;
}

#wordSearchGame td {
  width: 28px !important;
  height: 28px !important;
  font-size: 0.85rem !important;
  padding: 2px !important;
}

#wordList {
  font-size: 0.8rem !important;
  padding: 0 0.5rem;
  word-break: break-word;
}

/* RESPONSIVE JUEGOS - PAREJAS */
#matchingGame {
  max-width: 100% !important;
  overflow-x: auto;
  padding: 0.5rem;
}

#levelInfo {
  font-size: 1rem !important;
}

#pairsStats {
  font-size: 0.85rem !important;
}

.match-card {
  font-size: 0.85rem !important;
  padding: 10px !important;
  min-height: 40px !important;
}

/* RESPONSIVE JUEGOS - QUIZ */
#quizContainer {
  max-width: 100%;
  overflow-x: hidden;
}

#quizContainer > div {
  padding: 0.75rem !important;
  font-size: 0.9rem;
}

#quizResult {
  font-size: 1rem !important;
  padding: 0.5rem;
}

/* ARREGLO OVERFLOW GENERAL */
body {
  overflow-x: hidden;
  max-width: 100vw;
}

.page-section {
  overflow-x: hidden;
}

.juego-card {
  max-width: 100%;
  overflow-x: auto;
}

.hhhhh {
  background: linear-gradient(rgba(245, 138, 138, 0.4), rgba(0, 0, 0, 0.4));
  padding: 2.5rem 1rem;
  text-align: center;
  border-bottom: 3px solid #d4af37;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
}

.hhhhh .site-heading-lower {
  font-family: 'Pirata One', cursive;
  color: #ffd700;
  font-size: 3rem;
  text-shadow: 3px 3px 8px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.3);
  letter-spacing: 2px;
}


