/* One-card-at-a-time presentation for the Services and Backup pages.
   Cards crossfade into each other (see services-scroll.js). Everything that
   hides a card is gated behind `.js-cards` so the copy stays visible and
   scrollable if the script never runs. */

.services-scroll-page {
    height: 100vh;
    min-height: 100vh;
    padding-bottom: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.services-scroll-page main {
    width: 100%;
    margin: 0;
    height: calc(100vh - 103px);
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
    padding-top: var(--services-heading-height, 172px);
    padding-bottom: 46px;              /* exact height of the fixed footer bar */
    display: flex;
    flex-direction: column;
    flex-shrink: 0;                    /* body is a flex column; don't let main
                                         collapse and open a gap above the footer */
}

.services-scroll-heading {
    position: fixed;
    top: 103px;
    left: 50%;
    width: min(100%, 1600px);
    z-index: 1000;
    transform: translateX(-50%);
    background: #2c282d;
    border-bottom: 1px solid rgba(192, 132, 252, .18);
    box-sizing: border-box;
}

.services-scroll-heading .servicestitle {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    min-height: 0;
    padding: 26px 20px 18px;
    box-sizing: border-box;
    color: #f0f0f0;
}

.services-scroll-heading picture img {
    width: 70px;
    height: auto;
    margin-bottom: 8px;
}

.services-scroll-heading .service-page-title {
    margin: 0;
    color: #f0f0f0;
    font-size: clamp(22px, 3.4vh, 32px);
    font-weight: 700;
    line-height: 1.2;
    max-width: 900px;
    text-align: center;
}

.services-scroll-heading .service-page-copy {
    max-width: 850px;
    margin: 6px auto 0;
    padding: 0;
    color: #ddd;
    line-height: 1.5;
    font-size: clamp(14px, 1.9vh, 17px);
    font-weight: normal;
}

.services-scroll {
    padding: 10px 0;                   /* small, consistent buffer above the
                                         first card and below the last card */
    flex: 1 1 auto;                    /* fill main, down to the footer */
    min-height: 0;
    display: flex;
    flex-direction: column;
    background-image: linear-gradient(0deg, rgba(145,145,145,.5) 50%, rgba(145,145,145,.5) 50%), url('../images/background2.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
}

/* Per-page section backgrounds. Same grey wash keeps the card contrast; only
   the photo behind it changes. Homepage keeps background2.jpg (base rule). */
.services-page .services-scroll {
    /* source photo is bright - use a dark wash (not the grey one) so it sits
       back behind the cards like the other sections */
    background-image: linear-gradient(0deg, rgba(20,18,24,.8) 0%, rgba(20,18,24,.8) 100%), url('../images/bg-services.webp');
}

.backup-page .services-scroll {
    /* portrait photo - fit it to the section width; height overflows and is
       cropped top/bottom (or a dark band fills a short viewport). Darker wash. */
    background-image: linear-gradient(0deg, rgba(20,18,24,.8) 0%, rgba(20,18,24,.8) 100%), url('../images/bg-backup.webp');
    background-color: #161418;
    background-size: 100% auto;
    background-position: center center;
}

.services-scroll .carousel {
    position: relative;
    margin: auto;
    overflow: hidden;
    width: min(100% - 48px, 1520px);
    max-width: 1520px;
    padding: 0;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.services-scroll .carousel-container {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: none;
    padding: 0 10px;
    counter-reset: service-card;
}

.services-scroll .carousel-container::-webkit-scrollbar {
    display: none;
}

/* A copy-heavy card can still scroll its own overflow on short screens, but
   never show a visible scrollbar - it reads as a layout bug. */
.services-scroll .carousel-card {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.services-scroll .carousel-card::-webkit-scrollbar {
    display: none;
}

.services-scroll .carousel-card {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    min-height: 100%;
    margin: 0 0 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: safe center;
    padding: clamp(28px, 4.5vw, 60px) clamp(28px, 6vw, 84px);
    padding-right: max(60px, 7vw);   /* clear the dot column on the right */
    text-align: left;
    background:
        linear-gradient(135deg,
            rgba(139, 92, 246, .17) 0%,
            rgba(139, 92, 246, .08) 42%,
            rgba(255, 255, 255, .035) 58%,
            rgba(255, 255, 255, .03) 100%);
    border: 0;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .4);
    color: #f0f0f0;
    counter-increment: service-card;
}

.services-scroll .carousel-card > picture {
    display: none;                     /* text-led cards, no legacy gear artwork */
}

/* ---- JS active: stack the cards and crossfade between them ---- */
.js-cards .services-scroll .carousel-container {
    overflow: hidden;
}

.js-cards .services-scroll .carousel-card {
    position: absolute;
    inset: 0;
    height: 100%;
    min-height: 0;
    margin: 0;
    overflow-y: auto;                  /* tall copy stays reachable on short screens */
    overscroll-behavior: contain;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .4s ease, visibility .4s ease;
}

.js-cards .services-scroll .carousel-card.is-active {
    position: absolute;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 2;
    animation: serviceCardIn .55s cubic-bezier(.22, .61, .36, 1) both;
}

@keyframes serviceCardIn {
    from { opacity: 0; transform: translateY(26px) scale(.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* The up/down arrow buttons are superseded by the vertical dot column, which is
   itself the navigation (each dot is a button). Kept in the DOM for the script
   but hidden. */
.services-scroll-controls {
    display: none;
}

/* Transient "how to navigate" hint that sits just left of the ↑/↓ controls
   and fades away the first time the visitor moves between cards. */
.services-scroll-hint {
    position: absolute;
    top: 50%;
    right: 70px;
    z-index: 6;
    max-width: 232px;
    padding: 11px 15px;
    background: rgba(28, 25, 32, .68);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(192, 132, 252, .34);
    border-radius: 9px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .34);
    color: #efecf5;
    font-size: 13px;
    line-height: 1.45;
    text-align: left;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-50%) translateX(10px);
    transition: opacity .45s ease, transform .45s ease;
}

.services-scroll-hint.is-shown {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.services-scroll-hint.is-dismissed {
    opacity: 0;
    transform: translateY(-50%) translateX(10px);
}

/* Desktop affordance only — on touch, swiping is the obvious gesture. */
@media (max-width: 700px) {
    .services-scroll-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .services-scroll-hint { transition: opacity .2s linear; transform: translateY(-50%); }
    .services-scroll-hint.is-dismissed { transform: translateY(-50%); }
}

.services-scroll-controls .carousel-btn {
    position: static;
    width: 38px;
    height: 38px;
    padding: 0;
    transform: none;
    background: rgba(44, 40, 45, .9);
    border: 1px solid rgba(192, 132, 252, .45);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.services-scroll-controls .carousel-btn:hover {
    background: rgba(66, 60, 66, .95);
}

/* Pagination dots - shows how many cards there are and which one you're on.
   Vertical column on the right edge, centred, mirroring the up/down motion. */
.services-scroll-dots {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 12px 9px;
    border-radius: 999px;
    background: rgba(28, 25, 32, .55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(192, 132, 252, .26);
}

.services-scroll-dot {
    position: relative;
    width: 10px;
    height: 10px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .32);
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}

.services-scroll-dot.is-active {
    background: #c084fc;
    transform: scale(1.45);
}

/* Tooltip: names the section a dot jumps to, on hover / keyboard focus.
   Sits to the left of the right-edge dot column, with a small pointer. */
.services-scroll-dot-tip {
    position: absolute;
    right: calc(100% + 16px);
    top: 50%;
    z-index: 20;
    max-width: none;
    padding: 4px 9px;
    border-radius: 6px;
    background: rgba(28, 25, 32, .94);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(192, 132, 252, .42);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .42);
    color: #efecf5;
    font-family: 'Noto Sans', Arial, sans-serif;
    font-size: 10px;
    font-style: normal;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: .01em;
    white-space: nowrap;
    text-align: right;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(6px);
    transition: opacity .18s ease, transform .18s ease;
}

.services-scroll-dot-tip::after {
    content: "";
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: rgba(28, 25, 32, .94);
}

.services-scroll-dot:hover .services-scroll-dot-tip,
.services-scroll-dot:focus-visible .services-scroll-dot-tip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

@media (prefers-reduced-motion: reduce) {
    .services-scroll-dot-tip { transition: opacity .12s linear; transform: translateY(-50%); }
    .services-scroll-dot:hover .services-scroll-dot-tip,
    .services-scroll-dot:focus-visible .services-scroll-dot-tip { transform: translateY(-50%); }
}

.services-scroll .carousel-card::before {
    content: counter(service-card, decimal-leading-zero);
    position: static;
    /* NOTE: with JS on, cards are display:none when inactive (mobile) which
       stops the CSS counter - services-scroll.js sets data-num and the rule
       below takes over. The counter is the no-JS fallback. */
    z-index: auto;
    width: auto;
    height: auto;
    margin-bottom: 20px;
    background: none;
    filter: none;
    border-radius: 0;
    color: #f0f0f0;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    letter-spacing: normal;
    text-shadow: 0 0 8px rgba(139, 92, 246, .45), 0 0 16px rgba(106, 56, 255, .28);
}

.js-cards .services-scroll .carousel-card[data-num]::before {
    content: attr(data-num);
}

.services-scroll .carousel-card p {
    max-width: 860px;
    margin: 0 0 22px;
    color: #ddd5e5;
    font-size: clamp(15px, 1.15vw, 19px);
    line-height: 1.6;
}

.services-scroll .carousel-card h2,
.services-scroll .carousel-card h3 {
    max-width: 1000px;
    margin: 0 0 16px;
    color: #f0f0f0;
    font-size: clamp(28px, 4vw, 60px);
    line-height: 1.08;
    text-align: left;
    text-shadow: none;
}

.services-scroll .carousel-card .questions-btn {
    display: inline-block;
    align-self: flex-start;
    margin-top: 10px;
    border: 0;
    border-radius: 3px;
    padding: 13px 20px;
    background: linear-gradient(90deg, #6a38ff 0%, #4411aa 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .02em;
    text-decoration: none;
    cursor: pointer;
}

.services-scroll .carousel-card .questions-btn:hover {
    background: #7d4dff;
    box-shadow: none;
}

/* ============================================================================
   MOBILE (<=700px): plain scrolling page - NOT viewport-locked, NO fixed
   heading, NO viewport-height math. Same shape as every other page: fixed
   header + fixed thin footer, everything else is normal flow. One card at a
   time; the page scrolls, which lets iOS Safari shrink its toolbars.
   ============================================================================ */
@media (max-width: 700px) {
    .services-scroll-page {
        height: auto;
        min-height: 100svh;
        overflow-x: hidden;
        overflow-y: visible;
    }

    /* Still a plain scrolling page, but main claims at least the space between
       the fixed header and the fixed footer and flex-fills it with the card,
       so the active card's bottom edge always meets the footer - no grey gap.
       Taller content simply grows main and the page scrolls as before. */
    .services-scroll-page main {
        height: auto;
        min-height: calc(100svh - 103px - 46px);
        overflow: visible;
        padding-top: 0;
        padding-bottom: 0;
        display: flex;
        flex-direction: column;
    }

    /* Heading: a normal centred block, not a fixed bar. */
    .services-scroll-heading {
        position: static;
        transform: none;
        left: auto;
        width: 100%;
        padding: 12px 16px;
        flex: 0 0 auto;
    }

    .services-scroll-heading picture img {
        width: 42px;
        margin-bottom: 4px;
    }

    .services-scroll-heading .service-page-title {
        font-size: clamp(17px, 4.8vw, 21px);
        line-height: 1.15;
    }

    .services-scroll-heading .service-page-copy {
        display: none;
    }

    .services-scroll,
    .services-scroll .carousel {
        width: 100%;
        overflow: visible;
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .services-scroll { padding: 10px 0; }      /* same buffer as desktop */
    .services-scroll .carousel { padding: 0; }

    /* Active card flex-fills the stage (not a fixed 62svh block that could fall
       short of the footer). Force layout/visibility so nothing from
       services.css / backup.css / the crossfade base rules can hide it. */
    .services-scroll .carousel-container,
    .js-cards .services-scroll .carousel-container {
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        flex-wrap: nowrap !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        transform: none !important;
        padding: 0 6px !important;
    }

    .js-cards .services-scroll .carousel-card,
    .services-scroll .carousel-card {
        position: static !important;
        inset: auto !important;
        display: none !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 0 0 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        animation: none !important;
        overflow: visible !important;
        border: 0 !important;
        border-radius: 4px !important;
        padding: 26px 44px 26px 20px !important;   /* right pad clears the dots */
        justify-content: center !important;
    }

    .js-cards .services-scroll .carousel-card.is-active,
    .services-scroll .carousel-card.is-active {
        display: flex !important;
        flex: 1 1 auto !important;
    }

    /* If the script never ran there is no .is-active - show them all, stacked,
       each a comfortable height. */
    html:not(.js-cards) .services-scroll .carousel-card {
        display: flex !important;
        flex: 0 0 auto !important;
        min-height: 60svh !important;
        margin-bottom: 16px !important;
    }

    .services-scroll .carousel-card::before {
        font-size: 12px;
        margin-bottom: 12px;
    }

    .services-scroll .carousel-card h2,
    .services-scroll .carousel-card h3 {
        font-size: clamp(19px, 5.6vw, 27px);
        line-height: 1.15;
        margin-bottom: 10px;
    }

    .services-scroll .carousel-card p {
        font-size: clamp(13px, 3.6vw, 15px);
        line-height: 1.5;
        margin-bottom: 16px;
    }

    .services-scroll .carousel-card .questions-btn {
        padding: 10px 16px;
        font-size: 13px;
        margin-top: 4px;
    }

    .services-scroll-dots {
        right: 8px;
        gap: 13px;
        padding: 13px 8px;
        /* drop the per-frame blur over a photo background on mobile GPUs */
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        background: rgba(28, 25, 32, .72);
    }

    .services-scroll-dot {
        width: 11px;
        height: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .js-cards .services-scroll .carousel-card {
        transition: opacity .2s linear, visibility .2s linear;
    }

    .js-cards .services-scroll .carousel-card.is-active {
        animation: none;
    }
}
