/* ==========================================================================
   Live Rooms Feed — Grid + Room Card + Section Tabs
   Requires tokens.css, base.css, layout.css
   /css/frontend/rooms-feed.css

   Ported from livehoney.cam 2026-09-24. Uses CSS Grid, not the
   photo-gallery siblings' server-side masonry — that pattern exists to
   handle variable-aspect-ratio photos. BongaCams live thumbnails are
   uniform-ratio snapshots, so a plain auto-fill grid is simpler and
   gives equal-height rows for free.
   ========================================================================== */

.gender-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-2);
    padding: var(--spacing-6) 0 var(--spacing-4);
}

/* 2026-09-22: center the tabs to match the centered feed-head — desktop
   only. On mobile this row is a horizontal scroller, and
   justify-content:center on an overflowing scroll container clips the
   left edge (the first tabs become unreachable). */
@media (min-width: 769px) {
    .gender-tabs {
        justify-content: center;
    }
}

.gender-tabs__tab {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: var(--spacing-2) var(--spacing-4);
    text-decoration: none;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.gender-tabs__tab:hover {
    border-color: var(--color-border-hover);
    color: var(--color-text-primary);
}

.gender-tabs__tab--active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-cta-text);
}

/* 2026-09-24: the Categories hub link in the tab row — visually a tab
   but outlined with the accent since it's a navigation hub, not a
   section filter. */
.gender-tabs__tab--hub {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.gender-tabs__tab--hub:hover {
    background: var(--color-accent-subtle);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* --------------------------------------------------------------------------
   /categories index (2026-09-24) — labelled link grid, same pill style
   as tag pills but larger since these are primary navigation.
   -------------------------------------------------------------------------- */

.category-index {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-2);
    max-width: 900px;
    margin: 0 auto;
    padding: var(--spacing-4) 0 var(--spacing-8);
}

.category-index__link {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: var(--spacing-2) var(--spacing-4);
    text-decoration: none;
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.category-index__link:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: var(--color-accent-subtle);
    text-decoration: none;
}

/* Live count chip inside hub links — used on /regions where the set is
   small enough (6) to afford a count per entry. */
.category-index__count {
    margin-left: var(--spacing-1);
    font-size: var(--text-xs);
    color: var(--color-text-accent);
}

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--spacing-4);
    padding-bottom: var(--spacing-8);
}

.room-card {
    background: var(--color-bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.room-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* 2026-09-22: re-declare on :hover — bare `a:hover` (base.css) outranks
   the unprefixed class and would underline every inline descendant
   (username + subject) on card hover. */
.room-card__link:hover {
    color: inherit;
    text-decoration: none;
}

.room-card__image {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--color-bg-elevated);
}

.room-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-base);
}

.room-card:hover .room-card__image img {
    transform: scale(1.03);
}

.room-card__live-badge {
    position: absolute;
    top: var(--spacing-2);
    left: var(--spacing-2);
    background: var(--color-danger);
    color: var(--color-white);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
    padding: 2px var(--spacing-2);
}

.room-card__hd-badge {
    position: absolute;
    top: var(--spacing-2);
    right: var(--spacing-2);
    background: var(--color-overlay-dark);
    color: var(--color-white);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    border-radius: var(--radius-sm);
    padding: 2px var(--spacing-2);
}

/* 2026-09-24: interactive-toy badge (BongaCash is_vibratoy) — sits left
   of the viewers pill, accent background since it's a selling point. */
.room-card__toy-badge {
    position: absolute;
    bottom: var(--spacing-2);
    left: var(--spacing-2);
    background: var(--color-accent);
    color: var(--color-cta-text);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    border-radius: var(--radius-sm);
    padding: 2px var(--spacing-2);
}

.room-card__viewers {
    position: absolute;
    bottom: var(--spacing-2);
    right: var(--spacing-2);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--color-overlay-dark);
    color: var(--color-white-90);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
    padding: 2px var(--spacing-2);
}

.room-card__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--spacing-3);
}

.room-card__username {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-accent);
    line-height: var(--leading-tight);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 2026-09-22: tags moved out of the room-card link (can't nest an <a>
   inside another <a>) and are now individually clickable filter links,
   so this is a flex row of small pill-links rather than one text span. */
.room-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-1);
    padding: 0 var(--spacing-3) var(--spacing-3);
}

.room-card__tag {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    background: var(--color-bg-subtle, rgba(255, 255, 255, 0.05));
    border-radius: var(--radius-full, 999px);
    padding: 2px var(--spacing-2);
    text-decoration: none;
    line-height: var(--leading-snug);
    white-space: nowrap;
}

.room-card__tag:hover {
    color: var(--color-accent);
    background: var(--color-accent-subtle);
}

@media (max-width: 768px) {
    .rooms-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: var(--spacing-3);
    }

    .room-card__body {
        padding: var(--spacing-2);
    }

    .room-card__tags {
        padding: 0 var(--spacing-2) var(--spacing-2);
    }
}

/* 2026-09-22: pager for offset-based room pagination (RoomsModel::getRooms
   page param). Kept simple — prev/next + a status label, not numbered page
   links, since the underlying list is live and page numbers beyond the
   immediate next/prev aren't a meaningful destination (see RoomsModel's
   own doc comment on why). */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-4);
    margin-top: var(--spacing-6);
    padding: var(--spacing-4) 0;
}

.pager__link {
    color: var(--color-accent);
    font-weight: var(--font-semibold);
    text-decoration: none;
}

.pager__link:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

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

@media (max-width: 768px) {
    .pager {
        gap: var(--spacing-2);
    }
}

/* 2026-09-22: shown above the grid when a tag filter (from a room-card
   tag link) is active, with a way back to the unfiltered view. */
.active-tag {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    padding-bottom: var(--spacing-4);
}

.active-tag strong {
    color: var(--color-accent);
}

.active-tag__clear {
    color: var(--color-text-muted);
    text-decoration: underline;
}

.active-tag__clear:hover {
    color: var(--color-accent);
}

/* ==========================================================================
   Landing-page head + room page + tag directory (2026-09-22)
   ========================================================================== */

/* 2026-09-22: centered — a left-aligned H1+intro over the wide container
   looked unbalanced; centered reads as a proper page head and matches how
   cam directories typically lay this out. */
.feed-head {
    padding: var(--spacing-6) 0 var(--spacing-2);
    text-align: center;
}

.feed-head__title {
    font-size: var(--text-2xl, 1.5rem);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    margin: 0 0 var(--spacing-2);
}

.feed-head__intro {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    max-width: 60ch;
    margin: 0 auto;
    line-height: var(--leading-relaxed, 1.6);
}

/* 2026-09-24: live online-count pill under the H1 — number is the API's
   filtered online_models total. Pulsing dot borrows the universal "LIVE"
   convention; accent-subtle pill keeps it visible without competing with
   the H1. */
.feed-head__count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 var(--spacing-2);
    padding: 2px 10px;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--color-text-accent);
    background: var(--color-accent-subtle);
    border: 1px solid var(--color-accent-subtle);
    border-radius: var(--radius-full);
}

.feed-head__live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-accent);
    animation: feed-live-pulse 1.6s ease-in-out infinite;
}

@keyframes feed-live-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

/* Room subject under the username on cards — one line, ellipsis. */
.room-card__subject {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    line-height: var(--leading-snug);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   /room/{username} page
   -------------------------------------------------------------------------- */

.room-page__live-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: var(--spacing-2);
    background: var(--color-danger);
    color: var(--color-white);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
    padding: 2px var(--spacing-2);
}

.room-page__meta {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin: 0;
}

.room-embed {
    position: relative;
    width: 100%;
    /* 2026-09-22: no max-width cap — the embed carries video AND chat
       side-by-side, so it wants the full container width. A 960px cap
       left a dead column on the right at --width-container (1200px). */
    aspect-ratio: 16 / 9;
    background: var(--color-bg-elevated);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--spacing-4);
}

.room-embed__iframe {
    position: absolute;
    /* 2px overscan — third-party embed pages tend to render a ~1px light
       seam along their own top/left edges. Sizing the frame 4px larger
       and pulling it -2px lets the box's overflow:hidden clip that edge
       off entirely. */
    inset: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    border: none;
}

/* 2026-09-24: cam_only mode — our own <video> element fed by hls.js.
   object-fit:contain so the stream's real aspect shows uncropped inside
   the 16:9 box; black bars only when the model's cam isn't 16:9. */
.room-embed__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* CTA pill floating over the cam_only video — the stream itself carries
   no tracking, so the monetized outbound click stays one tap away. */
.room-embed__cta-overlay {
    position: absolute;
    right: var(--spacing-3);
    bottom: var(--spacing-3);
    background: var(--color-cta-bg);
    color: var(--color-cta-text);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    padding: var(--spacing-2) var(--spacing-4);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: background var(--transition-fast);
}

.room-embed__cta-overlay:hover {
    background: var(--color-cta-bg-hover);
    color: var(--color-cta-text);
    text-decoration: none;
}

.room-offline {
    display: flex;
    gap: var(--spacing-4);
    align-items: center;
    max-width: 720px;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-4);
    margin-bottom: var(--spacing-4);
}

.room-offline__thumb {
    width: 180px;
    height: auto;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.room-offline__title {
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    margin: 0 0 var(--spacing-2);
}

.room-offline__body p {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    margin: 0;
}

.room-page__subject {
    color: var(--color-text-secondary);
    font-size: var(--text-base);
    margin: 0 0 var(--spacing-3);
}

.room-page__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-1);
    margin-bottom: var(--spacing-4);
}

.room-page__cta {
    margin: 0 0 var(--spacing-6);
}

.room-page__cta-link {
    display: inline-block;
    background: var(--color-cta-bg);
    color: var(--color-cta-text);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-md);
    padding: var(--spacing-3) var(--spacing-5);
    text-decoration: none;
    transition: background var(--transition-fast);
}

.room-page__cta-link:hover {
    /* 2026-09-22: re-declare color + no underline — bare `a:hover` in
       base.css (specificity 0,1,1) beats the unprefixed class rule
       (0,1,0) and was painting the text --color-accent-hover, the same
       hue as the background → invisible label. cta-bg-hover darkens on
       hover (correct direction for a filled button); accent-hover would
       lighten it. */
    background: var(--color-cta-bg-hover);
    color: var(--color-cta-text);
    text-decoration: none;
}

/* 2026-09-24: CTA group — primary "chat" + secondary "full profile"
   split the row half/half, filling the full content width like the
   About box and promo cards around them. flex-basis 240px means they
   stack full-width on narrow viewports instead of squeezing. */
.room-page__ctas {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-3);
    margin: 0 0 var(--spacing-6);
}

.room-page__ctas > .room-page__cta-link {
    flex: 1 1 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--spacing-4) var(--spacing-5);
}

.room-page__cta-link--secondary {
    background: var(--color-bg-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.room-page__cta-link--secondary:hover {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    border-color: var(--color-border-hover);
}

/* --------------------------------------------------------------------------
   /room/ About block (2026-09-24) — BongaCash returns a real model profile
   (bio fields + turns_on/off), which is the room page's indexable text
   where Chaturbate's version only had a subject line.
   -------------------------------------------------------------------------- */

.room-profile {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-4) var(--spacing-5);
    margin-bottom: var(--spacing-4);
    /* 2026-09-24: no max-width cap — the 860px version left dead space
       right of the box while the promo cards and similar-rooms grid
       around it span the full container. */
}

.room-profile__title {
    font-size: var(--text-lg, 1.125rem);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    margin: 0 0 var(--spacing-3);
}

.room-profile__turns {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed, 1.6);
    margin: 0 0 var(--spacing-2);
}

.room-profile__turns strong {
    color: var(--color-text-primary);
}

/* Definition-list stats as a compact chip grid — reads as a profile
   spec sheet, wraps naturally on mobile. */
.room-profile__stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-2);
    margin: var(--spacing-3) 0 0;
}

.room-profile__stat {
    background: var(--color-bg-subtle, rgba(255, 255, 255, 0.05));
    border-radius: var(--radius-md);
    padding: var(--spacing-1) var(--spacing-3);
    font-size: var(--text-xs);
}

.room-profile__stat dt {
    display: inline;
    color: var(--color-text-muted);
}

.room-profile__stat dt::after {
    content: ': ';
}

.room-profile__stat dd {
    display: inline;
    color: var(--color-text-primary);
    margin: 0;
}

.similar-rooms {
    padding-top: var(--spacing-4);
}

.similar-rooms__title {
    font-size: var(--text-lg, 1.125rem);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    margin: 0 0 var(--spacing-4);
}

@media (max-width: 768px) {
    .room-offline {
        flex-direction: column;
        align-items: flex-start;
    }

    .room-offline__thumb {
        width: 100%;
    }
}

/* 2026-09-24: per-mode embed boxes. chat_cam is BongaCams' official
   chat-popup (video + chat column, ~1000px fixed desktop layout) — 16:9
   is close enough to its natural shape that any letterbox is sub-pixel.
   cam_only is our own hls.js <video> — also 16:9, with object-fit:contain
   covering models whose cam aspect differs. cam_only is mobile-native
   (video scales, unlike the popup's fixed chat column). */
.room-embed--chat_cam {
    aspect-ratio: 16 / 9;
}

.room-embed--cam_only {
    aspect-ratio: 16 / 9;
}

/* Mobile fallback for the chat_cam embed: the popup is a fixed desktop
   layout so under 1025px the iframe isn't even injected (app.js); the
   thumb fallback taps through to the affiliate room URL instead. */
.room-embed__fallback {
    display: flex;
    position: relative;
    width: 100%;
    text-decoration: none;
    overflow: hidden;
}

.room-embed__thumb {
    width: 100%;
    height: auto;
    display: block;
}

.room-embed__play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    background: rgba(0, 0, 0, 0.72);
    color: var(--color-white);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    white-space: nowrap;
    padding: var(--spacing-3) var(--spacing-4);
    border-radius: var(--radius-md);
}

.room-embed--live .room-embed__fallback {
    display: none;
}

@media (max-width: 1024px) {
    /* chat_cam box wraps the fallback thumb's natural 4:3 instead of the
       desktop 16:9 frame. If the iframe was already injected and the
       window is dragged narrow, swap back to the thumb rather than
       show a scrolling embed. */
    .room-embed--chat_cam {
        aspect-ratio: auto;
    }

    /* cam_only is mobile-native (BongaCamsEmbed::isMobileNative) — the
       <video> stays on all viewports, so keep the 16:9 box. */
    .room-embed--cam_only {
        aspect-ratio: 16 / 9;
    }

    .room-embed--live .room-embed__iframe {
        display: none;
    }

    .room-embed--live .room-embed__fallback {
        display: flex;
    }
}

/* --------------------------------------------------------------------------
   /tags directory
   -------------------------------------------------------------------------- */

.tag-directory {
    padding-bottom: var(--spacing-8);
}

.tag-directory__group {
    margin-bottom: var(--spacing-5);
}

.tag-directory__letter {
    font-size: var(--text-lg, 1.125rem);
    font-weight: var(--font-bold);
    color: var(--color-accent);
    margin: 0 0 var(--spacing-2);
}

.tag-directory__list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-1);
}

/* ==========================================================================
   2026-09-22 — mobile chrome tightening + promo cards
   ========================================================================== */

/* Sponsored slot in the room grid — native-card styling, always labeled. */
.promo-card {
    background: var(--color-bg-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.promo-card__link {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--spacing-2);
    height: 100%;
    min-height: 180px;
    padding: var(--spacing-4);
    text-decoration: none;
    text-align: center;
}

/* Same a:hover specificity leak as .room-card__link — without this,
   hovering the card underlines the title/text spans. */
.promo-card__link:hover {
    text-decoration: none;
}

.promo-card__label {
    align-self: center;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: 1px var(--spacing-2);
}

.promo-card__title {
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    color: var(--color-text-accent);
    line-height: var(--leading-tight);
}

.promo-card__text {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: var(--leading-snug);
}

.promo-card__cta {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-accent);
}

/* type=image promos — banner creative centered inside the card, never
   stretched (a 728x90 leader would blur at grid-card width). Squarish
   creatives fit grid_card best; wide banners fit room_below. */
.promo-card__image {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 220px;
    margin: 0 auto;
}

.promo-card__link:hover .promo-card__cta {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

@media (max-width: 768px) {
    /* Gender tabs stay reachable while scrolling the grid. Negative
       side-margins + matching padding let the bar bleed to the container
       edges so thumbs don't peek through the gap. top = --header-height,
       NOT 0: the fixed header (z 200) slides back over anything at 0
       whenever it unhides on scroll-up, which would bury the tabs. */
    .gender-tabs {
        position: sticky;
        top: var(--header-height);
        z-index: 10;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        background: var(--color-bg-primary);
        margin: 0 calc(-1 * var(--spacing-3));
        padding: var(--spacing-2) var(--spacing-3);
        transition: transform 0.3s ease;
    }

    /* 2026-09-23: tabs hide with the header (body.header-hidden is set
       by the same scroll listener). They stick at top:--header-height,
       so they must travel header-height + their own height to clear
       the viewport. Reduced-motion matches the header: no transition. */
    body.header-hidden .gender-tabs {
        transform: translateY(calc(-1 * var(--header-height) - 100%));
    }

    .gender-tabs::-webkit-scrollbar {
        display: none;
    }

    .gender-tabs__tab {
        flex-shrink: 0;
    }

    /* Compact page head — H1 stays (SEO), intro clamps to 2 lines
       visually while the full text remains in the DOM. */
    .feed-head {
        padding: var(--spacing-3) 0 var(--spacing-1);
    }

    .feed-head__title {
        font-size: 1.25rem;
    }

    .feed-head__intro {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

@media (prefers-reduced-motion: reduce) {
    /* Same rule the header follows — the tabs' hide/reveal transition
       is decorative motion. */
    .gender-tabs {
        transition: none;
    }
}
