/* References Page Specific Styles */
body {
    background-color: rgb(25, 25, 25);
}

/* --- Hero Slider --- */
.ref-hero {
    position: relative;
    width: 100%;
    height: 80vh;
    min-height: 600px;
    overflow: hidden;
    margin-bottom: var(--space-xl);
}

/* --- Group Headers --- */
.ref-group {
    margin-bottom: 5rem;
}

.ref-group-header {
    margin-bottom: 3rem;
    padding-left: 20px;
    border-left: 3px solid var(--color-accent);
}

.ref-group-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.ref-group-subtitle {
    font-size: 2.5rem;
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 300;
    line-height: 1.1;
}

.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    background-size: cover;
    background-position: center;
}

.hero-slide.active {
    opacity: 1;
    z-index: 1;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    /* Slight overall tint */
}

.slide-content {
    position: absolute;
    top: 50%;
    left: 5%;
    /* Left aligned as requested */
    transform: translateY(-50%);
    width: 90%;
    max-width: 600px;
    background: rgba(0, 0, 0, 0.7);
    /* Dark background for text */
    backdrop-filter: blur(10px);
    padding: var(--space-md);
    border-left: 5px solid var(--color-accent);
    color: var(--color-white);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    opacity: 0;
    transform: translateY(-40%);
    transition: all 0.8s ease-out 0.3s;
    /* Delay for slide in */
}

.hero-slide.active .slide-content {
    opacity: 1;
    transform: translateY(-50%);
}

.slide-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    font-family: var(--font-heading);
}

.slide-desc {
    font-size: 1.1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

/* Slider Controls */
.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--color-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;
    font-size: 1.5rem;
}

.slider-arrow:hover {
    background: var(--color-accent);
    color: var(--color-black);
    border-color: var(--color-accent);
}

.slider-prev {
    left: 20px;
}

.slider-next {
    right: 20px;
}


/* --- Interactive Project Rows (Arrow Split) --- */
.projects-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding-bottom: var(--space-xl);
}

.project-row {
    position: relative;
    width: 100%;
    height: 200px;
    /* Reduced height as requested (Thinner) */
    display: flex;
    gap: 20px;
    overflow: visible;
}

.project-card {
    position: relative;
    height: 100%;
    /* Default: 50% width + overlap buffer */
    width: calc(50% + 25px);
    flex: 0 0 auto;

    background-size: cover;
    background-position: center;
    cursor: pointer;

    /* Layout transition */
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;

    z-index: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    /* border-radius: 0; Keep sharp for arrows */
}

/* Overlap Logic - Restored with Gap */
.project-card+.project-card {
    /* 50px Clip Depth. -45px Margin = 5px Visual Gap */
    margin-left: -45px;
}

/* Hover Interaction: Push & Shrink */
.project-row:hover .project-card {
    filter: brightness(0.6) grayscale(0.6);
    /* Dim inactive */
}

.project-row:hover .project-card:hover {
    width: calc(75% + 25px);
    /* Expand active */
    filter: brightness(1.1) grayscale(0);
    /* Highlight active */
    /* Maintain z-index to keep arrow lock intact */
}

.project-row:hover .project-card:not(:hover) {
    width: calc(25% + 25px);
    /* Shrink inactive */
}

/* --- Card Content Positioning "Split Layout" --- */

/* Base Overlay - Flex for center alignment default */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0 4rem;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.6), transparent, rgba(0, 0, 0, 0.6));
    display: flex;
    align-items: center;
    transition: all 0.4s ease;
}

.project-card:hover .card-overlay {
    background: rgba(0, 0, 0, 0.6);
    /* Slightly darker on hover */
    backdrop-filter: blur(4px);
}

/* Base Content Wrapper */
.card-content {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s ease;
    width: 45%;
    /* Constrain width */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.project-card:hover .card-content {
    opacity: 1;
    pointer-events: auto;
}

/* Base Title */
.card-title {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    width: 40%;
    z-index: 2;
}

/* --- LEFT CARD CONFIG --- */
/* Title on Left */
.project-card.left .card-title {
    left: 4rem;
    text-align: left;
}

/* Content on Right (Expands into empty space) */
.project-card.left .card-content {
    right: 4rem;
    align-items: flex-end;
    /* Align text to right */
    text-align: right;
}

/* Hover Separation - Move INWARDS to center */
.project-row:hover .project-card.left:hover .card-title {
    left: 10%;
    /* Percent based for responsiveness */
}

.project-row:hover .project-card.left:hover .card-content {
    right: 15%;
    /* Move away from edge towards center */
    transform: translateY(-50%) translateX(0);
}


/* --- RIGHT CARD CONFIG --- */
/* Title on Right */
.project-card.right .card-title {
    right: 4rem;
    text-align: right;
}

/* Content on Left (Expands into empty space) */
.project-card.right .card-content {
    left: 4rem;
    align-items: flex-start;
    /* Align text to left */
    text-align: left;
}

/* Hover Separation - Move INWARDS to center */
.project-row:hover .project-card.right:hover .card-title {
    right: 10%;
}

.project-row:hover .project-card.right:hover .card-content {
    left: 15%;
    /* Move away from edge towards center */
    transform: translateY(-50%) translateX(0);
}


/* Hide Description box since we use Stats */
.card-desc {
    display: none;
}

/* Stats grid alignment based on parent flex */
.card-stats-wrapper {
    margin-bottom: 15px;
    justify-content: inherit;
    /* Inherit flex-start/end from parent */
    gap: 15px;
}

/* Inactive State: Fade Title */
.project-row:hover .project-card:not(:hover) .card-title {
    opacity: 0.3;
}

/* Duplicate block removed (merged into main mobile block below) */


/* --- Card Preview Stats Styling --- */
.card-stats-wrapper {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.preview-stat {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.1);
    /* Subtle box */
    padding: 8px 12px;
    border-left: 2px solid var(--color-accent);
    backdrop-filter: blur(4px);
}

.p-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.p-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
    letter-spacing: 1px;
}

.card-link {
    font-size: 0.9rem;
    color: #fff !important;
    /* Requested White */
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.card-link:hover {
    opacity: 1;
}


/* Z-Index Arrow Locking Layers - Restored */
.project-row.arrow-right .project-card.left {
    z-index: 2;
}

.project-row.arrow-right .project-card.right {
    z-index: 1;
}

.project-row.arrow-left .project-card.left {
    z-index: 1;
}

.project-row.arrow-left .project-card.right {
    z-index: 2;
}

/* Clip Paths - Restored */
/* Arrow Right Type (>) */
.project-row.arrow-right .project-card.left {
    clip-path: polygon(0 0, calc(100% - 50px) 0, 100% 50%, calc(100% - 50px) 100%, 0 100%);
}

.project-row.arrow-right .project-card.right {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 50px 50%);
}

/* Arrow Left Type (<) */
.project-row.arrow-left .project-card.left {
    clip-path: polygon(0 0, 100% 0, calc(100% - 50px) 50%, 100% 100%, 0 100%);
}

.project-row.arrow-left .project-card.right {
    clip-path: polygon(0 50%, 50px 0, 100% 0, 100% 100%, 50px 100%);
}


/* Content Handling during Shrink */
/* Content Handling */
/* Removed old block */

/* Card Overlay Styling */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0 4rem;
    /* Stronger default gradient for visibility */
    background: linear-gradient(to right, rgba(0, 0, 0, 0.6), transparent 50%, rgba(0, 0, 0, 0.6));
    display: flex;
    align-items: center;
    transition: all 0.4s ease;
}

/* Darker Overlay on Hover for Readability */
.project-card:hover .card-overlay {
    /* Handled in main block */
}

/* Legacy overrides removal */
.project-card.left .card-overlay,
.project-card.right .card-overlay {
    /* Reset to allow absolute content positioning */
    justify-content: center;
    /* or default */
}

.card-title {
    font-size: 2rem;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.5rem;
}


/* Mobile: Stack them */
@media (max-width: 768px) {
    .project-row {
        flex-direction: column;
        height: auto;
        gap: 30px;
        margin-bottom: 30px;
    }

    .project-card {
        width: 100% !important;
        height: 400px !important;
        /* Fixed height for consistency */
        min-height: 400px;
        flex: none;
        clip-path: none !important;
        border-radius: var(--radius-sm);
        margin: 0 !important;
    }

    /* Fix Overlay: Full spread, dark at bottom */
    .card-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.6) 50%, rgba(0, 0, 0, 0.9) 100%);
        padding: 2rem 1.5rem;
        flex-direction: column;
        justify-content: flex-end;
        /* Push content to bottom */
        align-items: flex-start;
    }

    /* Reset Content Positioning */
    .project-card.left .card-title,
    .project-card.right .card-title,
    .project-card.left .card-content,
    .project-card.right .card-content,
    .card-title,
    .card-content {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
        width: 100% !important;
        text-align: left !important;
        align-items: flex-start !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        margin: 0;
    }

    .card-title {
        font-size: 1.8rem;
        margin-bottom: 3.5rem;
        /* Increased to 3.5rem as per request */
        text-shadow: 0 4px 8px rgba(0, 0, 0, 0.8);
    }

    .project-card .card-content {
        margin-top: 0;
        width: 100%;
    }

    /* Stats Grid on Mobile */
    .card-stats-wrapper {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        margin-bottom: 15px;
    }

    .preview-stat {
        background: rgba(0, 0, 0, 0.6);
        /* Darker backing for legibility */
        border-left: 2px solid var(--color-accent);
        padding: 8px;
    }

    .card-link {
        margin-top: 10px;
        background: rgba(255, 255, 255, 0.1);
        padding: 10px 20px;
        border-radius: 4px;
        width: fit-content;
    }
}


/* --- Modal / Lightbox (Premium & Unique) --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(20px);
    /* Heavy blur */
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 1400px;
    height: 85vh;
    background: linear-gradient(145deg, #151515, #0a0a0a);
    display: flex;
    border-radius: 0;
    /* Ultra sharp edges for modern feel */
    overflow: hidden;
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Unique feature: Glowing accent line */
.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-accent);
    z-index: 10;
    box-shadow: 0 0 20px var(--color-accent);
}

.modal-close {
    position: absolute;
    top: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 100;
    transition: all 0.4s ease;
    background: transparent;
}

.modal-close:hover {
    background: #fff;
    color: #000;
    transform: rotate(180deg);
}

.modal-body {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Gallery Section */
.modal-gallery {
    flex: 3;
    position: relative;
    background: #000;
    /* Diagonal cut effect mask */
    clip-path: polygon(0 0, 100% 0, 95% 100%, 0% 100%);
    z-index: 2;
}

.modal-slider {
    width: 100%;
    height: 100%;
    position: relative;
}

.modal-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transform: scale(1.15);
    transition: opacity 1s ease, transform 1.2s ease;
}

.modal-slide.active {
    opacity: 1;
    transform: scale(1);
    z-index: 2;
}

/* Info Section */
.modal-info {
    flex: 2;
    padding: 4rem 3rem 3rem 1rem;
    /* Extra top pad */
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: transparent;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 4rem;
    /* Massive */
    color: #fff;
    margin-bottom: 0.5rem;
    line-height: 0.9;
    letter-spacing: -2px;
    background: linear-gradient(to right, #fff, #888);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    /* Gradient Text */
}

.modal-meta {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    /* Wide tracking */
    color: var(--color-accent);
    margin-bottom: 3rem;
    display: block;
    margin-left: 5px;
}

.modal-desc p {
    font-size: 1.15rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 3rem;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 20px;
}

/* Premium Stats Grid */
.modal-stats {
    display: flex;
    gap: 3rem;
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item h5 {
    font-size: 2.5rem;
    color: #fff;
    font-weight: 300;
    margin: 0;
    line-height: 1;
}

.stat-item span {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.4);
    display: block;
    margin-top: 5px;
}

/* Nav Buttons */
/* Nav Buttons - Solid & Distinct Design */
.modal-prev,
.modal-next {
    position: absolute;
    bottom: 30px;
    right: 60px;
    /* Shifted left (was 30px) */
    top: auto;
    transform: none;
    width: 45px;
    /* Smaller circle (was 60px) */
    height: 45px;
    border: none;
    border-radius: 50%;
    /* Circle */

    /* Solid White - No Transparency */
    background: #ffffff;

    margin: 0;
    z-index: 2100;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    pointer-events: auto;

    /* Flex center for text arrow */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    /* Icon size maintained/large relative to button */
    color: #000000;
    /* High Contrast Black */

    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    /* Strong shadow to lift off bg */
}

/* Moved further left as requested */
.modal-prev {
    right: 130px;
    /* Gap maintained (60 + 45 + gap) */
}

.modal-prev:hover,
.modal-next:hover {
    background: var(--color-accent);
    /* Use gold accent on hover */
    color: #000;
    transform: translateY(-5px);
    /* Lift up effect */
    box-shadow: 0 15px 35px rgba(212, 168, 83, 0.4);
    /* Colored glow */
}


/* Mobile Modal Fixes */
@media (max-width: 900px) {

    /* Full Screen Modal */
    .modal-content {
        width: 100% !important;
        height: 100% !important;
        max-width: none;
        border: none;
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        flex-direction: column;
        height: 100%;
        overflow-y: auto;
        /* Allow scrolling content */
    }

    /* Resize Gallery for Mobile */
    .modal-gallery {
        height: 40vh;
        /* Top 40% is image */
        min-height: 250px;
        flex: none;
        width: 100%;
        clip-path: none;
    }

    .modal-slide {
        transform: scale(1) !important;
        /* Disable zoom effect on mobile for perf */
    }

    /* Content Area */
    .modal-info {
        padding: 1.5rem;
        flex: 1;
        justify-content: flex-start;
        background: #111;
        /* Solid bg manually */
    }

    .modal-title {
        font-size: 2rem;
        line-height: 1.1;
    }

    .modal-desc p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Stats on Mobile */
    .modal-stats {
        flex-wrap: wrap;
        gap: 1.5rem;
        padding-top: 1.5rem;
    }

    .stat-item h5 {
        font-size: 1.8rem;
    }

    /* Adjust Arrows for Mobile */
    .modal-prev,
    .modal-next {
        bottom: auto;
        /* Reset bottom */
        top: 50%;
        /* Center vertically on image */
        margin-top: -25px;
        /* Half height */
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.9);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    }

    /* Position relative to screen edges */
    .modal-prev {
        left: 15px;
        right: auto;
    }

    .modal-next {
        right: 15px;
        left: auto;
    }

    /* Move close button */
    .modal-close {
        top: 15px;
        right: 15px;
        background: rgba(0, 0, 0, 0.5);
        color: #fff;
        border: none;
        width: 40px;
        height: 40px;
    }
}

/* Intro Text */
.bg-dark-content .intro-desc p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Intro & Outro Text Sections (Dark Theme) --- */
.bg-dark-content {
    background-color: rgb(25, 25, 25);
    /* Dark background matching image */
    color: var(--color-white);
    /* Default text white */
    padding: var(--space-xl) 0;
}

.intro-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
    align-items: center;
}

.bg-dark-content .section-title {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: var(--space-md);
    color: var(--color-white);
}

.bg-dark-content .lead-text {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 300;
}

.bg-dark-content .intro-desc p {
    margin-bottom: var(--space-md);
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 768px) {
    .intro-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .bg-dark-content .section-title {
        font-size: 2rem;
    }
}