/* Gallery page: player + playlist, reel tiles, follow links */

.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ---- Player + playlist ---- */
.media-player {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    width: 100%;
    margin: 10px 0 50px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.mp-main {
    min-width: 0;
    border-right: 1px solid var(--border);
}

.mp-embed {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--graph-bg);
}

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

.mp-info { padding: 20px 24px 24px; }

.mp-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.mp-cat {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--on-primary);
    background: var(--primary-bg);
    border-radius: 4px;
    padding: 2px 8px;
}

.mp-cat:empty { display: none; }

.mp-dur {
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    color: var(--muted);
}

.mp-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text);
    margin: 0 0 6px;
}

.mp-desc {
    font-size: 0.84rem;
    line-height: 1.7;
    color: var(--muted);
    margin: 0;
}

/* The list takes no height of its own, so the player sets the row height and the list scrolls */
.mp-list {
    display: flex;
    flex-direction: column;
    height: 0;
    min-height: 100%;
    min-width: 0;
}

.mp-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
}

.mp-count { color: var(--primary); }

.mp-items {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.mp-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.mp-item:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }

.mp-item.is-active {
    background: color-mix(in srgb, var(--primary-bg) 10%, transparent);
    border-color: color-mix(in srgb, var(--primary-bg) 35%, transparent);
}

.mp-thumb {
    position: relative;
    flex: 0 0 120px;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    background: var(--graph-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mp-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mp-item-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.mp-item-title {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mp-item.is-active .mp-item-title { color: var(--primary); }

.mp-pin {
    align-self: flex-start;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--primary-bg) 45%, transparent);
    border-radius: 4px;
    padding: 1px 6px;
}

.mp-item-meta {
    font-size: 0.62rem;
    letter-spacing: 0.4px;
    color: var(--muted);
}

/* Play marker: lime disc with a triangle (shared by thumbnails and reel tiles) */
.mp-play {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-bg);
    opacity: 0.9;
    transition: transform 0.2s;
}

.mp-play::after {
    content: '';
    position: absolute;
    inset: 8px 7px 8px 10px;
    background: var(--on-primary);
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.mp-item.is-active .mp-play { display: none; }
.mp-item:hover .mp-play { transform: scale(1.1); }

/* ---- Reels ---- */
.reels-section {
    width: 100%;
    margin-bottom: 40px;
}

.reels-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    margin: 0 0 20px;
}

.reels-head .section-heading {
    margin: 0;
    padding-bottom: 12px;
    border-bottom: none;
    width: auto;
}

.reels-strip {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    overflow-x: auto;
    padding: 4px 2px 12px;
    /* proximity, not mandatory: mandatory snapped small wheel steps back to the same tile */
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* Tiles are 9:16 to fit the saved covers whole. Instagram's embed is a 54px header, the media
   at 4:5, then a footer, so a tile holding an iframe switches to 4:5 and shifts the iframe up by
   the header: only the media shows (it still plays inline). */
.reel-embed {
    position: relative;
    flex: 0 0 180px;
    aspect-ratio: 9 / 16;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--graph-bg);
    box-shadow: var(--card-shadow);
    scroll-snap-align: start;
    transition: border-color 0.25s;
}

.reel-embed:has(iframe) { aspect-ratio: 4 / 5; }

.reel-embed:hover { border-color: color-mix(in srgb, var(--primary-bg) 50%, transparent); }

.reel-cover {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.reel-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.reel-cover:hover img { transform: scale(1.04); }

.reel-cover:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.reel-embed iframe {
    position: absolute;
    top: -54px;
    left: 0;
    width: 100%;
    height: calc(100% + 54px + 120px);
    border: none;
}

/* ---- Follow links ---- */
.media-follow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 20px;
    width: 100%;
    padding: 16px 20px;
    margin-bottom: 50px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--card-shadow);
}

.media-follow-text {
    font-size: 0.82rem;
    color: var(--muted);
}

.media-follow-links {
    display: flex;
    gap: 10px;
}

.media-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px 4px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}

.media-link:hover {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary-bg) 50%, transparent);
}

.reels-head .media-link {
    padding: 0 0 12px;
    border: none;
    font-weight: 500;
    color: var(--muted);
}

.reels-head .media-link:hover { color: var(--primary); }

.media-link svg { width: 24px; height: 24px; }

/* Responsive */
@media (max-width: 820px) {
    .media-player { grid-template-columns: 1fr; }

    .mp-main {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .mp-list {
        height: auto;
        min-height: 0;
    }

    .mp-items { max-height: 320px; }
}

@media (max-width: 540px) {
    .mp-info { padding: 16px 18px 18px; }
    .mp-thumb { flex-basis: 96px; }
    .reel-embed { flex-basis: 150px; }
}
