/* --- Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; line-height: 1.4; overflow-x: hidden; background-color: white; }

/* --- Layout --- */
.main-container { display: flex; min-height: 100vh; position: relative; z-index: 10; }
.sidebar { width: 250px; padding: 22px 30px; position: fixed; top: 0; left: 0; height: 100vh; }
.logo { font-size: 1.35rem; font-weight: 300; margin-bottom: 22px; cursor: pointer; }

.menu { list-style: none; }
.menu li { margin-bottom: 1px; }
.menu a, .back-link { text-decoration: none; color: #bbb; font-size: 1.35rem; font-weight: 300; transition: color 0.3s ease; display: block; }
.menu a:hover, .back-link:hover, .menu a.active { color: #333; }

/* Content Area */
.content { margin-left: 250px; padding: 40px 40px 40px 20px; flex-grow: 1; display: flex; flex-direction: column; align-items: flex-end; }

/* List of Works */
.works-list { width: 100%; display: flex; flex-direction: column; align-items: flex-end; }
.work-item { display: flex; gap: 40px; text-decoration: none; color: #333; margin-bottom: 70px; justify-content: flex-end; width: 100%; max-width: 820px; }
.work-text { width: 240px; flex-shrink: 0; }
.work-text h2 { font-size: 1.1rem; font-weight: normal; margin-bottom: 4px; }
.meta { color: #999; font-size: 0.9rem; margin-bottom: 20px; }
.work-item img { width: 420px; height: 280px; object-fit: cover; }

/* --- Project Detail View --- */
.project-detail { width: fit-content; max-width: 100%; display: none; flex-direction: column; }
.slideshow-container { position: relative; cursor: pointer; margin-bottom: 30px; width: fit-content; }
.slideshow-container img { display: block; max-width: 100%; width: auto; height: auto; max-height: 85vh; }
.slide-arrow { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 2rem; color: white; opacity: 0; transition: opacity 0.5s ease; pointer-events: none; text-shadow: 0 0 10px rgba(0,0,0,0.5); }
.slideshow-container:hover .slide-arrow { opacity: 1; }
#slideshow-video { display: none; max-width: 100%; max-height: 85vh; width: auto; height: auto; background: #000; }
.project-text { width: 0; min-width: 100%; }
.project-text h2 { font-weight: normal; }
.description { color: #666; font-size: 0.95rem; margin-top: 15px; }

/* --- Office / Contact View --- */
.contact-view { width: 100%; max-width: 340px; display: none; flex-direction: column; }
.contact-view img { width: 100%; height: auto; display: block; margin-bottom: 20px; }
.contact-info p { color: #999; font-size: 0.9rem; margin-bottom: 16px; line-height: 1.5; }
.contact-info a { color: #333; text-decoration: none; }
.contact-info a:hover { text-decoration: underline; }

/* --- THE ANIMATION ENGINE --- */
@keyframes pureFade { 0% { opacity: 0; } 100% { opacity: 1; } }

/* -------------------------------------------------------------------------
   STATE & SECTION LOGIC ENGINE
-------------------------------------------------------------------------- */

/* Hide menus by default to prevent bleed-through */
.filter-menu, .section-list, .dynamic-back, .back-link { display: none; }

/* --- 1. COVER STATE --- */
body[data-state="cover"] .hero-image { opacity: 1; z-index: 1; display: block; }
body[data-state="cover"] .logo { color: white; }
/* FIXED: Bulletproof hide rules for the cover page */
body[data-state="cover"] #main-menu, 
body[data-state="cover"] .filter-menu,
body[data-state="cover"] .back-link,
body[data-state="cover"] .content { display: none !important; }
.hero-image { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: black; }
.hero-image img { width: 100%; height: 100%; object-fit: cover; opacity: 0.8; }

/* --- 2. MENU STATE --- */
/* FIXED: Actively hiding the filter sub-menus here so they don't show on the main page */
body[data-state="menu"] .hero-image, 
body[data-state="menu"] .content,
body[data-state="menu"] .filter-menu,
body[data-state="menu"] .back-link { display: none; } 
body[data-state="menu"] .logo { color: black; }
body[data-state="menu"] #main-menu { display: block; animation: pureFade 0.8s ease forwards; }

/* --- 3. CONTENT STATE (Viewing lists and filters) --- */
body[data-state="content"] .hero-image, body[data-state="content"] #main-menu { display: none; }
body[data-state="content"] .logo { color: black; }
body[data-state="content"] .content { display: flex; }

/* Route logic for specific sections */

/* Architecture */
body[data-state="content"][data-section="architecture"] #filter-architecture { display: block; animation: pureFade 0.8s ease forwards; }
/* FIXED: Changed to display: flex to restore the right-edge alignment */
body[data-state="content"][data-section="architecture"] #list-architecture { display: flex; animation: pureFade 0.8s ease forwards; }

/* Art */
body[data-state="content"][data-section="art"] #filter-art { display: block; animation: pureFade 0.8s ease forwards; }
/* FIXED: Changed to display: flex */
body[data-state="content"][data-section="art"] #list-art { display: flex; animation: pureFade 0.8s ease forwards; }

/* Journal and Articles */
body[data-state="content"][data-section="journal"] #list-journal { display: flex; animation: pureFade 0.8s ease forwards; }
body[data-state="content"][data-section="articles"] #list-articles { display: flex; animation: pureFade 0.8s ease forwards; }


/* --- 4. PROJECT STATE (Viewing a single item) --- */
body[data-state="project"] .hero-image, body[data-state="project"] #main-menu, body[data-state="project"] .section-list { display: none; }
body[data-state="project"] .logo { color: black; }
body[data-state="project"] .content { display: flex; }
body[data-state="project"] .project-detail { display: flex; animation: pureFade 0.8s ease forwards; }

/* Show the correct back link based on the section */
body[data-state="project"][data-section="architecture"] #back-architecture { display: block; animation: pureFade 0.8s ease forwards; }
body[data-state="project"][data-section="journal"] #back-journal { display: block; animation: pureFade 0.8s ease forwards; }
body[data-state="project"][data-section="articles"] #back-articles { display: block; animation: pureFade 0.8s ease forwards; }
body[data-state="project"][data-section="art"] #back-art { display: block; animation: pureFade 0.8s ease forwards; }


/* --- 5. CONTACT STATE --- */
body[data-state="contact"] .hero-image, body[data-state="contact"] #main-menu { display: none; }
body[data-state="contact"] .logo { color: black; }
body[data-state="contact"] #link-back-office { display: block; animation: pureFade 0.8s ease forwards; }
body[data-state="contact"] .content { display: flex; }
body[data-state="contact"] .contact-view { display: flex; animation: pureFade 0.8s ease forwards; }


/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {

    /* Sidebar stays as a narrow left column — same structure as desktop */
    .main-container { flex-direction: row; }
    .sidebar {
        width: 110px;
        min-width: 110px;
        padding: 20px 14px;
        position: fixed;
        height: 100vh;
        overflow: hidden;
    }
    .logo { font-size: 0.65rem; letter-spacing: 0.03em; margin-bottom: 22px; }
    .menu a, .back-link { font-size: 0.68rem; line-height: 1.7; }

    /* Content takes the rest of the screen */
    .content {
        margin-left: 110px;
        padding: 20px 16px 60px 28px;
        align-items: flex-start;
        width: calc(100% - 110px);
    }

    /* Work list — horizontal row, same as desktop feel */
    .works-list { align-items: flex-end; width: 100%; }
    .work-item {
        flex-direction: row;
        align-items: flex-start;
        justify-content: flex-end;
        gap: 14px;
        width: 100%;
        max-width: 100%;
        margin-bottom: 40px;
    }
    .work-text { width: 95px; flex-shrink: 0; text-align: right; }
    .work-text h2 { font-size: 0.75rem; }
    .meta { font-size: 0.65rem; margin-bottom: 0; }
    .work-item img {
        width: 26vw;
        max-width: 105px;
        height: 70px;
        flex-shrink: 0;
        object-fit: cover;
    }

    /* Project detail — image full width of content area, text below */
    .project-detail { width: 100%; }
    .slideshow-container { width: 100%; margin-bottom: 20px; }
    .slideshow-container img { width: 100%; height: auto; display: block; }
    .project-text { width: 100%; max-width: 100%; }
    .project-text h2 { font-size: 0.95rem; }
    .description { font-size: 0.82rem; line-height: 1.65; }

    /* Contact view */
    .contact-view { max-width: 100%; }
}