/* benevsky.tech — обложки проектов. Одна схема для всех (образец — первая обложка myAksay):
   слева окно браузера с компьютерной версией, справа телефон с другим, тоже красивым экраном.
   Яркий фон своего цвета, лёгкое парение, отклик на курсор, при наведении длинный экран прокручивается, по стеклу пробегает блик.
   Размеры — в cqw/cqh: обложка — контейнер, поэтому на телефоне композиция та же.
   Разметку собирает tools/covers-dm.py → content/covers/<проект>.html. */

.cv { position: relative; isolation: isolate; overflow: hidden; container-type: size; border-color: transparent; background: var(--b4, #111); --px: 0; --py: 0; }
.ph-cover.cv { aspect-ratio: 16 / 10.4; }
.cv:not(.is-vis) *, .cv:not(.is-vis) *::before, .cv:not(.is-vis) *::after { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) { .cv *, .cv *::before, .cv *::after { animation: none !important; transition: none !important; } }
.cv img { display: block; width: 100%; height: auto; object-fit: fill; }
/* без приближения при наведении: общее правило карточек увеличивает картинку, в обложках оно выключено */
.proj:hover .cv img { transform: none; }

/* фон: яркий цвет проекта, свет плывёт, сетка точек */
.dm { position: absolute; inset: 0; font-family: var(--font); color: #15161c;
  background: radial-gradient(70% 85% at 12% 6%, var(--b2), transparent 62%), radial-gradient(75% 90% at 98% 100%, var(--b3), transparent 64%), linear-gradient(145deg, var(--b1), var(--b4)); }
.dm::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1.3px); background-size: 3cqw 3cqw; -webkit-mask-image: radial-gradient(85% 85% at 50% 45%, #000, transparent); mask-image: radial-gradient(85% 85% at 50% 45%, #000, transparent); }
.dm-glow { position: absolute; left: 48cqw; top: 30cqh; width: 80cqw; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.08) 42%, transparent 66%); animation: dmGlow 14s ease-in-out infinite alternate; pointer-events: none; }
@keyframes dmGlow { to { transform: translate(-42%, -56%) scale(1.12); } }

/* устройства */
.dm-desk, .dm-phone { position: absolute; z-index: 2; translate: calc(var(--px) * var(--z, 1) * 1.4cqw) calc(var(--py) * var(--z, 1) * 1.4cqh); transition: translate 0.6s var(--ease), box-shadow 0.4s var(--ease); }
.dm-desk { --z: 1; left: 6cqw; top: 19cqh; width: 58cqw; border-radius: 1.8cqw; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 3cqw 6.5cqw -2cqw rgba(0, 0, 0, 0.5); animation: dmFloat 9s ease-in-out infinite; animation-delay: -4.5s; }
.dm-bar { display: flex; align-items: center; gap: 0.75cqw; height: 3.4cqw; padding: 0 1.5cqw; background: #f2f2f0; border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
.dm-bar i { flex: none; width: 1cqw; height: 1cqw; border-radius: 50%; background: rgba(0, 0, 0, 0.18); }
.dm-bar b { margin: 0 auto; padding: 0.35cqw 2.4cqw; border-radius: 100px; background: #fff; font-size: 1.25cqw; font-weight: 500; color: #6b6f7a; letter-spacing: 0; white-space: nowrap; }
.dm-desk.is-dark { background: #0f1117; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 3cqw 6.5cqw -2cqw rgba(0, 0, 0, 0.6); }
.dm-desk.is-dark .dm-bar { background: #171a22; border-color: rgba(255, 255, 255, 0.06); }
.dm-desk.is-dark .dm-bar i { background: rgba(255, 255, 255, 0.22); } .dm-desk.is-dark .dm-bar b { background: #232733; color: #a3a8b8; }
.dm-scr { position: relative; overflow: hidden; }
.dm-desk .dm-scr { aspect-ratio: 16 / 10; }
.dm-desk .dm-scr img { min-height: 100%; object-fit: cover; object-position: 50% 0; }
.dm-phone { --z: 2.2; right: 6cqw; top: 9cqh; height: 82cqh; aspect-ratio: 360 / 779; border-radius: 3.2cqw; overflow: hidden; background: #fff; box-shadow: 0 0 0 0.45cqw var(--ring, #fff), 0 0 0 calc(0.45cqw + 1px) rgba(0, 0, 0, 0.08), 0 3cqw 6.5cqw -2cqw rgba(0, 0, 0, 0.55); animation: dmFloat 9s ease-in-out infinite; }
.dm-phone.is-dark { background: #0b0c10; --ring: #1d2029; }
.dm-phone .dm-scr { height: 100%; }
.dm-phone .dm-scr img { height: 100%; object-fit: cover; object-position: 50% 0; }
@keyframes dmFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.6cqh); } }

/* при наведении длинный экран прокручивается; по стеклу проходит блик */
.dm-scr.is-long img { height: auto; min-height: 0; transition: transform 5s cubic-bezier(0.45, 0, 0.2, 1); }
@media (hover: hover) and (pointer: fine) {
  .proj:hover .dm-desk .dm-scr.is-long img { transform: translateY(calc(-100% + 36.25cqw)); }
  .proj:hover .dm-desk, .proj:hover .dm-phone { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75), 0 4cqw 8cqw -2cqw rgba(0, 0, 0, 0.55); }
}
/* Блик живёт внутри экрана устройства (.dm-scr), а не на всём устройстве.
   В Safari на iPhone скруглённый блок, который сам двигается (парение), не всегда обрезает выехавший за край блик:
   в покое (translateX(-120%)) он висел светлой полосой между компьютером и телефоном. Поэтому:
   1) экран обрезается маской — её Safari соблюдает (у самого устройства маску ставить нельзя: срежет рамку и тень);
   2) блик прозрачен всё время, кроме момента, когда идёт по экрану. */
.dm-scr { -webkit-mask-image: -webkit-radial-gradient(white, black); mask-image: radial-gradient(white, black); isolation: isolate; }
.dm-phone .dm-scr { border-radius: inherit; }
.dm-scr::after { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; background: linear-gradient(110deg, transparent 38%, rgba(255, 255, 255, 0.28) 50%, transparent 62%); transform: translateX(-120%); opacity: 0; animation: dmGlint 9s var(--ease) infinite; }
.dm-phone .dm-scr::after { animation-delay: 0.6s; }
@keyframes dmGlint { 0%, 72% { transform: translateX(-120%); opacity: 0; } 77% { opacity: 0; } 79% { opacity: 1; } 83% { opacity: 1; } 85% { opacity: 0; } 90%, 100% { transform: translateX(120%); opacity: 0; } }
/* вне экрана блик спрятан и сброшен, при появлении обложки (.is-vis) цикл начинается заново */
.cv:not(.is-vis) .dm-scr::after { animation: none; opacity: 0; }

/* два телефона рядом (продукт только мобильный): стоят ровно, парят и откликаются на курсор вместе */
.dm-phone.is-left { right: auto; left: 24cqw; }
.dm-phone.is-right { right: auto; left: 52cqw; }

/* палитры — у каждого свой яркий цвет */
.cv-bai { --b1: #2f4bff; --b2: #7c96ff; --b3: #8b5cff; --b4: #0b1166; }
.cv-sx { --b1: #ff7a2e; --b2: #ffc07a; --b3: #b8400f; --b4: #4a1804; }
.cv-mk { --b1: #ff6a1f; --b2: #ffd36b; --b3: #ff3d57; --b4: #e8341c; }
.cv-case { --b1: #12c283; --b2: #8bf5c8; --b3: #0a9aa0; --b4: #06603f; }
.cv-cg { --b1: #c13cff; --b2: #ff7ad1; --b3: #6d3cff; --b4: #3a0f7a; }
.cv-st { --b1: #2f8cff; --b2: #d8f0ff; --b3: #74c9ff; --b4: #1450c4; }
.cv-nv { --b1: #6e72ff; --b2: #b4c3ff; --b3: #e08bff; --b4: #5b45e0; }
.cv-tt { --b1: #ff3130; --b2: #ff9a5a; --b3: #ff3d8a; --b4: #c4001d; }
.cv-av { --b1: #23b86f; --b2: #c4f27a; --b3: #ffcf5c; --b4: #0e5a3c; }

/* ══ 01 · проекты: видны первые три карточки, остальные шесть — за большой плашкой «Показать ещё».
   Карточки прячет только этот CSS при классе .js (его ставит скрипт в <head>), поэтому без JS видны все девять, а плашки нет.
   Поведение — app.js, блок «проекты: первые три карточки…». ══ */
.pfold-wrap { display: none; }
.js .pfold-wrap { display: block; margin-top: 16px; }
.js .projects.is-fold:not(.is-open) > li:nth-child(n + 4) { display: none; }
/* раскрытые карточки выезжают по очереди (--k ставит app.js для появления сетки) */
.js .projects.is-open > li:nth-child(n + 4) { animation: pfoldIn 0.75s var(--ease) both; animation-delay: calc((var(--k, 3) - 3) * 70ms + 0.05s); }
@keyframes pfoldIn { from { opacity: 0; transform: translateY(26px) scale(0.97); } }
/* в две колонки третья карточка одна в ряду — стоит по центру, как одинокая последняя */
@media (max-width: 1060px) and (min-width: 721px) {
  .js .projects.is-fold:not(.is-open) > li:nth-child(3) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 8px); }
}
/* карточка Benevsky Space — последняя в списке (site-kit.mjs → spaceCard): вход в блог, обложка — лента benevsky.space.
   В три колонки она одна в последнем ряду — стоит по центру; в две — в паре с Securix */
.cv-sp { --b1: #1d8fd6; --b2: #9fe4ff; --b3: #5a62f0; --b4: #0a1f4d; }
.proj .status.is-go { gap: 6px; }
@media (min-width: 1061px) { .projects > li:last-child:nth-child(3n + 1) { grid-column: 2; } }

/* плашка: слева «Другие проекты» (без числа: проектов больше, чем на сайте), названия и большая кнопка; справа по кругу листаются живые обложки скрытых проектов —
   клоны обложек из их карточек (app.js), того же формата и на том же месте, что обложка карточки над плашкой */
.pfold {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) calc((100% - 10px) / 3 - 22px); align-items: center; column-gap: 10px;
  padding: 10px; border: 1px solid var(--hair); border-radius: 28px; cursor: pointer;
  background: radial-gradient(50% 120% at 0% 100%, color-mix(in srgb, var(--g1) 7%, transparent), transparent 70%), var(--surface);
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.35s var(--ease), box-shadow 0.35s var(--ease), translate 0.35s var(--ease);
}
/* бегущий свет: по рамке плашки — при наведении, как у карточек; на кнопке — всегда, как у главных кнопок */
.pfold > .gr { padding: 2px; opacity: 0; transition: opacity 0.45s var(--ease); }
.pfold-go .gr { padding: 1.5px; }

.pfold-side { display: flex; flex-direction: column; align-items: flex-start; gap: 26px; padding: 14px 24px 14px 26px; }
.pfold-text { display: flex; flex-direction: column; gap: 10px; }
.pfold-h { display: block; font-size: clamp(28px, 2.6vw, 38px); font-weight: 500; line-height: 1.05; letter-spacing: -0.038em; color: var(--ink); }
.pfold-names { display: block; max-width: 34em; font-size: 16.5px; line-height: 1.5; letter-spacing: -0.01em; color: var(--muted); text-wrap: pretty; }

.pfold-go {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 60px; margin: 0; padding: 0 8px 0 26px; border: 0; border-radius: 100px; cursor: pointer;
  font-size: 16.5px; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; color: #fff;
  background: linear-gradient(115deg, var(--g1), color-mix(in srgb, var(--g1) 50%, var(--g3)) 60%, var(--g3));
  animation: pfoldGlow 4.8s ease-in-out infinite;
  transition: color 0.3s var(--ease), transform 0.25s var(--ease);
}
.pfold-go:active { transform: scale(0.98); }
.pfold-go:focus-visible { outline: 2px solid var(--hot-ink); outline-offset: 3px; border-radius: 100px; }
.pfold-go::after { content: ""; position: absolute; top: 0; bottom: 0; left: -70%; width: 45%; z-index: -1; pointer-events: none; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.32), transparent); transform: skewX(-18deg); }
.pfold-ic { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34); }
.pfold-ic svg { animation: pfoldNudge 2.6s var(--ease) infinite; transition: rotate 0.45s var(--ease); }
@keyframes pfoldGlow { 0%, 100% { box-shadow: 0 10px 26px -12px color-mix(in srgb, var(--g1) 80%, transparent); } 50% { box-shadow: 0 14px 32px -10px color-mix(in srgb, var(--g3) 80%, transparent); } }
@keyframes pfoldNudge { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(3px); } }

/* обложки: текущая на месте, прошлая уезжает влево, следующая ждёт справа (без перехода, за краем) */
.pfold-scene { position: relative; isolation: isolate; overflow: hidden; aspect-ratio: 16 / 10.4; border: 1px solid transparent; border-radius: 20px; background: var(--surface-2); }
.pfold-scene .pfold-cv { position: absolute; inset: 0; margin: 0; border: 0; border-radius: inherit; transform: translateX(0); transition: transform 1.2s cubic-bezier(0.6, 0, 0.2, 1); }
.pfold-scene .pfold-cv.is-prev { transform: translateX(calc(-100% - 14px)); }
.pfold-scene .pfold-cv.is-wait { transform: translateX(calc(100% + 14px)); visibility: hidden; transition: none; }

/* подпись: название проекта на обложке (без счётчика «1/6») */
.pfold-tag { position: absolute; z-index: 5; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px 5px 9px; border-radius: 100px; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--hair); box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.4); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.04em; line-height: 1.4; color: var(--ink); white-space: nowrap; pointer-events: none; }
.pfold-tag i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hot) 20%, transparent); }
.pfold-tag b { font-weight: 500; }
.pfold-tag.is-swap b { animation: pfoldTag 0.6s var(--ease); }
@keyframes pfoldTag { from { opacity: 0; transform: translateY(4px); } }

/* наведение — как у карточек: плашка приподнимается, светится рамка, обложка отвечает на курсор (параллакс — app.js) */
@media (hover: hover) and (pointer: fine) {
  .pfold:hover { translate: 0 -3px; border-color: color-mix(in srgb, var(--hot) 40%, transparent); box-shadow: 0 26px 60px -28px color-mix(in srgb, var(--g1) 55%, transparent), 0 10px 26px -18px color-mix(in srgb, var(--g3) 45%, transparent); }
  .pfold:hover > .gr { opacity: 1; }
  .pfold:hover .pfold-go::after { left: 130%; transition: left 0.9s var(--ease); }
  .pfold:hover .pfold-cv .dm-desk, .pfold:hover .pfold-cv .dm-phone { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75), 0 4cqw 8cqw -2cqw rgba(0, 0, 0, 0.55); }
}

/* раскрыто: та же плашка, но узкая — по центру «Свернуть» со стрелкой вверх */
.pfold.is-open { grid-template-columns: minmax(0, 1fr); justify-items: center; padding: 8px; background: var(--surface); }
.pfold.is-open .pfold-scene, .pfold.is-open .pfold-text { display: none; }
.pfold.is-open .pfold-side { padding: 0; }
.pfold.is-open .pfold-go { min-height: 52px; padding: 0 6px 0 22px; color: var(--ink); background: transparent; animation: none; box-shadow: none; }
.pfold.is-open .pfold-go::after { display: none; }
.pfold.is-open .pfold-ic { width: 40px; height: 40px; color: var(--hot-ink); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hair); }
.pfold.is-open .pfold-ic svg { rotate: 180deg; animation: none; }
.pfold.is-open .gr { opacity: 0; }
@media (hover: hover) and (pointer: fine) { .pfold.is-open:hover .pfold-go { color: var(--hot-ink); } }

/* две колонки карточек: обложка шириной в колонку, справа */
@media (max-width: 1060px) {
  .pfold { grid-template-columns: minmax(0, 1fr) calc((100% + 6px) / 2 - 22px); }
  .pfold-side { gap: 20px; padding: 12px 16px 12px 18px; }
  .pfold-h { font-size: 30px; }
  .pfold-names { font-size: 15.5px; }
}
/* телефон: обложка сверху во всю ширину, как в карточке, ниже текст и кнопка */
@media (max-width: 720px) {
  .js .pfold-wrap { margin-top: 14px; }
  .pfold { grid-template-columns: minmax(0, 1fr); border-radius: 24px; }
  .pfold-scene { order: -1; }
  .pfold-tag { left: 10px; bottom: 9px; padding: 4px 10px 4px 8px; font-size: 10.5px; }
  .pfold-side { align-items: stretch; gap: 18px; padding: 18px 8px 8px; }
  .pfold-text { gap: 8px; padding: 0 6px; }
  .pfold-h { font-size: 28px; }
  .pfold-names { font-size: 15px; }
  .pfold-go { min-height: 56px; padding-left: 22px; font-size: 16px; }
  .pfold-ic { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .js .projects.is-open > li:nth-child(n + 4) { animation: none; }
  .pfold, .pfold-go, .pfold-ic svg, .pfold .gr, .pfold-scene .pfold-cv { transition: none; }
  .pfold-go, .pfold-ic svg, .pfold-tag b { animation: none !important; }
}
@media print {
  .js .projects.is-fold > li { display: flex !important; }
  .pfold-wrap { display: none !important; }
}

/* ══ плавность (25.11.2026): экран, который ещё грузится, проявляется мягко, а не появляется рывком.
   Класс .is-ld ставит app.js только картинкам, которые к его запуску не загрузились; размеры у <img> заданы, макет не сдвигается ══ */
.cv img, .pj-deck-slide img { transition: opacity 0.45s var(--ease), transform 0.8s var(--ease); }
.dm-scr.is-long img { transition: transform 5s cubic-bezier(0.45, 0, 0.2, 1), opacity 0.45s var(--ease); }
.cv img.is-ld, .pj-deck-slide img.is-ld { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .pj-deck-slide img { transition: none; } }
