/* =========================================================
   QTECH SECTION RAIL
   Controlled in-page orientation component

   Large desktop:
   Floating left-side rail

   Laptop / tablet / mobile:
   Floating compact control opening upward
========================================================= */


/* =========================================================
   COMPONENT VARIABLES

   Scoped to the component so we don't add more global
   :root variables unless they are actually system-wide.
========================================================= */

.qtech-section-rail {
    --qtech-rail-width: 180px;

    z-index: 80;

    font-size: 13px;

    visibility: hidden;
    opacity: 0;

    pointer-events: none;

    transition:
        opacity 180ms ease,
        visibility 180ms ease;
}


/* JS activates the component once the tracked page
   content reaches the appropriate viewport position. */

.qtech-section-rail.is-visible {
    visibility: visible;
    opacity: 1;

    pointer-events: auto;
}


/* =========================================================
   DESKTOP HEADING
========================================================= */

.qtech-section-rail
.qtech-section-rail__heading {
    margin: 0 0 13px;

    color: var(--qtech-red);

    font-size: 10px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: .12em;

    text-transform: uppercase;
}


/* =========================================================
   LIST
========================================================= */

.qtech-section-rail
.qtech-section-rail__list {
    position: relative;

    margin: 0 !important;
    padding: 0 0 0 15px !important;

    list-style: none !important;

    border-left:
        1px solid rgba(7, 17, 31, .13);
}


.qtech-section-rail
.qtech-section-rail__list li {
    margin: 0 !important;
    padding: 0 !important;

    list-style: none !important;
}


/* =========================================================
   LINKS
========================================================= */

.qtech-section-rail
.qtech-section-rail__list a,

.qtech-section-rail
.qtech-section-rail__list a:link,

.qtech-section-rail
.qtech-section-rail__list a:visited {
    position: relative;

    display: block;

    padding: 7px 4px 7px 0;

    color: #66717d;

    font-size: 12px;
    line-height: 1.35;
    font-weight: 600;

    text-decoration: none;

    transition:
        color 160ms ease,
        transform 160ms ease,
        background-color 160ms ease;
}


/* =========================================================
   ACTIVE MARKER
========================================================= */

.qtech-section-rail
.qtech-section-rail__list a::before {
    content: "";

    position: absolute;

    left: -16px;
    top: 50%;

    width: 3px;
    height: 0;

    background: var(--qtech-red);

    border-radius: 99px;

    transform:
        translateY(-50%);

    transition:
        height 160ms ease;
}


.qtech-section-rail
.qtech-section-rail__list a.is-active {
    color: var(--qtech-navy);

    font-weight: 700;
}


.qtech-section-rail
.qtech-section-rail__list a.is-active::before {
    height: 22px;
}


/* =========================================================
   HOVER / KEYBOARD
========================================================= */

.qtech-section-rail
.qtech-section-rail__list a:hover {
    color: var(--qtech-navy);

    transform:
        translateX(2px);
}


.qtech-section-rail
.qtech-section-rail__list a:focus-visible {
    color: var(--qtech-navy);

    outline:
        2px solid var(--qtech-red);

    outline-offset: 3px;

    border-radius: 2px;
}


/* =========================================================
   COMPACT TOGGLE
   Hidden on large desktop
========================================================= */

.qtech-section-rail
.qtech-section-rail__toggle {
    display: none;
}


/* =========================================================
   AUTOMATIC RAIL TARGET

   JS adds this class to every valid destination.
========================================================= */

.qtech-rail-target {
    scroll-margin-top: 145px;
}


/* =========================================================
   LARGE DESKTOP

   Original floating card treatment.
========================================================= */

@media (min-width: 1600px) {

    .qtech-section-rail {
        position: fixed;

        top: 142px;

        left: max(
            24px,
            calc(50vw - 800px)
        );

        width:
            var(--qtech-rail-width);

        padding:
            17px 15px 18px;

        background:
            rgba(247, 245, 241, .94);

        border:
            1px solid rgba(7, 17, 31, .08);

        border-radius: 9px;

        box-shadow:
            0 6px 20px
            rgba(7, 17, 31, .045);

        backdrop-filter:
            blur(8px);

        -webkit-backdrop-filter:
            blur(8px);
    }

}


/* =========================================================
   LAPTOP / TABLET / MOBILE

   Floating current-section control.
   Opens upward and does not compete with the site header.
========================================================= */

@media (max-width: 1599px) {

    .qtech-section-rail {
        position: fixed !important;

        left: 20px !important;
        right: auto !important;

        top: auto !important;
        bottom: 20px !important;

        width:
            min(
                360px,
                calc(100vw - 40px)
            ) !important;

        background:
            var(--qtech-light) !important;

        border:
            1px solid
            rgba(7, 17, 31, .12) !important;

        border-radius:
            9px !important;

        box-shadow:
            0 8px 26px
            rgba(7, 17, 31, .13) !important;

        overflow:
            visible !important;

        z-index: 999;
    }


    /* ---------------------------------------------
       Desktop heading
    --------------------------------------------- */

    .qtech-section-rail
    .qtech-section-rail__heading {
        display: none !important;
    }


    /* ---------------------------------------------
       Toggle
    --------------------------------------------- */

    .qtech-section-rail
    .qtech-section-rail__toggle {
        position: relative;

        width: 100% !important;
        min-height: 48px;

        padding:
            9px 46px
            9px 16px !important;

        display: grid !important;

        grid-template-columns:
            auto minmax(0, 1fr);

        align-items: center;

        column-gap: 12px;

        background:
            transparent !important;

        border:
            0 !important;

        border-radius:
            9px !important;

        color:
            var(--qtech-navy) !important;

        text-align: left;

        cursor: pointer;
    }


    /* ---------------------------------------------
       Small "Jump To" label
    --------------------------------------------- */

    .qtech-section-rail
    .qtech-section-rail__toggle-label {
        color:
            var(--qtech-red);

        font-size: 9px;
        line-height: 1;
        font-weight: 700;
        letter-spacing: .10em;

        text-transform: uppercase;
    }


    /* ---------------------------------------------
       Current section
    --------------------------------------------- */

    .qtech-section-rail
    .qtech-section-rail__current {
        min-width: 0;

        overflow: hidden;

        color:
            var(--qtech-navy);

        font-size: 13px;
        line-height: 1.25;
        font-weight: 700;

        white-space: nowrap;

        text-overflow:
            ellipsis;
    }


    /* ---------------------------------------------
       Chevron
    --------------------------------------------- */

    .qtech-section-rail
    .qtech-section-rail__chevron {
        position: absolute;

        right: 17px;
        top: 50%;

        width: 8px;
        height: 8px;

        border-left:
            2px solid var(--qtech-red);

        border-top:
            2px solid var(--qtech-red);

        transform:
            translateY(-25%)
            rotate(45deg);

        transition:
            transform 180ms ease;
    }


    .qtech-section-rail.is-open
    .qtech-section-rail__chevron {
        transform:
            translateY(-75%)
            rotate(225deg);
    }


    /* ---------------------------------------------
       Dropdown
    --------------------------------------------- */

    .qtech-section-rail
    .qtech-section-rail__list {
        position: absolute;

        left: -1px;
        right: -1px;

        bottom:
            calc(100% + 8px);

        display: none;

        max-height:
            min(60vh, 440px);

        overflow-y: auto;

        margin: 0 !important;

        padding:
            8px !important;

        background:
            var(--qtech-light) !important;

        border:
            1px solid
            rgba(7, 17, 31, .12) !important;

        border-radius:
            9px !important;

        box-shadow:
            0 10px 30px
            rgba(7, 17, 31, .14);

        list-style:
            none !important;
    }


    .qtech-section-rail.is-open
    .qtech-section-rail__list {
        display: block;
    }


    /* ---------------------------------------------
       Compact links
    --------------------------------------------- */

    .qtech-section-rail
    .qtech-section-rail__list a,

    .qtech-section-rail
    .qtech-section-rail__list a:link,

    .qtech-section-rail
    .qtech-section-rail__list a:visited {
        position: relative;

        display: block;

        padding:
            10px 12px !important;

        color: #687481;

        border:
            0 !important;

        border-radius: 5px;

        font-size: 13px;
        line-height: 1.3;
        font-weight: 600;

        text-decoration: none;

        transform: none;
    }


    .qtech-section-rail
    .qtech-section-rail__list a:hover,

    .qtech-section-rail
    .qtech-section-rail__list a:focus-visible {
        background:
            rgba(7, 17, 31, .045);

        color:
            var(--qtech-navy);

        transform: none;
    }


    /* ---------------------------------------------
       Active compact item
    --------------------------------------------- */

    .qtech-section-rail
    .qtech-section-rail__list a.is-active {
        padding-left:
            22px !important;

        background:
            rgba(166, 25, 46, .055);

        color:
            var(--qtech-navy);

        font-weight: 700;
    }


    .qtech-section-rail
    .qtech-section-rail__list a::before {
        display: none;
    }


    .qtech-section-rail
    .qtech-section-rail__list
    a.is-active::before {
        content: "";

        position: absolute;

        display: block;

        left: 10px;
        top: 50%;

        width: 3px;
        height: 18px;

        background:
            var(--qtech-red);

        border-radius: 99px;

        transform:
            translateY(-50%);
    }


    /* Floating control no longer requires a large
       sticky-header anchor offset. */

    .qtech-rail-target {
        scroll-margin-top: 30px;
    }

}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 767px) {

    .qtech-section-rail {
        left: 12px !important;
        bottom: 12px !important;

        width:
            calc(100vw - 24px) !important;
    }


    .qtech-section-rail
    .qtech-section-rail__toggle {
        min-height: 46px;

        padding-left:
            14px !important;
    }


    /*
     * Current section alone is enough on a phone.
     */

    .qtech-section-rail
    .qtech-section-rail__toggle-label {
        display: none;
    }


    .qtech-section-rail
    .qtech-section-rail__current {
        font-size: 12px;
    }


    .qtech-section-rail
    .qtech-section-rail__list a,

    .qtech-section-rail
    .qtech-section-rail__list a:link,

    .qtech-section-rail
    .qtech-section-rail__list a:visited {
        padding-top:
            11px !important;

        padding-bottom:
            11px !important;

        font-size: 13px;
    }

}


/* =========================================================
   REDUCED MOTION

   Respect user's operating-system accessibility preference.
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .qtech-section-rail,
    .qtech-section-rail *,
    .qtech-section-rail *::before,
    .qtech-section-rail *::after {
        transition-duration:
            0.01ms !important;

        animation-duration:
            0.01ms !important;

        animation-iteration-count:
            1 !important;
    }

}
