/**
 * Pollster Education — Premium Smooth Scrolling Stylesheet
 * Engineered for fluid, natural inertia, sticky-header clearance, and accessibility
 */

:root {
    --pe-scroll-header-offset: 85px;
}

@media (max-width: 991.98px) {
    :root {
        --pe-scroll-header-offset: 75px;
    }
}

/* Ensure anchor navigation clears the sticky header across all browsers */
html {
    scroll-padding-top: var(--pe-scroll-header-offset);
}

/* Lenis core integration rules */
html.lenis,
html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: clip !important;
}

.lenis.lenis-smooth iframe {
    pointer-events: none;
}

/* Ensure focus-visible elements clear sticky header when tabbed */
:target,
[id]:target {
    scroll-margin-top: var(--pe-scroll-header-offset);
}

/* Premium Scroll-to-Top Floating Button (Positioned bottom-left to avoid colliding with right-side action buttons) */
.pe-scroll-top-btn {
    position: fixed;
    left: 24px;
    right: auto;
    bottom: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #0b1a30;
    color: #ffffff;
    border: 2px solid rgba(242, 88, 34, 0.4);
    box-shadow: 0 4px 16px rgba(11, 26, 48, 0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                background 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.2s ease;
    z-index: 1030;
    outline: none;
    text-decoration: none;
}

.pe-scroll-top-btn:hover {
    background: #f25822;
    color: #ffffff;
    border-color: #f25822;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(242, 88, 34, 0.35);
}

.pe-scroll-top-btn:active {
    transform: translateY(0);
}

.pe-scroll-top-btn.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pe-scroll-top-btn:focus-visible {
    outline: 3px solid #f25822;
    outline-offset: 3px;
}

/* Accessibility: Respect Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto !important;
    }
    .pe-scroll-top-btn {
        transition: none !important;
    }
}
