/* Reset styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: var(--true-vh);
    overflow: hidden;
}

#background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('Links/Messerli-Drop-Game_Hintergrund_Website.png') no-repeat center center;
    background-size: cover;
    z-index: -1; /* Background behind everything */
    pointer-events: none; /* Allow interaction with iframe by ignoring background */
}

/* Iframe container */
#iframe-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    border: none;
    overflow: hidden; /* Prevent scrolling */
    z-index: 2; /* Ensure iframe container is above the background */
    pointer-events: auto; /* Allow interaction */
}

#iframe-container iframe {
    aspect-ratio: 16 / 9; /* Maintain 16:9 ratio */
    width: 100%;
    height: auto;
    border: none;
    max-width: calc(var(--true-vh) * 16 / 9); /* Restrict width based on height to maintain 16:9 */
    max-height: calc(100vw * 9 / 16); /* Restrict height based on width to maintain 16:9 */
    object-fit: contain; /* Prevent distortion */
    z-index: 3; /* Ensure iframe itself is interactive */
}

/* Portrait Image for Mobile */
#portrait-image {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    pointer-events: none; /* Prevent blocking interaction with iframe */
    z-index: 1; /* Behind iframe */
}

#portrait-image img {
    width: 100%;
    height: auto;
    max-width: 92vw; /* Full width of container */
    max-height: 92vh; /* Ensure it doesn't exceed viewport height */
    object-fit: contain; /* Prevent distortion */
}

/* Mobile Portrait Behavior */
@media (max-width: 768px) and (max-aspect-ratio: 16/9) { /* Mobile Portrait */
    #iframe-container {
        opacity: 0%;
    }

    #portrait-image {
        display: flex;
    }
}

/* Landscape or Desktop Behavior */
@media (min-aspect-ratio: 16/9), (min-width: 769px) { 
    #portrait-image {
        display: none;
    }

    #iframe-container {
        display: flex;
        opacity: 100%;
        max-height: var(--true-vh);
        max-width: 100vw;
    }
}
