/* Case Study Template: reusable for future project detail pages */

.case-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    margin: 2rem 0 0;
}

.case-back:hover {
    color: var(--primary-color);
}

/* Hero */
.case-hero {
    position: relative;
    padding: 3rem 0 4rem;
    overflow: hidden;
}

.case-hero-media {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    margin-top: 2rem;
}

.case-hero-media img {
    display: block;
    width: 100%;
    height: auto;
}

.case-hero-labels {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.5rem 0 1.25rem;
}

.case-hero-label {
    display: inline-block;
    width: fit-content;
    background-color: var(--accent-color);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.case-hero h1 {
    max-width: 800px;
}

.case-hero .lead {
    max-width: 640px;
    font-size: 1.15rem;
}

.case-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.case-tags span {
    display: inline-block;
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--secondary-color);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.9rem;
    border-radius: 100px;
}

/* Meta strip */
.case-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    background-color: var(--section-bg);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 2.5rem;
}

.case-meta-item h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.case-meta-item p {
    font-size: 1rem;
    color: var(--text-color);
    font-weight: 500;
    margin-bottom: 0;
}

/* Narrative (Problem / Approach / Solution) */
.case-narrative {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
}

.case-narrative-item .case-step-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

/* Two-card highlight grid (e.g. "key decisions") */
.case-highlight-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.case-highlight-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.case-highlight-item {
    padding: 2rem;
    border-radius: 16px;
    background-color: var(--section-bg);
}

.case-highlight-item h3 {
    margin-bottom: 0.75rem;
}

/* Deliverables section, all case studies except Cigna (which uses a
   different "Additional Collateral" PDF-link pattern, not this one).
   Second pass: the two-column row-table layout (heading/intro left,
   divider rows right) is gone, replaced by a centered heading + centered
   .section-intro (both back to the standard pattern every other
   case-study section uses) followed by a full-width card grid, one card
   per deliverable. Card styling follows .service-card's mechanism (white
   fill + var(--card-shadow) + the shared dark-mode card override list)
   rather than .case-highlight-item's var(--section-bg) fill, since
   Finvero and Vantrex render this section on a var(--section-bg)-tinted
   .case-section-alt background -- a var(--section-bg) card there would
   be invisible against its own section. */
.case-deliverables-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

/* Odd item count: last card spans both columns instead of leaving an
   orphan half-empty row. Works for any odd count (4, 5, or 6 items
   across the 7 pages) with no per-page override. */
.case-deliverable-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.case-deliverable-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 2rem;
    border-radius: 16px;
    background-color: white;
    box-shadow: var(--card-shadow);
}

/* Fixed-width icon column (not an inline glyph in the text flow) so
   every card's text starts at the same x position regardless of how
   many lines it wraps to. Font Awesome 6.4 solid glyph via ::before
   rather than a markup icon element -- keeps all 7 pages' HTML as a
   plain marker span. Solid style requires font-weight: 900, the glyph
   won't render at the default weight. */
.case-deliverable-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 1.6em;
}

.case-deliverable-marker::before {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--primary-color);
}

.case-deliverable-text {
    color: var(--text-light);
    margin: 0;
}

@media (max-width: 992px) {
    .case-deliverables-grid {
        grid-template-columns: 1fr;
    }
}

/* Gallery for images with mixed aspect ratios: uniform card sizing, cropped to a fixed ratio per gallery/row */
.case-mixed-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem;
}

.case-mixed-gallery .case-figure {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.case-mixed-gallery .case-figure img {
    width: 100%;
    aspect-ratio: var(--card-ratio, 4 / 3);
    object-fit: cover;
}

.case-mixed-gallery .case-figure.span-full {
    grid-column: 1 / -1;
}

.case-mixed-gallery.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.case-narrative-item h3 {
    margin-bottom: 0.75rem;
}

/* Section image + caption */
.case-figure {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    background-color: var(--section-bg);
}

.case-figure img {
    display: block;
    width: 100%;
    height: auto;
    cursor: zoom-in;
}

/* Opt-in for images outside .case-figure (e.g. a dense hero shot) */
.lightbox-trigger {
    cursor: zoom-in;
}

.case-figure figcaption {
    display: flex;
    align-items: center;
    min-height: 4.5rem;
    padding: 0.9rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text-light);
    background-color: #eef1f5;
}

.dark-theme .case-figure figcaption {
    background-color: var(--card-bg);
}

/* Logo system grid */
.logo-system-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.logo-swatch {
    border-radius: 16px;
    padding: 2.5rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
}

.logo-swatch img {
    max-width: 85%;
    max-height: 60px;
}

.logo-swatch-dark {
    background-color: #1e1e1e;
}

.logo-swatch-light {
    background-color: #f8f8f8;
    border: 1px solid var(--border-color);
}

.logo-swatch-label {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.75rem;
    margin-bottom: 0;
}

/* Color palette */
.color-swatch-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.color-swatch {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.color-swatch-fill {
    height: 80px;
}

.color-swatch-info {
    padding: 0.75rem 1rem;
    background-color: var(--section-bg);
}

.color-swatch-info .name {
    font-weight: 600;
    font-size: 0.9rem;
    display: block;
}

.color-swatch-info .hex {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Neutral brand asset grid: for pre-composed mockup/lockup images (no forced dark/light background) */
.brand-asset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.brand-asset-card {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    background-color: var(--section-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    min-height: 160px;
}

.brand-asset-card img {
    max-width: 100%;
    max-height: 140px;
}

/* Stat tiles */
.case-stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.case-stat-tile {
    text-align: center;
    padding: 2rem 1rem;
    border-radius: 16px;
    background-color: var(--section-bg);
}

.case-stat-tile .stat-value {
    display: block;
    font-size: 2.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
}

.case-stat-tile .stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Deliverables gallery */
.case-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem;
}

.case-gallery .case-figure {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.case-gallery .case-figure img {
    flex: 1;
    object-fit: cover;
}

/* Full-width stacked rows: for pairing dissimilar content types (e.g. a
   small mockup next to a full-bleed photo) that shouldn't be forced into
   matching grid-row heights */
.case-figure-stack {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* Wide gallery grid: 3-up, for gallery-style project pages */
.case-gallery-wide {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.75rem;
}

.case-gallery-wide .case-figure {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.case-gallery-wide .case-figure img {
    flex: 1;
    object-fit: cover;
    aspect-ratio: 4 / 3;
}

/* When a lone item lands alone in the final row of a 3-column grid,
   center it in the middle column instead of leaving it pinned left.
   Scoped to the width where each grid actually renders 3 columns. */
@media (min-width: 901px) {
    .case-highlight-grid.cols-3 .case-highlight-item:last-child:nth-child(3n+1),
    .case-mixed-gallery.cols-3 .case-figure:last-child:nth-child(3n+1),
    .logo-system-grid .logo-swatch:last-child:nth-child(3n+1),
    .case-gallery-wide .case-figure:last-child:nth-child(3n+1) {
        grid-column: 2;
    }
}

/* Click-to-enlarge lightbox: reusable across case studies */
.case-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    z-index: 2000;
    cursor: zoom-out;
}

.case-lightbox.active {
    display: flex;
}

.case-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.case-lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.case-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Downloadable deliverable links */
.case-pdf-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.case-pdf-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background-color: var(--section-bg);
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.9rem;
}

.case-pdf-link:hover {
    color: var(--primary-color);
}

.case-pdf-link i {
    font-size: 1.1rem;
    color: var(--accent-color);
}

/* Alternating section backgrounds */
.case-section-alt {
    background-color: var(--section-bg);
}

/* Next case study nav */
.case-next {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .case-meta {
        grid-template-columns: repeat(2, 1fr);
    }

    .case-narrative {
        grid-template-columns: 1fr;
    }

    .case-highlight-grid,
    .case-highlight-grid.cols-3 {
        grid-template-columns: 1fr;
    }

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

    .case-gallery {
        grid-template-columns: 1fr;
    }

    .case-mixed-gallery,
    .case-mixed-gallery.cols-3 {
        grid-template-columns: 1fr;
    }

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

    .case-stat-row {
        grid-template-columns: 1fr;
    }

    .case-gallery-wide {
        grid-template-columns: repeat(2, 1fr);
    }

    .case-pdf-list {
        grid-template-columns: 1fr;
    }
}

.dark-theme .case-tags span {
    background-color: rgba(59, 130, 246, 0.2);
}

.dark-theme .logo-swatch-light {
    background-color: #f8f8f8;
}

@media (max-width: 560px) {
    .case-meta {
        grid-template-columns: 1fr;
    }

    .logo-system-grid {
        grid-template-columns: 1fr;
    }

    .brand-asset-grid {
        grid-template-columns: 1fr;
    }

    .case-gallery-wide {
        grid-template-columns: 1fr;
    }
}
