/* Hallmark · built: the project · edit: site-wide glass and motion, no redesign · genre: editorial · theme: brand (MedGermany teal, blue and orange) · job: read · posture: lively, by the owner's request · copy: verbatim · nav: kept · footer: kept · v2.0.0 */
/* Hallmark · pre-emit critique: P3 H4 E4 S3 R5 V4 · weakest: S, the motion is learned from another site; it stays because the owner asked for it by name on 5 Nov, and all the words, pictures and layout stay MedGermany's */
/* Hallmark · waive: one reveal at most, the owner asked for Blissley's full set of scroll effects. Reading pages keep to one load-in, as Blissley's own do. */

/* Glass and motion, with the values measured from blissley.com on 5 Nov 2026. Rebuilt here in
   plain CSS and a small script; none of that site's code or files are used. Tokens only.
   Owner: Window 8. See docs/blog-revamp/briefs/w8-glass-and-scroll.md.
   effects.js has the off switches. */

:root {
    --fxb-height: 140px;
    --fxb-fade-height: 90px;

    --fx-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --fx-spring-tight: cubic-bezier(0.34, 1.3, 0.64, 1);
    --fx-spring-soft: cubic-bezier(0.34, 1.2, 0.64, 1);
    --fx-focus-blur: 8px;
    --fx-frost: rgba(255, 255, 255, 0.75);
    --fx-lift-shadow: 0 12px 32px -12px color-mix(in srgb, var(--mg-ink) 15%, transparent);
}

/* The two springs: stiffness 420 damping 26, and stiffness 260 damping 22. */
@supports (transition-timing-function: linear(0, 1)) {
    :root {
        --fx-spring-tight: linear(0, 0.144, 0.427, 0.703, 0.905, 1.022, 1.07, 1.074, 1.057, 1.035, 1.016, 1.003, 0.996, 0.994, 0.995, 0.996, 1);
        --fx-spring-soft: linear(0, 0.134, 0.397, 0.655, 0.851, 0.973, 1.034, 1.053, 1.049, 1.036, 1.021, 1.01, 1.003, 0.999, 0.997, 0.997, 1);
    }
}

/* A weak phone or a reader who wants less transparency: every effect stays, without the blur. */
html.fx-lite {
    --fx-focus-blur: 0px;
}

@media (max-width: 768px) {
    :root {
        --fxb-fade-height: 72px;
    }
}

/* A phone on its side has no height to give away. */
@media (max-height: 500px) {
    :root {
        --fxb-height: 0px;
        --fxb-fade-height: 0px;
    }
}

/* ---------- Bottom strip. It never takes a tap. ---------- */

.fxb {
    position: fixed;
    right: 0;
    bottom: var(--mg-dock-h, 0px);
    left: 0;
    z-index: 40;
    height: var(--fxb-height);
    pointer-events: none;
}

/* The default, and all that scripting off, no backdrop-filter, reduced transparency
   or a weak phone ever gets: a soft fade to the page colour, with no blur to pay for. */
.fxb::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: var(--fxb-fade-height);
    background: linear-gradient(to top, var(--mg-glass-bg), transparent);
    transition: opacity 0.5s linear;
}

.fxb i {
    display: none;
    position: absolute;
    inset: 0;
    transition: opacity 0.5s linear;
}

/* effects.js adds .fx-glass once the phone passes. A mask only reads alpha, so any
   opaque token works as its colour. Five layers, each 20% of the strip. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .fxb.fx-glass::before {
        display: none;
    }

    .fxb.fx-glass i {
        display: block;
    }

    .fxb.fx-glass i:nth-child(1) {
        -webkit-backdrop-filter: blur(2.4px);
        backdrop-filter: blur(2.4px);
        -webkit-mask-image: linear-gradient(to top, var(--mg-ink) 80%, transparent 100%);
        mask-image: linear-gradient(to top, var(--mg-ink) 80%, transparent 100%);
    }

    .fxb.fx-glass i:nth-child(2) {
        -webkit-backdrop-filter: blur(4.8px);
        backdrop-filter: blur(4.8px);
        -webkit-mask-image: linear-gradient(to top, var(--mg-ink) 60%, transparent 80%);
        mask-image: linear-gradient(to top, var(--mg-ink) 60%, transparent 80%);
    }

    .fxb.fx-glass i:nth-child(3) {
        -webkit-backdrop-filter: blur(7.2px);
        backdrop-filter: blur(7.2px);
        -webkit-mask-image: linear-gradient(to top, var(--mg-ink) 40%, transparent 60%);
        mask-image: linear-gradient(to top, var(--mg-ink) 40%, transparent 60%);
    }

    .fxb.fx-glass i:nth-child(4) {
        -webkit-backdrop-filter: blur(9.6px);
        backdrop-filter: blur(9.6px);
        -webkit-mask-image: linear-gradient(to top, var(--mg-ink) 20%, transparent 40%);
        mask-image: linear-gradient(to top, var(--mg-ink) 20%, transparent 40%);
    }

    .fxb.fx-glass i:nth-child(5) {
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        -webkit-mask-image: linear-gradient(to top, var(--mg-ink) 0%, transparent 20%);
        mask-image: linear-gradient(to top, var(--mg-ink) 0%, transparent 20%);
    }

    /* Frosted white once scrolled, in place of a strip under it. Even over pure black this tint
       leaves the header no darker than rgb(191, 191, 191), where the ink text holds 6.7:1. */
    @media (prefers-reduced-transparency: no-preference) {
        html:not(.fx-lite) .glass-header.header-scrolled {
            -webkit-backdrop-filter: blur(24px) saturate(1.5);
            backdrop-filter: blur(24px) saturate(1.5);
            background: var(--fx-frost);
        }
    }
}

@media (prefers-reduced-transparency: reduce) {
    .fxb.fx-glass::before {
        display: block;
    }

    .fxb.fx-glass i {
        display: none;
    }
}

/* Blue words fall to 2.9:1 on the frost over teal, so the current page and hover are ink with a line. */
.glass-header .navbar-nav .nav-link.active,
.glass-header .navbar-nav .nav-link:hover {
    color: var(--mg-ink) !important;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 6px;
}

/* Off at the footer, so the legal links stay sharp. */
.fxb.is-off {
    visibility: hidden;
    transition: visibility 0s linear 0.5s;
}

.fxb.is-off::before,
.fxb.is-off i {
    opacity: 0;
}

/* The footer stays sharp with scripting off too, because the strips pass behind it. */
.footer {
    position: relative;
    z-index: 41;
}

/* Nothing to blur behind an open form, so typing on a phone does not pay for it. */
.modal-open .fxb {
    visibility: hidden;
}

/* Links, keyboard focus and find-in-page stop clear of the header and the strip. Article headings set their
   own scroll-margin-top, which scroll-padding adds to. */
html:has(.fxb) {
    scroll-padding-top: calc(var(--mg-header-h) + 16px);
    scroll-padding-bottom: calc(var(--mg-dock-h, 0px) + var(--fxb-height));
}

/* Reading pages have no strip, as on Blissley's own reading page, so the words keep the screen.
   Delete these two rules to bring it back. */
.page-article .fxb {
    display: none;
}

html:has(.fxb):has(.page-article) {
    scroll-padding-top: 0;
    scroll-padding-bottom: var(--mg-dock-h, 0px);
}

/* ---------- Smooth scrolling, desktop only. Lenis adds .lenis to <html>. ---------- */

html.lenis,
html.lenis body {
    height: auto;
}

/* Otherwise an iframe swallows the wheel as it glides under the pointer. */
html.lenis-smooth iframe {
    pointer-events: none;
}

/* Overlays keep the wheel to themselves when they reach their end. */
html.lenis .modal,
html.lenis .news-live-results,
html.lenis .navbar-collapse {
    overscroll-behavior: contain;
}

/* ---------- Reveals on the way into view. effects.js adds these only to what starts below the
   fold, and takes them off again afterwards, so nothing stays hidden or keeps a filter. ---------- */

.fx-r {
    opacity: 0;
    translate: 0 var(--fx-y, 20px);
}

.fx-r--soft {
    filter: blur(var(--fx-b, 10px));
}

.fx-r--panel {
    --fx-y: 40px;
    --fx-b: 12px;
    --fx-t: 0.9s;
}

.fx-r.fx-in {
    opacity: 1;
    translate: 0 0;
    filter: blur(0);
    transition:
        opacity var(--fx-t, 0.8s) var(--fx-ease) var(--fx-d, 0s),
        translate var(--fx-t, 0.8s) var(--fx-ease) var(--fx-d, 0s),
        filter var(--fx-t, 0.8s) var(--fx-ease) var(--fx-d, 0s);
    will-change: opacity, translate, filter;
}

/* ---------- Everything from here runs in CSS, so it needs no script and costs no work on scroll.
   The fx-motion class on <body> is its off switch. ---------- */

@media (prefers-reduced-motion: no-preference) {
    /* First screen: the words rise in as the page opens. Fill is backwards only, so nothing
       is left holding a transform once it has finished. */
    @keyframes fx-rise {
        from {
            opacity: 0;
            translate: 0 18px;
        }
    }

    .fx-motion :is(.hero-carousel-copy, .inner-banner .caption, .library-head__grid, .guidance-contact) > * {
        animation: fx-rise 0.8s var(--fx-ease) backwards;
    }

    .fx-motion :is(.hero-carousel-copy, .inner-banner .caption, .library-head__grid, .guidance-contact) > :nth-child(2) {
        animation-delay: 0.15s;
        animation-duration: 0.7s;
    }

    .fx-motion :is(.hero-carousel-copy, .inner-banner .caption, .library-head__grid, .guidance-contact) > :nth-child(n + 3) {
        animation-delay: 0.3s;
        animation-duration: 0.7s;
    }

    /* A reading page opens as one piece, title then body, and paragraphs never animate. */
    .fx-motion .article-head,
    .fx-motion .article-column {
        animation: fx-rise 0.8s var(--fx-ease) backwards;
    }

    @supports (animation-timeline: view()) {
        /* A row comes into focus as it nears the middle of the screen, and goes out again. */
        @keyframes fx-focus {
            0%,
            100% {
                opacity: 0.25;
                filter: blur(var(--fx-focus-blur));
                scale: 0.985;
            }

            35%,
            65% {
                opacity: 1;
                filter: blur(0);
                scale: 1;
            }
        }

        /* Phones and tablets only: on a desktop the owner found it got in the way of reading. */
        @media (max-width: 991.98px) {
            .fx-motion .services-section .mobile-snap-item > .card,
            .fx-motion :is(.service-India, .service-Germany) .card-main {
                animation: fx-focus linear both;
                animation-timeline: view(block 15% 15%);
            }
        }

        /* The grid is marked as a sideways scroller, but its cards wrap into a column and it never
           scrolls. Left as it is, each card would follow the grid's scroll, which never moves, not the page's. */
        .fx-motion .services-section .mobile-snap-grid {
            overflow: visible;
        }

        /* Keyboard focus always lands on something sharp. */
        .fx-motion .services-section .mobile-snap-item > .card:focus-within,
        .fx-motion :is(.service-India, .service-Germany) .card-main:focus-within {
            animation: none;
        }

        /* Pictures drift against the scroll. effects.js clips them first. The timeline hangs on the
           picture's frame, because a frame with overflow: hidden counts as its own scroller and a
           plain view() on the picture would follow that, which never moves. */
        @keyframes fx-drift {
            from {
                translate: 0 4%;
                scale: 1.09;
            }

            to {
                translate: 0 -4%;
                scale: 1.09;
            }
        }

        .fx-drift-frame {
            view-timeline: --fx-frame block;
            view-timeline-inset: 10%;
        }

        /* This panel's hidden overflow is only for its rounded corners, and clip draws the same. */
        .fx-motion .why-choose {
            overflow: clip;
        }

        .fx-drift {
            animation: fx-drift linear both;
            animation-timeline: --fx-frame;
        }
    }

    /* The words hold still beside the rows while they go by. */
    @media (min-width: 992px) {
        .fx-motion .services-section .row > .col-md-4 {
            position: sticky;
            top: calc(var(--mg-header-h) + 16px);
            align-self: flex-start;
        }
    }

    /* ---------- Under the pointer: buttons, cards and questions lift on a spring. ---------- */
    @media (hover: hover) and (pointer: fine) {
        .fx-motion .btn-submit {
            transition: transform 0.48s var(--fx-spring-tight);
        }

        .fx-motion .btn-submit:hover {
            transform: translateY(-2px) scale(1.03);
        }

        .fx-motion .btn-submit:active {
            transform: scale(0.97);
        }

        .fx-motion :is(.card, .guide-card-modern, .testimonial-card) {
            transition:
                transform 0.59s var(--fx-spring-soft),
                box-shadow 0.59s var(--fx-spring-soft);
        }

        .fx-motion :is(.card, .guide-card-modern, .testimonial-card):hover {
            transform: translateY(-4px);
            box-shadow: var(--fx-lift-shadow);
        }

        .fx-motion .post-card__media img {
            transition: scale 0.7s var(--fx-ease);
        }

        .fx-motion .post-card:hover .post-card__media img {
            scale: 1.04;
        }

        .fx-motion .ask-questions .faq-question {
            transition: translate 0.59s var(--fx-spring-soft);
        }

        .fx-motion .ask-questions .faq-item:hover .faq-question {
            translate: 4px 0;
        }
    }
}

/* ---------- Clear glass, the owner's request of 5 Nov. Only where something rich sits behind it:
   a photograph or the teal. The fx-liquid class on <body> is its off switch. Over flat teal a blur
   shows nothing, so those pieces are tint, rim and shine only and cost nothing to draw. ---------- */

:root {
    --fx-clear-tint: color-mix(in srgb, var(--mg-glass-solid) 10%, transparent);
    --fx-clear-tint-strong: color-mix(in srgb, var(--mg-glass-solid) 20%, transparent);
    --fx-clear-shine: inset 0 1px 0 color-mix(in srgb, var(--mg-glass-solid) 18%, transparent);
}

/* Second-choice buttons on the teal. White words hold about 8:1 on this tint. The closing band's
   button stays solid white: it is the last call to action and has to be the clearest thing there. */
.fx-liquid .why-choose .btn-custom {
    border: 1px solid var(--mg-glass-rim);
    background: var(--fx-clear-tint);
    box-shadow: var(--fx-clear-shine);
    color: var(--mg-on-teal) !important;
}

.fx-liquid .why-choose .btn-custom:hover {
    border-color: var(--mg-glass-rim);
    background: var(--fx-clear-tint-strong);
    color: var(--mg-on-teal) !important;
}

/* Rows on the teal are dark glass: a white tint would drop the orange labels below 4.5:1. */
.fx-liquid .why-choose .feature {
    padding: 12px 16px;
    border: 1px solid color-mix(in srgb, var(--mg-glass-solid) 15%, transparent);
    border-radius: var(--mg-radius-md);
    background: var(--mg-glass-bg-dark);
    box-shadow: var(--fx-clear-shine);
    margin-bottom: 12px;
}

/* The words on the consultation photograph sit on a dark glass panel, solid wherever glass is off.
   The panel now carries the contrast, so the old dark wash can leave the photograph clear. */
.fx-liquid .consultaion .text-overlay {
    right: 16px;
    bottom: 16px;
    left: 16px;
    padding: 20px 24px;
    border: 1px solid var(--mg-glass-rim);
    border-radius: var(--mg-radius-lg);
    background: var(--mg-glass-solid-dark);
    box-shadow: var(--fx-clear-shine);
}

.fx-liquid .consultaion .overlay {
    display: none;
}

/* At the desktop size these words would fill a phone's photograph and cover the face in it. */
@media (max-width: 768px) {
    .fx-liquid .consultaion .text-overlay {
        right: 12px;
        bottom: 12px;
        left: 12px;
        padding: 12px 16px;
        font-size: 20px;
        line-height: 1.25;
    }
}

/* The hero's arrows sit on the teal at every width, so they need no blur either. */
.fx-liquid .hero-carousel-control {
    border-color: var(--mg-glass-rim);
    background: var(--mg-glass-bg-dark);
    box-shadow: var(--fx-clear-shine);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    @media (prefers-reduced-transparency: no-preference) {
        html:not(.fx-lite) .fx-liquid .consultaion .text-overlay {
            background: var(--mg-glass-bg-dark);
            -webkit-backdrop-filter: blur(24px) saturate(1.5);
            backdrop-filter: blur(24px) saturate(1.5);
        }

        /* Library pictures melt at the bottom. Not on phones, where they are small thumbnails
           and it would cost a blur on every card for something hardly seen. */
        @media (min-width: 769px) {
            html:not(.fx-lite) .fx-liquid .post-card:not(.post-card--feature) .post-card__media:not(.post-card__media--empty) {
                position: relative;
            }

            html:not(.fx-lite) .fx-liquid .post-card:not(.post-card--feature) .post-card__media:not(.post-card__media--empty)::after {
                content: "";
                position: absolute;
                right: 0;
                bottom: 0;
                left: 0;
                height: 35%;
                pointer-events: none;
                -webkit-backdrop-filter: blur(8px);
                backdrop-filter: blur(8px);
                -webkit-mask-image: linear-gradient(to top, var(--mg-ink) 30%, transparent);
                mask-image: linear-gradient(to top, var(--mg-ink) 30%, transparent);
            }
        }
    }
}

@media (prefers-reduced-transparency: reduce) {
    .fx-liquid .why-choose .feature,
    .fx-liquid .hero-carousel-control {
        background: var(--mg-glass-solid-dark);
    }
}

@media (prefers-reduced-motion: reduce) {
    .fxb::before,
    .fxb i,
    .fxb.is-off {
        transition: none;
    }
}

@media print {
    .fxb {
        display: none;
    }

    .fx-r {
        opacity: 1;
        translate: none;
        filter: none;
    }
}
