/* ============================================
   COMPONENTS - Cards, Grids, Lightbox, Filters
   Depends on: variables.css, animations.css
   ============================================ */

/* ========== PAGE LAYOUT ========== */
.page-content {
    padding-top: var(--spacing-lg);
    padding-bottom: var(--spacing-section);
    min-height: calc(100vh - 100px);
}

.page-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-content-x);
}

.page-title {
    text-align: center;
    font-size: var(--font-size-h1);
    font-weight: var(--font-weight-light);
    letter-spacing: var(--letter-spacing-title);
    margin-bottom: var(--spacing-sm, 10px);
}

.page-title h1 {
    font-size: var(--font-size-h1);
    font-weight: var(--font-weight-light);
    letter-spacing: var(--letter-spacing-title);
}

.page-subtitle {
    text-align: center;
    font-size: var(--font-size-large);
    margin-bottom: var(--spacing-section);
}

:is(.theme-light, .theme-beige, .theme-ivory) .page-subtitle {
    color: var(--current-text-muted);
}

.theme-dark .page-subtitle {
    color: var(--color-text-muted);
}

/* Project page container - narrower for readability */
.page-container--project {
    max-width: 900px;
}

/* ========== CARD GRID ========== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: var(--spacing-grid-gap);
}

/* Photo grid - refined gap for gallery feel */
.card-grid--photos {
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 4px;
}

/* ========== CARD COMPONENT ========== */
.card {
    display: block;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
}

/* Light theme cards - with background, shadow, and lift */
:is(.theme-light, .theme-beige, .theme-ivory) .card {
    background: var(--color-bg-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    transition: transform 0.4s var(--ease-out-expo),
                box-shadow 0.4s var(--ease-out-expo);
}

:is(.theme-light, .theme-beige, .theme-ivory) .card:hover {
    transform: translateY(var(--elevation-lift));
    box-shadow: var(--shadow-card-hover);
}

/* Dark theme cards - minimal styling */
.theme-dark .card {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

/* ========== CARD IMAGE ========== */
.card__image {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #e5e5e5 0%, #efefef 100%);
}

.theme-dark .card__image {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

/* Default aspect ratio 4:3 */
.card__image {
    aspect-ratio: 4/3;
}

/* Wide aspect ratio 16:9 (film, work) */
.card__image--wide {
    aspect-ratio: 16/9;
}

/* Photo aspect ratio 3:2 */
.card__image--photo {
    aspect-ratio: 3/2;
}

.card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========== CARD CONTENT ========== */
.card__content {
    padding: var(--spacing-card-padding);
}

.theme-dark .card__content {
    padding: 20px 0;
}

.card__title {
    font-size: var(--font-size-large);
    font-weight: var(--font-weight-regular);
    margin-bottom: 8px;
    letter-spacing: 0;
}

.theme-dark .card__title {
    color: var(--color-text-primary);
}

:is(.theme-light, .theme-beige, .theme-ivory) .card__title {
    color: var(--current-text);
}

.card__subtitle {
    font-size: var(--font-size-small);
    line-height: 1.5;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.card:hover .card__subtitle {
    opacity: 1;
}

.theme-dark .card__subtitle {
    color: var(--color-text-muted);
}

:is(.theme-light, .theme-beige, .theme-ivory) .card__subtitle {
    color: var(--color-text-dim);
}

/* ========== PLACEHOLDER (no image) ========== */
.placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-small);
}

.theme-dark .placeholder {
    color: var(--color-text-dim);
}

:is(.theme-light, .theme-beige, .theme-ivory) .placeholder {
    color: var(--current-text-muted);
}

/* ========== PLAY BUTTON (Film cards) ========== */
.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border: 2px solid var(--color-text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    pointer-events: none;
    backdrop-filter: blur(4px);
    background: rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease,
                transform 0.4s var(--ease-spring),
                background 0.3s ease;
}

.play-button::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 18px solid var(--color-text-primary);
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
    margin-left: 5px;
}

.card:hover .play-button {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
    background: rgba(0, 0, 0, 0.35);
}

/* ========== CATEGORY FILTERS ========== */
.filters {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 30px 0;
    margin-bottom: 30px;
    font-size: var(--font-size-small);
}

.filters__link {
    color: var(--color-text-muted);
    cursor: pointer;
    padding-bottom: 4px;
    position: relative;
    transition: color var(--transition-fast);
}

/* Animated underline for filters */
.filters__link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.35s var(--ease-out-expo);
}

.filters__link:hover::after,
.filters__link.active::after {
    transform: scaleX(1);
}

.filters__link:hover,
.filters__link.active {
    opacity: 1;
}

.theme-dark .filters__link:hover,
.theme-dark .filters__link.active {
    color: var(--color-text-primary);
}

.theme-light .filters__link:hover,
.theme-light .filters__link.active {
    color: var(--color-text-dark);
}

.filters__separator {
    color: var(--color-text-muted);
    margin: 0 8px;
    font-weight: 600;
}

/* ========== LIGHTBOX ========== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: var(--z-lightbox);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.97);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s var(--ease-out-expo),
                visibility 0.4s;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox__image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    box-shadow: var(--shadow-lightbox);
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.5s var(--ease-out-expo),
                opacity 0.4s ease;
}

.lightbox.active .lightbox__image {
    transform: scale(1);
    opacity: 1;
}

.lightbox__close,
.lightbox__nav {
    position: absolute;
    background: none;
    border: none;
    color: var(--color-text-primary);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
    font-weight: 300;
    line-height: 1;
}

.lightbox__close:hover,
.lightbox__nav:hover {
    opacity: 1;
}

.lightbox__close {
    top: 30px;
    right: 30px;
    font-size: 45px;
}

.lightbox__nav {
    top: 50%;
    transform: translateY(-50%);
    font-size: 50px;
    padding: 20px;
}

.lightbox__nav--prev {
    left: 20px;
}

.lightbox__nav--next {
    right: 20px;
}

/* ========== SLIDESHOW (Homepage) ========== */
.slideshow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.slideshow::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

/* ========== HOMEPAGE MAIN CONTENT ========== */
.home-content {
    position: relative;
    z-index: 2;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px;
}

.home-nav {
    font-size: var(--font-size-large);
    line-height: 1.5;
}

.home-nav a {
    color: var(--color-text-muted);
    transition: color var(--transition-fast),
                border-color var(--transition-fast);
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
}

.home-nav a:hover {
    color: var(--color-text-primary);
    border-bottom-color: var(--color-text-primary);
}

.home-nav .separator {
    color: var(--color-text-muted);
    margin: 0 0.5em;
    font-weight: 600;
    font-size: 1.15em;
}

/* Home social links */
.home-social {
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    z-index: 3;
}

.home-social a {
    color: var(--color-text-primary);
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--transition-fast);
}

.home-social a:hover {
    opacity: 1;
}

.home-social a svg {
    width: 20px;
    height: 20px;
}

/* ========== SECTION LINK ========== */
.section-link {
    text-align: center;
    margin-top: var(--spacing-section);
    font-size: var(--font-size-body);
}

.section-link a {
    display: inline-block;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

:is(.theme-light, .theme-beige, .theme-ivory) .section-link a {
    color: var(--current-text-muted);
}

:is(.theme-light, .theme-beige, .theme-ivory) .section-link a:hover {
    color: var(--current-text);
    border-bottom-color: var(--current-text);
}

.theme-dark .section-link a {
    color: var(--color-text-muted);
}

.theme-dark .section-link a:hover {
    color: var(--color-text-primary);
    border-bottom-color: var(--color-text-primary);
}

/* ========== BACK LINK ========== */
.back-link {
    display: inline-block;
    margin-top: var(--spacing-section);
    font-size: var(--font-size-small);
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.theme-dark .back-link {
    color: var(--color-text-muted);
}

.theme-dark .back-link:hover {
    color: var(--color-text-primary);
    border-bottom-color: var(--color-text-primary);
}

:is(.theme-light, .theme-beige, .theme-ivory) .back-link {
    color: var(--current-text-muted);
}

:is(.theme-light, .theme-beige, .theme-ivory) .back-link:hover {
    color: var(--current-text);
    border-bottom-color: var(--current-text);
}

/* ========== VIDEO CONTAINER ========== */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-card);
    margin-bottom: var(--spacing-lg);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ========== PROJECT GALLERY ========== */
.project-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 48px;
    margin-top: var(--spacing-lg);
}

.project-gallery img {
    width: 100%;
    border-radius: var(--radius-card);
}

/* ========== CATEGORY GALLERY GRID ========== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-sm);
}

.gallery-item {
    width: 100%;
    object-fit: cover;
    cursor: pointer;
}

/* Section headings within project pages */
.page-container--project h3 {
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

/* ========== PROJECT HERO ========== */
.project-hero img {
    width: 100%;
    border-radius: var(--radius-card);
}

/* ========== 404 PAGE ========== */
.error-page {
    text-align: center;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.error-page .page-title {
    font-size: clamp(4rem, 15vw, 8rem);
    margin-bottom: var(--spacing-sm);
}

.error-page__message {
    font-size: var(--font-size-large);
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-sm);
}

.error-page__detail {
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-lg);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .page-content {
        padding-top: var(--spacing-md);
    }

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

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

    .filters__separator {
        display: none;
    }

    .filters__link {
        margin: 5px 10px;
    }

    .lightbox__close {
        top: 20px;
        right: 20px;
        font-size: 35px;
    }

    .lightbox__nav {
        font-size: 35px;
        padding: 10px;
    }

    .lightbox__nav--prev {
        left: 10px;
    }

    .lightbox__nav--next {
        right: 10px;
    }

    .home-content {
        padding: 40px 20px;
    }

    .home-nav .separator {
        display: block;
        margin: 10px 0;
    }

    .home-social {
        bottom: 40px;
    }
}
