/* ===========================================
   EVAN DREW WEBSITE - Master Stylesheet
   Base: 1920x1080px fixed composition
   All measurements relative to this master
   =========================================== */

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #ffffff; /* White letterboxing bars */
}

/* ===========================================
   MASTER COMPOSITION CONTAINER
   Scales proportionally, centered with letterboxing
   =========================================== */
.master-comp {
    position: absolute;
    width: 1920px;
    height: 1080px;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    /* Scale is set via JavaScript */
}

/* ===========================================
   BACKGROUND LAYER
   =========================================== */
.background {
    position: absolute;
    top: 0;
    left: 0;
    width: 1920px;
    height: 1080px;
    z-index: 1;
}

.background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===========================================
   MOBILE GALLERY (hidden on desktop)
   =========================================== */
.mobile-gallery {
    display: none;
}

/* ===========================================
   GALLERY WALL LAYER (Index Page)
   Images overlay on background, centered 1920x1080
   =========================================== */
.gallery-wall {
    position: absolute;
    top: 0;
    left: 0;
    width: 1920px;
    height: 1080px;
    z-index: 2;
}

.gallery-wall-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 1920px;
    height: 1080px;
    cursor: pointer;
    pointer-events: none; /* Clicks handled by gallery-wall container */
}

.gallery-wall-image img {
    width: 100%;
    height: 100%;
    pointer-events: none;
    transition: transform 0.3s ease-in-out;
    /* transform-origin set dynamically via JS based on opaque content center */
}

.gallery-wall-image img.hovered {
    transform: scale(1.07);
}

/* ===========================================
   FX FILTER OVERLAY (Viewport Mode)
   Below menu/exit/view image, above background/gallery
   Increases brightness 40%, decreases contrast 50%, applies 6px blur
   =========================================== */
.fx-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 1920px;
    height: 1080px;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(6px) brightness(1.3) saturate(0.7);
    -webkit-backdrop-filter: blur(6px) brightness(1.3) saturate(0.7);
}

.fx-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===========================================
   VIEWPORT CONTAINER (Index Page Popup)
   =========================================== */
.viewport-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 1920px;
    height: 1080px;
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.viewport-container.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.viewport-image {
    position: absolute;
    /* Centered horizontally in 1920px comp */
    left: 50%;
    transform: translateX(-50%);
    /* Top aligned at 219px */
    top: 219px;
    /* Height: 660px, width scales proportionally */
    height: 660px;
    width: auto;
    cursor: pointer;
}

/* ===========================================
   EXIT ICON (Viewport Mode)
   =========================================== */
.exit-icon {
    position: absolute;
    width: 35px;
    height: 35px;
    /* Top align: 878.5px */
    top: 878.5px;
    /* Right align to 1588px */
    left: 1588px;
    z-index: 25;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease-in-out;
}

.exit-icon.active {
    opacity: 1;
    visibility: visible;
}

.exit-icon:hover {
    transform: scale(1.1);
}

.exit-icon img {
    width: 100%;
    height: 100%;
}

/* ===========================================
   MENU (Fixed on all pages)
   =========================================== */

/* Menu positioning wrapper */
.menu-wrapper {
    position: absolute;
    top: 0;
    right: 135px; /* 1920 - 1785 = 135 */
    text-align: right;
    z-index: 100;
}

.menu-title {
    font-family: 'Times New Roman', Times, serif;
    font-weight: 700;
    font-size: 48px;
    color: #000000;
    text-decoration: none;
    display: block;
    position: absolute;
    top: 72px;
    right: 0;
    line-height: 1;
    white-space: nowrap;
    transition: color 0.3s ease-in-out;
}

.menu-title:hover {
    color: #8f3030;
}

.menu-link {
    font-family: 'Avenir', 'Avenir Next', sans-serif;
    font-weight: 300;
    font-size: 20px;
    letter-spacing: 0.02em;
    color: #000000;
    text-decoration: none;
    display: block;
    position: absolute;
    right: 0;
    line-height: 1;
    transition: color 0.3s ease-in-out;
}

.menu-link:hover {
    color: #8f3030;
}

.menu-link.active {
    color: #8f3030;
}

/* Archive link */
.menu-link-archive {
    top: 138px;
}

/* About link */
.menu-link-about {
    top: 168px;
}

/* ===========================================
   ABOUT PAGE - Text Box
   =========================================== */
.about-text-box {
    position: absolute;
    /* top: 196.758px, left: 561.402px, right: 1358.613px, bottom: 703.208px */
    top: 196.758px;
    left: 561.402px;
    width: calc(1358.613px - 561.402px); /* 797.211px */
    height: calc(703.208px - 196.758px); /* 506.45px */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.about-text {
    font-family: 'Avenir', 'Avenir Next', sans-serif;
    font-weight: 300;
    font-size: 18px;
    letter-spacing: 0.1em; /* 10 tracking approximation */
    text-align: center;
    color: #000000;
    line-height: 1.6;
}

.about-text--mobile {
    display: none;
}

/* ===========================================
   ABOUT PAGE - Social Icons
   =========================================== */
.social-icons {
    position: absolute;
    /* Top aligned at 775px */
    top: 775px;
    /* Centered horizontally */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px; /* 20px between icons */
    z-index: 5;
}

.social-icon {
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: transform 0.3s ease-in-out;
}

.social-icon:hover {
    transform: scale(1.15);
}

.social-icon img {
    width: 100%;
    height: 100%;
}

/* ===========================================
   ARCHIVE PAGE - Image Container
   =========================================== */
.archive-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 1920px;
    height: 1080px;
    z-index: 5;
}

.archive-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 1920px;
    height: 1080px;
}

.archive-image img {
    width: 100%;
    height: 100%;
}

/* Click zones for archive navigation */
.archive-nav-zone {
    position: absolute;
    top: 0;
    height: 100%;
    width: 50%;
    cursor: pointer;
    z-index: 6;
}

.archive-nav-left {
    left: 0;
}

.archive-nav-right {
    right: 0;
}

/* ===========================================
   UTILITY CLASSES
   =========================================== */
.hidden {
    display: none !important;
}

/* Ensure images don't drag */
img {
    -webkit-user-drag: none;
    user-select: none;
}

/* ===========================================
   MOBILE LAYOUT — sub-768px breakpoint
   1080x1920 composition
   =========================================== */
@media (max-width: 767px) {

    /* --- Master comp & background --- */
    .master-comp {
        width: 1080px;
        height: 1920px;
    }

    .background {
        width: 1080px;
        height: 1920px;
    }

    /* --- Background images per page (absolute positioned, not object-fit) --- */
    .background img {
        width: auto;
        height: auto;
        object-fit: unset;
        position: absolute;
    }

    body.page-about .background img {
        width: 3680px;
        height: auto;
        top: -135px;
        left: -300px;
    }

    body.page-gallery .background img {
        width: 3608px;
        height: auto;
        top: -99px;
        left: -1667px;
    }

    body.page-archive .background img {
        width: 3580px;
        height: auto;
        top: -85px;
        left: -885px;
    }

    /* --- Menu --- */
    .menu-wrapper {
        right: 0;
        left: 0;
        text-align: center;
    }

    .menu-title {
        position: absolute;
        top: 105px;
        right: 0;
        left: 0;
        text-align: center;
        font-size: 72px;
    }

    .menu-link {
        font-size: 34px;
    }

    .menu-link-archive {
        top: 204px;
        right: 0;
        left: 0;
        text-align: center;
    }

    .menu-link-about {
        top: 255px;
        right: 0;
        left: 0;
        text-align: center;
    }

    /* --- Gallery wall — hidden on mobile --- */
    .gallery-wall {
        display: none;
    }

    /* --- Mobile gallery --- */
    .mobile-gallery {
        display: block; /* override base display:none */
        position: absolute;
        top: 0;
        left: 0;
        width: 1080px;
        height: 1920px;
        z-index: 2; /* raised to 150 via JS when zoomed, drops back at rest */
        overflow: visible;
        touch-action: none;
    }

    .mobile-gallery-image {
        position: absolute;
        height: 645px;
        width: auto;
        left: 50%;
        transform: translateX(-50%);
        top: 400px;
        display: block;
        pointer-events: none;
    }

    /* --- FX overlay + viewport — hidden on mobile (no popup mode) --- */
    .fx-overlay {
        display: none;
    }

    .viewport-container {
        display: none;
    }

    .exit-icon {
        display: none;
    }

    /* --- Archive — mobile --- */
    .archive-container {
        width: 1080px;
        height: 1920px;
        touch-action: none;
    }

    .archive-image {
        width: 1080px;
        height: 1920px;
    }

    .archive-image img {
        width: 2700px;
        height: auto;
        position: absolute;
        top: 217px;
        left: -810px;
        transform: none;
    }

    .archive-nav-zone {
        display: none;
    }

    /* --- About — mobile --- */
    .about-text-box {
        top: 400px;
        left: auto;
        right: 130px;
        width: 760px;
        height: auto;
        align-items: flex-start;
        justify-content: flex-start;
    }

    .about-text--desktop {
        display: none;
    }

    .about-text--mobile {
        display: block;
        width: 100%;
        text-align: right;
        font-size: 30px;
        line-height: 1.2;
    }

    .social-icons {
        top: 1265px;
        left: auto;
        right: 130px;
        transform: none;
        justify-content: flex-end;
    }

    .social-icon {
        width: 75px;
        height: 75px;
    }

    /* --- Remove all hover effects on mobile --- */
    .gallery-wall-image img.hovered {
        transform: none;
    }

    .exit-icon:hover {
        transform: none;
    }

    .menu-title:hover,
    .menu-link:hover {
        color: inherit;
    }

    .social-icon:hover {
        transform: none;
    }

}
