/* Online catalog viewer: book mode with page transitions, scroll mode, thumbnails, TOC drawer and share sheet */
@import url('/fonts/fonts.css');

:root {
  --ui-bg: #0c1424; --ui-bg-2: #141e33; --ui-fg: #e8edf5; --ui-muted: #8d9ab0; --ui-line: rgba(255,255,255,.09);
  --ui-accent: #f36b21; --bar-h: 60px; --foot-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: radial-gradient(120% 90% at 50% 0%, #1b2a47 0%, #0c1424 55%, #080d18 100%); color: var(--ui-fg); font-family: 'Yekan Bakh', 'Peyda', system-ui, sans-serif; overflow: hidden; -webkit-font-smoothing: antialiased; }
body.is-scroll { overflow: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
svg.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[dir=rtl] .flip-rtl { transform: scaleX(-1); }

/* top bar */
.vw-bar { position: fixed; inset-inline: 0; top: 0; height: var(--bar-h); display: flex; align-items: center; gap: 14px; padding-inline: 18px; z-index: 30; background: linear-gradient(180deg, rgba(8,13,24,.92), rgba(8,13,24,.6)); backdrop-filter: blur(14px); border-bottom: 1px solid var(--ui-line); }
.vw-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.vw-brand .mk { width: 34px; height: 34px; border-radius: 10px; background: #fff; display: grid; place-items: center; flex: none; --logo-light: #0b1f3a; --logo-accent: #f36b21; }
.vw-brand .mk svg { width: 24px; height: 24px; }
.vw-brand b { display: block; font-family: 'Peyda'; font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 36vw; }
.vw-brand small { display: block; color: var(--ui-muted); font-size: 12px; }
.vw-sp { flex: 1; }
.vw-tools { display: flex; align-items: center; gap: 6px; }
.vw-btn { height: 38px; min-width: 38px; padding-inline: 10px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--ui-fg); transition: background .2s, color .2s; font-size: 13.5px; white-space: nowrap; }
.vw-btn:hover, .vw-btn.on { background: rgba(255,255,255,.08); }
.vw-btn.primary { background: var(--ui-accent); color: #fff; padding-inline: 16px; font-weight: 700; }
.vw-btn.primary:hover { background: #ff7a30; }
.vw-langs { display: flex; gap: 2px; background: rgba(255,255,255,.05); border-radius: 11px; padding: 3px; }
.vw-langs a { padding: 5px 10px; border-radius: 8px; font-size: 12.5px; color: var(--ui-muted); }
.vw-langs a.on { background: #fff; color: #0c1424; font-weight: 700; }
.vw-sep { width: 1px; height: 24px; background: var(--ui-line); margin-inline: 4px; }

/* stage */
.vw-stage { position: fixed; inset: var(--bar-h) 0 var(--foot-h); perspective: 2400px; }
.vw-slot { position: absolute; left: 50%; top: 50%; translate: -50% -50%; will-change: transform, opacity; transform-style: preserve-3d; backface-visibility: hidden; }
.vw-spread { position: absolute; top: 0; left: 0; display: flex; transform-origin: 0 0; filter: drop-shadow(0 24px 40px rgba(0,0,0,.45)); }
.vw-spread .cat-page { flex: none; }
.vw-spread.two .cat-page:first-child { box-shadow: inset -14px 0 22px -18px rgba(0,0,0,.35); }
[dir=rtl] .vw-spread.two .cat-page:first-child, .vw-spread.two .cat-page:first-child:dir(rtl) { box-shadow: inset 14px 0 22px -18px rgba(0,0,0,.35); }
.vw-spread.two::after { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; translate: -1px 0; background: linear-gradient(90deg, rgba(0,0,0,.18), rgba(255,255,255,.12), rgba(0,0,0,.18)); pointer-events: none; z-index: 5; }
.vw-nav { position: fixed; top: 50%; translate: 0 -50%; z-index: 20; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.08); backdrop-filter: blur(8px); transition: background .2s, opacity .2s, scale .2s; }
.vw-nav:hover { background: var(--ui-accent); scale: 1.06; }
.vw-nav[disabled] { opacity: 0; pointer-events: none; }
.vw-nav.prev { inset-inline-start: 18px; }
.vw-nav.next { inset-inline-end: 18px; }
.vw-nav svg { width: 22px; height: 22px; }

/* footer: progress + page counter + thumbnails toggle */
.vw-foot { position: fixed; inset-inline: 0; bottom: 0; height: var(--foot-h); display: flex; align-items: center; gap: 16px; padding-inline: 22px; z-index: 30; }
.vw-progress { flex: 1; height: 4px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; position: relative; cursor: pointer; }
.vw-progress i { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; background: linear-gradient(90deg, var(--ui-accent), #ffb37d); border-radius: 4px; transition: width .5s cubic-bezier(.2,.75,.25,1); }
.vw-count { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ui-muted); min-width: 64px; text-align: center; }
.vw-count b { color: var(--ui-fg); }

/* thumbnails tray */
.vw-tray { position: fixed; inset-inline: 0; bottom: var(--foot-h); z-index: 25; padding: 14px 18px; background: linear-gradient(0deg, rgba(8,13,24,.96), rgba(8,13,24,.82)); backdrop-filter: blur(14px); border-top: 1px solid var(--ui-line); display: flex; gap: 12px; overflow-x: auto; translate: 0 110%; transition: translate .45s cubic-bezier(.2,.75,.25,1); scrollbar-width: thin; }
.vw-tray.open { translate: 0 0; }
.vw-th { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ui-muted); }
.vw-th .box { position: relative; overflow: hidden; border-radius: 4px; outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .2s, translate .2s; background: #fff; }
.vw-th:hover .box { translate: 0 -3px; }
.vw-th.on .box { outline-color: var(--ui-accent); }
.vw-th.on { color: var(--ui-fg); }
.vw-th .box > .cat-page { position: absolute; top: 0; left: 0; transform-origin: 0 0; pointer-events: none; }

/* drawers & sheets */
.vw-scrim { position: fixed; inset: 0; background: rgba(4,8,16,.55); backdrop-filter: blur(3px); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .3s; }
.vw-scrim.open { opacity: 1; pointer-events: auto; }
.vw-drawer { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(380px, 88vw); z-index: 41; background: #0f182b; border-inline-end: 1px solid var(--ui-line); padding: 22px 20px; overflow-y: auto; translate: -105% 0; transition: translate .45s cubic-bezier(.2,.75,.25,1); }
[dir=rtl] .vw-drawer { translate: 105% 0; }
.vw-drawer.open { translate: 0 0 !important; }
.vw-drawer h3 { font-family: 'Peyda'; font-size: 19px; margin: 0 0 4px; }
.vw-drawer p.sub { color: var(--ui-muted); font-size: 13px; margin: 0 0 18px; }
.vw-toc a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; transition: background .2s; }
.vw-toc a:hover { background: rgba(255,255,255,.05); }
.vw-toc a.on { background: rgba(243,107,33,.12); color: #ffb37d; }
.vw-toc .n { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.06); font-size: 12px; font-weight: 700; flex: none; }
.vw-toc .t { flex: 1; font-size: 14px; }
.vw-toc .p { color: var(--ui-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.vw-drawer .x, .vw-sheet .x { position: absolute; top: 16px; inset-inline-end: 16px; }

.vw-sheet { position: fixed; left: 50%; top: 50%; translate: -50% -46%; z-index: 41; width: min(460px, 92vw); background: #0f182b; border: 1px solid var(--ui-line); border-radius: 22px; padding: 26px; opacity: 0; pointer-events: none; transition: opacity .3s, translate .4s cubic-bezier(.2,.75,.25,1); box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.vw-sheet.open { opacity: 1; translate: -50% -50%; pointer-events: auto; }
.vw-sheet h3 { font-family: 'Peyda'; margin: 0 0 4px; font-size: 19px; }
.vw-sheet p.sub { color: var(--ui-muted); font-size: 13px; margin: 0 0 18px; }
.vw-qr { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center; }
.vw-qr .code { background: #fff; border-radius: 16px; padding: 10px; aspect-ratio: 1; display: grid; place-items: center; }
.vw-qr .code img { width: 100%; height: 100%; }
.vw-qr .acts { display: flex; flex-direction: column; gap: 8px; }
.vw-link { display: flex; gap: 8px; margin-top: 18px; background: rgba(255,255,255,.05); border: 1px solid var(--ui-line); border-radius: 12px; padding: 6px; }
.vw-link input { flex: 1; min-width: 0; background: none; border: 0; color: var(--ui-fg); font: inherit; font-size: 12.5px; padding-inline: 8px; direction: ltr; outline: none; }
.vw-share { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.vw-share a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 12px; background: rgba(255,255,255,.04); font-size: 12px; color: var(--ui-muted); transition: background .2s, color .2s; }
.vw-share a:hover { background: rgba(255,255,255,.08); color: var(--ui-fg); }
.vw-toast { position: fixed; left: 50%; bottom: calc(var(--foot-h) + 18px); translate: -50% 20px; z-index: 60; background: #fff; color: #0c1424; padding: 10px 18px; border-radius: 12px; font-size: 13.5px; font-weight: 600; opacity: 0; transition: opacity .3s, translate .3s; pointer-events: none; }
.vw-toast.show { opacity: 1; translate: -50% 0; }

/* scroll mode */
.vw-scroll { display: none; padding: calc(var(--bar-h) + 24px) 0 48px; flex-direction: column; align-items: center; gap: 26px; }
.is-scroll .vw-scroll { display: flex; }
.is-scroll .vw-stage, .is-scroll .vw-nav, .is-scroll .vw-foot, .is-scroll .vw-tray { display: none; }
.vw-sw { position: relative; overflow: hidden; border-radius: 3px; box-shadow: 0 18px 40px rgba(0,0,0,.4); flex: none; }
.vw-sw > .cat-page { position: absolute; top: 0; left: 0; transform-origin: 0 0; }

/* loading */
.vw-load { position: fixed; inset: 0; display: grid; place-items: center; z-index: 70; background: #0c1424; transition: opacity .5s, visibility .5s; }
.vw-load.done { opacity: 0; visibility: hidden; }
.vw-load .ring { width: 54px; height: 54px; border-radius: 50%; border: 3px solid rgba(255,255,255,.1); border-top-color: var(--ui-accent); animation: vw-spin 1s linear infinite; }
@keyframes vw-spin { to { rotate: 360deg; } }

.hide-sm { }
@media (max-width: 820px) {
  :root { --bar-h: 56px; }
  .hide-sm { display: none !important; }
  .vw-brand b { max-width: 46vw; font-size: 14px; }
  .vw-bar { gap: 6px; padding-inline: 10px; }
  .vw-nav { width: 42px; height: 42px; }
  .vw-nav.prev { inset-inline-start: 6px; } .vw-nav.next { inset-inline-end: 6px; }
}
@media print { body > *:not(#print) { display: none !important; } }
