/* =====================================================================
   KAIJU — мир, остановка «О создателях»: бумажная лента-раскадровка (REDESIGN-30).
   Разметка — секция #founders в world.html, поведение — js/world/world-founders.js.
   Переменные от world.js: --ph (высота куска), --adv (отрезок прокрутки куска), --hold (закрепление, px),
   класс .is-held — блок закреплён (компьютер). Шрифты мира: Montserrat 500/600, Unbounded 600, Cousine.
   Без скруглений больше 2 px, без box-shadow и backdrop-filter: тень ленты — filter: drop-shadow.
   ===================================================================== */
.ws-fd {
  --wf-ink: #353535;
  --wf-ink-2: #5a3b4e;
  --wf-brick: #9d302b;
  --wf-paper-base: #fbe8ef;
  --wf-paper-edge: #ead5de; /* край ленты: бумага на 6 % темнее */
  --wf-shade: drop-shadow(-7px 8px 12px rgba(107, 78, 134, 0.38));
  --wf-gap: 24px;
  --wf-pad: 32px;
  --wf-ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* топоним — на снегу ниже нарисованной доски журнала, слева над лентой */
  --wf-title-y: calc(var(--ph, 960px) * 0.235);
  --wt-x: 17%;
  --wt-y: var(--wf-title-y);
}

/* ------------------------------ лента ------------------------------ */
.wf-reel {
  list-style: none;
  margin: 0;
  padding: 20px var(--wf-pad) 22px;
  background: var(--wf-paper, url("../img/world/assets/ui-paper-texture/1024-720.webp")) 0 0 / 480px 480px repeat, var(--wf-paper-base);
  border: 1px solid var(--wf-paper-edge);
  border-radius: 0;
  filter: var(--wf-shade);
  color: var(--wf-ink);
}

.wf-cell {
  display: grid;
  grid-template-rows: auto auto 1fr;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

/* кадр манги; пока кадра нет — рамка со скринтоном */
.wf-frame {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 2px solid var(--wf-ink);
  background:
    radial-gradient(circle, rgba(53, 53, 53, 0.16) 0.9px, transparent 1.1px) 0 0 / 6px 6px,
    linear-gradient(180deg, #f7f2ef, #ece4e6);
}

.wf-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wf-cap {
  margin: 0;
  max-width: 34ch;
  font: 500 15px/1.45 "Montserrat", sans-serif;
  color: var(--wf-ink);
  text-wrap: pretty;
}

.wf-nick {
  margin: -6px 0 0;
  font: 400 12px/1.3 "Cousine", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--wf-ink-2);
}

/* последнее поле: цитата Влады и «Читать полностью», без картинки */
.wf-cell--quote {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: 0 8px;
}

.wf-quote { margin: 0; }
.wf-quote blockquote { margin: 0; }
.wf-quote p {
  margin: 0;
  max-width: 24em;
  font: 600 26px/1.3 "Montserrat", sans-serif;
  color: var(--wf-ink);
  text-wrap: balance;
}
.wf-quote figcaption {
  margin-top: 12px;
  font: 400 12px/1.3 "Cousine", ui-monospace, monospace;
  color: var(--wf-ink-2);
}

.wf-more {
  align-self: flex-start;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--wf-ink);
  font: 600 14px/1 "Unbounded", "Montserrat", sans-serif;
  letter-spacing: 0.01em;
  text-decoration: underline;
  text-decoration-color: var(--wf-brick);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 6px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.16s ease-out, text-underline-offset 0.2s ease;
}
.wf-more:active { transform: scale(0.97); }
.wf-more:focus-visible { outline: 2px solid var(--wf-brick); outline-offset: 4px; }
@media (hover: hover) and (pointer: fine) {
  .wf-more:hover { text-underline-offset: 9px; }
}

/* ------------------------------ компьютер, закреплено: лента проезжает ------------------------------ */
/* обёртка = закрепление + отрезок куска: сцена стоит, пока картина стоит, и уезжает вместе с ней */
/* лента и топоним — над наклейками соседнего журнала, которые свисают в верх куска */
.ws-fd.is-held { z-index: 6; }
.ws-fd.is-held .wf-pin { height: calc(var(--hold, 0px) + var(--adv, 100vh)); }

.ws-fd.is-held .wf-scene {
  position: sticky;
  top: 0;
  height: var(--adv, 100vh);
}

.ws-fd.is-held {
  /* лента под топонимом; кадр 2:3 — сколько даёт экран, но не выше 60vh */
  /* кадр = min(60vh, экран − подписи − 140 px), но не меньше 440 px; лента прижата к низу экрана,
     топоним — над лентой (подписи с полями ленты ≈ 143 px, низ ленты в 28 px от края с учётом наклона) */
  --wf-fh: max(440px, min(60vh, calc(100vh - 240px)));
  --wf-top: calc(100vh - var(--wf-fh) - 171px);
  --wf-title-y: calc(var(--wf-top) - 62px);
  --wf-fw: calc(var(--wf-fh) * 2 / 3);
}

.ws-fd.is-held .wf-tilt {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: var(--wf-top);
  padding-left: 4%;
  rotate: -1deg;
}

.ws-fd.is-held .wf-enter { transform: translate3d(40vw, 0, 0); transition: transform 0.7s var(--wf-ease); }
.ws-fd.is-held.is-in .wf-enter { transform: none; }

.ws-fd.is-held .wf-reel {
  display: flex;
  align-items: stretch;
  gap: var(--wf-gap);
  width: max-content;
  will-change: transform;
}

.ws-fd.is-held .wf-cell { width: var(--wf-fw); }
.ws-fd.is-held .wf-cap { max-width: none; min-height: calc(15px * 1.45 * 3); }
.ws-fd.is-held .wf-cell--quote { width: calc(var(--wf-fw) * 2 + var(--wf-gap)); padding: 0 calc(var(--wf-gap) * 0.5); }

/* проезд: прогресс закрепления = сдвиг секции от верха экрана на --hold; где scroll-driven animations нет — JS */
@supports (animation-timeline: view()) and (view-timeline-name: --a) {
  .ws-fd { view-timeline-name: --wf; }
  .ws-fd.is-held .wf-reel {
    animation: wf-pan linear both;
    animation-timeline: --wf;
    animation-range: cover 100vh cover calc(100vh + var(--hold, 0px));
  }
}

@keyframes wf-pan {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(calc(-1 * var(--wf-travel, 0px)), 0, 0); }
}

/* ------------------------------ без закрепления (reduced-motion): сетка 3 + 2, цитата последней ------------------------------ */
.ws-fd:not(.is-held) .wf-pin { padding: calc(var(--wf-title-y) + 84px) 4% 64px; }
.ws-fd:not(.is-held) .wf-reel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px var(--wf-gap);
  max-width: 1040px;
}
.ws-fd:not(.is-held) .wf-quote p { font-size: 22px; }

/* ------------------------------ лист «Читать полностью» ------------------------------ */
.wf-sheet {
  width: min(640px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 36px 40px 28px;
  border: 1px solid var(--wf-paper-edge, #ead5de);
  border-radius: 0;
  background: var(--wf-paper, url("../img/world/assets/ui-paper-texture/1024-720.webp")) 0 0 / 480px 480px repeat, #fbe8ef;
  color: #353535;
  filter: drop-shadow(-7px 8px 12px rgba(107, 78, 134, 0.38));
  overscroll-behavior: contain;
  opacity: 1;
  transform: none;
  transition:
    opacity 0.16s ease-out,
    transform 0.16s ease-out,
    overlay 0.16s allow-discrete,
    display 0.16s allow-discrete;
}
.wf-sheet:not([open]) { opacity: 0; transform: translateY(12px); }
.wf-sheet[open] {
  transition-duration: 0.26s;
  transition-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
}
@starting-style {
  .wf-sheet[open] { opacity: 0; transform: translateY(24px); }
}

.wf-sheet::backdrop {
  background: rgba(43, 38, 80, 0.35);
  opacity: 1;
  transition: opacity 0.26s ease-out, overlay 0.26s allow-discrete, display 0.26s allow-discrete;
}
.wf-sheet:not([open])::backdrop { opacity: 0; transition-duration: 0.16s; }
@starting-style {
  .wf-sheet[open]::backdrop { opacity: 0; }
}

.wf-sheet-text p {
  margin: 0 0 14px;
  max-width: 62ch;
  font: 500 16px/1.6 "Montserrat", sans-serif;
  color: #353535;
}
.wf-sheet-text p:last-child { margin-bottom: 0; }

.wf-sheet-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

/* «Закрыть» — наклейка: розовый лист с белым краем */
.wf-close {
  min-height: 44px;
  padding: 0 18px;
  border: 3px solid #fff;
  border-radius: 2px;
  background: #fce8f1;
  color: #353535;
  font: 600 13px/1 "Unbounded", "Montserrat", sans-serif;
  letter-spacing: 0.01em;
  rotate: -2deg;
  filter: drop-shadow(-3px 5px 4px rgba(107, 78, 134, 0.34));
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.16s ease-out;
}
.wf-close:active { transform: scale(0.97); }
.wf-close:focus-visible { outline: 2px solid #9d302b; outline-offset: 3px; }

/* ------------------------------ телефон: лента горизонтально, свайп по кадрам ------------------------------
   Секция укладывается в свой отрезок куска m5 плюс высоту ленты: топоним, под ним лента во всю ширину экрана,
   кадр ~78vw, край следующего виден справа, поля 16 px; снап по кадрам. */
@media (max-width: 767px) {
  .ws-fd {
    /* верх куска — под нарисованным разворотом журнала: топоним по пустой площадке (slot patch) */
    --wf-title-y: max(calc(var(--ph, 585px) * 0.12), calc(var(--patch-y, 190px) + 14px));
    --wt-x: 16px;
    --wf-mw: 78vw;
  }
  .ws-fd:not(.is-held) .wf-pin { padding: calc(var(--wf-title-y) + 56px) 0 24px; }
  .ws-fd:not(.is-held) .wf-reel {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--wf-mw);
    grid-template-columns: none;
    gap: 16px;
    max-width: none;
    padding: 16px;
    border-width: 1px 0;
    background-attachment: local, local;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .ws-fd:not(.is-held) .wf-reel::-webkit-scrollbar { display: none; }
  .ws-fd:not(.is-held) .wf-cell { scroll-snap-align: start; scroll-snap-stop: always; }
  .wf-cap { max-width: none; min-height: calc(15px * 1.45 * 3); }
  .wf-cell--quote { padding: 0 4px; gap: 16px; }
  .ws-fd:not(.is-held) .wf-quote p { font-size: 20px; }
  .wf-sheet { padding: 28px 20px 20px; }
  .wf-sheet-text p { font-size: 15px; line-height: 1.55; }
}

/* ------------------------------ reduced-motion ------------------------------ */
@media all {
  .ws-fd .wf-enter { transform: none !important; transition: none; }
  .ws-fd .wf-reel { animation: none !important; transform: none !important; }
  .wf-sheet,
  .wf-sheet[open] { transform: none; transition: opacity 0.2s linear, overlay 0.2s allow-discrete, display 0.2s allow-discrete; }
  @starting-style {
    .wf-sheet[open] { transform: none; }
  }
  .wf-more,
  .wf-close { transition: none; }
}

/* 30.10 приёмка: «О создателях» напечатано на самой бумажной ленте, в верхнем поле — не лежит на доске журнала */
.ws-fd.is-held {
  --wf-top: calc(100vh - var(--wf-fh) - 171px - 44px);
  --wf-title-y: calc(var(--wf-top) + 16px);
  --wt-x: calc(4% + var(--wf-pad, 24px));
}
.ws-fd.is-held .wf-reel { padding-top: 64px; }
.ws-fd.is-held .wt { z-index: 4; --wt-rz: -1deg; transform: rotate(-1deg); }
