/* ============================================================
   INSTAGRAM REELS RAIL
   A rolling strip of @harrysandersseo reels, filterable by topic.
   Full-bleed: .reels-rail sits outside .container so it can run
   to the section edges without any 100vw scrollbar maths.
   ============================================================ */

.reels-section { overflow: hidden; }

.reels-section .section-header { margin-bottom: 28px; }

/* ----- filter chips ----- */
.reels-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 34px;
}

.reel-chip {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--gray-400);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 9px 18px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.reel-chip:hover {
    color: var(--white);
    border-color: rgba(0, 229, 255, 0.45);
}

.reel-chip.is-active {
    background: var(--gradient-brand);
    border-color: transparent;
    color: var(--black);
}

.reel-chip:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

/* ----- the rail ----- */
.reels-rail { position: relative; }

.reels-viewport {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Don't let a swipe past the end trigger the browser's back gesture */
    overscroll-behavior-x: contain;
    /* Feather the ends so tiles dissolve rather than getting guillotined */
    -webkit-mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent);
}

.reels-viewport::-webkit-scrollbar { display: none; }
.reels-viewport.is-dragging { cursor: grabbing; }

.reels-track {
    display: flex;
    width: max-content;
}

.reels-pass {
    display: flex;
    gap: 18px;
    padding: 6px 9px;
}

/* ----- a tile ----- */
.reel-card {
    flex: 0 0 auto;
    width: 208px;
    text-decoration: none;
    display: block;
    -webkit-user-drag: none;
}

.reel-thumb {
    position: relative;
    aspect-ratio: 9 / 16;
    border-radius: 14px;
    overflow: hidden;
    background: var(--gray-800);
    border: 1px solid rgba(255, 255, 255, 0.09);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.3, 1),
                border-color 0.35s ease,
                box-shadow 0.35s ease;
}

.reel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    -webkit-user-drag: none;
    user-select: none;
}

.reel-card:hover .reel-thumb,
.reel-card:focus-visible .reel-thumb {
    transform: translateY(-6px);
    border-color: rgba(0, 229, 255, 0.55);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 229, 255, 0.18);
}

.reel-card:focus-visible { outline: none; }
.reel-card:focus-visible .reel-thumb { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* play affordance */
.reel-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--white);
    background: rgba(0, 0, 0, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.reel-play svg { width: 17px; height: 17px; margin-left: 2px; }

.reel-card:hover .reel-play {
    background: var(--cyan);
    border-color: var(--cyan);
    color: var(--black);
    transform: translate(-50%, -50%) scale(1.08);
}

/* view-count badge, only on the reels that earned one */
.reel-views {
    position: absolute;
    left: 10px;
    bottom: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--white);
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 999px;
    padding: 3px 9px;
}

.reel-title {
    display: block;
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--gray-400);
    transition: color 0.25s ease;
}

.reel-card:hover .reel-title { color: var(--white); }

/* ----- arrows ----- */
.reels-nav {
    position: absolute;
    top: calc(50% - 22px);
    transform: translateY(-50%);
    z-index: 3;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: var(--white);
    background: rgba(10, 10, 10, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.reels-nav svg { width: 18px; height: 18px; }
.reels-nav--prev { left: 14px; }
.reels-nav--next { right: 14px; }

.reels-rail:hover .reels-nav,
.reels-nav:focus-visible { opacity: 1; }

.reels-nav:hover {
    background: var(--cyan);
    border-color: var(--cyan);
    color: var(--black);
}

/* ----- footer link ----- */
.reels-footer {
    text-align: center;
    margin-top: 36px;
}

.reels-profile-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--cyan);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.25s ease;
}

.reels-profile-link:hover { border-bottom-color: var(--cyan); }
.reels-profile-link svg { width: 16px; height: 16px; }

/* ----- lightbox ----- */
.reel-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.86);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.reel-lightbox.is-open { opacity: 1; }

.reel-lightbox-inner {
    width: min(400px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.reel-lightbox iframe {
    width: 100%;
    height: min(74vh, 640px);
    border: 0;
    border-radius: 14px;
    background: var(--white);
}

.reel-lightbox-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--cyan);
    text-decoration: none;
}

.reel-lightbox-link:hover { text-decoration: underline; }

.reel-lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: var(--white);
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: background 0.2s ease;
}

.reel-lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }
.reel-lightbox-close svg { width: 20px; height: 20px; }

@media (max-width: 640px) {
    .reel-card { width: 158px; }
    .reels-pass { gap: 12px; }
    .reels-nav { display: none; }
    .reel-title { font-size: 12px; }
    .reels-viewport {
        -webkit-mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent);
        mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent);
    }
}

/* A category that already fits on screen sits still and centred: rolling it
   would just show the same four reels two or three times over. */
.reels-rail.is-static .reels-track { width: 100%; justify-content: center; }
.reels-rail.is-static .reels-pass { flex-wrap: nowrap; }
.reels-rail.is-static .reels-nav { display: none; }
.reels-rail.is-static .reels-viewport {
    -webkit-mask-image: none;
    mask-image: none;
}
