/* ==========================================================================
   Viewer Corner - "BusOva Viewer" desktop-app corner fold
   --------------------------------------------------------------------------
   A folded top-right page corner (a "peel") that lifts on hover/focus to
   reveal a readable card linking to the downloads page.

   NOTE: deliberately NOT named "page-peel"/"peel" - those names match ad-
   blocker filter lists (page-peel is a known intrusive ad format) and get
   the stylesheet/element blocked for visitors running uBlock/AdBlock.

   - Fixed to the top-right viewport corner.
   - Desktop only (>= 992px): on mobile the navbar/hamburger live in this
     corner, and the pitch ("desktop app") is aimed at desktop users anyway.
   - Theme-aware (uses core colour tokens) and respects reduced-motion.
   - No clip-path with calc(): that combo can leave a 1px GPU-render sliver
     on some machines. Plain border-radius + filter:drop-shadow instead.
   ========================================================================== */

.bo-vcorner {
    position: fixed;
    top: 0;
    right: 0;
    /* Box spans the open card so the cursor can travel from fold to card
       without dropping hover. pointer-events:none keeps the empty area
       inert - only the fold and (when open) the card are interactive. */
    width: 280px;
    height: 170px;
    z-index: 1035; /* above sticky header (1020/1030), below modals (1040+) */
    pointer-events: none;
    font-family: var(--font-family-sans);
}

.bo-vcorner__link {
    position: absolute;
    inset: 0;
    display: block;
    text-decoration: none;
    color: #fff;
    border: 0;
    background: none;
    box-shadow: none;
    outline: none;
    pointer-events: none; /* children opt back in */
}

/* ---- The folded corner ("peel") - always visible ------------------------- */
.bo-vcorner__fold {
    position: absolute;
    top: 0;
    right: 0;
    width: 56px;
    height: 56px;
    pointer-events: auto;
    background: linear-gradient(135deg,
        var(--color-primary) 0%,
        var(--color-primary-hover) 100%);
    /* Top-right triangle: top-left -> top-right -> bottom-right */
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%);
            clip-path: polygon(0 0, 100% 0, 100% 100%);
    -webkit-filter: drop-shadow(-2px 2px 4px rgba(0, 0, 0, 0.28));
            filter: drop-shadow(-2px 2px 4px rgba(0, 0, 0, 0.28));
    transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                height 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                -webkit-filter 0.35s ease,
                filter 0.35s ease;
    z-index: 2;
}

/* Paper-like sheen on the upper edge */
.bo-vcorner__fold::after {
    content: "";
    position: absolute;
    inset: 0;
    -webkit-clip-path: inherit;
            clip-path: inherit;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.45) 0%,
        rgba(255, 255, 255, 0) 48%);
}

/* Resting hint icon sitting on the fold */
.bo-vcorner__hint {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.85rem;
    color: #fff;
    z-index: 3;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* ---- The revealed card --------------------------------------------------- */
.bo-vcorner__card {
    position: absolute;
    top: 0;
    right: 0;
    width: 250px;
    padding: 15px 18px 16px;
    box-sizing: border-box;
    color: #fff;
    background: linear-gradient(135deg,
        var(--color-primary) 0%,
        var(--color-primary-hover) 100%);
    border-radius: 0 0 0 14px; /* round the bottom-left only; fold caps top-right */
    -webkit-filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.28));
            filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.28));
    opacity: 0;
    transform: translateY(-10px);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 1;
}

/* ---- Open on hover / keyboard focus -------------------------------------- */
.bo-vcorner:hover .bo-vcorner__card,
.bo-vcorner:focus-within .bo-vcorner__card {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.bo-vcorner:hover .bo-vcorner__fold,
.bo-vcorner:focus-within .bo-vcorner__fold {
    width: 70px;
    height: 70px;
    -webkit-filter: drop-shadow(-5px 5px 7px rgba(0, 0, 0, 0.34));
            filter: drop-shadow(-5px 5px 7px rgba(0, 0, 0, 0.34));
}

.bo-vcorner:hover .bo-vcorner__hint,
.bo-vcorner:focus-within .bo-vcorner__hint {
    opacity: 0;
}

/* Keep card text white even though it lives inside an <a> (beat a:hover) */
.bo-vcorner__row,
.bo-vcorner__heading,
.bo-vcorner__text,
.bo-vcorner__icon {
    color: #fff;
}

.bo-vcorner__row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.bo-vcorner__icon {
    font-size: 1.55rem;
    flex: 0 0 auto;
}

.bo-vcorner__heading {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.15;
    letter-spacing: 0.2px;
}

.bo-vcorner__text {
    font-size: 0.8rem;
    line-height: 1.35;
    opacity: 0.94;
    margin-bottom: 12px;
}

.bo-vcorner__cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-primary-hover);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.bo-vcorner:hover .bo-vcorner__cta {
    background: #fff;
}

.bo-vcorner__cta .bo-vcorner__arrow {
    transition: transform 0.2s ease;
}

.bo-vcorner:hover .bo-vcorner__cta .bo-vcorner__arrow {
    transform: translateX(3px);
}

/* ---- Gentle idle hint so the corner gets noticed ------------------------- */
@media (prefers-reduced-motion: no-preference) {
    .bo-vcorner__fold {
        animation: bo-vcorner-nudge 5s ease-in-out 1.2s 3;
    }
    @keyframes bo-vcorner-nudge {
        0%, 88%, 100% { width: 56px; height: 56px; }
        94%           { width: 84px; height: 84px; }
    }
    .bo-vcorner:hover .bo-vcorner__fold,
    .bo-vcorner:focus-within .bo-vcorner__fold { animation: none; }
}

/* ---- Mobile: hand the corner back to the navbar -------------------------- */
@media (max-width: 991.98px) {
    .bo-vcorner { display: none; }
}
