/*
 * Portfolio v4 - Andrea Chang inspired design
 * Column-based grid with vmin typography
 */

/* ===== CSS Variables ===== */
:root {
    /* Colors - minimal black/white palette */
    --color-text: #1a1a1a;
    --color-text-secondary: #4a4a4a;
    --color-text-muted: #888;
    --color-background: #fff;
    --color-surface: #f8f8f8;
    --color-border: #e5e5e5;
    --color-accent: #000;

    /* Typography - vmin scaled for impact */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Hero/display typography */
    --text-hero: clamp(2.5rem, 10vmin, 8rem);
    --text-section: clamp(1.5rem, 4vmin, 3rem);

    /* Body typography */
    --text-xlg: clamp(2rem, 2vmin, 1.5rem);
    --text-lg: clamp(1.1rem, 1.5vmin, 1.25rem);
    --text-base: clamp(0.95rem, 1.2vmin, 1.1rem);
    --text-sm: clamp(0.8rem, 1vmin, 0.9rem);
    --text-xs: clamp(0.7rem, 0.9vmin, 0.8rem);

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;
    --space-3xl: 6rem;
    --space-4xl: 8rem;

    /* Layout */
    --page-padding: clamp(1.5rem, 5vw, 4rem);
    --max-width: 1600px;
    --header-height: 60px;
    --grid-gap: clamp(1rem, 2vmin, 2rem);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 0.2s;
    --duration-medium: 0.4s;
    --duration-slow: 0.6s;
    --duration-reveal: 0.9s;
}

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

/* ===== Base ===== */
html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

p {
    line-height: 1.6;
    color: var(--color-text-secondary);
}

a {
    color: inherit;
    text-decoration: none;
    transition: opacity var(--duration-fast) ease;
}

a:hover {
    opacity: 0.6;
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    padding: var(--space-lg) max(var(--page-padding), calc((100vw - var(--max-width)) / 2 - 40px));
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: auto;
}

.header__name {
    font-size: var(--text-lg);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text);
}

.header__nav {
    display: flex;
    gap: var(--space-md);
}

.header__nav-link {
    font-size: var(--text-sm);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text);
    transition: opacity var(--duration-fast);
}

.header__nav-link:hover {
    opacity: 0.5;
}

.header__nav-link--active {
    opacity: 0.5;
}

/* ===== Main Content ===== */
.main {
    padding-top: var(--header-height);
    min-height: 100vh;
}

/* ===== Hero Section ===== */
.hero {
    padding: var(--space-3xl) var(--page-padding) var(--space-xl);
    max-width: var(--max-width);
    margin: 0 auto;
}

.hero__title {
    font-size: var(--text-hero);
    font-weight: 400;
    line-height: 0.95;
    letter-spacing: -0.04em;
    margin-bottom: var(--space-md);
}

.hero__subtitle {
    font-size: var(--text-lg);
    color: var(--color-text-muted);
    font-weight: 400;
}

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-xs);
    padding: var(--space-lg) var(--page-padding) var(--space-xl);
    flex-wrap: wrap;
    max-width: var(--max-width);
    margin: 0 auto;
}

.filter-btn {
    background: none;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    padding: 0.6em 1.2em;
    border-radius: 100px;
    transition: all var(--duration-fast) ease;
    color: var(--color-text-muted);
}

.filter-btn:hover {
    color: var(--color-text);
    border-color: var(--color-border);
}

.filter-btn.active {
    background: var(--color-text);
    color: var(--color-background);
    border-color: var(--color-text);
}

/* ===== Projects Grid ===== */
.projects-section {
    padding: 0 var(--page-padding) var(--space-4xl);
    max-width: var(--max-width);
    margin: 0 auto;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    max-width: var(--max-width);
    margin: 0 auto;
}

/* ===== Project Card ===== */
.project-card {
    display: block;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity var(--duration-slow) var(--ease-out),
                transform var(--duration-slow) var(--ease-out);
}

.project-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger effect */
.project-card:nth-child(2n+1).visible { transition-delay: 0s; }
.project-card:nth-child(2n).visible { transition-delay: 0.08s; }

.project-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.project-card__thumbnail {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #000;
}

.project-card__thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--duration-slow) var(--ease-out);
}

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

.project-card__info {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
    padding: var(--space-md);
    background: #000;
    opacity: 0;
    transition: opacity var(--duration-medium) var(--ease-out);
}

.project-card:hover .project-card__info {
    opacity: 1;
}

.project-card__title {
    font-size: var(--text-xlg);
    font-weight: 500;
    margin-bottom: 0.25em;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: #fff;
}

.project-card__meta {
    font-size: var(--text-sm);
    color: rgba(255,255,255,0.7);
}

/* Hidden state for filtering */
.project-card.hidden {
    display: none;
}

/* ===== Footer ===== */
.footer {
    padding: var(--space-2xl) var(--page-padding);
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-2xl);
}

.footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--max-width);
    margin: 0 auto;
}

.footer__copyright {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.footer__link {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

/* ===== Info Page ===== */
.info-content {
    padding: 12rem var(--page-padding) var(--space-3xl);
    max-width: 1200px;
    margin: 0 auto;
}

.info-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: var(--space-3xl);
    align-items: start;
}

.info-portrait {
    position: sticky;
    top: calc(var(--header-height) + var(--space-xl));
}

.info-portrait img {
    width: 100%;
    max-width: 400px;
    border-radius: 12px;  /* adjust value as needed */
}

.info-bio {
    padding-top: var(--space-xs);
}

.info-title {
    font-size: var(--text-section);
    margin-bottom: var(--space-xl);
    font-weight: 400;
}

.info-text {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-2xl);
}

.info-text p {
    margin-bottom: var(--space-md);
    font-size: inherit;
}

.info-text p:last-child {
    margin-bottom: 0;
}

.info-contact {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.info-contact a {
    font-size: var(--text-base);
    color: var(--color-text);
    border-bottom: 1px solid var(--color-text);
    padding-bottom: 2px;
    transition: opacity var(--duration-fast);
}

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

/* ===== Project Detail Page ===== */
.project-page .main {
    padding-top: var(--header-height);
}

.project-detail {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-xl) var(--page-padding) var(--space-4xl);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-xl);
    transition: color var(--duration-fast);
}

.back-link:hover {
    color: var(--color-text);
    opacity: 1;
}

.project-header {
    margin-bottom: var(--space-xl);
}

.project-header__title {
    font-size: var(--text-section);
    margin-bottom: var(--space-xs);
}

.project-header__client {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
}

.project-header__meta {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    display: flex;
    gap: var(--space-md);
}

/* Project Video */
.project-video {
    margin-bottom: var(--space-2xl);
    background: #000;
    aspect-ratio: 16 / 9;
}

.project-video video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Project Content */
.project-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-3xl);
    margin-bottom: var(--space-3xl);
}

.project-description {
    font-size: var(--text-lg);
    line-height: 1.7;
    color: var(--color-text-secondary);
}

/* Credits */
.project-credits {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.credit {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
}

.credit dt {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

.credit dd {
    font-size: var(--text-base);
    color: var(--color-text);
}

/* Project Role */
.project-role {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
}

.role-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

.role-value {
    font-size: var(--text-base);
    color: var(--color-text);
}

/* Project Navigation */
.project-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    padding-top: var(--space-2xl);
    border-top: 1px solid var(--color-border);
}

.project-nav__prev,
.project-nav__next {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
    padding: var(--space-md) 0;
    transition: opacity var(--duration-fast);
}

.project-nav__prev:hover,
.project-nav__next:hover {
    opacity: 0.6;
}

.project-nav__next {
    text-align: right;
}

.project-nav__prev span,
.project-nav__next span {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

.project-nav__prev strong,
.project-nav__next strong {
    font-size: var(--text-lg);
    font-weight: 500;
}

/* Project Snippets */
.project-snippets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--grid-gap);
    margin-bottom: var(--space-xl);
}

.project-snippets video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    aspect-ratio: 16 / 9;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity var(--duration-reveal) var(--ease-out),
                transform var(--duration-reveal) var(--ease-out);
}

.project-snippets video.visible {
    opacity: 1;
    transform: translateY(0);
}

.project-snippets video:hover {
    opacity: 0.9 !important;
}

.project-snippets .snippet-wide {
    grid-column: span 2;
}

.project-snippets .snippet-vertical {
    aspect-ratio: 9 / 16;
}

.project-snippets .snippet-4x5 {
    aspect-ratio: 4 / 5;
}

.project-snippets .snippet-square {
    aspect-ratio: 1 / 1;
}

/* 3-column grid for vertical videos */
.project-snippets.snippets-3col {
    grid-template-columns: repeat(3, 1fr);
}

/* Project Photos */
.project-photos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--grid-gap);
    margin-bottom: var(--space-3xl);
}

.project-photos img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 3 / 2;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity var(--duration-reveal) var(--ease-out),
                transform var(--duration-reveal) var(--ease-out);
}

.project-photos img.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Animations ===== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity var(--duration-reveal) var(--ease-out),
                transform var(--duration-reveal) var(--ease-out);
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }

    .hero {
        padding: var(--space-2xl) var(--page-padding) var(--space-lg);
    }

    .hero__title {
        font-size: clamp(2rem, 12vw, 4rem);
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    /* Single column - no stagger */
    .project-card.visible {
        transition-delay: 0s !important;
    }

    .info-layout {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .info-portrait {
        position: relative;
        top: 0;
    }

    .info-portrait img {
        max-width: 280px;
    }

    .project-content {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

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

    .project-nav__next {
        text-align: left;
    }

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

    .project-snippets.snippets-3col {
        grid-template-columns: 1fr;
    }

    .project-snippets .snippet-wide {
        grid-column: span 1;
    }

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

    .footer__inner {
        flex-direction: column;
        gap: var(--space-sm);
        text-align: center;
    }
}

@media (max-width: 480px) {
    .filter-bar {
        gap: 0.4rem;
        padding-bottom: var(--space-lg);
    }

    .filter-btn {
        padding: 0.5em 1em;
        font-size: 0.7rem;
    }

    .hero__title {
        font-size: clamp(1.8rem, 14vw, 3rem);
    }

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