/* ───────── Catalog: coverflow strip + 3D book viewer ───────── */

/* ── On the profile ── */
.cat { display: grid; gap: 6px; }
.cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cat-head h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.5rem, 6vw, 1.9rem); line-height: 1.3; color: var(--txt, #F4F3FF); text-wrap: balance; }
.cat-count { color: var(--txt-2, #B8B5E3); font-size: .82rem; font-weight: 700; white-space: nowrap; }
.cat-flow {
  display: flex; overflow-x: auto; overflow-y: visible; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -18px; padding: 26px 27% 34px; perspective: 1000px; perspective-origin: 50% 45%;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.cat-flow::-webkit-scrollbar { display: none; }
.cat-item {
  position: relative; flex: 0 0 46%; margin-inline: -2.5%; scroll-snap-align: center; aspect-ratio: 3 / 4;
  border-radius: 16px; overflow: hidden; background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none;
  box-shadow: 0 34px 50px -24px rgba(0, 0, 0, .9), inset 0 0 0 1px rgba(255, 255, 255, .12);
  -webkit-tap-highlight-color: transparent; will-change: transform;
}
/* Size the strip from the section's width (padding percentages and flex percentages measure different boxes). */
@supports (width: 1cqw) {
  .cat { container-type: inline-size; --iw: min(46cqw, 230px); }
  .cat-flow { padding-inline: calc(50cqw + 18px - var(--iw) / 2); }
  .cat-item { flex-basis: var(--iw); margin-inline: calc(var(--iw) * -.06); }
}
.cat-item::after { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(115deg, rgba(255, 255, 255, .2), transparent 32%); pointer-events: none; }
.cat-n { position: absolute; z-index: 2; bottom: 10px; right: 10px; padding: 1px 9px; border-radius: 999px; background: rgba(7, 6, 26, .6); font-size: .75rem; font-weight: 800; }
.cat-item:focus-visible { outline: 3px solid rgba(var(--ring-rgb), .9); outline-offset: 3px; }
.cat-open {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; border-radius: 18px;
  text-decoration: none; color: #F4F3FF; font-weight: 800;
  background: linear-gradient(120deg, rgba(var(--h1-rgb), .45), rgba(var(--h2-rgb), .25));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 20px 40px -24px rgba(var(--h1-rgb), .9);
}
.cat-open .i { width: 22px; height: 22px; color: rgb(var(--ring-rgb)); }
/* Light page: the strip's shadows soften and the button takes the card's own colours. */
.mode-light .cat-item { box-shadow: 0 30px 44px -26px rgba(23, 21, 58, .55), inset 0 0 0 1px rgba(23, 21, 58, .08); }
.mode-light .cat-open { color: var(--ht); background: linear-gradient(120deg, var(--h1), var(--h2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 20px 40px -22px rgba(var(--h1-rgb), .9); }
.mode-light .cat-open .i { color: currentColor; }

/* ── Viewer ── */
html.cv-lock, html.cv-lock body { overflow: hidden; }
.cv {
  position: fixed; inset: 0; z-index: 60; color: #F4F3FF;
  display: grid; grid-template-rows: auto minmax(0, 1fr) var(--info-h, auto) auto;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
  opacity: 0; transition: opacity .35s ease;
}
.cv.open { opacity: 1; }
.cv-sky { position: absolute; inset: 0; z-index: -1; background: radial-gradient(90% 60% at 50% 35%, rgba(var(--h1-rgb, 47, 43, 234), .35), transparent 70%), radial-gradient(70% 50% at 50% 110%, rgba(var(--ring-rgb, 18, 214, 195), .16), transparent 70%), rgba(7, 6, 26, .985); }
.cv-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.cv-heading { flex: 1; min-width: 0; display: grid; text-align: center; line-height: 1.5; }
.cv-heading strong { font-size: .95rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-count { font-size: .78rem; color: #B8B5E3; font-variant-numeric: tabular-nums; }
.cv-btn { width: 44px; height: 44px; border-radius: 14px; border: 0; display: grid; place-items: center; cursor: pointer; color: #F4F3FF; background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
.cv-btn[aria-pressed="true"] { background: rgba(var(--ring-rgb, 18, 214, 195), .25); }
.cv-btn:focus-visible, .cv-side:focus-visible, .cv-thumb:focus-visible { outline: 2px solid rgb(var(--ring-rgb, 18, 214, 195)); outline-offset: 2px; }

/* The stage keeps one size while pages turn; catalog.js places each page inside it in its own proportions. */
.cv-stage { position: relative; min-height: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
/* perspective lives on the book (not the stage) so the side buttons stay above the pages for taps */
.cv-book { position: absolute; inset: 8px 16px; perspective: 2200px; transform-style: preserve-3d; transition: transform .7s var(--ease-out), opacity .5s ease; }
.cv:not(.open) .cv-book { transform: perspective(1200px) translate3d(0, 50px, -200px) rotateX(22deg) scale(.88); opacity: 0; }
.cv-page, .cv-turn { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.cv-page, .cv-turn-front, .cv-turn-back { overflow: hidden; border-radius: 14px 4px 4px 14px; background: #FBFAFF; }
.cv-turn-front, .cv-turn-back { position: absolute; inset: 0; }
.cv-page { box-shadow: 0 40px 70px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .08); }
/* the spine: a soft fold along the right edge of every page */
.cv-page::after, .cv-turn-front::after { content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 18px; z-index: 3; pointer-events: none; background: linear-gradient(to left, rgba(0, 0, 0, .26), rgba(255, 255, 255, .08) 40%, transparent); }
.cv-content { position: absolute; inset: 0; transition: transform .35s var(--ease-out); }
.cv-under { z-index: 1; }
.cv-cur { z-index: 2; }
.cv-under-shade, .cv-turn-shade { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; }
.cv-under-shade { background: linear-gradient(to left, rgba(0, 0, 0, .55), transparent 55%); }
.cv-turn-shade { background: linear-gradient(to right, rgba(0, 0, 0, .55), rgba(0, 0, 0, .05) 70%, rgba(255, 255, 255, .15)); }
.cv-turn { z-index: 3; transform-origin: 100% 50%; transform-style: preserve-3d; }
.cv-turn-front, .cv-turn-back { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.cv-turn-front { box-shadow: -18px 0 40px -18px rgba(0, 0, 0, .7); }
.cv-turn-back { transform: rotateY(180deg); background: linear-gradient(to left, #D9D7EE, #F4F3FA 70%); border-radius: 4px 14px 14px 4px; }
.cv-turn-back i { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 22px, rgba(20, 18, 58, .04) 22px 23px); }
.cv.zoomed .cv-content { cursor: grab; transition: none; }
.cv.zoomed .cv-info, .cv.zoomed .cv-thumbs, .cv.zoomed .cv-side { opacity: 0; pointer-events: none; }

.cv-side {
  position: absolute; top: 50%; z-index: 5; width: 44px; height: 44px; margin-top: -22px; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: #F4F3FF; background: rgba(7, 6, 26, .55); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
  transition: opacity .3s ease, transform .3s var(--ease-spring);
}
.cv-side:active { transform: scale(.9); }
.cv-side-next { left: 6px; }
.cv-side-prev { right: 6px; }
@media (pointer: coarse) { .cv-side { opacity: .75; } }

.cv-info { padding: 6px 20px 4px; display: grid; gap: 6px; align-content: end; min-height: 0; overflow-y: auto; }
.cv-info.empty > * { visibility: hidden; }
.cv-info.swap > * { animation: info-in .55s var(--ease-out) backwards; }
.cv-info.swap > *:nth-child(2) { animation-delay: .05s; }
.cv-info.swap > *:nth-child(3) { animation-delay: .1s; }
@keyframes info-in { from { opacity: 0; transform: translateY(12px); } }
.cv-info-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cv-info-title { font-size: 1.05rem; font-weight: 800; line-height: 1.6; }
.cv-info-title:empty { display: none; }
.cv-price { flex: none; padding: 2px 12px; border-radius: 999px; background: #FFB020; color: #1A1206; font-weight: 900; font-size: .85rem; font-variant-numeric: tabular-nums; }
.cv-info-body { color: #B8B5E3; font-size: .875rem; line-height: 1.9; white-space: pre-line; }
.cv-info-body:empty { display: none; }
.cv-cta {
  display: flex; align-items: center; justify-content: center; min-height: 50px; margin-top: 4px; border-radius: 16px; text-decoration: none; font-weight: 800;
  color: #fff; background: linear-gradient(150deg, var(--h1, #2F2BEA), var(--h2, #6A2FE0)); box-shadow: 0 16px 30px -16px rgba(var(--h1-rgb, 47, 43, 234), .9);
}
.cv-cta-wa { background: linear-gradient(150deg, #1FAF5A, #128C7E); box-shadow: 0 16px 30px -16px rgba(31, 175, 90, .9); }

.cv-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px 14px; scrollbar-width: none; }
.cv-thumbs::-webkit-scrollbar { display: none; }
.cv-thumb { position: relative; flex: none; width: 48px; height: 64px; padding: 0; border: 0; border-radius: 9px; overflow: hidden; cursor: pointer; background: rgba(255, 255, 255, .06); opacity: .55; transition: opacity .25s ease, transform .35s var(--ease-spring); }
.cv-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cv-thumb span { position: absolute; bottom: 2px; right: 3px; font-size: .62rem; font-weight: 800; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.cv-thumb.on { opacity: 1; transform: translateY(-3px) scale(1.08); box-shadow: 0 0 0 2px rgb(var(--ring-rgb, 18, 214, 195)); }

@media (min-width: 900px) {
  .cv-book { inset: 10px 9vw; }
  .cv-info { max-width: max(var(--pw, 640px), 420px); margin: 0 auto; width: 100%; padding-inline: 0; }
  .cv-side { width: 56px; height: 56px; margin-top: -28px; }
  .cv-side-next { left: 4vw; }
  .cv-side-prev { right: 4vw; }
}

/* ── Standalone catalog page ── */
body.catalog-page { background: #07061A; color-scheme: dark; }
.catalog-page .cv { opacity: 1; }
