/**
 * TechRealm Scroll HUD
 * A self-contained scroll-progress bar + circular back-to-top control.
 * Brand-matched to the Bringer color scheme (uses --bringer-s-* vars with fallbacks).
 * Author: TechRealm
 */

/* Top scroll-progress bar */
.tr-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    transform: scaleX(0);
    transform-origin: 0 50%;
    background: linear-gradient(
        90deg,
        var(--bringer-s-accent, #3F6EE9),
        var(--bringer-s-text-accent, #5C9DFF)
    );
    box-shadow: 0 0 10px var(--bringer-s-text-accent, #5C9DFF);
    z-index: 2000;
    pointer-events: none;
    will-change: transform;
}

/* Floating circular back-to-top button */
.tr-backtotop {
    position: fixed;
    left: 26px;
    bottom: 26px;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border: none;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    background: var(--bringer-s-container-frosted, #1A1D24EE);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--bringer-s-heading, #F5F7FA);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.9);
    transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
}

.tr-backtotop.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.tr-backtotop:hover {
    transform: translateY(-3px) scale(1.05);
}

.tr-backtotop:focus-visible {
    outline: 2px solid var(--bringer-s-text-accent, #5C9DFF);
    outline-offset: 3px;
}

/* Progress ring drawn behind the arrow */
.tr-backtotop svg.tr-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}

.tr-backtotop .tr-ring-track {
    fill: none;
    stroke: var(--bringer-s-border, #F5F7FA27);
    stroke-width: 3;
}

.tr-backtotop .tr-ring-fill {
    fill: none;
    stroke: var(--bringer-s-text-accent, #5C9DFF);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
}

/* Arrow glyph */
.tr-backtotop .tr-arrow {
    position: relative;
    z-index: 1;
    width: 18px;
    height: 18px;
    display: block;
    transition: transform 0.25s ease;
}

.tr-backtotop:hover .tr-arrow {
    transform: translateY(-2px);
}

@media (max-width: 600px) {
    .tr-backtotop {
        left: 16px;
        bottom: 16px;
        width: 46px;
        height: 46px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tr-scroll-progress,
    .tr-backtotop,
    .tr-backtotop .tr-arrow,
    .tr-backtotop .tr-ring-fill {
        transition: none;
    }
}
