/* ============================================
   CASE STUDY STYLES
   Specific styling for case study pages
   ============================================ */

/* ============================================
   CASE STUDY SPACING OVERRIDE
   Tighter spacing for case studies only
   ============================================ */
.case-study-page {
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-xxl: 4rem;
}

/* ============================================
   CASE STUDY HERO
   ============================================ */
.case-study-hero {
    padding-top: calc(var(--space-xxl) * 2);
    padding-bottom: calc(var(--space-xxl) * 1.5);
    background-color: var(--color-background-alt);
    background-size: cover;
    background-position: left center;
    background-repeat: no-repeat;
    position: relative;
}

.case-study-hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.3));
    z-index: 0;
}

.case-study-hero > .container {
    position: relative;
    z-index: 1;
}

.case-study-hero .hero-meta,
.case-study-hero .hero-title,
.case-study-hero .hero-subtitle,
.case-study-hero .hero-role {
    max-width: 50%;
}

@media (max-width: 1023px) {
    .case-study-hero .hero-meta,
    .case-study-hero .hero-title,
    .case-study-hero .hero-subtitle,
    .case-study-hero .hero-role {
        max-width: 67%;
    }
}

/* Case study specific backgrounds */
.case-study-hero--smart-agency {
    background-image: url('../images/smart-agency-hero.jpg');
}

.case-study-hero--strato {
    background-image: url('../images/strato-hero.jpg');
}

.case-study-hero--babbel {
    background-image: url('../images/babbel-hero.jpg');
}

.case-study-hero--inpera {
    background-image: url('../images/inpera-hero.jpg');
}

.case-study-hero--design-system {
    background-image: url('../images/design-system-hero.jpg');
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    font-size: var(--text-sm);
    color: var(--color-text-medium);
}

.client-name {
    color: var(--color-primary);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.divider {
    color: var(--color-border);
}

.hero-title {
    font-size: clamp(var(--text-4xl), 6vw, var(--text-6xl));
    font-weight: var(--font-normal);
    margin-bottom: var(--space-lg);
    line-height: var(--leading-tight);
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: clamp(var(--text-xl), 3vw, var(--text-2xl));
    line-height: var(--leading-snug);
    color: var(--color-text-medium);
    max-width: 800px;
    margin-bottom: var(--space-xl);
}

.highlight-stat {
    color: var(--color-primary);
    font-weight: var(--font-bold);
}

.hero-role {
    font-size: var(--text-base);
    color: var(--color-text-medium);
}

/* ============================================
   CASE STUDY SECTIONS
   ============================================ */
.case-study-section {
    padding: var(--space-xl) 0;
}

@media (min-width: 768px) {
    .case-study-section {
        padding: var(--space-xxl) 0;
    }
}

.container.narrow {
    max-width: var(--content-width);
}

.section-heading {
    font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl));
    margin-bottom: var(--space-lg);
    font-weight: var(--font-semibold);
}

/* ============================================
   CONTEXT SECTION
   ============================================ */
.context-section {
    background: var(--color-background);
}

.context-section .container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
}

.context-arrow {
    display: none;
    flex-shrink: 0;
    width: 58px;
    height: 58px;
    color: var(--color-primary);
    opacity: 0.4;
}

.context-arrow svg {
    width: 100%;
    height: 100%;
}

.context-arrow:first-child {
    animation: bounceRight 2s ease-in-out infinite;
}

.context-arrow:last-child {
    animation: bounceLeft 2s ease-in-out infinite;
}

@keyframes bounceRight {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(8px);
    }
}

@keyframes bounceLeft {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(-8px);
    }
}

@media (min-width: 768px) {
    .context-arrow {
        display: block;
    }
}

.intro-text {
    font-size: var(--text-xl);
    line-height: var(--leading-snug);
    color: var(--color-text-medium);
    max-width: 600px;
    text-align: center;
    margin: 0;
}

/* ============================================
   PROBLEM SECTION
   ============================================ */
.problem-section {
    background: var(--color-background-alt);
}

.problem-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
}

/* Problem items always stack, never side-by-side */
@media (min-width: 768px) {
    .problem-grid {
        grid-template-columns: 1fr;
    }
}

.problem-item {
    background: var(--color-background);
    padding: var(--space-lg);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
}

/* Side-by-side layout on desktop when image is present */
@media (min-width: 768px) {
    .problem-item {
        display: flex;
        gap: var(--space-lg);
        align-items: flex-start;
    }
    
    .problem-item-content {
        flex: 1;
        min-width: 0;
    }
    
    .problem-item .case-study-image {
        flex: 1.5;
        margin: 0;
    }
    
    .problem-item .case-study-image img {
        width: 100%;
        height: auto;
    }
}

.problem-number {
    width: 48px;
    height: 48px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-2xl);
    margin-bottom: var(--space-md);
}

.problem-title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-md);
    line-height: var(--leading-normal);
}

.problem-details {
    list-style: none;
    color: var(--color-text-medium);
}

.problem-details li {
    padding: var(--space-xs) 0;
    padding-left: var(--space-md);
    position: relative;
    line-height: var(--leading-normal);
}

.problem-details li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--color-primary);
    font-weight: bold;
}

.problem-description {
    color: var(--color-text-medium);
    line-height: var(--leading-snug);
    margin-bottom: var(--space-md);
}

.user-quotes {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.user-quotes blockquote {
    font-style: italic;
    color: var(--color-text-light);
    font-size: var(--text-sm);
    padding-left: var(--space-md);
    border-left: 2px solid var(--color-border);
    margin: 0;
}

/* ============================================
   PROPOSAL SECTION
   ============================================ */
.proposal-section {
    background: var(--color-background);
}

.proposal-intro {
    max-width: 800px;
    margin-bottom: var(--space-xl);
}

.lead-text {
    font-size: var(--text-2xl);
    font-weight: var(--font-medium);
    line-height: var(--leading-snug);
    margin-bottom: var(--space-md);
    color: var(--color-text-dark);
}

.rationale {
    font-size: var(--text-lg);
    line-height: var(--leading-snug);
    color: var(--color-text-medium);
}

.proposal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
}

.proposal-item {
    border-left: 4px solid var(--color-primary);
    padding-left: var(--space-lg);
}

.proposal-number {
    display: inline-flex;
    width: 36px;
    height: 36px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-xl);
    margin-bottom: var(--space-md);
}

.proposal-title {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-md);
    line-height: var(--leading-normal);
}

.proposal-reasons,
.proposal-implementation {
    margin-top: var(--space-md);
}

.proposal-reasons h4,
.proposal-implementation p strong {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text-dark);
    margin-bottom: var(--space-sm);
}

.proposal-reasons ul,
.proposal-implementation ul {
    list-style: none;
    margin-top: var(--space-sm);
}

.proposal-reasons li,
.proposal-implementation li {
    padding: var(--space-sm) 0;
    padding-left: var(--space-md);
    position: relative;
    color: var(--color-text-medium);
    line-height: var(--leading-normal);
}

.proposal-reasons li::before,
.proposal-implementation li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--color-primary);
    font-weight: bold;
}

.note {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--color-background-alt);
    border-radius: var(--border-radius);
    font-size: var(--text-sm);
}

/* ============================================
   CHALLENGE SECTION
   ============================================ */
.challenge-section {
    background: var(--color-background-alt);
}

.challenge-content {
    max-width: 700px;
    margin: 0 auto;
}

.challenge-text {
    font-size: var(--text-lg);
    line-height: var(--leading-snug);
    color: var(--color-text-medium);
    margin-bottom: var(--space-md);
}

.challenge-outcome {
    margin-top: var(--space-xl);
    padding: var(--space-lg);
    background: var(--color-background);
    border: 2px solid var(--color-primary);
    border-radius: var(--border-radius);
    text-align: center;
}

.challenge-outcome h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-md);
}

.big-text {
    font-size: var(--text-2xl);
    line-height: var(--leading-snug);
    color: var(--color-text-dark);
}

.big-text strong {
    color: var(--color-primary);
}

/* ============================================
   TURNING POINT SECTION
   ============================================ */
.turning-point-section {
    background: var(--color-background);
}

.turning-point-content {
    max-width: 900px;
    margin: 0 auto;
}

.data-reveal {
    margin: var(--space-xl) 0;
    padding: var(--space-xl);
    background: var(--color-background-alt);
    border-radius: var(--border-radius);
}

.stat-highlight {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.stat-number {
    font-size: 5rem;
    font-weight: var(--font-bold);
    color: var(--color-primary);
    line-height: 1;
    margin-bottom: var(--space-md);
}

.stat-label {
    font-size: var(--text-lg);
    line-height: var(--leading-snug);
    color: var(--color-text-medium);
}

.insight-box {
    background: var(--color-background);
    padding: var(--space-lg);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--border-radius);
}

.insight-box h4 {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-sm);
}

.insight-box p {
    color: var(--color-text-medium);
    line-height: var(--leading-snug);
    margin: 0;
}

.reframe-text {
    font-size: var(--text-lg);
    line-height: var(--leading-snug);
    color: var(--color-text-medium);
    margin-bottom: var(--space-md);
}

/* ============================================
   RESULTS SECTION
   ============================================ */
.results-section {
    background: var(--color-primary);
    color: white;
}

.results-section .section-heading {
    color: white;
}

.timeline {
    max-width: 700px;
    margin: 0 auto;
}

.timeline-item {
    position: relative;
    padding-left: var(--space-xl);
    padding-bottom: var(--space-xl);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: 0;
    top: 0;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    border: 3px solid var(--color-primary);
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 16px;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.3);
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-content h4 {
    color: white;
    font-size: var(--text-lg);
    margin-bottom: var(--space-sm);
    font-weight: var(--font-semibold);
}

.timeline-content p {
    color: rgba(255, 255, 255, 0.9);
    line-height: var(--leading-snug);
    margin-bottom: var(--space-sm);
}

.timeline-content .detail {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.7);
}

.timeline-item.success {
    padding-bottom: 0;
}

.timeline-item.success .timeline-marker {
    width: 24px;
    height: 24px;
    background: white;
    border: 4px solid var(--color-primary);
}

.big-stat {
    text-align: center;
    padding: var(--space-lg) 0;
}

.stat-number.large {
    font-size: 6rem;
    color: white;
}

.stat-description {
    font-size: var(--text-xl);
    color: rgba(255, 255, 255, 0.95);
    max-width: 500px;
    margin: 0 auto;
}

/* ============================================
   TAKEAWAYS SECTION
   ============================================ */
.takeaways-section {
    background: var(--color-background-alt);
}

/* Override narrow container for takeaways */
.takeaways-section .container {
    max-width: var(--max-width);
}

.takeaways-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}

@media (min-width: 768px) {
    .takeaways-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.takeaway-item {
    background: var(--color-background);
    padding: var(--space-lg);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
}

.takeaway-item h4 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-sm);
    color: var(--color-primary);
}

.takeaway-item p {
    color: var(--color-text-medium);
    line-height: var(--leading-snug);
    margin: 0;
}

/* ============================================
   NEXT PROJECT
   ============================================ */
.next-project {
    background: var(--color-text-dark);
    padding: var(--space-xl) 0;
}

.next-project-link {
    display: block;
    color: white;
    text-align: center;
    transition: transform var(--transition-normal);
}

.next-project-link:hover {
    transform: translateY(-4px);
    opacity: 1;
}

.next-label {
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: var(--space-sm);
}

.next-title {
    font-size: clamp(var(--text-2xl), 3vw, var(--text-3xl));
    color: white;
    margin: 0;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 767px) {
    .case-study-hero {
        padding-top: var(--space-lg);
    }

    .hero-title {
        font-size: var(--text-3xl);
    }

    .hero-subtitle {
        font-size: var(--text-lg);
    }

    .problem-grid,
    .takeaways-grid {
        grid-template-columns: 1fr;
    }

    .proposal-item {
        padding-left: var(--space-md);
    }

    .stat-number {
        font-size: var(--text-6xl);
    }

    .stat-number.large {
        font-size: var(--text-7xl);
    }

    .timeline-item {
        padding-left: var(--space-lg);
    }
}

/* ============================================
   IMAGE PLACEHOLDERS
   ============================================ */
.case-study-image-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--color-background-alt);
    border: 2px dashed var(--color-border);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-light);
    font-size: var(--text-sm);
    margin: var(--space-lg) 0;
}
/* Case Study Images */
.case-study-image {
    width: 100%;
    margin: var(--space-lg) 0;
}

.case-study-image img {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-caption {
    font-size: var(--text-sm);
    color: var(--color-text-medium);
    text-align: center;
    margin-top: var(--space-sm);
    font-style: italic;
}
/* Full-width images */
.case-study-image.full-width {
    max-width: 100%;
    margin: var(--space-xl) 0;
	padding: 0 5%;
}

.case-study-image.full-width img {
    width: 100%;
    border-radius: 0;
}

/* Centered buttons */
.button-center {
    text-align: center;
    margin-top: var(--space-lg);
}

/* ============================================
   LIGHTBOX
   ============================================ */
.case-study-image img {
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.case-study-image img:hover {
    opacity: 0.9;
}

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-close {
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    width: 48px;
    height: 48px;
    background: transparent;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.lightbox-close:hover {
    background: white;
}

.lightbox-close::before,
.lightbox-close::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 2px;
    background: white;
    transition: background var(--transition-fast);
}

.lightbox-close:hover::before,
.lightbox-close:hover::after {
    background: var(--color-text-dark);
}

.lightbox-close::before {
    transform: rotate(45deg);
}

.lightbox-close::after {
    transform: rotate(-45deg);
}

.lightbox-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    cursor: zoom-in;
}

.lightbox-image-container.zoomed {
    cursor: grab;
    justify-content: flex-start;
    align-items: flex-start;
}

.lightbox-image-container.zoomed.dragging {
    cursor: grabbing;
}

.lightbox-image {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
    transition: max-width 0.3s ease, max-height 0.3s ease;
}

.lightbox-image-container.zoomed .lightbox-image {
    max-width: none;
    max-height: none;
    cursor: zoom-out;
}
