/* Emiliano López · opción A «Biblioteca» */
:root {
  --tinta: #2E2A27;       /* gris cálido casi negro: todos los textos */
  --rojo: #B4472C;        /* rojo oscuro tirando a naranja: destacados */
  --rojo-oscuro: #8E3620;
  --blanco: #FFFFFF;
  --beige-1: #F4EEE4;     /* hero y autor */
  --beige-2: #EAE0D1;     /* catálogo */
  --beige-3: #E4D8C6;     /* contacto */
  --campo: #FBF8F3;
  --linea: #D3C4AE;

  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Jost', 'Helvetica Neue', Arial, sans-serif;

  --radio: 6px;
  --ancho: 1100px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 96px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--beige-1);
  color: var(--tinta);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}

img { max-width: 100%; height: auto; }

a { color: var(--rojo); }
a:hover { color: var(--tinta); }

:focus-visible { outline: 2px solid var(--rojo); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.saltar {
  position: absolute; left: 16px; top: -60px; z-index: 20;
  background: var(--tinta); color: var(--blanco); padding: 10px 16px; border-radius: var(--radio);
}
.saltar:focus { top: 12px; }

.contenedor { max-width: var(--ancho); margin: 0 auto; padding-inline: 24px; }
.contenedor--angosto { max-width: 820px; }

.titulo-seccion {
  margin: 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(46, 42, 39, .5);
}

/* Botones: rectangulares con puntas redondeadas */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 12px 22px;
  border: 1.5px solid var(--tinta); border-radius: var(--radio);
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn--secundario { background: transparent; color: var(--tinta); }
.btn--secundario:hover { background: var(--tinta); color: var(--blanco); }
.btn--principal { background: var(--tinta); color: var(--blanco); }
.btn--principal:hover { background: #48423D; border-color: #48423D; color: var(--blanco); }
.btn--destacado { background: var(--rojo); border-color: var(--rojo); color: var(--blanco); }
.btn--destacado:hover { background: var(--rojo-oscuro); border-color: var(--rojo-oscuro); color: var(--blanco); }
.botones { display: flex; flex-wrap: wrap; gap: 12px; }

/* Cabecera */
.cabecera {
  position: sticky; top: 0; z-index: 10;
  background: var(--blanco);
  border-bottom: 1px solid var(--linea);
}
.cabecera__fila {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 24px; padding-block: 12px;
}
.marca { display: flex; align-items: center; gap: 14px; color: var(--tinta); text-decoration: none; }
.marca img { height: 64px; width: auto; }
.marca span { font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1; }
.menu { display: flex; flex-wrap: wrap; gap: 4px 28px; }
.menu a { color: var(--tinta); text-decoration: none; font-weight: 500; padding-block: 10px; }
.menu a:hover { color: var(--rojo); }

/* Hero */
.hero { background: var(--beige-1); padding-block: 56px 80px; }
.hero__contenido { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 20px; }
.hero__imagen { width: 224px; }
.hero__copete {
  margin: 0;
  font-size: 15px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase;
  color: var(--rojo);
}
.hero__copete span { display: block; }
.hero__frase {
  margin: 0; max-width: 820px;
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 4rem); line-height: 1.04;
  text-wrap: balance;
}

/* Catálogo y carrusel */
.catalogo { background: var(--beige-2); padding-block: 80px; }
.catalogo .contenedor { display: flex; flex-direction: column; gap: 48px; }
.slide { display: flex; flex-wrap: wrap; gap: 56px; align-items: center; }
.slide[hidden] { display: none; }
.carrusel { position: relative; overflow: hidden; }
/* Desplazamiento de derecha a izquierda: la nueva entra por la derecha, la anterior sale por la izquierda */
.slide.entra { animation: entrar-der .5s ease-out; }
.slide.sale {
  position: absolute; inset: 0 0 auto 0;
  animation: salir-izq .5s ease-out forwards; pointer-events: none;
}
.slide.atras.entra { animation-name: entrar-izq; }
.slide.atras.sale { animation-name: salir-der; }
@keyframes entrar-der { from { transform: translateX(100%); } to { transform: none; } }
@keyframes salir-izq { from { transform: none; } to { transform: translateX(-100%); } }
@keyframes entrar-izq { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes salir-der { from { transform: none; } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .slide.entra, .slide.sale { animation: none; } .slide.sale { display: none; } }
.slide__portada { flex: 0 0 320px; max-width: 100%; display: flex; justify-content: center; }
.slide__portada img { width: 320px; box-shadow: 0 22px 44px rgba(46, 42, 39, .22); }
.slide__info { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.slide__titulo { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.slide__nombre { font-family: var(--serif); font-weight: 500; font-size: clamp(2.2rem, 4vw, 3rem); line-height: 1.05; }
.slide__genero { font-size: 18px; font-weight: 500; color: var(--rojo); }
.etiquetas { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.etiquetas li { font-size: 13px; padding: 4px 12px; border: 1px solid var(--linea); border-radius: 999px; background: var(--campo); }
.slide__desc { margin: 0; max-width: 60ch; }
.slide__precio { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 34px; }

.carrusel__menu {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px;
  border-top: 1px solid var(--linea); padding-top: 32px;
}
.flecha {
  width: 44px; height: 44px; border-radius: var(--radio);
  border: 1.5px solid var(--tinta); background: transparent; color: var(--tinta);
  font: inherit; font-size: 22px; line-height: 1; cursor: pointer;
}
.flecha:hover { background: var(--tinta); color: var(--blanco); }
.miniatura {
  width: 88px; height: 88px; padding: 0; cursor: pointer; overflow: hidden;
  background: transparent; border: 3px solid transparent; border-radius: 8px;
}
.miniatura img { display: block; width: 100%; height: auto; }
.miniatura[aria-current="true"] { border-color: var(--rojo); }

/* Ventana de «Más información» */
.dialogo {
  width: min(720px, calc(100% - 32px)); max-height: calc(100% - 48px);
  padding: 0; border: 0; border-radius: var(--radio);
  background: var(--beige-1); color: var(--tinta);
  box-shadow: 0 30px 60px rgba(46, 42, 39, .35);
}
html.sin-scroll, html:has(dialog[open]) { overflow: hidden; }
.dialogo::backdrop { background: rgba(46, 42, 39, .55); }
.dialogo__cuerpo { position: relative; padding: 40px 32px 32px; display: flex; flex-direction: column; gap: 14px; }
.dialogo__cuerpo h3 { margin: 0 40px 4px 0; font-family: var(--serif); font-weight: 500; font-size: 2.4rem; line-height: 1.1; }
.dialogo__cuerpo p { margin: 0; }
.dialogo__cuerpo .botones { margin-top: 12px; }
.dialogo__cerrar {
  position: absolute; top: 12px; right: 12px; width: 44px; height: 44px;
  border: 0; background: transparent; color: var(--tinta); font-size: 30px; line-height: 1; cursor: pointer;
}

/* Ventanas de demo y compra */
.dialogo--form { width: min(560px, calc(100% - 32px)); }
.dialogo__cuerpo[hidden] { display: none; }
.pedido .formulario__pie { margin-top: 6px; }
.formato { margin: 0; padding: 0; border: 0; display: grid; gap: 6px; }
.formato legend { padding: 0; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.formato label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; cursor: pointer; font-weight: 500; }
.formato input { accent-color: var(--rojo); margin: 0; transform: translateY(1px); }
.formato span { font-size: 14px; font-weight: 400; opacity: .75; }
.descuento { display: flex; flex-direction: column; gap: 6px; }
.descuento label { font-size: 14px; font-weight: 600; }
.descuento__fila { display: flex; gap: 8px; }
.descuento__fila input {
  flex: 1; min-width: 0; min-height: 44px; padding: 12px 14px;
  border: 1px solid var(--linea); border-radius: var(--radio);
  background: var(--campo); color: var(--tinta); font: inherit; text-transform: uppercase;
}
.descuento__fila input[aria-invalid="true"] { border-color: var(--rojo); }
.descuento__fila .btn { padding-inline: 18px; }
.descuento__estado { margin: 0; font-size: 14px; font-weight: 500; }
.descuento__estado:empty { display: none; }
.descuento__estado.error { color: var(--rojo); }
.pago__lista { font-size: 18px; opacity: .55; }
.pago {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; border: 1px solid var(--linea); border-radius: var(--radio); background: var(--campo);
}
.pago__detalle { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.pago__precio { font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.1; }
.pago__medio { font-weight: 500; }
.pago__cambiar {
  align-self: flex-start; padding: 6px 0; border: 0; background: none; cursor: pointer;
  color: var(--rojo); font: inherit; font-size: 14px; text-align: left; text-decoration: underline;
}
.pago__cambiar:hover { color: var(--tinta); }
.pago__fuente { margin: -4px 0 0; font-size: 12px; opacity: .65; }
.pago__fuente a { color: inherit; }
.pedido.enviando button[type="submit"] { opacity: .6; pointer-events: none; }

/* Páginas de resultado de compra y descarga */
.aviso { background: var(--beige-1); padding-block: 72px 96px; }
.aviso__cuerpo { display: flex; flex-direction: column; gap: 16px; }
.aviso__cuerpo h1 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: clamp(2.2rem, 5vw, 3rem); line-height: 1.1; }
.aviso__cuerpo p { margin: 0; max-width: 60ch; }
.aviso__nota { font-size: 15px; opacity: .8; }

/* Sobre el autor */
.autor { background: var(--beige-1); padding-block: 88px; }
.autor__fila { display: flex; flex-wrap: wrap; gap: 56px; align-items: flex-start; }
.autor__foto {
  flex: 0 0 330px; max-width: 100%; aspect-ratio: 3 / 4;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--linea); background: var(--campo); font-size: 15px;
}
.autor__foto img { width: 100%; height: auto; display: block; }
.autor__foto:has(img) { border: 0; background: none; aspect-ratio: auto; }
.autor__texto { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.autor__texto p { margin: 0; max-width: 65ch; }
.autor__nombre { font-family: var(--serif); font-size: 34px; line-height: 1.1; color: var(--rojo); }

/* Contacto */
.contacto { background: var(--beige-3); padding-block: 88px; }
.contacto .contenedor { display: flex; flex-direction: column; gap: 28px; }
.contacto__intro { margin: 0; max-width: 60ch; font-size: 18px; }
.formulario { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo--ancho { grid-column: 1 / -1; }
.campo--oculto { position: absolute; left: -9999px; }
.campo label { font-size: 14px; font-weight: 600; }
.opcional { font-weight: 400; opacity: .75; }
.campo input, .campo textarea {
  width: 100%; min-height: 44px; padding: 12px 14px;
  border: 1px solid var(--linea); border-radius: var(--radio);
  background: var(--campo); color: var(--tinta); font: inherit;
}
.campo textarea { resize: vertical; }
.campo [aria-invalid="true"] { border-color: var(--rojo); }
.formulario__pie { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.formulario__estado { margin: 0; font-weight: 500; }
.formulario__estado.error { color: var(--rojo); }

/* Pie */
.pie { background: var(--tinta); color: var(--blanco); padding-block: 24px; }
.pie__fila {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px;
}
.pie__copy { margin: 0; font-size: 14px; }
.pie__imagen { height: 96px; width: auto; justify-self: center; }
.pie__redes { display: flex; justify-content: flex-end; gap: 6px; }
.pie__redes a { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--blanco); }
.pie__redes a:hover { color: #F0B9A8; }

@media (max-width: 720px) {
  .cabecera { position: static; }
  .marca img { height: 52px; }
  .marca span { font-size: 24px; }
  .hero { padding-block: 40px 56px; }
  .hero__imagen { width: 168px; }
  .slide { gap: 32px; }
  .slide__portada { flex-basis: 100%; }
  .slide__portada img { width: 260px; }
  .miniatura { width: 72px; height: 72px; }
  .autor__foto { flex-basis: 100%; max-width: 330px; }
  .pie__fila { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .pie__redes { justify-content: center; }
  .formulario { grid-template-columns: 1fr; }
}
