:root {
  --page: #f3e7d0;
  --paper: #fcf6ec;
  --maroon: #7a3328;
  --maroon-dark: #5e241b;
  --gold: #b8924a;
  --gold-soft: #e6d3ad;
  --ink: #3b2b22;
  --muted: #7c6a5c;
  --line: #e9dcc4;
  --serif: "Cormorant Garamond", Georgia, serif;
  --body: "Alegreya", Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: linear-gradient(180deg, #f8efdf 0%, var(--page) 100%) fixed;
  min-height: 100vh;
  padding-bottom: 120px;
}

.layout { max-width: 720px; margin: 0 auto; }
.sheet {
  margin: 24px auto 0;
  background: var(--paper);
  border: 1px solid #e2cfa9;
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(94, 60, 30, 0.18);
  overflow: hidden;
}

.cover-pane { margin: 24px auto 0; }
/* Book cover: flat, square corners, slight 3D turn and soft shadow (same effect as Diseño Editorial) */
.cover-pane { perspective: 1600px; }
.book {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  transform: rotateY(14deg) rotateX(4deg);
    transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.cover { display: block; width: 100%; height: auto; border-radius: 0; }
.book::after {
  /* light volume: soft sheen from the spine side */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,0.18) 0%, rgba(255,255,255,0.10) 3%, rgba(255,255,255,0) 12%, rgba(0,0,0,0) 85%, rgba(0,0,0,0.08) 100%);
}
.book::before {
  /* dim layer shown on hover behind the buy button */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: rgba(40, 20, 12, 0.35); opacity: 0; transition: opacity 0.3s ease;
}
.book .buy-cover {
  position: absolute; left: 50%; top: 50%; z-index: 2;
  transform: translate(-50%, -40%);
  white-space: nowrap;
  background: var(--maroon); color: #fff; border-color: var(--maroon);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.book .buy-cover:hover { background: var(--maroon-dark); border-color: var(--maroon-dark); }
.book:hover, .book:focus-within { transform: rotateY(6deg) rotateX(2deg); }
.book:hover::before, .book:focus-within::before { opacity: 1; }
.book:hover .buy-cover, .book:focus-within .buy-cover { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
/* Touch screens have no hover: the buy button at the top of the page covers it */
@media (hover: none) { .book .buy-cover, .book::before { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .book, .buy-cover { transition: none; }
}

.head { text-align: center; padding: 28px 24px 8px; }
.diamonds { display: flex; justify-content: center; align-items: center; gap: 30px; margin-bottom: 14px; }
.diamonds span { width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); }
.diamonds span:nth-child(2) { width: 13px; height: 13px; }

h1 {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--maroon);
  font-size: clamp(2.1rem, 7vw, 3rem);
  line-height: 1.05;
  margin: 0;
}
.subtitle { font-style: italic; color: var(--muted); font-size: 1.15rem; margin: 8px 0 0; }
.rule { width: 140px; height: 2px; background: var(--gold); margin: 18px auto; border: 0; }
.lead { font-style: italic; color: var(--muted); max-width: 520px; margin: 0 auto; line-height: 1.5; }
.author { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.82rem; margin-top: 16px; }

.play-all {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 18px 0 6px;
  font: 600 1rem var(--body);
  color: #fff; background: var(--maroon);
  border: 0; border-radius: 999px; padding: 12px 22px; cursor: pointer;
}
.play-all:hover { background: var(--maroon-dark); }
.play-all svg, .buy svg { width: 16px; height: 16px; fill: currentColor; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 18px 0 6px; }
.actions .play-all { margin: 0; }
.buy {
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 1rem var(--body); color: var(--maroon); text-decoration: none;
  background: transparent; border: 1.5px solid var(--gold); border-radius: 999px; padding: 11px 22px;
}
.buy:hover { background: #f5ead6; border-color: var(--maroon); }

.tracks { list-style: none; margin: 8px 0 0; padding: 8px 20px 28px; }
.track { padding: 10px 0; border-bottom: 1px solid var(--line); }
.track:last-child { border-bottom: 0; }
.track-title { display: flex; align-items: baseline; gap: 10px; font-size: 1.12rem; }
.track-title .dot { width: 7px; height: 7px; background: var(--gold); transform: rotate(45deg); flex: none; position: relative; top: -2px; }
.track-note { font-style: italic; color: var(--muted); font-size: 0.88rem; margin: 2px 0 0 17px; }

.parts { margin: 6px 0 0 17px; display: grid; gap: 2px; }
.part {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; border-radius: 10px; padding: 7px 10px;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.part:hover { background: #f5ead6; }
.part svg { width: 18px; height: 18px; flex: none; fill: var(--gold); }
.part .label { flex: 1; }
.part .time { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.part.is-current { background: #f1e2c6; }
.part.is-current .label { color: var(--maroon); font-weight: 700; }
.part.is-current svg { fill: var(--maroon); }

.foot { text-align: center; color: var(--muted); font-size: 0.9rem; padding: 4px 24px 28px; }
.foot a { color: var(--maroon); }

/* Player bar */
.player {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(252, 246, 236, 0.97);
  backdrop-filter: blur(6px);
  border-top: 1px solid #e2cfa9;
  box-shadow: 0 -8px 24px rgba(94, 60, 30, 0.12);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  transform: translateY(110%);
  transition: transform 0.25s ease;
}
.player.is-open { transform: none; }
.player-inner { max-width: 720px; margin: 0 auto; }
.now { display: flex; align-items: center; gap: 8px; min-width: 0; }
.now svg { width: 16px; height: 16px; fill: var(--gold); flex: none; }
.now-title { font-weight: 700; color: var(--maroon); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-kind { color: var(--muted); font-style: italic; font-size: 0.85rem; white-space: nowrap; }
.controls { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: var(--maroon); flex: none;
}
.btn svg { width: 20px; height: 20px; fill: currentColor; }
.btn.main { background: var(--maroon); color: #fff; width: 46px; height: 46px; }
.btn.main:hover { background: var(--maroon-dark); }
.seek { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
input[type="range"] { flex: 1; accent-color: var(--maroon); }

@media (max-width: 760px) {
  .sheet { margin: 0; border-radius: 0; border: 0; box-shadow: none; }
  .tracks { padding: 8px 12px 24px; }
  .cover-pane { margin: 0; padding: 24px 32px 8px; }
}

/* Desktop: cover fixed on the left, player on the right */
@media (min-width: 960px) {
  :root { --left: min(46vw, calc(80vh * 707 / 937 + 160px)); }
  .layout { max-width: none; margin: 0; padding-left: var(--left); }
  .cover-pane {
    position: fixed; top: 0; bottom: 0; left: 0; width: var(--left); margin: 0;
    display: flex; align-items: center; justify-content: center; padding: 24px 40px;
    background: linear-gradient(180deg, #efe0c3 0%, #e8d4ae 100%);
    border-right: 1px solid #e2cfa9;
  }
  .book { max-height: 80vh; }
  .cover { width: auto; max-width: 100%; max-height: 80vh; }
  .sheet, .foot { max-width: 720px; margin-left: auto; margin-right: auto; }
  .sheet { margin-top: 32px; }
  .player { left: var(--left); }
}
@media (max-width: 420px) { .seek .t { display: none; } }
