html, body { margin:0; padding:0; background:#EFEDE7; }
* { box-sizing:border-box; }
body { color:#111; font-family:'Sono', ui-monospace, monospace; overflow-x:hidden; }
a { color:#111; text-decoration:none; border-bottom:1px solid #11111155; }
a:hover { color:#A8502B; border-bottom-color:#A8502B; }
img { max-width:100%; }
button { font-family:'Sono', monospace; }
::selection { background:#A8502B; color:#EFEDE7; }
:focus-visible { outline:2px solid #A8502B; outline-offset:3px; }

@keyframes bookmarquee { from { transform:translateX(0); } to { transform:translateX(-50%); } }
@keyframes bookfloat { 0%,100% { transform:translateY(0) rotate(-2deg); } 50% { transform:translateY(-12px) rotate(-1deg); } }
@keyframes bookfloat2 { 0%,100% { transform:translateY(-6px) rotate(2deg); } 50% { transform:translateY(6px) rotate(1deg); } }
@keyframes bookspin { from { transform:rotate(0deg); } to { transform:rotate(360deg); } }
@keyframes bksway { 0%,100% { transform:rotate(-1.1deg); } 50% { transform:rotate(1.1deg); } }

.grain { position:absolute; inset:0; z-index:1; pointer-events:none; background-image:url(assets/grain.png); background-repeat:repeat; }
.wrap { position:relative; z-index:2; }

.btn-dark { border:0; background:#111; color:#EFEDE7; cursor:pointer; }
.btn-dark:hover { background:#A8502B; color:#EFEDE7; }
.btn-light { border:0; background:#EFEDE7; color:#111; cursor:pointer; }
.btn-light:hover { background:#A8502B; color:#EFEDE7; }
.btn-line { background:transparent; border:1px solid #111; cursor:pointer; color:#111; }
.btn-line:hover { background:#111; color:#EFEDE7; }
.btn-dark:disabled { opacity:.55; cursor:wait; }

/* tarjetas del índice */
.card { border:0; display:block; flex:0 1 calc((100% - 72px) / 4); min-width:200px; max-width:340px; }
.card .ph { position:relative; overflow:hidden; }
.bk-hang { transform-origin:50% 3%; animation:bksway 7s ease-in-out infinite; width:100%; display:block; }
.card:hover .bk-hang { animation-play-state:paused; }

/* capítulos */
.chapter { scroll-margin-top:80px; margin-bottom:56px; }
.spread { position:relative; border-radius:3px 10px 10px 3px; overflow:hidden; box-shadow:0 40px 70px -28px #00000090, inset -6px 0 0 #00000030; background:#111; }
.spread-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(230px, 1fr)); }
.page-left { position:relative; overflow:hidden; padding:clamp(24px,5vw,42px) clamp(20px,4vw,34px); display:flex; flex-direction:column; justify-content:center; gap:14px; min-height:300px; }
.bk-photo { position:relative; min-height:300px; overflow:hidden; }
.bk-persp { position:relative; width:100%; aspect-ratio:4/5; perspective:1600px; }
.bk-sway { position:absolute; inset:0; transform-origin:50% 3%; animation:bksway 7s ease-in-out infinite; }
.bk-photo:hover .bk-sway { animation-play-state:paused; }
.bk-card3d { position:absolute; inset:0; transform-style:preserve-3d; transition:transform .9s cubic-bezier(.45,.05,.25,1); }
.bk-card3d.is-back { transform:rotateY(180deg); }
.bk-face { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; backface-visibility:hidden; -webkit-backface-visibility:hidden; filter:drop-shadow(0 18px 22px #00000055); }
.bk-face.back { transform:rotateY(180deg); }
.bk-tag { position:absolute; left:8px; top:0; z-index:4; display:flex; flex-direction:column; align-items:center; transform-origin:50% 0; pointer-events:none; transform:translateY(-58%) rotate(-5deg); transition:transform .45s cubic-bezier(.34,1.4,.5,1); }
.bk-photo:hover .bk-tag, .bk-photo:focus-within .bk-tag { transform:translateY(0) rotate(-8deg); }
.tag-paper { position:relative; width:58px; background:#EFEDE7f2; color:#111; padding:9px 5px 6px; clip-path:polygon(18% 0, 82% 0, 100% 11%, 100% 100%, 0 100%, 0 11%); box-shadow:0 6px 10px -6px #00000080; text-align:center; }
.flip-btn { position:absolute; bottom:10px; left:10px; height:28px; padding:0 11px; border-radius:14px; background:#00000070; border:0; cursor:pointer; display:flex; align-items:center; gap:5px; color:#EFEDE7; opacity:.75; font-size:9px; letter-spacing:.14em; text-transform:uppercase; z-index:5; }
.flip-btn:hover { background:#A8502B; opacity:1; }
.zoom-btn { position:absolute; bottom:10px; right:10px; width:32px; height:32px; border-radius:50%; background:#00000070; border:0; cursor:pointer; display:flex; align-items:center; justify-content:center; z-index:5; }
.zoom-btn:hover { background:#A8502B; }
.size-btn { min-width:44px; min-height:42px; padding:0 11px; border:1px solid #EFEDE7; cursor:pointer; font-size:11px; letter-spacing:.14em; text-transform:uppercase; background:transparent; color:#EFEDE7; }
.size-btn[aria-pressed="true"] { background:#EFEDE7; color:#111; }

/* overlays */
.overlay { position:fixed; inset:0; z-index:90; display:none; }
.overlay.open { display:flex; }
.drawer { position:relative; width:min(400px,100%); background:#EFEDE7; height:100%; padding:20px; display:flex; flex-direction:column; gap:18px; border-left:1px solid #111; margin-left:auto; }
.field { width:100%; min-height:48px; background:transparent; border:1px solid #111; color:#111; padding:0 14px; font-family:'Sono',monospace; font-size:13px; border-radius:0; }
select.field { appearance:none; background-image:linear-gradient(45deg,transparent 50%,#111 50%),linear-gradient(135deg,#111 50%,transparent 50%); background-position:calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size:5px 5px; background-repeat:no-repeat; }
.lbl { font-size:10px; letter-spacing:.3em; text-transform:uppercase; color:#5f5c55; margin-bottom:10px; display:block; }
.form-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)); gap:10px; }
.form-grid .full { grid-column:1 / -1; }
.checkout-grid { display:grid; grid-template-columns:1.4fr 1fr; gap:44px; align-items:start; }
@media (max-width: 760px) { .checkout-grid { grid-template-columns:1fr; } }
.deliv { display:flex; gap:12px; align-items:flex-start; border:1px solid #111; padding:14px; cursor:pointer; font-size:12.5px; line-height:1.5; }
.deliv small { color:#5f5c55; font-size:11px; }
.deliv input { accent-color:#A8502B; width:18px; height:18px; margin-top:2px; flex:none; }
.deliv:has(input:checked) { background:#111; color:#EFEDE7; }
.deliv:has(input:checked) small { color:#EFEDE7c0; }
.err { color:#9b2c1a; font-size:12px; min-height:16px; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

/* mini libro */
.mb-leaf { position:absolute; inset:0; z-index:3; transform-style:preserve-3d; transition:transform .55s cubic-bezier(.61,.06,.4,.99); }
.mb-face { position:absolute; inset:0; backface-visibility:hidden; display:flex; align-items:center; justify-content:center; }
.mb-face img { width:100%; height:100%; object-fit:contain; }

@media (prefers-reduced-motion: reduce) {
  .bk-tag, .bk-card3d, .mb-leaf { transition:none; }
  .bk-sway, .bk-hang, [data-anim] { animation:none !important; }
}
