/* Benevsky Space — свои детали поверх общей дизайн-системы (styles.css, covers.css, project.css, services.css — с сайта студии).
   Новое здесь: первый экран ленты, фильтр по темам, крупный «новый пост», миниатюра поста, обложки-фото, 3D-модель по кнопке,
   блок «Сайты Benevsky». Цвета — только токены --g*, --t*, --hot*; двигаются только transform и opacity. */

/* ══ шапка: «Студия ↗» ведёт на соседний сайт ══ */
.sp-ext { display: inline-block; margin-left: 2px; color: var(--hot-ink); font-size: 0.85em; }

/* ══ переливающийся градиент — для заголовков Space, как у h2 и финала ══ */
.sp-hero-h1 .hot, .sp-h1 .hot, .sp-feat-h .hot { display: block; color: var(--hot-ink); }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .sp-hero-h1 .hot, .sp-h1 .hot, .sp-feat-h .hot {
    background: linear-gradient(100deg, var(--t1) 0%, var(--t2) 28%, var(--t3) 52%, var(--t1) 78%) 0 50% / 220% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
    -webkit-box-decoration-break: clone; box-decoration-break: clone;
    animation: gText 10s ease-in-out infinite alternate;
  }
}

/* ══ первый экран ленты ══ */
.sp-hero { padding-bottom: 8px; }
.sp-hero .hero-pill { margin-top: 18px; }
.sp-hero-h1 { margin-top: 24px; max-width: 1100px; font-size: clamp(40px, 5.6vw, 84px); font-weight: 500; line-height: 1.02; letter-spacing: -0.05em; text-wrap: balance; }
.sp-hero-lede { max-width: 760px; margin-top: 26px; font-size: clamp(17px, 1.45vw, 20px); }
.sp-hero-facts { margin-top: 34px; display: inline-flex; flex-wrap: wrap; border: 1px solid var(--hair); border-radius: 20px; background: color-mix(in srgb, var(--surface) 70%, transparent); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.sp-hero-facts > div { display: flex; flex-direction: column; gap: 6px; padding: 14px 24px 16px; }
.sp-hero-facts > div + div { box-shadow: -1px 0 0 var(--hair); }
.sp-hero-facts dt { color: var(--hot-ink); font-size: 10.5px; }
.sp-hero-facts dd { font-size: 22px; font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

/* ══ новый пост — крупно: обложка слева, текст справа ══ */
.sp-feat-sec { margin-top: 56px; }
.sp-feat { position: relative; }
.sp-feat-link {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr); align-items: center; gap: 10px 8px;
  padding: 10px; border-radius: 32px; text-decoration: none; overflow: hidden; isolation: isolate;
  background: radial-gradient(60% 120% at 100% 0%, color-mix(in srgb, var(--g2) 9%, transparent), transparent 70%), var(--surface);
  border: 1px solid var(--hair); box-shadow: var(--shadow);
  transition: border-color 0.35s var(--ease), box-shadow 0.35s var(--ease), translate 0.35s var(--ease);
}
.sp-feat-cv .cv { aspect-ratio: 16 / 10.4; border-radius: 24px; }
.sp-feat-body { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; padding: 20px 26px 22px 30px; }
.sp-feat-h { font-size: clamp(30px, 3vw, 46px); font-weight: 500; line-height: 1.04; letter-spacing: -0.042em; text-wrap: balance; color: var(--ink); }
.sp-feat-lede { font-size: 17px; line-height: 1.55; letter-spacing: -0.01em; color: var(--muted); text-wrap: pretty; }
.sp-feat-go { margin-top: 6px; }
.sp-new { display: inline-flex; align-items: center; gap: 8px; color: var(--hot-ink); }
.sp-new .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hot) 18%, transparent); animation: spPulse 2.4s var(--ease) infinite; }
@keyframes spPulse { 50% { transform: scale(0.7); opacity: 0.6; } }
.sp-feat-link > .gr { padding: 2px; opacity: 0; transition: opacity 0.45s var(--ease); }
:root:not([data-theme="dark"]) .sp-feat-go { background: linear-gradient(115deg, var(--g1), color-mix(in srgb, var(--g1) 50%, var(--g3)) 60%, var(--g3)); color: #fff; }

/* ══ строка поста: № · тема — линия — дата ══ */
.sp-log { display: flex; align-items: center; gap: 10px; width: 100%; color: var(--muted); font-size: 10.5px; letter-spacing: 0.1em; }
.sp-log > i { flex: 1; min-width: 14px; height: 1px; background: var(--rule); }
.sp-log-t { color: var(--hot-ink); }
.sp-log time { white-space: nowrap; }

/* ══ что внутри поста: 3D, видео, снимки ══ */
.sp-media { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-media li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 8px; border-radius: 100px; background: var(--surface-2); border: 1px solid var(--hair); font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.sp-media svg { color: var(--hot-ink); }

/* ══ фильтр по темам ══ */
.sp-feed .sec-head { margin-bottom: 30px; }
.sp-topics { display: flex; flex-wrap: wrap; gap: 8px; scroll-margin-top: 110px; }
.sp-topic {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 8px 0 16px; border-radius: 100px; cursor: pointer;
  border: 1px solid var(--hair); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; font-weight: 500; letter-spacing: -0.01em;
  -webkit-tap-highlight-color: transparent; transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease), color 0.3s var(--ease), translate 0.3s var(--ease);
}
.sp-topic { text-decoration: none; }
.sp-topic svg { color: var(--hot-ink); transition: color 0.3s var(--ease); }
.sp-topic b { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 100px; background: var(--surface-2); font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted); }
.sp-topic.is-on { border-color: transparent; color: #fff; background: linear-gradient(115deg, var(--g1), color-mix(in srgb, var(--g1) 50%, var(--g3)) 60%, var(--g3)); box-shadow: 0 10px 26px -14px color-mix(in srgb, var(--g1) 80%, transparent); }
.sp-topic.is-on svg { color: #fff; }
.sp-topic.is-on b { background: rgba(255, 255, 255, 0.2); color: #fff; }
.sp-topic:focus-visible { outline: 2px solid var(--hot-ink); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .sp-topic:not(.is-on):hover { border-color: color-mix(in srgb, var(--hot) 45%, transparent); translate: 0 -2px; } }

/* ══ лента: карточки одного вида, 3 → 2 → 1 колонки ══ */
.sp-grid { margin-top: 26px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.sp-grid > li { display: flex; }
.sp-grid > li[hidden] { display: none; }
/* новый пост уже стоит крупно выше — в ленте он появляется, только когда выбрана тема */
.sp-grid:not(.is-filtered) > .is-lead { display: none; }
.sp-grid.is-swap > li { animation: spIn 0.6s var(--ease) both; animation-delay: calc(var(--k, 0) * 60ms); }
@keyframes spIn { from { opacity: 0; transform: translateY(18px); } }
.sp-empty { margin-top: 26px; font-size: 17px; }
.sp-more .sp-grid { margin-top: 0; }

/* ══ миниатюра поста ══ */
.sp-card {
  position: relative; flex: 1; display: flex; flex-direction: column; text-decoration: none; overflow: hidden; isolation: isolate;
  background: var(--surface); border: 1px solid var(--hair); border-radius: 28px;
  transition: border-color 0.35s var(--ease), box-shadow 0.35s var(--ease), translate 0.35s var(--ease);
}
.sp-card-cv { position: relative; margin: 10px 10px 0; }
.sp-card-cv .cv { aspect-ratio: 16 / 10.4; border-radius: 20px; }
/* номер и формат — прямо на обложке, на светлом стекле */
.sp-num, .sp-kind {
  position: absolute; z-index: 5; top: 12px; display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 100px;
  background: rgba(255, 255, 255, 0.86); color: #15161c; border: 1px solid rgba(255, 255, 255, 0.9); box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; line-height: 1.3; white-space: nowrap; pointer-events: none;
}
.sp-num { left: 12px; }
.sp-kind { right: 12px; max-width: calc(100% - 96px); overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }
.sp-kind svg { flex: none; }
.sp-kind svg { color: #15161c; opacity: 0.7; }
.sp-card-body { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 16px 22px 20px; }
.sp-card h3 { margin-top: 2px; font-size: clamp(23px, 1.9vw, 27px); font-weight: 500; line-height: 1.12; letter-spacing: -0.035em; text-wrap: balance; transition: color 0.3s var(--ease); }
.sp-card-lede { font-size: 15px; line-height: 1.55; color: var(--muted); text-wrap: pretty; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sp-card-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--hair); display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; }
.sp-go { color: var(--hot-ink); font-size: 11px; white-space: nowrap; }
.sp-go span { display: inline-block; transition: transform 0.3s var(--ease); }
.sp-card > .gr { padding: 2px; opacity: 0; transition: opacity 0.45s var(--ease); }
/* пометка «черновик» — только в предпросмотре (сборка --release черновики не выкладывает) */
.sp-draft-tag { position: absolute; z-index: 6; right: 22px; bottom: 22px; display: inline-flex; padding: 4px 9px; border-radius: 8px; border: 1px dashed var(--hot-ink); color: var(--hot-ink); background: var(--surface); font-size: 9.5px; letter-spacing: 0.1em; pointer-events: none; }
.sp-card .sp-draft-tag, .sp-feat .sp-draft-tag { right: auto; left: 12px; bottom: 12px; }
.sp-feat-cv { position: relative; }

@media (hover: hover) and (pointer: fine) {
  .sp-card:hover, .sp-feat-link:hover { border-color: color-mix(in srgb, var(--hot) 40%, transparent); box-shadow: 0 20px 44px -24px color-mix(in srgb, var(--g1) 45%, transparent); translate: 0 -3px; }
  .sp-card:hover h3 { color: var(--hot-ink); }
  .sp-card:hover .sp-go span, .sp-feat-link:hover .sp-feat-go span { transform: translateX(4px); }
  .sp-card:hover > .gr, .sp-feat-link:hover > .gr { opacity: 1; }
  .sp-card:hover .dm-desk, .sp-card:hover .dm-phone, .sp-card:hover .sp-frame,
  .sp-feat-link:hover .dm-desk, .sp-feat-link:hover .dm-phone, .sp-feat-link:hover .sp-frame { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75), 0 4cqw 8cqw -2cqw rgba(0, 0, 0, 0.55); }
}
@media (hover: none) { .sp-card.is-focus > .gr { opacity: 1; } }
.sp-card > .gr, .sp-feat-link > .gr { animation-play-state: paused; }
@media (hover: hover) and (pointer: fine) { .sp-card:hover > .gr, .sp-feat-link:hover > .gr { animation-play-state: running; } }
@media (hover: none) { .sp-card.is-focus > .gr { animation-play-state: running; } }

/* ══ обложка поста: та же схема «компьютер + телефон» (covers.css); плюс одно окно и фото в рамке ══ */
.sp-cv { width: 100%; }
.sp-cv.is-solo .dm-desk { left: 15cqw; top: 18.5cqh; width: 70cqw; }   /* одно окно — крупно, ниже плашек № и формата: высота окна ≈ 74cqh */
.sp-frame { position: absolute; z-index: 2; overflow: hidden; border-radius: 1.6cqw; background: #fff;
  box-shadow: 0 0 0 0.5cqw rgba(255, 255, 255, 0.92), 0 3cqw 6.5cqw -2cqw rgba(0, 0, 0, 0.5);
  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); animation: dmFloat 9s ease-in-out infinite; }
.sp-frame .dm-scr { height: 100%; }
.sp-frame .dm-scr img { height: 100%; object-fit: cover; object-position: 50% 50%; }
.sp-frame.is-main { --z: 1; left: 6cqw; top: 11cqh; width: 60cqw; max-height: 80cqh; animation-delay: -4.5s; }
.sp-frame.is-second { --z: 2.2; right: 5cqw; bottom: 9cqh; width: 37cqw; max-height: 60cqh; }
/* одна рамка: целый макет или слайд, вписан по своим пропорциям и стоит по центру, ниже плашек № и формата */
.sp-frame.is-solo { --z: 1.4; --fw: min(74cqw, calc(70cqh * var(--ar, 1.6))); left: 0; right: 0; top: 9cqh; bottom: 0; margin: auto; width: var(--fw); height: calc(var(--fw) / var(--ar, 1.6)); max-height: none; }

/* ══ страница поста ══ */
.sp-post-hero .pj-hero-grid { margin-top: 10px; }
.sp-stamp { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; color: var(--muted); font-size: 11px; letter-spacing: 0.1em; }
.sp-stamp > * { white-space: nowrap; }
.sp-stamp-n { padding: 5px 10px; border-radius: 100px; border: 1px solid color-mix(in srgb, var(--hot) 40%, transparent); color: var(--hot-ink); }
.sp-h1-q { display: block; margin-bottom: 14px; font-size: clamp(15px, 1.2vw, 17px); font-weight: 500; line-height: 1.4; letter-spacing: -0.005em; color: var(--muted); text-wrap: balance; }
.sp-h1 { margin-top: 22px; font-size: clamp(36px, 3.7vw, 56px); font-weight: 500; line-height: 1.03; letter-spacing: -0.048em; text-wrap: balance; }
.sp-post .pj-lede strong { color: var(--ink); font-weight: 500; }
.sp-post-hero .pj-hero-cover .cv { aspect-ratio: 16 / 10.4; }
.sp-post-hero .bl-draft { margin: 4px 0 8px; }

/* текст между блоками */
.sp-prose { margin-top: 30px; max-width: 820px; }
.sp-prose p { font-size: clamp(17px, 1.4vw, 19px); line-height: 1.6; letter-spacing: -0.012em; color: var(--muted); text-wrap: pretty; }
.sp-prose p + p { margin-top: 14px; }
.sp-prose strong { color: var(--ink); font-weight: 500; }
.sp-prose a, .pj-why a { color: var(--hot-ink); text-underline-offset: 3px; }
.pj-res + .sp-prose, .pj-cards + .sp-prose, .pj-pains + .sp-prose { margin-top: 28px; }
.sp-prose + .pj-res { margin-top: 26px; }
.pj-pains + .pj-why { margin-top: 14px; }

/* ══ 3D-модель по кнопке: сначала снимок, по нажатию — сама модель ══ */
.sp-embed-stage { position: relative; aspect-ratio: 16 / 9.6; overflow: hidden; background: var(--surface-2); }
.sp-embed-stage > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.sp-embed-veil { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px;
  background: radial-gradient(60% 70% at 50% 50%, rgba(8, 8, 12, 0.42), rgba(8, 8, 12, 0.12) 70%), linear-gradient(0deg, rgba(8, 8, 12, 0.35), transparent 40%);
  transition: opacity 0.5s var(--ease); }
.sp-embed-go { min-height: 58px; padding: 0 26px 0 20px; gap: 10px; font-size: 16.5px; }
:root:not([data-theme="dark"]) .sp-embed-go { background: linear-gradient(115deg, var(--g1), color-mix(in srgb, var(--g1) 50%, var(--g3)) 60%, var(--g3)); color: #fff; }
.sp-embed-hint { padding: 6px 12px; border-radius: 100px; background: rgba(8, 8, 12, 0.5); color: #fff; font-size: 10.5px; letter-spacing: 0.08em; text-align: center; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.sp-embed iframe { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; border: 0; background: #0b0c10; }
.sp-embed.is-live .sp-embed-veil { opacity: 0; pointer-events: none; }
.sp-embed-cap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; }
.sp-video-box video { display: block; width: 100%; height: auto; background: #000; }

/* ══ «Сайты Benevsky» ══ */
.sp-sites-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sp-sites-list > li { display: flex; }
.sp-site { position: relative; overflow: hidden; flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 22px 24px 26px; border-radius: 24px; background: var(--surface); border: 1px solid var(--hair); text-decoration: none; transition: border-color 0.35s var(--ease), translate 0.35s var(--ease); }
.sp-site-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.sp-site-top .card-ic { width: 38px; height: 38px; border-radius: 12px; }
.sp-site-dom { color: var(--muted); font-size: 10.5px; }
.sp-site-go { margin-left: auto; font-family: var(--mono); color: var(--hot-ink); transition: transform 0.3s var(--ease); }
.sp-site b { font-size: 24px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; }
.sp-site i { font-style: normal; font-size: 15px; line-height: 1.55; color: var(--muted); text-wrap: pretty; }
.sp-site > .gr { padding: 1.5px; opacity: 0; transition: opacity 0.45s var(--ease); animation-play-state: paused; }
@media (hover: hover) and (pointer: fine) {
  .sp-site:hover { border-color: color-mix(in srgb, var(--hot) 40%, transparent); translate: 0 -3px; }
  .sp-site:hover > .gr { opacity: 1; animation-play-state: running; }
  .sp-site:hover .sp-site-go { transform: translate(3px, -3px); }
}

/* ══ адаптив ══ */
@media (max-width: 1240px) {
  .sp-feat-link { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .sp-feat-body { padding: 16px 18px 18px 22px; gap: 14px; }
}
@media (max-width: 1060px) and (min-width: 721px) {
  .sp-grid > li.is-alone { grid-column: 1 / -1; justify-self: center; width: calc(50% - 8px); }
}
@media (max-width: 1060px) {
  .sp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-feat-link { grid-template-columns: minmax(0, 1fr); }
  .sp-feat-body { padding: 16px 16px 18px; }
  .sp-sites-list { grid-template-columns: minmax(0, 1fr); }
  .sp-site { padding: 20px 22px 22px; }
}
@media (max-width: 720px) {
  .sp-hero-h1 { margin-top: 20px; font-size: clamp(34px, 9.6vw, 44px); line-height: 1.04; }
  .sp-hero-lede { font-size: 16px; }
  .sp-hero-facts { display: grid; grid-template-columns: auto auto minmax(0, 1fr); width: 100%; margin-top: 26px; }
  .sp-hero-facts > div { padding: 12px 16px 14px; }
  .sp-hero-facts dd { font-size: 17px; white-space: nowrap; }
  .sp-feat .sp-log > i:nth-of-type(2), .sp-feat .sp-log-t { display: none; }
  .sp-feat-sec { margin-top: 36px; }
  .sp-feat-link { padding: 8px; border-radius: 26px; }
  .sp-feat-cv .cv { border-radius: 19px; }
  .sp-feat-body { padding: 14px 10px 12px; }
  .sp-feat-h { font-size: clamp(27px, 7.4vw, 32px); }
  .sp-feat-lede { font-size: 15.5px; }
  .sp-feat-go { width: 100%; justify-content: center; }
  .sp-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .sp-topics { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 4px var(--gutter) 8px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .sp-topics::-webkit-scrollbar { display: none; }
  .sp-topic { flex: none; scroll-snap-align: start; }
  .sp-card { border-radius: 24px; }
  .sp-card-cv { margin: 8px 8px 0; }
  .sp-card-cv .cv { border-radius: 18px; }
  .sp-card-body { padding: 14px 16px 18px; }
  .sp-num, .sp-kind { top: 10px; padding: 5px 9px; font-size: 9.5px; }
  .sp-num { left: 10px; } .sp-kind { right: 10px; }
  .sp-h1 { font-size: clamp(32px, 8.8vw, 40px); }
  .sp-stamp { gap: 8px 14px; font-size: 10px; }
  .sp-embed-stage { aspect-ratio: 4 / 4.6; }
  .sp-embed-go { min-height: 54px; font-size: 15.5px; }
  .sp-embed-hint { font-size: 9.5px; }
  .sp-site b { font-size: 21px; }
  .sp-prose p { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .sp-hero-h1 .hot, .sp-h1 .hot, .sp-feat-h .hot, .sp-new .dot, .sp-frame { animation: none !important; }
  .sp-grid.is-swap > li { animation: none; }
  .sp-card, .sp-feat-link, .sp-site, .sp-topic, .sp-embed-veil { transition: none; }
}
@media print { .sp-topics, .sp-embed-veil { display: none !important; } }

/* пометки [проверить: …] в черновиках бывают длинными — переносятся, а не вылезают за край на телефоне */
.bl-chk { white-space: normal; overflow-wrap: anywhere; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* ссылки по смыслу на сайт студии: услуги и кейсы по теме поста */
.sp-studio { padding-top: 96px; }
.sp-studio .sv-rel { margin-top: 0; }
.sp-studio h2.mark { padding-top: 16px; border-top: 1px solid var(--rule); }
@media (max-width: 720px) { .sp-studio { padding-top: 64px; } }
/* страница темы: лента сразу под первым экраном */
.is-topic .sp-feed { padding-top: 48px; }
@media (max-width: 720px) { .is-topic .sp-feed { padding-top: 32px; } }
