/* 
   Aesthetic variables:
   Stark minimalist, brutalist architecture inspired.
   High contrast, no film grain.
*/
:root {
    --bg-color: #ffffff;
    --text-color: #000000;
    --accent-color: #555555;
    
    --font-heading: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-body: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    
    --spacing-sm: 1rem;
    --spacing-md: 2.5rem;
    --spacing-lg: 5rem;
    --spacing-xl: 10rem;
    
    --header-height: 80px;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3 {
    font-weight: normal;
}

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

a:hover {
    color: var(--accent-color);
}

/* Top Mini Menu (like reference site's very top directory) */
.l-menu {
    text-align: center;
    padding: 10px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid #eee;
    background: #fff;
    position: relative;
    z-index: 100;
}

/* Layout Containers */
.container--full {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 4%;
}

.container--text {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 4%;
}

/* Header */
.l-header {
    position: sticky;
    top: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    z-index: 90;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.l-header__left, .l-header__right {
    flex: 1;
}

.l-header__right {
    text-align: right;
}

.l-header__center {
    flex: 2;
    text-align: center;
}

.site--logo h1 {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 0.1em;
}

/* Masonry Gallery */
.l-main {
    padding-top: var(--spacing-md);
    padding-bottom: var(--spacing-xl);
}

/* Layout Toggle Button */
.layout-toggle-btn {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: #000;
    color: #fff;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.3s;
}

.layout-toggle-btn:hover {
    background: var(--accent-color);
}

.layout-toggle-btn svg {
    position: absolute;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

/* Default state: Masonry visible, Grid hidden */
.layout-toggle-btn .icon-grid {
    opacity: 0;
    transform: scale(0.5) rotate(-45deg);
}

.layout-toggle-btn .icon-masonry {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Toggled state: Grid visible, Masonry hidden */
.layout-toggle-btn.is-toggled .icon-masonry {
    opacity: 0;
    transform: scale(0.5) rotate(45deg);
}

.layout-toggle-btn.is-toggled .icon-grid {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Base Gallery Container (Default Masonry) */
.projects {
    column-count: 2;
    column-gap: 40px;
    transition: opacity 0.4s ease;
}

.c-project {
    break-inside: avoid;
    margin-bottom: 60px;
}

/* Toggled Grid Layout (3 Columns) */
.projects.is-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.projects.is-grid .c-project {
    margin-bottom: 0;
    max-width: 100%;
}

.projects.is-animating {
    opacity: 0;
}

.c-project__container {
    display: block;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.lazy-image {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.lazy-image.loaded {
    opacity: 1;
    transform: translateY(0) translateX(0);
}

.c-project__container:hover .lazy-image.loaded {
    transform: translateY(0) translateX(40px);
}

.c-project__title {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40px;
    margin: 0;
    padding: 10px 0;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: center;
    font-size: 0.85rem;
    color: var(--accent-color);
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
}

.c-project__container:hover .c-project__title {
    opacity: 1;
}

/* Information / Journal Section */
.information-section {
    padding: var(--spacing-xl) 0;
    background-color: #fafafa;
    border-top: 1px solid #eee;
}

.information-section h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-content {
    font-size: 1.1rem;
}

.info-content p {
    margin-bottom: 1.5rem;
}

/* Footer */
.l-footer {
    padding: var(--spacing-md) 0;
    border-top: 1px solid #eee;
    font-size: 0.85rem;
}

.l-footer .container--full {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Responsive - Tablet */
@media (max-width: 900px) {
    .projects {
        column-count: 2; /* Switch to 2 columns on tablet */
    }
    
    .projects.is-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .header-row {
        flex-direction: column;
        justify-content: center;
        gap: 10px;
        height: auto;
        padding: 20px 0;
    }
    
    .l-header__left, .l-header__center, .l-header__right {
        text-align: center;
        flex: none;
    }
}

/* Responsive - Mobile */
@media (max-width: 600px) {
    .projects {
        column-count: 1; /* Single column on mobile */
    }
    
    .projects.is-grid {
        grid-template-columns: 1fr;
    }
    
    .layout-toggle-btn {
        width: 40px;
        height: 40px;
        right: 15px;
        bottom: 20px;
        top: auto;
        transform: none;
    }

    /* Disable hover effects on mobile and show captions below images */
    .c-project__container {
        overflow: visible;
        margin-bottom: 20px;
    }

    .c-project__container:hover .lazy-image.loaded {
        transform: none; /* Disable slide effect */
    }

    .c-project__title {
        position: static;
        width: 100%;
        writing-mode: horizontal-tb;
        transform: none;
        text-align: left;
        opacity: 1; /* Always visible */
        color: var(--accent-color);
        padding: 10px 0 0 0;
        font-size: 0.9rem;
    }

    .l-footer .container--full {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}
