/* ========================================
   FONTS
======================================== */
@font-face {
    font-family: 'Redaction 50';
    src: url('Assets/Font/webfonts/Redaction_50-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'League Mono';
    src: url('Assets/Font/LeagueMono-VF.woff2') format('woff2-variations');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ========================================
   CSS VARIABLES
======================================== */
:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --font-headline: 'Redaction 50', Georgia, serif;
    --font-body: 'League Mono', 'Courier New', monospace;
    --transition-speed: 0.3s;
    --grid-gap: 16px;
    --header-height: 60px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 200;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

img,
video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   HEADER
======================================== */
#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 1000;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
}

.header-left {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 200;
    letter-spacing: 0.02em;
    transition: opacity var(--transition-speed);
}

.header-left:hover {
    opacity: 0.7;
}

.home-text {
    display: none;
}

.email-text {
    display: inline;
}

.music-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 200;
    padding: 8px 16px;
    transition: opacity var(--transition-speed);
}

.music-btn:hover {
    opacity: 0.7;
}

.music-icon {
    font-size: 12px;
    margin-top: -2px;
    transition: transform var(--transition-speed);
}

.music-btn.playing .music-icon {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ========================================
   MAIN CONTENT
======================================== */
main {
    padding-top: var(--header-height);
}

.section {
    display: none;
    min-height: calc(100vh - var(--header-height));
}

.section.active {
    display: block;
}

/* ========================================
   HERO SECTION
======================================== */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 60px 24px 80px;
}

.profile-container {
    width: 200px;
    height: 200px;
    border: 1px solid var(--text-color);
    margin-bottom: 40px;
    overflow: hidden;
}

.profile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-title {
    font-family: var(--font-headline);
    font-size: clamp(36px, 8vw, 64px);
    font-weight: 400;
    letter-spacing: 0.02em;
    margin-bottom: 24px;
}

.hero-description {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 200;
    line-height: 1.8;
    max-width: 520px;
    color: var(--text-color);
}

/* ========================================
   PROJECTS SECTION
======================================== */
.projects-section {
    padding: 0 24px 80px;
}

.section-title {
    font-family: var(--font-headline);
    font-size: clamp(28px, 6vw, 48px);
    font-weight: 400;
    text-align: center;
    margin-bottom: 48px;
}

.projects-grid {
    column-count: 4;
    column-gap: var(--grid-gap);
    max-width: 1400px;
    margin: 0 auto;
}

.project-card {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: #111;
    break-inside: avoid;
    margin-bottom: var(--grid-gap);
    transition: transform var(--transition-speed), opacity var(--transition-speed);
}

.project-card:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

.project-card .thumbnail-container {
    position: relative;
    width: 100%;
    /* No padding-top needed - natural aspect ratio from image */
}

.project-card .thumbnail-image,
.project-card .thumbnail-video {
    width: 100%;
    height: auto;
    display: block;
}

.project-card .thumbnail-video {
    display: none;
}

.project-card .thumbnail-video.loaded {
    display: block;
}

.project-card .thumbnail-video.loaded+.thumbnail-image {
    display: none;
}

/* ========================================
   PROJECT DETAIL
======================================== */
#project-section {
    padding: 40px 24px 80px;
}

.project-header {
    text-align: center;
    margin-bottom: 48px;
}

.project-title {
    font-family: var(--font-headline);
    font-size: clamp(32px, 7vw, 56px);
    font-weight: 400;
    margin-bottom: 24px;
}

.project-description {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 200;
    line-height: 1.8;
    max-width: 680px;
    margin: 0 auto;
    white-space: pre-line;
}

/* PDF Container */
.pdf-container {
    max-width: 1200px;
    margin: 0 auto 48px;
}

.pdf-container iframe {
    width: 100%;
    height: 80vh;
    border: none;
}

.pdf-container:empty {
    display: none;
}

/* Project Gallery - True Masonry using CSS Columns */
.project-gallery {
    column-count: 4;
    column-gap: var(--grid-gap);
    max-width: 1400px;
    margin: 0 auto;
}

/* Centered layout for galleries with 1-2 items */
.project-gallery.gallery-centered {
    column-count: unset;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--grid-gap);
}

.project-gallery.gallery-centered .gallery-item {
    max-width: 600px;
    margin-bottom: 0;
}

.gallery-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: #111;
    break-inside: avoid;
    margin-bottom: var(--grid-gap);
    transition: transform var(--transition-speed), opacity var(--transition-speed);
}

/* Progressive loading animation states */
.gallery-item-hidden {
    opacity: 0;
    transform: translateY(20px);
}

.gallery-item-visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.gallery-item:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: auto;
    display: block;
}

.gallery-item video {
    display: none;
}

.gallery-item video.loaded {
    display: block;
}

.gallery-item video.loaded+img {
    display: none;
}

/* ========================================
   LOADING OVERLAY
======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1500;
}

.loading-overlay.active {
    display: flex;
}

.loading-text {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 200;
    color: var(--text-color);
    white-space: pre-line;
    text-align: center;
}

.loading-dots::after {
    content: '.';
    animation: loadingDots 1.2s steps(1) infinite;
}

@keyframes loadingDots {
    0% {
        content: '.';
    }

    25% {
        content: '..';
    }

    50% {
        content: '...';
    }

    75% {
        content: '....';
    }

    100% {
        content: '.';
    }
}

/* ========================================
   FULLSCREEN MODAL
======================================== */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 24px;
}

.fullscreen-modal.active {
    display: flex;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 24px;
    font-size: 36px;
    color: var(--text-color);
    background: none;
    border: none;
    cursor: pointer;
    z-index: 2001;
    transition: opacity var(--transition-speed);
}

.modal-close:hover {
    opacity: 0.7;
}

.modal-content {
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content img,
.modal-content video {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

/* ========================================
   RESPONSIVE - TABLET
======================================== */
@media (max-width: 1024px) {
    .projects-grid {
        column-count: 3;
    }

    .project-gallery {
        column-count: 3;
    }
}

/* ========================================
   RESPONSIVE - MOBILE
======================================== */
@media (max-width: 768px) {
    :root {
        --grid-gap: 12px;
        --header-height: 50px;
    }

    #header {
        padding: 0 16px;
    }

    .music-btn {
        padding: 8px;
    }

    .hero {
        padding: 40px 16px 60px;
    }

    .profile-container {
        width: 160px;
        height: 160px;
        margin-bottom: 32px;
    }

    .projects-section {
        padding: 0 16px 60px;
    }

    .projects-grid {
        column-count: 2;
    }

    .project-gallery {
        column-count: 2;
    }

    #project-section {
        padding: 24px 16px 60px;
    }

    .section-title {
        margin-bottom: 32px;
    }
}

/* ========================================
   UTILITY
======================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Loading state for videos */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 2px solid transparent;
    border-top-color: var(--text-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}