/* =============================
   VARIABLES GLOBALES
============================= */
:root {
  --primary-color: #b71c1c;
  --secondary-color: #880e4f;
  --accent-color: #ef5350;
  --accent-hover: #ffa726;
  --text-color: #f5f5f5;
  --bg-color: #1e1e1e;
  --card-bg: #333;
  --modal-bg: rgba(0, 0, 0, 0.85);
  --transition-speed: 0.3s;
}

/* Clase para resaltar apartados importantes */
.highlight {
  color: #ffa726;
}

/* =============================
   RESET Y BASE
============================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}


/* CABECERA */
header {
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  padding: 20px;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: background 0.4s ease;
}

header.scrolled {
  background: rgba(183, 28, 28, 0.8);
  backdrop-filter: blur(6px);
}

.header-container {
  max-width: 1200px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

header h1 {
  font-size: 2.2em;
}

.menu-toggle {
  font-size: 1.8em;
  color: var(--text-color);
  background: none;
  border: none;
  cursor: pointer;
  display: none;
}

/* SEARCH CONTAINER */
.search-container {
  position: relative;
  display: inline-block;
}

.search-icon {
  font-size: 1.5em;
  cursor: pointer;
  color: var(--text-color);
}

.search-input {
  position: absolute;
  top: 50%;
  left: 35px;
  transform: translateY(-50%);
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 1em;
  outline: none;
}

/* NAVEGACIÓN */
nav ul {
  list-style: none;
  display: flex;
}

nav ul li {
  margin-left: 20px;
}

nav ul li a {
  color: #ffccbc;
  text-decoration: none;
  font-weight: bold;
  transition: color var(--transition-speed);
}

nav ul li a:hover {
  color: var(--accent-hover);
}

/* MAIN */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 100px 20px 40px;
}

/* SECCIONES */
.section {
  margin-bottom: 50px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.section.visible {
  opacity: 1;
  transform: translateY(0);
}

.section h2 {
  margin-bottom: 20px;
  color: #e57373;
  font-size: 1.8em;
}

/* Menús Desplegables */
details.faction-group {
  margin-bottom: 20px;
  padding: 10px;
  border: 1px solid var(--accent-hover);
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.05);
}

details.faction-group summary {
  font-size: 1.5em;
  color: var(--accent-hover);
  cursor: pointer;
  list-style: none;
  outline: none;
  padding: 10px 0;
}

details.faction-group summary::-webkit-details-marker {
  display: none;
}

/* TARJETAS */
.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.card {
  background-color: var(--card-bg);
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.card:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.card h4 {
  margin-bottom: 10px;
  font-size: 1.3em;
  color: var(--accent-hover);
}

.card p {
  font-size: 1em;
  margin-bottom: 10px;
}

.card .more {
  color: var(--accent-hover);
  font-size: 0.9em;
  position: absolute;
  bottom: 10px;
  right: 15px;
}

/* SECCIÓN MASCOTAS */
.pet-card-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.pet-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pet-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

.pet-icon {
  font-size: 3em;
  margin-bottom: 10px;
}

.pet-card h4 {
  margin-bottom: 5px;
  font-size: 1.2em;
  color: var(--accent-hover);
}

.pet-card p {
  font-size: 0.9em;
  color: var(--text-color);
}

/* MODAL */
.oculto {
  display: none !important;
}

/* Ajustes para el modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  overflow-y: auto;
  padding: 1rem;
}

.modal-content {
  background-color: var(--modal-bg, #222);
  color: var(--text-color, #fff);
  padding: 1.5rem;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0,0,0,0.8);
}
.close-btn {
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 1.5rem;
  color: #fff;
  cursor: pointer;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* PIE DE PÁGINA */
footer {
  background: linear-gradient(to right, var(--secondary-color), var(--primary-color));
  padding: 20px;
  text-align: center;
  font-weight: bold;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.4);
  margin-top: 40px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: var(--modal-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-content {
  background-color: #222;
  color: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  position: relative;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 1.5rem;
  color: #fff;
  cursor: pointer;
}
.close-btn:hover {
  color: #fff;
}

/* Resaltado de subtítulos y encabezados dentro del modal */
.modal-content strong {
  color: #ffc107;
  font-weight: bold;
}
.modal-content h3 {
  color: #ffa726;
  margin-bottom: 10px;
}

/* Estilo para el botón de "Siguiente frase" */
#frase-btn {
  margin-top: 10px;
  padding: 10px 20px;
  background-color: #ffa726;
  color: #000;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(255, 167, 38, 0.6);
  transition: background-color 0.3s ease, transform 0.2s ease;
}

#frase-btn:hover {
  background-color: #ffb74d;
  transform: translateY(-2px);
}

/* Imagenes estilo */
.card img.personaje-img {
  width: 100%;
  height: auto;
  max-height: 350px;
  object-fit: contain;
  border-radius: 12px;
  margin: 10px auto;
  display: block;
  box-shadow: 0 0 12px rgba(255, 167, 38, 0.3);
}

/* FRASES FALSAS */
#frases-falsas {
  text-align: center;
  padding: 60px 20px;
  background-color: #1e1e1e;
  margin-top: 50px;
}

.titulo-frases {
  color: #e57373;
  font-size: 2em;
  font-weight: bold;
  margin-bottom: 30px;
}

.frase-box {
  background-color: #2c2c2c;
  border-left: 6px solid var(--accent-hover);
  padding: 25px 30px;
  border-radius: 12px;
  color: var(--text-color);
  font-style: italic;
  font-size: 1.3em;
  max-width: 700px;
  margin: 0 auto 25px;
  box-shadow: 0 4px 12px rgba(255, 167, 38, 0.2);
  transition: opacity 0.3s ease-in-out;
}

.boton-frase {
  padding: 12px 24px;
  background: linear-gradient(to right, #ffa726, #fb8c00);
  color: #000;
  font-weight: bold;
  font-size: 1em;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(255, 167, 38, 0.3);
  transition: background 0.3s, transform 0.2s;
}

.boton-frase:hover {
  background: linear-gradient(to right, #ffb74d, #ffa000);
  transform: translateY(-2px);
}


.especial-abuelo {
  background: linear-gradient(to right, #2c2c2c, #1a1a1a);
  border-top: 3px solid var(--accent-color);
  border-bottom: 3px solid var(--accent-hover);
  padding: 50px 20px;
  margin-top: 60px;
  text-align: center;
  box-shadow: 0 0 15px rgba(255, 167, 38, 0.2);
}

.especial-abuelo h2 {
  font-size: 2em;
  color: var(--accent-hover);
  margin-bottom: 30px;
}

.abuelo-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  align-items: center;
}

.abuelo-texto {
  flex: 1 1 300px;
  max-width: 600px;
  text-align: left;
  color: var(--text-color);
  font-size: 1.1em;
  line-height: 1.7;
}

.abuelo-imagen {
  margin-top: 20px;
  text-align: center;
}

.abuelo-imagen img {
  max-width: 250px;
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
  transition: transform 0.3s ease;
}

.abuelo-imagen img:hover {
  transform: scale(1.05);
}

.oculto {
  display: none;
}

.glitch {
  position: relative;
  color: #fff;
  font-size: 2.2em;
  font-weight: bold;
  letter-spacing: 2px;
  animation: glitch-skew 1s infinite linear alternate-reverse;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  overflow: hidden;
  color: #fff;
  background: transparent;
}

.glitch::before {
  left: 2px;
  text-shadow: -2px 0 red;
  clip-path: polygon(0 0, 100% 0, 100% 30%, 0 30%);
  animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch::after {
  left: -2px;
  text-shadow: -2px 0 blue;
  clip-path: polygon(0 70%, 100% 70%, 100% 100%, 0 100%);
  animation: glitch-anim-2 2s infinite linear alternate-reverse;
}

@keyframes glitch-skew {
  0% { transform: skew(0deg); }
  20% { transform: skew(-2deg); }
  40% { transform: skew(2deg); }
  60% { transform: skew(-1deg); }
  80% { transform: skew(1deg); }
  100% { transform: skew(0deg); }
}

@keyframes glitch-anim-1 {
  0% { clip-path: polygon(0 0, 100% 0, 100% 30%, 0 30%); transform: translate(-2px, -2px); }
  50% { clip-path: polygon(0 10%, 100% 10%, 100% 40%, 0 40%); transform: translate(2px, 2px); }
  100% { clip-path: polygon(0 5%, 100% 5%, 100% 20%, 0 20%); transform: translate(-1px, 1px); }
}

@keyframes glitch-anim-2 {
  0% { clip-path: polygon(0 70%, 100% 70%, 100% 100%, 0 100%); transform: translate(2px, 2px); }
  50% { clip-path: polygon(0 60%, 100% 60%, 100% 90%, 0 90%); transform: translate(-2px, -1px); }
  100% { clip-path: polygon(0 80%, 100% 80%, 100% 100%, 0 100%); transform: translate(1px, -2px); }
}


.header-container h1 {
  animation: colorFlame 2s infinite alternate;
}

@keyframes colorFlame {
  0%   { color: #ff5722; }
  50%  { color: #ffc107; }
  100% { color: #e53935; }
}
/* Animación de colores en el título */
@keyframes colorCycle {
  0%   { color: #ff5252; }
  25%  { color: #ffa726; }
  50%  { color: #ffee58; }
  75%  { color: #81c784; }
  100% { color: #64b5f6; }
}

.header-container h1 {
  font-size: 2.2em;
  animation: colorCycle 6s infinite alternate;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* =============================
   ÁRBOL GENEALÓGICO
============================= */
.tree-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  margin-top: 30px;
}

.liam-node {
  font-size: 1.5em;
  font-weight: bold;
  background: #ef5350;
  padding: 12px 24px;
  border-radius: 10px;
  color: white;
  box-shadow: 0 0 12px rgba(255, 82, 82, 0.4);
  animation: fadeInUp 1s ease;
}

.generacion {
  font-size: 1.3em;
  color: var(--accent-hover);
  text-align: center;
  margin-top: 20px;
}


/* =============================
   FACCIONES
============================= */
.branches {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  max-width: 1200px;
}

.branch {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 10px;
  width: 300px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
  animation: fadeInUp 0.8s ease both;
  transition: transform 0.3s;
}

.branch:hover {
  transform: translateY(-5px);
}

.branch h3 {
  text-align: center;
  margin-bottom: 15px;
  color: var(--accent-hover);
  border-bottom: 2px solid var(--accent-hover);
  padding-bottom: 5px;
  font-size: 1.3em;
}

.member {
  background: #444;
  margin: 8px 0;
  padding: 10px 14px;
  border-radius: 6px;
  color: var(--text-color);
  font-weight: 500;
  transition: background 0.3s ease;
  animation: fadeInUp 0.5s ease;
}

.member:hover {
  background: #555;
}

/* Colores por facción */
.branch.criminal {
  background: linear-gradient(to bottom, #3c1c1c, #2a1a1a);
  border-left: 4px solid crimson;
}
.branch.legal {
  background: linear-gradient(to bottom, #1c2c3c, #1a1f2a);
  border-left: 4px solid #2196f3;
}
.branch.civil {
  background: linear-gradient(to bottom, #1c3c2c, #1a2a1a);
  border-left: 4px solid #66bb6a;
}

/* =============================
   BOTONES
============================= */
.back-button {
  display: inline-block;
  margin: 40px auto 0;
  text-align: center;
  padding: 12px 24px;
  background: #ef5350;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  transition: background 0.3s ease;
}

.back-button:hover {
  background-color: var(--accent-hover);
}

.toggle-faccion {
  margin: 10px auto;
  padding: 8px 20px;
  background-color: #444;
  border: 2px solid var(--accent-hover);
  color: var(--text-color);
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: block;
}

.toggle-faccion:hover {
  background-color: var(--accent-hover);
  color: #000;
}

/* Botón modo oscuro/claro */
.modo-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 20px;
  background: #ffa726;
  color: black;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  transition: background 0.3s ease;
}

.modo-toggle:hover {
  background-color: #ffb74d;
}

/* =============================
   TÍTULO
============================= */
.titulo-faccion {
  font-size: 2.2em;
  text-align: center;
  color: var(--accent-hover);
  margin-bottom: 30px;
}

/* =============================
   ANIMACIONES
============================= */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
