/*
 * The front page: the mark tells how Yaumna works, with the steps of "It Starts With You" (Ayman) and the new words.
 * Headlines follow it: "It starts with you." "Then your people." … "That's Yaumna."
 *   1 You: the blue dot alone.
 *   2 Your people fly in and settle around you.
 *   3 What you share: the sun rises out of you into its place.
 *   4 Apps ask first: three apps knock (dashed, a line to you), then turn solid with a tick.
 *   5 Any format: each app shows its own form inside (a story, a feed, a chat).
 *   6 That's Yaumna: the apps go, and the mark becomes the icon.
 * Each step drives its own changes (a view timeline per step, hoisted to .story). They run during the glide from the
 * previous section to this one (cover 6% to 50%: a full-screen section is fully in view at 50%), and the page snaps to
 * each section, so at rest the mark always shows one step whole.
 * At rest, and where scroll-driven animations aren't supported, the finished icon shows.
 * Stage (viewBox 0 0 600 600): you at 300,300 (r 45); your people at radius 120 (r 22.5); the sun at 300,180;
 * apps at radius 222, at -30°, 150° and 60°, between your people.
 */
.story { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: clamp(24px, 4vw, 64px); timeline-scope: --s2, --s3, --s4, --s5, --s6; }
.stage { grid-column: 2; grid-row: 1; align-self: start; position: sticky; top: 0; height: 100svh; display: grid; place-items: center; }
.stage svg { width: min(100%, 580px); height: auto; max-height: 84svh; overflow: visible; }
.steps { grid-column: 1; grid-row: 1; list-style: none; margin: 0; padding: 0; }
/*
 * Snapping (Ayman): each section fills the screen and locks into place, so the mark's change plays during the glide
 * from one section to the next and never rests halfway. The header and the first step make the first screen; the
 * footer snaps to the end.
 */
:root { --bar: 84px; }
html:has(body.home) { scroll-snap-type: y mandatory; }
.home .site-bar { scroll-snap-align: start; }
.step { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; scroll-snap-align: start; scroll-snap-stop: always; }
.step.first { min-height: calc(100svh - var(--bar)); scroll-snap-align: none; }
.home .night { scroll-snap-align: end; }
.s2 { view-timeline: --s2 block; } .s3 { view-timeline: --s3 block; } .s4 { view-timeline: --s4 block; }
.s5 { view-timeline: --s5 block; } .s6 { view-timeline: --s6 block; }
.step .card { display: flex; flex-direction: column; gap: 18px; max-width: 30rem; }
.step .glyph { width: 30px; height: 30px; }
.step h1 { font-size: clamp(50px, 6vw, 86px); line-height: 1.02; }
.step h2 { font-size: clamp(44px, 5.2vw, 76px); line-height: 1.02; }
.step p { margin: 0; font-size: clamp(17px, 1.5vw, 19px); line-height: 1.6; color: var(--soft); max-width: 27em; }
.step .handle { font-family: var(--display); font-weight: 400; font-size: clamp(28px, 2.8vw, 38px); letter-spacing: -0.015em; line-height: 1.1; color: var(--ink); }
.step .handle em { font-style: normal; color: var(--em); }
.step .actions { margin-top: 10px; }
.step.first { justify-content: flex-start; padding-top: clamp(56px, 14svh, 160px); }

/* The mark's parts, at rest: the finished icon. */
.big .tile { fill: var(--paper); stroke: #DCD8E8; stroke-width: 2; }
.big .people circle { fill: var(--ink); }
.big .sun { fill: var(--sun); }
.big .you { fill: var(--you); }
.big .knocks, .big .apps, .big .forms, .big .ticks { opacity: 0; }
.big .knocks line { stroke: #A9A4C2; stroke-width: 2.5; stroke-dasharray: 2 9; stroke-linecap: round; }
.big .apps .asking { fill: var(--paper); stroke: #A9A4C2; stroke-width: 2.5; stroke-dasharray: 6 6; }
.big .apps .allowed { fill: var(--paper); stroke: var(--ink); stroke-width: 2.5; }
.big .forms .photo { fill: #E4DFF4; }
.big .forms .bar { stroke: #FFFFFF; stroke-width: 3.5; stroke-linecap: round; }
.big .forms .line { stroke: #CBC6DD; stroke-width: 4; stroke-linecap: round; }
.big .forms .them { fill: #EFEDF6; }
.big .forms .mine { fill: var(--you); }
.big .ticks circle { fill: var(--you); }
.big .ticks path { fill: none; stroke: #FFFFFF; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/*
 * The sky: One Day's colours (Ayman) as a subtle vertical gradient, a cooler sky above and a warmer horizon below,
 * behind the story. Both colours shift with the steps, so each change melts into the next: dawn lavender over a peach
 * glow as it starts with you; pale morning blue as your people come; near white at noon as the sun takes its place;
 * cream over gold in the afternoon for the apps; peach over sunset orange for their formats; dusk over an ember glow,
 * then deep night, for "That's Yaumna", when the words turn light. The two colours are registered properties so they
 * animate smoothly, and each change names only its target, so it starts from wherever the one before left it.
 */
@property --sky-top { syntax: "<color>"; inherits: false; initial-value: #ECE6F7; }
@property --sky-low { syntax: "<color>"; inherits: false; initial-value: #FCE4DA; }
/* The body's own white would paint over the sky (it sits behind the page's content), so on this page it's clear. */
.home { animation: none; background-color: transparent; }
.sky {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-color: #ECE6F7; background-image: linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-low) 100%);
}
@supports (animation-timeline: view()) {
  .sky {
    animation: to-morning ease-in-out both, to-noon ease-in-out both, to-afternoon ease-in-out both,
               to-sunset ease-in-out both, to-dusk ease-in-out both, to-night ease-in-out both;
    animation-timeline: --s2, --s3, --s4, --s5, --s6, --s6;
    animation-range: cover 0% cover 50%, cover 0% cover 50%, cover 0% cover 50%,
                     cover 0% cover 50%, cover 0% cover 26%, cover 26% cover 50%;
  }
  @keyframes to-morning { to { --sky-top: #EDEBFA; --sky-low: #F9F5FB; } }
  @keyframes to-noon { to { --sky-top: #FFFFFF; --sky-low: #FCF9FB; } }
  @keyframes to-afternoon { to { --sky-top: #FFF1EA; --sky-low: #FFD7C6; } }
  @keyframes to-sunset { to { --sky-top: #FFC1A6; --sky-low: #EE8577; } }
  @keyframes to-dusk { to { --sky-top: #3A2F6E; --sky-low: #C26A7C; } }
  @keyframes to-night { to { --sky-top: #15123A; --sky-low: #2B2363; } }
}
@media (prefers-reduced-motion: reduce) { .sky { animation: none !important; } }
/* The footer starts clear here, so the night sky runs into it without an edge. */
.home .night { background-color: transparent; background-image: linear-gradient(to bottom, rgba(21, 18, 58, 0) 0, var(--night) 45%); }

/* Motion that settles: arrivals ease in and come to rest softly; departures ease away. */
.stage { --settle: cubic-bezier(0.22, 1, 0.36, 1); --leave: cubic-bezier(0.55, 0, 0.75, 0.3); }

@supports (animation-timeline: view()) {
  .big .tile, .big .people circle, .big .sun, .big .apps > g, .big .forms > g, .big .ticks > g, .big .knocks > line { transform-box: fill-box; transform-origin: center; }
  .big .knocks, .big .apps, .big .forms, .big .ticks { opacity: 1; }

  /* 2. Your people fly in from beyond the edges, one after another. */
  .big .people circle { animation: arrive var(--settle) both, dusk-glow linear both; animation-timeline: --s2, --s6; }
  .big .people .p0 { --dx: 220px; --dy: 0px; animation-range: cover 11.5% cover 33.5%, cover 6% cover 50%; }
  .big .people .p1 { --dx: 156px; --dy: 156px; animation-range: cover 14.2% cover 36.2%, cover 6% cover 50%; }
  .big .people .p2 { --dx: 0px; --dy: 220px; animation-range: cover 17% cover 39%, cover 6% cover 50%; }
  .big .people .p3 { --dx: -156px; --dy: 156px; animation-range: cover 19.8% cover 41.8%, cover 6% cover 50%; }
  .big .people .p4 { --dx: -220px; --dy: 0px; animation-range: cover 22.5% cover 44.5%, cover 6% cover 50%; }
  .big .people .p5 { --dx: -156px; --dy: -156px; animation-range: cover 25.2% cover 47.2%, cover 6% cover 50%; }
  .big .people .p6 { --dx: 156px; --dy: -156px; animation-range: cover 28% cover 50%, cover 6% cover 50%; }
  /* At dusk your people glow against the dark; as the white icon forms around them, they're dark again, as in the icon. */
  @keyframes dusk-glow { 45% { fill: #EEEDF8; } to { fill: #221E55; } }
  @keyframes glow { to { fill: #EEEDF8; } }
  @keyframes arrive { from { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.5); } 40% { opacity: 1; } to { opacity: 1; transform: none; } }

  /* 3. The sun rises out of you into its place. */
  .big .sun { animation: rise var(--settle) both; animation-timeline: --s3; animation-range: cover 17% cover 50%; }
  @keyframes rise { from { opacity: 0; transform: translateY(120px) scale(0.5); } 35% { opacity: 1; } to { opacity: 1; transform: none; } }

  /* 4. Three apps knock, with a line to you; then each gets a yes and turns solid. */
  .big .apps > g { animation: come var(--settle) both, go var(--leave) both; animation-timeline: --s4, --s6; }
  .big .apps .a0 { --dx: 60px; --dy: -34px; animation-range: cover 8.8% cover 28%, cover 11.5% cover 30.8%; }
  .big .apps .a1 { --dx: -60px; --dy: 34px; animation-range: cover 12.9% cover 32.1%, cover 11.5% cover 30.8%; }
  .big .apps .a2 { --dx: 34px; --dy: 60px; animation-range: cover 17% cover 36.2%, cover 11.5% cover 30.8%; }
  .big .knocks > line { animation: appear var(--settle) both, go var(--leave) both; animation-timeline: --s4, --s6; animation-range: cover 19.8% cover 33.5%, cover 11.5% cover 30.8%; }
  .big .apps .allowed { animation: appear var(--settle) both; animation-timeline: --s4; animation-range: cover 36.2% cover 47.2%; }
  .big .ticks > g { animation: yes var(--settle) both, go var(--leave) both; animation-timeline: --s4, --s6; }
  .big .ticks .k0 { animation-range: cover 36.2% cover 44.5%, cover 11.5% cover 30.8%; }
  .big .ticks .k1 { animation-range: cover 39% cover 47.2%, cover 11.5% cover 30.8%; }
  .big .ticks .k2 { animation-range: cover 41.8% cover 50%, cover 11.5% cover 30.8%; }
  @keyframes come { from { opacity: 0; transform: translate(var(--dx), var(--dy)); } to { opacity: 1; transform: none; } }
  @keyframes appear { from { opacity: 0; } to { opacity: 1; } }
  @keyframes yes { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: none; } }
  /* No `from`: each leaves from wherever its earlier animation left it. */
  @keyframes go { to { opacity: 0; transform: scale(0.8); } }

  /* 5. Each app shows its own form. */
  .big .forms > g { animation: yes var(--settle) both, go var(--leave) both; animation-timeline: --s5, --s6; }
  .big .forms .f0 { animation-range: cover 14.2% cover 30.8%, cover 11.5% cover 30.8%; }
  .big .forms .f1 { animation-range: cover 22.5% cover 39%, cover 11.5% cover 30.8%; }
  .big .forms .f2 { animation-range: cover 30.8% cover 47.2%, cover 11.5% cover 30.8%; }

  /* 6. The apps go, and the mark becomes the icon. */
  .big .tile { animation: become var(--settle) both; animation-timeline: --s6; animation-range: cover 28% cover 50%; }
  @keyframes become { from { opacity: 0; transform: scale(1.12); } to { opacity: 1; transform: none; } }
}
@supports (animation-timeline: view()) {
  @media (min-width: 761px) {
    .s5 .display em { animation: to-deep-ink linear both; animation-timeline: --s5; animation-range: cover 4% cover 41.8%; }
    .s5 .card p { animation: to-ink linear both; animation-timeline: --s5; animation-range: cover 4% cover 41.8%; }
    @keyframes to-deep-ink { to { color: #2B2363; } }
    @keyframes to-ink { to { color: #221E55; } }
    .s6 .display, .s6 .handle { animation: to-light linear both; animation-timeline: --s6; animation-range: cover 4% cover 28%; }
    .s6 .card p:not(.handle) { animation: to-light-soft linear both; animation-timeline: --s6; animation-range: cover 4% cover 28%; }
    .s6 .btn.solid { animation: to-light-button linear both; animation-timeline: --s6; animation-range: cover 4% cover 28%; }
    .s6 .btn:not(.solid) { animation: to-light-outline linear both; animation-timeline: --s6; animation-range: cover 4% cover 28%; }
    .s6 .glyph g { animation: glow linear both; animation-timeline: --s6; animation-range: cover 4% cover 28%; }
    @keyframes to-light { to { color: #EEEDF8; } }
    @keyframes to-light-soft { to { color: #B9B5D3; } }
    @keyframes to-light-button { to { background-color: #EEEDF8; border-color: #EEEDF8; color: #221E55; } }
    @keyframes to-light-outline { to { color: #EEEDF8; border-color: rgba(238, 237, 248, 0.35); } }
  }
}
@media (prefers-reduced-motion: reduce) {
  .s5 .display em, .s5 .card p, .s6 .display, .s6 .handle, .s6 .card p, .s6 .btn, .s6 .glyph g { animation: none !important; }
  .big .tile, .big .people circle, .big .sun, .big .apps > g, .big .apps .allowed, .big .forms > g, .big .ticks > g, .big .knocks > line { animation: none !important; }
  .big .knocks, .big .apps, .big .forms, .big .ticks { opacity: 0 !important; }
}

/* Phones: the mark held at the top, the words passing below it on a card. */
@media (max-width: 760px) {
  .story { grid-template-columns: minmax(0, 1fr); }
  .stage { grid-column: 1; height: 56svh; z-index: 0; }
  .stage svg { width: min(90vw, 380px); }
  .steps { grid-column: 1; z-index: 1; }
  :root { --bar: 68px; }
  .step, .step.first { min-height: 100svh; justify-content: flex-end; padding-top: 0; padding-bottom: 5svh; }
  .step.first { min-height: calc(100svh - var(--bar)); }
  .step .card { background-color: var(--paper); border: 1px solid var(--hair); border-radius: 22px; padding: 22px; max-width: none; gap: 12px; }
  .step h1 { font-size: clamp(40px, 11vw, 52px); }
  .step h2 { font-size: clamp(38px, 10.5vw, 48px); }
  .step .glyph { display: none; }
}
