/* ==========================================
   1. VARIABLES Y CONFIGURACIÓN GLOBAL
   ================================---------- */
:root {
	--coral: #FF5964;
	--coral-deep: #E14456;
	--navy: #211F2E;
	--navy-soft: #2B2D42;
	--teal: #3AAFA9;
	--teal-tint: #EAF6F5;
	--paper: #FFFCFB;
	--paper-line: #F0DEE0;
	--cream: #FBF3EF;
	--serif: "Playfair Display", Georgia, serif;
	--sans: "Karla", -apple-system, sans-serif;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: var(--sans);
	color: var(--navy-soft);
	background: var(--paper);
	line-height: 1.6;
}

h1,
h2,
h3 {
	font-family: var(--serif);
	font-weight: 600;
	margin: 0;
}

a {
	color: inherit;
	text-decoration: none;
}

.wrap {
	max-width: 1120px;
	margin: 0 auto;
	padding: 0 28px;
}

/* ==========================================
   2. BOTONES Y COMPONENTES GENERALES
   ================================---------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-weight: 700;
	font-size: 0.95rem;
	padding: 12px 22px;
	border-radius: 999px;
	border: 1.5px solid transparent;
	cursor: pointer;
}

.btn-primary {
	background: var(--coral);
	color: var(--cream);
}

.btn-secondary {
	background: var(--paper);
	color: var(--coral);
	outline: 2px solid #ff5964;
}

.btn-ghost {
	background: transparent;
	color: var(--navy);
	border-color: rgba(43, 45, 66, 0.3);
}

.btn-disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* ==========================================
   3. NAVEGACIÓN Y MENÚ HAMBURGUESA
   ================================---------- */
.nav {
	position: sticky;
	top: 0;
	background: var(--paper);
	border-bottom: 1px solid var(--paper-line);
	z-index: 10;
}

.nav .wrap {
	height: 72px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	font-family: var(--serif);
	font-weight: 700;
	font-size: 1.15rem;
}

.nav-links {
	display: flex;
	gap: 24px;
	font-size: 0.95rem;
	font-weight: 600;
}

.nav-toggle {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	flex-direction: column;
	justify-content: space-between;
	width: 28px;
	height: 20px;
	padding: 0;
	z-index: 100;
}

.nav-toggle span {
	display: block;
	width: 100%;
	height: 2px;
	background-color: var(--navy);
	transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ==========================================
   4. HERO Y PORTADA GENERAL
   ================================---------- */
.hero {
	background: var(--coral);
	color: var(--paper);
	text-align: center;
	padding: 64px 0 56px;
}

.hero h1 {
	font-size: clamp(2rem, 5vw, 3.2rem);
	font-style: italic;
}

.hero p {
	margin-top: 14px;
	font-size: 1.05rem;
}

/* =============================
   5. SECCIÓN DESTACADA
   ================---------- */
.seccion-destacada {
	background-color: var(--cream);
	padding: 64px 0;
	border-top: 1px solid var(--paper-line);
	border-bottom: 1px solid var(--paper-line);
}

.contenido-seccion {
	display: flex;
	align-items: center;
	gap: 48px;
	flex-wrap: wrap;
}

.foto-seccion {
	flex: 0 1 280px;
	width: 100%;
	max-width: 280px;
	aspect-ratio: 2/3;
	object-fit: cover;
	border-radius: 10px;
	box-shadow: 0 10px 30px rgba(33, 31, 46, 0.1);
}

.texto-seccion {
	flex: 1;
	min-width: 280px;
}

.texto-seccion h2 {
	font-size: clamp(1.8rem, 3vw, 2.4rem);
	font-style: italic;
	color: var(--navy);
	margin-bottom: 16px;
}

.texto-seccion p {
	font-size: 1.02rem;
	color: var(--navy);
	line-height: 1.85;
	margin-bottom: 24px;
}

/* ==========================================
   6. CATÁLOGO DE LIBROS
   ================================---------- */
.catalog-section {
	padding: 56px 0 80px;
}

.catalog-section h2 {
	font-size: 1.6rem;
	margin-bottom: 28px;
}

.empty {
	color: #8b8598;
}

.book-grid {
	display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    overflow-x: visible;
    padding-bottom: 0;
}

.book-card {
	display: block;
}

.book-grid .book-card {
    flex: none;
    width: auto;
} /* <-- LLAVE CORREGIDA AQUÍ */

.book-cover {
	aspect-ratio: 2/3;
	border-radius: 10px;
	background: linear-gradient(155deg, var(--navy), #3a3752);
	background-size: cover;
	background-position: center;
	border: 1px solid var(--cream);
	display: flex;
	align-items: flex-end;
	padding: 16px;
	margin-bottom: 10px;
	overflow: hidden;
	position: relative;
}

.book-cover img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 6px;
}

.book-cover-title {
	font-family: var(--serif);
	font-style: italic;
	color: var(--cream);
	font-size: 1.1rem;
	line-height: 1.2;
}

.book-card-title {
	font-weight: 700;
	font-size: 0.95rem;
}

.book-card-meta,
.book-card-price {
	font-size: 0.78rem;
	color: #8b8598;
	margin-top: 1px;
}

/* ==========================================
   7. DETALLE DE PRODUCTO Y SAGA
   ================================---------- */
.breadcrumb {
	padding: 16px 0;
	border-bottom: 1px solid var(--paper-line);
	font-size: 0.85rem;
	color: #8b8598;
}

.breadcrumb a:hover {
	color: var(--coral-deep);
}

.product-hero {
	padding: 48px 0;
}

.product-grid {
	display: grid;
	grid-template-columns: 0.6fr 1fr;
	gap: 56px;
	align-items: start;
}

.cover-panel {
	background: linear-gradient(155deg, var(--navy), #3a3752);
	border-radius: 6px;
	padding: 40px 30px;
	color: var(--cream);
	aspect-ratio: 2/3;
	max-width: 320px;
	display: flex;
	align-items: flex-end;
	overflow: hidden;
	position: relative;
}

.cover-panel img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 6px;
}

.cover-panel .tag {
	font-size: 0.8rem;
	font-weight: 700;
	color: var(--teal);
	margin: 0 0 10px;
}

.cover-panel h1 {
	font-style: italic;
	font-size: 1.8rem;
	color: var(--cream);
}

.kicker {
	font-weight: 700;
	color: var(--coral-deep);
	font-size: 0.88rem;
	margin: 0 0 8px;
}

.product-title {
	font-size: clamp(1.7rem, 3vw, 2.3rem);
	margin-bottom: 10px;
}

.hook {
	font-size: 1.02rem;
	color: #55506a;
}

.hook p,
.synopsis p {
	margin: 0 0 14px;
}

.hook p:last-child,
.synopsis p:last-child {
	margin-bottom: 0;
}

.tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 18px;
}

.tag-chip {
	font-size: 0.8rem;
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--teal-tint);
	color: teal;
	font-weight: 600;
}

.buy-card {
	margin-top: 26px;
	border: 1px solid var(--paper-line);
	border-radius: 10px;
	padding: 22px;
}

.format-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 0;
	border-bottom: 1px solid var(--paper-line);
	gap: 16px;
}

.format-row:last-child {
	border-bottom: none;
}

.format-block {
	display: flex;
	flex-direction: column;
}

.format-name {
	font-weight: 700;
}

.format-price,
.format-missing {
	font-size: 0.85rem;
	color: #8b8598;
}

.epub-note {
	font-size: 0.8rem;
	color: #8b8598;
	margin-top: 10px;
	text-align: center;
}

.epub-note-trust {
	font-size: 0.8rem;
	margin-top: 4px;
	text-align: center;
	color: var(--coral);
}

.purchase-success {
	margin-top: 16px;
	padding: 18px;
	border-radius: 10px;
	background: #e4f6ee;
	text-align: center;
}

.purchase-success p {
	margin: 0 0 12px;
	color: teal;
	font-weight: 600;
	font-size: 0.92rem;
}

.epub-message {
	margin-top: 12px;
	font-size: 0.9rem;
	text-align: center;
}

.epub-message-ok {
	color: teal;
}

.epub-message-error {
	color: var(--coral-deep);
}

.form-row{ margin-bottom:16px; text-align:left; }
.form-row label{ display:block; font-size:0.85rem; font-weight:700; margin-bottom:6px; color:var(--navy-soft); }
.form-row input{
  width:100%; padding:11px 14px; border:1.5px solid var(--paper-line); border-radius:8px;
  font-family:var(--sans); font-size:0.95rem; color:var(--navy-soft); background:var(--paper);
  box-sizing:border-box;
}
.form-row input:focus{ outline:none; border-color:var(--teal); }

.product-body {
	padding: 20px 0 72px;
	border-top: 1px solid var(--paper-line);
}

.product-body h2 {
	font-size: 1.4rem;
	margin-bottom: 16px;
}

.synopsis {
	max-width: 70ch;
	color: #4c4760;
	font-size: 1.02rem;
	line-height: 1.85;
}

.body-grid {
	display: grid;
	grid-template-columns: 1fr 0.4fr;
	gap: 56px;
	align-items: start;
}

.details-card {
	border: 1px solid var(--paper-line);
	border-radius: 10px;
	padding: 26px;
}

.details-card h3 {
	font-size: 1.05rem;
	margin-bottom: 16px;
}

.details-row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid var(--paper-line);
	font-size: 0.9rem;
}

.details-row:last-child {
	border-bottom: none;
}

.details-row dt {
	color: #8b8598;
}

.details-row dd {
	margin: 0;
	font-weight: 600;
	text-align: right;
}

.pull-quote {
	margin: 22px 0 0;
	padding: 16px 0 0;
	border-top: 1px solid var(--paper-line);
	font-family: var(--serif);
	font-style: italic;
	font-size: 1.15rem;
	line-height: 1.5;
	color: var(--navy);
}

.saga-section {
	padding: 20px 0 72px;
	border-top: 1px solid var(--paper-line);
	background: var(--teal-tint);
}

.saga-section .kicker {
	color: teal;
}

.saga-section h2 {
	font-size: 1.5rem;
	font-style: italic;
	margin-bottom: 24px;
}

.saga-list {
	max-width: 60ch;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.saga-item {
	display: flex;
	align-items: baseline;
	gap: 12px;
	padding: 12px 16px;
	border-radius: 8px;
	background: var(--paper);
}

.saga-item-current {
	background: var(--navy);
	color: var(--cream);
}

.saga-num {
	font-family: var(--serif);
	font-weight: 700;
	color: var(--teal);
	flex-shrink: 0;
	width: 1.5em;
}

.saga-item-current .saga-num {
	color: var(--coral);
}

.saga-title {
	font-weight: 600;
}

.saga-item-current .saga-title a {
	color: var(--cream);
}

.saga-title a:hover {
	text-decoration: underline;
}

.saga-tag {
	font-size: 0.78rem;
	font-weight: 700;
	color: var(--coral-deep);
	margin-left: 6px;
}

.saga-item-current .saga-tag {
	color: var(--teal);
}

.saga-tag-soon {
	color: #8b8598;
}

/* ==========================================
   8. MODAL DE PAYPAL
   ================================---------- */
.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(33, 31, 46, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	z-index: 100;
}

.modal-overlay[hidden] {
	display: none;
}

.modal-box {
	background: var(--paper);
	border-radius: 14px;
	padding: 32px;
	width: 100%;
	max-width: 420px;
	max-height: 90vh;
	overflow-y: auto;
	position: relative;
	box-shadow: 0 20px 60px rgba(33, 31, 46, 0.25);
}

.modal-close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: none;
	background: var(--paper-line);
	font-size: 1.3rem;
	line-height: 1;
	cursor: pointer;
	color: var(--navy-soft);
}

.modal-close:hover {
	background: #e5d5d8;
}

.modal-kicker {
	font-weight: 700;
	color: var(--coral-deep);
	font-size: 0.85rem;
	margin: 0 0 6px;
}

.modal-box h3 {
	font-size: 1.3rem;
	margin-bottom: 4px;
}

.modal-price {
	font-family: var(--serif);
	font-weight: 700;
	font-size: 1.4rem;
	color: var(--navy);
	margin: 0 0 22px;
}

/* ==========================================
   9. FOOTER Y BANNER DE COOKIES
   ================================---------- */
.site-footer {
	background-color: var(--navy);
	color: var(--cream);
	padding: 64px 0 32px;
	margin-top: 80px;
	border-top: 1px solid var(--paper-line);
}

.footer-grid {
	display: grid;
	grid-template-columns: 1.5fr 1fr 1fr 1fr;
	gap: 40px;
	align-items: start;
}

.footer-brand {
	font-family: var(--serif);
	font-weight: 700;
	font-size: 1.15rem;
	margin-bottom: 12px;
	color: var(--paper);
}

.footer-tagline {
	font-size: 0.92rem;
	color: #9d98b5;
	margin: 0;
}

.footer-col h3 {
	font-family: var(--sans);
	font-size: 0.9rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--paper);
	margin-bottom: 16px;
}

.footer-col ul {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.footer-col a {
	font-size: 0.9rem;
	color: #9d98b5;
	transition: color 0.2s ease;
}

.footer-col a:hover {
	color: var(--coral);
}

.footer-bottom {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 56px;
	padding-top: 24px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	font-size: 0.82rem;
	color: #8b8598;
}

.footer-bottom p {
	margin: 0;
}

.footer-location {
	text-align: right;
}

.cookie-overlay {
	position: fixed;
	inset: 0;
	background: rgba(33, 31, 46, 0.75);
	backdrop-filter: blur(4px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	z-index: 99999;
}

.cookie-modal {
	background: var(--paper);
	color: var(--navy);
	padding: 32px;
	border-radius: 16px;
	max-width: 420px;
	width: 100%;
	box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
	text-align: center;
}

.cookie-modal h3 {
	font-family: var(--serif);
	font-size: 1.4rem;
	margin-bottom: 12px;
	color: var(--navy);
}

.cookie-modal p {
	font-size: 0.92rem;
	color: #55506a;
	line-height: 1.6;
	margin-bottom: 24px;
}

.cookie-buttons {
	display: flex;
	gap: 12px;
}

/* ==========================================
   10. MEDIA QUERIES (RESPONSIVE)
   ================================---------- */
@media (max-width: 800px) {
	.product-grid,
	.body-grid {
		grid-template-columns: 1fr;
	}

	.cover-panel {
		margin: 0 auto;
		width: 95%;
	}

	.footer-grid {
		grid-template-columns: 1fr 1fr;
		gap: 32px;
	}
}

@media (max-width: 768px) {
	/* Menú hamburguesa móvil */
	.nav-toggle {
		display: flex;
	}

	.nav-links {
		position: absolute;
		top: 72px;
		left: 0;
		width: 100%;
		background-color: var(--paper);
		flex-direction: column !important;
		align-items: center;
		padding: 24px 0;
		gap: 16px !important;
		border-bottom: 1px solid var(--paper-line);
		box-shadow: 0 10px 20px rgba(33, 31, 46, 0.05);
		display: none !important;
	}

	.nav-links.nav-open {
		display: flex !important;
	}

	.nav-toggle.active span:nth-child(1) {
		transform: translateY(9px) rotate(45deg);
	}

	.nav-toggle.active span:nth-child(2) {
		opacity: 0;
	}

	.nav-toggle.active span:nth-child(3) {
		transform: translateY(-9px) rotate(-45deg);
	}

	/* Carrusel de libros en móvil */
	.book-grid {
		display: flex !important;
		overflow-x: auto !important;
		scroll-snap-type: x mandatory;
		gap: 16px !important;
		padding-bottom: 16px !important;
		scrollbar-width: none;
		-ms-overflow-style: none;
	}
	
	.book-grid::-webkit-scrollbar {
		display: none;
	}

	.book-grid .book-card {
		flex: 0 0 160px !important;
		scroll-snap-align: start;
	}
}

@media (max-width: 500px) {
	.footer-grid {
		grid-template-columns: 1fr;
	}

	.footer-bottom {
		flex-direction: column;
		gap: 10px;
		text-align: center;
	}

	.footer-location {
		text-align: center;
	}
}