/* ============================================================
   OnlyPedia — Immersive Feed (full-screen vertical creator feed)
   Mobile-first. The overlay is a dark surface over media, so it
   stays dark regardless of the site theme; text is white on a
   bottom gradient. Namespaced .opim-* + .op-immersive-fab.
   ============================================================ */

/* Safe-area insets as variables so a single JS override can neutralise them on
   browsers that report them wrong. Default = the real (capped) env() values;
   DuckDuckGo-on-Android inflates env() → op-immersive.js zeroes these there. */
:root {
    /* Default = a TIGHT cap, safe for Android (incl. DuckDuckGo, which folds its
       toolbars into env and over-reports). It still clears the Android status /
       gesture bars. iOS needs the real notch/home-indicator insets → op-immersive.js
       loosens the cap only there (iOS is reliably detectable; DDG is not). */
    --opim-sat: min(env(safe-area-inset-top, 0px), 28px);
    --opim-sab: min(env(safe-area-inset-bottom, 0px), 28px);
}

/* Lock background scroll while the feed is open */
html.opim-lock,
body.opim-lock {
    overflow: hidden !important;
    overscroll-behavior: none;
}

/* ── Root overlay ─────────────────────────────────────────── */
.opim-root {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #000;
    display: none;
    color: #fff;
    font-family: var(--op-font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    -webkit-tap-highlight-color: transparent;
}
.opim-root.is-open { display: block; }

/* ── Top bar (close) ──────────────────────────────────────── */
.opim-topbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: calc(var(--opim-sat) + 14px) 16px 34px;
    background: linear-gradient(to bottom, rgba(0,0,0,.5), rgba(0,0,0,0));
    pointer-events: none;
}
/* Semi-transparent OnlyPedia wordmark, top-left, same font as the header */
.opim-brand {
    pointer-events: none;
    font-family: 'Special Gothic Expanded One', var(--op-font-body, sans-serif);
    font-size: 19px;
    line-height: 1;
    letter-spacing: -.02em;
    color: rgba(255,255,255,.7);
}
.opim-brand__r {
    font-family: var(--op-font-body, sans-serif);
    font-size: 0.48em;
    font-weight: 600;
    position: relative;
    top: -0.55em;          /* small, tight superscript hugging the wordmark */
    margin-left: 0.5px;
    opacity: .8;
}
.opim-close {
    pointer-events: auto;
    width: 48px; height: 48px;
    margin: -6px -8px -6px 0;          /* enlarge tap area without pushing layout */
    display: flex; align-items: center; justify-content: center;
    border: 0;
    background: transparent;           /* no box, no shadow — just the icon */
    color: #fff;
    cursor: pointer;
}
.opim-close svg { width: 38px; height: 38px; }
.opim-close:active { transform: scale(.9); }

/* ── Vertical scroller ────────────────────────────────────── */
.opim-scroll {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.opim-scroll::-webkit-scrollbar { display: none; }
.opim-scroll { scrollbar-width: none; }

/* ── One creator per screen ───────────────────────────────── */
.opim-slide {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
    background: #0a0a0f;
}

/* ── Horizontal gallery ───────────────────────────────────── */
.opim-gallery { position: absolute; inset: 0; }
.opim-track {
    display: flex;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}
.opim-track::-webkit-scrollbar { display: none; }
.opim-track { scrollbar-width: none; }
.opim-media {
    position: relative;
    min-width: 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    background: #0a0a0f;
}
.opim-media img,
.opim-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #14141c;
}

/* ── Gallery bullets (TikTok style) — sit just above the badges ── */
.opim-bullets {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    pointer-events: none;
}
.opim-bullet {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,.38);
    box-shadow: 0 1px 3px rgba(0,0,0,.35);
    transition: background .2s ease, transform .2s ease;
}
.opim-bullet.is-on { background: #fff; transform: scale(1.15); }

/* ── Legibility gradient ──────────────────────────────────── */
.opim-shade {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 72%;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(to top,
        rgba(0,0,0,.88) 0%,
        rgba(0,0,0,.6) 30%,
        rgba(0,0,0,.15) 68%,
        rgba(0,0,0,0) 100%);
}

/* ── Info + CTA ───────────────────────────────────────────── */
.opim-info {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 4;
    padding: 0 18px calc(var(--opim-sab) + 24px);
    /* Let swipes over the name/stats block fall through to the gallery beneath,
       so horizontal (and vertical) swiping works anywhere on screen. Only the
       CTA re-enables pointer events below. */
    pointer-events: none;
}
.opim-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
/* "Trending" badge — same treatment as the site's .lv-trending pill */
.opim-badge--trending {
    font-family: 'Special Gothic Expanded One', var(--op-font-body, sans-serif);
    font-weight: 400;
    font-size: 11px;
    letter-spacing: .3px;
    color: #fff;
    padding: 5px 11px;
    border-radius: 20px;
    background: linear-gradient(-45deg, #ff5858, #f857a6, #f857a6, #ff5858);
    background-size: 400% 400%;
    animation: opim-grad 4s ease infinite;
}
/* "HOT" badge — CPC widget creatives (orange/red, matches .cat-hot-badge). */
.opim-badge--hot {
    font-family: 'Special Gothic Expanded One', var(--op-font-body, sans-serif);
    font-weight: 400;
    font-size: 11px;
    letter-spacing: .3px;
    color: #fff;
    padding: 5px 11px;
    border-radius: 20px;
    background: linear-gradient(-45deg, #ff9500, #ff2d55, #ff2d55, #ff9500);
    background-size: 400% 400%;
    animation: opim-grad 4s ease infinite;
}
@keyframes opim-grad {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.opim-price {
    font-family: 'Special Gothic Expanded One', var(--op-font-body, sans-serif);
    font-weight: 400;
    font-size: 11px;
    letter-spacing: .3px;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--op-accent, #e11d74);
    color: #fff;
}
.opim-price--free {
    /* Acid green with a touch of lime/yellow, animated like our other gradients */
    background-color: #a3e635;
    background-image: linear-gradient(-45deg, #bef264, #a3e635, #4ade80, #bef264);
    background-size: 400% 400%;
    animation: opim-of-flow 4s ease infinite;
    color: #063d17;                   /* dark text for punch on the bright gradient */
}
.opim-name {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -.02em;
    text-shadow: 0 2px 12px rgba(0,0,0,.5);
}
.opim-user {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,.82);
    text-shadow: 0 1px 8px rgba(0,0,0,.5);
}
.opim-verified {
    width: 16px; height: 16px;
    flex-shrink: 0;
    vertical-align: middle;
}
.opim-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 10px;
    font-size: 13px;
    color: rgba(255,255,255,.8);
}
.opim-stat b { color: #fff; font-weight: 800; }

.opim-cta {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-top: 18px;
    pointer-events: auto;   /* buttons stay tappable inside the pass-through info */
}
.opim-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 48px;
    padding: 0 20px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform .12s ease, opacity .2s ease;
}
.opim-btn:active { transform: scale(.97); }

/* Blue "dynamic" OnlyFans CTA (matches the site's #03aff0→#0362f0 gradient) */
.opim-btn--of {
    flex: 1 1 auto;
    /* Dynamic animated blue gradient — same treatment as the single-creator CTA */
    background: linear-gradient(-45deg, #00AFF0, #00D2FF, #009BD9, #00AFF0);
    background-size: 400% 400%;
    animation: opim-of-flow 4s ease infinite;
    box-shadow: 0 8px 22px rgba(3,175,240,.34);
}
/* Keep the label white in every state (beat any themed :visited link colour) */
.opim-btn--of,
.opim-btn--of:link,
.opim-btn--of:visited,
.opim-btn--of:hover,
.opim-btn--of:active { color: #fff; }
@keyframes opim-of-flow {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.opim-btn__of {
    display: inline-flex;
    width: 22px; height: 22px;
    align-items: center;
    justify-content: center;
}
.opim-btn__of svg { width: 22px; height: 15px; }

/* Ghost = round icon-only "open profile" */
.opim-btn--ghost {
    flex: 0 0 auto;
    width: 48px;
    padding: 0;
    background: rgba(255,255,255,.15);
    color: #fff;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ── Loader + hint ────────────────────────────────────────── */
.opim-loader {
    position: absolute;
    left: 50%; bottom: calc(var(--opim-sab) + 92px);
    transform: translateX(-50%);
    z-index: 5;
}
.opim-spin {
    display: block;
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,.25);
    border-top-color: #fff;
    animation: opim-spin .8s linear infinite;
}
@keyframes opim-spin { to { transform: rotate(360deg); } }

.opim-hint {
    position: absolute;
    left: 50%; bottom: calc(var(--opim-sab) + 130px);
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    animation: opim-bob 1.4s ease-in-out infinite;
}
.opim-hint__ar { font-size: 15px; font-weight: 800; }
@keyframes opim-bob {
    0%, 100% { transform: translate(-50%, 0); }
    50%      { transform: translate(-50%, -6px); }
}

/* ============================================================
   Floating action button (contextual entry point)
   Mobile only, clears the fixed bottom tab bar.
   ============================================================ */
.op-immersive-fab {
    position: fixed;
    right: 14px;
    bottom: calc(var(--op-tabbar-h, 68px) + var(--opim-sab) + 14px);
    z-index: 900;
    width: 52px; height: 52px;
    aspect-ratio: 1 / 1;
    display: none !important;           /* desktop: force-hidden (beats parent button resets); shown on mobile below */
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50% !important;      /* guard against theme button resets */
    /* Animated pink→orange gradient (same family as our other gradients), opaque
       in both themes. background-color is the solid fallback; background-image is
       !important to beat the parent theme's transparent button reset, while
       background-position is left to the animation. */
    background-color: #e11d74 !important;
    background-image: linear-gradient(-45deg, #e11d74, #ff6a3d, #f857a6, #e11d74) !important;
    background-size: 400% 400% !important;
    background-position: 0% 50%;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(225,29,116,.42);
    -webkit-tap-highlight-color: transparent;
    transition: bottom .3s ease;
    animation: opim-fab-grad 5s ease infinite, opim-fab-breathe 2.8s ease-in-out infinite;
}
/* Single-creator pages: when the floating OnlyFans CTA slides in, lift the FAB
   above it so it doesn't cover the CTA (class toggled from JS). */
.op-immersive-fab.op-immersive-fab--raised {
    bottom: calc(var(--op-tabbar-h, 68px) + var(--opim-sab) + 74px);
}
.op-immersive-fab svg {
    position: relative;
    z-index: 1;
    width: 23px; height: 23px;
    color: #fff !important;     /* crisp white icon in both themes */
}
.op-immersive-fab:active { transform: scale(.92); }

@keyframes opim-fab-grad {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes opim-fab-breathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

/* Raised above the coach dimmer while the one-time hint shows */
.op-immersive-fab.is-coached {
    z-index: 100001;
    box-shadow: 0 0 0 4px rgba(225,29,116,.4), 0 6px 20px rgba(0,0,0,.4);
    animation: opim-fab-grad 5s ease infinite, opim-fab-pulse 1.05s ease-in-out infinite;
}
@keyframes opim-fab-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.1); }
}

@media (max-width: 900px) {
    .op-immersive-fab { display: flex !important; }
}

/* ── One-time coach mark ──────────────────────────────────── */
.opim-coach {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0,0,0,.55);
    opacity: 0;
    transition: opacity .25s ease;
}
.opim-coach.is-on { opacity: 1; }
.opim-coach__tip {
    position: fixed;
    max-width: 200px;
    padding: 9px 13px;
    border-radius: 12px;
    background: #fff;
    color: #14141c;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    text-align: right;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.opim-coach__tip::after {
    content: "";
    position: absolute;
    right: 16px; bottom: -7px;
    border: 7px solid transparent;
    border-top-color: #fff;
    border-bottom: 0;
}

/* Empty state (no creators / data issue) — never a black void */
.opim-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    text-align: center;
    color: rgba(255,255,255,.85);
}
.opim-empty p { margin: 0; font-size: 16px; font-weight: 600; }
.opim-empty__row { display: flex; gap: 10px; }
.opim-empty__btn {
    border: 0;
    padding: 11px 22px;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.opim-empty__retry {
    background: linear-gradient(135deg, #03aff0, #0362f0);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .opim-hint,
    .op-immersive-fab,
    .op-immersive-fab::before,
    .op-immersive-fab.is-coached { animation: none; }
    .opim-btn, .opim-close { transition: none; }
}
