/* =========================================================================
   sections/playables.css · Playables v4 (Р73 + Р94–Р105)
   Сверху по центру крупный заголовок с пиксельными стрелками, ниже карусель из трёх карточек 9:16:
   центральная впереди (играет всегда), левая и правая под ней, выглядывают из-за неё (перекрытие ~40%, scale .86, бледнее),
   всегда внутри экрана. Движение только transform/opacity, 560 мс мягким ease; переход по кругу без призраков:
   следующая выезжает из-под центральной, старая уходит под неё на другую сторону (z-index ниже).
   Радиус везде 0. Размеры карточки (--ps-h, --ps-w) и вылет соседей (--ps-off) ставит stories.js по замеру окна.
   Заголовок: LoRes 21 Serif Regular 84 / 63 / 42, antialiased. Пиксельные пилюли из .px-pill страницы.
   ========================================================================= */
.ps {
    --ps-h: min(calc(100dvh - 300px), 760px);
    --ps-w: calc(var(--ps-h) * 9 / 16);
    --ps-off: calc(var(--ps-w) * 0.586);
    --ps-dur: 10s;
    --ps-meta: 60px;
    --ps-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- заголовок сверху по центру, по бокам пиксельные стрелки --------------------------------- */
.ps-head { display: flex; align-items: center; justify-content: center; gap: var(--s5, 48px); }
.ps .ps-title {
    margin: 0;
    text-align: center;
    font-family: var(--font-statement);
    font-weight: 400;
    font-synthesis: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: geometricPrecision;
    font-size: 84px;
    line-height: 1.1;
    letter-spacing: 0;
    color: var(--ink);
}
.ps .ps-title .hidden-coin { font-size: 0.3em; vertical-align: 0.5em; }
.ps-arrow {
    flex: none;
    display: inline-flex;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink-3);
    cursor: pointer;
    transition: color var(--dur-press, 140ms) var(--ease-out, ease-out), transform var(--dur-press, 140ms) var(--ease-out, ease-out);
}
@media (hover: hover) and (pointer: fine) { .ps-arrow:hover { color: var(--ink); } }
.ps-arrow:active { transform: scale(0.94); }
.ps-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
.ps-arrow svg { display: block; }

/* ---- сцена ----------------------------------------------------------------------------------------- */
.ps-stage {
    position: relative;
    height: calc(var(--ps-h) + var(--ps-meta));
    margin-top: var(--s4, 32px);
    overflow-x: clip;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}
.ps-track { position: absolute; inset: 0; }

.ps .ps-slide {
    --d: 0; --sc: 1;
    position: absolute;
    top: 0;
    left: 50%;
    width: var(--ps-w);
    margin-left: calc(var(--ps-w) / -2);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    opacity: 1;
    visibility: visible;                                      /* index.css прячет .playable без .is-active */
    z-index: 1;
    transform-origin: 50% calc(var(--ps-h) / 2);              /* соседи уменьшаются к центру карточки */
    transform: translateX(calc(var(--d) * var(--ps-off))) scale(var(--sc));
    transition: transform 560ms var(--ps-ease), opacity 560ms var(--ps-ease);
}
.ps .ps-slide.is-active { --d: 0;  --sc: 1;    opacity: 1;   z-index: 3; }
.ps .ps-slide.is-prev   { --d: -1; --sc: 0.86; opacity: 0.5; z-index: 1; cursor: pointer; }
.ps .ps-slide.is-next   { --d: 1;  --sc: 0.86; opacity: 0.5; z-index: 1; cursor: pointer; }
.ps .ps-slide.is-prev .playable-frame,
.ps .ps-slide.is-next .playable-frame { pointer-events: none; }
.ps .ps-slide:not(.is-active) .ps-act,
.ps .ps-slide:not(.is-active) .ps-cap,
.ps .ps-slide:not(.is-active) .ps-bar,
.ps .ps-slide:not(.is-active) .playable-launch { opacity: 0; pointer-events: none; }
.ps .ps-slide.is-active .playable-frame { cursor: pointer; }
.ps .ps-slide.is-live .playable-frame { cursor: auto; }

/* карточка: ровный прямоугольник, без рамки и тени; центральная в акценте (тонкий контур) */
.ps .playable-frame:not(.is-max):not(:fullscreen):not(:-webkit-full-screen) {
    width: 100%;
    height: var(--ps-h);
    aspect-ratio: 9 / 16;
    border-radius: 0;
    background: var(--play-bg);
    overflow: hidden;
    position: relative;
}
.ps .ps-slide.is-active .playable-frame:not(.is-max) { outline: 2px solid var(--accent); outline-offset: 0; }
.ps .ps-video,
.ps .playable-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: none;
    border-radius: 0;
}
.ps .ps-video { z-index: 1; }
.ps .playable.is-live .ps-video,
.ps .playable.is-live .playable-poster,
.ps .playable.is-live .ps-cap,
.ps .playable.is-live .ps-bar,
.ps .playable.is-live .playable-frame::after { display: none; }

/* поверх ролика внизу: название, одна строка, прогресс-бар */
.ps .playable-frame::after {
    content: "";
    position: absolute;
    z-index: 2;
    left: 0; right: 0; bottom: 0;
    height: 46%;
    pointer-events: none;
    background: linear-gradient(to top, color-mix(in srgb, var(--play-bg) 88%, transparent), transparent);
}
.ps .playable-frame.is-max::after,
.ps .playable-frame:fullscreen::after { display: none; }
.ps-cap { position: absolute; z-index: 3; left: 0; right: 0; bottom: 26px; padding: 0 16px; color: var(--paper-2); pointer-events: none; }
.ps .ps-name { margin: 0; font-family: var(--font-ui); font-size: 21px; font-weight: 600; line-height: 1.2; letter-spacing: var(--tr-display, -0.02em); color: var(--paper-2); }
.ps .ps-line { margin: 4px 0 0; font-family: var(--font-ui); font-size: 14px; line-height: 1.35; color: color-mix(in srgb, var(--paper-2) 82%, transparent); }
.ps-bar { position: absolute; z-index: 3; left: 16px; right: 16px; bottom: 14px; height: 3px; border-radius: 0; background: color-mix(in srgb, var(--paper-2) 34%, transparent); pointer-events: none; }
.ps-fill { position: absolute; inset: 0; border-radius: 0; background: var(--paper-2); transform: scaleX(0); transform-origin: 0 50%; }
.ps .ps-slide.is-active.is-run .ps-fill { animation: ps-fill var(--ps-dur) linear forwards; }
.ps.is-paused .ps-slide.is-active .ps-fill { animation-play-state: paused; }
@keyframes ps-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Play: пиксельная пилюля ПОВЕРХ центральной карточки, по центру */
.ps .playable-launch.px-pill,
.ps .playable-btn.px-pill {
    --pill-bg: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 var(--s4, 32px);
    border: 0;
    color: var(--paper-2);
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.ps .playable-launch.px-pill { position: absolute; z-index: 4; right: 16px; bottom: 28px; left: auto; top: auto; transform: none; }   /* Р153: в правый нижний угол, над полосой прогресса, не поверх сторис */
.ps .playable.is-live .playable-launch { display: none; }
@media (hover: hover) and (pointer: fine) {
    .ps .playable-launch.px-pill:hover { --pill-bg: var(--ink-2); }
    .ps .playable-btn.px-pill:hover { --pill-bg: color-mix(in srgb, var(--ink) 12%, var(--tint)); }
}
.ps .playable-launch:focus-visible,
.ps .playable-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ps .playable-launch.px-pill:active { transform: translate(-50%, -50%) scale(0.97); }
.ps .playable-btn.px-pill:active { transform: scale(0.97); }

/* под центральной карточкой: Restart / Fullscreen у запущенной игры */
.ps-act { display: grid; min-height: 44px; margin-top: var(--s2, 16px); transition: opacity 200ms var(--ps-ease); }
.ps .playable-bar { display: flex; gap: var(--s1, 8px); visibility: hidden; width: 100%; margin: 0; }
.ps .playable.is-live .playable-bar { visibility: visible; }
.ps .playable-btn.px-pill { --pill-bg: var(--tint); flex: 1 1 0; min-width: 0; color: var(--ink); padding: 0 var(--s1, 8px); }

/* ---- история крупно: полноэкранный просмотр ролика ------------------------------------------------- */
.ps-view {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--ink) 92%, transparent);
}
.ps-view[hidden] { display: none; }
.ps-view-video {
    height: min(100dvh - 48px, 1100px);
    width: calc(min(100dvh - 48px, 1100px) * 9 / 16);
    max-width: calc(100vw - 32px);
    object-fit: cover;
    background: var(--play-bg);
    border-radius: 0;
}
.ps-view-close {
    position: absolute;
    top: max(12px, var(--safe-t, 0px));
    right: max(12px, var(--safe-r, 0px));
    width: 44px; height: 44px;
    border: 0;
    border-radius: 0;
    background: var(--paper-2);
    color: var(--ink);
    font: 600 18px/1 var(--font-ui);
    cursor: pointer;
}
.ps-view-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* развёрнутая на весь экран игра (iOS-путь .is-max): предки не должны быть transform-контейнерами */
.has-max .ps .ps-slide,
.ps .ps-slide:has(.playable-frame.is-max) { transform: none !important; transition: none !important; opacity: 1 !important; }

/* ---- узкие экраны ------------------------------------------------------------------------------------ */
@media (max-width: 1199px) {
    .ps .ps-title { font-size: 63px; }
}
@media (max-width: 767px) {
    .ps-head { gap: var(--s3, 24px); }
    .ps .ps-title { font-size: 42px; }
    .ps-arrow svg { width: 20px; height: 36px; }
    .ps-stage { margin-top: var(--s3, 24px); }
}
@media (prefers-reduced-motion: reduce) {
    .ps .ps-slide, .ps-act, .ps-arrow { transition: none; }
    .ps .ps-slide.is-active.is-run .ps-fill { animation: none; transform: scaleX(1); }
}


/* Р109: стрелки у центральной карточки, проявляются при наведении на карусель (рисунок Роба) */
.ps-stage > .ps-arrow {
    position: absolute;
    top: 50%;
    z-index: 5;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 180ms var(--ease-out, ease-out);
    background: none;
    border: 0;
    padding: 12px;
    color: var(--ink);
    cursor: pointer;
}
.ps-stage > .ps-arrow-prev { left: calc(50% - var(--ps-w, 340px) / 2 - var(--ps-off, 200px) * 0.55 - 40px); }
.ps-stage > .ps-arrow-next { right: calc(50% - var(--ps-w, 340px) / 2 - var(--ps-off, 200px) * 0.55 - 40px); }
.ps-stage > .ps-arrow svg { width: 15px; height: 27px; }      /* 5×9 клеток по 3px */
.ps-stage:hover > .ps-arrow, .ps-stage > .ps-arrow:focus-visible { opacity: 1; }
.ps-stage > .ps-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ps-head { justify-content: center; }
@media (hover: none) { .ps-stage > .ps-arrow { display: none; } }

.ps-head .ps-arrow svg { width: 15px; height: 27px; }


/* ── Р116: вайб как в Projects — воздух, мельче, без синей обводки, тихие тени, соседи в сером ── */
.ps-head { margin: 72px 0 56px; }
.ps .ps-title { font-size: 84px; line-height: 88px; letter-spacing: -4px; font-weight: 400; font-synthesis: none; }
.ps .ps-slide.is-active .playable-frame:not(.is-max) { outline: none; }
.ps .ps-slide .playable-frame { box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 8%, transparent), 0 18px 40px -26px color-mix(in srgb, var(--ink) 55%, transparent); }
.ps .ps-slide.is-prev, .ps .ps-slide.is-next { opacity: 0.55; filter: grayscale(1) contrast(0.9); }
.ps .ps-slide .ps-cap { display: none; }                         /* подпись переехала в сноску под каруселью */
.ps-note {
    display: grid;
    justify-items: center;
    gap: 6px;
    margin: 40px auto 120px;
    text-align: center;
}
.ps-note-i { font: 400 12px/1 var(--font-label, var(--font-mono, ui-monospace, monospace)); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ps-note-n {
    font: 400 36px/40px 'LoRes 12', var(--font-ui, 'Inter Tight', system-ui, sans-serif);
    letter-spacing: -3px; font-synthesis: none;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: geometricPrecision;
    color: var(--ink);
}
.ps-note-l { font: 400 16px/1.4 var(--font-ui, 'Inter Tight', system-ui, sans-serif); color: var(--ink-2); }
@media (max-width: 767px) {
    .ps-head { margin: 40px 0 32px; }
    .ps .ps-title { font-size: 42px; line-height: 48px; letter-spacing: -2px; }
    .ps-note { margin: 28px auto 72px; }
    .ps-note-n { font-size: 24px; line-height: 28px; letter-spacing: -2px; }
}
@media (prefers-reduced-motion: reduce) { .ps .ps-slide.is-prev, .ps .ps-slide.is-next { filter: grayscale(1); } }

/* Р120: соседи в своих цветах, но очень прозрачные (12%) — без серого */
.ps .ps-slide.is-prev, .ps .ps-slide.is-next { opacity: 0.12 !important; filter: none !important; }
@media (hover: hover) and (pointer: fine) { .ps .ps-slide.is-prev:hover, .ps .ps-slide.is-next:hover { opacity: 0.3 !important; } }

/* Р121: подпись игры на шаг ближе к карусели */
.ps-note { margin-top: calc(20px - var(--ps-meta, 60px)) !important; position: relative; z-index: 4; }   /* место под Restart/Fullscreen пустует, пока игра не запущена */
.ps.is-live .ps-note { visibility: hidden; }

/* аудит №11: мишени ≥ 44px — стрелки карусели и Play */
.ps-arrow { min-width: 44px; min-height: 44px; }
.ps .playable-launch.px-pill { min-height: 44px; min-width: 64px; }
