/*
 * The home page since the pivot of 2026-11-24: the splash, a slow fan of violet light rising beneath the
 * Owner's locked title, then one section about a viewport tall for each service, each lit by its own
 * object in its own hue. Spec: Design/pivot-2026-11-24/DESIGN.md, section 7.
 */

/* ---------- Splash: the first viewport ---------- */

.home-splash {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding: calc(var(--header-height) + var(--space-7)) var(--page-gutter) var(--space-9);
    overflow: hidden;
    isolation: isolate;
    background: var(--color-ink) url("../images/posters/splash-violet-fan-poster.webp") 50% 100% / cover no-repeat;
}

/* The rays always rise from the bottom centre */
.home-splash-video {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 100%;
    opacity: 0;
    transition: opacity var(--duration-slow) var(--ease-out);
}

.home-splash-video.is-playing {
    opacity: 1;
}

/* A calm fade behind the header, and a solid fade that melts the splash into the first service */
.home-splash::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(7, 6, 11, 0.55) 0%, rgba(7, 6, 11, 0) 30%),
        linear-gradient(0deg, var(--color-ink) 0%, rgba(7, 6, 11, 0) 22%);
    pointer-events: none;
}

/* The words sit in the dark upper half, lifted above the true middle, and the rays rise beneath them */
.home-splash-content {
    display: grid;
    justify-items: center;
    gap: var(--space-6);
    max-width: 1100px;
    margin-top: -12vh;
    text-align: center;
}

.home-splash-title {
    max-width: 13.5em;
    font-size: var(--text-display-1);
    line-height: 0.98;
    letter-spacing: -0.035em;
}

.home-splash-subtitle {
    max-width: 40em;
    color: var(--color-text-muted);
    font-size: var(--text-lead);
    line-height: 1.45;
    letter-spacing: 0.01em;
    text-wrap: balance;
}

/* Each service stays on one line, so the subtitle breaks only after a comma */
.no-break {
    white-space: nowrap;
}

.home-splash-action {
    margin-top: var(--space-3);
}

/* The title, subtitle and button rise into place, in CSS only, so the words show even without the script */
.home-splash-content > * {
    animation: splash-rise var(--duration-slow) var(--ease-out) both;
}

.home-splash-content > :nth-child(2) {
    animation-delay: 160ms;
}

.home-splash-content > :nth-child(3) {
    animation-delay: 300ms;
}

@keyframes splash-rise {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-splash-video {
        display: none;
    }

    .home-splash-content > * {
        animation: none;
    }
}

/* ---------- The three service sections ---------- */

.home-service {
    position: relative;
    display: grid;
    align-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding: var(--section-padding) 0;
    overflow: hidden;
    isolation: isolate;
}

/* A hairline in the service's hue across the top of each section */
.home-service::before {
    content: "";
    position: absolute;
    top: 0;
    left: var(--page-gutter);
    right: var(--page-gutter);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--service-hue) 50%, transparent);
    opacity: 0.35;
}

.home-service-inner {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--space-6);
    align-items: center;
}

/* Copy in five columns, the visual in seven */
.home-service-copy {
    position: relative;
    z-index: 1;
    grid-column: 1 / span 5;
    grid-row: 1;
    display: grid;
    gap: var(--space-5);
    align-content: start;
}

.home-service .service-visual {
    grid-column: 6 / span 7;
    grid-row: 1;
}

/* Website Services puts its visual on the left */
.home-service[data-visual-side="left"] .home-service-copy {
    grid-column: 8 / span 5;
}

.home-service[data-visual-side="left"] .service-visual {
    grid-column: 1 / span 7;
}

.home-service-title {
    font-size: var(--text-display-2);
    line-height: 1.02;
    letter-spacing: -0.03em;
}

.home-service-lead {
    max-width: 34em;
    color: var(--color-text-muted);
    font-size: var(--text-lead);
    line-height: 1.55;
}

.home-service-support {
    max-width: 34em;
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-line);
    color: var(--color-text-muted);
}

.home-service-link {
    justify-self: start;
    margin-top: var(--space-3);
}

/* ---------- Tablet and phone: the visual first as a band, then the copy ---------- */

@media (max-width: 1023px) {
    .home-service {
        min-height: 0;
    }

    .home-service-inner {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-service-copy,
    .home-service[data-visual-side="left"] .home-service-copy {
        grid-column: 1;
        grid-row: 2;
    }

    .home-service .service-visual,
    .home-service[data-visual-side="left"] .service-visual {
        grid-column: 1;
        grid-row: 1;
    }
}

/* Phones: the stacked sections run long, so the space around and inside each one is a step tighter */
@media (max-width: 767px) {
    .home-service {
        padding: var(--space-8) 0;
    }

    .home-service-inner {
        gap: var(--space-5);
    }

    .home-service-copy {
        gap: var(--space-4);
    }

    .home-service-link {
        justify-self: stretch;
    }
}
