/* Mobile TikTok-style swipe feed. Shown only when socialPage.showSwipe is true. */

/* Everything fixed in here starts BELOW the site navbar, never at the viewport
 * top. The navbar is `position: sticky; top: 0` at `z-index: 1030` and ~60px
 * tall, so a `top: 0` overlay here loses the stacking contest across that whole
 * band no matter what z-index it carries: the browser hit-tests the navbar and
 * the tap opens the hamburger menu. That is what happened to the 48px
 * `.swipe-topbar` — it sat entirely inside the navbar's band, which made the
 * "Classic list" button (the feed's ONLY way out on a phone, since the swipe
 * feed IS the mobile presentation of /social) impossible to tap. `--nav-h`
 * (theme.css, kept exact at runtime by js/nav_height.js) is the measured navbar
 * height, so offsetting by it clears the band whatever the navbar wraps to.
 *
 * The feed is deliberately full-bleed below that line and DOES cover the page
 * footer: swipe mode is an immersive surface with no footer of its own, and the
 * reachable "Classic list" toggle is the way back to a page that has one. That
 * only holds while the toggle is reachable — hence the reachability case in the
 * frontend browser gate (config/frontend_quality_gates.json: social_swipe_mobile),
 * which hit-tests the button with elementFromPoint at 390x844. A test that only
 * asserts the button renders cannot see this failure. */
.social-swipe-feed {
    position: fixed;
    inset: var(--nav-h) 0 0 0;
    height: calc(100dvh - var(--nav-h));
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    background: var(--swipe-stage);
    z-index: 1000;
}

.swipe-topbar {
    position: fixed;
    top: var(--nav-h); left: 0; right: 0;
    height: 48px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px;
    color: var(--on-image);
    z-index: 1002;
    background: linear-gradient(color-mix(in srgb, var(--shadow-ink) 66.667%, transparent), transparent);
    font-family: var(--font-display, 'Archivo Black'), sans-serif;
    font-size: 14px;
}
.swipe-topbar button {
    background: color-mix(in srgb, var(--on-image) 13.333%, transparent); color: var(--on-image); border: 1px solid color-mix(in srgb, var(--on-image) 26.667%, transparent);
    border-radius: var(--radius-pill, 50px); padding: 5px 12px; font-size: 12px;
    font-family: var(--font-body, 'Outfit'), sans-serif; cursor: pointer;
}

.swipe-card {
    position: relative;
    /* Matches the scrollport height above, so one card still fills exactly one
       snap position now that the feed is inset below the navbar. */
    height: calc(100dvh - var(--nav-h));
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
    color: var(--on-image);
    font-family: var(--font-body, 'Outfit'), sans-serif;
}

.swipe-cover {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
}
.swipe-cover-fallback {
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display, 'Archivo Black'), sans-serif;
    font-size: 96px; color: color-mix(in srgb, var(--on-image) 33.333%, transparent);
    background: linear-gradient(150deg, var(--swipe-cover-fallback-start), var(--brand));
}
.swipe-scrim {
    position: absolute; inset: 0;
    background: linear-gradient(transparent 42%, color-mix(in srgb, var(--shadow-ink) 87.843%, transparent));
}

.swipe-overlay {
    position: absolute; left: 16px; right: 76px; bottom: 28px;
    z-index: 1001;
}
.swipe-byline { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.swipe-avatar { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; border: 2px solid var(--on-image); flex: 0 0 auto; }
.swipe-avatar img { width: 100%; height: 100%; object-fit: cover; }
.swipe-avatar-fallback {
    display: flex; align-items: center; justify-content: center;
    background: var(--brand); color: var(--on-image);
    font-family: var(--font-display, 'Archivo Black'), sans-serif; font-size: 14px;
}
.swipe-byname { font-weight: 600; font-size: 14px; }
.swipe-verb { font-size: 12.5px; color: color-mix(in srgb, var(--on-image) 80%, transparent); }
.swipe-rating { color: var(--swipe-rating); font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.swipe-title { font-family: var(--font-display, 'Archivo Black'), sans-serif; font-size: 19px; line-height: 1.15; margin: 0 0 8px; }
.swipe-snippet { font-size: 13.5px; line-height: 1.45; margin: 0; color: var(--swipe-copy); }
.swipe-quote {
    margin: 0; padding: 10px 12px;
    background: color-mix(in srgb, var(--on-image) 10.196%, transparent); border-left: 3px solid var(--accent-interest);
    border-radius: 0 8px 8px 0; font-size: 13.5px; line-height: 1.45;
}
.swipe-spoiler-veil {
    display: inline-block; border: 1px dashed color-mix(in srgb, var(--on-image) 40%, transparent); background: color-mix(in srgb, var(--shadow-ink) 33.333%, transparent);
    color: var(--on-image); border-radius: var(--radius-sm, 6px); padding: 10px 14px;
    font-size: 13px; cursor: pointer; backdrop-filter: blur(6px);
}

.swipe-rail {
    --reaction-chip-min-height: 0;
    --reaction-chip-min-width: 0;
    --reaction-chip-padding: 3px 9px;
    --reaction-chip-fg: var(--on-image);
    --reaction-chip-bg: color-mix(in srgb, var(--shadow-ink) 46%, transparent);
    --reaction-chip-border: color-mix(in srgb, var(--on-image) 32%, transparent);
    --reaction-chip-hover-border: color-mix(in srgb, var(--on-image) 40%, transparent);
    --reaction-chip-hover-bg: color-mix(in srgb, var(--shadow-ink) 34.902%, transparent);
    --reaction-chip-mine-border: var(--accent-interest);
    --reaction-chip-mine-bg: color-mix(in srgb, var(--shadow-ink) 34.902%, transparent);
    --reaction-chip-backdrop-filter: blur(5px);
    --reaction-chip-shadow: 0 2px 8px color-mix(in srgb, var(--shadow-ink) 40%, transparent);
    --reaction-chip-text-shadow: 0 1px 2px color-mix(in srgb, var(--shadow-ink) 50%, transparent);
    --reaction-chip-font-size: 12px;
    --reaction-chip-font-weight: 600;
    position: absolute; right: 10px; bottom: 120px;
    display: flex; flex-direction: column; gap: 18px; align-items: center;
    z-index: 1001;
}
.swipe-act {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none; color: var(--on-image); font-size: 11px; cursor: pointer;
    text-decoration: none;
    /* Lift the labels off the artwork so they read on bright covers too. */
    text-shadow: 0 1px 3px color-mix(in srgb, var(--shadow-ink) 55%, transparent);
}
/* The rail discs float over arbitrary cover art, so they earn their presence
   from depth, not colour: a dark glass fill that holds on any background, a
   bright specular rim, an inset top highlight (glassy), and a drop shadow that
   lifts them off the photo. */
.swipe-act-ic {
    width: 46px; height: 46px; border-radius: 50%;
    background: color-mix(in srgb, var(--shadow-ink) 30%, transparent); border: 1px solid color-mix(in srgb, var(--on-image) 45%, transparent);
    -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--shadow-ink) 45%, transparent), inset 0 1px 0 color-mix(in srgb, var(--on-image) 25%, transparent);
    display: flex; align-items: center; justify-content: center; font-size: 20px;
    transition: transform .12s var(--ease-standard, ease), background .15s, border-color .15s;
}
.swipe-act:hover .swipe-act-ic { background: color-mix(in srgb, var(--shadow-ink) 40%, transparent); border-color: color-mix(in srgb, var(--on-image) 62%, transparent); }
.swipe-act:active .swipe-act-ic { transform: scale(.9); }

/* ── Reactions inside the swipe rail ──────────────────────────────────
   The shared reaction bar (post_reactions.css) is built for the light
   classic feed: light pills, a horizontal wrap, and a picker that opens
   up-and-to-the-right. Dropped into the dark vertical rail it clashes with
   the frosted-glass action buttons, the pills are small/awkward to tap, and
   — sitting against the screen's right edge — the picker runs off-screen so
   half the emoji are unreachable. Re-skin it into the rail's own language.
   Everything here is scoped under .swipe-rail, so the classic feed and the
   post-detail page (which share .pr-bar) are untouched. */

/* The whole bar slots into the rail as one more stacked action. */
.swipe-rail .pr-bar {
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* React button: a frosted-glass circle, twin of .swipe-act-ic. It already
   renders the viewer's current reaction (or a ＋, echoing "＋ Follow"). */
.swipe-rail .pr-add {
    order: -1;                 /* circle on top, counts read as its label */
    width: 46px; height: 46px; min-width: 46px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
    font-size: 22px;
    color: var(--on-image);
    background: color-mix(in srgb, var(--shadow-ink) 30%, transparent);
    border: 1px solid color-mix(in srgb, var(--on-image) 45%, transparent);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--shadow-ink) 45%, transparent), inset 0 1px 0 color-mix(in srgb, var(--on-image) 25%, transparent);
    transition: background .15s, border-color .15s, box-shadow .15s, transform .12s;
}
.swipe-rail .pr-add:hover { background: color-mix(in srgb, var(--shadow-ink) 40%, transparent); border-color: color-mix(in srgb, var(--on-image) 62%, transparent); }
.swipe-rail .pr-add:active { transform: scale(.92); }
/* Your reaction should genuinely glow — a warm, lit disc that stands apart. */
.swipe-rail .pr-add.is-mine {
    background: color-mix(in srgb, var(--accent-interest) 90%, transparent);
    border-color: color-mix(in srgb, var(--on-image) 85%, transparent);
    box-shadow: 0 4px 18px color-mix(in srgb, var(--accent-interest) 60%, transparent), inset 0 1px 0 color-mix(in srgb, var(--on-image) 35%, transparent);
}
/* The commit overshoot fires only on a real tap: post_reactions.js repaint()
   (apply/swap/double-tap, never first render) stamps .pr-pop on the freshly
   built disc. Keying off .is-mine instead would replay on every card mount. */
.swipe-rail .pr-add.pr-pop {
    animation: pr-commit-pop .34s var(--ease-enter, cubic-bezier(.34, 1.56, .64, 1)) both;
}
@keyframes pr-commit-pop {
    0%   { transform: scale(.6);  }
    55%  { transform: scale(1.18); }
    100% { transform: scale(1);   }
}

/* Picker emoji get a press response on touch, not just hover. */
.swipe-rail .pr-pick:active { transform: scale(1.22); background: color-mix(in srgb, var(--on-image) 16.863%, transparent); }

/* Count chips become compact dark-frosted tags stacked under the circle. */
.swipe-rail .pr-chips { flex-direction: column; align-items: center; gap: 4px; }
.swipe-rail .pr-count { color: color-mix(in srgb, var(--on-image) 85.098%, transparent); }

/* Picker opens toward screen centre (leftwards) as a 3×2 frosted grid, so all
   six reactions stay on-screen and each is a comfortable 44px tap target. */
.swipe-rail .pr-picker {
    left: auto;
    right: calc(100% + 10px);
    bottom: auto;
    top: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 6px;
    border-radius: 18px;
    background: var(--swipe-popover-bg);
    border-color: color-mix(in srgb, var(--on-image) 18.039%, transparent);
    box-shadow: 0 12px 32px color-mix(in srgb, var(--shadow-ink) 60%, transparent);
}
/* Re-assert the hidden state: the scoped rule above outranks the base
   .pr-picker[hidden]{display:none}, so it must be restored at higher
   specificity or the picker shows when it should be closed. */
.swipe-rail .pr-picker[hidden] { display: none; }
.swipe-rail .pr-pick {
    width: 44px; height: 44px; min-width: 44px; min-height: 44px;
    border-radius: 12px;
    font-size: 22px;
    color: var(--on-image);
    background: transparent;
}
.swipe-rail .pr-pick:hover { background: color-mix(in srgb, var(--on-image) 12.157%, transparent); }

/* Reactor list popover: same leftward, dark-frosted treatment. */
.swipe-rail .pr-reactors {
    left: auto;
    right: calc(100% + 10px);
    top: 0;
    color: var(--on-image);
    background: var(--swipe-popover-bg);
    border-color: color-mix(in srgb, var(--on-image) 18.039%, transparent);
    box-shadow: 0 12px 32px color-mix(in srgb, var(--shadow-ink) 60%, transparent);
}
.swipe-rail .pr-reactor.cc-empty { color: color-mix(in srgb, var(--on-image) 60%, transparent); }

/* Visible keyboard focus (the shared base ships none). */
.swipe-rail .pr-add:focus-visible,
.swipe-rail .pr-pick:focus-visible,
.swipe-rail [data-reaction-chip]:focus-visible {
    outline: 2px solid var(--on-image);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .swipe-act-ic { transition: none; }
    .swipe-act:active .swipe-act-ic { transform: none; }
    .swipe-rail .pr-add { transition: none; }
    .swipe-rail .pr-add:active { transform: none; }
    .swipe-rail .pr-add.pr-pop { animation: none; }
    .swipe-rail .pr-pick:active { transform: none; }
}

/* Comment bottom sheet */
.swipe-sheet { position: fixed; inset: 0; z-index: 1100; }
.swipe-sheet-scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--shadow-ink) 53.333%, transparent); }
.swipe-sheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    max-height: 78dvh; overflow-y: auto;
    background: var(--surface); color: var(--text);
    border-radius: 18px 18px 0 0; padding: 14px 16px 24px;
    box-shadow: 0 -10px 30px color-mix(in srgb, var(--shadow-ink) 40%, transparent);
}
.swipe-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.swipe-sheet-head button { background: none; border: none; font-size: 22px; color: var(--text-muted); cursor: pointer; }

.swipe-sentinel { height: 1px; width: 100%; }

@media (prefers-reduced-motion: reduce) {
    .social-swipe-feed { scroll-behavior: auto; }
}

.swipe-return-btn { display: none; }
@media (max-width: 767.98px) {
    .swipe-return-btn {
        display: inline-flex; align-items: center; gap: 6px;
        margin: 12px 0; padding: 8px 14px;
        background: var(--brand); color: var(--on-image); border: none;
        border-radius: var(--radius-pill, 50px); font-family: var(--font-body, 'Outfit'), sans-serif;
        font-size: 13px; cursor: pointer;
    }
}

.swipe-state {
    /* Centred in the feed, not in the viewport: the feed now starts at --nav-h. */
    position: fixed; left: 0; right: 0;
    top: calc(var(--nav-h) + (100dvh - var(--nav-h)) / 2); transform: translateY(-50%);
    text-align: center; color: var(--on-image); font-family: var(--font-body, 'Outfit'), sans-serif;
    font-size: 15px; padding: 0 24px; z-index: 1001;
}

.swipe-post-body { font-size: 13.5px; line-height: 1.45; margin: 6px 0 0; color: var(--swipe-copy); }
.swipe-card .social-post-body-shell {
    text-shadow: 0 1px 3px color-mix(in srgb, var(--shadow-ink) 55%, transparent);
}
.swipe-card .social-post-body-shell.has-overflow:not(.is-expanded)::after {
    background: linear-gradient(180deg, color-mix(in srgb, var(--swipe-stage) 0%, transparent), color-mix(in srgb, var(--swipe-stage) 82%, transparent));
}
.swipe-card .social-post-body-toggle {
    background: color-mix(in srgb, var(--shadow-ink) 32%, transparent);
    border: 1px solid color-mix(in srgb, var(--on-image) 34%, transparent);
    color: var(--on-image);
    margin-top: 4px;
    padding: .35rem .7rem;
    text-shadow: 0 1px 3px color-mix(in srgb, var(--shadow-ink) 60%, transparent);
}
.swipe-card .social-post-body-toggle:hover {
    background: color-mix(in srgb, var(--shadow-ink) 45%, transparent);
    color: var(--swipe-rating);
}
.swipe-card .social-post-body-toggle:focus-visible {
    outline-color: var(--on-image);
}
.swipe-post-stack {
    position: absolute; top: 58px; right: 64px; z-index: 1001;
    background: color-mix(in srgb, var(--on-image) 14.902%, transparent); color: var(--on-image); border: 1px solid color-mix(in srgb, var(--on-image) 26.667%, transparent); border-radius: 8px;
    padding: 6px 12px; font-family: var(--font-display, 'Archivo Black'), sans-serif; font-size: 14px;
}
.swipe-card--posttext { background: radial-gradient(120% 80% at 50% 22%, var(--brand), var(--swipe-post-gradient-end) 85%); }
.swipe-post-textwrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0 26px; }
.swipe-post-text { color: var(--on-image); font-family: var(--font-display, 'Archivo Black'), sans-serif; font-size: 21px; line-height: 1.25; text-align: center; margin: 0; }
/* GH-301: a forum-backed post leads with its title, linked to the forum thread. */
.swipe-post-title { display: block; color: var(--on-image); font-family: var(--font-display, 'Archivo Black'), sans-serif; font-size: 19px; line-height: 1.25; text-align: center; margin: 0 0 10px; text-decoration: none; }
.swipe-overlay--postbyline { bottom: 24px; }

.swipe-eyebrow {
    margin: 0 0 .35rem;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent-canonical);
}
