/**
 * FFN Timeline Slider — Frontend Styles
 * Editorial, asymmetric, museum-like timeline slider.
 */

/* ──────────────────────────────────────────────
   SLIDER CONTAINER
   ────────────────────────────────────────────── */

.ffn-timeline-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 40px 0 60px;
    box-sizing: border-box;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ──────────────────────────────────────────────
   FILTER BAR
   ────────────────────────────────────────────── */

.ffn-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 80px 28px;
}

.ffn-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ffn-filter-btn {
    background: none;
    border: 1px solid #d0d0d0;
    border-radius: 20px;
    padding: 5px 16px;
    font-size: 12px;
    font-family: inherit;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

.ffn-filter-btn:hover {
    border-color: #1a1a1a;
    color: #1a1a1a;
}

.ffn-filter-btn--active {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #fff;
}

.ffn-filter-btn--active:hover {
    background: #333;
    border-color: #333;
    color: #fff;
}

/* Filtered-out columns */
.ffn-column--hidden {
    display: none !important;
}

/* ──────────────────────────────────────────────
   TRACK
   ────────────────────────────────────────────── */

.ffn-track {
    display: flex;
    align-items: flex-end;
    gap: var(--ffn-col-gap, 60px);
    transition: transform var(--ffn-speed, 500ms) cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
    padding: 0 80px;
}

/* ──────────────────────────────────────────────
   COLUMNS
   ────────────────────────────────────────────── */

.ffn-column {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: var(--ffn-double-gap, 30px);
}

/* Asymmetric sizing: vary column widths for editorial feel */
.ffn-column--single {
    width: clamp(220px, 25vw, 380px);
    /* Alternate vertical alignment for playfulness */
    align-self: flex-start;
}

.ffn-column--single:nth-child(3n+1) {
    align-self: flex-end;
}

.ffn-column--single:nth-child(3n+2) {
    align-self: center;
}

.ffn-column--double {
    width: clamp(200px, 22vw, 340px);
    align-self: center;
}

.ffn-column--double:nth-child(even) {
    align-self: flex-start;
}

/* ──────────────────────────────────────────────
   WORK / ARTWORK ITEM
   ────────────────────────────────────────────── */

.ffn-work {
    display: flex;
    flex-direction: column;
}

.ffn-work__image {
    overflow: hidden;
    line-height: 0;
    cursor: pointer;
}

.ffn-work__image:hover img {
    opacity: 0.85;
}

/* Column entrance animation */
@keyframes ffn-fade-up {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ffn-column {
    opacity: 0;
}

.ffn-column.ffn-column--visible {
    animation: ffn-fade-up 0.6s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.ffn-column:nth-child(2).ffn-column--visible { animation-delay: 0.08s; }
.ffn-column:nth-child(3).ffn-column--visible { animation-delay: 0.16s; }
.ffn-column:nth-child(4).ffn-column--visible { animation-delay: 0.24s; }
.ffn-column:nth-child(5).ffn-column--visible { animation-delay: 0.32s; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ffn-column {
        opacity: 1;
    }
    .ffn-column.ffn-column--visible {
        animation: none;
    }
}

.ffn-work__image img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.ffn-work__image img[loading] {
    opacity: 0;
}

.ffn-work__image img.loaded,
.ffn-work__image img:not([loading]) {
    opacity: 1;
}

/* ──────────────────────────────────────────────
   META / CAPTION
   ────────────────────────────────────────────── */

.ffn-work__meta {
    margin-top: 12px;
}

.ffn-work__line {
    width: 100%;
    height: 1px;
    background: #1a1a1a;
    margin-bottom: 8px;
}

.ffn-work__info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.ffn-work__text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ffn-work__artist {
    font-size: var(--ffn-title-size, 14px);
    color: #1a1a1a;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

.ffn-work__title {
    font-size: var(--ffn-title-size, 14px);
    color: #1a1a1a;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

.ffn-work__caption {
    font-size: calc(var(--ffn-title-size, 14px) - 1px);
    color: #666;
    font-weight: 300;
    line-height: 1.3;
    margin-top: 2px;
}

.ffn-work__year {
    font-size: var(--ffn-year-size, 13px);
    color: #1a1a1a;
    font-weight: 400;
    letter-spacing: 0.02em;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Overlay caption variant */
.ffn-caption--overlay .ffn-work__meta {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(255,255,255,0.95));
    padding: 20px 12px 12px;
    margin-top: 0;
}

.ffn-caption--overlay .ffn-work {
    position: relative;
}

.ffn-caption--overlay .ffn-work__line {
    background: rgba(26,26,26,0.4);
}

/* ──────────────────────────────────────────────
   ARROWS
   ────────────────────────────────────────────── */

.ffn-arrow {
    position: absolute;
    bottom: 10px;
    z-index: 10;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #c850c0;
    transition: color 0.2s ease, transform 0.2s ease;
    outline: none;
}

.ffn-arrow:hover {
    color: #a040a0;
}

.ffn-arrow:focus-visible {
    outline: 2px solid #c850c0;
    outline-offset: 2px;
    border-radius: 2px;
}

.ffn-arrow-left {
    left: 20px;
}

.ffn-arrow-right {
    right: 20px;
}

.ffn-arrow:active {
    transform: scale(0.92);
}

/* Arrow style: outlined */
.ffn-arrow--outlined {
    border: 1.5px solid currentColor;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Arrow style: filled */
.ffn-arrow--filled {
    background: #c850c0;
    color: #fff;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.ffn-arrow--filled:hover {
    background: #a040a0;
    color: #fff;
}

/* ──────────────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────────────── */

@media (max-width: 768px) {
    .ffn-filters {
        padding: 0 50px 20px;
        gap: 8px;
    }

    .ffn-filter-btn {
        font-size: 11px;
        padding: 4px 12px;
    }
}

@media (max-width: 768px) {
    .ffn-track {
        gap: 30px;
        padding: 0 50px;
    }

    .ffn-column--single {
        width: clamp(180px, 65vw, 300px);
    }

    .ffn-column--double {
        width: clamp(160px, 55vw, 260px);
    }

    .ffn-arrow-left {
        left: 8px;
    }

    .ffn-arrow-right {
        right: 8px;
    }

    .ffn-arrow svg {
        width: 22px;
        height: 22px;
    }

    .ffn-work__info {
        flex-direction: column;
        gap: 2px;
    }

    .ffn-work__year {
        align-self: flex-end;
    }

    .ffn-timeline-slider {
        padding: 20px 0 50px;
    }
}

@media (max-width: 480px) {
    .ffn-column--single {
        width: 75vw;
    }

    .ffn-column--double {
        width: 70vw;
    }

    .ffn-track {
        gap: 20px;
        padding: 0 40px;
    }
}

/* ──────────────────────────────────────────────
   LIGHTBOX
   ────────────────────────────────────────────── */

.ffn-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(255, 255, 255, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.ffn-lightbox[hidden] {
    display: none !important;
}

.ffn-lightbox.ffn-lightbox--visible {
    opacity: 1;
}

.ffn-lightbox__close {
    position: absolute;
    top: 24px;
    right: 28px;
    background: none;
    border: none;
    font-size: 32px;
    color: #1a1a1a;
    cursor: pointer;
    line-height: 1;
    padding: 8px;
    z-index: 10;
    transition: color 0.2s ease;
}

.ffn-lightbox__close:hover {
    color: #c850c0;
}

.ffn-lightbox__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 90vw;
    max-height: 90vh;
    cursor: default;
}

.ffn-lightbox__img {
    max-width: 85vw;
    max-height: 75vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.ffn-lightbox__meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.ffn-lightbox__artist {
    font-size: 13px;
    color: #666;
    letter-spacing: 0.01em;
}

.ffn-lightbox__title {
    font-size: 15px;
    color: #1a1a1a;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.ffn-lightbox__year {
    font-size: 13px;
    color: #1a1a1a;
    letter-spacing: 0.02em;
}

@media (max-width: 768px) {
    .ffn-lightbox__img {
        max-width: 95vw;
        max-height: 70vh;
    }

    .ffn-lightbox__close {
        top: 12px;
        right: 14px;
    }
}
