main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: 40px;
}


/* Back Button */
#button-container {
    margin-top: 9%;
    width: calc(100vw - 6.6rem);
}



.back-link {
  text-decoration: none;
  display: inline-block;
}

.back-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: transform 0.7s ease;
}


#back-button:active {
    transform: scale(0.95);
}

#Arrow-back {
    transform: rotate(180deg);
  
}

.back-inner:hover {
  transform: translateX(-5px);
}



/* Project Info Section */
#project-info {
    width: calc(100vw - 6.6rem);
    height: auto;
    min-height: 140px;
    display: flex;
    flex-direction: column;
}

#qandb {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 2rem;
}

#question-container {
    width: 60%;
}

h2 {
    font-family: 'Saans', sans-serif;
    font-weight: 100;
    /* line-height: 1; */
    font-size: 2.3rem;
    color: #1E1E1E;
}

/* CTA Button */
#cta {
    border: none;
    font-family: 'Saans', sans-serif;
    display: inline-block;
    background-color: black;
    font-size: 1.1rem;
    padding: 0.9rem 1.2rem;
    border-radius: 30px;
    color: white;
    line-height: 1;
    white-space: nowrap;
    text-align: center;
    align-items: center;
    width: auto;
    height: auto;
    transition: all 0.3s cubic-bezier(0.2, 0, 0.2, 1);
    cursor: pointer;
}

#cta:hover {
    background-color: #0004FF;
    transform: translateY(-2px);
}

#cta:active {
    transform: translateY(0);
}

/* Tag Container */
#tag-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.tag {
    display: inline-block;
    border: 1px solid black;
    border-radius: 0px;
    font-family: 'Saans', sans-serif;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0.3rem 0.8rem;
    text-align: center;
    white-space: nowrap;
    width: auto;
    height: auto;
    user-select: none;
    transition: all 0.2s ease;
}

.tag:hover {
    background-color: black;
    color: white;
}

.tag p {
    margin: 0;
    font-weight: 400;
}


/* Extra Info Container */
#extra-info-container {
    margin-top: 20px;
    width: 50%;
    column-count: 2;
    column-gap: 2rem;
    display: block;
    align-content: flex-start;
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.9s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.9s cubic-bezier(0.4, 0, 0.2, 1), 
                max-height 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Add extra margin when agency context is missing */
body:not(:has(#agency-context)) #extra-info-container {
    margin-top: 40px;
}


#agency-context {
  opacity: 0;
  margin-block: 20px;
  visibility: hidden;
  transition: opacity 0.9s cubic-bezier(0.4, 0, 0.2, 1), 
              visibility 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

#agency-context.show {
  opacity: 1;
  visibility: visible;
}

#agency-context p {
  color: #d7d7d7;
}



#extra-info-container.show {
    opacity: 1;
    visibility: visible;
}

#extra-info-container.show{
  max-height: 1000px;
}

#extra-info-container p {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    line-height: 1.1;
}

/* Media Containers */
.container-style1 {
    width: calc(100vw - 6.6rem);
    height: auto;
    margin-top: 3%;
    display: flex;
    justify-content: center;
}

.container-style2 {
    width: calc(100vw - 6.6rem);
    height: auto;
    margin-top: 3%;
    display: flex;
    justify-content: space-between;
    gap: 2%;
}

.container-style3 {
    width: calc(100vw - 6.6rem);
    height: auto;
    margin-top: 3%;
    display: flex;
    justify-content: space-between;
    gap: 2%;
}

.container-style3 video {
    width: 28%;
    aspect-ratio: 9 / 16;
    object-fit: cover;

}

.container-style-special {
    width: calc(100vw - 6.6rem);
    height: auto;
    background-color: rgb(217, 217, 217);
    margin-top: 3%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3%;
}

.container-style1 iframe{
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
}

.video-special {
    width: 380px;
    height: auto;
    border-radius: 20px;
}

/* Media Styling */
.container-style1 img,
.container-style1 video {
    width: 100%;
    height: auto;
    object-fit: cover;

}

.container-style2 img,
.container-style2 video {
    width: 48.5%;
    height: auto;
    object-fit: cover;

}


/* First Container Animation - Updated for smooth transitions */
#first-container {
    margin-top: 3%;
    transition: margin-top 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Expanded state - adjust based on screen size and agency context presence */
#first-container.expanded {
    margin-top: 6%;
}

/* Adjust margins for pages WITH agency context */
body:has(#agency-context) #first-container.expanded {
    margin-top: 6%;
}

/* Adjust margins for pages WITHOUT agency context */
body:not(:has(#agency-context)) #first-container.expanded {
    margin-top: 4%;
}

/* Next Project Section */
#next-project {
    width: calc(100vw - 6.6rem);
    height: auto;
    margin-bottom: 1%;
    margin-top: 3%;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.7s ease;
}

#arrow-container{
    display: flex;
    align-items: center;
    margin-bottom: 0.2rem;
    
}

#next-project:hover {
    transform: translateX(5px);
}


#next-project p, #button-container p {
    font-size: 1.3rem;
    text-decoration: none;
    color: #d7d7d7;
}

#Arrow-to-project, #Arrow-back {
    width: 20px;
    margin-left: 0.5rem;
    color: #d7d7d7;
    height: auto;
    transition: transform 0.5s ease;
}

#next-project:hover #Arrow-to-project {
    transform: translateX(10px);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 990px) {
    #project-info,
    #button-container,
    .container-style1,
    .container-style2,
    .container-style3,
    #next-project,
    .container-style-special {
        width: 88vw;

    }

    .container-style1,
    .container-style2,
    .container-style3,
    .container-style-special {
        padding: 0;
        margin-top: 2.3rem;
    }

    .container-style-special {
        background-color: none;
        padding: 0;
        border-radius: none;
    }

    .video-special {
        border-radius: 0;
    }


    .tag {
        font-size: 0.7rem;
        padding: 0.1rem 0.5rem;
    }

  

    #cta {
        font-size: 0.9rem;
        padding: 0.8rem;
    }

    #qandb {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    #question-container {
        width: 100%;
    }

    #extra-info-container {
        margin-top: 40px;
        width: 100%;
        column-count: 1;
        column-gap: 0;
    }

    #extra-info-container p {
        margin-bottom: 1rem;
    }

    .container-style2, .container-style3 {
        flex-direction: column;
        width: 88vw;       
        gap: 2.3rem;      
    }

    .container-style2 img,
    .container-style2 video {
        width: 100%;
        
    }



    .container-style3 {
        flex-direction: column;
    }

    .container-style3 video {
        width: 100%;

    }

    #button-container {
        margin-top: 30%;
    }

    #next-project {
        margin-top: 4rem;
    }
}

@media (max-width: 700px) {
    /* Tablet breakpoint for first-container expansion */
    #first-container.expanded {
        margin-top: 15%;
    }
    
    body:has(#agency-context) #first-container.expanded {
        margin-top: 20%;
    }
    
    body:not(:has(#agency-context)) #first-container.expanded {
        margin-top: 15%;
    }
}

@media (max-width: 600px) {
    h2 {
        font-size: 1.5rem;
    }

    #Arrow-back {
        width: 23px;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 490px) {
    /* Mobile breakpoint for first-container expansion */
    #first-container.expanded {
        margin-top: 35%;
    }
    
    body:has(#agency-context) #first-container.expanded {
        margin-top: 43%;
    }
    
    body:not(:has(#agency-context)) #first-container.expanded {
        margin-top: 35%;
    }
}