/* ==========================================
   LAYOUT.CSS - Page Layouts & Sections
   ========================================== */

/* Content Sections */
.section {
    position: absolute;
    inset: 0;
    padding: 8rem 4rem 8rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    transform: translateY(30px) scale(0.98);
}

/* About section fix - don't center vertically to avoid cutting off top */
#about {
    align-items: flex-start !important;
}

#about > div {
    height: auto;
    min-height: 100%;
    display: flex;
    align-items: center;
}

.section.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.section.leaving {
    opacity: 0;
    transform: translateY(-30px) scale(0.98);
}

/* Hero Text */
.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 300;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Marquee Container */
.marquee-container {
    overflow: hidden;
    width: 100%;
}

.marquee-track {
    display: flex;
    animation: marquee 40s linear infinite;
    width: fit-content;
}

.marquee-track:hover {
    animation-play-state: paused;
}

.marquee-content {
    display: flex;
    white-space: nowrap;
}

.marquee-link {
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: 500;
    padding: 0 3rem;
    color: transparent;
    -webkit-text-stroke: 1px var(--text-secondary);
    transition: all 0.3s ease;
    cursor: pointer;
}

.marquee-link:hover {
    color: var(--text-primary);
    -webkit-text-stroke: 1px var(--text-primary);
}

/* Project Marquee */
.project-marquee {
    margin-top: 3rem;
    overflow: hidden;
    width: 100%;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.project-marquee:active {
    cursor: grabbing;
}

.project-marquee-track {
    display: flex;
    animation: marquee 40s linear infinite;
    width: fit-content;
    gap: 2rem;
}

.project-marquee-track:hover {
    animation-play-state: paused;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    /* CHANGED: Updated to Pure Black with opacity */
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    animation: fadeIn 0.3s ease forwards;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
    animation: zoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.lightbox-content img.zoomed {
    cursor: zoom-out;
    transform: scale(1.5);
}

.lightbox-close {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    color: var(--text-primary);
    font-size: 2rem;
    cursor: pointer;
    background: rgba(245, 245, 245, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(245, 245, 245, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    transform: rotate(90deg);
    background: rgba(245, 245, 245, 0.2);
}

.lightbox-title {
    position: fixed;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 500;
    text-align: center;
}

.lightbox-counter {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Navigation arrows */
.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(245, 245, 245, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(245, 245, 245, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.lightbox-nav:hover {
    background: rgba(245, 245, 245, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev {
    left: 2rem;
}

.lightbox-nav.next {
    right: 2rem;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        rgba(255, 255, 255, 0.05) 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    width: 400px;
    height: 500px;
    flex-shrink: 0;
}

.skeleton-title {
    width: 150px;
    height: 14px;
    margin: 1rem auto 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .section {
        padding: 7rem 1rem 6rem;
    }

    .marquee-link {
        padding: 0 1.5rem;
        font-size: clamp(2.5rem, 8vw, 4rem);
    }

    .footer {
        flex-direction: column;
        gap: 1rem;
    }

    .footer-divider {
        width: 100%;
        height: 1px;
    }

    .lightbox-nav {
        width: 50px;
        height: 50px;
    }

    .lightbox-nav.prev {
        left: 1rem;
    }

    .lightbox-nav.next {
        right: 1rem;
    }

    .project-card {
        width: 260px;
    }

    .project-image {
        height: 350px;
    }

    .project-marquee-track {
        animation: marquee 25s linear infinite;
    }

    .scroll-hint {
        bottom: 5rem;
        font-size: 0.75rem;
    }

    /* About section mobile */
    #about {
        overflow-y: auto !important;
    }

    #about > div {
        height: auto !important;
        min-height: auto !important;
    }

    #about > div > div {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        min-height: auto !important;
        height: auto !important;
    }

    #about > div > div > div:first-child {
        padding-right: 0 !important;
    }

    /* Make sticky image static on mobile */
    #about > div > div > div:last-child {
        position: static !important;
        order: -1;
    }

    #about > div > div > div:last-child > div {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 4/5;
        max-height: 280px;
    }

    #about > div > div > div:first-child h2 {
        font-size: clamp(1.5rem, 5vw, 2rem) !important;
        margin-bottom: 0.75rem !important;
    }

    #about > div > div > div:first-child p {
        font-size: 0.8125rem !important;
        line-height: 1.5 !important;
        margin-bottom: 0.5rem !important;
    }

    /* Border left section on mobile */
    #about > div > div > div:first-child > div:first-of-type {
        padding-left: 1rem !important;
        margin: 1rem 0 !important;
    }

    /* Skills grid on mobile */
    #about > div > div > div:first-child > div:nth-of-type(2) {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
        margin: 1rem 0 !important;
    }

    #about > div > div > div:first-child > div:nth-of-type(2) > div {
        padding: 0.625rem !important;
    }

    #about > div > div > div:first-child > div:nth-of-type(2) h4 {
        font-size: 0.5625rem !important;
        margin-bottom: 0.25rem !important;
    }

    #about > div > div > div:first-child > div:nth-of-type(2) p {
        font-size: 0.75rem !important;
    }

    /* Tags on mobile */
    #about span {
        padding: 0.4375rem 0.875rem !important;
        font-size: 0.6875rem !important;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
    }

    /* What I Do section on mobile */
    #about > div > div > div:first-child > div:last-of-type {
        padding-top: 1rem !important;
    }

    #about > div > div > div:first-child > div:last-of-type h3 {
        font-size: 0.75rem !important;
        margin-bottom: 0.625rem !important;
    }

    /* Lightbox content on mobile */
    .lightbox-content {
        max-width: 95vw;
        max-height: 85vh;
    }

    .lightbox-content img.zoomed {
        transform: scale(2);
    }

    .lightbox-title {
        bottom: 2rem;
        font-size: 1rem;
        padding: 0 1rem;
    }

    .lightbox-counter {
        bottom: 0.75rem;
    }

    /* Extra bottom padding for sections with buttons near footer */
    #contact,
    #privacy {
        padding-bottom: 10rem !important;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .section {
        padding: 7rem 0.75rem 6rem;
    }

    .project-card {
        width: 220px;
    }

    .project-image {
        height: 280px;
    }

    .hero-title {
        font-size: clamp(1.8rem, 7vw, 2.5rem);
    }

    .marquee-link {
        font-size: clamp(2rem, 7vw, 3rem);
        padding: 0 1rem;
    }

    #about > div > div > div:first-child > div:nth-of-type(2) {
        grid-template-columns: 1fr !important;
    }
}

/* Tablet optimizations */
@media (max-width: 1024px) and (min-width: 769px) {
    .section {
        padding: 7rem 3rem 7rem;
    }
    
    .project-card {
        width: 350px;
    }
    
    #about > div > div {
        gap: 4rem !important;
    }
}

/* Large desktop optimizations */
@media (min-width: 1920px) {
    .section {
        padding: 8rem 6rem 8rem;
    }
    
    .lightbox-content img {
        max-height: 85vh;
    }
}

/* Print styles */
@media print {
    .loader,
    .header,
    .hamburger-btn,
    .side-nav,
    .footer,
    .lightbox,
    .scroll-hint {
        display: none !important;
    }
    
    .section {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        page-break-after: always;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .section,
    .marquee-track,
    .project-marquee-track,
    .lightbox-content,
    .lightbox-nav,
    .project-card,
    .lightbox-content img {
        animation: none !important;
        transition: none !important;
    }
    
    .marquee-track,
    .project-marquee-track {
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .lightbox-nav,
    .lightbox-close {
        border: 2px solid var(--text-primary);
        background: rgba(245, 245, 245, 0.2);
    }
    
    .marquee-link {
        -webkit-text-stroke: 2px var(--text-secondary);
    }
}

/* Dark mode optimizations (if browser prefers dark) */
@media (prefers-color-scheme: dark) {
    .lightbox {
        background: rgba(0, 0, 0, 0.98);
    }
}
