/* ═══════════════════════════════════════════════════════════
   Biblioteca Sonora — Design System v2
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg: #0a0a0f;
    --bg-raised: #111118;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c28;
    --surface: #1e1e2a;
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --text: #e8e6f0;
    --text-secondary: #9490a8;
    --text-muted: #5e5a72;
    --accent: #c9a96e;
    --accent-light: #dfc48f;
    --accent-dim: rgba(201, 169, 110, 0.15);
    --accent-glow: rgba(201, 169, 110, 0.25);
    --success: #5cb88a;
    --danger: #e05555;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --nav-height: 64px;
    --section-padding: 100px;
    --card-radius: 16px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.6; overflow-x: hidden; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 10001; padding: 10px 14px; background: var(--accent); color: #17120a; font-weight: 700; border-radius: var(--radius-sm); transform: translateY(-160%); transition: transform 0.2s var(--ease-out); }
.skip-link:focus { transform: translateY(0); outline: 3px solid var(--text); outline-offset: 2px; }
@media (pointer: fine) { body { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='28' viewBox='0 0 20 28'%3E%3Cpath d='M4 1L3 22l3-4 3 8 2-1-3-8h4L4 1z' fill='%23c9a96e' stroke='%230a0a0f' stroke-width='1'/%3E%3C/svg%3E") 4 1, auto; } }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { border: none; background: none; cursor: pointer; font-family: inherit; color: inherit; }
select { font-family: inherit; }

/* ─── NAV ────────────────────────────────────────────── */
#main-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: var(--nav-height); background: rgba(10,10,15,0.7); backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6); border-bottom: 1px solid var(--border); transition: background 0.4s var(--ease-smooth); padding-top: env(safe-area-inset-top); }
.nav-inner { max-width: 1200px; margin: 0 auto; padding: 0 32px; height: 100%; display: flex; align-items: center; justify-content: space-between; }
.nav-logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; color: var(--accent); }
.nav-links { display: flex; gap: 32px; }
.nav-link { font-size: 0.875rem; color: var(--text-secondary); transition: color 0.3s; position: relative; }
.nav-link::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 1px; background: var(--accent); transition: width 0.3s var(--ease-out); }
.nav-link:hover { color: var(--text); }
.nav-link:hover::after { width: 100%; }

/* ─── HAMBURGER ──────────────────────────────────────── */
.hamburger { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 36px; height: 36px; padding: 6px; border-radius: var(--radius-sm); z-index: 110; }
.hamburger-line { display: block; width: 100%; height: 2px; background: var(--text-secondary); border-radius: 2px; transition: all 0.35s var(--ease-out); transform-origin: center; }
.hamburger.active .hamburger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active .hamburger-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.active .hamburger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── MOBILE MENU ────────────────────────────────────── */
.mobile-menu-overlay { position: fixed; inset: 0; z-index: 98; background: rgba(0,0,0,0.6); opacity: 0; visibility: hidden; transition: all 0.4s; }
.mobile-menu-overlay.active { opacity: 1; visibility: visible; }
.mobile-menu { position: fixed; top: var(--nav-height); right: 0; z-index: 99; width: 280px; max-width: 85vw; height: calc(100vh - var(--nav-height)); background: var(--bg-raised); border-left: 1px solid var(--border); padding: 32px 28px; padding-bottom: env(safe-area-inset-bottom); display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.45s var(--ease-out); }
.mobile-menu.active { transform: translateX(0); }
.mobile-menu-link { display: block; padding: 16px 4px; font-size: 1.05rem; font-weight: 500; color: var(--text-secondary); border-bottom: 1px solid var(--border); transition: color 0.3s, padding-left 0.3s var(--ease-out); }
.mobile-menu-link:hover { color: var(--accent); padding-left: 12px; }

/* ─── SPLASH / OPENING ANIMATION ────────────────────── */
.splash-overlay {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}
.splash-overlay.hidden { display: none; }
.splash-curtain {
    position: absolute; left: 0; right: 0; height: 50%;
    background: #050508;
    transition: transform 0.9s cubic-bezier(0.77, 0, 0.175, 1);
}
.splash-curtain-top { top: 0; transform-origin: top; }
.splash-curtain-bottom { bottom: 0; transform-origin: bottom; }
.splash-overlay.reveal .splash-curtain-top { transform: translateY(-100%); }
.splash-overlay.reveal .splash-curtain-bottom { transform: translateY(100%); }

.splash-center {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center; gap: 20px;
    opacity: 0;
    animation: splashFadeIn 0.8s ease 0.15s forwards;
}
.splash-overlay.reveal .splash-center {
    animation: splashFadeOut 0.4s ease forwards;
}

.splash-icon {
    color: var(--accent);
    filter: drop-shadow(0 0 20px rgba(201,169,110,0.5)) drop-shadow(0 0 40px rgba(201,169,110,0.2));
    animation: splashPulse 2s ease-in-out infinite;
}

.splash-line {
    width: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    animation: splashLineExpand 1s ease 0.5s forwards;
}

@keyframes splashFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes splashFadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(1.15); }
}
@keyframes splashPulse {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(201,169,110,0.5)) drop-shadow(0 0 40px rgba(201,169,110,0.2)); }
    50% { filter: drop-shadow(0 0 30px rgba(201,169,110,0.7)) drop-shadow(0 0 60px rgba(201,169,110,0.35)); }
}
@keyframes splashLineExpand {
    from { width: 0; }
    to { width: 160px; }
}

/* ─── HERO ───────────────────────────────────────────── */
#hero { position: relative; height: 55vh; max-height: 500px; display: flex; align-items: center; justify-content: center; padding: calc(var(--nav-height) + 20px) 32px 30px; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(10,10,15,0.5) 0%, rgba(10,10,15,0.82) 60%, var(--bg) 100%), url('img/hero_bg.png') center/cover no-repeat; pointer-events: none; }
.hero-smoke { position: absolute; inset: 0; pointer-events: none; z-index: 1; opacity: 0.3; background: radial-gradient(ellipse 120% 60% at 20% 90%, rgba(201,169,110,0.12) 0%, transparent 50%), radial-gradient(ellipse 100% 80% at 80% 80%, rgba(140,120,90,0.1) 0%, transparent 50%); animation: smokeFlow 12s ease-in-out infinite alternate; }
.hero-smoke-2 { animation: smokeFlow2 16s ease-in-out infinite alternate; opacity: 0.2; background: radial-gradient(ellipse 90% 70% at 60% 100%, rgba(180,150,100,0.15) 0%, transparent 50%); }
@keyframes smokeFlow { 0% { transform: translateX(-30px) translateY(0) scale(1); } 100% { transform: translateX(40px) translateY(-20px) scale(1.15); } }
@keyframes smokeFlow2 { 0% { transform: translateX(20px) translateY(10px) scale(1.1); } 100% { transform: translateX(-40px) translateY(-30px) scale(1); } }
.particles-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.hero-content { position: relative; z-index: 2; max-width: 720px; text-align: center; animation: heroFadeIn 1.2s var(--ease-out) both; }

@keyframes heroFadeIn { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }

.hero-badge { display: inline-block; font-size: 0.72rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); background: var(--accent-dim); border: 1px solid rgba(201,169,110,0.2); padding: 6px 16px; border-radius: 100px; margin-bottom: 28px; animation: heroFadeIn 1.2s var(--ease-out) 0.2s both; }
#hero-title { font-family: var(--font-display); font-size: clamp(2rem,4.5vw,3.2rem); font-weight: 700; font-style: italic; line-height: 1.1; letter-spacing: -0.02em; margin-bottom: 24px; color: var(--accent); animation: heroFadeIn 1.2s var(--ease-out) 0.3s both; }
#hero-title em { font-style: italic; color: var(--accent); }
.hero-subtitle { font-size: 1.05rem; color: rgba(232,230,240,0.85); max-width: 520px; margin: 0 auto 28px; line-height: 1.65; animation: heroFadeIn 1.2s var(--ease-out) 0.4s both; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; animation: heroFadeIn 1.2s var(--ease-out) 0.5s both; }

/* ─── QUOTE BANNER ───────────────────────────────────── */
.quote-banner { background: var(--bg-raised); border-bottom: 1px solid var(--border); padding: 36px 32px; }
.quote-inner { max-width: 700px; margin: 0 auto; text-align: center; position: relative; }
.quote-mark { color: var(--accent); margin-bottom: 8px; }
.quote-text { font-family: var(--font-display); font-size: 1.1rem; font-style: italic; line-height: 1.7; color: var(--text); margin-bottom: 10px; opacity: 0; animation: quoteFadeIn 1s var(--ease-out) 0.5s both; }
.quote-source { font-size: 0.78rem; color: var(--accent); letter-spacing: 0.05em; opacity: 0; animation: quoteFadeIn 1s var(--ease-out) 0.8s both; }
@keyframes quoteFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ─── BUTTONS ────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 28px; border-radius: 100px; font-size: 0.9rem; font-weight: 500; transition: all 0.3s var(--ease-out); white-space: nowrap; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #b8944f); color: #0a0a0f; box-shadow: 0 4px 20px rgba(201,169,110,0.2); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(201,169,110,0.35); }
.btn-ghost { border: 1px solid var(--border-hover); color: var(--text-secondary); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-icon { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); transition: all 0.3s var(--ease-out); }
.btn-icon:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-icon.is-fav { border-color: var(--danger); color: var(--danger); background: rgba(224,85,85,0.1); }
.btn-icon.is-fav svg { fill: var(--danger); }

/* ─── SECTIONS ───────────────────────────────────────── */
section { padding: var(--section-padding) 0; }
.section-inner { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.section-header { text-align: center; margin-bottom: 56px; }
.section-header h2 { font-family: var(--font-display); font-size: clamp(1.8rem,3vw,2.6rem); font-weight: 700; font-style: italic; letter-spacing: -0.02em; margin-bottom: 12px; color: var(--accent); }
.section-desc { color: var(--text-secondary); font-size: 1.05rem; }

/* ─── CATALOG CONTROLS ───────────────────────────────── */
.catalog-controls { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 32px; flex-wrap: wrap; }
.search-bar { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 260px; max-width: 600px; padding: 14px 24px; background: rgba(255,255,255,0.06); border: 2px solid rgba(201,169,110,0.3); border-radius: 100px; transition: border-color 0.3s, box-shadow 0.3s; }
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 24px rgba(201,169,110,0.15); }
.search-bar svg { color: var(--accent); flex-shrink: 0; }
.search-bar input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 0.95rem; font-family: var(--font-body); }
.search-bar input::placeholder { color: rgba(255,255,255,0.35); }
.controls-right { display: flex; gap: 8px; align-items: center; }
.sort-select { padding: 8px 14px; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 100px; color: var(--text-secondary); font-size: 0.8rem; outline: none; cursor: pointer; transition: border-color 0.3s; appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239490a8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.sort-select:focus { border-color: var(--accent); }
.sort-select option { background: var(--bg-raised); color: var(--text); }
.view-toggle, .fav-filter-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: all 0.3s; }
.view-toggle:hover, .fav-filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.fav-filter-btn.active { border-color: var(--danger); color: var(--danger); background: rgba(224,85,85,0.1); }

/* ─── BOOKS GRID ─────────────────────────────────────── */
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, 200px); gap: 22px; justify-content: center; }
.books-grid.list-view { grid-template-columns: 1fr; gap: 8px; max-width: 700px; margin: 0 auto; }
.book-card { position: relative; background: var(--bg-card); border: none; border-radius: var(--card-radius); overflow: hidden; cursor: pointer; transition: all 0.4s var(--ease-out); }
.book-card:hover { background: var(--bg-card-hover); transform: translateY(-6px); box-shadow: 0 20px 60px rgba(0,0,0,0.4); }

/* Favorite heart on card */
.book-fav-btn { position: absolute; top: 8px; right: 8px; z-index: 5; width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.5); transition: all 0.3s; opacity: 0; }
.book-card:hover .book-fav-btn { opacity: 1; }
.book-fav-btn:hover { color: var(--danger); transform: scale(1.15); }
.book-fav-btn.is-fav { opacity: 1; color: var(--danger); }
.book-fav-btn.is-fav svg { fill: var(--danger); }

/* Nuevo badge */
.book-badge-new { position: absolute; top: 8px; left: 8px; z-index: 5; padding: 3px 8px; border-radius: 6px; font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; background: var(--accent); color: #0a0a0f; }
.book-badge-availability { position: absolute; right: 8px; bottom: 8px; z-index: 5; padding: 4px 7px; border-radius: 4px; font-size: 0.65rem; font-weight: 700; background: rgba(10, 10, 15, 0.84); color: #fff; }
.availability-available { color: #93e5b4; }
.availability-sample { color: #d9c27a; }
.availability-coming_soon { color: #b7bac6; }

.book-cover-wrap { position: relative; aspect-ratio: 3/4; overflow: hidden; }
.book-cover-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease-out); }
.book-card:hover .book-cover-wrap img { transform: scale(1.05); }

/* Mini equalizer on hover */
.book-eq { position: absolute; bottom: 10px; left: 10px; display: flex; align-items: flex-end; gap: 2px; height: 16px; opacity: 0; transition: opacity 0.3s; }
.book-card:hover .book-eq { opacity: 1; }
.book-eq-bar { width: 3px; background: var(--accent); border-radius: 2px; animation: eqBounce 0.8s ease-in-out infinite alternate; }
.book-eq-bar:nth-child(1) { height: 40%; animation-delay: 0s; }
.book-eq-bar:nth-child(2) { height: 70%; animation-delay: 0.15s; }
.book-eq-bar:nth-child(3) { height: 50%; animation-delay: 0.3s; }
.book-eq-bar:nth-child(4) { height: 90%; animation-delay: 0.1s; }
@keyframes eqBounce { 0% { transform: scaleY(0.3); } 100% { transform: scaleY(1); } }

.book-cover-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(10,10,15,0.85) 0%, transparent 50%); display: flex; align-items: flex-end; justify-content: center; padding: 20px; opacity: 0; transition: opacity 0.4s; }
.book-card:hover .book-cover-overlay { opacity: 1; }
.book-play-btn { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 20px; transform: translateY(10px); transition: transform 0.4s var(--ease-out); box-shadow: 0 4px 20px rgba(201,169,110,0.3); }
.book-card:hover .book-play-btn { transform: translateY(0); }
.book-play-btn svg { color: #0a0a0f; margin-left: 2px; }

.book-info { padding: 14px 16px 16px; }
.book-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; line-height: 1.3; margin-bottom: 4px; color: #ffffff; }
.book-author { font-size: 0.88rem; color: #c0bdd0; margin-bottom: 10px; }
.book-meta { display: flex; align-items: center; gap: 12px; font-size: 0.68rem; color: var(--text-muted); }
.book-meta-item { display: flex; align-items: center; gap: 4px; }
.book-meta-item svg { width: 12px; height: 12px; }
.no-results { text-align: center; color: var(--text-muted); font-size: 1rem; padding: 60px 0; }

/* ─── LIST VIEW ──────────────────────────────────────── */
.books-grid.list-view .book-card { display: flex; flex-direction: row; border-radius: var(--radius-md); }
.books-grid.list-view .book-card:hover { transform: translateX(4px); }
.books-grid.list-view .book-cover-wrap { width: 60px; min-width: 60px; aspect-ratio: auto; height: 80px; }
.books-grid.list-view .book-cover-overlay { display: none; }
.books-grid.list-view .book-info { display: flex; align-items: center; gap: 16px; padding: 10px 16px; flex: 1; }
.books-grid.list-view .book-title { margin-bottom: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 140px; }
.books-grid.list-view .book-author { margin-bottom: 0; white-space: nowrap; }
.books-grid.list-view .book-meta { margin-left: auto; }
.books-grid.list-view .book-fav-btn { opacity: 1; position: static; background: none; }
.books-grid.list-view .book-badge-new { position: static; margin-right: 8px; }
.books-grid.list-view .book-badge-availability { position: static; margin-left: 8px; }
.books-grid.list-view .book-eq { display: none; }

/* ─── FEATURES ───────────────────────────────────────── */
#como-funciona { background: var(--bg-raised); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.feature-card { padding: 32px 28px; border-radius: var(--card-radius); background: var(--bg-card); border: 1px solid var(--border); transition: all 0.4s var(--ease-out); opacity: 0; transform: translateY(30px); }
.feature-card.visible { opacity: 1; transform: translateY(0); }
.feature-card:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
.feature-icon { width: 52px; height: 52px; border-radius: var(--radius-md); background: var(--accent-dim); display: flex; align-items: center; justify-content: center; margin-bottom: 20px; color: var(--accent); }
.feature-card h3 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; margin-bottom: 10px; }
.feature-card p { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.65; }

/* ─── ABOUT ──────────────────────────────────────────── */
.about-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }
.about-text h2 { font-family: var(--font-display); font-size: clamp(1.6rem,3vw,2.2rem); font-weight: 700; margin-bottom: 20px; }
.about-text p { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: 16px; }
.about-text strong { color: var(--accent); font-weight: 600; }
#waveform-canvas { width: 100%; max-width: 400px; height: 200px; border-radius: var(--card-radius); background: var(--bg-card); border: 1px solid var(--border); }

/* ─── FOOTER ─────────────────────────────────────────── */
#footer { padding: 40px 0; border-top: 1px solid var(--border); }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer-brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; color: var(--accent); font-size: 0.95rem; }
.footer-copy { font-size: 0.78rem; color: var(--text-muted); }
.footer-links { display: flex; gap: 24px; }
.footer-links a { font-size: 0.82rem; color: var(--text-secondary); transition: color 0.3s; }
.footer-links a:hover { color: var(--accent); }

/* ─── MODAL ──────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: max(32px, env(safe-area-inset-top)) max(32px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(32px, env(safe-area-inset-left)); opacity: 0; visibility: hidden; transition: all 0.4s; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-card { position: relative; max-width: 700px; width: 100%; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; transform: translateY(20px) scale(0.97); transition: transform 0.4s var(--ease-out); max-height: 90vh; overflow-y: auto; }
.modal-overlay.active .modal-card { transform: translateY(0) scale(1); }
.modal-close { position: absolute; top: 16px; right: 16px; z-index: 10; width: 36px; height: 36px; border-radius: 50%; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); transition: all 0.3s; }
.modal-close:hover { background: rgba(0,0,0,0.8); color: var(--text); }
.modal-body { display: flex; }
.modal-cover { width: 240px; min-height: 340px; object-fit: cover; flex-shrink: 0; }
.modal-info { padding: 32px 28px; display: flex; flex-direction: column; justify-content: center; }
.modal-info h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; line-height: 1.2; margin-bottom: 6px; }
.modal-author { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 12px; }
.modal-description { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.65; margin-bottom: 16px; }
.modal-badges { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.modal-badge { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 4px 10px; border-radius: 100px; }
.badge-dominio { background: rgba(92,184,138,0.15); color: var(--success); border: 1px solid rgba(92,184,138,0.25); }
.badge-integra { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(201,169,110,0.25); }
.modal-meta { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.meta-item { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-muted); }
.meta-item svg { color: var(--accent); }
.meta-plays { font-size: 0.72rem; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-download { font-size: 0.85rem; padding: 11px 24px; }
.btn-preview { font-size: 0.85rem; padding: 11px 20px; }
.btn-download.is-unavailable { opacity: 0.58; cursor: not-allowed; }
.btn-preview.is-unavailable { opacity: 0.58; cursor: not-allowed; }
.modal-download-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.modal-download-files a { font-size: 0.78rem; color: var(--accent); border: 1px solid var(--border); padding: 6px 9px; border-radius: 4px; }
.modal-download-files a:hover { border-color: var(--accent); }

/* ─── AUDIO PLAYER ───────────────────────────────────── */
.audio-player { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 18px; }
.player-play-btn { width: 36px; height: 36px; min-width: 36px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; color: #0a0a0f; transition: all 0.25s var(--ease-out); box-shadow: 0 2px 12px rgba(201,169,110,0.2); }
.player-play-btn:hover { transform: scale(1.08); }
.player-play-btn svg { margin-left: 1px; }
.player-progress-wrap { flex: 1; height: 4px; background: rgba(255,255,255,0.08); border-radius: 4px; cursor: pointer; position: relative; overflow: hidden; }
.player-progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-light)); border-radius: 4px; transition: width 0.1s linear; }
.player-time { font-size: 0.72rem; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 80px; text-align: right; }
.player-volume-wrap { display: flex; align-items: center; gap: 4px; }
.player-vol-btn { color: var(--text-muted); padding: 4px; transition: color 0.2s; }
.player-vol-btn:hover { color: var(--accent); }
.player-speed-btn { color: var(--text-muted); background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 4px; padding: 2px 8px; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all .2s; margin-left: 8px; letter-spacing: .02em; }
.player-speed-btn:hover { color: var(--accent); border-color: var(--accent); background: rgba(168,130,255,.1); }
.player-volume { width: 60px; height: 4px; -webkit-appearance: none; appearance: none; background: rgba(255,255,255,0.08); border-radius: 4px; outline: none; cursor: pointer; }
.player-volume::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); cursor: pointer; }
.player-volume::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); cursor: pointer; border: none; }

/* ─── MINI-PLAYER ────────────────────────────────────── */
.mini-player { position: fixed; bottom: 0; left: 0; right: 0; z-index: 150; background: #111118; border-top: 1px solid var(--border); transform: translateY(100%); transition: transform 0.5s var(--ease-out); display: none; }
.mini-player.active { transform: translateY(0); }
.mini-player-inner { max-width: 1200px; margin: 0 auto; padding: 10px 24px; padding-bottom: env(safe-area-inset-bottom); display: flex; align-items: center; gap: 14px; }
.mini-player-cover { width: 44px; height: 44px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.mini-player-info { min-width: 0; flex-shrink: 0; max-width: 180px; }
.mini-player-title { display: block; font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-player-author { display: block; font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-player-controls { flex: 1; display: flex; align-items: center; gap: 12px; }
.mini-player-play { width: 36px; height: 36px; min-width: 36px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; color: #0a0a0f; transition: all 0.25s; }
.mini-player-play:hover { transform: scale(1.08); }
.mini-player-play svg { margin-left: 1px; }
.mini-player-progress-wrap { flex: 1; height: 4px; background: rgba(255,255,255,0.08); border-radius: 4px; cursor: pointer; overflow: hidden; }
.mini-player-progress-bar { height: 100%; width: 0%; background: var(--accent); border-radius: 4px; transition: width 0.1s linear; }
.mini-player-time { font-size: 0.72rem; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 36px; }
.mini-player-close { color: var(--text-muted); padding: 6px; transition: color 0.2s; flex-shrink: 0; }
.mini-player-close:hover { color: var(--text); }
.mini-player-progress-full { height: 2px; background: rgba(255,255,255,0.04); }
.mini-player-progress-full-bar { height: 100%; width: 0%; background: var(--accent); transition: width 0.1s linear; }

/* ─── TOAST ──────────────────────────────────────────── */
.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 300; background: var(--bg-card); border: 1px solid var(--accent); color: var(--text); padding: 12px 24px; border-radius: 100px; font-size: 0.82rem; opacity: 0; visibility: hidden; transition: all 0.4s var(--ease-out); box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ─── AUTH GATE ───────────────────────────────────────── */
.auth-gate { position: fixed; inset: 0; z-index: 9999; background: var(--bg); display: flex; align-items: center; justify-content: center; transition: opacity 0.5s, visibility 0.5s; }
.auth-gate.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.auth-card { text-align: center; max-width: 380px; width: 100%; padding: 48px 36px; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 20px; animation: heroFadeIn 0.8s var(--ease-out) both; }
.auth-icon { color: var(--accent); margin-bottom: 20px; }
.auth-card h2 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; margin-bottom: 6px; }
.auth-card > p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 28px; }
#auth-form { display: flex; flex-direction: column; gap: 12px; }
#auth-input { width: 100%; padding: 13px 18px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-size: 0.9rem; font-family: var(--font-body); outline: none; transition: border-color 0.3s; text-align: center; letter-spacing: 0.1em; }
#auth-input:focus { border-color: var(--accent); }
#auth-input::placeholder { color: var(--text-muted); letter-spacing: 0; }
#auth-form .btn { width: 100%; justify-content: center; }
.auth-error { font-size: 0.8rem; color: var(--danger); margin-top: 12px; min-height: 1.2em; }
body.has-mini-player { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

/* ─── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .hamburger { display: flex; }
    .books-grid { grid-template-columns: repeat(auto-fill, 170px); gap: 14px; }
    .about-inner { grid-template-columns: 1fr; gap: 40px; }
    .modal-body { flex-direction: column; }
    .modal-cover { width: 100%; min-height: 200px; max-height: 240px; }
    .footer-inner { flex-direction: column; text-align: center; }
    .audio-player { flex-wrap: wrap; }
    .player-volume-wrap { display: none; }
    .mini-player-info { max-width: 100px; }
    .mini-player-time { display: none; }
    .catalog-controls { flex-direction: column; align-items: stretch; }
    .search-bar { max-width: none; }
    .controls-right { justify-content: flex-end; }
    .books-grid.list-view .book-info { flex-wrap: wrap; gap: 4px; }
    .books-grid.list-view .book-meta { margin-left: 0; }
}

@media (max-width: 480px) {
    .section-inner { padding: 0 20px; }
    .books-grid { grid-template-columns: repeat(auto-fill, 150px); gap: 10px; }
    .book-info { padding: 10px 10px 12px; }
    .book-title { font-size: 0.88rem; }
    .mini-player-inner { padding: 8px 16px; gap: 10px; }
    .mini-player-cover { width: 36px; height: 36px; }
    .mini-player-progress-wrap { display: none; }
}

/* ─── SHELVES / ESTANTERÍAS ───────────────────────────── */
.shelves-section { padding: 60px 0; background: var(--bg-raised); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.shelf { margin-bottom: 36px; }
.shelf:last-child { margin-bottom: 0; }
.shelf-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 0 4px; }
.shelf-emoji { font-size: 1.3rem; }
.shelf-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; color: var(--text); }
.shelf-count { font-size: 0.72rem; color: var(--text-muted); margin-left: auto; }
.shelf-scroll { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; scrollbar-color: var(--accent-dim) transparent; }
.shelf-scroll::-webkit-scrollbar { height: 4px; }
.shelf-scroll::-webkit-scrollbar-thumb { background: var(--accent-dim); border-radius: 2px; }
.shelf-book { flex-shrink: 0; width: 120px; cursor: pointer; transition: transform 0.3s var(--ease-out); }
.shelf-book:hover { transform: translateY(-6px); }
.shelf-book img { width: 120px; height: 160px; object-fit: cover; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.4); transition: box-shadow 0.3s; border: 2px solid transparent; }
.shelf-book:hover img { border-color: var(--accent); box-shadow: 0 8px 28px rgba(201,169,110,0.2); }
.shelf-book-title { font-size: 0.68rem; font-weight: 500; color: var(--text-secondary); margin-top: 8px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shelf-book-author { font-size: 0.6rem; color: var(--text-muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── TIMELINE ───────────────────────────────────────── */
.timeline-section { padding: 60px 0 40px; background: var(--bg); }
.timeline-scroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 16px; scrollbar-width: thin; scrollbar-color: var(--accent-dim) transparent; }
.timeline-scroll::-webkit-scrollbar { height: 6px; }
.timeline-scroll::-webkit-scrollbar-thumb { background: var(--accent-dim); border-radius: 3px; }
.timeline-track { display: flex; align-items: flex-end; gap: 0; min-width: max-content; position: relative; padding: 20px 0 50px; }
.timeline-track::before { content: ''; position: absolute; bottom: 38px; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent 0%, var(--accent-dim) 5%, var(--accent) 50%, var(--accent-dim) 95%, transparent 100%); }
.timeline-item { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 120px; cursor: pointer; position: relative; transition: transform 0.3s var(--ease-out); }
.timeline-item:hover { transform: translateY(-6px); }
.timeline-item img { width: 90px; height: 120px; object-fit: cover; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.5); transition: all 0.3s; border: 2px solid transparent; }
.timeline-item:hover img { border-color: var(--accent); box-shadow: 0 8px 32px rgba(201,169,110,0.2); }
.timeline-item-title { font-size: 0.65rem; font-weight: 600; text-align: center; max-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-secondary); }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); box-shadow: 0 0 8px rgba(201,169,110,0.3); position: relative; z-index: 2; }
.timeline-year { font-size: 0.62rem; color: var(--accent); font-weight: 600; letter-spacing: 0.05em; position: absolute; bottom: 2px; }

/* ─── CHAPTERS LIST ──────────────────────────────────── */
.modal-chapters { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.chapters-toggle { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 0; font-size: 0.82rem; font-weight: 500; color: var(--text-secondary); transition: color 0.3s; }
.chapters-toggle:hover { color: var(--accent); }
.chapters-chevron { transition: transform 0.3s var(--ease-out); margin-left: auto; }
.chapters-toggle.open .chapters-chevron { transform: rotate(180deg); }
.chapters-list { max-height: 200px; overflow-y: auto; padding: 4px 0; scrollbar-width: thin; scrollbar-color: var(--accent-dim) transparent; }
.chapters-list::-webkit-scrollbar { width: 4px; }
.chapters-list::-webkit-scrollbar-thumb { background: var(--accent-dim); border-radius: 2px; }
.chapter-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-sm); font-size: 0.75rem; color: var(--text-secondary); transition: all 0.2s; cursor: pointer; }
.chapter-item:hover { background: var(--accent-dim); color: var(--accent); }
.chapter-num { font-size: 0.65rem; font-weight: 600; color: var(--text-muted); min-width: 24px; text-align: right; }

/* ─── SLEEP TIMER ────────────────────────────────────── */
.sleep-timer-wrap { position: relative; flex-shrink: 0; }
.mini-player-sleep { display: flex; align-items: center; gap: 4px; color: var(--text-muted); padding: 6px; border-radius: 6px; transition: all 0.3s; font-size: 0.7rem; }
.mini-player-sleep:hover { color: var(--accent); }
.mini-player-sleep.active { color: var(--accent); }
.sleep-timer-label { font-variant-numeric: tabular-nums; font-weight: 600; }
.sleep-timer-menu { position: absolute; bottom: 100%; right: 0; margin-bottom: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 6px; display: none; flex-direction: column; gap: 2px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); min-width: 100px; }
.sleep-timer-menu.show { display: flex; }
.sleep-timer-menu button { padding: 8px 14px; font-size: 0.78rem; color: var(--text-secondary); border-radius: 6px; text-align: left; transition: all 0.2s; }
.sleep-timer-menu button:hover { background: var(--accent-dim); color: var(--accent); }

/* ─── HERO STATS (animated counter) ──────────────────── */
.hero-stats { display: flex; align-items: center; justify-content: center; gap: 40px; margin-bottom: 28px; animation: heroFadeIn 1.2s var(--ease-out) 0.45s both; }
.hero-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hero-stat-num { font-size: 2rem; font-weight: 700; color: var(--accent); font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.hero-stat-label { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }

/* ─── TYPEWRITER CURSOR ─────────────────────────────── */
.quote-text.typing::after { content: '|'; color: var(--accent); font-weight: 300; animation: blinkCursor 0.6s step-end infinite; }
@keyframes blinkCursor { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ─── 3D TILT ON BOOK CARDS ─────────────────────────── */
.book-card { perspective: 800px; }
.book-cover-wrap { transform-style: preserve-3d; transition: transform 0.15s ease-out; }

/* ─── THEME TOGGLE BUTTON ───────────────────────────── */
.btn-theme-toggle { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); transition: all 0.3s; margin-left: 8px; }
.btn-theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ─── SEPIA / PARCHMENT THEME ────────────────────────── */
:root.sepia { --bg: #f5e6c8; --bg-raised: #ede0c8; --bg-card: #e8d5b0; --bg-card-hover: #dcc9a0; --surface: #e0d0b0; --border: rgba(0,0,0,0.1); --border-hover: rgba(0,0,0,0.18); --text: #2a1f0e; --text-secondary: #5c4a2e; --text-muted: #8a7a5a; --accent: #8b6914; --accent-light: #a07a1a; --accent-dim: rgba(139,105,20,0.12); --accent-glow: rgba(139,105,20,0.2); }
:root.sepia body { background: var(--bg); color: var(--text); }
@media (pointer: fine) { :root.sepia body { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='28' viewBox='0 0 20 28'%3E%3Cpath d='M4 1L3 22l3-4 3 8 2-1-3-8h4L4 1z' fill='%238b6914' stroke='%23f5e6c8' stroke-width='1'/%3E%3C/svg%3E") 4 1, auto; } }
:root.sepia #main-nav { background: rgba(245,230,200,0.85); }
:root.sepia .modal-card { background: var(--bg-raised); }
:root.sepia .book-title { color: var(--text); }
:root.sepia .book-cover-overlay { background: linear-gradient(to top, rgba(245,230,200,0.85) 0%, transparent 50%); }
:root.sepia .mini-player { background: var(--bg-raised); }
:root.sepia .auth-gate { background: var(--bg); }
:root.sepia .btn-primary { color: #fff; }
:root.sepia .book-play-btn { color: #fff; }
:root.sepia .player-play-btn, :root.sepia .mini-player-play { color: #fff; }
:root.sepia .hero-bg { background: linear-gradient(to bottom, rgba(245,230,200,0.5) 0%, rgba(245,230,200,0.82) 60%, var(--bg) 100%), url('img/hero_bg.png') center/cover no-repeat; }
:root.sepia .modal-close { background: rgba(0,0,0,0.15); }
:root.sepia .book-fav-btn { background: rgba(0,0,0,0.15); }

/* ─── RANDOM BOOK BUTTON ────────────────────────────── */
.btn-random { font-size: 0.82rem; padding: 8px 16px; white-space: nowrap; }
@keyframes gridShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.books-grid.shaking { animation: gridShake 0.3s ease 2; }

/* ─── STATISTICS SECTION ────────────────────────────── */
.stats-section { padding: 80px 0; background: var(--bg-raised); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.stat-card { padding: 32px 24px; border-radius: var(--card-radius); background: var(--bg-card); border: 1px solid var(--border); text-align: center; transition: all 0.4s var(--ease-out); }
.stat-card:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,0.2); }
.stat-number { display: block; font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.stat-label { display: block; font-size: 0.82rem; color: var(--text-secondary); }

/* ─── LITERARY MAP ──────────────────────────────────── */
#mapa-literario { padding: 80px 0; background: var(--bg); }
.map-container { max-width: 800px; margin: 0 auto; position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--card-radius); padding: 24px; overflow: hidden; }
#literary-map { width: 100%; height: auto; display: block; }
.map-continent { fill: rgba(255,255,255,0.04); stroke: rgba(255,255,255,0.08); stroke-width: 1; }
.map-dot { fill: var(--accent); cursor: pointer; transition: r 0.3s; }
.map-dot:hover { r: 8; }
@keyframes mapPulse { 0%,100% { opacity: 0.4; r: 10; } 50% { opacity: 0; r: 18; } }
.map-dot-pulse { fill: none; stroke: var(--accent); stroke-width: 1; opacity: 0; animation: mapPulse 2.5s ease-in-out infinite; pointer-events: none; }
.map-tooltip { position: absolute; background: var(--bg-raised); border: 1px solid var(--accent); color: var(--text); font-size: 0.78rem; padding: 6px 12px; border-radius: var(--radius-sm); pointer-events: none; opacity: 0; transition: opacity 0.2s; white-space: nowrap; z-index: 10; transform: translate(-50%, -100%); margin-top: -10px; }
.map-tooltip.visible { opacity: 1; }

/* ─── AUTHOR BIO CARD ───────────────────────────────── */
.modal-author { cursor: pointer; transition: color 0.3s; }
.modal-author:hover { color: var(--accent); }
.author-bio-card { border-left: 3px solid var(--accent); padding: 12px 16px; margin-bottom: 14px; background: var(--accent-dim); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; overflow: hidden; animation: slideDown 0.35s var(--ease-out) both; }
@keyframes slideDown { from { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; } to { max-height: 300px; opacity: 1; } }
.author-bio-years { font-size: 0.82rem; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.author-bio-text { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.55; margin-bottom: 8px; }
.author-bio-works { display: flex; flex-wrap: wrap; gap: 6px; }
.author-bio-works a { font-size: 0.72rem; padding: 3px 10px; border-radius: 100px; border: 1px solid var(--border); color: var(--text-secondary); transition: all 0.3s; }
.author-bio-works a:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ─── MINI-PLAYER WAVEFORM ──────────────────────────── */
.mini-player-waveform { height: 30px; flex: 1; min-width: 80px; display: none; border-radius: 4px; }
.mini-player-waveform.active { display: block; }

/* ─── QR CODE IN MODAL ──────────────────────────────── */
.modal-qr { width: 60px; height: 60px; border-radius: var(--radius-sm); border: 1px solid var(--border); object-fit: contain; cursor: pointer; transition: all 0.3s var(--ease-out); }
.modal-qr.enlarged { width: 180px; height: 180px; border-color: var(--accent); box-shadow: 0 8px 32px rgba(0,0,0,0.4); }

/* ─── SCROLL REVEAL ──────────────────────────────────── */
.book-card { opacity: 0; transform: translateY(30px); }
.book-card.revealed { opacity: 1; transform: translateY(0); transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out); }

/* ─── SKELETON LOADING ──────────────────────────────── */
.book-cover-wrap .skeleton { position: absolute; inset: 0; background: linear-gradient(110deg, var(--bg-card) 30%, rgba(255,255,255,0.04) 50%, var(--bg-card) 70%); background-size: 200% 100%; animation: skeletonShimmer 1.5s ease infinite; border-radius: var(--card-radius) var(--card-radius) 0 0; z-index: 1; }
@keyframes skeletonShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── RIPPLE THEME TRANSITION ────────────────────────── */
.theme-ripple { position: fixed; border-radius: 50%; z-index: 9999; pointer-events: none; animation: rippleExpand 0.6s ease-out forwards; }
@keyframes rippleExpand { 0% { transform: scale(0); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }

/* ─── BOOK OF THE DAY ────────────────────────────────── */
.book-of-day-section { padding: 60px 0; background: var(--bg); }
.book-of-day-card { display: flex; gap: 32px; align-items: center; padding: 32px; border-radius: var(--card-radius); background: linear-gradient(135deg, var(--bg-card) 0%, rgba(201,169,110,0.06) 100%); border: 1px solid rgba(201,169,110,0.2); cursor: pointer; transition: all 0.4s var(--ease-out); }
.book-of-day-card:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: 0 16px 48px rgba(201,169,110,0.12); }
.book-of-day-cover { width: 140px; height: 190px; object-fit: cover; border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); flex-shrink: 0; }
.book-of-day-info { flex: 1; }
.book-of-day-tag { display: inline-block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); background: var(--accent-dim); padding: 4px 12px; border-radius: 100px; margin-bottom: 12px; }
.book-of-day-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: #fff; margin-bottom: 6px; }
.book-of-day-author { font-size: 0.95rem; color: var(--text-secondary); margin-bottom: 12px; }
.book-of-day-desc { font-size: 0.88rem; color: var(--text-muted); line-height: 1.6; max-width: 500px; }
@media (max-width: 600px) { .book-of-day-card { flex-direction: column; text-align: center; } .book-of-day-desc { max-width: none; } }

/* ─── BOOK QUOTES IN MODAL ──────────────────────────── */
.modal-book-quotes { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.modal-book-quotes-title { font-family: var(--font-display); font-size: 0.9rem; font-weight: 600; color: var(--accent); margin-bottom: 10px; }
.modal-book-quote-item { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.6; padding: 10px 14px; border-left: 2px solid var(--accent-dim); margin-bottom: 8px; font-style: italic; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: rgba(201,169,110,0.03); }

/* ─── BACK TO TOP ────────────────────────────────────── */
.btn-back-top { position: fixed; bottom: 28px; right: 28px; z-index: 140; width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #0a0a0f; border: none; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 20px rgba(201,169,110,0.3); opacity: 0; visibility: hidden; transform: translateY(16px); transition: all 0.35s var(--ease-out); }
.btn-back-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.btn-back-top:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(201,169,110,0.4); }

/* ─── RSS FOOTER ────────────────────────────────────── */
.footer-rss { display: inline-flex; align-items: center; color: var(--text-secondary); transition: color 0.3s; }
.footer-rss:hover { color: var(--accent); }

/* ─── CUSTOM CURSOR FOR CLICKABLES ───────────────────── */
a, button, select, input, .book-card, .timeline-item, .chapter-item {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='28' viewBox='0 0 20 28'%3E%3Cpath d='M4 1L3 22l3-4 3 8 2-1-3-8h4L4 1z' fill='%23fffbe6' stroke='%230a0a0f' stroke-width='1'/%3E%3C/svg%3E") 4 1, pointer;
}

/* ─── ACCESSIBILITY ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .splash-overlay { display: none !important; }
    .hero-smoke, .hero-smoke-2, .particles-canvas { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE AUDIT FIX — min 12px font + no horizontal overflow
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* ── Prevent horizontal overflow ────────────────────── */
    html, body { overflow-x: hidden; max-width: 100vw; }
    .section-inner { max-width: 100%; overflow-x: hidden; }

    /* Timeline & shelves: contain within viewport */
    .timeline-scroll,
    .shelf-scroll { max-width: 100vw; -webkit-overflow-scrolling: touch; }
    .timeline-track { min-width: 0; }
    .timeline-item { min-width: 100px; }
    .timeline-item img { width: 70px; height: 94px; }

    /* Map: constrain to viewport */
    .map-container { max-width: calc(100vw - 40px); overflow: hidden; }

    /* Modal: prevent overflow */
    .modal-card { max-width: calc(100vw - 32px); }
    .modal-body { max-width: 100%; overflow: hidden; }

    /* ── Enforce minimum 12px (0.75rem) for all text ─── */
    /* Badges & labels */
    .book-badge-new { font-size: 0.75rem; }
    .modal-badge { font-size: 0.75rem; }
    .hero-badge { font-size: 0.75rem; }

    /* Book cards */
    .book-meta { font-size: 0.75rem; }
    .book-author { font-size: 0.875rem; }

    /* Shelf */
    .shelf-book-title { font-size: 0.75rem; }
    .shelf-book-author { font-size: 0.75rem; }
    .shelf-count { font-size: 0.75rem; }

    /* Timeline */
    .timeline-item-title { font-size: 0.75rem; }
    .timeline-year { font-size: 0.75rem; }

    /* Player */
    .player-time { font-size: 0.75rem; }
    .player-speed-btn { font-size: 0.75rem; }
    .mini-player-author { font-size: 0.75rem; }
    .mini-player-time { font-size: 0.75rem; }
    .mini-player-sleep { font-size: 0.75rem; }

    /* Modal */
    .meta-plays { font-size: 0.75rem; }
    .meta-item { font-size: 0.8rem; }
    .chapter-item { font-size: 0.78rem; }
    .chapter-num { font-size: 0.75rem; }

    /* Quote */
    .quote-source { font-size: 0.8rem; }

    /* Footer */
    .footer-copy { font-size: 0.8rem; }
    .footer-links a { font-size: 0.82rem; }

    /* Auth */
    .auth-error { font-size: 0.82rem; }

    /* Misc */
    .hero-stat-label { font-size: 0.78rem; }
    .sort-select { font-size: 0.82rem; }
    .toast { font-size: 0.82rem; }
    .author-bio-works a { font-size: 0.75rem; }
    .author-bio-text { font-size: 0.82rem; }
    .author-bio-years { font-size: 0.82rem; }
    .sleep-timer-menu button { font-size: 0.8rem; }
    .btn-random { font-size: 0.82rem; }
    .map-tooltip { font-size: 0.8rem; }
    .stat-label { font-size: 0.82rem; }
    .chapters-toggle { font-size: 0.82rem; }

    /* Buttons: ensure tap-friendly sizes */
    .btn { font-size: 0.9rem; padding: 12px 24px; }
    .btn-download,
    .btn-preview { font-size: 0.88rem; }

    /* Tap targets: minimum 44px */
    .book-fav-btn { width: 44px; height: 44px; }
    .view-toggle, .fav-filter-btn { width: 44px; height: 44px; }
    .modal-close { width: 44px; height: 44px; }
    .mini-player-close { min-width: 44px; min-height: 44px; }
}

/* ═══════════════════════════════════════════════════════════
   PREFERS-COLOR-SCHEME: LIGHT — auto sepia for light OS
   ═══════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: light) {
    :root:not(.dark-forced) {
        --bg: #f5e6c8; --bg-raised: #ede0c8; --bg-card: #e8d5b0;
        --bg-card-hover: #dcc9a0; --surface: #e0d0b0;
        --border: rgba(0,0,0,0.1); --border-hover: rgba(0,0,0,0.18);
        --text: #2a1f0e; --text-secondary: #5c4a2e; --text-muted: #8a7a5a;
        --accent: #8b6914; --accent-light: #a07a1a;
        --accent-dim: rgba(139,105,20,0.12); --accent-glow: rgba(139,105,20,0.2);
    }
}

/* ═══════════════════════════════════════════════════════════
   EXTRA BREAKPOINTS
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 320px) {
    .books-grid { grid-template-columns: repeat(auto-fill, 140px); gap: 8px; }
    .section-inner { padding: 0 12px; }
    .hero-content { padding: 0 8px; }
    .nav-inner { padding: 0 16px; }
    .search-bar { padding: 10px 16px; }
    .shelf-book { width: 100px; }
    .shelf-book img { width: 100px; height: 134px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .books-grid { grid-template-columns: repeat(auto-fill, 180px); }
    .about-inner { gap: 40px; }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════ */
@media print {
    #main-nav, .mini-player, .modal-overlay, .auth-gate,
    .splash-overlay, .particles-canvas, .hero-smoke,
    .hero-smoke-2, .btn-back-top, .toast { display: none !important; }
    body { background: #fff; color: #000; }
    .book-card { break-inside: avoid; }
}

/* ─── PÁGINAS DIRECTAS DE OBRA ────────────────────────── */
.book-page { min-height: 100vh; display: flex; flex-direction: column; }
.book-page-nav { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.book-page-brand { font-family: var(--font-display); color: var(--accent); font-size: 1.25rem; font-weight: 700; }
.book-page-back { color: var(--text-secondary); font-size: 0.92rem; }
.book-page-back:hover { color: var(--accent-light); }
.book-page-main { width: min(1120px, calc(100% - 48px)); margin: auto; padding: 44px 0 72px; }
.book-page-card { display: grid; grid-template-columns: minmax(210px, 320px) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); align-items: center; padding: clamp(24px, 5vw, 64px); background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28); }
.book-page-cover { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--radius-sm); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38); }
.book-page-content { min-width: 0; }
.book-page-kicker { margin: 12px 0 6px; color: var(--accent); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.book-page-status { display: inline-block; padding: 4px 9px; color: var(--success); background: rgba(92, 184, 138, 0.12); border: 1px solid rgba(92, 184, 138, 0.22); border-radius: 999px; font-size: 0.77rem; font-weight: 600; }
.book-page-content h1 { max-width: 17ch; font-family: var(--font-display); font-size: clamp(2.1rem, 5vw, 4.4rem); line-height: 1.05; font-weight: 600; }
.book-page-author { margin-top: 14px; color: var(--text-secondary); font-family: var(--font-display); font-size: 1.22rem; }
.book-page-description { max-width: 66ch; margin-top: 28px; color: var(--text-secondary); font-size: 1rem; }
.book-page-details { display: flex; flex-wrap: wrap; gap: 18px 36px; margin-top: 28px; }
.book-page-details dt { color: var(--text-muted); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.book-page-details dd { margin-top: 2px; color: var(--text); font-size: 0.95rem; }
.book-page-details dd a { color: var(--accent-light); }
.book-page-details dd a:hover { text-decoration: underline; }
.book-page-listen { display: inline-flex; margin-top: 34px; color: #17120a; background: var(--accent); font-weight: 700; }
.book-page-listen:hover { background: var(--accent-light); }
.book-page-preview { margin-top: 24px; }
.book-page-preview .book-page-kicker { margin-bottom: 8px; }
.book-page-preview audio { width: min(100%, 440px); height: 40px; }
.book-page-preview-unavailable { margin-top: 24px; color: var(--text-muted); font-size: 0.9rem; }
.book-page-footer { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0 34px; color: var(--text-muted); font-size: 0.8rem; border-top: 1px solid var(--border); }
.modal-author-link { cursor: pointer; }
.modal-author-link:hover, .modal-author-link:focus-visible { color: var(--accent); outline: none; }
.author-page { min-height: 100vh; display: flex; flex-direction: column; }
.author-page-main { width: min(1120px, calc(100% - 48px)); margin: auto; padding: 42px 0 72px; }
.author-page-main h1 { font-family: var(--font-display); font-size: clamp(2.4rem, 6vw, 5rem); line-height: 1.05; }
.author-page-count { margin-top: 14px; color: var(--text-secondary); }
.author-page-works { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-top: 38px; }
.author-page-work { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 16px; align-items: center; padding: 14px; background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.author-page-work:hover { border-color: var(--border-hover); background: var(--bg-card); }
.author-page-work img { width: 82px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 5px; }
.author-page-work h2 { font-family: var(--font-display); font-size: 1.16rem; line-height: 1.2; }
.author-page-work h2 a:hover { color: var(--accent-light); }
.author-page-work p:last-child { margin-top: 5px; color: var(--text-secondary); font-size: 0.85rem; }

@media (max-width: 640px) {
    .book-page-nav, .book-page-main, .book-page-footer { width: min(100% - 32px, 1120px); }
    .book-page-nav { padding: 20px 0; }
    .book-page-card { grid-template-columns: 1fr; padding: 24px; }
    .book-page-cover { width: min(230px, 70%); }
    .book-page-main { padding: 20px 0 48px; }
    .book-page-content h1 { max-width: none; }
    .author-page-main { width: min(100% - 32px, 1120px); padding: 20px 0 48px; }
}
