/* WandrSphere panel (see utl/foryou.php).
 *
 * Desktop (>768px): docked below the top bar, open by default. The sphere
 * icon in the main nav toggles .collapsed, which slides it off past the left
 * edge; foryou.js also clears --wandr-sidebar-w to 0 at the same time so the
 * page content reflows to fill the freed space (that var is otherwise set in
 * head.php's inline <style>, only on pages that include this panel at all).
 *
 * Mobile (<=768px): hidden off-screen by default, .open slides it in as a
 * full-screen popup instead — a separate state to the desktop .collapsed
 * one, since the two breakpoints have opposite defaults (see foryou.js).
 */

.foryou-panel {
    color: #fff;
    display: flex;
    flex-direction: column;
    background: rgba(13,12,20,.97);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    box-sizing: border-box;
    overflow: hidden;                      /* belt-and-braces: nothing paints past the box */
    transition: transform .22s ease;
}

/* Title bar: shown at both breakpoints now that desktop can collapse the
   panel too, not just the mobile popup. The close (X) button only appears on
   mobile though - desktop collapses via the edge tab below instead. */
.foryou-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

@media (min-width: 769px) {
    .foryou-panel {
        position: fixed;
        top: var(--wandr-nav-h, 60px);
        left: 0;
        bottom: 0;
        /* Fixed, NOT var(--wandr-sidebar-w) - that var is toggled to 0 on
           close (see foryou.js) to collapse the space the page reserves for
           the panel via body's padding-left (nav.css). If this width were
           tied to the same var, translateX(-100%) below would compute
           against a simultaneously-zeroed width - i.e. 100% of 0 - and the
           slide-away would silently become a no-op, which is exactly the bug
           that left the header still on screen after "closing". */
        width: 280px;
        z-index: 140;                          /* below the top nav (150) */
        border-right: 1px solid rgba(255,255,255,.07);
    }
    .foryou-panel.collapsed { transform: translateX(-100%); }
    .foryou-close { display: none; }
}

@media (max-width: 768px) {
    .foryou-panel {
        position: fixed;
        inset: 0;
        z-index: 970;                          /* above the profile FAB (950) */
        transform: translateX(-100%);
    }
    .foryou-panel.open { transform: translateX(0); }
}

.foryou-title { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 800; letter-spacing: .3px; }
.foryou-title-ico { width: 22px; height: 22px; object-fit: contain; display: block; }
.foryou-close {
    background: none; border: none; color: #fff; opacity: .7;
    font-size: 24px; line-height: 1; cursor: pointer; padding: 4px 6px;
}
.foryou-close:hover { opacity: 1; }

/* Edge tab: desktop-only expand/retract handle, docked to the sidebar's
   right edge (half poking past it) so it stays reachable however wide or
   narrow the reserved body space currently is. It's a sibling of the panel,
   not a child - a transformed ancestor becomes the containing block for any
   fixed-position descendant, which would drag a child version of this tab
   off-screen along with the panel's own slide-away transform. */
.foryou-edge-tab { display: none; }
@media (min-width: 769px) {
    .foryou-edge-tab {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: calc(50vh + var(--wandr-nav-h, 60px) / 2);
        transform: translateY(-50%);
        /* Flush against the sidebar's right edge (or the viewport's left edge
           when collapsed, since --wandr-sidebar-w goes to 0) - NOT centred on
           the edge. A -14px straddle used to sit half inside the sidebar
           (overlapping its own scrollbar) and half off-screen when collapsed. */
        left: var(--wandr-sidebar-w, 280px);
        width: 38px;
        height: 64px;
        border-radius: 0 12px 12px 0;
        background: rgba(20,19,32,.92);
        border: 1px solid rgba(255,255,255,.1);
        border-left: none;
        color: rgba(255,255,255,.55);
        cursor: pointer;
        z-index: 145;                          /* above the panel (140), below the top nav (150) */
        transition: left .22s ease, background .15s ease, color .15s ease;
    }
    .foryou-edge-tab:hover { background: rgba(139,92,246,.24); color: #fff; }
    .foryou-edge-tab img { width: 22px; height: 22px; object-fit: contain; display: block; }
}

/* Three equal-height sections rather than one long scrolling column - each
   section's own row list scrolls independently, so a long People list can't
   push Sites/Topics off screen (and vice versa). The title is a flex-shrink:0
   sibling above the scrolling list, so it stays put while its list scrolls. */
.foryou-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.foryou-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,.055);
}
.foryou-section:last-child { border-bottom: none; }
.foryou-section-title {
    flex-shrink: 0;
    padding: 0 18px 10px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px;
    opacity: .45;
}
.foryou-list {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}
.foryou-list::-webkit-scrollbar { width: 4px; }
.foryou-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }
.foryou-row {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 18px;
    text-decoration: none; color: inherit;
    transition: background .14s ease;
}
.foryou-row:hover { background: rgba(255,255,255,.06); }

.foryou-ava {
    flex-shrink: 0;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    font-size: 13px; font-weight: 800;
}
.foryou-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foryou-ava--sq { border-radius: 10px; }
.foryou-ava--round { border-radius: 50%; background: rgba(139,92,246,.3); }
.foryou-ava--topic {
    border-radius: 10px;
    background: rgba(167,139,250,.16);
    color: #c4b5fd;
    font-size: 16px;
}

.foryou-row-label {
    font-size: 13.5px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.foryou-empty { padding: 4px 18px; font-size: 12.5px; opacity: .4; }
