@charset "UTF-8";

/* =============================================================================
   Читалка журнала: разворот из двух страниц, перелистывание, свайпы, зум.
   Отдельный экран — своя шапка и тёмный фон, чтобы номер читался как журнал.
   ========================================================================== */

.reader {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  /* Колонка auto растянулась бы под натуральную ширину страницы журнала
     и утащила за собой панели. minmax(0,1fr) держит грид в размер экрана. */
  grid-template-columns: minmax(0, 1fr);
  background: #0E0D0C;
  color: #F2EDE7;
  font-family: var(--ui);
  z-index: 100;
}

.reader-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  background: rgba(0, 0, 0, .45);
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.reader-bar::-webkit-scrollbar { display: none; }
.reader-bar .reader-btn { flex: none; }
.reader-bar .title {
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.reader-bar .issue-date { font-size: 13px; color: rgba(255, 255, 255, .55); }
.reader-bar .spacer { margin-left: auto; }

.reader-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, .85);
  font-size: 13.5px;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.reader-btn svg { width: 16px; height: 16px; fill: currentColor; }
.reader-btn:hover:not(:disabled) { background: var(--red); border-color: var(--red); color: #fff; }
.reader-btn:disabled { opacity: .32; cursor: default; }

/* Сцена с разворотом.
   Размер задаёт не страница, а сцена: каждая половина занимает 50 % ширины,
   картинка вписывается в неё через object-fit и прижимается к корешку.
   Так разворот никогда не вылезает за экран и не растягивает страницу. */
.reader-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  padding: 20px 74px;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  touch-action: pan-y;
}

.spread {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  perspective: 2400px;
  transition: transform .25s var(--ease);
}

.spread .page {
  position: relative;
  display: flex;
  align-items: center;
  width: 50%;
  height: 100%;
  flex: none;
  min-width: 0;
}
.spread.single .page { width: 100%; justify-content: center; }
.spread .page.left { justify-content: flex-end; }
.spread .page.right { justify-content: flex-start; }

.spread .page img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  background: #1a1817;
  box-shadow: 0 24px 70px -24px rgba(0, 0, 0, .95);
}

/* тень у корешка — разворот выглядит как настоящий журнал */
.spread .page.left::after,
.spread .page.right::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 40px;
  pointer-events: none;
  z-index: 2;
}
.spread .page.left::after {
  right: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, .45), rgba(0, 0, 0, 0));
}
.spread .page.right::after {
  left: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, .45), rgba(0, 0, 0, 0));
}

/* анимация переворота */
.spread.turn-next .page.right { animation: turn-fwd .5s var(--ease); transform-origin: left center; }
.spread.turn-prev .page.left  { animation: turn-back .5s var(--ease); transform-origin: right center; }

@keyframes turn-fwd {
  0%   { transform: rotateY(0deg);   filter: brightness(1); }
  100% { transform: rotateY(-92deg); filter: brightness(.45); }
}
@keyframes turn-back {
  0%   { transform: rotateY(0deg);  filter: brightness(1); }
  100% { transform: rotateY(92deg); filter: brightness(.45); }
}

/* стрелки */
.reader-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(0, 0, 0, .5);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s var(--ease), opacity .2s var(--ease);
  z-index: 5;
}
.reader-nav svg { width: 20px; height: 20px; fill: currentColor; }
.reader-nav:hover:not(:disabled) { background: var(--red); border-color: var(--red); }
.reader-nav:disabled { opacity: .2; cursor: default; }
.reader-nav.prev { left: 16px; }
.reader-nav.next { right: 16px; }

/* нижняя панель: ползунок и миниатюры */
.reader-foot {
  border-top: 1px solid rgba(255, 255, 255, .1);
  background: rgba(0, 0, 0, .45);
  padding: 12px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.reader-progress { display: flex; align-items: center; gap: 14px; }
.reader-progress input[type="range"] {
  flex: 1;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
  cursor: pointer;
}
.reader-progress input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #fff;
}
.reader-progress input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #fff;
}
.reader-counter {
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: rgba(255, 255, 255, .8);
}

.thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.thumbs button {
  flex: none;
  width: 46px;
  aspect-ratio: 210 / 297;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 2px;
  padding: 0;
  overflow: hidden;
  background: #1a1817;
  opacity: .55;
  transition: opacity .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.thumbs button img { width: 100%; height: 100%; object-fit: cover; }
.thumbs button:hover { opacity: .9; transform: translateY(-2px); }
.thumbs button.is-current { opacity: 1; border-color: var(--red); }

.reader.is-zoomed .spread { cursor: zoom-out; }
.reader.is-zoomed .reader-stage { overflow: auto; }
.reader:not(.is-zoomed) .spread { cursor: zoom-in; }

@media (max-width: 820px) {
  .reader-stage { padding: 14px 48px; }
  .reader-nav { width: 42px; height: 42px; }
  .reader-nav.prev { left: 6px; }
  .reader-nav.next { right: 6px; }
  .thumbs { display: none; }
  .reader-bar .issue-date { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .spread.turn-next .page.right,
  .spread.turn-prev .page.left { animation: none; }
}
