:root {
  --cover: #5b1526; --cover-deep: #2e0812; --gold: #d9b86c; --paper: #f3ead8; --ink: #2b2430; --guil: #b98f7a;
  --ease: cubic-bezier(.22, .8, .2, 1);
  --serif: 'Cormorant Garamond', Georgia, serif; --caps: 'Cinzel', serif; --mono: 'IBM Plex Mono', monospace; --script: 'Pinyon Script', cursive;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--serif); color: var(--ink); -webkit-font-smoothing: antialiased;
  background: radial-gradient(ellipse at 50% 20%, #3b0c18, #14040a 70%);
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }

.app {
  position: relative; max-width: 480px; height: 100svh; margin: 0 auto; overflow: hidden;
  background: radial-gradient(ellipse at 50% 35%, color-mix(in srgb, var(--cover) 82%, black) 0%, var(--cover-deep) 75%);
  box-shadow: 0 0 80px rgba(0, 0, 0, .5);
}

/* ───────── intro / cover ───────── */
.intro {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px;
  perspective: 1600px;
  transition: opacity .7s ease, transform 1s var(--ease), visibility 0s linear 1s;
}
.intro::before { /* soft spotlight */
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 45% at 50% 46%, rgba(255, 220, 170, .14), transparent 70%);
  pointer-events: none;
}
.book {
  position: relative; width: min(72vw, 300px); aspect-ratio: 88 / 125;
  transform-style: preserve-3d;
  transition: transform 1.6s var(--ease);
  animation: bookIn 1.2s var(--ease) both;
}
@keyframes bookIn { from { transform: translateY(30px) rotateX(18deg) scale(.92); opacity: 0; } }
.pages-edge { /* page block thickness */
  position: absolute; inset: 3px -5px -6px 3px; border-radius: 4px 12px 12px 4px;
  background: repeating-linear-gradient(90deg, #e9dfc9 0 1px, #cfc2a6 1px 2px);
  box-shadow: 0 30px 50px rgba(0, 0, 0, .55), 0 8px 14px rgba(0, 0, 0, .4);
}
.under { position: absolute; inset: 0; border-radius: 3px 10px 10px 3px; background: var(--paper); overflow: hidden; }
.under-inner { position: absolute; inset: 0; background-image: var(--guil-bg); opacity: .9; }
.under::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .25), transparent 18%); }
.cover {
  position: absolute; inset: 0; transform-origin: 0 50%; transform-style: preserve-3d;
  transition: transform 1.5s cubic-bezier(.55, .05, .25, 1);
}
.face { position: absolute; inset: 0; border-radius: 3px 10px 10px 3px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; display: block; }
.front {
  background:
    var(--leather),
    radial-gradient(ellipse at 30% 25%, rgba(255, 255, 255, .12), transparent 55%),
    linear-gradient(160deg, var(--cover), var(--cover-deep));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35), inset 6px 0 10px rgba(0, 0, 0, .35), inset -2px -2px 6px rgba(0, 0, 0, .3);
}
.front::before { /* spine crease */
  content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(rgba(0, 0, 0, .35), rgba(0, 0, 0, .15)); box-shadow: 1px 0 0 rgba(255, 255, 255, .06);
}
.front svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.back {
  transform: rotateY(180deg);
  background: linear-gradient(90deg, #e7dcc4, var(--paper)), var(--paper);
}
.back { visibility: hidden; } /* Safari flattens the 3D book and paints the back over the cover */
.intro.opening .back { visibility: visible; transition: visibility 0s .5s; }
.back::before { content: ''; position: absolute; inset: 0; background-image: var(--guil-bg); opacity: .7; }
.cover::after { /* foil glint sweep */
  content: ''; position: absolute; inset: 0; border-radius: 3px 10px 10px 3px; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 240, 200, .22) 48%, transparent 60%);
  background-size: 260% 100%; animation: glint 4.5s ease-in-out infinite 1.4s; backface-visibility: hidden;
}
@keyframes glint { 0%, 55% { background-position: 120% 0; } 100% { background-position: -60% 0; } }
.hint {
  position: relative; font-family: var(--caps); font-size: 12px; letter-spacing: .32em; text-transform: uppercase;
  color: var(--gold); opacity: .85; animation: hint 2.4s ease-in-out infinite 1.4s, fadeIn 1s ease both .9s;
}
@keyframes hint { 0%, 100% { opacity: .45; } 50% { opacity: .95; } }
@keyframes fadeIn { from { opacity: 0; } }

.intro.opening .cover { transform: rotateY(-168deg); }
.intro.opening .book { transform: translateX(14%) scale(1.06); }
.intro.opening .hint { opacity: 0; transition: opacity .3s; animation: none; }
.intro.gone { opacity: 0; visibility: hidden; transform: scale(1.18); }

/* ───────── inside ───────── */
.inside { position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease .1s; }
.inside.on { opacity: 1; }
.pager {
  position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.pager::-webkit-scrollbar { display: none; }
.page { flex: 0 0 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; padding: 14px 14px 64px; position: relative; }
.sheet {
  position: relative; height: 100%; border-radius: 6px; overflow: hidden auto; scrollbar-width: none;
  background-color: var(--paper); background-image: var(--guil-bg);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(120, 90, 60, .18), inset 14px 0 18px -14px rgba(90, 60, 40, .35);
  padding: 26px 22px 30px;
}
.sheet::-webkit-scrollbar { display: none; }
.sheet::before { /* faint rosette watermark */
  content: ''; position: absolute; left: 50%; top: 50%; width: 360px; height: 360px; transform: translate(-50%, -50%);
  background-image: var(--rosette); background-size: contain; background-repeat: no-repeat; opacity: .8; pointer-events: none;
}
.sheet > * { position: relative; }
.pno { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-family: var(--mono); font-size: 10px; letter-spacing: .3em; color: rgba(43, 36, 48, .45); }
.perf { position: absolute; top: 14px; right: 12px; font-family: var(--mono); font-size: 9px; letter-spacing: .2em; color: rgba(43, 36, 48, .35); writing-mode: vertical-rl; }

.kicker { font-family: var(--caps); font-size: 10.5px; letter-spacing: .34em; text-transform: uppercase; color: var(--cover); }
.title { font-family: var(--caps); font-weight: 500; font-size: 26px; letter-spacing: .14em; text-transform: uppercase; margin: 6px 0 14px; line-height: 1.15; }
.lead { font-size: 19px; line-height: 1.5; font-style: italic; }
.rule { height: 1px; background: linear-gradient(90deg, transparent, rgba(91, 21, 38, .45), transparent); margin: 16px 0; }

/* data page */
.dp-head { display: flex; justify-content: space-between; align-items: flex-start; }
.dp-head .kicker { font-size: 9.5px; }
.dp-head .doc { font-family: var(--mono); font-size: 10px; text-align: right; line-height: 1.5; color: rgba(43, 36, 48, .7); }
.dp-head .doc b { font-weight: 500; color: var(--ink); font-size: 12px; letter-spacing: .08em; }
.dp-title { font-family: var(--caps); font-size: 15px; letter-spacing: .22em; margin: 8px 0 16px; color: var(--cover); }
.dp-body { display: grid; grid-template-columns: 42% 1fr; gap: 14px; align-items: start; }
.photo {
  position: relative; aspect-ratio: 3.5 / 4.5; border-radius: 3px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(43, 36, 48, .25), 0 3px 8px rgba(0, 0, 0, .15);
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.92) contrast(1.03); }
.holo {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light; opacity: .5; /* color-dodge smears a rainbow in Safari */
  background:
    repeating-radial-gradient(circle at 30% 40%, transparent 0 7px, rgba(255, 255, 255, .08) 8px 9px),
    linear-gradient(115deg, transparent 20%, rgba(255, 0, 170, .35) 32%, rgba(0, 220, 255, .38) 44%, rgba(120, 255, 120, .32) 56%, rgba(255, 220, 0, .35) 68%, transparent 80%);
  background-size: 100% 100%, 250% 250%;
  background-position: 0 0, var(--hx, 50%) var(--hy, 50%);
  transition: background-position .25s linear;
}
.holo::after { /* holographic monogram */
  content: attr(data-mono); position: absolute; right: 6px; bottom: 4px; font-family: var(--script); font-size: 34px; color: rgba(255, 255, 255, .5);
}
.holo.idle { animation: holoIdle 6s ease-in-out infinite alternate; }
@keyframes holoIdle { from { background-position: 0 0, 10% 30%; } to { background-position: 0 0, 90% 70%; } }
.fields { display: grid; gap: 7px; }
.field small { display: block; font-family: var(--caps); font-size: 7.5px; letter-spacing: .18em; text-transform: uppercase; color: rgba(43, 36, 48, .55); }
.field span { font-family: var(--mono); font-size: 10.8px; font-weight: 500; letter-spacing: .04em; line-height: 1.25; }
.sign { margin-top: 14px; display: flex; align-items: flex-end; gap: 12px; }
.sign small { font-family: var(--caps); font-size: 7.5px; letter-spacing: .18em; text-transform: uppercase; color: rgba(43, 36, 48, .55); }
.sign .sig { font-family: var(--script); font-size: 30px; color: #1f2b5a; line-height: 1; transform: rotate(-4deg); }
.mrz {
  margin-top: 18px; padding: 10px 6px 8px; background: rgba(255, 255, 255, .55); border-radius: 2px;
  font-family: var(--mono); font-size: clamp(8.4px, 2.6vw, 11px); letter-spacing: .06em; line-height: 1.55; white-space: pre; overflow: hidden; color: #1d1a22;
}
.dp-foot { position: relative; height: 170px; margin-top: 10px; }
.big-rosette { position: absolute; left: 50%; top: 0; width: 170px; height: 170px; transform: translateX(-50%); background: var(--rosette-strong) center / contain no-repeat; opacity: .5; }
.dp-stamp { position: absolute; left: 50%; top: 20px; margin-left: -70px; }
.teaser { position: absolute; inset: 12% 10% auto 14%; }
.t-k { font-family: var(--caps); font-size: 8px; letter-spacing: .25em; color: var(--cover); opacity: .7; }
.t-row { display: flex; gap: 8px; margin-top: 8px; }
.t-row img { width: 42%; aspect-ratio: 3.5 / 4.5; object-fit: cover; opacity: .9; }
.t-lines { flex: 1; display: grid; gap: 9px; align-content: start; padding-top: 4px; }
.t-lines i { display: block; height: 4px; border-radius: 2px; background: rgba(43, 36, 48, .22); }
.t-lines i:nth-child(odd) { width: 70%; }
.t-mrz { margin-top: 14px; height: 22px; background: repeating-linear-gradient(90deg, rgba(43, 36, 48, .28) 0 3px, transparent 3px 5px); opacity: .6; }

/* visa pages */
.visa-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--caps); font-size: 10px; letter-spacing: .3em; color: rgba(43, 36, 48, .55); padding-bottom: 10px; border-bottom: 1px dashed rgba(43, 36, 48, .25); margin-bottom: 18px; }
.stamp-slot { display: flex; justify-content: center; margin: 22px 0 6px; min-height: 160px; }
.stamp { width: 190px; opacity: 0; transform-origin: 50% 50%; }
.stamp svg { width: 100%; height: auto; display: block; filter: url(#ink); }
.stamp.wide { width: 270px; }
.stamp.small { width: 140px; }
.stamp.side { position: absolute; right: 8px; width: 120px; }

.cd { display: flex; justify-content: center; gap: 4px; }
.itin { list-style: none; margin-top: 6px; }
.itin li { display: grid; grid-template-columns: 78px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px dotted rgba(43, 36, 48, .25); }
.itin time { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--cover); padding-top: 2px; }
.itin b { font-family: var(--caps); font-weight: 500; font-size: 13px; letter-spacing: .12em; display: block; }
.itin span { font-size: 16px; font-style: italic; opacity: .8; }

.entry-card {
  margin: 4px auto 0; width: 82%; background: #fff; padding: 8px 8px 12px; transform: rotate(-2deg);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
}
.entry-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.entry-card p { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-align: center; margin-top: 8px; }
.addr { font-size: 19px; line-height: 1.4; text-align: center; margin-top: 14px; }
.venue { font-family: var(--caps); font-size: 24px; letter-spacing: .18em; text-align: center; margin-top: 16px; }
.center { text-align: center; }
.palette { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.palette span { width: 30px; height: 30px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(43, 36, 48, .2), inset 0 -3px 6px rgba(0, 0, 0, .15); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px;
  padding: 13px 24px; border-radius: 999px; font-family: var(--caps); font-size: 11px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--paper); background: linear-gradient(160deg, var(--cover), var(--cover-deep)); text-decoration: none;
  box-shadow: 0 6px 16px rgba(46, 8, 18, .35), inset 0 0 0 1px rgba(217, 184, 108, .5);
}
.btn.ghost { background: transparent; color: var(--cover); box-shadow: inset 0 0 0 1px rgba(91, 21, 38, .55); }
.btn:active { transform: scale(.97); }
.btns { display: flex; flex-direction: column; align-items: center; }
.sigline { font-family: var(--script); font-size: 34px; color: var(--cover); text-align: center; margin-top: 18px; }

/* nav */
.nav {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 14px; padding: 6px 10px; border-radius: 999px;
  background: rgba(20, 4, 10, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--gold); box-shadow: inset 0 0 0 1px rgba(217, 184, 108, .3);
}
.nav .arrow { width: 34px; height: 34px; border-radius: 50%; font-size: 16px; color: var(--gold); }
.nav .arrow:disabled { opacity: .3; }
.count { font-family: var(--mono); font-size: 12px; letter-spacing: .2em; min-width: 66px; text-align: center; }
.swipe-hint {
  position: absolute; left: 0; right: 0; bottom: 96px; text-align: center; font-family: var(--caps); font-size: 10px; letter-spacing: .3em;
  color: var(--cover); text-transform: uppercase; opacity: 0; pointer-events: none; transition: opacity .6s;
}
.swipe-hint.show { opacity: .85; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(10px); } }

.music-btn { position: fixed; top: 14px; right: max(14px, calc(50vw - 226px)); z-index: 30; width: 38px; height: 38px; border-radius: 50%; color: var(--gold); background: rgba(20, 4, 10, .5); box-shadow: inset 0 0 0 1px rgba(217, 184, 108, .4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .holo { transition: none; }
}

/* polish: legible swipe hint + compact footer on short phones */
.swipe-hint { left: 50%; right: auto; width: max-content; transform: translateX(-50%); padding: 7px 14px; border-radius: 999px; background: rgba(243, 234, 216, .92); box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
@keyframes nudge { 0%, 100% { transform: translateX(-50%); } 50% { transform: translateX(calc(-50% + 10px)); } }
@media (max-height: 720px) {
  .dp-foot { height: 128px; }
  .big-rosette { width: 128px; height: 128px; }
  .dp-stamp { top: 0; }
  .sheet { padding: 20px 18px 26px; }
}
button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
