/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #1a1a1a;
    background: #f7f6f3;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

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

button {
    cursor: pointer;
    border: none;
    background: none;
    font: inherit;
    color: inherit;
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 3rem;
    background: rgba(247, 246, 243, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.logo {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #999;
    transition: color 0.3s;
    position: relative;
}

.nav-links a::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: #1a1a1a;
    transition: width 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #1a1a1a;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

/* Burger */
.burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 4px;
    z-index: 101;
}

.burger span {
    display: block;
    width: 24px;
    height: 1.5px;
    background: #1a1a1a;
    transition: transform 0.3s, opacity 0.3s;
}

.burger.open span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}

.burger.open span:nth-child(2) {
    opacity: 0;
}

.burger.open span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99;
    background: rgba(247, 246, 243, 0.98);
    justify-content: center;
    align-items: center;
}

.mobile-menu.open {
    display: flex;
}

.mobile-menu ul {
    text-align: center;
}

.mobile-menu a {
    display: block;
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 1rem;
    color: #999;
    transition: color 0.3s;
}

.mobile-menu a:hover,
.mobile-menu a.active {
    color: #1a1a1a;
}

/* ===== Works Grid (Masonry-inspired) ===== */
.works-grid {
    padding: 7rem 3rem 4rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 280px;
    grid-auto-flow: dense;
    gap: 0.75rem;
    max-width: 1400px;
    margin: 0 auto;
}

.work-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: #e8e6e1;
}

.work-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.work-item:hover img {
    transform: scale(1.05);
}

/* Featured items span 2 rows for visual rhythm */
.work-item.featured {
    grid-row: span 2;
}

.work-item.wide {
    grid-column: span 2;
}

.work-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: flex-end;
    padding: 1.5rem;
    transition: background 0.4s;
}

.work-item:hover .work-item-overlay {
    background: rgba(0, 0, 0, 0.3);
}

.work-item-overlay span {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s, transform 0.4s;
}

.work-item:hover .work-item-overlay span {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Work Detail Modal ===== */
.work-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #f7f6f3;
    overflow-y: auto;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0s 0.35s;
}

.work-modal.open {
    visibility: visible;
    pointer-events: auto;
    transition: visibility 0s 0s;
}

.work-modal .modal-close {
    opacity: 0;
    transition: opacity 0.3s ease, background 0.2s;
}

.work-modal.open .modal-close {
    opacity: 1;
}

.work-modal .modal-content {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.work-modal.open .modal-content {
    opacity: 1;
    transform: translateY(0);
}

.modal-close {
    position: fixed;
    top: 1.5rem;
    right: 3rem;
    z-index: 210;
    font-size: 1.5rem;
    line-height: 1;
    color: #1a1a1a;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.06);
}

.modal-content {
    display: flex;
    min-height: 100vh;
}

.modal-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 3rem 3rem;
    background: #eeedea;
}

.modal-image img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}

.modal-info {
    width: 400px;
    flex-shrink: 0;
    padding: 8rem 3rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal-info h2 {
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.modal-date {
    font-size: 0.85rem;
    color: #999;
    letter-spacing: 0.04em;
    margin-bottom: 2rem;
}

.modal-desc {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #555;
}

/* ===== Projects Page ===== */
.projects-page {
    padding: 7rem 3rem 4rem;
    max-width: 1100px;
    margin: 0 auto;
}

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: #e0dfdc;
    border-top: 1px solid #e0dfdc;
    border-bottom: 1px solid #e0dfdc;
}

.project-card {
    display: flex;
    gap: 2.5rem;
    cursor: pointer;
    padding: 2rem 1.5rem;
    background: #f7f6f3;
    transition: background 0.3s;
}

.project-card:hover {
    background: #eeedea;
}

.project-card-img {
    width: 300px;
    flex-shrink: 0;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #e8e6e1;
}

.project-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:hover .project-card-img img {
    transform: scale(1.04);
}

.project-card-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.4rem;
}

.project-card-info h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.project-card-date {
    font-size: 0.85rem;
    color: #999;
    letter-spacing: 0.03em;
}

.project-card-desc {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
    margin-top: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Project Detail Modal */
.project-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #f7f6f3;
    overflow-y: auto;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0s 0.35s;
}

.project-modal.open {
    visibility: visible;
    pointer-events: auto;
    transition: visibility 0s 0s;
}

.project-modal .modal-close {
    opacity: 0;
    transition: opacity 0.3s ease, background 0.2s;
}

.project-modal.open .modal-close {
    opacity: 1;
}

.project-modal .project-modal-content {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.project-modal.open .project-modal-content {
    opacity: 1;
    transform: translateY(0);
}

.project-modal-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 7rem 3rem 4rem;
}

.project-modal-content h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.project-date {
    font-size: 0.85rem;
    color: #999;
    letter-spacing: 0.04em;
    margin-bottom: 2rem;
}

.project-desc {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #555;
    margin-bottom: 3rem;
}

.project-gallery {
    columns: 2;
    column-gap: 0.75rem;
}

.project-gallery img {
    width: 100%;
    margin-bottom: 0.75rem;
    break-inside: avoid;
    background: #e8e6e1;
}

/* ===== About Page ===== */
.about-page {
    padding: 7rem 3rem 4rem;
    max-width: 720px;
    margin: 0 auto;
}

.about-content h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.about-subtitle {
    font-size: 0.95rem;
    color: #999;
    margin-bottom: 3rem;
}

.about-section {
    margin-bottom: 3rem;
}

.about-section h2 {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 1.25rem;
}

.about-section > p {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #444;
}

.about-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.about-timeline li {
    display: flex;
    gap: 2rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.timeline-year {
    flex-shrink: 0;
    width: 48px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #1a1a1a;
}

.about-timeline li span:last-child {
    color: #555;
}

.about-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.about-list li {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #555;
}

/* ===== Contact Page ===== */
.contact-page {
    padding: 7rem 3rem 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.contact-form-wrapper {
    width: 100%;
    max-width: 480px;
}

.form-group {
    margin-bottom: 2rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 0;
    font-size: 0.95rem;
    border: none;
    border-bottom: 1px solid #d0cfcc;
    outline: none;
    background: transparent;
    font-family: inherit;
    color: #1a1a1a;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-bottom-color: #1a1a1a;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #bbb;
    font-weight: 400;
}

.form-group textarea {
    resize: vertical;
    min-height: 140px;
    line-height: 1.7;
}

.form-submit {
    display: flex;
    justify-content: flex-end;
}

.form-submit button {
    padding: 0.65rem 2.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1.5px solid #1a1a1a;
    background: #1a1a1a;
    color: #fff;
    transition: background 0.3s, color 0.3s;
}

.form-submit button:hover {
    background: transparent;
    color: #1a1a1a;
}

.form-submit button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.form-status {
    margin-top: 1rem;
    font-size: 0.85rem;
    text-align: right;
    min-height: 1.2em;
}

.form-status.success {
    color: #3a8a3a;
}

.form-status.error {
    color: #c44;
}

/* ===== Fade-in animation for page elements ===== */
/* Fade-in: JS adds .fade-ready first, then .visible on scroll */
.fade-in.fade-ready {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
    .nav {
        display: none;
    }

    .burger {
        display: flex;
    }

    .header {
        padding: 1.25rem 1.5rem;
    }

    /* Works: 1 column, no featured sizing */
    .works-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        padding: 5.5rem 1rem 2rem;
        gap: 0.5rem;
    }

    .work-item {
        aspect-ratio: 4 / 3;
    }

    .work-item.featured,
    .work-item.wide {
        grid-row: auto;
        grid-column: auto;
    }

    .work-item-overlay {
        background: linear-gradient(transparent 50%, rgba(0, 0, 0, 0.4));
    }

    .work-item-overlay span {
        opacity: 1;
        transform: none;
    }

    /* Work modal stacked */
    .modal-content {
        flex-direction: column;
    }

    .modal-image {
        padding: 5rem 1rem 1rem;
        min-height: 45vh;
    }

    .modal-info {
        width: 100%;
        padding: 2rem 1.5rem 3rem;
    }

    .modal-close {
        right: 1.5rem;
        top: 1.25rem;
    }

    /* Projects stacked */
    .projects-page {
        padding: 5.5rem 1rem 2rem;
    }

    .project-card {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem 1rem;
    }

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

    .project-gallery {
        columns: 1;
    }

    .project-modal-content {
        padding: 5.5rem 1.5rem 3rem;
    }

    /* About */
    .about-page {
        padding: 5.5rem 1.5rem 3rem;
    }

    /* Contact */
    .contact-page {
        padding: 5.5rem 1.5rem 2rem;
        align-items: flex-start;
        padding-top: 8rem;
    }
}

@media (min-width: 769px) and (max-width: 1023px) {
    .works-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 240px;
        padding: 7rem 2rem 3rem;
    }

    .work-item.wide {
        grid-column: auto;
    }
}

@media (min-width: 1024px) {
    .works-grid {
        grid-auto-rows: 300px;
    }
}
