/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-y: scroll;
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    font-family: 'Parkinsans', sans-serif;
    background: #fff;
    color: #030b2a;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

/* ============================================
   Navigation
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px 60px;
}

.navbar::before {
    content: '';
    position: absolute;
    inset: 0;
    bottom: -20px;
    z-index: -1;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, black 85%, transparent 100%);
    transition: opacity 0.4s ease;
}

.nav-logo {
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
}

.nav-logo img {
    height: 48px;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Nav entrance — staggered slide down */
@keyframes rh-nav-enter {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-entering .nav-link {
    opacity: 0;
    animation: rh-nav-enter cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.nav-entering .nav-link:nth-child(1) { animation-delay: 0.15s; animation-duration: 0.5s; }
.nav-entering .nav-link:nth-child(2) { animation-delay: 0.19s; animation-duration: 0.47s; }
.nav-entering .nav-link:nth-child(3) { animation-delay: 0.23s; animation-duration: 0.44s; }
.nav-entering .nav-link:nth-child(4) { animation-delay: 0.27s; animation-duration: 0.41s; }
.nav-entering .nav-link:nth-child(5) { animation-delay: 0.31s; animation-duration: 0.38s; }
.nav-entering .nav-link:nth-child(6) { animation-delay: 0.35s; animation-duration: 0.35s; }

/* Nav exit — staggered slide up */
.nav-exiting .nav-link {
    opacity: 0 !important;
    transform: translateY(-20px) !important;
}

.nav-exiting .nav-link:nth-child(6) { transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0s !important; }
.nav-exiting .nav-link:nth-child(5) { transition: opacity 0.38s cubic-bezier(0.16, 1, 0.3, 1), transform 0.38s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0.04s !important; }
.nav-exiting .nav-link:nth-child(4) { transition: opacity 0.41s cubic-bezier(0.16, 1, 0.3, 1), transform 0.41s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0.08s !important; }
.nav-exiting .nav-link:nth-child(3) { transition: opacity 0.44s cubic-bezier(0.16, 1, 0.3, 1), transform 0.44s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0.12s !important; }
.nav-exiting .nav-link:nth-child(2) { transition: opacity 0.47s cubic-bezier(0.16, 1, 0.3, 1), transform 0.47s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0.16s !important; }
.nav-exiting .nav-link:nth-child(1) { transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0.2s !important; }

.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 1000px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #030b2a;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(0, 0, 0, 0.06);
}

.nav-link.active {
    color: #1180f9;
    background: rgba(17, 128, 249, 0.08);
}

.hamburger {
    display: none;
}

.mobile-menu {
    display: none;
}

/* ============================================
   Back to Top Button
   ============================================ */
.back-to-top {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #030b2a;
    text-decoration: none;
    z-index: 99;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease, box-shadow 0.2s ease;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top:hover {
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

[id] {
    scroll-margin-top: 100px;
}

/* ============================================
   Case Study Layout
   ============================================ */
.case-study {
    max-width: 90vw;
    margin: 0 auto;
    padding: 120px 80px 100px;
    display: flex;
    flex-direction: column;
    gap: 100px;
}

/* ============================================
   Shared Styles — Gold Gradient Labels
   ============================================ */
.cs-label {
    background: linear-gradient(to bottom, #9a8651 17.553%, #cab479);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 16px;
    font-weight: 700;
}

.cs-subtitle {
    background: linear-gradient(to bottom, #9a8651 17.553%, #cab479);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 0;
}

.cs-sidebar-label {
    background: linear-gradient(to bottom, #9a8651 17.553%, #cab479);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 16px;
    font-weight: 700;
    width: 108px;
    flex-shrink: 0;
}

.cs-card {
    background: #dde3ec;
    border-radius: 10px;
    padding: 20px;
}

.cs-divider {
    border: none;
    border-top: 1px solid #030b2a;
    margin: 0;
}

/* ============================================
   Header Section
   ============================================ */
.cs-header {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.cs-header-text .cs-label {
    margin-bottom: 0;
}

.cs-title {
    font-size: 40px;
    font-weight: 400;
    color: #030b2a;
    line-height: 1.5;
}

.cs-hero-image {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.cs-hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

.cs-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 197px;
    column-gap: 64px;
    row-gap: 40px;
    font-size: 16px;
}

.cs-meta-overview {
    grid-column: 1 / 3;
}

.cs-meta-role {
    grid-column: 3;
}

.cs-meta-problem {
    grid-column: 1;
}

.cs-meta-solution {
    grid-column: 2;
}

.cs-meta-timeline {
    grid-column: 3;
}

.cs-meta-grid p:last-child {
    margin-bottom: 0;
}

/* ============================================
   Two Column Layout
   ============================================ */
.cs-two-col {
    display: flex;
    gap: 217px;
    align-items: flex-start;
}

.cs-content {
    flex: 1;
    min-width: 0;
    font-size: 16px;
}

.cs-content p {
    margin-bottom: 8px;
}

.cs-content p:last-child {
    margin-bottom: 0;
}

/* ============================================
   Section
   ============================================ */
.cs-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ============================================
   Background — Phone Screens Row
   ============================================ */
.cs-bg-screens {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    justify-content: flex-end;
}

.cs-bg-phone {
    flex: 1;
    min-width: 0;
    border-radius: 30px;
    border: 8px solid #000;
    overflow: hidden;
    aspect-ratio: 393 / 852;
}

.cs-bg-phone img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ============================================
   Research — Persona Cards
   ============================================ */
.cs-persona-row {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.cs-persona-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    border-radius: 8px;
    flex: 1;
}

.cs-persona-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
}

.cs-persona-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cs-persona-title {
    font-size: 20px;
    font-weight: 500;
    text-align: center;
    margin-bottom: 0;
}

.cs-persona-exp {
    font-size: 20px;
    font-weight: 700;
    color: #29cc38;
    text-align: center;
    margin-top: -16px;
}

/* ============================================
   Research — Insight Cards (2x2 grid)
   ============================================ */
.cs-insight-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.cs-insight-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
}

.cs-insight-num {
    font-size: 20px;
    font-weight: 500;
    background: linear-gradient(to bottom, #9a8651 17.553%, #cab479);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cs-insight-card p {
    font-size: 20px;
    font-weight: 500;
    line-height: 1.5;
}

/* ============================================
   Problem — Stat Callout
   ============================================ */
.cs-stat-callout {
    background: #dde3ec;
    border-radius: 10px;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.cs-stat-prefix,
.cs-stat-suffix {
    font-size: 20px;
    font-weight: 400;
}

.cs-stat-number {
    font-size: 96px;
    font-weight: 700;
    line-height: 1.5;
    background: linear-gradient(to bottom, #9a8651 17.553%, #cab479);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   Introducing Section (Dark)
   ============================================ */
.cs-introducing {
    background: #110e08;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 100px;
    gap: 40px;
    /* Extend beyond case-study padding */
    margin-left: -80px;
    margin-right: -80px;
    width: calc(100% + 160px);
}

.cs-introducing-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;
}

.cs-introducing-text {
    font-family: 'Inter', sans-serif;
    font-size: 40px;
    font-weight: 500;
    background: linear-gradient(to right, #9a8651, #cab479);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.cs-introducing-logo {
    height: 145px;
    width: auto;
}

.cs-introducing-mockup {
    width: 100%;
}

.cs-introducing-mockup img {
    width: 100%;
    height: auto;
    display: block;
}

/* ============================================
   Features / Solution Overview
   ============================================ */
.cs-feature-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.cs-feature-text {
    width: 304px;
    flex-shrink: 0;
    font-size: 16px;
}

.cs-feature-title {
    font-size: 20px;
    font-weight: 700;
    color: #014998;
    margin-bottom: 4px;
}

.cs-feature-screens {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 40px;
    padding: 40px;
    align-items: flex-start;
}

.cs-feature-screens img {
    flex: 1;
    min-width: 0;
    height: auto;
    object-fit: cover;
    border-radius: 40px;
    border: 8px solid #000;
}

/* ============================================
   Edge Cases
   ============================================ */
.cs-edge-row {
    display: flex;
    gap: 20px;
    align-items: center;
    min-height: 440px;
}

.cs-edge-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.cs-edge-text p {
    width: 304px;
}

.cs-edge-text .cs-feature-title {
    width: 304px;
}

.cs-edge-screen {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    width: 100%;
}

.cs-edge-screen img {
    height: 400px;
    width: auto;
    border-radius: 30px;
    border: 6px solid #000;
}

.cs-edge-row-reverse {
    flex-direction: row;
}

/* ============================================
   Business Impact
   ============================================ */
.cs-impact-row {
    display: flex;
    gap: 20px;
}

.cs-impact-card {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.cs-impact-icon {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.cs-impact-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.46px;
}

.cs-impact-desc {
    font-size: 20px;
    font-weight: 500;
}

/* ============================================
   Page Entrance & Scroll Animations
   ============================================ */
.page-transition-cover {
    position: fixed;
    inset: 0;
    background: #000002;
    z-index: 99;
    pointer-events: none;
}

/* ============================================
   Page Exit
   ============================================ */
.cs-exiting .case-study,
.cs-exiting .back-to-top {
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.cs-exiting .nav-logo {
    opacity: 0 !important;
    transition: opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
}

.cs-exiting .navbar::before {
    opacity: 0 !important;
    transition: opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
}

.cs-exiting::after {
    content: '';
    position: fixed;
    inset: 0;
    background: #000002;
    z-index: 98;
    opacity: 0;
    animation: darken-bg 0.3s ease 0.3s forwards;
}

@keyframes darken-bg {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Sections start hidden, animate in on scroll */
.cs-section,
.cs-header,
.cs-divider,
.cs-introducing {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.cs-section.cs-visible,
.cs-header.cs-visible,
.cs-divider.cs-visible,
.cs-introducing.cs-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children within visible sections */
.cs-visible .cs-two-col,
.cs-visible .cs-card-row,
.cs-visible .cs-card,
.cs-visible .cs-stat-callout,
.cs-visible .cs-persona-row,
.cs-visible .cs-insight-grid,
.cs-visible .cs-bg-screens,
.cs-visible .cs-feature-row,
.cs-visible .cs-edge-row,
.cs-visible .cs-impact-row,
.cs-visible .cs-introducing-top,
.cs-visible .cs-introducing-mockup {
    animation: cs-stagger-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.cs-visible > :nth-child(1) { animation-delay: 0s; }
.cs-visible > :nth-child(2) { animation-delay: 0.08s; }
.cs-visible > :nth-child(3) { animation-delay: 0.16s; }
.cs-visible > :nth-child(4) { animation-delay: 0.24s; }
.cs-visible > :nth-child(5) { animation-delay: 0.32s; }
.cs-visible > :nth-child(6) { animation-delay: 0.4s; }

@keyframes cs-stagger-in {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1200px) {
    .case-study {
        padding: 100px 40px 80px;
        gap: 80px;
    }

    .navbar {
        padding: 16px 40px;
    }

    .nav-link {
        padding: 8px 16px;
        font-size: 13px;
    }

    .cs-two-col {
        gap: 80px;
    }

    .cs-meta-grid {
        column-gap: 40px;
    }

    .cs-feature-screens img {
        border-radius: 30px;
        border-width: 6px;
    }

    .cs-feature-screens {
        gap: 20px;
        padding: 20px;
    }

    .cs-introducing {
        margin-left: -40px;
        margin-right: -40px;
        width: calc(100% + 80px);
    }

    .cs-stat-number {
        font-size: 72px;
    }
}

@media (max-width: 900px) {
    .case-study {
        padding: 90px 24px 60px;
        gap: 60px;
    }

    .navbar {
        padding: 12px 24px;
    }

    .nav-logo {
        left: 24px;
    }

    .nav-link {
        padding: 6px 12px;
        font-size: 12px;
    }

    .nav-logo img {
        height: 40px;
    }

    .back-to-top {
        bottom: 24px;
        right: 24px;
        width: 40px;
        height: 40px;
    }

    .cs-title {
        font-size: 28px;
    }

    .cs-two-col {
        flex-direction: column;
        gap: 16px;
    }

    .cs-sidebar-label {
        width: auto;
    }

    .cs-meta-grid {
        grid-template-columns: 1fr;
        row-gap: 24px;
    }

    .cs-meta-overview,
    .cs-meta-role,
    .cs-meta-problem,
    .cs-meta-solution,
    .cs-meta-timeline {
        grid-column: 1;
    }

    .cs-bg-screens {
        flex-wrap: wrap;
        gap: 16px;
    }

    .cs-bg-phone {
        flex: 1 1 40%;
    }

    .cs-persona-row {
        flex-direction: column;
        align-items: center;
    }

    .cs-insight-grid {
        grid-template-columns: 1fr;
    }

    .cs-feature-row {
        flex-direction: column;
    }

    .cs-feature-text {
        width: 100%;
    }

    .cs-feature-screens {
        flex-direction: column;
        align-items: center;
        gap: 16px;
        padding: 20px;
    }

    .cs-feature-screens img {
        width: 100%;
        max-width: 300px;
        border-radius: 30px;
    }

    .cs-edge-row,
    .cs-edge-row-reverse {
        flex-direction: column;
        min-height: auto;
    }

    .cs-edge-text {
        align-items: flex-start;
    }

    .cs-edge-text p,
    .cs-edge-text .cs-feature-title {
        width: 100%;
    }

    .cs-impact-row {
        flex-direction: column;
    }

    .cs-introducing {
        margin-left: -24px;
        margin-right: -24px;
        width: calc(100% + 48px);
        padding-top: 60px;
    }

    .cs-stat-number {
        font-size: 56px;
    }
}

@media (max-width: 640px) {
    .navbar {
        padding: 2rem;
        z-index: 110;
    }

    .nav-logo {
        left: 16px;
    }

    .nav-links {
        display: none !important;
    }

    .nav-logo img {
        height: 3rem;
    }

    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        padding: 8px;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 110;
    }

    .hamburger-line {
        display: block;
        width: 100%;
        height: 2px;
        background: #030b2a;
        border-radius: 2px;
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                    opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .hamburger.is-open .hamburger-line:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .hamburger.is-open .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .hamburger.is-open .hamburger-line:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .mobile-menu {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2rem;
        position: fixed;
        inset: 0;
        z-index: 105;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .mobile-menu.menu-open {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-menu-link {
        font-family: 'Inter', sans-serif;
        font-weight: 600;
        font-size: 24px;
        color: #030b2a;
        text-decoration: none;
        padding: 1rem 3rem;
        border-radius: 1000px;
        opacity: 0;
        transform: translateY(20px);
    }

    @keyframes mobile-nav-enter {
        to { opacity: 1; transform: translateY(0); }
    }

    .mobile-menu.menu-open .mobile-menu-link {
        animation: mobile-nav-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .mobile-menu.menu-open .mobile-menu-link:nth-child(1) { animation-delay: 0.1s; }
    .mobile-menu.menu-open .mobile-menu-link:nth-child(2) { animation-delay: 0.15s; }
    .mobile-menu.menu-open .mobile-menu-link:nth-child(3) { animation-delay: 0.2s; }

    .mobile-menu.menu-closing {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.15s;
    }

    .mobile-menu.menu-closing .mobile-menu-link {
        opacity: 1;
        transform: translateY(0);
        animation: menu-exit 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .mobile-menu.menu-closing .mobile-menu-link:nth-child(3) { animation-delay: 0s; }
    .mobile-menu.menu-closing .mobile-menu-link:nth-child(2) { animation-delay: 0.05s; }
    .mobile-menu.menu-closing .mobile-menu-link:nth-child(1) { animation-delay: 0.1s; }

    @keyframes menu-exit {
        from { opacity: 1; transform: translateY(0); }
        to { opacity: 0; transform: translateY(12px); }
    }

    .mobile-menu-link.active {
        color: #1180f9;
        background: rgba(17, 128, 249, 0.08);
    }

    .nav-exiting .hamburger {
        opacity: 0 !important;
        transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    .case-study {
        padding: 80px 0px 40px;
        gap: 48px;
    }

    .cs-title {
        font-size: 24px;
    }

    .cs-introducing {
        margin-left: -16px;
        margin-right: -16px;
        width: calc(100% + 32px);
        padding-top: 40px;
    }

    .cs-introducing-text {
        font-size: 28px;
    }

    .cs-introducing-logo {
        height: 80px;
    }
}
