/* ==========================================================================
   BLOSSOM - Gallery
   Photos, videos, and media grid
   ========================================================================== */

/* Audio, Photos, Videos Sections */
.photos,
.videos {
    background: var(--color-bg-dark);
}

/* Audio sits between the concerts gradient (which ends on bg-darker) and the
   videos section, so the darker tone both continues that gradient seamlessly
   and puts a visible step between Audio and Videos. */
.audio {
    background: var(--color-bg-darker);
}

/* ==========================================================================
   Photo Gallery Grid - Google Photos Style (Justified Layout)
   ========================================================================== */

.gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    /* Target row height - images will scale to fit */
    --row-height: 200px;
}

@media (min-width: 640px) {
    .gallery-grid {
        --row-height: 220px;
        gap: var(--space-3);
    }
}

@media (min-width: 1024px) {
    .gallery-grid {
        --row-height: 250px;
    }
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-slow);
}

.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(26, 20, 16, 0.8) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.gallery-item:hover {
    z-index: var(--z-above);
    transform: scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

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

.gallery-item:hover::after {
    opacity: 1;
}

.gallery-icon {
    position: absolute;
    bottom: var(--space-4);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    transition: all var(--transition-normal);
    z-index: var(--z-above);
}

.gallery-icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-gold);
}

.gallery-item:hover .gallery-icon {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-6) var(--space-4) var(--space-4);
    font-family: var(--font-accent);
    font-style: italic;
    font-size: var(--text-sm);
    color: var(--color-cream);
    text-align: center;
    z-index: var(--z-above);
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-normal);
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.gallery-item:hover .gallery-caption {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Video Grid
   ========================================================================== */

/* The container stacks: featured card, then the grid of the rest, then the
   channel link. The grid itself is .video-grid-rest. */
.video-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.video-grid-rest {
    display: grid;
    gap: var(--space-6);
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 640px) {
    .video-grid-rest {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .video-grid-rest {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.video-channel-cta {
    display: flex;
    justify-content: center;
}

/* Video Cards (YouTube API) */
.video-card {
    background: var(--color-brown);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--color-rust);
    transition: all var(--transition-normal);
}

/* Featured: a wide cinematic frame with the title laid over the image,
   so the newest video reads as the section's focal point. */
.video-card--featured {
    position: relative;
}

.video-card--featured .video-thumbnail {
    aspect-ratio: 16 / 9;
}

@media (min-width: 768px) {
    .video-card--featured .video-thumbnail {
        aspect-ratio: 288 / 100;
    }
}

.video-card--featured .video-thumbnail::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 12, 9, 0.15) 0%, rgba(15, 12, 9, 0.55) 55%, rgba(15, 12, 9, 0.92) 100%);
    pointer-events: none;
}

@media (min-width: 768px) {
    .video-card--featured .video-info {
        position: absolute;
        left: var(--space-8);
        right: var(--space-8);
        bottom: var(--space-6);
        padding: 0;
        pointer-events: none;
    }

    .video-card--featured .video-title {
        font-size: var(--text-3xl);
        -webkit-line-clamp: 2;
    }
}

/* Once the iframe takes over, the scrim and the overlaid title must get out
   of the way or they sit on top of the playing video. */
.video-card--featured .video-thumbnail.video-playing::after {
    display: none;
}

.video-card--featured:has(.video-playing) .video-info {
    display: none;
}

.video-eyebrow {
    display: block;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    letter-spacing: var(--tracking-widest);
    text-transform: uppercase;
    color: var(--color-gold);
    margin-bottom: var(--space-2);
}

.video-card:hover {
    border-color: var(--color-gold);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.video-thumbnail {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    cursor: pointer;
    /* Rendered as a <button> so it is keyboard-operable and needs no inline
       onclick handler; reset the UA button box back to a plain block. */
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    text-align: inherit;
}

.video-thumbnail:focus-visible {
    outline: 3px solid var(--color-gold);
    outline-offset: 2px;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.05);
}

.video-thumbnail iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.video-thumbnail.video-playing {
    cursor: default;
}

.video-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    transition: all var(--transition-normal);
}

.video-play-overlay svg {
    width: 60px;
    height: 60px;
    fill: var(--color-gold);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
    transition: transform var(--transition-normal);
}

.video-card:hover .video-play-overlay {
    background: transparent;
}

.video-card:hover .video-play-overlay svg {
    transform: scale(1.1);
}

.video-info {
    padding: var(--space-4);
}

/* ==========================================================================
   Videos - Empty State
   Shown when the channel has no videos yet, or the feed cannot be reached.
   ========================================================================== */

.video-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    text-align: center;
    padding: var(--space-12) var(--space-6);
    border: 1px dashed var(--color-brown);
    border-radius: var(--radius-lg);
    background: var(--color-bg-darker);
}

.video-empty-mark {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    border: 2px solid var(--color-brown);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-rust);
}

.video-empty-mark svg {
    width: 34px;
    height: 34px;
}

.video-empty-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-width: 460px;
}

.video-empty-text h3 {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    font-weight: var(--font-semibold);
    color: var(--color-cream-dark);
    margin: 0;
}

.video-empty-text p {
    font-size: var(--text-base);
    color: var(--color-text-muted);
    margin: 0;
}

.video-title {
    font-family: var(--font-heading);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-cream);
    margin-bottom: var(--space-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-date {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

/* Video Loading State */
.video-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
    color: var(--color-text-muted);
}
