/* ============================================================================
   Video CTA widget - bottom-right card + modal, CompanionGuide styling.
   Uses the site tokens from style.css (bg-surface, accent-blue, radius-xl...)
   so it reads as part of the site rather than as a partner banner.

   Two variants:
     .vcta            home + category pages, Ourdream gif
     .vcta--video     companion pages, random character preview video
                      (replaces .companion-floating-cta there)

   TEST: Ourdream AI on sub5=cg-vid. To remove: delete this file,
   js/video-cta-widget.js and the two tags that reference them.
   ========================================================================== */

.vcta {
    position: fixed;
    right: var(--space-5, 1.25rem);
    bottom: var(--space-5, 1.25rem);
    z-index: 9998; /* below the fixed header (999999), above page content */
    width: 210px;
    border-radius: var(--radius-xl, 12px);
    overflow: hidden;
    background-color: var(--bg-surface, #1f1f1f);
    border: 1px solid var(--border-primary, #404040);
    box-shadow: var(--shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, .4));
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    cursor: pointer;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .35s ease, transform .35s ease, border-color .2s ease, box-shadow .2s ease;
    -webkit-tap-highlight-color: transparent;
}
.vcta.is-in { opacity: 1; transform: none; }
.vcta:hover {
    border-color: var(--border-accent, #3b82f6);
    box-shadow: 0 24px 30px -6px rgba(0, 0, 0, .5);
}
.vcta:focus-visible { outline: 2px solid var(--accent-blue, #3b82f6); outline-offset: 3px; }

/* On companion pages this widget takes the floating CTA's place entirely. */
body.vcta-replaces-cta .companion-floating-cta { display: none !important; }

.vcta-media { position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden; background-color: var(--bg-tertiary, #262626); }
.vcta-media img,
.vcta-media video { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; display: block; }
.vcta-media::after {
    content: "";
    position: absolute; inset: auto 0 0 0; height: 58%;
    background: linear-gradient(to top, var(--bg-surface, #1f1f1f) 20%, rgba(31, 31, 31, .7) 56%, transparent);
    pointer-events: none;
}

.vcta-online {
    position: absolute; top: 10px; left: 10px; z-index: 2;
    display: inline-flex; align-items: center; gap: 6px;
    background-color: var(--accent-green, #10b981); color: #fff;
    font-size: .75rem; font-weight: 600; line-height: 1;
    padding: 5px 10px 5px 8px; border-radius: var(--radius-full, 9999px);
}
.vcta-online i {
    width: 6px; height: 6px; border-radius: 50%; background: #fff; display: block;
    animation: vcta-pulse 1.8s ease-in-out infinite;
}
@keyframes vcta-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.vcta-close {
    position: absolute; top: 8px; right: 8px; z-index: 3;
    width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
    background-color: rgba(10, 10, 10, .65); color: var(--text-secondary, #a3a3a3);
    cursor: pointer; display: grid; place-items: center;
    opacity: 0; transition: opacity .2s ease, color .2s ease;
}
.vcta:hover .vcta-close { opacity: 1; }
.vcta-close:hover { color: var(--text-primary, #fff); }
.vcta-close:focus-visible { opacity: 1; outline: 2px solid var(--accent-blue, #3b82f6); }

.vcta-body { position: relative; z-index: 2; margin-top: -42px; padding: 0 var(--space-4, 1rem) var(--space-3, .75rem); }
.vcta-line {
    color: var(--text-primary, #fff); font-size: .875rem; font-weight: 600;
    line-height: 1.35; margin: 0 0 var(--space-2, .5rem); text-wrap: balance;
}
.vcta-foot { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3, .75rem); }
.vcta-act { color: var(--accent-blue, #3b82f6); font-size: .8125rem; font-weight: 600; }
.vcta-free { color: var(--text-muted, #737373); font-size: .75rem; }

/* ---------------------------------------------------------------- modal --- */
.vcta-overlay {
    position: fixed; inset: 0; z-index: 10000002; /* above the sticky leaderboard */
    background-color: rgba(10, 10, 10, .8);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    display: grid; place-items: center; padding: var(--space-5, 1.25rem);
    opacity: 0; visibility: hidden; transition: opacity .22s ease, visibility .22s;
}
.vcta-overlay.is-open { opacity: 1; visibility: visible; }

.vcta-modal {
    width: min(500px, 100%); max-height: calc(100vh - 40px); overflow-y: auto;
    background-color: var(--bg-surface, #1f1f1f);
    border: 1px solid var(--border-primary, #404040);
    border-radius: var(--radius-2xl, 16px);
    box-shadow: var(--shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, .4));
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    transform: translateY(10px); transition: transform .24s ease;
}
.vcta-overlay.is-open .vcta-modal { transform: none; }

.vcta-head {
    position: relative; text-align: center;
    padding: var(--space-6, 1.5rem) var(--space-12, 3rem) var(--space-5, 1.25rem);
    background-color: var(--bg-secondary, #1a1a1a);
    border-bottom: 1px solid var(--border-secondary, #262626);
    border-radius: var(--radius-2xl, 16px) var(--radius-2xl, 16px) 0 0;
}
.vcta-eyebrow {
    margin: 0 0 var(--space-2, .5rem); color: var(--accent-blue, #3b82f6);
    font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.vcta-title {
    margin: 0 0 var(--space-2, .5rem); color: var(--text-primary, #fff);
    font-size: 1.625rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15;
    display: flex; align-items: center; justify-content: center; gap: var(--space-2, .5rem);
}
.vcta-title svg { color: var(--accent-red, #ef4444); flex: none; }
.vcta-sub { margin: 0; color: var(--text-secondary, #a3a3a3); font-size: .9375rem; }
.vcta-x {
    position: absolute; top: var(--space-4, 1rem); right: var(--space-4, 1rem);
    width: 32px; height: 32px; padding: 0; border: 1px solid var(--border-primary, #404040);
    border-radius: 50%; background-color: var(--bg-tertiary, #262626);
    color: var(--text-secondary, #a3a3a3); cursor: pointer; display: grid; place-items: center;
    transition: color .2s ease, border-color .2s ease;
}
.vcta-x:hover { color: var(--text-primary, #fff); border-color: var(--border-accent, #3b82f6); }
.vcta-x:focus-visible { outline: 2px solid var(--accent-blue, #3b82f6); outline-offset: 2px; }

.vcta-shot { display: block; padding: var(--space-5, 1.25rem) var(--space-5, 1.25rem) 0; }
.vcta-shot img,
.vcta-shot video {
    width: 100%; height: auto; display: block;
    border-radius: var(--radius-lg, 8px);
    border: 1px solid var(--border-secondary, #262626);
    background-color: var(--bg-tertiary, #262626); min-height: 110px;
}

.vcta-cta {
    display: flex; align-items: center; justify-content: center; gap: var(--space-2, .5rem);
    margin: var(--space-5, 1.25rem); padding: var(--space-4, 1rem) var(--space-6, 1.5rem);
    background-color: var(--accent-blue, #3b82f6); color: #fff;
    border-radius: var(--radius-md, 6px); font-size: 1.0625rem; font-weight: 600;
    text-decoration: none; transition: all .2s ease;
}
.vcta-cta:hover { background-color: #2563eb; transform: translateY(-1px); box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .3)); }
.vcta-cta:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.vcta-cta::after { content: none; } /* style.css appends an arrow to [target=_blank] */

.vcta-note {
    margin: 0; padding: 0 var(--space-5, 1.25rem) var(--space-6, 1.5rem);
    text-align: center; color: var(--text-muted, #737373); font-size: .875rem;
}
.vcta-note b { color: var(--accent-green, #10b981); font-weight: 600; }

@media (max-width: 600px) {
    .vcta { right: 12px; bottom: 12px; width: 164px; }
    .vcta-line { font-size: .8125rem; }
    .vcta-act { font-size: .75rem; }
    .vcta-free { font-size: .6875rem; }
    .vcta-close { opacity: 1; }
    .vcta-head { padding: var(--space-5, 1.25rem) var(--space-10, 2.5rem) var(--space-4, 1rem); }
    .vcta-title { font-size: 1.375rem; }
    .vcta-cta { font-size: .9375rem; }
}

@media (prefers-reduced-motion: reduce) {
    .vcta, .vcta-modal, .vcta-overlay, .vcta-cta { transition: none; }
    .vcta-online i { animation: none; }
}
