/*
 * Full-screen landing page: the Vixen title, then the SIaR features one step at a
 * time, over the SIaR background video.
 */

:root {
    --ground: #05090D;
    --ink: #E4EDEE;
    --ink-soft: #A2B5BB;
    --ink-faint: #63777E;
    --accent: #22A884;
    --accent-ink: #7AD151;
    --accent-soft: rgba(34, 168, 132, 0.16);
    --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

    --ease-out: cubic-bezier(.22, 1, .36, 1);
    --step-ms: 850ms;
    --gutter: max(16px, env(safe-area-inset-left));
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: "Open Sans", Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--ground);
    -webkit-font-smoothing: antialiased;
}

/* With JavaScript: one fixed screen, stepped through with the arrow. */
.js,
.js body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

.js body {
    display: grid;
    grid-template-rows: 1fr auto;
    height: 100vh;
    height: 100dvh;
    padding-top: env(safe-area-inset-top);
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* ---- background video --------------------------------------------------- */

/* Framed as on the SIaR page: a large circle that fades out at its edge. */
.backdrop {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: -2;
    width: min(118vw, 122vh);
    aspect-ratio: 960 / 942;
    transform: translate(-50%, -50%) scale(var(--zoom, 1));
    transition: transform 1.4s var(--ease-out);
    opacity: 0.5;
    pointer-events: none;
    -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0%, #000 38%, rgba(0, 0, 0, .45) 60%, transparent 76%);
    mask-image: radial-gradient(circle at 50% 50%, #000 0%, #000 38%, rgba(0, 0, 0, .45) 60%, transparent 76%);
}

/* The poster sits behind the video, so the backdrop shows straight away even where a
   phone holds back the video until the first touch. */
.backdrop {
    background-position: center;
    background-size: cover;
}

.backdrop video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ...and the video only covers it once it has a frame to show. */
.js .backdrop video {
    opacity: 0;
    transition: opacity .4s ease;
}

.js .backdrop.has-frame video {
    opacity: 1;
}

/* Darkens the middle, where the text sits, so it reads over the brightest part of the video. */
.veil {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(ellipse 60% 45% at 50% 50%, rgba(5, 9, 13, .7), rgba(5, 9, 13, 0) 100%);
}

/* ---- slides ------------------------------------------------------------- */

.stage {
    position: relative;
    min-height: 0;
}

.slide {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px var(--gutter);
}

.js .slide {
    position: absolute;
    inset: 0;
    visibility: hidden;
    pointer-events: none;
    /* stay visible until the exit below has played */
    transition: visibility 0s linear 350ms;
}

.js .slide.is-active {
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

/*
 * Each part of a slide moves on its own, a beat apart. Coming down the list,
 * the old slide leaves upwards and the new one rises from below; going back
 * up, the same in reverse.
 */
.js .slide > * {
    opacity: 0;
    transform: translate3d(0, 48px, 0);
    transition:
        opacity calc(var(--step-ms) * .6) ease,
        transform var(--step-ms) var(--ease-out);
}

.js .slide.is-before > * {
    transform: translate3d(0, -48px, 0);
}

.js .slide.is-active > * {
    opacity: 1;
    transform: none;
}

.js .slide.is-active > :nth-child(2) { transition-delay: 90ms; }
.js .slide.is-active > :nth-child(3) { transition-delay: 180ms; }

/* Leaving slides go quickly and all at once, so they never collide with the arrival. */
.js .slide:not(.is-active) > * {
    transition-duration: 350ms;
    transition-delay: 0ms;
}

/* ---- the title screen --------------------------------------------------- */

/* The title and subtitle stay in the middle of the screen; the tagline sits in the
   space above them, so it never pushes them off centre. */
.slide-hero {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto minmax(0, 1fr);
    justify-items: center;
}

.hero-tagline { grid-row: 1; align-self: end; }
.hero-title { grid-row: 2; }
.hero-subtitle { grid-row: 3; }

/* A sentence in its own see-through box, well above the title. */
.hero-tagline {
    max-width: 30ch;
    margin: 0 0 clamp(3rem, 14vh, 9rem);
    padding: 0.6em 1em;
    border: 1px solid rgba(228, 237, 238, 0.22);
    border-radius: 16px;
    background: rgba(5, 9, 13, 0.4);
    font-size: clamp(1.4rem, 1.1rem + 1.4vmin, 2.2rem);
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: 0.01em;
    color: var(--accent-ink);
    text-wrap: balance;
}

.hero-title {
    margin: 0 0 0.35em;
    font-size: clamp(2rem, 1rem + 5vmin, 3.5rem);
    font-weight: 300;
    line-height: 1.14;
    letter-spacing: 0.9px;
    color: #fff;
    overflow-wrap: break-word;
    text-wrap: balance;
}

.hero-subtitle {
    margin: 0;
    font-size: clamp(1rem, 0.75rem + 1.5vmin, 1.3rem);
    font-weight: 300;
    line-height: 1.3;
    color: var(--ink);
    text-wrap: balance;
}

/* ---- feature screens ---------------------------------------------------- */

.feature-count {
    margin: 0 0 1.25rem;
    font-family: var(--mono);
    font-size: 0.8125rem;
    letter-spacing: 0.12em;
    color: var(--accent-ink);
}

.feature-count span {
    color: var(--ink-faint);
}

.feature-headline {
    max-width: 22ch;
    margin: 0;
    font-size: clamp(1.75rem, 0.9rem + 3.6vmin, 3rem);
    font-weight: 300;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: #fff;
    text-wrap: balance;
}

.feature-lede {
    max-width: 46ch;
    margin: 1.1rem 0 0;
    font-size: clamp(1rem, 0.9rem + 0.5vmin, 1.18rem);
    line-height: 1.55;
    color: var(--ink-soft);
    text-wrap: pretty;
}

.feature-headline code,
.feature-lede code {
    font-family: var(--mono);
    color: var(--accent-ink);
    background: var(--accent-soft);
    border-radius: 4px;
    white-space: nowrap;
}

.feature-headline code {
    padding: 0.06em 0.3em;
    font-size: 0.72em;
}

.feature-lede code {
    padding: 0.08em 0.38em;
    font-size: 0.88em;
}

.feature-lede strong {
    color: var(--ink);
    font-weight: 600;
}

/* ---- the step arrow ----------------------------------------------------- */

/* Placed by steps.js just under the visible text, and glides there on each step. */
.controls {
    display: none;
}

.js .controls {
    position: fixed;
    left: 50%;
    top: var(--arrow-y, 70%);
    z-index: 1;
    display: block;
    width: max-content;
    max-width: calc(100vw - 24px);
    transform: translateX(-50%);
}

.js .controls.is-placed {
    transition: top .6s var(--ease-out);
}

.step-button {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid rgba(228, 237, 238, 0.35);
    border-radius: 50%;
    color: #fff;
    background: rgba(5, 9, 13, 0.35);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color .2s ease, background-color .2s ease;
}

.step-button svg {
    transition: transform .5s var(--ease-out);
}

/* On the last feature the arrow turns round and takes you back to the top. */
.step-button.is-last svg {
    transform: rotate(180deg);
}

.step-button:hover {
    border-color: var(--accent);
    background: rgba(34, 168, 132, 0.15);
}

.step-button:focus-visible {
    outline: 2px solid var(--accent-ink);
    outline-offset: 4px;
}

/* Title screen: one labelled arrow down to the chooser. Chooser: one per product, side by side. Inside a story: the plain arrow. */
/* "Applications" sits above the box, aligned with its left edge; the box is lightly see-through. */
.start-box {
    padding: 16px clamp(20px, 3vw, 32px);
    border-left: 2px solid var(--accent);
    border-radius: 0 16px 16px 0; /* square on the left, so the green line runs straight */
    background: rgba(5, 9, 13, 0.28);
}

.start-heading {
    margin: 0 0 8px 2px;
    text-align: left;
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

/* One row of products side by side, each label beside its arrow (stacked on upright phones, below). */
.start-items {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: clamp(20px, 5vw, 56px);
}

.start-item {
    display: flex;
    flex: none;
    align-items: center;
    gap: 14px;
}

.step-label {
    white-space: nowrap;
    text-align: left;
    line-height: 1.35;
    font-size: 0.8125rem;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    cursor: pointer;
    user-select: none;
    transition: color .2s ease;
}

/* "Applications" on the title screen is 30% larger than the product labels. */
.apps-item .step-label {
    font-size: calc(0.8125rem * 1.3);
}

.start-item:hover .step-label {
    color: var(--ink);
}

.start-item:hover .step-button {
    border-color: var(--accent);
    background: rgba(34, 168, 132, 0.15);
}

.controls:not(.is-home) .apps-item,
.controls:not(.is-choose) .start-group,
.controls.is-home .next-button,
.controls.is-choose .next-button {
    display: none;
}

.apps-item,
.next-button,
.start-group {
    animation: appear .45s ease both;
}

@keyframes appear {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---- go home ------------------------------------------------------------ */

/* Just right of the down arrow, which stays centred under the text. Shown inside a story only. */
.home-button {
    display: none;
}

.js .home-button {
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(228, 237, 238, 0.3);
    border-radius: 50%;
    color: var(--ink);
    background: rgba(5, 9, 13, 0.45);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    opacity: 0;
    visibility: hidden;
    transform: translate(-6px, -50%);
    transition:
        opacity .4s ease,
        transform .4s var(--ease-out),
        visibility 0s linear .4s,
        border-color .2s ease,
        background-color .2s ease;
}

.js .home-button.is-shown {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%);
    transition-delay: 0s;
}

.home-button:hover {
    border-color: var(--accent);
    background: rgba(34, 168, 132, 0.15);
}

.home-button:focus-visible {
    outline: 2px solid var(--accent-ink);
    outline-offset: 4px;
}

/* ---- load bar ----------------------------------------------------------- */

/* Thin bar across the top: fills as each step plays the next part of the video. */
.loadbar {
    display: none;
}

.js .loadbar {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 2;
    display: block;
    height: 3px;
    background: rgba(228, 237, 238, 0.08);
}

.loadbar-buffered,
.loadbar-played {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    transform-origin: left center;
    transform: scaleX(var(--p, 0));
}

.loadbar-buffered {
    background: rgba(228, 237, 238, 0.14);
    transition: transform .4s ease;
}

.loadbar-played {
    transition: transform .25s linear;
    background: linear-gradient(90deg, var(--accent), var(--accent-ink));
    box-shadow: 0 0 10px rgba(122, 209, 81, 0.55);
}

/* No video to follow (save-data, or it failed to load): the bar counts steps instead. */
.no-video .loadbar-played {
    transition: transform var(--step-ms) var(--ease-out);
}

/* ---- footer ------------------------------------------------------------- */

.site-footer {
    padding: 0 var(--gutter);
    text-align: center;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.7);
}

.site-footer p {
    margin: 0;
}

.site-footer a {
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}

.site-footer a:hover,
.site-footer a:focus-visible {
    border-bottom-color: #fff;
}

.site-footer a:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* ---- screen sizes ------------------------------------------------------- */

@media (max-width: 599px) {
    /* Phones: everything tightened to fit a 320px screen. */
    .start-box {
        padding: 12px 14px;
    }

    .start-items {
        gap: 18px;
    }

    .start-item {
        gap: 10px;
    }

    .start-item .step-button {
        width: 44px;
        height: 44px;
    }

    .step-label {
        font-size: 0.75rem;
        letter-spacing: 0.02em;
    }

    .apps-item .step-label {
        font-size: calc(0.75rem * 1.3);
    }

    .slide {
        padding-left: 24px;
        padding-right: 24px;
    }
}

/* Phones held upright: the chooser's text sits higher, leaving room for the applications
   below it, stacked one per row with their arrows lined up. */
@media (max-width: 599px) and (orientation: portrait) {
    .slide-choose {
        padding-bottom: min(300px, 44vh);
    }

    .start-box {
        width: 90vw;
    }

    .start-heading {
        font-size: 0.8125rem;
    }

    .step-label {
        font-size: 0.875rem;
    }

    .apps-item .step-label {
        font-size: calc(0.875rem * 1.3);
    }

    .start-items {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* Large and 4K screens. */
@media (min-width: 1600px) and (min-height: 900px) {
    .hero-title { font-size: clamp(3.5rem, 2.5vw + 1rem, 5rem); }
    .hero-subtitle { font-size: clamp(1.3rem, 1vw + 0.3rem, 2rem); }
    .feature-headline { font-size: clamp(3rem, 2vw + 1rem, 4.25rem); }
    .feature-lede { font-size: clamp(1.18rem, 0.6vw + 0.6rem, 1.5rem); }
}

/* Landscape phones: very little height, so tighten everything. */
@media (max-height: 480px) and (orientation: landscape) {
    .slide { padding-top: 8px; padding-bottom: 8px; }
    .slide-hero { display: flex; } /* too little height to hold the title in the middle */
    .hero-tagline { max-width: 50ch; margin-bottom: 0.75rem; padding: 0.4em 0.8em; font-size: clamp(1rem, 5vh, 1.3rem); }
    .hero-title { font-size: clamp(1.75rem, 9vh, 2.5rem); margin-bottom: 0.25em; }
    .hero-subtitle { font-size: clamp(0.95rem, 4.5vh, 1.15rem); }
    .feature-count { margin-bottom: 0.5rem; }
    .feature-headline { max-width: 32ch; font-size: clamp(1.25rem, 6.5vh, 1.75rem); }
    .feature-lede { max-width: 70ch; margin-top: 0.5rem; font-size: 0.9rem; line-height: 1.45; }
    .step-button { width: 40px; height: 40px; }
    .site-footer p { display: inline; }
    .site-footer p + p::before { content: " \00b7  "; }
}

/* Phones turned sideways: the chooser's text sits at the top, with the applications lower down
   (steps.js keeps them in the middle of the screen, clear of the text). */
@media (orientation: landscape) and (max-height: 480px) {
    .js .slide-choose {
        justify-content: flex-start;
        padding-top: clamp(16px, 10vh, 120px);
    }
}

/* Without JavaScript: everything in one ordinary scrolling page. */
.no-js .slide {
    min-height: 70vh;
}

.no-js .slide-choose {
    display: none;
}

.no-js .slide-hero {
    min-height: 100vh;
}

.no-js .site-footer {
    padding-bottom: 24px;
}

@media (prefers-reduced-motion: reduce) {
    .js .slide > *,
    .js .slide.is-before > * {
        transform: none;
        transition: opacity 200ms ease;
        transition-delay: 0ms !important;
    }

    .backdrop {
        transition: none;
    }

    .js .controls,
    .js .home-button {
        transition: none;
    }

    .apps-item,
    .next-button,
    .start-group {
        animation: none;
    }

    .loadbar-buffered {
        transition: none;
    }
}

/* ---- privacy banner (both pages) ---------------------------------------- */

.consent {
    position: fixed;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 16px;
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: 12px 12px 12px 18px;
    border-left: 2px solid var(--accent);
    border-radius: 0 14px 14px 0;
    background: #0C1319;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    transform: translateX(-50%);
    animation: consent-in .4s var(--ease-out) backwards;
    transition: opacity .3s ease, transform .3s ease;
}

.consent[hidden] {
    display: none;
}

.consent.is-leaving {
    opacity: 0;
    transform: translate(-50%, 12px);
}

@keyframes consent-in {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.consent-text {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--ink-soft);
}

.consent-text a {
    margin-left: 4px;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 1px solid var(--accent);
}

.consent-text a:hover,
.consent-text a:focus-visible {
    color: #fff;
    border-bottom-color: #fff;
}

.consent-accept {
    flex: none;
    padding: 8px 18px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #fff;
    background: rgba(34, 168, 132, 0.18);
    cursor: pointer;
    transition: background-color .2s ease;
}

.consent-accept:hover {
    background: rgba(34, 168, 132, 0.35);
}

.consent-text a:focus-visible,
.consent-accept:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

@media (max-width: 599px) {
    .consent {
        width: calc(100vw - 24px);
        gap: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .consent {
        animation: none;
        transition: none;
    }
}
