/* Phase 2: home scenes H1 to H4. Loaded after style.css, on the home page only.
   The finished composition is the natural state; entrances start from keyframes or the .pre class. */

/* ---------- H1: the headline is the scene ---------- */
.h1s { position: relative; display: flex; flex-direction: column; overflow: hidden; background: var(--core-900); isolation: isolate; }
.h1-copy { position: relative; z-index: 1; }
.h1-copy h1 { font-size: var(--fs-display); line-height: 1.25; margin: 32px 0 16px; }
.h1-copy .intro { font-size: var(--fs-lead); max-width: 560px; margin-bottom: 24px; }
.h1-art { order: 2; display: block; width: min(300px, 84vw); height: auto; margin: 20px auto 0; overflow: visible; }
[dir="rtl"] .h1-art { transform: scaleX(-1); }   /* composition and motion follow the reading direction */
.h1-art .side { fill: var(--core); opacity: .85; }
.h1-art .edge { stroke: var(--white-300); stroke-width: 1; opacity: .28; }
.h1-art .seam { stroke: var(--lime); stroke-width: 3; stroke-dasharray: 1; }
.h1-art .pass { stroke: var(--white); stroke-width: 3; stroke-dasharray: .12 1; stroke-dashoffset: .12; opacity: 0; }
.h1-art .pass.run { animation: pass .8s var(--ease); }
@keyframes pass { 0% { stroke-dashoffset: .12; opacity: 1; } 90% { opacity: .8; } 100% { stroke-dashoffset: -1; opacity: 0; } }

/* one sequence, 2.4s: line, headline, masses, text, a short push-in; it never blocks scroll or clicks */
.h1-art .seam { animation: draw .6s var(--ease) both; }
.h1-copy h1 { animation: unmask .85s .15s var(--ease) both; }
.h1-art .slat { animation: settle 1.1s var(--ease) both; --from: 1; }
.h1-art .s1 { animation-delay: .30s; }
.h1-art .s2 { animation-delay: .38s; --from: -1; }
.h1-art .s3 { animation-delay: .46s; }
.h1-art .s4 { animation-delay: .54s; --from: -1; }
.h1-art .s5 { animation-delay: .62s; }
.h1-art .edge { animation: graze 1.2s .4s ease-out backwards; }
.h1-copy .intro { animation: rise .6s 1s var(--ease) both; }
.h1-copy .actions { animation: rise .6s 1.1s var(--ease) both; }
.h1-art { animation: push 2.4s var(--ease) both; }
@keyframes graze { 0% { stroke: var(--lime-600); opacity: 0; } 40% { stroke: var(--lime); opacity: 1; } }
@keyframes rise { from { opacity: 0; translate: 0 18px; } }
@keyframes push { from { scale: .96; } 66% { scale: .975; } }

/* ---------- H3: added light on the approved formats ---------- */
.format .piece { transition: transform .8s var(--ease), opacity .5s ease-out, fill var(--t-ui); }
.format-live { touch-action: pan-y; }   /* a horizontal drag moves the bars; vertical scroll stays free */
@media (hover: hover) {
  .format-ex:not(.pre):hover :is(.i2, .i4) { fill: var(--grey); }
  .format-ex:not(.pre):hover :is(.i1, .i5) { fill: var(--core-600); }
  .format-co:not(.pre):hover .piece { animation: catch .7s ease-in-out; }
  .format-co:not(.pre):hover .i1 { animation-delay: .25s; }
  .format-ev:not(.pre):hover .piece { animation: catch .6s ease-in-out; }
  .format-ev:not(.pre):hover .i1 { animation-delay: .18s; }
  .format-ev:not(.pre):hover .i2 { animation-delay: .36s; }
}
@keyframes catch { 50% { fill: var(--white); } }

/* ---------- H4: one horizon ---------- */
.home-closing { position: relative; overflow: hidden; isolation: isolate; background: var(--core-900); padding-bottom: 0; }
.home-closing .actions { position: relative; }
.home-closing .actions::after { content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: min(520px, 90vw); height: 180px; translate: -50% -50%; background: radial-gradient(closest-side, var(--lime), transparent); opacity: .08; transition: opacity var(--t-scene) var(--ease); }
.home-closing .wrap:has(.btn:hover) .actions::after, .home-closing .actions:focus-within::after { opacity: .2; }
.home-closing.pre .actions::after { opacity: 0; }
.horizon { display: block; width: min(640px, 100%); height: auto; margin: 56px auto 0; overflow: visible; }
[dir="rtl"] .horizon { transform: scaleX(-1); }
.horizon .ground { stroke: var(--core-600); stroke-width: 2; }
.rise { transition: transform var(--t-scene) var(--ease), opacity .5s ease-out; }
.r1 { transition-delay: .07s; } .r2 { transition-delay: .14s; } .r3 { transition-delay: .21s; } .r4 { transition-delay: .28s; }
/* start: each mass sits further along its own angle */
.pre .rise { opacity: 0; }
.pre .r0 { transform: translate(-14px, 28px); } .pre .r1 { transform: translate(22px, -44px); }
.pre .r2 { transform: translate(-28px, 56px); } .pre .r3 { transform: translate(16px, -32px); }
.pre .r4 { transform: translate(-20px, 40px); }

@media (min-width: 961px) {
  .h1s { min-height: calc(100svh - var(--bar)); justify-content: center; }
  .h1-art { position: absolute; z-index: 0; bottom: 0; inset-inline-end: 0; width: min(46vw, calc(100svh - var(--bar))); height: 100%; margin: 0; }
  /* the headline keeps to its own side so the masses and the line do not cross the letters */
  .h1-copy h1 { font-size: min(8.4vw, 16svh, 150px); max-width: 58%; margin: 32px 0 24px; }
  html:lang(en) .h1-copy h1 { font-size: clamp(34px, min(4.4vw, 8.6svh), 76px); max-width: 60%; }
  .h1-copy .intro { max-width: min(560px, 46%); }
  .h1-copy .actions { max-width: 50%; padding-bottom: 48px; }
}

/* short wide screens: tighter spacing so the headline and both buttons stay on the first screen */
@media (min-width: 961px) and (max-height: 680px) {
  .h1-copy h1 { margin: 20px 0 14px; }
  html:lang(en) .h1-copy h1 { font-size: clamp(32px, min(4.6vw, 7.4svh), 80px); }
  .h1-copy .intro { margin-bottom: 16px; }
  .h1-copy .actions { padding-bottom: 20px; }
}

@media (max-width: 960px) { .h1-art { position: relative; z-index: 0; } }
/* narrow phones: the two actions stack at one width */
@media (max-width: 440px) {
  .h1-copy .actions { flex-direction: column; }
  .h1-copy .actions .btn { text-align: center; }
}
