/* ============================================
   CASES REDESIGN — Стили блока кейсов
   Версия: 2.0 (Bento Grid + Inline Stories)
   ============================================ */

/* --- Grain Overlay на секции --- */
.cases-section {
    position: relative;
}

.cases-section::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.cases-section > *:not(.shape-divider) {
    position: relative;
    z-index: 1;
}

/* --- Фильтр-табы --- */
.cases-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 48px;
}

.cases-filter__btn {
    padding: 10px 22px;
    border: 2px solid #000;
    background: transparent;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    border-radius: 0;
}

.cases-filter__btn:hover {
    background: #000;
    color: #fff;
}

.cases-filter__btn.active {
    background: #000;
    color: #fff;
}

/* --- Bento Grid --- */
.cases-bento {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Карточка кейса (базовая) --- */
.case-card {
    background: #FFFFFF;
    border: 2.5px solid #000;
    border-radius: 16px;
    padding: 28px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    /* Scroll reveal начальное состояние */
    opacity: 0;
    transform: translateY(30px);
}

.case-card.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

/* Stagger reveal delays */
.case-card:nth-child(1) { transition-delay: 0s; }
.case-card:nth-child(2) { transition-delay: 0.08s; }
.case-card:nth-child(3) { transition-delay: 0.16s; }
.case-card:nth-child(4) { transition-delay: 0.24s; }
.case-card:nth-child(5) { transition-delay: 0.32s; }
.case-card:nth-child(6) { transition-delay: 0.4s; }
.case-card:nth-child(7) { transition-delay: 0.48s; }
.case-card:nth-child(8) { transition-delay: 0.56s; }
.case-card:nth-child(9) { transition-delay: 0.64s; }
.case-card:nth-child(10) { transition-delay: 0.72s; }

.case-card:hover {
    transform: translateY(-5px);
    box-shadow: 6px 6px 0 #000;
}

/* --- Stripe Spotlight эффект --- */
.case-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        320px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(255, 142, 60, 0.13),
        transparent 55%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.case-card:hover::before {
    opacity: 1;
}

/* --- Flagship карточка (большая) --- */
.case-card--flagship {
    grid-column: span 2;
    grid-row: span 2;
    padding: 36px;
}

.case-card--flagship .case-card__name {
    font-size: 2.8rem;
}

.case-card--flagship .case-metric__value {
    font-size: 2.4rem;
}

.case-card--flagship .case-card__hook {
    font-size: 1.05rem;
}

/* --- Coming Soon карточка --- */
.case-card--soon {
    opacity: 0.55;
    border-style: dashed;
    cursor: default;
    background: rgba(255,255,255,0.7);
}

.case-card--soon:hover {
    transform: none;
    box-shadow: none;
}

.case-card--soon::before {
    display: none;
}

.case-card--soon .case-card__expand {
    display: none;
}

/* --- Внутренние элементы карточки --- */
.case-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.case-card__tag {
    display: inline-block;
    padding: 4px 11px;
    border: 2px solid #000;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* Цвета тегов по категориям */
.case-card__tag--operations { background: #93C5FD; }
.case-card__tag--sales { background: #FF8E3C; color: #fff; }
.case-card__tag--analytics { background: #A7F3D0; }
.case-card__tag--marketing { background: #FFD166; }

/* Статус-штамп */
.case-card__stamp {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 3px 9px;
    border: 2.5px solid;
    transform: rotate(-3deg);
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}

.case-card__stamp--deployed {
    border-color: #059669;
    color: #059669;
}

.case-card__stamp--progress {
    border-color: #D97706;
    color: #D97706;
}

/* Имя, роль, хук */
.case-card__name {
    font-size: 1.9rem;
    font-weight: 900;
    margin-bottom: 2px;
    line-height: 1.1;
    letter-spacing: -0.03em;
    position: relative;
    z-index: 2;
}

.case-card__role {
    font-size: 0.95rem;
    font-weight: 500;
    color: #555;
    margin-bottom: 14px;
    position: relative;
    z-index: 2;
}

.case-card__hook {
    font-size: 0.9rem;
    line-height: 1.55;
    color: #333;
    margin-bottom: 20px;
    font-style: italic;
    flex-grow: 1;
    position: relative;
    z-index: 2;
}

/* Метрики в карточке */
.case-card__metrics {
    display: flex;
    gap: 20px;
    padding-top: 16px;
    border-top: 2.5px solid #000;
    margin-top: auto;
    position: relative;
    z-index: 2;
}

.case-metric__value {
    font-size: 1.7rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 3px;
}

.case-metric__label {
    font-size: 0.7rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    line-height: 1.3;
}

/* Кнопка «Подробнее» */
.case-card__expand {
    background: #000;
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    margin-top: 16px;
    transition: background 0.25s;
    border-radius: 0;
    width: 100%;
    font-family: inherit;
    position: relative;
    z-index: 2;
}

.case-card__expand:hover {
    background: #333;
}

/* ============================================
   INLINE STORY (Развернутый кейс)
   ============================================ */
.case-story {
    background: #FFFFFF;
    border: 2.5px solid #000;
    border-radius: 16px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0 48px;
    transition:
        max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.4s ease 0.1s,
        padding 0.4s ease;
    grid-column: 1 / -1;
    transform: none !important;
    display: none;
}

.case-story.active {
    max-height: 3000px;
    opacity: 1;
    padding: 40px 48px 48px;
}

/* Кнопка «Свернуть» */
.case-story__close {
    background: none;
    border: 2px solid #000;
    padding: 8px 20px;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 28px;
    transition: all 0.25s;
    font-family: inherit;
}

.case-story__close:hover {
    background: #000;
    color: #fff;
}

/* Заголовок story */
.case-story__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.case-story__title {
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.case-story__subtitle {
    font-size: 1.1rem;
    color: #555;
    font-weight: 500;
}

/* Бар метрик */
.case-story__metrics-bar {
    display: flex;
    gap: 32px;
    padding: 24px 0;
    border-top: 2.5px solid #000;
    border-bottom: 2.5px solid #000;
    margin-bottom: 36px;
    flex-wrap: wrap;
}

.story-metric {
    flex: 1;
    min-width: 110px;
}

.story-metric__value {
    font-size: 2.1rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 5px;
}

.story-metric__label {
    font-size: 0.75rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    line-height: 1.3;
}

/* Контент story */
.case-story__content {
    max-width: 820px;
}

.case-story__content h4 {
    font-size: 0.95rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    margin-top: 32px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eee;
}

.case-story__content h4:first-child {
    margin-top: 0;
}

.case-story__content p,
.case-story__content li {
    font-size: 1rem;
    line-height: 1.7;
    color: #333;
}

.case-story__content ul {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}

.case-story__content li {
    padding-left: 24px;
    position: relative;
    margin-bottom: 10px;
}

.case-story__content li::before {
    content: '→';
    position: absolute;
    left: 0;
    font-weight: 700;
    color: #FF8E3C;
}

/* Схема архитектуры */
.arch-diagram {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 28px;
    background: #f7f7f7;
    border: 2px solid #eee;
    border-radius: 12px;
    margin-top: 16px;
}

.arch-node {
    background: #fff;
    border: 2px solid #000;
    border-radius: 8px;
    padding: 12px 18px;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
    min-width: 130px;
}

.arch-node--blue { background: #93C5FD; }
.arch-node--orange { background: #FF8E3C; color: #fff; }
.arch-node--yellow { background: #FFD166; }
.arch-node--pink { background: #F595DB; }
.arch-node--green { background: #A7F3D0; }

.arch-arrow {
    font-size: 1.4rem;
    font-weight: 900;
    color: #000;
    flex-shrink: 0;
}

/* CTA в story */
.case-story__cta {
    margin-top: 36px;
    padding-top: 28px;
    border-top: 2.5px solid #000;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .cases-bento {
        grid-template-columns: repeat(2, 1fr);
    }

    .case-card--flagship {
        grid-column: span 2;
        grid-row: span 1;
    }

    .case-story.active {
        padding: 32px;
    }

    .case-story__title {
        font-size: 2rem;
    }
}

@media (max-width: 640px) {
    .cases-bento {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .case-card--flagship {
        grid-column: span 1;
    }

    .case-card--flagship .case-card__name {
        font-size: 2rem;
    }

    .case-card {
        padding: 22px;
    }

    .case-story.active {
        padding: 20px;
    }

    .case-story__metrics-bar {
        flex-direction: column;
        gap: 16px;
    }

    .case-story__title {
        font-size: 1.6rem;
    }

    .cases-filter {
        gap: 6px;
    }

    .cases-filter__btn {
        padding: 7px 14px;
        font-size: 0.68rem;
    }

    .arch-diagram {
        flex-direction: column;
        align-items: stretch;
    }

    .arch-arrow {
        text-align: center;
        transform: rotate(90deg);
    }
}

/* Accessibility: respect motion preferences */
@media (prefers-reduced-motion: reduce) {
    .case-card {
        opacity: 1;
        transform: none;
        transition: none !important;
    }
    .case-story {
        transition: none !important;
    }
    .case-card::before {
        display: none;
    }
}

/* Trigger deploy */
