/* =========================================================
   SINGLE CASE PAGE
   ---------------------------------------------------------
   Устойчивая версия: высота блоков с картинками (proof-
   карточки и compare-слайдер) держится на aspect-ratio +
   min-height + @supports-фолбэке, поэтому не схлопывается.
   Из секции пруфов убраны фичи, которые ломают композитинг
   в WebKit и встроенных браузерах (Telegram/соцсети):
   тяжёлый filter: blur(), isolation: isolate и вложенные
   backdrop-filter на карточках.
========================================================= */

body.single-case-template {
    background: #090909;
    overflow-x: hidden;
}

body.single-case-template .single-case {
    min-height: 100vh;
    background: linear-gradient(180deg, #141416 0%, #0d0d0f 42%, #090909 100%);
}

.single-case,
.single-case * {
    box-sizing: border-box;
}

.single-case img {
    max-width: 100%;
}

.single-case__container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}

/* ========================= HERO / MAIN LAYOUT ========================= */

.single-case__hero {
    position: relative;
    padding-top: 150px;
    padding-bottom: 72px;
    overflow: hidden;
}

.single-case__hero::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 40px;
    width: 720px;
    height: 460px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: radial-gradient(circle at center,
        rgba(229, 46, 46, 0.13) 0%,
        rgba(229, 46, 46, 0.06) 34%,
        rgba(229, 46, 46, 0) 72%);
    filter: blur(64px);
    pointer-events: none;
    z-index: 0;
}

.single-case__layout {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.94fr);
    gap: 56px;
    align-items: start;
}

.single-case__left,
.single-case__right {
    min-width: 0;
}

.single-case__title {
    margin: 0 0 34px;
    color: #fff;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(34px, 3.4vw, 46px);
    line-height: 1.02;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

/* ========================= TAGS ========================= */

.single-case__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.single-case__tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(229, 46, 46, 0.22);
    background: rgba(16, 16, 16, 0.9);
    color: rgba(255, 255, 255, 0.68);
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.single-case__tag img {
    width: 12px;
    height: 12px;
    object-fit: contain;
    display: block;
}

/* ========================= TEXT BLOCKS ========================= */

.single-case__block + .single-case__block {
    margin-top: 34px;
}

.single-case__block-head,
.single-case__result-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.single-case__block-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.single-case__block-title {
    margin: 0;
    color: #fff;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 13px;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.single-case__task-box {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.012) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 22px 22px 20px;
}

.single-case__text {
    color: rgba(255, 255, 255, 0.66);
    font-family: var(--font-primary);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.68;
}

.single-case__text p { margin: 0 0 12px; }
.single-case__text p:last-child { margin-bottom: 0; }
.single-case__text a { color: #ff3b30; text-decoration: none; }
.single-case__text a:hover { text-decoration: underline; }

/* ========================= WORK LIST ========================= */

.single-case__text--work ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.single-case__text--work li {
    position: relative;
    display: block;
    padding-left: 34px;
    margin: 0 0 16px;
    color: rgba(255, 255, 255, 0.72);
}

.single-case__text--work li:last-child { margin-bottom: 0; }

.single-case__text--work li::before {
    content: "";
    display: block;
    position: absolute;
    left: 0;
    top: 2px;
    width: 20px;
    height: 20px;
    background: var(--work-list-icon) center / contain no-repeat;
}

.single-case__text--work:not([style*="--work-list-icon"]) li::before {
    background: rgba(229, 46, 46, 0.12);
    border: 1px solid rgba(229, 46, 46, 0.3);
    border-radius: 50%;
}

.single-case__text--work:not([style*="--work-list-icon"]) li::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 8px;
    width: 8px;
    height: 4px;
    border-left: 2px solid #ff3b30;
    border-bottom: 2px solid #ff3b30;
    transform: rotate(-45deg);
}

/* ========================= RESULT IMAGE ========================= */

.single-case__result-image {
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: #0a0a0b;
    margin-bottom: 18px;
}

.single-case__result-image img {
    display: block;
    width: 100%;
    height: auto;
}

.single-case__result-head {
    margin-top: 22px;
    margin-bottom: 14px;
}

.single-case__block-title--result { width: 100%; }

/* ========================= STATS ========================= */

.single-case__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.single-case__stat {
    min-height: 88px;
    padding: 16px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: linear-gradient(180deg, rgba(229, 46, 46, 0.06) 0%, rgba(255, 255, 255, 0.01) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

.single-case__stat-val {
    color: #ff3b30;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(20px, 2vw, 22px);
    line-height: 1;
    letter-spacing: -0.02em;
}

.single-case__stat-lbl {
    color: rgba(255, 255, 255, 0.44);
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 9px;
    line-height: 1.32;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* =========================================================
   BEFORE / AFTER COMPARE SLIDER
   Высота: aspect-ratio + min-height + @supports-фолбэк.
========================================================= */

.single-case__compare {
    --pos: 50%;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: #0a0a0b;
    margin-bottom: 18px;
    aspect-ratio: 4 / 3;
    min-height: 260px;
}

@supports not (aspect-ratio: 1) {
    .single-case__compare { height: 0; padding-top: 75%; }
}

.single-case__compare-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.single-case__compare-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.single-case__compare-image--before {
    inset: 0 auto 0 0;
    width: var(--pos);
    overflow: hidden;
    z-index: 2;
    border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.single-case__compare-label {
    position: absolute;
    top: 14px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(10, 10, 10, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: #fff;
    font-family: var(--font-primary);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.single-case__compare-label--before { left: 14px; }
.single-case__compare-label--after { right: 14px; }

.single-case__compare-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--pos);
    width: 0;
    z-index: 4;
    pointer-events: none;
}

.single-case__compare-divider::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.88);
    transform: translateX(-1px);
}

.single-case__compare-handle {
    position: absolute;
    left: 0;
    top: 50%;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    transform: translate(-50%, -50%);
    background: rgba(15, 15, 16, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.single-case__compare-handle::before,
.single-case__compare-handle::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 2px;
    height: 14px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 2px;
    transform: translateY(-50%);
}

.single-case__compare-handle::before { left: 18px; }
.single-case__compare-handle::after { right: 18px; }

.single-case__compare-range {
    position: absolute;
    inset: 0;
    z-index: 5;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: ew-resize;
    margin: 0;
}

/* =========================================================
   PROOFS SECTION
   ---------------------------------------------------------
   Убраны из этой секции: filter: blur(80px) на ::before,
   isolation: isolate, backdrop-filter на лейблах карточек —
   именно эта связка ломала отрисовку секции во встроенных
   браузерах и старом WebKit. Красный блик оставлен лёгким
   градиентом без blur-фильтра.
========================================================= */

.single-case__proofs {
    position: relative;
    padding: 56px 0 100px;
    background:
        radial-gradient(60% 40% at 50% 18%,
            rgba(229, 46, 46, 0.14) 0%,
            rgba(229, 46, 46, 0.05) 45%,
            rgba(229, 46, 46, 0) 75%),
        #090909;
    overflow: hidden;
}

.single-case__proofs .single-case__container {
    position: relative;
    z-index: 2;
}

.single-case__proofs-head {
    max-width: 720px;
    margin-bottom: 40px;
}

.single-case__proofs-title {
    margin: 0 0 14px;
    color: #fff;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(26px, 2.6vw, 36px);
    line-height: 1.04;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

.single-case__proofs-text {
    max-width: 680px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 15px;
    line-height: 1.6;
}

.single-case__proofs-list {
    display: grid;
    gap: 28px;
}

.single-case__proof-pair {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.022) 0%, rgba(255, 255, 255, 0.008) 100%),
        #101012;
    padding: 22px;
}

.single-case__proof-pair::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 0% 0%, rgba(255, 59, 48, 0.10) 0%, rgba(255, 59, 48, 0.03) 26%, rgba(255, 59, 48, 0) 54%);
    pointer-events: none;
}

.single-case__proof-title {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    color: #fff;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 16px;
    line-height: 1.3;
    letter-spacing: -0.005em;
}

.single-case__proof-title::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #ff3b30;
    box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.14);
    flex-shrink: 0;
}

.single-case__proof-grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}

/* PROOF CARD — тройная защита высоты, без backdrop-filter */
.single-case__proof-card {
    position: relative;
    overflow: hidden;
    margin: 0;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: #0f0f11;
    aspect-ratio: 4 / 3;
    min-height: 220px;
}

@supports not (aspect-ratio: 1) {
    .single-case__proof-card { height: 0; padding-top: 75%; }
}

.single-case__proof-card img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: left top;
    border-radius: inherit;
    transition: transform 0.4s ease;
}

.single-case__proof-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.12) 100%);
    pointer-events: none;
    z-index: 1;
}

.single-case__proof-label {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(8, 8, 9, 0.9);
    color: #fff;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 10px;
    line-height: 1;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.single-case__proof-card--before .single-case__proof-label {
    color: rgba(255, 255, 255, 0.82);
}

.single-case__proof-card--after .single-case__proof-label {
    border-color: rgba(255, 59, 48, 0.32);
    background: rgba(255, 59, 48, 0.24);
    color: #fff;
}

@media (hover: hover) {
    .single-case__proof-card:hover img { transform: scale(1.03); }
}

/* ========================= OPTIONAL CTA ========================= */

.single-case__cta { padding: 30px 0 100px; }

.single-case__cta-box {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 52px 24px;
    text-align: center;
    background:
        radial-gradient(circle at center, rgba(229, 46, 46, 0.16) 0%, rgba(229, 46, 46, 0.06) 32%, rgba(229, 46, 46, 0) 70%),
        linear-gradient(180deg, #121315 0%, #0b0b0c 100%);
}

.single-case__cta-title {
    margin: 0 0 14px;
    color: #fff;
    font-family: var(--font-display);
    font-size: clamp(30px, 3vw, 44px);
    font-weight: 800;
    line-height: 1.0;
    letter-spacing: -0.03em;
}

.single-case__cta-title span,
.single-case__cta-title .accent { color: #ff3b30; }

.single-case__cta-text {
    margin: 0 auto 24px;
    max-width: 460px;
    color: rgba(255, 255, 255, 0.62);
    font-family: var(--font-primary);
    font-size: 15px;
    line-height: 1.55;
}

.single-case__cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 13px 30px;
    border-radius: 999px;
    background: #f03a2f;
    color: #fff;
    text-decoration: none;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 15px;
    line-height: 1;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.single-case__cta-btn:hover,
.single-case__cta-btn:focus,
.single-case__cta-btn:active {
    color: #fff;
    outline: none;
    box-shadow: none;
}

@media (hover: hover) {
    .single-case__cta-btn:hover {
        background: #ff463b;
        transform: translateY(-2px);
    }
}

/* =========================================================
   RESPONSIVE — каждый брейкпоинт с новым aspect-ratio
   задаёт и min-height под ту же пропорцию.
========================================================= */

@media (max-width: 1024px) {
    .single-case__hero { padding-top: 128px; padding-bottom: 56px; }
    .single-case__layout { grid-template-columns: 1fr; gap: 40px; }
    .single-case__hero::before { width: 620px; height: 420px; }
    .single-case__proofs { padding-top: 40px; padding-bottom: 80px; }
    .single-case__proofs-head { margin-bottom: 32px; }
    .single-case__proof-pair { border-radius: 18px; padding: 18px; }
}

@media (max-width: 768px) {
    .single-case__container { padding-left: 18px; padding-right: 18px; }
    .single-case__hero { padding-top: 108px; padding-bottom: 40px; }
    .single-case__title { font-size: clamp(28px, 8vw, 36px); margin-bottom: 28px; }
    .single-case__task-box { padding: 18px 16px 16px; }
    .single-case__text { font-size: 14px; }

    .single-case__stats { grid-template-columns: 1fr; gap: 10px; }
    .single-case__stat {
        min-height: 0;
        flex-direction: row;
        align-items: baseline;
        justify-content: flex-start;
        gap: 10px;
        padding: 16px 18px;
        text-align: left;
    }
    .single-case__stat-val { font-size: 24px; flex-shrink: 0; }
    .single-case__stat-lbl { font-size: 11px; line-height: 1.3; letter-spacing: 0.03em; }

    .single-case__compare { aspect-ratio: 3 / 2; min-height: 220px; }
    .single-case__compare-label { top: 10px; min-height: 28px; padding: 6px 10px; font-size: 10px; }
    .single-case__compare-label--before { left: 10px; }
    .single-case__compare-label--after { right: 10px; }
    .single-case__compare-handle { width: 40px; height: 40px; }
    .single-case__compare-handle::before { left: 15px; }
    .single-case__compare-handle::after { right: 15px; }

    .single-case__proofs { padding-top: 32px; padding-bottom: 64px; }
    .single-case__proofs-list { gap: 20px; }
    .single-case__proof-pair { padding: 16px; border-radius: 16px; }
    .single-case__proof-title { font-size: 15px; margin-bottom: 14px; }

    .single-case__proof-grid { grid-template-columns: 1fr; gap: 12px; }
    .single-case__proof-card { aspect-ratio: 16 / 10; min-height: 200px; border-radius: 12px; }
    .single-case__proof-label { left: 10px; top: 10px; }

    .single-case__cta { padding-bottom: 72px; }
    .single-case__cta-box { border-radius: 18px; padding: 38px 18px; }
}

@media (max-width: 480px) {
    .single-case__proof-pair { padding: 14px; }
    .single-case__proof-title { align-items: flex-start; line-height: 1.35; }
    .single-case__proof-title::before { margin-top: 6px; }
}

/* Фолбэк без aspect-ratio на мобильных пропорциях */
@supports not (aspect-ratio: 1) {
    @media (max-width: 768px) {
        .single-case__proof-card { height: 0; padding-top: 62.5%; }
        .single-case__compare { height: 0; padding-top: 66.66%; }
    }
}