/**
 * PROJECT PAGE STYLES - Aeolian Design System
 * ============================================
 * Split-screen layout with suspended dust animation
 * and synchronized image carousel with text transitions.
 */

/* ===========================================
   RESET & BASE
   =========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
    max-width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
    color: #e0e1dd;
}

/* ===========================================
   CSS VARIABLES
   =========================================== */
:root {
    --color-text: #e0e1dd;
    --color-accent: #778da9;
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --ease-organic: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-settle: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Project page specific */
    --project-padding-top: 120px;
    --project-padding-side: 60px;
    --project-padding-bottom: 80px;
    --carousel-height: 70vh;
    --text-panel-width: 35%;
    --carousel-width: 58%;

    /* Default dust color (can be overridden per-project) */
    --dust-color: 212, 197, 176;
}

/* ===========================================
   DUST CANVAS
   =========================================== */
#dust-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* ===========================================
   NAVIGATION
   =========================================== */
.main-nav {
    position: fixed;
    top: 60px;
    right: 60px;
    z-index: 100;
    display: flex;
    align-items: center;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0;
}

.projects-dropdown-container {
    position: relative;
}

.projects-trigger {
    background: none;
    border: none;
    color: var(--color-text);
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0.5rem 0;
    transition: opacity 300ms ease;
}

.projects-trigger:hover {
    opacity: 0.7;
}

.projects-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    padding-top: 1rem;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 300ms var(--ease-organic);
}

.projects-dropdown-container:hover .projects-dropdown,
.projects-dropdown-container:focus-within .projects-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.projects-dropdown li {
    margin-bottom: 0.5rem;
}

.projects-dropdown a {
    color: var(--color-accent);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    transition: all 300ms ease;
    display: block;
    padding: 0.25rem 0;
}

.projects-dropdown a:hover,
.projects-dropdown a.active {
    color: var(--color-text);
    transform: translateX(8px);
}

.nav-divider {
    color: rgba(224, 225, 221, 0.3);
    margin: 0 1.5rem;
    font-weight: 200;
}

.contact-link {
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    transition: opacity 300ms ease;
}

.contact-link:hover {
    opacity: 0.7;
}

/* ===========================================
   HOME INDICATOR (Top-left circle) - ENHANCED
   =========================================== */
.home-indicator {
    position: fixed;
    top: 60px;
    left: 60px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(119, 141, 169, 0.8);
    color: transparent;
    text-decoration: none;
    font-size: 0;
    transition: all 400ms var(--ease-settle);
    z-index: 100;
    overflow: hidden;
}

.home-indicator:hover {
    transform: scale(1.4);
    background: var(--color-text);
    box-shadow: 0 0 20px rgba(224, 225, 221, 0.3);
}

.home-indicator:focus {
    outline: 1px solid var(--color-text);
    outline-offset: 4px;
}

/* ===========================================
   PROJECT LAYOUT - Split Screen (FIXED OVERFLOW)
   =========================================== */
.project-container {
    display: grid;
    grid-template-columns: var(--text-panel-width) var(--carousel-width);
    gap: 5%;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    padding: var(--project-padding-top) var(--project-padding-side) var(--project-padding-bottom);
    padding-right: 80px;
    align-items: center;
}

/* ===========================================
   LEFT PANEL - TEXT
   =========================================== */
.text-panel {
    position: sticky;
    top: var(--project-padding-top);
    height: calc(100vh - 200px);
    height: calc(100dvh - 200px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-right: 2rem;
}

.text-content {
    max-width: 100%;
}

.project-title {
    font-size: 2.5rem;
    font-weight: 200;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-text);
    margin-bottom: 0.8rem;
    line-height: 1.2;
    opacity: 0.95;
}

.project-subtitle {
    font-size: 0.9rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: 3rem;
    opacity: 0.8;
}

/* ===========================================
   DESCRIPTION CONTAINER (Text transitions)
   =========================================== */
.description-container {
    position: relative;
    min-height: 120px;
    overflow: hidden;
    margin-bottom: 3rem;
}

.description-track {
    position: relative;
}

.description-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    font-size: 1rem;
    font-weight: 300;
    line-height: 1.8;
    color: var(--color-text);
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 600ms var(--ease-organic),
        transform 600ms var(--ease-organic);
    pointer-events: none;
}

.description-text.active {
    opacity: 0.9;
    transform: translateY(0);
    position: relative;
    pointer-events: auto;
}

/* ===========================================
   EXTERNAL LINK BUTTON
   =========================================== */
.project-link {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 1rem 2.5rem;
    border: 1px solid rgba(224, 225, 221, 0.3);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    font-weight: 300;
    transition: all 500ms var(--ease-organic);
    position: relative;
    overflow: hidden;
}

.project-link::after {
    content: '→';
    margin-left: 1rem;
    font-size: 1.2rem;
    transition: transform 300ms ease;
    display: inline-block;
}

.project-link:hover {
    letter-spacing: 0.35em;
    border-color: rgba(224, 225, 221, 0.6);
    background: rgba(224, 225, 221, 0.05);
    padding-left: 3rem;
    padding-right: 3rem;
}

.project-link:hover::after {
    transform: translateX(8px);
}

.project-link:focus {
    outline: 1px solid var(--color-text);
    outline-offset: 4px;
}

/* ===========================================
   RIGHT PANEL - CAROUSEL (FIXED ARROW POSITIONING)
   =========================================== */
.carousel-container {
    position: relative;
    height: var(--carousel-height);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 60px;
    box-sizing: border-box;
}

.carousel-viewport {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 100%;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.carousel-track {
    position: relative;
    width: 100%;
    height: 100%;
}

/* ===========================================
   IMAGE SLIDES (FIXED OVERFLOW)
   =========================================== */
.image-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    opacity: 0;
    filter: blur(10px) brightness(0.6);
    transform: scale(1.02);
    transition:
        opacity 800ms var(--ease-organic),
        filter 800ms var(--ease-organic),
        transform 800ms var(--ease-organic);
    will-change: opacity, filter, transform;
}

.image-slide.active {
    opacity: 1;
    filter: blur(0) brightness(1);
    transform: scale(1);
    z-index: 2;
}

/* ===========================================
   NAVIGATION ARROWS (FIXED POSITIONING & VISIBILITY)
   =========================================== */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 400ms ease;
}

.carousel-arrow.prev {
    left: 0;
}

.carousel-arrow.next {
    right: 0;
}

.carousel-arrow:hover {
    transform: translateY(-50%) scale(1.1);
    background: rgba(0, 0, 0, 0.5);
}

.carousel-arrow:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(224, 225, 221, 0.5);
}

/* Arrow elements */
.arrow-line {
    position: absolute;
    width: 20px;
    height: 1px;
    background: rgba(224, 225, 221, 0.7);
    transition: all 400ms ease;
}

.arrow-head {
    position: absolute;
    width: 8px;
    height: 8px;
    border-top: 1px solid rgba(224, 225, 221, 0.7);
    border-right: 1px solid rgba(224, 225, 221, 0.7);
    transition: all 400ms ease;
}

/* Prev arrow */
.prev .arrow-line {
    transform: rotate(-45deg);
    transform-origin: right center;
    right: 12px;
}

.prev .arrow-head {
    transform: rotate(-135deg);
    left: 14px;
}

/* Next arrow */
.next .arrow-line {
    transform: rotate(45deg);
    transform-origin: left center;
    left: 12px;
}

.next .arrow-head {
    transform: rotate(45deg);
    right: 14px;
}

/* Hover states */
.carousel-arrow:hover .arrow-line {
    width: 24px;
    background: rgba(224, 225, 221, 1);
}

.carousel-arrow:hover .arrow-head {
    border-color: rgba(224, 225, 221, 1);
}

/* ===========================================
   PROGRESS BAR
   =========================================== */
.progress-bar {
    position: absolute;
    bottom: -30px;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(224, 225, 221, 0.1);
    z-index: 5;
}

.progress-fill {
    height: 100%;
    background: rgba(224, 225, 221, 0.5);
    transition: width 600ms var(--ease-organic);
}

/* ===========================================
   SLIDE COUNTER
   =========================================== */
.slide-counter {
    position: absolute;
    bottom: -50px;
    right: 0;
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    color: var(--color-text);
    opacity: 0.5;
}

/* ===========================================
   NEXT PROJECT BUTTON (Last slide navigation)
   =========================================== */
.next-project-btn {
    display: inline-flex;
    align-items: center;
    margin-top: 2.5rem;
    padding: 0.8rem 1.8rem;
    background: rgba(224, 225, 221, 0.1);
    border: 1px solid rgba(224, 225, 221, 0.3);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 300;
    transition: all 500ms var(--ease-organic);
    position: relative;
    overflow: hidden;
}

.next-project-btn .btn-arrow {
    margin-left: 0.8rem;
    transition: transform 400ms var(--ease-settle);
    display: inline-block;
}

.next-project-btn:hover {
    background: rgba(224, 225, 221, 0.15);
    border-color: rgba(224, 225, 221, 0.5);
    letter-spacing: 0.25em;
    padding-left: 2.2rem;
    padding-right: 2.2rem;
}

.next-project-btn:hover .btn-arrow {
    transform: translateX(8px);
}

.next-project-btn:focus {
    outline: 1px solid var(--color-text);
    outline-offset: 4px;
}

/* ===========================================
   SLIDE BUTTON CONTAINER (Button outside paragraph)
   =========================================== */
.slide-button-container {
    margin-top: 2.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1),
                transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    position: relative;
    z-index: 5;
}

/* Show button container when visible class is added via JS */
.slide-button-container.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Remove margin-top from button when inside container (container handles spacing) */
.slide-button-container .next-project-btn {
    margin-top: 0;
}

/* Ensure last paragraph doesn't have extra bottom margin */
.description-text:last-of-type {
    margin-bottom: 0;
}

/* ===========================================
   ENTRANCE ANIMATIONS
   =========================================== */
.text-panel {
    opacity: 0;
    transform: translateX(-20px);
    animation: panelEnter 1s var(--ease-organic) 0.3s forwards;
}

.carousel-container {
    opacity: 0;
    transform: translateX(20px);
    animation: panelEnter 1s var(--ease-organic) 0.5s forwards;
}

@keyframes panelEnter {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===========================================
   RESPONSIVE: TABLET (<1024px)
   =========================================== */
@media (max-width: 1024px) {
    :root {
        --project-padding-top: 100px;
        --project-padding-side: 40px;
        --project-padding-bottom: 40px;
        --carousel-height: 50vh;
    }

    .main-nav {
        top: 30px;
        right: 40px;
    }

    .home-indicator {
        top: 30px;
        left: 30px;
    }

    .project-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: var(--project-padding-top) var(--project-padding-side) var(--project-padding-bottom);
        padding-right: var(--project-padding-side);
    }

    .text-panel {
        position: relative;
        top: auto;
        height: auto;
        padding-right: 0;
        order: 2;
    }

    .carousel-container {
        height: var(--carousel-height);
        order: 1;
        padding: 0 50px;
    }

    .carousel-arrow.prev {
        left: 0;
    }

    .carousel-arrow.next {
        right: 0;
    }

    .carousel-arrow .arrow-line,
    .carousel-arrow .arrow-head {
        background: rgba(224, 225, 221, 0.8);
        border-color: rgba(224, 225, 221, 0.8);
    }

    .project-title {
        font-size: 2rem;
    }
}

/* ===========================================
   RESPONSIVE: MOBILE (<768px)
   =========================================== */
@media (max-width: 768px) {
    :root {
        --project-padding-top: 80px;
        --project-padding-side: 24px;
        --project-padding-bottom: 24px;
        --carousel-height: 40vh;
    }

    /* Navigation - match homepage centered positioning */
    .main-nav {
        top: 24px;
        right: 50%;
        transform: translateX(50%);
        left: auto;
        width: auto;
        display: flex;
        justify-content: center;
        padding: 0;
    }

    /* Ensure nav-right container doesn't overflow */
    .nav-right {
        display: flex;
        align-items: center;
        gap: 0.8rem;
        margin-right: 0;
    }

    .home-indicator {
        top: 24px;
        left: 24px;
        width: 12px;
        height: 12px;
    }

    .projects-trigger,
    .contact-link {
        font-size: 0.75rem;
        white-space: nowrap;
        letter-spacing: 0.15em;
    }

    .nav-divider {
        margin: 0 0.5rem;
    }

    /* Dropdown container positioning */
    .projects-dropdown-container {
        position: relative;
    }

    .carousel-container {
        padding: 0 40px;
    }

    .carousel-arrow {
        width: 36px;
        height: 36px;
    }

    .carousel-arrow.prev {
        left: 0;
    }

    .carousel-arrow.next {
        right: 0;
    }

    .arrow-line {
        width: 14px;
    }

    .arrow-head {
        width: 6px;
        height: 6px;
    }

    .prev .arrow-line {
        right: 10px;
    }

    .prev .arrow-head {
        left: 12px;
    }

    .next .arrow-line {
        left: 10px;
    }

    .next .arrow-head {
        right: 12px;
    }

    .project-title {
        font-size: 1.5rem;
    }

    .project-subtitle {
        font-size: 0.8rem;
        margin-bottom: 2rem;
    }

    .description-container {
        min-height: auto;
    }

    .project-link {
        padding: 0.8rem 1.5rem;
        font-size: 0.75rem;
    }
}

/* ===========================================
   ACCESSIBILITY: REDUCED MOTION
   =========================================== */
@media (prefers-reduced-motion: reduce) {
    .text-panel,
    .carousel-container {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .image-slide {
        transition: opacity 0.01ms;
        filter: none;
        transform: none;
    }

    .image-slide.active {
        filter: none;
        transform: none;
    }

    .description-text {
        transition: none;
    }

    #dust-canvas {
        display: none;
    }
}

/* ===========================================
   PRINT STYLES
   =========================================== */
@media print {
    #dust-canvas,
    .carousel-arrow,
    .progress-bar,
    .home-indicator,
    .main-nav {
        display: none;
    }

    .project-container {
        display: block;
    }

    .image-slide {
        position: relative;
        opacity: 1;
        filter: none;
        transform: none;
        page-break-inside: avoid;
    }
}
