@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&display=swap');

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

:root {
    --color-bg: #ffffff;
    --color-text: #111111;
    --color-muted: #999999;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    --frame: 24px;
    --gap: 60px;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
    min-height: 100vh;
    padding: var(--frame);
    display: flex;
    flex-direction: column;
}

a {
    color: var(--color-text);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.85;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Site header */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 0 40px;
}

.site-name {
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--color-text);
}

.site-name a {
    color: inherit;
}

.site-instagram {
    color: var(--color-text);
    display: flex;
    align-items: center;
}

/* Hero: remove body padding */
body.hero-active {
    padding: 0;
    margin: 0;
}

/* Hero Page — standalone, full-width, no crop, no chrome */
.hero-page {
    display: block;
    position: relative;
    width: 100vw;
    min-height: 100vh;
    cursor: pointer;
    text-decoration: none;
}

.hero-link {
    display: block;
}

.hero-link img {
    display: block;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
}

.hero-logo {
    position: absolute;
    top: var(--frame);
    left: var(--frame);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: lowercase;
}

.hero-caption {
    position: absolute;
    bottom: var(--frame);
    left: var(--frame);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
}

.hero-instagram {
    position: absolute;
    top: var(--frame);
    right: var(--frame);
    z-index: 10;
}

/* Light text (for dark images) */
.hero-text-light .hero-logo,
.hero-text-light .hero-caption,
.hero-text-light .hero-instagram {
    color: rgba(255, 255, 255, 0.85);
}

/* Dark text (for light images) */
.hero-text-dark .hero-logo,
.hero-text-dark .hero-caption,
.hero-text-dark .hero-instagram {
    color: rgba(0, 0, 0, 0.75);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 50px 0 40px;
    flex: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Card Grid — Homepage (masonry columns) */
.card-grid {
    columns: 3;
    column-gap: 24px;
}

.card {
    display: block;
    break-inside: avoid;
    margin-bottom: 24px;
}

.card-img {
    overflow: hidden;
    background: #f5f5f5;
}

.card-img img {
    width: 100%;
}

.card-placeholder {
    width: 100%;
    min-height: 200px;
}

.card-text {
    padding: 6px 0 0;
}

.card-text h2 {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.04em;
}

/* Home footer bar */
.home-bar {
    margin-top: auto;
    padding: 60px 0 0;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: lowercase;
    color: var(--color-muted);
    line-height: 1.8;
}

.home-bar a {
    color: var(--color-muted);
}

/* Page elements */
.page-title {
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    margin-bottom: 2rem;
}

.page-description {
    color: var(--color-muted);
    font-size: 0.85rem;
    margin-bottom: 2rem;
    max-width: 500px;
    line-height: 1.7;
}

/* Overlay — gallery/project detail */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: var(--color-bg);
    overflow-y: auto;
    padding: var(--frame);
}

.overlay-close {
    position: fixed;
    top: var(--frame);
    right: var(--frame);
    z-index: 90;
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--color-text);
    line-height: 1;
    padding: 8px;
}

.overlay-close:hover {
    opacity: 0.4;
}

.overlay-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 50px 0 40px;
}

/* Image Grid — inside galleries/projects (masonry) */
/* Masonry via JS (left-to-right order) */
.masonry {
    display: flex;
    gap: 24px;
}

.masonry-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.masonry .image-item {
    margin-bottom: 0;
}

/* Fallback: CSS columns (top-to-bottom order) */
.image-grid {
    display: block;
    column-count: 3;
    column-gap: 24px;
}

.image-item {
    break-inside: avoid;
    margin-bottom: 24px;
}

.image-item a {
    display: block;
}

.image-item img {
    width: 100%;
    cursor: pointer;
}

.image-item figcaption {
    font-size: 0.7rem;
    color: var(--color-muted);
    padding: 6px 0;
    letter-spacing: 0.04em;
}

/* Project content blocks */
.project-text,
.content-text {
    max-width: 600px;
    line-height: 1.8;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.project-meta {
    margin-bottom: 1.5rem;
}

.project-year {
    font-size: 0.75rem;
    color: var(--color-muted);
}

.content-image {
    margin: 2rem 0;
}

.content-image figcaption {
    font-size: 0.7rem;
    color: var(--color-muted);
    margin-top: 6px;
}

.content-image-fullscreen {
    margin: 2rem calc(-1 * var(--frame));
    width: calc(100% + 2 * var(--frame));
}

.content-image-fullscreen img {
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    display: block;
}

.content-image-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 2rem 0;
    align-items: center;
}

.content-image-pair figure {
    margin: 0;
}

.content-image-pair img {
    width: 100%;
    height: auto;
    display: block;
}

/* Gallery & Project listing grids (fallback pages) */
.gallery-grid,
.project-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap);
}

.gallery-card,
.project-card {
    display: block;
}

.gallery-card img,
.project-card img {
    width: 100%;
}

.gallery-card-info,
.project-card-info {
    padding: 10px 0;
}

.gallery-card-info h2,
.project-card-info h2 {
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.gallery-card-info p,
.project-card-info p {
    font-size: 0.7rem;
    color: var(--color-muted);
    margin-top: 2px;
}

.gallery-card-placeholder,
.project-card-placeholder {
    width: 100%;
    min-height: 200px;
    background: #f5f5f5;
}

/* Contact */
.contact-page {
    padding-top: 15vh;
}

.contact-email {
    display: block;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    color: var(--color-text);
    margin-bottom: 1.2rem;
    transition: opacity 0.2s;
}

.contact-email:hover {
    opacity: 0.5;
}

.contact-icons {
    display: flex;
    gap: 16px;
}

.contact-icons a {
    color: var(--color-text);
    transition: opacity 0.2s;
}

.contact-icons a:hover {
    opacity: 0.5;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.97);
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    font-size: 1.5rem;
    padding: 1rem;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    opacity: 1;
}

.lightbox-close {
    top: 1rem;
    right: 1rem;
}

.lightbox-prev {
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
}

.lightbox-next {
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
}

/* Empty states */
.empty-state {
    color: var(--color-muted);
    font-size: 0.8rem;
    padding: 3rem 0;
    text-align: center;
    letter-spacing: 0.05em;
}

/* 404 */
.container h1:only-child {
    text-align: center;
    padding: 4rem 0;
    font-weight: 300;
    font-size: 1rem;
    letter-spacing: 0.1em;
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --frame: 16px;
        --gap: 16px;
    }

    .site-name {
        font-size: 1.2rem;
    }

    .card-grid {
        columns: 2;
        column-gap: 8px;
    }

    .gallery-grid,
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .masonry {
        gap: 4px;
    }

    .masonry-col {
        gap: 4px;
    }

    .image-grid {
        column-count: 2;
        column-gap: 4px;
    }

    .container {
        padding: 44px 0 30px;
    }

    .page-title {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .card-grid {
        columns: 1;
    }

    .gallery-grid,
    .project-grid {
        grid-template-columns: 1fr;
    }
}
