/* Any Caraballo · Entre trazos y papeles */
:root {
  --bg: #F4EFE3;
  --paper: #F6F2E8;
  --ink: #4A4440;
  --muted: #5A524B;
  --blue: #4F5FA0;
  --blue-dark: #36437A;
  --line: #D9C3A5;
  --tan: #8A6F55;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Mulish', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); }
a:hover { color: var(--blue-dark); }

/* Intro */
.intro {
  max-width: 1240px;
  margin: 0 auto;
  padding: 64px 24px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.eyebrow {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--tan);
}
.intro h1 {
  margin: 0;
  font-family: 'Libre Caslon Text', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(44px, 7vw, 88px);
  line-height: 1.05;
  color: var(--blue);
}
.lead {
  margin: 0;
  max-width: 560px;
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
}

/* Visor */
.viewer {
  padding: 40px 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  overflow: hidden;
}

/* Libro */
.book {
  --pw: min(540px, 46vw);            /* ancho de una página */
  position: relative;
  width: calc(var(--pw) * 2);
  height: calc(var(--pw) * 4 / 3);   /* proporción A5 (420 x 560) */
  margin: 0 auto;
  perspective: 2600px;
  transition: transform .8s cubic-bezier(.3,.1,.2,1);
  touch-action: pan-y;
}
.book.at-start { transform: translateX(-25%); }  /* portada centrada */
.book.at-end   { transform: translateX(25%); }   /* contratapa centrada */

.sheet {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transform-origin: left center;
  transform-style: preserve-3d;
  /* el z-index cambia a mitad del giro para que la hoja quede siempre arriba */
  transition: transform .9s cubic-bezier(.3,.1,.2,1), z-index 0s linear .45s;
}
.sheet.flipped { transform: rotateY(-180deg); }
.sheet:focus-visible { outline: none; }
.sheet:focus-visible .face { box-shadow: 0 0 0 3px var(--blue); }

.face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--paper);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: 0 18px 40px -18px rgba(70,50,30,.45);
}
.face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.face.back { transform: rotateY(180deg); }

/* sombra suave del lomo */
.face::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 7%;
  pointer-events: none;
}
.face.front::after { left: 0;  background: linear-gradient(to right, rgba(60,40,20,.14), rgba(60,40,20,0)); }
.face.back::after  { right: 0; background: linear-gradient(to left,  rgba(60,40,20,.14), rgba(60,40,20,0)); }

/* Controles */
.controls {
  display: flex;
  align-items: center;
  gap: 20px;
}
.status {
  min-width: 220px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.status-title {
  font-family: 'Libre Caslon Text', Georgia, serif;
  font-style: italic;
  font-size: 20px;
  color: var(--blue);
}
.status-page { font-size: 13px; color: #6E655C; }

.navbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #FBF8F1;
  color: var(--blue);
  cursor: pointer;
  transition: background .2s;
}
.navbtn:hover { background: #fff; }
.navbtn:disabled { opacity: .35; cursor: default; }

.chips {
  max-width: 1000px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.chip {
  font: 600 13px/1 'Mulish', system-ui, sans-serif;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.chip:hover { background: #FBF8F1; }
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* Footer */
footer {
  margin-top: 48px;
  border-top: 1px solid var(--line);
}
.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 48px 24px 56px;
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-end;
  justify-content: space-between;
}
footer h2 {
  margin: 0 0 8px;
  font-family: 'Libre Caslon Text', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 40px;
  color: var(--blue);
}
footer p { margin: 0; font-size: 16px; color: var(--muted); }
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  font-size: 15px;
  font-weight: 600;
}
.links a { padding: 12px 0; }

@media (prefers-reduced-motion: reduce) {
  .book, .sheet { transition-duration: .01s; }
}
