:root {
    --color-text: #3F261D;
    --color-bg: #fff;
    --color-link: #000;
    --color-link-hover: #000;
    --page-padding: 1.5rem;
    --grid-gutter: clamp(0.625rem, -0.2463rem + 3.7175vw, 3.75rem);
    --grid-columns: 6;
    --grid-padding: 2rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: futura, Arial, sans-serif;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 13px;
    position: relative; /* Add this line */
    z-index: 0; /* Add this line */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.3s ease;
}

/* Add this new rule */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    z-index: -2; /* Place it behind the video */
}

#background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

a {
    color: var(--color-link);
    text-decoration: none;
}

a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

.logo {
    width: 66px;
}

.frame {
    padding: 1rem;
    display: grid;
    grid-template-columns: auto auto 1fr auto 1fr;
    grid-template-rows: auto auto;
    align-content: space-between;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    pointer-events: none;
}

.frame > * {
    pointer-events: auto;
}

.logo {
    grid-column: 1;
    grid-row: 1;
}

.frame__description {
    grid-column: 3 / span 3; /* Extend to span 3 columns */
    grid-row: 1;
    justify-self: start;
    align-self: start;
    padding-left: calc(40vw - var(--page-padding));
    max-width: 60vw; /* Increase maximum width */
    white-space: nowrap; /* Prevent line breaks */
}

.frame__bottom-left {
    grid-column: 1;
    grid-row: 2;
    align-self: end;
    display: flex;
    flex-direction: row; /* Change to row to place items side by side */
    gap: 1rem; /* Adjust the gap between links as needed */
}

.frame__credits {
    grid-column: 3 / span 3; /* Extend to span 3 columns */
    grid-row: 2;
    justify-self: start;
    align-self: end;
    padding-left: calc(40vw - var(--page-padding));
    max-width: 60vw; /* Increase maximum width */
}

.content {
    position: relative;
    z-index: 2;
}

.container {
    max-width: 120rem;
    margin: 0 auto;
}

.grid {
    display: grid;
    gap: calc(var(--grid-gutter) * 4) var(--grid-gutter);
    grid-template-columns: repeat(var(--grid-columns), 1fr);
    padding: 6rem var(--grid-padding);
    max-width: calc(100% - (var(--grid-padding) * 2));
    margin: 0 auto;
    padding-bottom: 12rem;
    padding-top: 12rem;
}

.img-wrap {
    position: relative; /* Add this */
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
    margin: 0;
}

.img-container {
    position: relative;
    overflow: visible;
    width: 100%;
    cursor: cell;
}

.img-container img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s ease;
}

.pin-icon {
    position: absolute;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
}

.pin-top-left {
    top: -1%;
    left: -1%;
    transform: translate(-50%, -50%);
}

.pin-top-right {
    top: -1%;
    right: -1%;
    transform: translate(50%, -50%) rotate(90deg);
}

.pin-bottom-left {
    bottom: -1%;
    left: -1%;
    transform: translate(-50%, 50%) rotate(-90deg);
}

.pin-bottom-right {
    bottom: -1%;
    right: -1%;
    transform: translate(50%, 50%) rotate(180deg);
}

/* Show pins on hover for desktop */
@media screen and (min-width: 769px) {
    .img-container:hover .pin-icon {
        opacity: 1;
    }

    .img-container:hover img:not(.pin-icon) {
        opacity: 0;
    }
}

/* For mobile, we'll show the pins when the image is active */
@media screen and (max-width: 768px) {
    .img-wrap.active .pin-icon {
        opacity: 1;
    }

    .img-wrap.active img:not(.pin-icon) {
        opacity: 0;
    }
}

.img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s ease;
}

.img img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.figcaption {
    position: relative; /* Add this */
    width: 100%;
    padding-top: 0.5em; /* Add some space above the caption */
    grid-column: 1 / -1;
    align-self: end;
    display: flex;
    flex-direction: column;
    width: 100%; /* Ensure the figcaption takes full width */
}

figcaption strong {
    display: block;
    margin-bottom: 0.25em; /* Adds a small space between the two text elements */
    align-self: flex-start; /* Aligns the strong element to the left */
}

figcaption span {
    position: absolute;
    right: 0;
    bottom: 0;
    align-self: flex-end; /* Aligns the span element to the right */
    text-align: right;
    width: 100%; /* Ensure the span takes full width */
}

/* If you need to adjust the font size or other properties */
figcaption strong,
figcaption span {
    font-size: 13px; /* Adjust as needed */
    line-height: 1.2; /* Adjust as needed */
}

.img-wrap:nth-child(1) { grid-column: 2 / span 2; grid-row: 1; }
.img-wrap:nth-child(2) { grid-column: 4 / span 3; grid-row: 2; }
.img-wrap:nth-child(3) { grid-column: 3 / span 3; grid-row: 3; }
.img-wrap:nth-child(4) { grid-column: 1 / span 2; grid-row: 4; }
.img-wrap:nth-child(5) { grid-column: 4 / span 2; grid-row: 5; }

@media screen and (min-width: 53em) {
    .frame {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        grid-template-columns: auto auto 1fr auto 1fr;
        grid-template-rows: auto auto;
        align-content: space-between;
        z-index: 1000;
    }

    .content {
        min-height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
    }
}

@media screen and (max-width: 768px) {
    body {
        font-size: 10px; /* Set the base font size for mobile */
    }

    .frame {
        grid-template-columns: 100%; /* Change to a single column layout */
        grid-template-rows: auto 1fr auto;
        height: 100vh;
        padding: 1rem;
    }
    figcaption strong, figcaption span {
        font-size: 10px;
    }

    .logo {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
    }

    .frame__description,
    .frame__credits {
        grid-column: 1;
        grid-row: 1;
        justify-self: end;
        text-align: left;
        padding-left: 0;
        width: 60%; /* Adjust as needed */
    }

    .frame__description {
        align-self: start;
        margin-top: 2px;
    }

    .frame__credits {
        align-self: start;
        margin-top: 18px;
    }

    .frame__bottom-left {
        grid-column: 1;
        grid-row: 3;
        justify-self: center;
        align-self: end;
        display: flex;
        justify-content: center;
        width: 100%;
        gap: 1.5rem;
        padding-bottom: 1rem;
    }

    .frame__email,
    .frame__instagram {
        font-size: 12px;
    }

    .grid {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: calc(var(--grid-gutter) * 6) var(--grid-gutter);
        padding-top: calc(var(--grid-gutter) * 12);   /* Double the top padding */
        padding-bottom: calc(var(--grid-gutter) * 12); /* Keep bottom padding as is */
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .img-wrap {
        grid-column: 1 / span 6 !important; /* Make all figures span full width (6 columns) */
    }

    .img-wrap:nth-child(n) {
        grid-column: 1 / span 6; /* Ensure all figures span 6 columns */
        grid-row: auto; /* Let the grid automatically assign rows */
    }
}

#background-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -1; /* Ensure it's above the white background but below the content */
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.video-active #background-video {
    opacity: 1;
}

body.video-active::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: inherit;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

body.video-active::before {
    opacity: 1;
}