/*
 * Fold 3: Where to start. "Aurora Night" look (visual-v2.md section 7, fold-start.json for copy and data).
 * Scoped to main.itil-v1 #start / .v1-start__*.
 *
 * Desktop (1100px and up): the answer and the button group sit in the left column; the route sits in the right
 * column. The path rail runs in the gutter between them: a gradient stroke that draws from Step 1 to Step 2 while
 * its two nodes pop. Step 1 = three numeral choice cards. Step 2 = a night panel with its own light.
 * Below 1100px: one column in DOM order (answer, route, button group), with the rail on the left of the route.
 *
 * Motion is only ever added under html.v1-motion and always ends at the normal state; the default CSS is the
 * finished picture.
 */

/* ---------- Layout ---------- */
main.itil-v1 .v1-start__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "intro" "path" "cta";
    gap: var(--s-8);
}
main.itil-v1 .v1-start__intro { grid-area: intro; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
main.itil-v1 .v1-start__path { grid-area: path; min-width: 0; }
main.itil-v1 .v1-start__cta { grid-area: cta; min-width: 0; }

@media (min-width: 1100px) {
    main.itil-v1 .v1-start__grid {
        grid-template-columns: minmax(0, 440fr) minmax(0, 648fr);
        grid-template-rows: auto 1fr;
        grid-template-areas: "intro path" "cta path";
        column-gap: 48px;
        row-gap: 26px;
        align-items: start;
    }
}

/* ---------- Decoration: orbit rings behind the answer column ---------- */
main.itil-v1 .v1-start__deco { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; border-radius: inherit; }
main.itil-v1 .v1-start__orbit {
    position: absolute; left: 50%; top: 50%;
    width: 760px; height: 760px;
    margin: -330px 0 0 -1010px;
    opacity: .42;
    /* Full strength in the page margin, a whisper behind the text column */
    -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 50%, rgba(0, 0, 0, .16) 62%, rgba(0, 0, 0, .1) 100%);
            mask-image: linear-gradient(90deg, #000 0%, #000 50%, rgba(0, 0, 0, .16) 62%, rgba(0, 0, 0, .1) 100%);
}
main.itil-v1 .v1-start__ring { transform-box: view-box; transform-origin: 50% 50%; }
html.v1-motion main.itil-v1 .v1-start__ring--a { animation: v1-start-spin 90s linear infinite; }
html.v1-motion main.itil-v1 .v1-start__ring--b { animation: v1-start-spin 64s linear infinite reverse; }
@keyframes v1-start-spin { to { transform: rotate(360deg); } }
@media (max-width: 1099.98px) {
    main.itil-v1 .v1-start__orbit { width: 520px; height: 520px; left: auto; right: -210px; top: -310px; margin: 0; opacity: .3; -webkit-mask-image: none; mask-image: none; }
}
@media (max-width: 767.98px) {
    main.itil-v1 .v1-start__deco { display: none; }
}

/* ---------- Left: the answer ---------- */
main.itil-v1 .v1-start__h2 { margin-top: 14px; text-wrap: balance; }
main.itil-v1 .v1-start__answer {
    margin-top: var(--s-4);
    max-width: var(--measure-answer);
    font-size: var(--fs-body);
    line-height: 1.6;
    color: var(--mute);
    text-wrap: pretty;
}
main.itil-v1 .v1-start__lead { font-weight: 700; color: var(--ink); }

/* ---------- Button group ---------- */
main.itil-v1 .v1-start__cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
main.itil-v1 .v1-start__cta .v1-btn { padding-inline: 24px; }
main.itil-v1 .v1-start__whatis { font-size: 17px; white-space: nowrap; }

@media (max-width: 767.98px) {
    main.itil-v1 .v1-start__cta { flex-direction: column; align-items: stretch; gap: var(--s-3); }
    main.itil-v1 .v1-start__cta .v1-btn { width: 100%; min-height: 54px; font-size: 18px; }
    /* Standalone link: padded to a 44px tap height (no neighbouring lines to overlap). */
    main.itil-v1 .v1-start__whatis { align-self: center; min-height: 44px; padding: 0 8px; }
}

/* ---------- Right: the route and its rail ---------- */
main.itil-v1 .v1-start__path {
    --rail-x: 9px;          /* centre of the rail, measured from the left edge of the list */
    --node-1: 14px;         /* centre of the Step 1 node, from the top of step 1 */
    --node-2: 33px;         /* centre of the Step 2 node, from the top of step 2 */
    --step-gap: 16px;
    position: relative;
    display: grid;
    gap: var(--step-gap);
    padding-left: 38px;
}
main.itil-v1 .v1-start__step { position: relative; min-width: 0; }

/* The rail: track + gradient stroke from the Step 1 node to the Step 2 node, then a tail that fades out. */
main.itil-v1 .v1-start__step--one:not(:last-child)::before,
main.itil-v1 .v1-start__step--one:not(:last-child)::after,
main.itil-v1 .v1-start__step--two::before {
    content: ""; position: absolute; width: 3px; border-radius: 3px; pointer-events: none;
    left: calc(var(--rail-x) - 38px - 1.5px);
}
main.itil-v1 .v1-start__step--one:not(:last-child)::before,
main.itil-v1 .v1-start__step--one:not(:last-child)::after {
    top: var(--node-1);
    bottom: calc(-1 * (var(--step-gap) + var(--node-2)));
    transform-origin: 50% 0;
}
main.itil-v1 .v1-start__step--one:not(:last-child)::before {
    background: linear-gradient(180deg, var(--blue) 0%, var(--violet) 55%, var(--pink) 100%);
    box-shadow: 0 0 14px rgba(124, 92, 255, .45);
}
/* A slim light that travels down the stroke (only shown while it moves) */
main.itil-v1 .v1-start__step--one:not(:last-child)::after { background: linear-gradient(180deg, transparent, #fff 45%, #fff 55%, transparent); opacity: 0; }
main.itil-v1 .v1-start__step--two::before {
    top: var(--node-2); bottom: 10px;
    background: linear-gradient(180deg, var(--pink), rgba(240, 72, 155, 0));
    opacity: .55;
    transform-origin: 50% 0;
}

/* Nodes */
main.itil-v1 .v1-start__node {
    position: absolute; z-index: 1;
    left: calc(var(--rail-x) - 38px - 11px);
    top: calc(var(--node-1) - 11px);
    width: 22px; height: 22px; border-radius: 50%;
    border: 3px solid transparent;
    background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box;
    box-shadow: 0 0 0 5px rgba(124, 92, 255, .14), 0 6px 16px -4px rgba(124, 92, 255, .55);
    transition: box-shadow 320ms var(--ease-out), transform 320ms var(--ease-spring);
}
main.itil-v1 .v1-start__node::after {   /* the filled core */
    content: ""; position: absolute; inset: 3px; border-radius: 50%;
    background: var(--grad);
}
main.itil-v1 .v1-start__step--two .v1-start__node {
    top: calc(var(--node-2) - 11px);
    box-shadow: 0 0 0 5px rgba(240, 72, 155, .14), 0 6px 16px -4px rgba(240, 72, 155, .55);
}
main.itil-v1 .v1-start__step--two .v1-start__node::after { background: linear-gradient(135deg, var(--violet), var(--pink)); }
/* The node of the step you are pointing at lights up */
@supports selector(:has(*)) {
    main.itil-v1 .v1-start__step:has(.v1-start__card:hover, .v1-start__after:hover, :focus-visible) .v1-start__node {
        transform: scale(1.18);
        box-shadow: 0 0 0 7px rgba(124, 92, 255, .2), 0 8px 22px -2px rgba(124, 92, 255, .8);
    }
}

main.itil-v1 .v1-start__h3 { font-size: 22px; --v1-lh: 1.27; letter-spacing: -0.02em; }

/* ---------- Step 1: numeral choice cards ---------- */
main.itil-v1 .v1-start__cards { display: grid; gap: 10px; margin-top: 10px; }
main.itil-v1 .v1-start__item { min-width: 0; }
main.itil-v1 .v1-start__card {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    column-gap: 14px;
    align-items: center;
    padding: 15px 20px 15px 16px;
    border-radius: 20px;
}
/* An optional line is showing (a claims line or the hub sentence): tighter cards keep the fold inside one screen */
@media (min-width: 768px) {
    main.itil-v1 .v1-start__path--tight .v1-start__card { padding-block: 10px; }
}
/* Numeral cell: "01" swaps for an arrow badge on hover */
main.itil-v1 .v1-start__no { position: relative; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: linear-gradient(140deg, rgba(76, 141, 255, .12), rgba(139, 92, 246, .12) 50%, rgba(240, 72, 155, .12)); box-shadow: inset 0 0 0 1px rgba(124, 92, 255, .16); overflow: hidden; }
main.itil-v1 .v1-start__numeral { font-size: 34px; letter-spacing: -0.05em; transition: transform 360ms var(--ease-out), opacity 240ms ease; }
main.itil-v1 .v1-start__go {
    position: absolute; inset: 0; display: grid; place-items: center;
    background: var(--tile-blue, linear-gradient(135deg, #3B6FE0, #6D3BE6)); color: #fff;
    opacity: 0; transform: translate3d(-100%, 0, 0);
    transition: transform 360ms var(--ease-out), opacity 240ms ease;
}
main.itil-v1 .v1-start__go .v1-i { width: 24px; height: 24px; }
@media (hover: hover) {
    main.itil-v1 .v1-start__card:hover .v1-start__numeral { transform: translate3d(100%, 0, 0); opacity: 0; }
    main.itil-v1 .v1-start__card:hover .v1-start__go { transform: none; opacity: 1; }
}
main.itil-v1 .v1-start__card:focus-within .v1-start__numeral { transform: translate3d(100%, 0, 0); opacity: 0; }
main.itil-v1 .v1-start__card:focus-within .v1-start__go { transform: none; opacity: 1; }

main.itil-v1 .v1-start__text { min-width: 0; }
main.itil-v1 .v1-start__title {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
    font-size: 19px; --v1-lh: 1.3;
}
main.itil-v1 .v1-start__link { color: var(--ink); transition: color var(--t-fast) ease; }
main.itil-v1 .v1-start__card:hover .v1-start__link,
main.itil-v1 .v1-start__link:focus-visible { color: var(--link); }
main.itil-v1 .v1-start__pill { min-height: 26px; padding: 0 10px; line-height: 1.5; letter-spacing: 0; }
main.itil-v1 .v1-start__sentence { margin-top: 2px; font-size: 16px; line-height: 1.5; color: var(--mute); }

main.itil-v1 .v1-start__meta {
    display: flex; flex-direction: column; align-items: flex-end; gap: 0;
    padding-left: 14px; border-left: 1px solid var(--line);
    font-size: 16px; line-height: 1.5; color: var(--mute); text-align: right;
    font-variant-numeric: tabular-nums;
}
main.itil-v1 .v1-start__meta-top { display: inline-flex; align-items: baseline; white-space: nowrap; }
main.itil-v1 .v1-start__meta-line + .v1-start__meta-line::before { content: "\00B7"; margin: 0 6px; color: var(--violet); font-weight: 800; }
main.itil-v1 .v1-start__date { font-weight: 700; color: var(--ink); white-space: nowrap; }

/* Focus ring on the whole card (the stretched link is the only tab stop). */
@supports selector(:has(*)) {
    main.itil-v1 .v1-start__card:has(.v1-stretch:focus-visible) { outline: var(--focus); outline-offset: var(--focus-offset); }
    main.itil-v1 .v1-start__card .v1-stretch:focus-visible::after { outline: none; }
}

main.itil-v1 .v1-start__fallback { margin-top: var(--s-3); }
main.itil-v1 .v1-start__claim { margin-top: var(--s-2); font-size: 16px; line-height: 1.5; }
main.itil-v1 .v1-start__claim + .v1-start__claim { margin-top: var(--s-1); }

/* ---------- Step 2: the night panel ---------- */
main.itil-v1 .v1-start__after {
    padding: 18px 22px 18px;
    border-radius: 22px;
    background:
        radial-gradient(420px 220px at 100% 0%, rgba(240, 72, 155, .30), transparent 64%),
        radial-gradient(460px 260px at 0% 100%, rgba(76, 141, 255, .30), transparent 62%),
        linear-gradient(150deg, #1D1A52 0%, #13113A 46%, #0A0926 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 0 0 1px rgba(255, 255, 255, .07), 0 30px 60px -30px rgba(14, 13, 51, .75), 0 18px 50px -24px rgba(124, 92, 255, .6);
}
/* A violet light that drifts inside the panel and leans towards the pointer */
main.itil-v1 .v1-start__after > .v1-start__glow {
    position: absolute; z-index: 0; pointer-events: none;
    width: 300px; height: 300px; border-radius: 50%;
    left: calc(var(--mx, 62%) - 150px); top: calc(var(--my, 30%) - 150px);
    background: radial-gradient(closest-side, rgba(139, 92, 246, .42), rgba(139, 92, 246, 0));
    transition: left 500ms var(--ease-out), top 500ms var(--ease-out);
}
html.v1-motion main.itil-v1 .v1-start__after > .v1-start__glow { animation: v1-start-breathe 7s ease-in-out infinite alternate; }
@keyframes v1-start-breathe { from { transform: scale(.85); opacity: .7; } to { transform: scale(1.2); opacity: 1; } }
/* The rising route, top right */
main.itil-v1 .v1-start__after > .v1-start__art {
    position: absolute; z-index: 0; pointer-events: none;
    right: 20px; top: 14px; width: 164px; height: auto; overflow: visible;
    opacity: .9;
}
main.itil-v1 .v1-start__art-dot { stroke: #13113A; stroke-width: 2.5; transform-box: fill-box; transform-origin: 50% 50%; }
main.itil-v1 .v1-start__art-dot--end { filter: drop-shadow(0 0 6px rgba(240, 72, 155, .9)); }

main.itil-v1 .v1-start__levels { margin-top: 8px; display: grid; gap: 4px; max-width: 100%; font-size: 16px; line-height: 1.55; color: var(--on-dark-2); }
@media (min-width: 768px) {
    /* The first line clears the route drawing in the top right corner */
    main.itil-v1 .v1-start__after > .v1-start__art ~ .v1-start__levels > li:first-child { padding-right: 176px; }
}
main.itil-v1 .v1-start__levels strong { font-weight: 700; color: var(--on-dark); }
main.itil-v1 .v1-start__routes { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-dark); font-size: 16px; line-height: 1.55; color: var(--on-dark-2); }
main.itil-v1 .v1-start__routes + .v1-start__routes { margin-top: 0; padding-top: 0; border-top: 0; }

/* ---------- Desktop: the rail moves into the gutter between the two columns ---------- */
@media (min-width: 1100px) {
    main.itil-v1 .v1-start__path { padding-left: 0; --rail-x: -24px; }
    main.itil-v1 .v1-start__step--one:not(:last-child)::before,
    main.itil-v1 .v1-start__step--one:not(:last-child)::after,
    main.itil-v1 .v1-start__step--two::before { left: calc(var(--rail-x) - 1.5px); }
    main.itil-v1 .v1-start__node { left: calc(var(--rail-x) - 11px); }
}

/* ---------- Phones ---------- */
@media (max-width: 767.98px) {
    main.itil-v1 .v1-start__path { padding-left: 32px; --rail-x: 9px; --node-2: 31px; }
    main.itil-v1 .v1-start__step--one:not(:last-child)::before,
    main.itil-v1 .v1-start__step--one:not(:last-child)::after,
    main.itil-v1 .v1-start__step--two::before { left: calc(var(--rail-x) - 32px - 1.5px); }
    main.itil-v1 .v1-start__node { left: calc(var(--rail-x) - 32px - 11px); }
    main.itil-v1 .v1-start__card { grid-template-columns: 46px minmax(0, 1fr); row-gap: 8px; column-gap: 12px; padding: 14px; align-items: start; }
    main.itil-v1 .v1-start__no { width: 46px; height: 46px; border-radius: 14px; }
    main.itil-v1 .v1-start__numeral { font-size: 28px; }
    /* Meta on one line under the text: "2 days · Next date 30 Nov 2026" */
    main.itil-v1 .v1-start__meta {
        grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: flex-start; gap: 0 6px;
        padding: 8px 0 0; border-left: 0; border-top: 1px solid var(--line); text-align: left;
    }
    main.itil-v1 .v1-start__after { padding: 18px; }
    /* No room beside the heading on a phone */
    main.itil-v1 .v1-start__after > .v1-start__art { display: none; }
    main.itil-v1 .v1-start__levels { gap: 8px; line-height: 1.7; }
    main.itil-v1 .v1-start__routes { line-height: 1.7; }
}
@media (max-width: 359.98px) {
    main.itil-v1 .v1-start__meta-top { white-space: normal; flex-wrap: wrap; }
}

/* ---------- Motion (html.v1-motion only; every keyframe ends at the normal state) ---------- */
/* The rail draws from Step 1 to Step 2, the nodes pop in turn, then the tail runs on. */
html.v1-motion main.itil-v1 .v1-start__path.is-in:not(.is-done) .v1-start__step--one::before { animation: v1-draw-y 1000ms var(--ease-out) 120ms backwards; }
html.v1-motion main.itil-v1 .v1-start__path.is-in:not(.is-done) .v1-start__step--two::before { animation: v1-draw-y 700ms var(--ease-out) 1000ms backwards; }
html.v1-motion main.itil-v1 .v1-start__path.is-in:not(.is-done) .v1-start__node { animation: v1-pop 520ms var(--ease-spring) backwards; }
html.v1-motion main.itil-v1 .v1-start__path.is-in:not(.is-done) .v1-start__step--two .v1-start__node { animation-delay: 820ms; }
html.v1-motion main.itil-v1 .v1-start__path.is-in:not(.is-done) .v1-start__step--one > .v1-start__h3 { animation: v1-left var(--t-reveal) var(--ease-out) 80ms backwards; }
/* The travelling light keeps the rail alive once it is drawn */
html.v1-motion main.itil-v1 .v1-start__path.is-in .v1-start__step--one:not(:last-child)::after { animation: v1-start-run 4.8s cubic-bezier(.6, 0, .4, 1) 1600ms infinite; }
@keyframes v1-start-run {
    0% { opacity: 0; clip-path: inset(0 0 100% 0); }
    8% { opacity: .9; clip-path: inset(0 0 86% 0); }
    46% { opacity: .9; clip-path: inset(86% 0 0 0); }
    54%, 100% { opacity: 0; clip-path: inset(100% 0 0 0); }
}
/* The rising route in the panel draws when the panel arrives, and its dots pop along it */
html.v1-motion main.itil-v1 .v1-start__after.is-in:not(.is-done) .v1-start__art-line { stroke-dasharray: 1; animation: v1-dash 1300ms var(--ease-out) 420ms backwards; }
html.v1-motion main.itil-v1 .v1-start__after.is-in:not(.is-done) .v1-start__art-dot { animation: v1-pop 480ms var(--ease-spring) backwards; animation-delay: calc(620ms + var(--i, 0) * 240ms); }
/* On hover the route redraws once */
@media (hover: hover) {
    html.v1-motion main.itil-v1 .v1-start__after.is-done:hover .v1-start__art-line { stroke-dasharray: 1; animation: v1-dash 1100ms var(--ease-out) backwards; }
    html.v1-motion main.itil-v1 .v1-start__after.is-done:hover .v1-start__art-dot--end { animation: v1-pulse 900ms ease-in-out infinite alternate; }
}

@media (prefers-reduced-motion: reduce) {
    main.itil-v1 .v1-start__numeral, main.itil-v1 .v1-start__go, main.itil-v1 .v1-start__node, main.itil-v1 .v1-start__after > .v1-start__glow { transition: none; }
}
@media print {
    main.itil-v1 .v1-start__deco, main.itil-v1 .v1-start__after > .v1-start__glow { display: none; }
}
