/* style.css */

/* ==================================================
   CSS Variables (Custom Properties)
   ================================================== */

   :root {
    --main-font: 'OctagridCR-Regular', sans-serif;
    --text-color-dark: #000;
    --text-color-light: #fff;
    --transparent-background: rgba(0, 0, 0, 0);
    --transparent-white-background: rgba(255, 255, 255, 0);
    --transparent-blue-background: rgba(0, 0, 255, 0);
    --main-transition-duration: 0.5s;
    --video-controls-transition-duration: 0.2s;
    --main-transition-easing: ease;
    --font-size-transition-easing: linear; /* Changed to linear for smoother font scaling */
}

/* ==================================================
   Font Declarations
   ================================================== */

@font-face {
    font-family: 'OctagridCR-Thin';
    src: url('assets/fonts/OctagridCR-Thin.woff') format('woff');
    font-weight: 100;
    font-style: normal;
}

@font-face {
    font-family: 'OctagridCR-ExtraLight';
    src: url('assets/fonts/OctagridCR-ExtraLight.woff') format('woff');
    font-weight: 200;
    font-style: normal;
}

@font-face {
    font-family: 'OctagridCR-Light';
    src: url('assets/fonts/OctagridCR-Light.woff') format('woff');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'OctagridCR-Regular';
    src: url('assets/fonts/OctagridCR-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'OctagridCR-Medium';
    src: url('assets/fonts/OctagridCR-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
}

/* ==================================================
   Global Styles
   ================================================== */

body {
    font-family: var(--main-font); /* Using CSS variable */
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ==================================================
   Header
   ================================================== */

header {
    top: 0;
    width: 95%;
    position: fixed; /* Consider if fixed positioning is needed */
    padding: 1rem;
    display: block;
    z-index: 1000; /* Ensure header is on top of other content */
}

/* Visually hidden h1 for accessibility and SEO */
header h1 {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

nav {
    display: block;
}

nav ul {
    list-style-type: none;
    display: flex;
    justify-content: space-between;
    margin-block-start: 0px;
    margin-block-end: 0px;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    padding-inline-start: 0px;
}

nav li {
    display: inline;
}

nav a {
    list-style-type: none;
    text-decoration: none;
    color: var(--text-color-dark); /* Using CSS variable */
    font-size: 1rem;
    font-family: var(--main-font); /* Using CSS variable */
}

/* ==================================================
   Content (Scroll Instruction)
   ================================================== */

.content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    font-size: 2rem;
    line-height: 100%;
    position: fixed; /* Consider if fixed positioning is needed */
    width: 95%;
    height: 95%;
    transition: width var(--main-transition-duration) var(--main-transition-easing), height var(--main-transition-duration) var(--main-transition-easing); /* Using CSS variable */
    overflow: hidden;
    font-family: var(--main-font); /* Using CSS variable */
}

/* ==================================================
   Footer
   ================================================== */

footer {
    bottom: 0;
    width: 95%;
    position: fixed; /* Consider if fixed positioning is needed */
    padding: 20px;
    text-align: left;
    font-size: 1rem;
    background-color: var(--transparent-blue-background); /* Using CSS variable */
    color: var(--text-color-dark); /* Using CSS variable */
    font-family: var(--main-font); /* Using CSS variable */
    display: flex;
    justify-content: flex-start;
}

footer img#footer-logo {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

footer h1 {
    font-weight: normal;
    container-type: inline-size;
    font-size: calc(25vw + 1rem);
    margin: 0;
    width: 100%;
    display: block;
}

/* ==================================================
   Items Container
   ================================================== */

   .itemsContainer {
    width: 80%;
    max-width: min(75vw, 75vh);
    max-height: min(75vw, 75vh);
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    z-index: 999; /* Ensure items container is on top of other content */
}

/* ==================================================
   Scroll Items
   ================================================== */

.scroll-item {
    position: fixed;
    top: 50%;
    left: 50%; /* Center the scroll items */
    transform: translate(-50%, -50%);
    aspect-ratio: var(--aspect-ratio);
    width: 0;
    height: 0;
    display: block;
    transition: 
        height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text-color-light); /* Using CSS variable */
    background-color: var(--transparent-background); /* Using CSS variable */
    box-sizing: border-box;
    padding: 0px;
    border-radius: 0px;
    white-space: nowrap;
    font-family: var(--main-font); /* Using CSS variable */
    z-index: 10; /* Base z-index for scroll items, for stacking effect */
}

.scroll-item:has(video) {
    background-color: var(--transparent-blue-background); /* Using CSS variable */
}

.scroll-item.text-content {
    background-color: var(--transparent-white-background); /* Using CSS variable */
    color: var(--text-color-light); /* Using CSS variable */
    padding: 30px;
    font-family: var(--main-font); /* Using CSS variable */
}

.scroll-item p {
    font-size: .25rem;
    line-height: 100%;
    margin: 0; /* Reset paragraph margins */
    transition: font-size var(--main-transition-duration) var(--font-size-transition-easing); /* Using CSS variable */
    font-family: var(--main-font); /* Using CSS variable */
}

/* ==================================================
   Video & Image Styling within Scroll Items
   ================================================== */

.scroll-item[data-orientation="vertical"] {
    width: auto !important;
    max-width: 100%;
}

.scroll-item video,
.scroll-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    height: auto;
    display: block;
    max-width: 100%; /* Ensure video/image doesn't exceed container */
    /* transition: transform var(--main-transition-duration) linear; /* Transition for transform, using linear easing for smoothness */
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-origin: 50% 50%; /* Ensure scaling from center */
}

/* Initially hide video controls, show on hover */
.scroll-item video::-webkit-media-controls {
    opacity: 0;
    transition: opacity var(--video-controls-transition-duration) var(--main-transition-easing); /* Using CSS variable */
}

.scroll-item video::-moz-media-controls {
    opacity: 0;
    transition: opacity var(--video-controls-transition-duration) var(--main-transition-easing); /* Using CSS variable */
}

.scroll-item video::--ms-media-controls {
    opacity: 0;
    transition: opacity var(--video-controls-transition-duration) var(--main-transition-easing); /* Using CSS variable */
}

.scroll-item:hover video::-webkit-media-controls {
    opacity: 1;
}

.scroll-item:hover video::-moz-media-controls {
    opacity: 1;
}

.scroll-item:hover video::--ms-media-controls {
    opacity: 1;
}

.aspect-ratio-7-10 {
    aspect-ratio: 7 / 10; /* Set the aspect ratio to match the image */
    max-height: calc(65vh + (10 * (random() * 1vh))); /* Constrain the height to a random value between 65vh and 75vh */
    width: auto; /* Let the width adjust based on the aspect ratio */
    object-fit: contain; /* Ensure the image fits within the container while maintaining aspect ratio */
}

.aspect-ratio-9-14-3 {
    aspect-ratio: 9 / 14.3; /* Set the aspect ratio to match the image */
    max-height: calc(65vh + (10 * (random() * 1vh))); /* Constrain the height to a random value between 65vh and 75vh */
    width: auto; /* Let the width adjust based on the aspect ratio */
    object-fit: contain; /* Ensure the image fits within the container while maintaining aspect ratio */
}

/* ==================================================
   Gallery Layout Styles
   ================================================== */

.galleryContainer {
    display: flex;
    flex-wrap: wrap; /* Allow items to wrap to the next line */
    justify-content: flex-start; /* Align items to the start of the container */
    align-items: flex-start; /* Align items to the top of each row */
    max-width: none; /* Remove max-width constraint in gallery mode */
    max-height: none; /* Remove max-height constraint in gallery mode */
    width: 95%; /* Adjust width as needed for gallery */
    padding: 1rem;
    margin: 0; /* Add some top/bottom margin for gallery */
    overflow: auto; /* Enable scrolling within the gallery if content overflows */
    position: relative; /* Change position to relative or static if needed */
}

.gallery-mode {
    position: relative; /* Change from fixed to relative */
    top: auto; /* Reset top */
    left: auto; /* Reset left */
    transform: none; /* Reset transform */
    width: 15vw; /* Set fixed width for gallery items */
    height: auto; /* Let height adjust to content */
    padding: 0; /* Remove padding in gallery mode */
    margin: 4rem 0 0 0; /* Add some margin for spacing between gallery items */
    font-size: 1rem; /* Reset font-size */
    display: block; /* Or flex if you need to control inner elements layout */
    flex-direction: row; /* If using flex, set direction */
    align-items: flex-start; /* Align items to the top */
    transition: none; /* Remove transitions in gallery mode for immediate layout change */
    overflow: visible; /* Ensure content is visible */
    box-sizing: border-box; /* Ensure padding and border are included in width/height */
    z-index: 10; /* Reset z-index */
}

.gallery-mode p {
    font-size: 1rem; /* Adjust font size for text in gallery mode if needed */
}

/* Target video AND img elements within .gallery-mode */
.gallery-mode img,
.gallery-mode video {
    width: 15vw; /* Image/video fills the 20vw width container */
    height: auto; /* Maintain aspect ratio */
    display: block; /* Ensure block display for both */
    max-width: 100%; /* Ensure they don't exceed container */
    transform: none; /* Reset scale transform */
}

.hidden-in-gallery {
    display: none !important; /* Force hide when this class is present */
}

/* ==================================================
   Modal Styles
   ================================================== */

   #modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9); /* Semi-transparent black background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000; /* Ensure the modal is on top of everything */
    opacity: 0;
    transition: opacity 0.3s ease;
}

#modal-overlay.visible {
    opacity: 1;
}

#modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#modal-image,
#modal-video {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain; /* Ensure the image/video fits without cropping */
    border-radius: 8px;
}

#modal-video {
    width: 90vw;
    height: 90vh;
}

#modal-close {
    position: absolute;
    top: -40px;
    right: -40px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10001; /* Ensure the close button is on top */
}

#modal-close:hover {
    color: #ccc;
}

/* ==================================================
   Utility Classes for Aspect Ratio & Iframe Containment
   ================================================== */

.aspect-ratio-16-9 {
    aspect-ratio: 16 / 9;
}

.aspect-ratio-9-16 {
    aspect-ratio: 9 / 16;
    max-height: 75%;
}

.aspect-ratio-1-1 {
    aspect-ratio: 1 / 1;
}

.aspect-ratio-2-3 {
    aspect-ratio: 2 / 3;
}

.aspect-ratio-3-4 {
    aspect-ratio: 3 / 4;
}

.aspect-ratio-1-5-1 {
    aspect-ratio: 1.5 / 1;
}

.aspect-ratio-4-5 {
    aspect-ratio: 4 / 5;
}

.cropped {
    overflow: hidden;
    object-fit: cover; /* Ensure the image covers the container without distortion */
}

.iframe-fill-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ==================================================
   Responsive Design Adjustments
   ================================================== */

/* Mobile Devices (up to 480px) */
@media (max-width: 480px) {
    .content {
        font-size: 1.5rem; /* Smaller font size for mobile */
    }

    .itemsContainer {
        width: 95%; /* Wider container for mobile */
        max-width: none; /* Remove max-width constraint */
    }

    .scroll-item {
        width: 90%; /* Wider scroll items for mobile */
    }

    .gallery-mode {
        width: 30vw; /* Larger gallery items for mobile */
    }

    .gallery-mode img,
    .gallery-mode video {
        width: 30vw; /* Larger images/videos in gallery mode for mobile */
    }

    footer {
        font-size: 0.8rem; /* Smaller footer text for mobile */
    }
}

/* Tablets and Small Devices (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .content {
        font-size: 1.75rem; /* Slightly larger font size for tablets */
    }

    .itemsContainer {
        width: 90%; /* Slightly wider container for tablets */
    }

    .scroll-item {
        width: 80%; /* Slightly wider scroll items for tablets */
    }

    .gallery-mode {
        width: 30vw; /* Medium-sized gallery items for tablets */
    }

    .gallery-mode img,
    .gallery-mode video {
        width: 30vw; /* Medium-sized images/videos in gallery mode for tablets */
    }

    footer {
        font-size: 0.9rem; /* Slightly larger footer text for tablets */
    }
}

/* Laptops and Medium Devices (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .content {
        font-size: 2rem; /* Default font size for laptops */
    }

    .itemsContainer {
        width: 85%; /* Default container width for laptops */
    }

    .scroll-item {
        width: 70%; /* Default scroll item width for laptops */
    }

    .gallery-mode {
        width: 20vw; /* Default gallery item width for laptops */
    }

    .gallery-mode img,
    .gallery-mode video {
        width: 20vw; /* Default image/video width in gallery mode for laptops */
    }

    footer {
        font-size: 1rem; /* Default footer text size for laptops */
    }
}

/* Large Screens (1025px and above) */
@media (min-width: 1025px) {
    /* No changes needed for large screens, as the default styles are already optimized */
}