@import url("https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=Libre+Caslon+Text:ital@0;1&family=Source+Serif+4:wght@500;600&display=swap");

:root {
  color-scheme: dark;
  --void: #110d0c;
  --surface: #161311;
  --surface-low: #1f1b19;
  --surface-high: #2e2927;
  --parchment: #eae1dd;
  --parchment-muted: #bbb3a3;
  --gold: #b1a071;
  --gold-soft: #93886b;
  --gold-highlight: #c1b593;
  --label: #9f9785;
  --hex-ink: #b0a58f;
  --hex-action: #b8ae98;
  --hex-action-hover: #c3b8a2;
  --sepia: #5c4033;
  --outline: #96917f;
  --outline-dim: #4b4738;
  font-family: "EB Garamond", Georgia, serif;
  background: var(--surface);
  color: var(--parchment);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--surface); scroll-behavior: smooth; }
html.exploring-library { scroll-snap-type: y mandatory; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 70% 6%, rgba(92, 64, 51, .14), transparent 30rem),
    radial-gradient(circle at 20% 65%, rgba(177, 160, 113, .025), transparent 32rem),
    var(--surface);
  color: var(--parchment);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button { font: inherit; color: inherit; }
button:focus-visible { outline: 1px solid var(--gold); outline-offset: 5px; }
::selection { background: rgba(177, 160, 113, .25); }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--outline-dim); }

.screen { min-height: 100svh; width: 100%; }
.is-hidden { display: none !important; }
.eyebrow {
  margin: 0 0 .9rem;
  color: var(--outline);
  font-family: "Source Serif 4", serif;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .32em;
  text-transform: uppercase;
}
.text-button, .primary-button, .secondary-button, .icon-button, .round-button {
  cursor: pointer;
}
.text-button {
  border: 0;
  border-bottom: 1px solid transparent;
  padding: .35rem 0;
  background: none;
  color: var(--outline);
  font-family: "Source Serif 4", serif;
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.text-button:hover { color: var(--gold); border-color: var(--gold); }
.primary-button, .secondary-button {
  position: relative;
  border: 0;
  border-radius: 2px;
  padding: .9rem .2rem .65rem;
  background: none;
  font-family: "Libre Caslon Text", serif;
  font-size: 1.05rem;
  letter-spacing: .08em;
}
.primary-button { color: var(--gold); }
.secondary-button { color: var(--parchment-muted); }
.primary-button::after, .secondary-button::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: .38rem;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, currentColor, transparent);
  transform: scaleX(.35);
  opacity: .6;
  transition: transform .7s cubic-bezier(.19, 1, .22, 1), opacity .4s;
}
.primary-button:hover::after, .secondary-button:hover::after { transform: scaleX(1); opacity: 1; }
.primary-button:hover, .secondary-button:hover { color: var(--gold-highlight); }
.primary-button span { padding-left: 1.4rem; }
.compact { padding-inline: .5rem; }
.round-button, .icon-button {
  border: 1px solid var(--outline-dim);
  background: rgba(31, 27, 25, .55);
  color: var(--parchment-muted);
  transition: border-color .35s, color .35s, background .35s;
}
.round-button:hover, .icon-button:hover { border-color: var(--gold-soft); color: var(--gold); background: var(--surface-low); }
.round-button { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 2px; font-size: 1rem; }
.icon-button { border-radius: 2px; padding: .65rem .8rem; font-family: "Source Serif 4", serif; font-size: .7rem; letter-spacing: .12em; }

/* Pórtico */
.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: max(5rem, env(safe-area-inset-top)) 1.5rem max(3rem, env(safe-area-inset-bottom));
  background: transparent;
}
.intro-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(8, 6, 5, .08) 0, rgba(8, 6, 5, .28) 42%, rgba(8, 6, 5, .9) 110%), linear-gradient(180deg, rgba(7, 5, 4, .24), transparent 22%, transparent 65%, rgba(7, 5, 4, .72));
}
.shared-descent {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #070605;
  perspective: 1000px;
  transition: opacity 1s ease, filter 1s ease;
}
body[data-screen="book"] .shared-descent { opacity: 0; filter: blur(5px); }
.descent-layers { position: absolute; inset: -5%; overflow: hidden; transform: translateZ(0); }
.descent-shot { position: absolute; inset: -8%; width: 116%; height: 116%; object-fit: cover; object-position: 50% 55%; opacity: 0; filter: brightness(.72) saturate(.74) sepia(.08); transform-origin: 50% 76%; will-change: transform, opacity; }
.descent-shot-one { animation: cinematicDescent 18s linear infinite; }
.descent-shot-two { animation: cinematicDescent 18s -9s linear infinite; }
@keyframes cinematicDescent {
  0% { opacity: 0; transform: scale(1); }
  12% { opacity: 1; transform: scale(1.12) translateY(-.3%); }
  50% { opacity: 1; transform: scale(1.5) translateY(-1.6%); }
  62% { opacity: 0; transform: scale(1.64) translateY(-2.2%); }
  100% { opacity: 0; transform: scale(1.95) translateY(-3%); }
}
.descent-light { position: absolute; inset: -15%; background: radial-gradient(circle at 50% 72%, rgba(177, 160, 113, .13), transparent 19%), radial-gradient(ellipse at 50% 48%, transparent 30%, rgba(6, 5, 4, .55) 90%); mix-blend-mode: screen; opacity: .46; animation: descentLightDrift 16s ease-in-out infinite alternate; }
@keyframes descentLightDrift {
  from { opacity: .43; transform: translate3d(0, .65%, 0); }
  to { opacity: .51; transform: translate3d(0, -.65%, 0); }
}
.intro-dust { position: absolute; inset: 0; overflow: hidden; }
.intro-dust i { position: absolute; bottom: -5%; width: 2px; height: 2px; border-radius: 50%; background: #dec878; box-shadow: 0 0 6px #dec878; opacity: 0; animation: introDustFall 7s linear infinite; }
.intro-dust i:nth-child(1) { left: 8%; animation-delay: -1s; }
.intro-dust i:nth-child(2) { left: 19%; animation-delay: -4s; animation-duration: 9s; }
.intro-dust i:nth-child(3) { left: 34%; animation-delay: -7s; }
.intro-dust i:nth-child(4) { left: 47%; animation-delay: -2s; animation-duration: 10s; }
.intro-dust i:nth-child(5) { left: 61%; animation-delay: -6s; }
.intro-dust i:nth-child(6) { left: 73%; animation-delay: -3s; animation-duration: 8s; }
.intro-dust i:nth-child(7) { left: 86%; animation-delay: -8s; animation-duration: 11s; }
.intro-dust i:nth-child(8) { left: 94%; animation-delay: -5s; }
@keyframes introDustFall { 0% { opacity: 0; transform: translate3d(0, 0, 0) scale(.6); } 25% { opacity: .5; } 100% { opacity: 0; transform: translate3d(-18px, -105vh, 0) scale(1.4); } }
.intro-copy { position: relative; z-index: 2; width: min(680px, 100%); padding: 1.5rem 0; text-align: center; text-shadow: 0 3px 16px #000, 0 1px 4px #000; animation: introSequence 5.5s .5s both; }
@keyframes introSequence {
  0% { opacity: 0; transform: translateY(18px) scale(.98); filter: blur(4px); }
  22% { opacity: 1; transform: none; filter: none; }
  70% { opacity: 1; transform: none; filter: none; }
  100% { opacity: 0; transform: translateY(-12px) scale(1.025); filter: blur(3px); }
}
.intro-copy h1 { margin: 0 auto; color: var(--parchment-muted); font-family: "EB Garamond", serif; font-size: clamp(1.35rem, 5vw, 2.25rem); font-style: italic; font-weight: 400; line-height: 1.65; letter-spacing: .025em; }
.intro-copy h1 span { display: block; color: var(--parchment); }
.intro-copy .primary-button {
  min-width: min(100%, 340px);
  border: 1px solid rgba(177, 160, 113, .72);
  padding: 1.15rem 1.5rem;
  background: rgba(177, 160, 113, .055);
  box-shadow: inset 0 0 24px rgba(177, 160, 113, .025), 0 14px 45px rgba(0, 0, 0, .25);
  font-size: clamp(1.15rem, 4.5vw, 1.55rem);
  letter-spacing: .08em;
  transition: color .4s, border-color .4s, background .4s, box-shadow .4s, transform .4s;
}
.intro-copy .primary-button::after { display: none; }
.intro-copy .primary-button:hover {
  border-color: var(--gold);
  background: rgba(177, 160, 113, .12);
  box-shadow: inset 0 0 30px rgba(177, 160, 113, .06), 0 16px 50px rgba(0, 0, 0, .38), 0 0 24px rgba(177, 160, 113, .08);
  color: var(--gold-highlight);
  transform: translateY(-2px);
}
.intro-copy .primary-button:active { transform: translateY(0); background: rgba(177, 160, 113, .18); }
.intro-copy .eyebrow { color: var(--gold-soft); margin-bottom: 3rem; }
.skip-button { position: absolute; top: max(1.5rem, env(safe-area-inset-top)); right: 1.5rem; z-index: 3; }

/* Laberinto vertical */
.library-screen { position: relative; z-index: 1; isolation: isolate; width: 100%; margin: 0; padding: 0; background: transparent; }
.library-screen:not(.is-hidden) { animation: libraryInterfaceReveal 1.25s ease both; }
@keyframes libraryInterfaceReveal { from { opacity: 0; } to { opacity: 1; } }
.library-screen::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at 50% 52%, rgba(7, 5, 4, .12), rgba(7, 5, 4, .5) 88%), linear-gradient(180deg, rgba(7, 5, 4, .22), transparent 25%, transparent 72%, rgba(7, 5, 4, .45)); }
.library-header { position: fixed; top: 0; right: 0; left: 0; z-index: 10; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: max(1.5rem, env(safe-area-inset-top)) max(1.5rem, 6vw) 3rem; background: linear-gradient(180deg, rgba(7, 5, 4, .84), transparent); pointer-events: none; }
.library-header::before { content: "⌑"; color: #a99a73; font-size: 1.35rem; line-height: 1; }
.library-header > div { flex: 1; }
.library-header h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.library-header .eyebrow { margin: .15rem 0 0; color: var(--label); text-shadow: 0 2px 8px rgba(0, 0, 0, .55); transition: opacity .5s ease, transform .65s cubic-bezier(.16, 1, .3, 1); }
.library-header .icon-button { pointer-events: auto; }
.hex-transition-veil { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at 50% 54%, rgba(7, 5, 4, .08), rgba(7, 5, 4, .82) 105%), rgba(7, 5, 4, .18); transition: opacity .85s ease-in-out; }
html.hex-switching .hex-transition-veil { opacity: .16; }
html.hex-switching .library-header .eyebrow { opacity: 0; transform: translateY(-6px); transition-duration: .2s; }
.library-lead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hex-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr; justify-items: stretch; gap: 0; padding: 0; }
.hex-grid::before { display: none; }
.hex-card {
  position: relative;
  width: 100%;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 7rem 1.5rem 5rem;
  overflow: visible;
  background: transparent;
  color: var(--parchment-muted);
  cursor: pointer;
  filter: none;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  transition: color .6s;
}
.hex-card::before { content: ""; position: absolute; top: 50%; left: 50%; width: min(84vw, 430px); aspect-ratio: 1; z-index: -1; background: radial-gradient(circle, rgba(184, 174, 152, .055), rgba(7, 5, 4, .18) 38%, transparent 68%); opacity: 0; transform: translate(-50%, -50%); transition: opacity .7s ease; }
.hex-card::after { content: ""; position: absolute; top: 50%; left: 50%; width: min(44vw, 210px); height: 1px; opacity: 0; background: linear-gradient(90deg, transparent, rgba(184, 174, 152, .34), transparent); transform: translate(-50%, -50%) scaleX(.5); transition: opacity .45s ease, transform .7s cubic-bezier(.16, 1, .3, 1); }
.hex-stop { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; text-align: center; text-shadow: 0 2px 12px rgba(0, 0, 0, .55); }
.hex-stop > * { opacity: 0; transform: translateY(var(--hex-transition-y, 14px)) scale(.99); transition: opacity .38s ease, transform .62s cubic-bezier(.16, 1, .3, 1); transition-delay: 0s; }
.hex-card.is-active .hex-stop > *, .hex-card:focus-visible .hex-stop > * { opacity: 1; transform: translateY(0) scale(1); }
.hex-card.is-active::before, .hex-card:focus-visible::before { opacity: .48; transform: translate(-50%, -50%); }
.hex-card.is-active::after, .hex-card:focus-visible::after { opacity: 1; transform: translate(-50%, -50%) scaleX(1); transition-delay: .28s; }
.hex-card.is-active .hex-kind { transition-delay: .12s; }
.hex-card.is-active .hex-number { transition-delay: .2s; }
.hex-card.is-active .hex-level { transition-delay: .29s; }
.hex-card.is-active .hex-enter { transition-delay: .46s; animation: enterPulse 3.2s ease-in-out 1s infinite; }
.hex-card.is-active .visited-mark { transition-delay: .54s; }
html.hex-switching .hex-card.is-active .hex-stop > *, html.hex-switching .hex-card:focus-visible .hex-stop > * { opacity: 0; transform: translateY(var(--hex-transition-y, -10px)) scale(.99); transition-delay: 0s; transition-duration: .22s, .32s; }
html.hex-switching .hex-card::before { opacity: 0; transform: translate(-50%, -50%); transition-delay: 0s; transition-duration: .3s; }
html.hex-switching .hex-card::after { opacity: 0; transform: translate(-50%, -50%) scaleX(.5); transition-delay: 0s; transition-duration: .3s; }
html.hex-switching .hex-grid { pointer-events: none; }
.hex-kind { margin-bottom: .55rem; color: var(--label); font-family: "Source Serif 4", serif; font-size: .6rem; letter-spacing: .34em; text-transform: uppercase; }
.hex-number { color: var(--hex-ink); font-family: "Libre Caslon Text", serif; font-size: clamp(3.3rem, 16vw, 6rem); font-weight: 400; line-height: .95; letter-spacing: .12em; }
.hex-level { margin-top: .85rem; color: var(--label); font-family: "Source Serif 4", serif; font-size: .58rem; letter-spacing: .3em; text-transform: uppercase; }
.hex-enter { position: relative; min-width: 170px; margin-top: 3.3rem; border: 1px solid rgba(184, 174, 152, .42); padding: .9rem 2rem; background: rgba(12, 9, 7, .58); color: var(--hex-action); font-family: "Libre Caslon Text", serif; font-size: 1.15rem; letter-spacing: .13em; text-transform: none; box-shadow: 0 12px 40px rgba(0, 0, 0, .32); backdrop-filter: blur(3px); }
.hex-enter::after { content: ""; display: inline-block; width: 5px; height: 5px; margin-left: .9rem; border-radius: 50%; background: #a99a73; box-shadow: 0 0 4px rgba(169, 154, 115, .4); opacity: .62; vertical-align: middle; }
@keyframes enterPulse { 0%, 100% { border-color: rgba(184, 174, 152, .32); color: var(--hex-action); box-shadow: 0 12px 40px rgba(0, 0, 0, .32), 0 0 0 rgba(184, 174, 152, 0); } 50% { border-color: rgba(184, 174, 152, .52); color: var(--hex-action-hover); box-shadow: 0 12px 40px rgba(0, 0, 0, .36), 0 0 12px rgba(184, 174, 152, .08); } }
.hex-card:hover .hex-enter, .hex-card:focus-visible .hex-enter { color: var(--hex-action-hover); background: rgba(184, 174, 152, .06); box-shadow: 0 0 24px rgba(184, 174, 152, .08); }
.visited-mark { margin-top: 1.1rem; color: var(--gold-soft); font-family: "Source Serif 4", serif; font-size: .43rem; letter-spacing: .2em; text-transform: uppercase; }
.sentinel { height: 35svh; display: flex; align-items: center; justify-content: center; gap: 7px; scroll-snap-align: end; }
.sentinel span { width: 3px; height: 3px; border-radius: 50%; background: var(--gold); animation: pulse 1.8s infinite; }
.sentinel span:nth-child(2) { animation-delay: .25s; }
.sentinel span:nth-child(3) { animation-delay: .5s; }
@keyframes pulse { 50% { opacity: .15; transform: translateY(-6px); } }

/* Celda cinematográfica */
.journey { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .7rem; overflow: auto; padding: max(1.25rem, env(safe-area-inset-top)) 1rem max(1.25rem, env(safe-area-inset-bottom)); background: #080706; }
.journey-room { position: relative; width: min(92vw, 540px); height: min(72svh, 720px); overflow: hidden; border: 1px solid rgba(177, 160, 113, .18); background: #090807; box-shadow: 0 28px 80px rgba(0, 0, 0, .72); animation: roomReveal 1.5s cubic-bezier(.22, 1, .36, 1) both; isolation: isolate; }
.room-scene { position: absolute; inset: -2%; width: 104%; height: 104%; object-fit: cover; object-position: 50% 52%; filter: brightness(.77) saturate(.78) sepia(.1); animation: roomBreath 14s ease-in-out infinite alternate; transition: filter .8s; }
.scene-vignette { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at 50% 47%, transparent 28%, rgba(5, 4, 3, .18) 64%, rgba(5, 4, 3, .8) 108%), linear-gradient(180deg, rgba(8, 7, 6, .25), transparent 30%, transparent 70%, rgba(8, 7, 6, .35)); }
@keyframes roomReveal { from { opacity: 0; transform: scale(1.09); filter: blur(8px); } to { opacity: 1; transform: scale(1); filter: none; } }
@keyframes roomBreath {
  from { transform: scale(1.015) translate3d(calc(var(--parallax-x, 0px) - 2px), var(--parallax-y, 0px), 0); }
  to { transform: scale(1.055) translate3d(calc(var(--parallax-x, 0px) + 2px), calc(var(--parallax-y, 0px) - 6px), 0); }
}
.scene-dust { position: absolute; inset: 0; z-index: 4; overflow: hidden; pointer-events: none; }
.scene-dust i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #d7b96a; box-shadow: 0 0 5px #d7b96a; opacity: 0; animation: dustDrift 8s linear infinite; }
.scene-dust i:nth-child(1) { left: 12%; top: 72%; animation-delay: -1s; }
.scene-dust i:nth-child(2) { left: 27%; top: 45%; animation-delay: -5s; animation-duration: 11s; }
.scene-dust i:nth-child(3) { left: 43%; top: 63%; animation-delay: -7s; }
.scene-dust i:nth-child(4) { left: 61%; top: 52%; animation-delay: -3s; animation-duration: 13s; }
.scene-dust i:nth-child(5) { left: 79%; top: 70%; animation-delay: -9s; animation-duration: 10s; }
.scene-dust i:nth-child(6) { left: 88%; top: 34%; animation-delay: -4s; animation-duration: 12s; }
@keyframes dustDrift { 0% { opacity: 0; transform: translate(0, 20px); } 25% { opacity: .55; } 75% { opacity: .18; } 100% { opacity: 0; transform: translate(15px, -130px); } }
.room-wall { position: absolute; z-index: 3; border: 0; padding: 0; background: transparent; color: var(--parchment-muted); cursor: pointer; transition: background .8s, box-shadow .8s; }
.room-wall::before { content: ""; position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, rgba(177, 160, 113, .2), rgba(92, 64, 51, .06) 48%, transparent 72%); transition: opacity .7s; }
.room-wall:hover::before, .room-wall:focus-visible::before, .room-wall.selected::before { opacity: 1; }
.wall-1 { top: 4%; left: 1%; width: 48%; height: 39%; clip-path: polygon(0 0, 100% 0, 86% 100%, 0 92%); }
.wall-2 { top: 4%; right: 1%; width: 48%; height: 39%; clip-path: polygon(0 0, 100% 0, 100% 92%, 14% 100%); }
.wall-3 { top: 37%; left: 1%; width: 45%; height: 34%; clip-path: polygon(0 0, 100% 5%, 78% 100%, 0 100%); }
.wall-4 { top: 37%; right: 1%; width: 45%; height: 34%; clip-path: polygon(0 5%, 100% 0, 100% 100%, 22% 100%); }
.wall-marker { position: absolute; top: 50%; left: 50%; min-width: 72px; display: flex; flex-direction: column; align-items: center; padding: .55rem .45rem .45rem; border: 1px solid rgba(177, 160, 113, .34); background: rgba(10, 8, 7, .68); box-shadow: 0 8px 25px rgba(0, 0, 0, .42); opacity: 0; transform: translate(-50%, -42%); transition: opacity .55s, transform .7s, border-color .5s, background .5s; backdrop-filter: blur(3px); }
.wall-marker small, .wall-marker em { font-family: "Source Serif 4", serif; font-size: .38rem; font-style: normal; letter-spacing: .18em; text-transform: uppercase; white-space: nowrap; }
.wall-marker b { margin: .12rem 0; color: var(--gold); font-family: "Libre Caslon Text", serif; font-size: 1.15rem; font-weight: 400; line-height: 1; }
.wall-marker em { color: var(--outline); font-size: .3rem; }
.room-wall:hover .wall-marker, .room-wall:focus-visible .wall-marker, .room-wall.selected .wall-marker { opacity: 1; transform: translate(-50%, -50%); }
.room-wall.selected .wall-marker { border-color: var(--gold); background: rgba(24, 18, 12, .86); box-shadow: 0 0 36px rgba(177, 160, 113, .2); }
.approaching-wall .journey-room { animation: approachWall 1.3s cubic-bezier(.65, 0, .35, 1) both; }
.approaching-wall[data-selected-wall="1"] .journey-room { transform-origin: 22% 22%; }
.approaching-wall[data-selected-wall="2"] .journey-room { transform-origin: 78% 22%; }
.approaching-wall[data-selected-wall="3"] .journey-room { transform-origin: 22% 54%; }
.approaching-wall[data-selected-wall="4"] .journey-room { transform-origin: 78% 54%; }
@keyframes approachWall { 0% { transform: scale(1); filter: none; } 55% { transform: scale(1.08); filter: brightness(1.08); } 100% { transform: scale(2.25); filter: brightness(.65) blur(2px); opacity: 0; } }
.journey-coordinate { margin: .65rem 0 0 !important; color: var(--gold-soft) !important; font-family: "Source Serif 4", serif !important; font-size: .54rem !important; font-style: normal !important; letter-spacing: .22em; text-transform: uppercase; animation: none !important; }
.choosing-wall .journey-coordinate { display: none; }
.journey p { margin: .05rem 0; color: var(--parchment-muted); font-size: .95rem; font-style: italic; text-align: center; }
.journey #journey-label { animation: pulse 2s infinite; }

@media (hover: none) {
  .choosing-wall .wall-marker { opacity: .62; transform: translate(-50%, -50%); }
}

/* Anaquel */
.book-picker { position: relative; display: none; width: min(680px, 100%); max-height: 88svh; overflow: auto; padding: .5rem max(.2rem, 2vw) 1rem; }
.choosing-book .journey-room, .opening-book .journey-room { display: none; }
.choosing-book .book-picker, .opening-book .book-picker { display: block; animation: pickerReveal .8s ease both; }
@keyframes pickerReveal { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.picker-back { position: absolute; top: 1.25rem; left: max(1rem, calc((100% - 560px) / 2 + 1rem)); z-index: 5; background: rgba(12, 9, 7, .66); backdrop-filter: blur(3px); }
.book-picker-hint { position: absolute; bottom: 1.35rem; left: 50%; z-index: 5; width: max-content; max-width: calc(100% - 2rem); margin: 0 !important; padding: .65rem 1rem; background: rgba(8, 7, 6, .58); color: var(--parchment-muted) !important; font-family: "EB Garamond", serif; font-size: 1rem !important; font-style: italic; text-align: center; text-shadow: 0 2px 8px #000; transform: translateX(-50%); animation: bookPickerHintPulse 2.6s ease-in-out infinite; pointer-events: none; backdrop-filter: blur(3px); }
.book-picker-hint::after { content: ""; display: inline-block; width: 4px; height: 4px; margin-left: .7rem; border-radius: 50%; background: #a99a73; box-shadow: 0 0 4px rgba(169, 154, 115, .4); vertical-align: middle; }
@keyframes bookPickerHintPulse { 0%, 100% { opacity: .58; } 50% { opacity: 1; } }
.opening-book .picker-back, .opening-book .book-picker-hint { opacity: 0; animation: none; pointer-events: none; transition: opacity .25s; }
.shelf-stage { position: relative; width: min(92vw, 560px); aspect-ratio: 2 / 3; margin: auto; overflow: hidden; border: 1px solid rgba(177, 160, 113, .18); background: #090706; box-shadow: 0 24px 70px rgba(0, 0, 0, .62); isolation: isolate; }
.shelf-scene { position: absolute; inset: -1%; width: 102%; height: 102%; object-fit: cover; filter: brightness(.84) saturate(.82) sepia(.08); animation: shelfBreath 13s ease-in-out infinite alternate; }
.shelf-vignette { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at 50% 46%, transparent 42%, rgba(7, 5, 4, .18) 72%, rgba(7, 5, 4, .72) 110%); }
@keyframes shelfBreath { from { transform: scale(1.01); filter: brightness(.82) saturate(.8); } to { transform: scale(1.035); filter: brightness(.9) saturate(.88); } }
.shelf-list { position: absolute; inset: 0; z-index: 2; }
.shelf-row { position: absolute; right: 12.8%; left: 12.8%; height: 12.2%; }
.shelf-row:nth-child(1) { top: 9%; }
.shelf-row:nth-child(2) { top: 25%; }
.shelf-row:nth-child(3) { top: 40%; }
.shelf-row:nth-child(4) { top: 55%; }
.shelf-row:nth-child(5) { top: 70%; }
.book-spines { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 0; background: transparent; }
.book-spine { position: relative; flex: 1; min-width: 0; height: 100%; border: 0; border-right: 1px solid transparent; border-radius: 0; padding: 0; background: transparent; color: transparent; font-size: 0; cursor: pointer; opacity: .55; transition: opacity .35s, background .5s, box-shadow .5s, transform .6s; }
.book-spine::before { content: ""; position: absolute; inset: -4% 0; border: 1px solid transparent; background: linear-gradient(180deg, rgba(177, 160, 113, .1), transparent 35%, rgba(177, 160, 113, .08)); opacity: 0; transition: opacity .45s, border-color .45s; }
.book-spine:hover, .book-spine:focus-visible { z-index: 2; color: var(--gold); opacity: 1; background: rgba(177, 160, 113, .08); box-shadow: 0 0 18px rgba(177, 160, 113, .12); transform: translateY(-3px) scaleX(1.18); }
.book-spine:hover::before, .book-spine:focus-visible::before { border-color: rgba(177, 160, 113, .72); opacity: 1; }
.book-spine.selected { z-index: 4; color: var(--void); opacity: 1; background: rgba(177, 160, 113, .8); box-shadow: 0 0 35px rgba(177, 160, 113, .7); animation: extractBook 1.5s cubic-bezier(.65, 0, .35, 1) forwards; }
@keyframes extractBook { 0% { transform: none; } 55% { transform: translateY(-10px) scale(1.25); } 100% { transform: translateY(-10px) scale(12); opacity: 0; } }
.choosing-book > .journey-coordinate, .choosing-book > #journey-label, .opening-book > .journey-coordinate, .opening-book > #journey-label { display: none; }

/* Volumen */
.book-screen { position: relative; z-index: 1; isolation: isolate; width: min(800px, 100%); margin: auto; padding: 0 clamp(1rem, 4vw, 3rem) max(3rem, env(safe-area-inset-bottom)); animation: bookSceneReveal .9s ease both; }
.book-screen::before { content: ""; position: fixed; inset: -2rem; z-index: -2; pointer-events: none; background: linear-gradient(180deg, rgba(8, 7, 6, .7), rgba(8, 7, 6, .9)), url("assets/anaquel-cinematografico-v1.png") center 42% / cover no-repeat; filter: blur(10px) brightness(.48) saturate(.62); transform: scale(1.07); }
.book-screen::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at 50% 38%, rgba(177, 160, 113, .055), rgba(8, 7, 6, .42) 64%, rgba(8, 7, 6, .86)); }
@keyframes bookSceneReveal { from { opacity: 0; } to { opacity: 1; } }
.book-header { position: sticky; top: 0; z-index: 6; min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: .65rem; margin-bottom: 1rem; padding: max(.85rem, env(safe-area-inset-top)) 0 1.15rem; background: linear-gradient(180deg, rgba(10, 8, 7, .995) 0%, rgba(10, 8, 7, .99) 82%, rgba(10, 8, 7, .9) 92%, transparent 100%); }
.book-header .round-button { width: 46px; height: 46px; flex-basis: 46px; border-color: rgba(159, 151, 133, .34); background: rgba(12, 9, 7, .62); color: var(--hex-action); backdrop-filter: blur(5px); }
.book-location { min-width: 0; text-align: center; }
.book-location p { margin: .14rem; }
.book-location p:first-child { color: var(--hex-ink); font-family: "Libre Caslon Text", serif; font-size: .86rem; letter-spacing: .13em; text-transform: uppercase; }
.book-location p:last-child { color: var(--label); font-family: "Source Serif 4", serif; font-size: .72rem; line-height: 1.4; letter-spacing: .11em; text-transform: uppercase; }
.book-object { position: relative; min-height: 68svh; display: flex; flex-direction: column; overflow: hidden; border-top: 1px solid rgba(177, 160, 113, .15); border-bottom: 1px solid rgba(177, 160, 113, .1); padding: 2.2rem clamp(.45rem, 2vw, 2.5rem) 1.6rem; background: linear-gradient(90deg, rgba(177, 160, 113, .028), transparent 12%, transparent 88%, rgba(177, 160, 113, .028)), rgba(14, 11, 10, .91); color: #ded7d0; box-shadow: 0 35px 90px rgba(0, 0, 0, .34), inset 0 0 80px rgba(0, 0, 0, .2); }
.book-object::before { content: ""; position: absolute; top: 0; left: 50%; width: 92px; height: 1px; background: linear-gradient(90deg, transparent, rgba(177, 160, 113, .42), transparent); transform: translateX(-50%); }
.book-object::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; box-shadow: inset 18px 0 40px rgba(0, 0, 0, .09), inset -18px 0 40px rgba(0, 0, 0, .09); }
.page-text { position: relative; z-index: 1; width: min(100%, 36rem); flex: 1; margin-inline: auto; color: #ded7d0; font-family: "EB Garamond", serif; font-size: clamp(1.125rem, 4.45vw, 1.24rem); line-height: 1.72; letter-spacing: .006em; text-align: left; text-wrap: pretty; }
.page-line { display: inline; margin: 0; padding: .04rem .025rem; cursor: pointer; transition: color .25s, background .25s; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.page-line::after { content: " "; }
.page-text::first-letter { float: left; margin: .08em .12em -.04em 0; color: var(--gold); font-family: "Libre Caslon Text", serif; font-size: 3.25em; line-height: .76; }
.page-line:hover { background: rgba(177, 160, 113, .07); color: var(--parchment); }
.page-line.saved { background: linear-gradient(transparent 80%, rgba(177, 160, 113, .24) 80%); }
.page-footer { position: relative; z-index: 1; width: min(100%, 36rem); display: flex; flex-direction: column; align-items: center; gap: .5rem; margin: 3.5rem auto 0; padding-top: 1.1rem; border-top: 1px solid rgba(159, 151, 133, .28); color: var(--label); font-family: "Source Serif 4", serif; font-size: .72rem; letter-spacing: .12em; text-align: center; text-transform: uppercase; }
.page-footer span { color: var(--label); }
.reading-hint { max-width: 34ch; margin: 2rem auto 1.15rem; color: rgba(187, 179, 163, .7); font-size: .82rem; font-style: italic; line-height: 1.5; text-align: center; }
.book-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; }
.book-actions .primary-button, .book-actions .secondary-button { min-width: 126px; min-height: 44px; border: 1px solid rgba(159, 151, 133, .26); padding: .72rem 1rem; background: rgba(14, 11, 10, .58); color: var(--hex-action); backdrop-filter: blur(4px); }
.book-actions .primary-button:hover, .book-actions .secondary-button:hover { border-color: rgba(184, 174, 152, .5); background: rgba(177, 160, 113, .07); color: var(--hex-action-hover); }

/* Archivo */
.saved-panel { position: fixed; z-index: 40; top: 0; right: 0; width: min(480px, 100%); height: 100%; overflow: auto; padding: max(2.5rem, env(safe-area-inset-top)) 1.7rem 3rem; background: rgba(31, 27, 25, .98); box-shadow: -25px 0 70px rgba(0, 0, 0, .45); transform: translateX(105%); transition: transform .55s cubic-bezier(.22, 1, .36, 1); }
.saved-panel::before { content: ""; position: absolute; top: 0; right: 2rem; width: 27px; height: 100px; background: var(--sepia); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%); opacity: .8; }
.saved-panel.open { transform: none; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 0 0 2rem; border-bottom: 1px solid var(--outline-dim); }
.panel-heading h2 { margin: 0; color: var(--gold); font-family: "Libre Caslon Text", serif; font-size: 2rem; font-weight: 400; }
.saved-list { display: grid; gap: 1.5rem; padding-top: 2rem; }
.saved-item { padding: 1.25rem; border: 0; border-left: 1px solid var(--gold-soft); background: rgba(22, 19, 17, .65); }
.saved-item blockquote { margin: 0 0 1rem; color: var(--parchment-muted); font-size: 1.05rem; font-style: italic; line-height: 1.55; }
.saved-item p { margin: 0; color: var(--gold-soft); font-family: "Source Serif 4", serif; font-size: .48rem; letter-spacing: .16em; text-transform: uppercase; }
.empty-state { color: var(--outline); font-style: italic; line-height: 1.6; }
.toast { position: fixed; z-index: 60; bottom: 2rem; left: 50%; padding: .7rem 1.1rem; border: 1px solid var(--outline-dim); border-radius: 2px; background: var(--surface-high); color: var(--parchment); font-family: "Source Serif 4", serif; font-size: .62rem; letter-spacing: .12em; white-space: nowrap; opacity: 0; pointer-events: none; transform: translate(-50%, 25px); transition: .3s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 620px) {
  .page-text { text-align: justify; text-justify: inter-word; hyphens: auto; }
  .page-text::first-letter { font-size: 4.1em; }
  .page-footer { flex-direction: row; justify-content: space-between; text-align: left; }
}

@media (min-width: 700px) {
  .library-header { padding-inline: max(3rem, 8vw); }
}

@media (max-width: 600px) {
  .choosing-wall { justify-content: stretch; gap: 0; overflow: hidden; padding: 0; }
  .choosing-wall .journey-room { width: 100%; max-width: none; height: 100svh; height: 100dvh; max-height: none; flex: 1 0 100%; border: 0; box-shadow: none; }
  .choosing-wall #journey-label { position: absolute; bottom: max(1.35rem, env(safe-area-inset-bottom)); left: 50%; z-index: 8; width: max-content; max-width: calc(100% - 2rem); margin: 0 !important; padding: .65rem 1rem; background: rgba(8, 7, 6, .58); color: var(--parchment-muted); text-shadow: 0 2px 8px #000; transform: translateX(-50%); animation: none; pointer-events: none; backdrop-filter: blur(3px); }
  .choosing-book, .opening-book { justify-content: flex-start; gap: 0; overflow: hidden; padding: 0; }
  .choosing-book .book-picker, .opening-book .book-picker { width: 100%; max-width: none; height: 100svh; height: 100dvh; max-height: none; overflow: hidden; padding: 0; }
  .choosing-book .shelf-stage, .opening-book .shelf-stage { width: 100%; height: 100%; max-width: none; margin: 0; border: 0; aspect-ratio: auto; box-shadow: none; }
  .choosing-book .shelf-row, .opening-book .shelf-row { right: .5%; left: .5%; }
  .picker-back { top: max(1rem, env(safe-area-inset-top)); left: max(1rem, env(safe-area-inset-left)); }
  .book-picker-hint { bottom: max(1.35rem, env(safe-area-inset-bottom)); }
}

@media (max-width: 430px) {
  .journey { justify-content: flex-start; }
  .choosing-wall { justify-content: flex-start; }
  .journey-room { width: min(88vw, 390px); }
  .book-picker { max-height: 76svh; }
  .shelf-list { gap: 1.7rem; }
  .book-spine { font-size: .38rem; }
  .book-header { margin-bottom: .75rem; }
  .book-actions { gap: .65rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .descent-shot-one { opacity: 1; transform: scale(1.08); animation: none !important; }
  .descent-shot-two { display: none; }
  .shared-descent { transform: none !important; }
  .hex-transition-veil { display: none; }
}
