/* Case Study Specific Styles */
.cs-wrap {
    position: relative;
    z-index: 2;
    max-width: 1000px;
    margin: 0 auto;
    padding: 120px 24px 60px;
}

/* HERO */
.cs-hero {
    text-align: left;
    margin-bottom: 64px;
    padding: 0;
    min-height: 0;
}

.cs-hero .back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 32px;
    transition: color 0.3s;
}

.cs-hero .back-link:hover {
    color: var(--a1);
}

.cs-hero h1 {
    font-family: 'Michroma', sans-serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 16px;
    line-height: 1.2;
}

.cs-hero .summary {
    font-size: 1.25rem;
    color: var(--muted);
    margin-bottom: 32px;
    max-width: 800px;
}

.cs-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
    padding: 24px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.cs-meta-item .lbl {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.cs-meta-item .val {
    font-weight: 500;
}

.tech-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tech-badges .badge {
    position: static;
    top: auto;
    right: auto;
    padding: 3px 10px;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    background: rgba(79, 142, 247, .12);
    border: 1px solid rgba(79, 142, 247, .3);
    color: var(--a1);
    box-shadow: none;
    border-radius: 30px;
}

/* SECTIONS */
.cs-section,
.cs-cta {
    padding: 0;
    margin-bottom: 64px;
}

.cs-section h2 {
    font-family: 'Michroma', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--a1);
}

/* SECTION TEXT RHYTHM */
.cs-section>p {
    max-width: 75ch;
}

.cs-section>p+p {
    margin-top: 14px;
}

.cs-section .tech-list {
    margin-top: 18px;
}

/* FEATURE GRID */
.feat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.feat-card {
    padding: 32px;
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: transform 0.3s;
}

.feat-card:hover {
    transform: translateY(-5px);
}

.feat-card h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text);
}

.feat-card p {
    font-size: 14px;
    color: var(--muted);
}

/* FEATURE CARD ICONS */
.feat-card .fc-ico {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 16px;
    border-radius: 12px;
    font-size: 18px;
    color: var(--a1);
    background: rgba(79, 142, 247, 0.12);
    border: 1px solid rgba(79, 142, 247, 0.28);
}

.feat-card:nth-child(3n+2) .fc-ico {
    color: var(--a2);
    background: rgba(124, 92, 191, 0.12);
    border-color: rgba(124, 92, 191, 0.28);
}

.feat-card:nth-child(3n) .fc-ico {
    color: var(--a3);
    background: rgba(34, 211, 168, 0.12);
    border-color: rgba(34, 211, 168, 0.28);
}

.feat-card:hover {
    border-color: rgba(79, 142, 247, 0.35);
}

/* SOLUTION — BEFORE / AFTER COMPARISON */
.sol-compare {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
    gap: 16px;
    margin: 32px 0 40px;
}

.sol-ba {
    padding: 24px 28px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--card2);
}

.sol-ba h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.sol-ba p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--muted);
}

.sol-ba--before h3 {
    color: var(--muted);
}

.sol-ba--after {
    border-color: rgba(34, 211, 168, 0.35);
    background: rgba(34, 211, 168, 0.06);
    box-shadow: inset 0 0 0 1px rgba(34, 211, 168, 0.08);
}

.sol-ba--after h3 {
    color: var(--a3);
}

.sol-ba--after p {
    color: var(--text);
}

.sol-ba-arrow {
    align-self: center;
    justify-self: center;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--a1);
    font-size: 16px;
}

@media (max-width: 640px) {
    .sol-compare {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .sol-ba-arrow {
        transform: rotate(90deg);
    }
}

/* GALLERY */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.gallery-item {
    cursor: pointer;
    overflow: hidden;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--border);
}

.gallery-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: top;
    display: block;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: transform 0.5s;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item figcaption {
    padding: 12px;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
}

/* ARCHITECTURE */
.arch-diagram {
    padding: 40px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 32px;
}

.arch-flow {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.arch-node {
    padding: 12px 20px;
    background: var(--card2);
    border: 1px solid var(--a1);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

.arch-arrow {
    color: var(--muted);
}

.tech-list {
    list-style: none;
}

.tech-list li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 12px;
    color: var(--muted);
}

.tech-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--a1);
}

/* CHALLENGES */
.challenge-item {
    margin-bottom: 40px;
    padding: 32px;
    background: var(--card2);
    border-left: 4px solid var(--a2);
    border-radius: 0 16px 16px 0;
}

.challenge-step {
    margin-bottom: 16px;
}

.challenge-step .lbl {
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #b9a5f5;
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
}

/* RESULTS */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.stat-card {
    padding: 32px;
    background: linear-gradient(135deg, var(--card), var(--card2));
    border: 1px solid var(--border);
    border-radius: 16px;
    text-align: center;
}

.stat-card .num {
    font-family: 'Michroma', sans-serif;
    font-size: 2rem;
    color: var(--a3);
    margin-bottom: 8px;
}

.stat-card .lbl {
    font-size: 14px;
    color: var(--muted);
}

/* CONFIDENTIALITY */
.conf-note {
    padding: 24px;
    margin-bottom: 32px;
    background: rgba(124, 92, 191, 0.05);
    border: 1px dashed var(--a2);
    border-radius: 12px;
    font-size: 14px;
    color: var(--muted);
    font-style: italic;
}

/* BACK TO PORTFOLIO (bottom) */
.cs-back-link {
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 8px;
    margin-bottom: 32px;
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: 30px;
    background: var(--card);
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s, border-color 0.3s, transform 0.3s;
}

.cs-back-link:hover {
    color: var(--a1);
    border-color: rgba(79, 142, 247, 0.35);
    transform: translateY(-2px);
}

/* CTA */
.cs-cta {
    text-align: center;
    padding: 48px 24px;
    background: var(--card);
    border-radius: 24px;
    border: 1px solid var(--border);
}

.cs-cta h2 {
    font-family: 'Michroma', sans-serif;
    margin-bottom: 24px;
}

/* LIGHTBOX */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 24, 0.95);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.lightbox-content img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    padding: 20px;
    user-select: none;
}

.lightbox-prev {
    left: -60px;
}

.lightbox-next {
    right: -60px;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .cs-wrap {
        padding: 100px 20px 40px;
    }

    .cs-section,
    .cs-cta {
        margin-bottom: 44px;
    }

    .arch-flow {
        flex-direction: column;
    }

    .lightbox-nav {
        display: none;
    }
}

/* ANIMATIONS */
.rv {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rv.on {
    opacity: 1;
    transform: translateY(0);
}