/* Start with a clean, full-screen space for the artwork */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Keep the main artwork from creating page scrollbars */
    background-color: #FF0093; /* Match the vivid pink used in the visual identity */
}

#artwork-wrapper {
    /* Centre the artwork area inside the browser window */
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center; /* Centre the artwork vertically too */
}

/* Let the p5 canvas fill whatever screen size the viewer has */
#canvas-container {
    position: absolute; /* Layer the canvas inside its wrapper */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
}

#canvas-container canvas {
    /* Make the generated canvas follow the container size */
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

/* Centre the two-page intervention story above the artwork */
#story-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-in-out;
}

#story-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.story-popup {
    position: relative;
    width: min(84vw, 78vh);
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    padding: clamp(54px, 7vw, 90px) clamp(32px, 7vw, 90px) 30px;
    background-color: rgba(162, 8, 78, 0.8);
    overflow-y: auto;
    scrollbar-width: none;
}

.story-popup::-webkit-scrollbar {
    display: none;
}

.story-popup .column-title {
    margin-bottom: clamp(20px, 3vw, 30px);
}

.story-popup .body-text {
    font-size: clamp(15px, 1.35vw, 20px);
}

.story-close-btn,
.story-nav-btn {
    border: 2px solid #D0FFEA;
    border-radius: 50%;
    background: transparent;
    color: #D0FFEA;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    font-family: 'Helvetica', Arial, sans-serif;
}

.story-close-btn {
    position: absolute;
    top: 22px;
    right: 22px;
    z-index: 1;
    width: 40px;
    height: 40px;
    font-size: 20px;
    line-height: 0;
}

.story-close-btn:hover,
.story-nav-btn:not(:disabled):hover {
    background: #D0FFEA;
    color: #A2084E;
}

.story-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-top: 28px;
}

.story-navigation .subtitle {
    margin: 0;
    min-width: 58px;
    text-align: center;
    font-size: 16px;
}

.story-nav-btn {
    width: 42px;
    height: 42px;
    font-size: 24px;
    line-height: 0;
    padding-bottom: 4px;
}

.story-nav-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

/* Build the information panel as a full-screen overlay */
#info-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(162, 8, 78, 0.8);
    z-index: 1000;
    padding: 0 60px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-in-out;
    overflow-y: auto; /* Allow long project notes to scroll */
    scrollbar-width: none; /* Keep the Firefox scrollbar visually quiet */
}

#info-overlay::-webkit-scrollbar { 
    /* Hide the scrollbar in WebKit browsers while keeping scroll available */
    display: none; 
}

#info-overlay.active {
    /* This class is added by JavaScript when the viewer opens the panel */
    opacity: 1;
    pointer-events: auto;
}

/* Style the circular close control so it stays easy to find */
.close-btn {
    position: fixed; /* Keep the button visible while the panel scrolls */
    top: 45px;
    right: 60px;
    background: transparent;
    border: 2px solid #D0FFEA;
    color: #D0FFEA;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    line-height: 0; /* Prevent extra text height from shifting the X icon */
}
.close-btn:hover {
    /* Invert the colours on hover to show that this is clickable */
    background: #D0FFEA;
    color: #A2084E;
}

/* Size and space the designed project title image */
.project-name {
    position: relative; /* Let the title sit naturally above the text */
    margin-top: 50px; /* Leave breathing room at the top */
    margin-bottom: 50px; /* Separate the title from the information grid */
    width: 66.66vw; /* Keep the title broad without filling the full screen */
    z-index: 10;
}

.project-name img {
    /* Preserve the title artwork proportions */
    width: 90%; 
    height: auto;
    display: block;
}

/* Arrange the desktop information into three balanced columns */
.three-col-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5vw; /* Use screen-based spacing between the columns */
    width: 100%;
    height: auto; /* Let the layout grow with the content */
    padding-top: 0; /* Keep the title and grid close together */
    padding-bottom: 80px; /* Leave room after the last content block */
    box-sizing: border-box;
}

.info-column {
    /* Stack each column's text groups vertically */
    display: flex;
    flex-direction: column;
}

/* Give each type of text a clear visual role */
.column-title {
    font-family: 'Helvetica', Arial, sans-serif;
    font-weight: bold; /* Make column headings easy to scan */
    text-transform: uppercase; /* Match the direct editorial style */
    color: #D0FFEA;
    font-size: 29px; /* Keep the heading stronger than the body text */
    border-bottom: 4px solid #AEEB87; /* Add the lime accent line */
    padding-bottom: 12px;
    margin-top: 0;
    margin-bottom: 30px;
    line-height: 1.1;
}

.info-group {
    /* Separate each credit or research detail from the next one */
    margin-bottom: 25px;
}

.subtitle {
    font-family: 'Helvetica', Arial, sans-serif;
    font-weight: bold;
    color: #AEEB87;
    text-transform: uppercase;
    font-size: 22px; /* Make labels smaller than the main heading */
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.body-text {
    /* Use comfortable settings for longer reading */
    font-family: 'Helvetica', Arial, sans-serif;
    font-weight: normal;
    color: #D0FFEA;
    font-size: 20px; /* Keep the body readable on large screens */
    line-height: 1.5;
    margin: 0;
}

.text-justify {
    /* Only justify paragraphs that need a more editorial block shape */
    text-align: justify;
}

.quote-text {
    /* Make the quote feel like a featured statement */
    font-family: 'Helvetica', Arial, sans-serif;
    font-weight: bold;
    color: #D0FFEA;
    font-size: 32px;
    line-height: 1.2;
    border-left: 4px solid #AEEB87; /* Echo the accent line used in headings */
    padding-left: 20px;
    margin-bottom: 30px;
}

/* Device Warning Layout */
#device-warning {
    display: none; 
    position: fixed;
    inset: 0;
    z-index: 9999;

    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.95) 10%, rgba(255, 255, 255, 0) 100%);

    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
}

#device-warning p {
    font-family: 'Helvetica', Arial, sans-serif;
    color: #A2084E;
    font-size: 24px;
    font-weight: bold;
    line-height: 1.5;
    margin: 10px 0;
    max-width: 85%;
}

/* Responsive Layout */

/* Slightly reduce the desktop scale for regular laptop screens */
@media (max-width: 1600px) {
    .three-col-layout { gap: 4vw; }
    .column-title { font-size: 27px; }
    .subtitle { font-size: 21px; }
    .body-text { font-size: 19px; }
    .quote-text { font-size: 30px; }
}

/* Tighten spacing and type sizes for tablets */
@media (max-width: 1200px) {
    .three-col-layout { gap: 30px; }
    #info-overlay { padding: 0 40px; } /* Use less side padding on narrower screens */
    .close-btn { right: 40px; }
    .column-title { font-size: 25px; }
    .subtitle { font-size: 20px; }
    .body-text { font-size: 18px; }
    .quote-text { font-size: 28px; }
    .project-name { width: 85vw; } /* Give the title more room on tablets */
}

/* Switch to one clear reading column for phones */
@media (max-width: 900px) {
    .three-col-layout {
        grid-template-columns: 1fr; /* Stack the three information areas vertically */
        gap: 40px;
    }
    .close-btn { top: 25px; }
    .column-title { font-size: 23px; }
    .subtitle { font-size: 18px; }
    .body-text { font-size: 16px; }
    .quote-text { font-size: 26px; }
    .project-name { width: 90vw; margin-top: 40px; }
    .story-popup { width: min(90vw, 78vh); }
    .story-popup .body-text { font-size: 16px; }
    
    #device-warning p { font-size: 18px; }
}

/* Hiển thị lớp phủ cảnh báo khi thiết bị cầm ở chế độ màn hình dọc (Portrait) */
@media (max-width: 1200px) and (orientation: portrait) {
    #device-warning {
        display: flex;
    }
}
