:root {
  color-scheme: dark;
  --ink: #f0e9dc;
  --muted: #aaa092;
  --gold: #c5a46f;
  --gold-dim: #6d5738;
  --black: #080806;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-mass: cubic-bezier(.65, 0, .35, 1);
  --serif: "Shippori Mincho", "Noto Serif TC", serif;
  --sans: "Manrope", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--black); }
body { margin: 0; overflow: hidden; background: var(--black); color: var(--ink); font-family: var(--sans); }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.skip-link {
  position: fixed; z-index: 30; top: 12px; left: 12px; padding: 10px 14px;
  background: var(--ink); color: var(--black); transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: fixed; z-index: 12; inset: 0 0 auto; height: 86px; padding: 0 clamp(24px, 4vw, 68px);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  border-bottom: 1px solid rgba(197, 164, 111, .12);
  background: linear-gradient(180deg, rgba(4,4,3,.62), transparent);
}
.brand { display: inline-flex; align-items: center; gap: 13px; width: max-content; font-family: var(--serif); font-size: 13px; letter-spacing: .1em; }
.brand-mark { display: grid; place-items: center; width: 28px; aspect-ratio: 1; border: 1px solid rgba(197,164,111,.7); border-radius: 50%; color: var(--gold); font-size: 11px; }
.header-coordinate { margin: 0; color: rgba(240,233,220,.48); font-size: 9px; letter-spacing: .25em; }
.hall-link { justify-self: end; padding-block: 10px; border-bottom: 1px solid rgba(197,164,111,.38); color: #d8c5a4; font-size: 10px; letter-spacing: .2em; }
.hall-link span { margin-left: 9px; color: var(--gold); }
.header-left { display: inline-flex; align-items: center; gap: clamp(14px, 2.4vw, 30px); }
.exit-modern { display: inline-flex; align-items: center; gap: 7px; padding-block: 9px; color: rgba(240,233,220,.6); font-size: 10px; letter-spacing: .2em; border-bottom: 1px solid rgba(197,164,111,.28); transition: color .45s var(--ease-out), border-color .45s var(--ease-out); }
.exit-modern:hover, .exit-modern:focus-visible { color: var(--ink); border-color: rgba(197,164,111,.72); }
.exit-arrow { color: var(--gold); }

.hero { --art-x: 0px; --art-y: 0px; --artifact-x: calc(50vw + 35.6vh); --artifact-y: 53.4%; position: relative; min-height: 100dvh; overflow: hidden; isolation: isolate; }
.hero-art { position: absolute; inset: -3%; background: url("library-assets/portal-background-plate.png") center / cover no-repeat; transform: translate3d(calc(var(--art-x) * -.45), calc(var(--art-y) * -.45), 0) scale(1.035); transition: transform 1.4s var(--ease-out); }
.page-ring-rotor { position: absolute; z-index: 1; left: var(--artifact-x); top: var(--artifact-y); width: max(106vw, 188.4vh); aspect-ratio: 1672 / 941; background: url("library-assets/portal-page-ring.png") center / contain no-repeat; transform-origin: center; animation: page-ring-turn 26s cubic-bezier(.45,.05,.55,.95) infinite; filter: drop-shadow(0 18px 30px rgba(0,0,0,.34)); will-change: transform; pointer-events: none; }
.book-rotor { position: absolute; z-index: 2; left: var(--artifact-x); top: var(--artifact-y); width: max(47.7vw, 84.8vh); aspect-ratio: 1672 / 941; background: url("library-assets/portal-black-book.png") center / contain no-repeat; transform-origin: center; animation: book-cutout-drift 7.8s var(--ease-mass) infinite alternate; filter: drop-shadow(0 30px 35px rgba(0,0,0,.72)); will-change: transform; pointer-events: none; }
.hero-vignette { position: absolute; inset: 0; background: radial-gradient(circle at 72% 51%, transparent 15%, rgba(3,3,2,.04) 35%, rgba(3,3,2,.5) 78%), linear-gradient(90deg, rgba(5,5,4,.58) 0%, transparent 50%); }
.hero-grain { position: absolute; inset: 0; opacity: .14; mix-blend-mode: soft-light; pointer-events: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E"); }

.gate-motion { position: absolute; z-index: 2; left: 70.9%; top: 50.5%; width: min(53vw, 785px); aspect-ratio: 1; transform: translate3d(calc(-50% + var(--art-x)), calc(-50% + var(--art-y)), 0); transition: transform 1.1s var(--ease-out); pointer-events: none; }
.ring-motion { position: absolute; inset: 0; border-radius: 50%; opacity: .58; filter: drop-shadow(0 0 9px rgba(193,150,87,.12)); }
.ring-outer { inset: 5%; border: 1px solid rgba(197,153,88,.52); border-left-color: transparent; border-bottom-color: rgba(197,153,88,.12); animation: ring-clockwise 42s cubic-bezier(.45, .05, .55, .95) infinite alternate; }
.ring-outer::after { content: "✦"; position: absolute; top: 12%; right: 10%; color: #e4bd7c; font-size: 12px; }
.ring-middle { inset: 13%; border: 1px dashed rgba(197,153,88,.28); animation: ring-counter 54s cubic-bezier(.45, .05, .55, .95) infinite alternate-reverse; }
.ring-middle::before, .ring-middle::after { content: ""; position: absolute; inset: 7%; border: 1px solid transparent; border-top-color: rgba(197,153,88,.42); border-bottom-color: rgba(197,153,88,.22); border-radius: 50%; }
.ring-inner { inset: 22%; border: 1px solid rgba(220,185,127,.24); animation: ring-clockwise 31s cubic-bezier(.45, .05, .55, .95) infinite alternate-reverse; }
.halo-motion { position: absolute; border-radius: 50%; mix-blend-mode: screen; }
.halo-one { inset: 31%; border: 1px solid rgba(233,195,130,.2); box-shadow: 0 0 44px rgba(199,149,78,.1); animation: halo-breathe 7s var(--ease-mass) infinite alternate; }
.halo-two { inset: 37%; background: radial-gradient(circle, rgba(184,136,73,.08), transparent 65%); animation: halo-breathe 5s var(--ease-mass) infinite alternate-reverse; }

.hero-copy { position: absolute; z-index: 5; left: clamp(28px, 7vw, 120px); top: 50%; width: min(39vw, 540px); transform: translateY(-46%); }
.hero-kicker { display: flex; align-items: center; gap: 13px; margin: 0 0 26px; color: var(--gold); font-size: 9px; letter-spacing: .3em; text-transform: uppercase; }
.hero-kicker span { width: 34px; height: 1px; background: var(--gold); }
.hero h1 { margin: 0; font-family: var(--serif); font-size: clamp(52px, 5.6vw, 82px); font-weight: 400; line-height: 1.02; letter-spacing: .12em; text-shadow: 0 12px 45px rgba(0,0,0,.5); text-wrap: balance; }
.hero-intro { margin: 28px 0 0; color: rgba(240,233,220,.68); font-family: var(--serif); font-size: clamp(13px, 1.1vw, 17px); line-height: 2; letter-spacing: .12em; }
.enter-library { width: min(100%, 330px); min-height: 48px; margin-top: 42px; padding: 0; display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.enter-label { font-size: 10px; letter-spacing: .28em; }
.enter-line { height: 1px; background: linear-gradient(90deg, rgba(197,164,111,.7), rgba(197,164,111,.12)); transform-origin: left; transition: transform .8s var(--ease-out); }
.enter-arrow { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(197,164,111,.42); border-radius: 50%; color: var(--gold); transition: transform .7s var(--ease-out), background .7s; }
.enter-library:hover .enter-line { transform: scaleX(.82); }
.enter-library:hover .enter-arrow { transform: translate(5px, 5px); background: rgba(197,164,111,.08); }

.hero-stage { position: absolute; z-index: 4; inset: 0; pointer-events: none; }
.portal { position: absolute; left: 70.9%; top: 50.5%; width: min(25vw, 360px); aspect-ratio: 1; transform: translate(-50%, -50%); border: 0; border-radius: 50%; background: transparent; cursor: pointer; pointer-events: auto; }
.portal::before { content: ""; position: absolute; inset: 20%; border-radius: 50%; border: 1px solid transparent; transition: border-color .6s, transform .8s var(--ease-out), box-shadow .8s; }
.portal-hit-label { position: absolute; left: 50%; bottom: 5%; transform: translateX(-50%) translateY(8px); color: rgba(232,211,176,0); font-size: 8px; letter-spacing: .35em; transition: color .5s, transform .6s var(--ease-out); }
.portal:hover::before { border-color: rgba(224,186,124,.28); transform: scale(1.15); box-shadow: 0 0 80px rgba(174,126,65,.1); }
.portal:hover .portal-hit-label { color: rgba(232,211,176,.65); transform: translateX(-50%) translateY(0); }
.hero:has(.portal:hover) .ring-motion,
.hero:has(.portal:focus-visible) .ring-motion { opacity: .82; filter: drop-shadow(0 0 16px rgba(221,177,108,.26)); }
.hero:has(.portal:hover) .halo-one,
.hero:has(.portal:focus-visible) .halo-one { transform: scale(1.18); opacity: .7; box-shadow: 0 0 70px rgba(211,163,93,.2); }
.hero:has(.portal:hover) .book-rotor,
.hero:has(.portal:focus-visible) .book-rotor { filter: brightness(1.12) drop-shadow(0 34px 42px rgba(0,0,0,.78)); }

.motion-note { position: absolute; z-index: 5; left: clamp(28px, 7vw, 120px); bottom: 43px; margin: 0; color: rgba(240,233,220,.35); font-size: 8px; letter-spacing: .19em; }
.motion-note span { margin-right: 10px; color: var(--gold); }
.chapter-mark { position: absolute; z-index: 5; right: clamp(25px, 4vw, 68px); bottom: 42px; margin: 0; color: rgba(240,233,220,.28); font-size: 8px; letter-spacing: .3em; }

.portal-transition { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; background: #030302; opacity: 0; visibility: hidden; pointer-events: none; overflow: hidden; }
.transition-ring { position: absolute; width: min(60vw, 850px); aspect-ratio: 1; border: 1px solid rgba(197,164,111,.45); border-radius: 50%; transform: scale(.12); }
.transition-ring-b { width: min(44vw, 620px); border-style: dashed; }
.transition-core { width: 10px; aspect-ratio: 1; border-radius: 50%; background: #d2ae74; box-shadow: 0 0 80px 20px rgba(207,164,98,.42); }
.transition-copy { position: absolute; bottom: 14%; color: rgba(240,233,220,.5); font-size: 8px; letter-spacing: .42em; opacity: 0; }
body.is-entering .portal-transition { visibility: visible; animation: transition-veil 1.5s var(--ease-mass) forwards; }
body.is-entering .transition-ring-a { animation: transition-tunnel 1.35s .05s var(--ease-mass) forwards; }
body.is-entering .transition-ring-b { animation: transition-tunnel 1.25s .16s var(--ease-mass) forwards reverse; }
body.is-entering .transition-core { animation: transition-core 1.35s var(--ease-mass) forwards; }
body.is-entering .transition-copy { animation: transition-copy .8s .45s forwards; }
body.is-entering .hero-art, body.is-entering .gate-motion { transform: translate3d(-20%, 0, 0) scale(1.35); transition-duration: 1.4s; }
.noscript-link { position: fixed; z-index: 50; inset: auto 20px 20px auto; padding: 12px 18px; background: var(--gold); color: var(--black); }

button:focus-visible, a:focus-visible { outline: 1px solid #f0c987; outline-offset: 5px; }

@keyframes ring-clockwise { to { transform: rotate(360deg); } }
@keyframes ring-counter { to { transform: rotate(-360deg); } }
@keyframes page-ring-turn { 0% { transform: translate(-50%,-50%) rotate(0); } 27% { transform: translate(-50%,-50%) rotate(96deg); } 61% { transform: translate(-50%,-50%) rotate(218deg); } 100% { transform: translate(-50%,-50%) rotate(360deg); } }
@keyframes book-cutout-drift { from { transform: translate(-50%,calc(-50% + 7px)) rotate(-.35deg) scale(.996); } to { transform: translate(-50%,calc(-50% - 9px)) rotate(.45deg) scale(1.008); } }
@keyframes central-book-drift { from { transform: translate3d(-5px, 12px, 0) rotateY(-10deg) rotateZ(-1.2deg); } to { transform: translate3d(7px, -14px, 25px) rotateY(10deg) rotateZ(1.4deg); } }
@keyframes halo-breathe { to { transform: scale(1.12); opacity: .45; } }
@keyframes transition-veil { 0% { opacity: 0; } 18%, 100% { opacity: 1; } }
@keyframes transition-tunnel { 0% { transform: scale(.12) rotate(0); opacity: 0; } 22% { opacity: 1; } 100% { transform: scale(4.5) rotate(80deg); opacity: 0; } }
@keyframes transition-core { 0% { transform: scale(1); } 55% { transform: scale(18); opacity: .8; } 100% { transform: scale(180); opacity: 0; } }
@keyframes transition-copy { to { opacity: 1; transform: translateY(-5px); } }

@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr auto; }
  .header-coordinate { display: none; }
  .hero-copy { top: auto; bottom: 12%; width: min(82vw, 500px); transform: none; }
  .hero h1 { font-size: clamp(52px, 12vw, 86px); }
  .hero-intro { margin-top: 19px; }
  .enter-library { margin-top: 25px; }
  .gate-motion, .portal { left: 63%; top: 40%; }
  .gate-motion { width: min(85vw, 660px); opacity: .82; }
  .portal { width: min(48vw, 300px); }
  .motion-note, .chapter-mark { display: none; }
}

@media (max-width: 767px) {
  .hero { --artifact-x: calc(69.7vw + 12.75vh); --artifact-y: 53.3%; }
  .site-header { height: 68px; padding-inline: 18px; }
  .brand { font-size: 11px; }
  .brand-mark { width: 25px; }
  .hall-link { font-size: 8px; }
  .header-left { gap: 15px; }
  .exit-modern { font-size: 8px; letter-spacing: .16em; }
  .exit-full { display: none; }
  .hero-art { inset: -2% -32%; background-position: 62% center; }
  .hero-vignette { background: linear-gradient(0deg, rgba(4,4,3,.92) 0%, rgba(4,4,3,.18) 54%, rgba(4,4,3,.1)); }
  .gate-motion, .portal { left: 61%; top: 37%; }
  .gate-motion { width: 104vw; }
  .portal { width: 58vw; }
  .hero-copy { left: 22px; bottom: 8%; width: calc(100% - 44px); }
  .hero-kicker { margin-bottom: 17px; }
  .hero h1 { font-size: clamp(50px, 16vw, 72px); }
  .hero-intro { font-size: 12px; line-height: 1.8; }
  .enter-library { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .hero-art, .gate-motion { transform: none; }
  .page-ring-rotor, .book-rotor { transform: translate(-50%,-50%); }
}
