/* ==========================================================================
   Motion across the site (October 2026, version 2)
   Everything here switches off for visitors who ask their device for reduced motion.
   The motion classes are added by js/motion.js, so every page reads normally without it.
   ========================================================================== */

/* 1. Sections rise into view as you scroll (once) */
.reveal {
    opacity: 0;
    transform: translateY(36px);
    transition: opacity 1.1s ease, transform 1.1s cubic-bezier(0.2, 0.65, 0.2, 1);
    transition-delay: var(--reveal-delay, 0s);
}

.reveal.is-in {
    opacity: 1;
    transform: none;
}

/* 2. Accent lines that draw themselves from left to right */
.draw-line {
    position: relative;
    border-bottom-color: transparent !important;
}

.draw-line::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(var(--line-w, 2px) * -1);
    height: var(--line-w, 2px);
    background: var(--line-color, var(--color-primary));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 1.4s cubic-bezier(0.65, 0, 0.35, 1) 0.15s;
}

.draw-line.is-in::after {
    transform: scaleX(1);
}

/* 3. Slowly flowing lines behind the home headline, page headers and navy bands */
.has-flow {
    position: relative;
    overflow: hidden;
}

.has-flow > .container {
    position: relative;
    z-index: 1;
}

.flow-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* 4. The home headline: words rise in one after another.
   The headline waits hidden until the script splits it into words; if the script
   never runs, it appears on its own after two seconds. */
.hero-title:not(.words-ready) {
    opacity: 0;
    animation: heroTitleFallback 0.6s ease 2s forwards;
}

@keyframes heroTitleFallback {
    to {
        opacity: 1;
    }
}

.hero-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.45em);
    animation: heroWordIn 0.9s cubic-bezier(0.2, 0.65, 0.2, 1) forwards;
    animation-delay: calc(var(--i) * 110ms + 300ms);
}

@keyframes heroWordIn {
    to {
        opacity: 1;
        transform: none;
    }
}

/* 5. Figures that count up */
.count-up {
    position: relative;
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

.count-live {
    display: none;
}

.count-up.is-counting .count-ghost {
    visibility: hidden;
}

.count-up.is-counting .count-live {
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    white-space: nowrap;
}

/* 6. Band of figures on the home page */
.figures-band {
    padding: var(--space-4xl) 0;
    background: var(--color-primary);
    color: #fff;
}

.figures-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2xl) var(--space-xl);
}

@media (min-width: 1024px) {
    .figures-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0;
    }
}

.figure {
    position: relative;
}

@media (min-width: 1024px) {
    .figure {
        padding: 0 var(--space-xl);
    }
    .figure:first-child {
        padding-left: 0;
    }
}

@media (min-width: 1024px) {
    .figure + .figure::before {
        content: '';
        position: absolute;
        left: 0;
        top: 8%;
        bottom: 8%;
        width: 1px;
        background: rgba(255, 255, 255, 0.25);
        transform: scaleY(0);
        transform-origin: top center;
        transition: transform 1.2s cubic-bezier(0.65, 0, 0.35, 1) 0.4s;
    }
    .figure.is-in + .figure.is-in::before,
    .figures-grid.lines-in .figure + .figure::before {
        transform: scaleY(1);
    }
}

.figure-number {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 1.6rem + 2.6vw, 4.2rem);
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    color: #fff;
    margin-bottom: var(--space-md);
}

.figure-label {
    font-size: var(--text-sm);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.75);
    max-width: 240px;
}

/* 7. Moving strip of organisation names */
.names-strip {
    padding: 32px 0 25px;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    overflow: hidden;
}

.names-strip-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-text-muted);
    line-height: 1;
    margin: 0;
}

@media (max-width: 767px) {
    .names-strip {
        padding: 24px 0 22px;
    }
    .names-strip-label {
        line-height: 1.5;
    }
    .names-strip .names-viewport {
        margin-top: 8px;
    }
}

.names-strip-label .nowrap {
    white-space: nowrap;
}

.names-viewport {
    margin-top: 14px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%);
}

.names-track {
    display: flex;
    width: max-content;
    animation: namesScroll var(--names-duration, 70s) linear infinite;
}

.names-viewport:hover .names-track {
    animation-play-state: paused;
}

.names-list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.names-list li {
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.75rem);
    color: var(--color-primary);
    white-space: nowrap;
    line-height: 1.2;
    padding: 0 var(--space-xl);
    position: relative;
}

.names-list li::after {
    content: '';
    position: absolute;
    right: -3px;
    top: 50%;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-radius: 50%;
    background: var(--color-accent);
    opacity: 0.6;
}

@keyframes namesScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* 8. Photos that move slightly slower than the page */
.parallax-img {
    translate: 0 var(--parallax, 0px);
    will-change: translate;
}

/* 9. Reading line along the bottom of the menu bar on long pages */
.reading-line {
    position: absolute;
    left: 0;
    bottom: -1px;
    height: 3px;
    width: 100%;
    background: var(--color-accent);
    transform: scaleX(0);
    transform-origin: left center;
    pointer-events: none;
}

/* 10. Small hover touches */
.nudge-arrow {
    display: inline-block;
    margin-left: 0.35em;
    transition: transform 0.3s ease;
}

a:hover .nudge-arrow,
a:focus-visible .nudge-arrow {
    transform: translateX(5px);
}

.research-image img,
.research-intro-image img,
.thought-leadership-image img,
.contact-image img,
.speaking-image img,
.about-image-wrapper img {
    transition: transform 0.6s ease, box-shadow 0.6s ease;
}

.research-image img:hover,
.research-intro-image img:hover,
.thought-leadership-image img:hover,
.contact-image img:hover,
.speaking-image img:hover,
.about-image-wrapper img:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.site-header.is-scrolled {
    box-shadow: 0 6px 24px rgba(26, 54, 93, 0.08);
}

/* 11. A soft fade between pages (browsers that support it) */
@view-transition {
    navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.35s;
}

/* Visitors who ask for reduced motion see everything still */
@media (prefers-reduced-motion: reduce) {
    .reveal,
    .reveal.is-in {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .draw-line::after,
    .figure + .figure::before {
        transform: none !important;
        transition: none;
    }
    .hero-title:not(.words-ready),
    .hero-word {
        opacity: 1;
        transform: none;
        animation: none;
    }
    .names-track {
        animation: none;
        flex-wrap: wrap;
        width: auto;
    }
    .names-list {
        flex-wrap: wrap;
    }
    .names-viewport {
        -webkit-mask-image: none;
        mask-image: none;
        max-width: var(--container-max);
        margin: 0 auto;
        padding: 0 var(--space-lg);
    }
    .names-list {
        margin-left: calc(var(--space-xl) * -1);
    }
    @media (min-width: 768px) {
        .names-viewport {
            padding: 0 var(--space-2xl);
        }
    }
    .parallax-img {
        translate: none;
    }
    .reading-line {
        display: none;
    }
    .nudge-arrow,
    .research-image img,
    .research-intro-image img,
    .thought-leadership-image img,
    .contact-image img,
    .speaking-image img,
    .about-image-wrapper img {
        transition: none;
    }
    @view-transition {
        navigation: none;
    }
}

@media print {
    .reveal {
        opacity: 1 !important;
        transform: none !important;
    }
    .flow-canvas,
    .reading-line {
        display: none;
    }
}
