/* CÓDEX • Interfaz adaptable • sin scroll en la pantalla principal */
:root{color-scheme:dark;--light:#edf5ff;--blue:#3cc5ff;--muted:#adc6d9;--ink:#030a16}
*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;overflow:hidden}
body{background:#030a14;color:var(--light);font-family:Georgia,'Times New Roman',serif;-webkit-font-smoothing:antialiased}
button,a{-webkit-tap-highlight-color:transparent}
button{font:inherit;color:inherit;cursor:pointer}
button:focus-visible,a:focus-visible{outline:2px solid #91e3ff;outline-offset:2px}
[hidden]{display:none!important}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
.app-shell{position:relative;isolation:isolate;width:100%;height:100vh;height:100dvh;min-height:320px;overflow:hidden;background:#030a16}
.scenery{
  position:absolute;
  inset:0;
  z-index:-4;
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center;
  pointer-events:none;
}
.scenery-shadow{position:absolute;inset:0;z-index:-3;pointer-events:none;background:linear-gradient(180deg,rgba(1,5,14,.24),rgba(0,5,15,.10) 45%,rgba(2,8,19,.05) 65%,rgba(0,3,10,.55)),radial-gradient(ellipse 47% 38% at 50% 20%,#01091499,transparent 100%)}
.mist{position:absolute;left:-20%;bottom:-19%;width:140%;height:38%;z-index:-2;pointer-events:none;opacity:.28;filter:blur(24px);background:radial-gradient(ellipse at 30% 80%,#57b4ff7a,transparent 39%),radial-gradient(ellipse at 73% 70%,#217dce7a,transparent 44%);animation:fogdrift 18s ease-in-out infinite alternate}
.mist-two{bottom:-24%;opacity:.13;animation-duration:24s;animation-direction:alternate-reverse}
@keyframes fogdrift{from{transform:translateX(-3%) scale(1)}to{transform:translateX(3%) scale(1.05)}}
.masthead{position:absolute;inset:0 0 auto;z-index:6;text-align:center;pointer-events:none}
.brand{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;pointer-events:none}
.brand-logo{display:block;height:clamp(105px,21vh,220px);width:auto;max-width:58vw;object-fit:contain;filter:drop-shadow(0 0 13px #036abb44);user-select:none}
.brand h1{margin:-.6vh 0 0;font-size:clamp(12px,1.47vw,22px);font-weight:500;letter-spacing:.055em;white-space:nowrap;text-shadow:0 2px 8px #000,0 0 10px #13395d}
.brand p{margin:7px 6px 0;color:#e3e7f2;font-size:clamp(10px,1.05vw,16px);line-height:1.25;text-shadow:0 2px 7px #000}
/* Cuadro hamburguesa del mismo formato que Biblioteca */
.hamburger{position:absolute;right:clamp(12px,1.8vw,36px);top:clamp(10px,1.5vh,25px);pointer-events:auto;z-index:8;display:grid;place-items:center;width:clamp(62px,6.6vw,94px);aspect-ratio:1;background:url('../img/codex-menu-button.png') center/100% 100% no-repeat;border:0;padding:14px;filter:drop-shadow(0 0 10px #000b);transition:transform .2s,filter .2s}
.hamburger svg{width:54%;height:54%;min-width:25px;min-height:25px;filter:drop-shadow(0 0 5px #18b4ff)}
.hamburger:hover,.hamburger[aria-expanded=true]{transform:translateY(-2px);filter:drop-shadow(0 0 12px #159dff)}
.stage{position:absolute;inset:0;pointer-events:none}
.book-stage{position:absolute;inset:0;pointer-events:none}
/* Estantería preparada para añadir cuantos libros se necesiten */
.book-carousel{position:absolute;left:50%;top:34.2%;transform:translateX(-50%);width:min(78vw,1210px);height:32%;z-index:3;display:flex;justify-content:center;align-items:center;pointer-events:none}
.book-shelf{--visible:3;display:flex;justify-content:center;align-items:flex-end;gap:clamp(12px,2.1vw,33px);height:100%;width:min(70%,830px);pointer-events:auto}
.book-tile{position:relative;display:block;height:100%;width:auto;aspect-ratio:2/3;min-width:0;padding:0;border:0;background:none;flex:none;filter:drop-shadow(6px 10px 9px #000b);transform:translateY(0);transform-origin:center bottom;transition:transform .25s ease,filter .25s ease}
.book-tile:hover,.book-tile:focus-visible{transform:translateY(-8px) scale(1.025);filter:drop-shadow(0 0 16px #19a9f399) drop-shadow(6px 10px 8px #000d)}
.book-visual{display:block;width:100%;height:100%;position:relative;overflow:hidden;border:2px solid #9e824a;border-left:4px solid #343740;border-radius:3px;background:#0a1524;box-shadow:inset 0 0 10px #000a,1px 1px 3px #eecb7a55}
.book-visual img{display:block;width:100%;height:100%;object-fit:cover}
.book-visual:after{content:'';position:absolute;inset:0;pointer-events:none;background:linear-gradient(95deg,#ffffff20,transparent 10%,transparent 83%,#0000004d)}
.carousel-arrow{position:absolute;top:50%;transform:translateY(-50%);z-index:2;display:grid;place-items:center;width:clamp(42px,4.1vw,59px);height:clamp(42px,4.1vw,59px);border:0;border-radius:50%;background:radial-gradient(circle,#0a3552cc,#030d20c9 73%);color:#71daff;box-shadow:0 0 0 1px #46b9ff88,inset 0 0 12px #098ce44d;pointer-events:auto;transition:filter .2s}
.carousel-arrow svg{height:50%;width:50%;filter:drop-shadow(0 0 4px #1caaff)}
.carousel-prev{left:2%}.carousel-next{right:2%}
.carousel-arrow:hover:not(:disabled){filter:drop-shadow(0 0 12px #36bfff)}
.carousel-arrow:disabled{opacity:.24;cursor:default}
.carousel-dots{position:absolute;bottom:-23px;left:50%;transform:translateX(-50%);display:flex;gap:8px;pointer-events:auto}
.carousel-dot{height:8px;width:8px;padding:0;border-radius:50%;border:1px solid #80caf7aa;background:#72818f;transition:background .2s,box-shadow .2s}
.carousel-dot.selected{background:#47caff;box-shadow:0 0 9px #0cb9ff}
/* Los seis controles ocupan toda la franja inferior, con separaciones proporcionadas */
.nav-tiles{position:absolute;bottom:11%;left:50%;transform:translateX(-50%);width:min(84vw,1440px);display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:clamp(4px,1.1vw,22px);align-items:center;justify-items:center;pointer-events:auto;z-index:4}
.nav-tile{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:clamp(2px,.3vw,7px);width:min(100%,155px);aspect-ratio:1.1;min-width:0;padding:11% 7%;border:0;background:url('../img/codex-menu-button.png') center/100% 100% no-repeat;text-shadow:0 2px 6px #000;transition:transform .2s,filter .2s}
.nav-tile svg{width:clamp(21px,2.3vw,34px);height:clamp(21px,2.3vw,34px);flex:none;filter:drop-shadow(0 1px 3px #000)}
.nav-tile span{max-width:96%;font-size:clamp(10px,1vw,17px);line-height:1.1;text-align:center;overflow-wrap:break-word}
.nav-tile:hover,.nav-tile:focus-visible{transform:translateY(-5px);filter:drop-shadow(0 0 10px #10a7ff)}
.nav-tile.active{filter:drop-shadow(0 0 7px #0f9cdb)}
.site-footer{position:absolute;z-index:4;bottom:1.2%;left:50%;transform:translateX(-50%);width:min(77vw,1150px);height:clamp(40px,7.5vh,73px);display:flex;justify-content:center;align-items:center;gap:clamp(5px,1vw,15px)}
.rule{flex:1;height:1px;opacity:.65;background:linear-gradient(to right,transparent,#c1e8ff,#7eabda,transparent)}
.social-links{height:100%;width:clamp(310px,36vw,540px);max-width:85%;padding:7px clamp(28px,4.1vw,66px);display:flex;align-items:center;justify-content:space-evenly;gap:12px;background:url('../img/codex-button.png') center/100% 100% no-repeat}
.social-link{width:clamp(26px,2.5vw,38px);height:clamp(26px,2.5vw,38px);flex:none;display:grid;place-items:center;text-decoration:none;color:#e5f7ff;transition:transform .2s,color .2s,filter .2s}
.social-link svg{width:85%;height:85%;fill:currentColor}
.social-link:hover{color:#69ceff;transform:translateY(-3px);filter:drop-shadow(0 0 8px #20bafa)}
/* MENÚ real desplegable: esquina superior derecha, sin oscurecer la página */
.menu-scrim{position:fixed;inset:0;z-index:7;background:transparent;pointer-events:auto}
.side-menu{position:fixed;z-index:9;top:clamp(80px,9.5vh,124px);right:clamp(10px,1.8vw,35px);width:min(342px,calc(100vw - 20px));max-height:min(72vh,655px);max-height:min(72dvh,655px);padding:17px 18px;display:flex;flex-direction:column;background:linear-gradient(155deg,rgba(11,26,44,.96),rgba(1,6,17,.965));border:1px solid #4b9cca;border-radius:12px;box-shadow:0 10px 40px #000d,0 0 18px #1777bc44;overflow-y:auto;overscroll-behavior:contain;visibility:hidden;opacity:0;transform:translateY(-8px) scale(.98);transform-origin:top right;pointer-events:none;transition:opacity .18s,transform .18s,visibility .18s}
.side-menu.open{visibility:visible;opacity:1;transform:translateY(0) scale(1);pointer-events:auto}
.menu-header{display:flex;justify-content:space-between;align-items:center;min-height:37px}
.menu-heading{font-size:19px;letter-spacing:.15em;font-weight:600}
.icon-btn,.modal-close{display:grid;place-items:center;border:1px solid #4ea7dd;background:linear-gradient(#102d48,#030d18);color:#ecf7ff;border-radius:9px;padding:0;line-height:1;box-shadow:inset 0 0 8px #1c8bd433}
.icon-btn{height:33px;width:33px}
.icon-btn svg,.modal-close svg{display:block;width:60%;height:60%}
.menu-divider{height:1px;margin:12px 0;background:linear-gradient(90deg,transparent,#2ba3e1,transparent)}
.language-title{margin:0 0 10px;font-size:14px;font-weight:500}
.language-toggle{display:flex;gap:8px}
.language-btn{flex:1;min-width:0;min-height:40px;border:1px solid #3c789e;border-radius:7px;background:#0a1c2e;color:#e0ebf5;font:600 13px system-ui,sans-serif}
.language-btn[aria-pressed=true]{border-color:#53c7ff;background:linear-gradient(120deg,#175384,#07263d);box-shadow:inset 0 0 8px #268edc4d}
.menu-nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
.menu-nav button{display:flex;align-items:center;gap:7px;min-height:42px;padding:7px;border:1px solid #275777;border-radius:7px;background:#10253ab5;text-align:left;font-size:12px;line-height:1.15}
.menu-nav button:hover{background:#16466a}
.menu-nav svg{height:19px;width:19px;flex:none;color:#72d4ff}
/* Fichas de los libros */
.codex-modal{position:fixed;inset:0;margin:auto;z-index:20;width:min(960px,94vw);max-width:none;max-height:89vh;max-height:89dvh;padding:0;overflow:hidden;background:linear-gradient(145deg,rgba(6,16,30,.96),rgba(1,5,13,.95));border:1px solid #329cd8;border-radius:15px;color:#edf7ff;box-shadow:0 0 0 1px #9ad5ff66,0 15px 90px #000,0 0 24px #0e78ba33}
.codex-modal::backdrop{background:#020710cb;backdrop-filter:blur(5px)}
.codex-modal:before{content:'';position:absolute;inset:5px;border:1px solid #477eac44;border-radius:11px;pointer-events:none}
.modal-close{position:absolute;z-index:4;right:clamp(12px,2vw,19px);top:clamp(12px,2vw,19px);height:40px;width:40px}
.modal-content{max-height:89vh;max-height:89dvh;overflow-y:auto;overscroll-behavior:contain;padding:clamp(23px,3vw,34px);scrollbar-color:#2f8eb7 #081426}
.modal-book{display:grid;grid-template-columns:minmax(150px,30%) minmax(0,1fr);grid-template-areas:'cover info' 'cover buy';align-items:start;column-gap:clamp(22px,3.1vw,38px);row-gap:12px}
.modal-cover{grid-area:cover;display:flex;justify-content:center;align-self:stretch;align-items:flex-start}
.modal-book-img{display:block;width:100%;height:auto;max-height:min(65vh,520px);max-height:min(65dvh,520px);object-fit:contain;filter:drop-shadow(10px 12px 14px #000)}
.modal-info{grid-area:info;min-width:0;padding-right:38px}
.eyebrow{margin:0 0 9px;color:#75d4ff;font:600 11px system-ui,sans-serif;letter-spacing:.15em;text-transform:uppercase}
.modal-info h2,.section-modal h2{margin:0 0 10px;font-size:clamp(25px,2.8vw,39px);line-height:1.1;color:#f3f8ff;text-shadow:0 0 11px #0b659055}
.modal-subtitle{margin:0 0 13px!important;color:#d5bb82!important;font:italic clamp(14px,1.3vw,17px)/1.4 Georgia,serif!important}
.modal-info p,.section-modal p{margin:0 0 12px;color:#c4d2e2;line-height:1.55;font-size:clamp(13px,1.15vw,16px)}
.buy-container{grid-area:buy;min-width:0;align-self:start}
.buy-heading{margin:5px 0 9px;color:#acd7f0;font:700 12px system-ui,sans-serif;letter-spacing:.095em;text-transform:uppercase}
.buy-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:clamp(8px,1vw,15px)}
.buy-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;width:100%;min-width:0;aspect-ratio:1.18;min-height:100px;max-height:145px;padding:10% 9%;border:0;text-align:center;color:#f0f9ff;text-decoration:none;background:url('../img/codex-menu-button.png') center/100% 100% no-repeat;transition:transform .2s,filter .2s}
.buy-btn svg{width:clamp(23px,2.2vw,31px);height:clamp(23px,2.2vw,31px);flex:none}
.buy-btn span{font:600 clamp(11px,1.05vw,15px)/1.15 system-ui,sans-serif;overflow-wrap:break-word}
.buy-btn small{font:600 10px system-ui,sans-serif;color:#8bcbf1}
.buy-btn:hover:not(.disabled){transform:translateY(-4px);filter:drop-shadow(0 0 10px #12b7ff)}
.buy-btn.disabled{cursor:default;opacity:.65;filter:grayscale(.28)}
.modal-disclaimer{font:11px/1.45 system-ui,sans-serif!important;color:#9bb3c8!important;margin:10px 0 0!important}
.section-modal{padding:4px 0}
.section-modal h2{margin:4px 40px 15px 0}
.section-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:18px}
.section-card{display:flex;flex-direction:column;gap:10px;align-items:flex-start;min-height:120px;padding:18px;background:#0b2035;border:1px solid #3b769e;border-radius:10px;text-align:left}
.section-card:hover{border-color:#77d4ff;background:#153452}
.section-card svg{width:28px;height:28px;color:#6bd0ff}
.section-card strong{font-size:16px}
.section-card span{font:13px/1.4 system-ui,sans-serif;color:#b1c7d7}
.mini-book-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:18px}
.mini-book{min-width:0;display:flex;flex-direction:column;align-items:center;gap:9px;padding:12px 10px;min-height:180px;border:1px solid #356e96;border-radius:9px;background:#071828;text-align:center}
.mini-book:hover{border-color:#57c9ff}
.mini-book img{display:block;height:clamp(100px,19vh,165px);max-width:100%;aspect-ratio:2/3;object-fit:contain}
.mini-book strong{font:600 13px/1.25 system-ui,sans-serif}
.status-pill{color:#89d9ff;font:600 11px system-ui,sans-serif}
/* Tablet horizontal / pantallas compactas */
@media(max-width:1100px){
 .brand-logo{height:clamp(100px,18vh,173px)}
 .book-carousel{top:33.5%;height:30.5%;width:92vw}
 .book-shelf{width:75%;gap:clamp(11px,2vw,24px)}
 .nav-tiles{width:92vw;gap:clamp(4px,.65vw,12px)}
 .nav-tile{width:min(100%,130px)}
 .nav-tile svg{width:clamp(21px,2.6vw,30px);height:clamp(21px,2.6vw,30px)}
 .nav-tile span{font-size:clamp(10px,1.23vw,14px)}
 .site-footer{width:88vw}
}
/* Tablet vertical */
@media(max-width:900px) and (orientation:portrait){
 .scenery{background-size:auto 100%;background-position:center}
 .scenery:before,.scenery:after{content:'';position:absolute;top:11%;width:28%;height:57%;background:url('../img/codex-background.png') left center/auto 100% no-repeat;opacity:.86;pointer-events:none}
 .scenery:before{left:0;-webkit-mask-image:linear-gradient(to right,#000,transparent);mask-image:linear-gradient(to right,#000,transparent)}
 .scenery:after{right:0;background-position:right center;-webkit-mask-image:linear-gradient(to left,#000,transparent);mask-image:linear-gradient(to left,#000,transparent)}
 .book-carousel{top:33%;height:28%}
 .nav-tiles{bottom:11%;width:94vw;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px 12px;max-width:650px}
 .nav-tile{width:min(100%,128px);aspect-ratio:1.1}
 .site-footer{bottom:1%;height:6.6%}
}
/* Teléfono vertical */
@media(max-width:600px) and (orientation:portrait){
 .brand-logo{height:clamp(92px,16vh,140px);max-width:72vw}
 .brand h1{max-width:93vw;margin:-4px 0 0;white-space:normal;font-size:clamp(10px,2.65vw,14px)}
 .brand p{max-width:80vw;margin-top:5px;font-size:clamp(9px,2.3vw,11px);line-height:1.35}
 .hamburger{top:9px;right:9px;width:clamp(51px,13vw,63px);padding:11px}
 .hamburger svg{width:50%;height:50%;min-width:20px;min-height:20px}
 .book-carousel{top:26.5%;height:28.2%;width:100vw} 
 .book-shelf{width:82%;gap:clamp(8px,2.8vw,14px)}
 .book-tile{height:auto;max-height:100%;max-width:calc((100% - 24px)/var(--visible));aspect-ratio:2/3}
 .carousel-arrow{width:29px;height:29px;top:52%}
 .carousel-prev{left:2px}.carousel-next{right:2px}
 .carousel-dots{bottom:-15px}
 .nav-tiles{bottom:11.4%;width:94vw;max-width:440px;grid-template-columns:repeat(3,minmax(0,1fr));gap:1px 5px}
 .nav-tile{width:min(100%,clamp(88px,28vw,119px));aspect-ratio:1.12;padding:10px 8px;gap:2px}
 .nav-tile svg{width:clamp(22px,6vw,27px);height:clamp(22px,6vw,27px)}
 .nav-tile span{font-size:clamp(10px,2.8vw,12px);line-height:1.05}
 .site-footer{bottom:1%;width:96vw;height:6.7%;min-height:37px;gap:3px}
 .social-links{width:min(76vw,350px);max-width:none;padding:5px 29px;gap:14px}
 .social-link{width:27px;height:27px}
 .menu-scrim{background:transparent}
 .side-menu{right:8px;top:clamp(65px,8.5vh,88px);max-height:74dvh;width:min(315px,calc(100vw - 16px));padding:13px}
 .modal-content{padding:17px 15px}
 .modal-book{grid-template-columns:minmax(100px,35%) minmax(0,1fr);column-gap:13px;row-gap:6px;grid-template-areas:'cover info' 'buy buy'}
 .modal-info{padding-right:35px}
 .modal-book-img{max-height:33dvh}
 .modal-info h2{font-size:clamp(18px,4.7vw,25px);margin-bottom:7px}
 .modal-info .eyebrow{font-size:10px;margin-bottom:4px}
 .modal-info .modal-subtitle{font-size:clamp(11px,2.8vw,13px)!important;margin-bottom:8px!important}
 .modal-info p{font-size:clamp(11px,2.9vw,13px);line-height:1.44}
 .buy-heading{margin:3px 0 5px;font-size:10px}
 .buy-options{gap:5px}
 .buy-btn{aspect-ratio:1.14;min-height:0;max-height:117px;padding:9% 7%;gap:4px}
 .buy-btn svg{width:24px;height:24px}
 .buy-btn span{font-size:clamp(10px,2.8vw,12px)}
 .buy-btn small{font-size:9px}
 .modal-disclaimer{font-size:10px!important}
 .section-modal p{font-size:13px;line-height:1.45}
 .section-card{padding:12px;min-height:100px}
 .section-card strong{font-size:14px}
 .section-card span{font-size:11px}
 .mini-book-list{gap:6px}
 .mini-book{padding:8px 4px;min-height:140px}
 .mini-book img{height:110px}
 .mini-book strong{font-size:10px}
}
@media(max-height:660px) and (orientation:landscape){
 .brand-logo{height:clamp(65px,17vh,120px)}
 .brand h1{font-size:clamp(10px,1.4vw,16px)}
 .brand p{font-size:10px;margin-top:2px}
 .book-carousel{top:30%;height:33%}
 .nav-tiles{bottom:11%;width:88vw}
 .nav-tile{width:min(100%,13vh + 20px);aspect-ratio:1.05}
 .nav-tile svg{height:clamp(16px,3.5vh,24px);width:clamp(16px,3.5vh,24px)}
 .nav-tile span{font-size:clamp(9px,1vw,12px)}
 .site-footer{height:10%;bottom:0}
 .hamburger{width:clamp(45px,10vh,65px)}
}
@media(max-height:580px) and (orientation:portrait){
 .brand-logo{height:15vh}
 .brand p{display:none}
 .book-carousel{top:22%;height:29%}
 .nav-tiles{bottom:11%;gap:0}
 .nav-tile{width:min(100%,min(26vw,20vh));aspect-ratio:1.1}
 .nav-tile svg{width:18px;height:18px}
 .nav-tile span{font-size:9px}
 .site-footer{height:8%}
}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;transition-duration:.01ms!important}}
