/*
 * Featured Case Study — large two-column section.
 * Theming is token-only (--mhb-*), so it follows the global data-mhb-theme
 * site toggle automatically. No per-block theme attribute.
 */

.mhb-featured-case {
    /* Emerald accent (matches the site's Emerald style). */
    --fc-accent: var(--mhb-green, #22c55e);
    --fc-accent-soft: rgba(34, 197, 94, 0.14);
    --fc-bg: #07100b;
    --fc-surface: rgba(255, 255, 255, 0.075);
    --fc-frame-bg: #050806;
    --fc-frame-bar: rgba(255, 255, 255, 0.075);
    --fc-text: #ffffff;
    --fc-muted: rgba(255, 255, 255, 0.72);
    --fc-subtle: rgba(255, 255, 255, 0.56);
    --fc-border: rgba(255, 255, 255, 0.14);
    --fc-border-strong: rgba(255, 255, 255, 0.24);

    /* Solid, token-driven surface: the translucent tint stacked over the base
       bg so the card reads correctly on ANY page in both light and dark,
       instead of depending on the (non-flipping) page background. */
    background:
        linear-gradient(
            0deg,
            var(--fc-surface),
            var(--fc-surface)
        ),
        var(--fc-bg) !important;
    border: 1px solid var(--fc-border);
    border-radius: 24px;
    box-shadow: 0 0 0 100vmax var(--mhb-bg);
    clip-path: inset(-96px -100vmax);
    color: var(--fc-text) !important;
    padding: clamp(28px, 5vw, 64px);
    perspective: 1200px;
    position: relative;
}

[data-mhb-theme="dark"] .mhb-featured-case,
:root[data-mhb-theme="dark"] .mhb-featured-case {
    box-shadow: 0 0 0 100vmax var(--mhb-bg);
}

[data-mhb-theme="light"] .mhb-featured-case {
    --fc-bg: #ffffff;
    --fc-surface: rgba(0, 0, 0, 0.035);
    --fc-frame-bg: #ffffff;
    --fc-frame-bar: rgba(0, 0, 0, 0.045);
    --fc-text: #0a0a0a;
    --fc-muted: rgba(10, 10, 10, 0.68);
    --fc-subtle: rgba(10, 10, 10, 0.52);
    --fc-border: rgba(0, 0, 0, 0.1);
    --fc-border-strong: rgba(0, 0, 0, 0.2);

    color: var(--fc-text);
    box-shadow: none;
    background:
        linear-gradient(
            0deg,
            var(--fc-surface),
            var(--fc-surface)
        ),
        var(--fc-bg) !important;
}

@media (prefers-color-scheme: light) {
    :root:not([data-mhb-theme="dark"]) .mhb-featured-case {
        --fc-bg: #ffffff;
        --fc-surface: rgba(0, 0, 0, 0.035);
        --fc-frame-bg: #ffffff;
        --fc-frame-bar: rgba(0, 0, 0, 0.045);
        --fc-text: #0a0a0a;
        --fc-muted: rgba(10, 10, 10, 0.68);
        --fc-subtle: rgba(10, 10, 10, 0.52);
        --fc-border: rgba(0, 0, 0, 0.1);
        --fc-border-strong: rgba(0, 0, 0, 0.2);

        color: var(--fc-text);
        box-shadow: none;
        background:
            linear-gradient(
                0deg,
                var(--fc-surface),
                var(--fc-surface)
            ),
            var(--fc-bg) !important;
    }
}

.mhb-featured-case.is-style-outline {
    background:
        linear-gradient(
            0deg,
            color-mix(in srgb, var(--fc-surface) 56%, transparent),
            color-mix(in srgb, var(--fc-surface) 56%, transparent)
        ),
        var(--fc-bg) !important;
    border-color: var(--fc-border-strong);
}

.mhb-featured-case__inner {
    align-items: center;
    display: grid;
    gap: clamp(32px, 5vw, 64px);
    grid-template-columns: 45% 55%;
    margin: 0 auto;
    max-width: 1280px;
}

/* ---------- Left column: browser-window frame ---------- */

.mhb-featured-case__media {
    position: relative;
}

.mhb-featured-case__frame {
    background: var(--fc-frame-bg);
    border: 1px solid var(--fc-border);
    border-radius: 14px;
    box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    will-change: transform, opacity, filter;
}

.mhb-featured-case__frame:hover {
    border-color: var(--fc-accent);
    box-shadow: 0 44px 90px -42px rgba(34, 197, 94, 0.42);
    transform: translateY(-6px);
}

.mhb-featured-case__frame::after {
    background: linear-gradient(
        115deg,
        transparent 18%,
        rgba(255, 255, 255, 0.16) 42%,
        transparent 66%
    );
    content: "";
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transform: translateX(-55%);
    transition: opacity 0.24s ease, transform 0.7s ease;
    z-index: 2;
}

.mhb-featured-case__frame:hover::after {
    opacity: 1;
    transform: translateX(55%);
}

.mhb-featured-case__bar {
    align-items: center;
    background: var(--fc-frame-bar);
    border-bottom: 1px solid var(--fc-border);
    display: flex;
    gap: 8px;
    padding: 12px 16px;
}

.mhb-featured-case__dot {
    background: var(--fc-border-strong);
    border-radius: 50%;
    display: inline-block;
    height: 11px;
    width: 11px;
}

.mhb-featured-case__dot:nth-child(1) {
    background: #ef4444;
}

.mhb-featured-case__dot:nth-child(2) {
    background: #f59e0b;
}

.mhb-featured-case__dot:nth-child(3) {
    background: #22c55e;
}

.mhb-featured-case__shot {
    align-items: center;
    aspect-ratio: 16 / 10;
    display: flex;
    justify-content: center;
    overflow: hidden;
    position: relative;
    will-change: transform;
}

/* Swipeable carousel: a scroll-snap track of full-width screenshots. Works with
   trackpad/touch/drag; the JS dots are optional enhancement. */
.mhb-featured-case__track {
    display: flex;
    height: 100%;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.mhb-featured-case__track::-webkit-scrollbar {
    display: none;
}

.mhb-featured-case__img {
    display: block;
    flex: 0 0 100%;
    height: 100%;
    -o-object-fit: cover;
       object-fit: cover;
    scroll-snap-align: start;
    width: 100%;
}

.mhb-featured-case__placeholder {
    color: var(--fc-muted);
    font-size: 0.85rem;
    padding: 24px;
    text-align: center;
}

/* Carousel dots (injected by view.js when there is more than one screenshot). */
.mhb-featured-case__dots {
    align-items: center;
    backdrop-filter: blur(18px);
    background:
        linear-gradient(
            135deg,
            color-mix(in srgb, var(--fc-frame-bg) 72%, transparent),
            color-mix(in srgb, var(--fc-surface) 88%, transparent)
        );
    border: 1px solid var(--fc-border);
    border-radius: 999px;
    box-shadow: 0 18px 52px -38px #000000;
    display: flex;
    gap: 6px;
    justify-content: center;
    left: 50%;
    padding: 6px;
    position: absolute;
    top: calc(100% - 8px);
    transform: translateX(-50%);
    z-index: 3;
}

.mhb-featured-case__gallery-btn,
.mhb-featured-case__dot-btn {
    align-items: center;
    display: inline-flex;
    justify-content: center;
}

.mhb-featured-case__dot-btn {
    background: transparent;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    color: var(--fc-muted);
    font-family: var(--mhb-font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    height: 30px;
    letter-spacing: 0.08em;
    padding: 0;
    transition: background 0.22s ease, color 0.22s ease,
        transform 0.22s ease;
    width: 42px;
}

.mhb-featured-case__dot-btn.is-active {
    background: var(--fc-accent);
    box-shadow: 0 0 0 4px var(--fc-accent-soft);
    color: #04130a;
    transform: translateY(-1px);
}

.mhb-featured-case__gallery-btn {
    background: color-mix(in srgb, var(--fc-text) 8%, transparent);
    border: 1px solid var(--fc-border);
    border-radius: 999px;
    color: var(--fc-text);
    cursor: pointer;
    font-size: 0.9rem;
    height: 30px;
    padding: 0;
    transition: background 0.22s ease, border-color 0.22s ease,
        transform 0.22s ease;
    width: 30px;
}

.mhb-featured-case__gallery-btn:hover,
.mhb-featured-case__dot-btn:hover {
    background: color-mix(in srgb, var(--fc-accent) 20%, transparent);
    border-color: var(--fc-accent);
    color: var(--fc-text);
    transform: translateY(-1px);
}

/* ---------- Right column: content ---------- */

.mhb-featured-case__eyebrow {
    color: var(--fc-accent);
    font-family: var(--mhb-font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    margin: 0 0 16px;
    text-transform: uppercase;
}

.mhb-featured-case__title {
    color: var(--fc-text);
    font-family: var(--mhb-font-display);
    font-size: clamp(1.8rem, 3.4vw, 2.8rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.08;
    margin: 0 0 8px;
}

.mhb-featured-case__client {
    color: var(--fc-muted);
    font-size: 0.95rem;
    margin: 0 0 20px;
}

.mhb-featured-case__desc {
    color: var(--fc-muted);
    font-size: 1rem;
    line-height: 1.7;
    margin: 0 0 28px;
    max-width: 60ch;
}

/* Results stat row */
.mhb-featured-case__results {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    margin: 0 0 28px;
}

.mhb-featured-case__result {
    margin: 0;
}

.mhb-featured-case__result-number {
    color: var(--fc-text);
    font-family: var(--mhb-font-display);
    font-size: clamp(1.6rem, 2.6vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    transition: color 0.2s ease;
}

.mhb-featured-case__result-label {
    color: var(--fc-subtle);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    margin: 8px 0 0;
}

/* Tag pills */
.mhb-featured-case__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
    margin: 0 0 28px;
    padding: 0;
}

.mhb-featured-case__tag {
    border: 1px solid var(--fc-border-strong);
    border-radius: 999px;
    color: var(--fc-muted);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    padding: 6px 14px;
    transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.mhb-featured-case__tag:hover {
    border-color: var(--fc-accent);
    color: var(--fc-text);
    transform: translateY(-2px);
}

/* Link */
.mhb-featured-case__link {
    color: var(--fc-accent);
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.mhb-featured-case__link:hover {
    text-decoration: underline;
}

.mhb-featured-case__content > * {
    will-change: transform, opacity, filter;
}

/* ---------- Responsive: stack, image on top ---------- */

@media (max-width: 768px) {
    .mhb-featured-case__inner {
        grid-template-columns: 1fr;
    }

    .mhb-featured-case__dots {
        position: relative;
        top: auto;
        transform: translateX(-50%) translateY(-8px);
    }
}

/* ---------- Single entry animation (staggered fade-up) ---------- */

@media (prefers-reduced-motion: no-preference) {
    .mhb-featured-case.is-ready .mhb-featured-case__frame,
    .mhb-featured-case.is-ready .mhb-featured-case__content > * {
        opacity: 0;
        transform: translateY(16px);
        transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    }

    /* Stagger: frame first, then each content row. */
    .mhb-featured-case.is-ready .mhb-featured-case__content > *:nth-child(1) {
        transition-delay: 0.06s;
    }
    .mhb-featured-case.is-ready .mhb-featured-case__content > *:nth-child(2) {
        transition-delay: 0.12s;
    }
    .mhb-featured-case.is-ready .mhb-featured-case__content > *:nth-child(3) {
        transition-delay: 0.18s;
    }
    .mhb-featured-case.is-ready .mhb-featured-case__content > *:nth-child(4) {
        transition-delay: 0.24s;
    }
    .mhb-featured-case.is-ready .mhb-featured-case__content > *:nth-child(n + 5) {
        transition-delay: 0.3s;
    }

    .mhb-featured-case.is-ready.is-visible .mhb-featured-case__frame,
    .mhb-featured-case.is-ready.is-visible .mhb-featured-case__content > * {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mhb-featured-case__frame,
    .mhb-featured-case__frame::after,
    .mhb-featured-case__gallery-btn,
    .mhb-featured-case__dot-btn,
    .mhb-featured-case__tag,
    .mhb-featured-case__content > * {
        transition: none;
    }

    .mhb-featured-case__frame:hover,
    .mhb-featured-case__tag:hover {
        transform: none;
    }
}

