/* Reset básico */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Colores */
:root {
  --fondo-1: #f9f9f9;
  --fondo-2: #ffffff;
  --texto: #000000;
  --link: #0056b3;
  --fondo-1o: #1a1a1a;
  --fondo-2o: #2a2a2a;
  --texto-o: #f0f0f0;
  --link-0: #4dabf7;
  --boton-1: #111111;
  --boton-2: #444444;
}

/* Reset y configuración general */
body {
  font-family: "Inter", sans-serif;
  font-size: clamp(0.9rem, 1.1vw + 0.6rem, 1.1rem);
  line-height: 1.55;
  background-color: var(--fondo-1);
  color: var(--texto);
  transition: background-color 0.3s, color 0.3s;
}

/* Encabezados */
h1,
h2,
h3 {
  font-weight: bold;
  text-align: center;
  margin-bottom: 0;
}

h1 {
  font-size: clamp(1.5rem, 2vw + 1rem, 2rem);
  line-height: 1;
}

h2 {
  font-size: clamp(1.25rem, 2vw + 0.5rem, 1.55rem);
  line-height: 1.0909;
}

h3 {
  font-size: clamp(1.1rem, 1.7vw + 0.4rem, 1.4rem);
  line-height: 1.2;
}

/* Logo página */
.logo {
  display: none;
}

.logo img {
  width: 100%;
  max-width: 20rem;
  /*max-height: 2.5rem;*/
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

body:not(.dark-mode) .logo.light-theme,
body.dark-mode .logo.dark-theme {
  display: block;
}

/* Párrafos */
p {
  margin: 1rem auto;
  text-align: center;
  max-width: 35.3125rem;
}

/* Contenedores */
div {
  margin: 1em 0 auto;
}

.container-1,
.container-2 {
  padding: 2.5rem;
}

.container-2 {
  background-color: var(--fondo-2);
}

.contenido {
  max-width: 38.75rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.separador {
  height: 1rem;
}

.centrado {
  display: flex;
  justify-content: center;
}

/* Listas */
ul,
ol {
  list-style-position: inside;
  padding-left: 1rem;
}

/* Enlaces */
a {
  color: inherit;
  text-decoration: none;
}

.enlinea {
  color: var(--link);
}

.enlinea:hover,
header a:hover {
  text-decoration: underline;
}

/* Navbar */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem 0;
  max-width: 48rem;
  margin: 0 auto;
}

.nav-izquerda a,
.nav-derecha a {
  font-size: clamp(1rem, 1.2vw + 0.6rem, 1.2rem);
}

.nav-derecha a {
  margin-left: 1.2rem;
}

/* Botón */
.link {
  background-color: var(--boton-1);
  color: var(--texto-o);
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  border-radius: 0.33rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: inherit;
}

.link:hover {
  background-color: var(--boton-2);
}

/* Sección novelas */
.lista-novelas {
  display: grid;
  gap: 2rem;
}

.novela {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 1.5rem;
  align-items: center;
  background-color: var(--fondo-1);
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  margin: 0;
}

.portada-container {
  display: block;
  margin: 0;
  padding: 0;
}

.portada {
  margin: 0;
  padding: 0;
}

.portada img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 0.5rem;
}

.contenido-novela {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  height: 100%;
  padding: 0;
  margin: 0;
}

.titulo-novela {
  margin: 0;
}

.sinopsis {
  text-align: justify;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
  hyphens: auto;
}

.contenido-novela .centrado {
  margin: 0;
}

/* Botón cambiar tema */
.theme-toggle {
  background-color: var(--boton-1);
  border: none;
  border-radius: 50%;
  width: 2.6rem;
  height: 2.6rem;
  font-size: clamp(1.3rem, 1.5vw + 0.5rem, 1.5rem);
  margin: 0 auto;
  cursor: pointer;
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 1000;
  line-height: 1;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.theme-toggle:hover {
  background-color: var(--fondo-1);
  color: var(--boton-1);
}

/* Modo oscuro */
.dark-mode {
  background-color: var(--fondo-1o);
  color: var(--texto-o);
}

.dark-mode .container-1 {
  background-color: var(--fondo-1o);
}

.dark-mode .container-2 {
  background-color: var(--fondo-2o);
}

.dark-mode .link {
  background-color: var(--boton-2);
}

.dark-mode .link:hover {
  background-color: var(--boton-1);
}

.dark-mode .nav-izquerda a,
.dark-mode .nav-derecha a {
  color: var(--texto-o);
}

.dark-mode .enlinea {
  color: var(--link-0);
}

.dark-mode .novela {
  background-color: var(--fondo-1o);
  box-shadow: 0 4px 10px rgba(255, 255, 255, 0.06);
}

.dark-mode .theme-toggle {
  background-color: var(--fondo-1);
}

.dark-mode .theme-toggle:hover {
  background-color: var(--boton-1);
}

/*Estilos navbar con menu desplegable*/
.dropdown {
  position: relative;
  display: inline-block;
  margin: 0;
}

.dropdown-toggle {
  background: none;
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: clamp(1rem, 1.2vw + 0.6rem, 1.2rem);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.dropdown-toggle:hover {
  text-decoration: underline;
}

.dropdown-icon {
  width: 1em;
  height: 1em;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.dropdown-toggle[aria-expanded="true"] .dropdown-icon {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 220px;
  background-color: var(--fondo-2);
  border-radius: 0.5rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 100;
}

.dropdown-toggle[aria-expanded="true"] + .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  font-size: 0.85rem;
  font-weight: bold;
  padding: 0 1.5rem;
  margin: 0;
  color: var(--link);
}

.dark-mode .dropdown-header {
  color: var(--link-0);
}

.dropdown-group ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dropdown-group li a {
  display: block;
  padding: 0.5rem 1.5rem;
  color: var(--texto);
  transition: background-color 0.2s ease;
}

.dark-mode .dropdown-group li a {
  color: var(--texto-o);
}

.dropdown-group li a:hover {
  background-color: rgba(0, 0, 0, 0.05);
  text-decoration: none;
}

.dark-mode .dropdown-group li a:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.dropdown-menu::before {
  content: "";
  position: absolute;
  bottom: 100%;
  right: 1rem;
  border: 0.5rem solid transparent;
}

.dark-mode .dropdown-menu {
  background-color: var(--fondo-2o);
}
