/* ============================================
   INSIGHTRIX — Individual Case Study Pages
   Rich visuals, diagrams, metrics
   ============================================ */

/* --- Case Study Hero --- */
.cs-hero {
    padding: 120px 0 0;
    background: var(--bg);
    position: relative;
    overflow: hidden;
}

.cs-hero-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    min-height: 420px;
}

.cs-hero-content {
    padding: 40px 0;
}

.cs-hero-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.cs-hero-breadcrumb a {
    color: var(--text-muted);
    transition: color 0.3s;
    cursor: none;
}

.cs-hero-breadcrumb a:hover { color: var(--green); }

.cs-hero-breadcrumb svg { flex-shrink: 0; opacity: 0.5; }

.cs-hero-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.cs-tag {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 5px 12px;
    background: var(--mint);
    color: var(--green-dark);
    border-radius: 6px;
}

.cs-tag-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.cs-hero-title {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 16px;
}

.cs-hero-summary {
    font-size: 1.0625rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 28px;
}

.cs-hero-quick-stats {
    display: flex;
    gap: 32px;
}

.cs-quick-stat {
    text-align: left;
}

.cs-quick-stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--green);
    letter-spacing: -0.02em;
    line-height: 1;
}

.cs-quick-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Hero Visual */
.cs-hero-visual {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    min-height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cs-hero-gradient {
    position: absolute;
    inset: 0;
    opacity: 0.9;
    z-index: 0;
}

.cs-hero-visual-content {
    position: relative;
    z-index: 1;
    padding: 40px;
    color: white;
    text-align: center;
    width: 100%;
}

/* --- Visual Diagrams (CSS-only) --- */

/* Flow Diagram */
.cs-flow {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.cs-flow-step {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: white;
    text-align: center;
    min-width: 100px;
}

.cs-flow-arrow {
    color: rgba(255,255,255,0.4);
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Metric Ring */
.cs-metric-ring {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 6px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    margin: 0 auto 20px;
    position: relative;
}

.cs-metric-ring::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 6px solid transparent;
    border-top-color: white;
    border-right-color: white;
    animation: cs-ring-spin 3s linear infinite;
}

@keyframes cs-ring-spin {
    to { transform: rotate(360deg); }
}

.cs-metric-ring-value {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.cs-metric-ring-label {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 4px;
}

/* Bar Chart Visual */
.cs-bars {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 160px;
    justify-content: center;
    margin-bottom: 16px;
}

.cs-bar {
    width: 36px;
    border-radius: 8px 8px 0 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: height 0.6s var(--ease-out-expo);
}

.cs-bar-fill {
    width: 100%;
    border-radius: 8px 8px 0 0;
    background: rgba(255,255,255,0.3);
    position: absolute;
    bottom: 0;
    transition: height 0.8s var(--ease-out-expo);
}

.cs-bar-fill.highlight {
    background: white;
}

.cs-bar-label {
    position: absolute;
    bottom: -24px;
    font-size: 0.625rem;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
}

/* Comparison Cards */
.cs-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
}

.cs-compare-card {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

.cs-compare-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
    margin-bottom: 8px;
}

.cs-compare-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.cs-compare-desc {
    font-size: 0.75rem;
    opacity: 0.7;
}

.cs-compare-arrow {
    font-size: 2rem;
    opacity: 0.4;
}

/* Grid Visual */
.cs-grid-visual {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.cs-grid-item {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.cs-grid-item-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.cs-grid-item-label {
    font-size: 0.6875rem;
    opacity: 0.7;
}

/* --- Content Sections --- */
.cs-section {
    padding: 80px 0;
    background: var(--bg);
}

.cs-section-dark {
    background: var(--bg-hero);
    color: var(--text-on-dark);
}

.cs-section-alt {
    background: var(--bg-secondary);
}

.cs-section-header {
    margin-bottom: 48px;
}

.cs-section-label {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--green);
    margin-bottom: 12px;
}

.cs-section-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text);
}

.cs-section-dark .cs-section-title {
    color: var(--text-on-dark);
}

/* Challenge & Solution Grid */
.cs-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
}

.cs-content-block p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
}

.cs-content-block h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

/* Bullet List */
.cs-list {
    list-style: none;
    padding: 0;
}

.cs-list li {
    position: relative;
    padding-left: 24px;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.cs-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
}

/* Numbered Steps */
.cs-steps {
    counter-reset: cs-step;
}

.cs-step-item {
    counter-increment: cs-step;
    display: flex;
    gap: 20px;
    margin-bottom: 28px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.cs-step-item:hover {
    border-color: rgba(16,185,129,0.15);
    box-shadow: var(--shadow-md);
}

.cs-step-num {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--mint);
    color: var(--green-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.cs-step-num::before {
    content: counter(cs-step, decimal-leading-zero);
}

.cs-step-content h4 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.cs-step-content p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* --- Results Section --- */
.cs-results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.cs-result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 20px;
    text-align: center;
    transition: transform 0.4s var(--ease-out-expo), box-shadow 0.3s;
}

.cs-result-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.cs-result-value {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--green);
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 8px;
}

.cs-result-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.cs-result-sublabel {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Tech Stack --- */
.cs-tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.cs-tech-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    transition: border-color 0.3s, background 0.3s;
}

.cs-tech-badge:hover {
    border-color: var(--green);
    background: var(--mint);
}

.cs-tech-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
}

/* --- Timeline Visual --- */
.cs-timeline {
    position: relative;
    padding-left: 40px;
}

.cs-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.cs-timeline-item {
    position: relative;
    margin-bottom: 32px;
    padding: 20px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.cs-timeline-item::before {
    content: '';
    position: absolute;
    left: -33px;
    top: 24px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--green);
    border: 3px solid var(--bg);
}

.cs-timeline-week {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--green);
    margin-bottom: 4px;
}

.cs-timeline-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.cs-timeline-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* --- Architecture Diagram --- */
.cs-architecture {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    overflow: hidden;
}

.cs-arch-layers {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cs-arch-layer {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cs-arch-label {
    width: 100px;
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-align: right;
}

.cs-arch-boxes {
    display: flex;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
}

.cs-arch-box {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    flex: 1;
    min-width: 90px;
    text-align: center;
    border: 1px solid;
}

.cs-arch-box-green {
    background: var(--mint);
    color: var(--green-dark);
    border-color: var(--mint-strong);
}

.cs-arch-box-blue {
    background: #e0e7ff;
    color: #3730a3;
    border-color: #c7d2fe;
}

.cs-arch-box-amber {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.cs-arch-box-gray {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-color: var(--border);
}

.cs-arch-connector {
    text-align: center;
    padding: 4px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* --- Quote Block --- */
.cs-quote {
    border-left: 4px solid var(--green);
    padding: 24px 32px;
    background: var(--mint);
    border-radius: 0 16px 16px 0;
    margin: 32px 0;
}

.cs-quote p {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--green-dark);
    line-height: 1.6;
    font-style: italic;
    margin-bottom: 8px !important;
}

.cs-quote cite {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: normal;
}

/* --- Next Case Study Nav --- */
.cs-next {
    padding: 60px 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.cs-next-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.cs-next-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.cs-next-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    transition: color 0.3s;
}

.cs-next-title:hover {
    color: var(--green);
}

.cs-next-arrow {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: background 0.3s, color 0.3s, border-color 0.3s;
    flex-shrink: 0;
}

.cs-next-arrow:hover {
    background: var(--green);
    border-color: var(--green);
    color: white;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .cs-hero-inner {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .cs-hero-visual {
        min-height: 280px;
    }

    .cs-two-col {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .cs-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .cs-hero {
        padding: 100px 0 0;
    }

    .cs-hero-quick-stats {
        flex-wrap: wrap;
        gap: 20px;
    }

    .cs-results-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .cs-result-card {
        padding: 20px 16px;
    }

    .cs-result-value {
        font-size: 1.75rem;
    }

    .cs-comparison {
        grid-template-columns: 1fr;
        gap: 12px;
    }

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

    .cs-architecture {
        padding: 24px;
    }

    .cs-arch-layer {
        flex-direction: column;
        align-items: flex-start;
    }

    .cs-arch-label {
        text-align: left;
        width: auto;
    }

    .cs-grid-visual {
        grid-template-columns: repeat(2, 1fr);
    }
}
