/* Shader & VFX section — compact grid in the same glass style as .project-card.
   Relies on css/projects.css for .projects-header, .category-tag,
   .project-modal, .modal-close, .modal-tags, .tag, .modal-title/subtitle/desc. */

#vfx {
    position: relative;
    width: 100%;
    padding: 40px 0 120px;
    font-family: 'Google Sans', sans-serif;
    color: #fff;
}

#vfx .projects-header {
    margin-bottom: 48px;
}

.vfx-grid {
    width: min(1200px, calc(100% - 80px));
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 270px));
    justify-content: center;
    gap: 20px;
}

/* Tile — portrait */
.vfx-tile {
    position: relative;
    aspect-ratio: 3 / 4;
    padding: 0;
    border-radius: 16px;
    border: 0;
    background: #0b0b0b;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    cursor: pointer;
    color: inherit;
    font: inherit;
    text-align: left;
    -webkit-mask-image: -webkit-radial-gradient(white, black); /* clip video to radius in Safari */
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.35s;
}

.vfx-tile:hover,
.vfx-tile:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.6);
    outline: none;
}

/* Keyboard focus only — mouse users never see this ring */
.vfx-tile:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 3px;
}

/* Reveal: staggered fade-up once the grid enters the viewport.
   fill-mode "backwards" so the hover transform still works after it ends. */
.vfx-grid.will-reveal .vfx-tile {
    opacity: 0;
}

.vfx-grid.is-revealed .vfx-tile {
    opacity: 1;
    animation: vfxTileIn 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
    animation-delay: calc(var(--i, 0) * 90ms);
}

@keyframes vfxTileIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
}

.vfx-cover,
.vfx-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vfx-cover,
.vfx-preview {
    transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.4s ease;
}

.vfx-tile:hover .vfx-cover,
.vfx-tile:hover .vfx-preview {
    transform: scale(1.03);
}

.vfx-preview {
    opacity: 0;
    pointer-events: none;
}

.vfx-tile.is-playing .vfx-preview {
    opacity: 1;
}

/* Short, light gradient — only enough to keep the title legible */
.vfx-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.2) 16%, transparent 28%);
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.vfx-tile:hover .vfx-shade {
    opacity: 0.7;
}

/* Soft spotlight that follows the cursor (position set in vfx.js) */
.vfx-tile::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%),
                rgba(255, 255, 255, 0.10), transparent 65%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.vfx-tile:hover::after {
    opacity: 1;
}

.vfx-meta {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 18px;
    z-index: 2;
    text-align: center;
}

.vfx-title {
    position: relative;
    display: inline-block;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.2;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

/* Absolutely placed so the title stays truly centred */
.vfx-arrow {
    position: absolute;
    left: 100%;
    top: 50%;
    margin-left: 8px;
    font-size: 0.9rem;
    opacity: 0;
    transform: translate(-6px, -50%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.vfx-tile:hover .vfx-arrow,
.vfx-tile:focus-visible .vfx-arrow {
    opacity: 0.85;
    transform: translate(0, -50%);
}

/* Modal — single column: video, info, breakdown */
.vfx-modal-content {
    display: block;
    max-width: 960px;
    height: auto;
    max-height: 88vh;
    padding: 32px;
}

.vfx-modal-video {
    display: block;
    width: 100%;
    max-height: 60vh;
    border-radius: 12px;
    background: #000;
}

.vfx-modal-info {
    margin-top: 28px;
}

.vfx-modal-info .modal-tags {
    margin-bottom: 1.2rem;
}

.vfx-modal-info .modal-title {
    font-size: 2.2rem;
}

.vfx-modal-info .modal-subtitle {
    margin-bottom: 1.2rem;
}

.vfx-breakdown {
    margin-top: 12px;
    display: grid;
    gap: 20px;
}

.vfx-breakdown-label {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.5);
}

.vfx-breakdown figure {
    margin: 0;
}

.vfx-breakdown img {
    display: block;
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.vfx-breakdown figcaption {
    margin-top: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.55);
}

@media (max-width: 768px) {
    .vfx-grid {
        width: calc(100% - 32px);
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .vfx-meta {
        left: 12px;
        right: 12px;
        bottom: 10px;
    }

    .vfx-title {
        font-size: 0.85rem;
    }

    .vfx-modal-content {
        width: 95%;
        padding: 20px;
    }

    .vfx-modal-info .modal-title {
        font-size: 1.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vfx-tile,
    .vfx-cover,
    .vfx-preview,
    .vfx-arrow {
        transition: none;
    }

    .vfx-tile:hover,
    .vfx-tile:hover .vfx-cover,
    .vfx-tile:hover .vfx-preview {
        transform: none;
    }

    .vfx-grid.is-revealed .vfx-tile {
        animation: none;
    }
}

/* Embedded HD player (YouTube / Vimeo) — matches .vfx-modal-video */
.vfx-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.vfx-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Process steps inside the breakdown (title + text + points + screenshot) */
.vfx-step {
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.vfx-step-title {
    margin: 0 0 10px;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
}

.vfx-step-text {
    margin: 0 0 18px;
    line-height: 1.6;
    color: #ccc;
}

.vfx-step-points {
    margin: 14px 0 0;
    padding-left: 18px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
    line-height: 1.6;
}

.vfx-step-points li + li {
    margin-top: 4px;
}

/* Chapter buttons under the HD video */
.vfx-chapters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.vfx-chapter {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.vfx-chapter:hover,
.vfx-chapter:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    outline: none;
}

.vfx-chapter.is-active {
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.vfx-chapter-time {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.vfx-chapter-label {
    font-size: 0.9rem;
    line-height: 1.35;
}

/* Breakdown step without a screenshot yet */
.vfx-step-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

/* Artist-facing material parameters */
.vfx-params {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.vfx-params dl {
    margin: 12px 0 0;
    display: grid;
    gap: 8px;
}

.vfx-param {
    display: grid;
    grid-template-columns: minmax(180px, 0.8fr) 1.2fr;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.vfx-param dt {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vfx-param code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    color: #fff;
}

.vfx-param-value {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.vfx-param dd {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.65);
}

@media (max-width: 768px) {
    .vfx-param {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}
