/* ==========================================================================
   THE HOME JOURNEY
   The home's first screen opens on Karun: the K, the ring and its text, still. A scroll (a flick of the wheel,
   a key, a swipe) warps into the K at light speed: the tour of the four businesses, which turn by themselves,
   faster than before. Under the text of the business in focus a line loads like a burning fuse while it waits
   (and burns in place while the pointer is near the text); under the line, the controls: the arrows and a mark
   per business, the current one taller. The line and the controls stand still on the screen whatever the
   text's length: the text sits on the line and grows upwards. A hint blinks a few times and fades. Another
   scroll warps back out to Karun and on to the next section.
   The script (fa-cinema.js, the home cycle) sets .is-journey on the scene once it runs, .is-tour inside the
   K, .is-warping on the way in or out and .is-hinting as a tour begins; it draws the line where .tour-line
   stands, across the text's column. (Markup: build_fa.py home().)
   ========================================================================== */

/* where the line stands: --tl-b from the foot of the screen; the text sits just above it, the controls under it */
.cycle { --tl-b: clamp(112px, 15.5vh, 152px); }
.tour-line { position: absolute; left: 0; right: 0; bottom: var(--tl-b); height: 0; pointer-events: none; }

/* while the scene warps, its words and controls step aside (and come back once it has landed) */
.cycle.is-journey .panels, .cycle.is-journey .ring-labels, .cycle.is-journey .cycle__hud { transition: opacity 0.6s var(--ease); }
.cycle.is-warping .panels, .cycle.is-warping .ring-labels, .cycle.is-warping .cycle__hud { opacity: 0; transition: opacity 0.25s; }

/* Karun's own screen has nothing to wait for: no controls there */
.cycle.is-journey:not(.is-tour) .cycle__hud .cnav { opacity: 0; visibility: hidden; pointer-events: none; }

/* ---------- The tour ---------- */
/* the text sits on the line (its foot a little above it), whatever its length */
.cycle.is-tour .panel--line { top: auto; bottom: calc(var(--tl-b) + 30px); transform: none; }

/* the controls under the line, in the middle of the text's column: the arrows larger, a mark per business (Karun's
   left out), no loading ring (the line is the wait), the current mark taller than the rest */
.cycle.is-tour .cycle__hud .cnav { top: auto; bottom: calc(var(--tl-b) - 68px); left: calc(100% - var(--gutter) - min(640px, 47vw) / 2); transform: translateX(-50%);
  gap: 8px; transition: opacity 0.6s var(--ease); }
[dir="ltr"] .cycle.is-tour .cycle__hud .cnav { left: calc(var(--gutter) + min(640px, 47vw) / 2); }
.cycle.is-tour .cnav .seg:first-child { display: none; }
.cycle.is-tour .cnav .cnav__btn { width: 46px; height: 46px; opacity: 0.92; color: var(--white); background: rgba(14, 49, 121, 0.4); border: 1px solid rgba(226, 231, 234, 0.34);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: opacity 0.3s, background-color 0.3s, border-color 0.3s, transform 0.3s var(--ease); }
.cycle.is-tour .cnav .cnav__btn:hover { opacity: 1; background-color: rgba(78, 114, 184, 0.5); border-color: var(--mist); }
.cycle.is-tour .cnav .cnav__btn svg { width: 22px; height: 22px; }
.cycle.is-tour .seg, .cycle.is-tour .seg.is-on { width: 22px; }
.cycle.is-tour .seg__ring { display: none; }
.cycle.is-tour .seg i { height: 10px; opacity: 0.42; }
.cycle.is-tour .seg.is-on i { opacity: 1; transform: scaleY(2.3); }
.cycle.is-tour .cnav.is-paused .seg.is-on i { height: 9px; transform: scaleY(1.6); }
/* as a tour begins the arrows call out a little (three soft swells of light) */
.cycle.is-tour.is-hinting .cnav .cnav__btn { animation: side-call 1.5s ease-in-out 0.8s 3; }
@keyframes side-call { 0%, 100% { box-shadow: 0 0 0 0 rgba(125, 162, 234, 0); } 45% { box-shadow: 0 0 0 7px rgba(125, 162, 234, 0.22), 0 0 26px 2px rgba(125, 162, 234, 0.35); } }

/* ---------- The hint ----------
   A faint line under the controls: how to turn the orbit (Space; on a touch screen, a swipe). It blinks a few
   times as a tour begins, then stays, blinking faintly and slowly for as long as the tour is on. */
.cycle__hint { position: absolute; bottom: calc(var(--tl-b) - 100px); left: calc(100% - var(--gutter) - min(640px, 47vw) / 2); margin: 0;
  transform: translateX(-50%); font-size: 13.5px; font-weight: 500; line-height: 1.6; letter-spacing: 0.01em; color: var(--mist);
  white-space: nowrap; opacity: 0; pointer-events: none; }
[dir="ltr"] .cycle__hint { left: calc(var(--gutter) + min(640px, 47vw) / 2); }
.cycle__hint-t, .cycle__hint-c { display: none; }
/* keys reach a page only once it has the focus (the browser gives it after a navigation; a page opened from outside,
   or in a preview pane, gets it with a click): until then the hint says to click first (.no-keys, fa-cinema.js) */
.cycle.no-keys .cycle__hint-k { display: none; }
.cycle.no-keys .cycle__hint-c { display: inline; }
/* (a touch screen is told to swipe instead: html.is-touch, fa-touch.css) */
.cycle.is-tour .cycle__hint { animation: hint-blink 3.4s ease-in-out 0.8s both, hint-glow 3.4s ease-in-out 4.2s infinite; }
@keyframes hint-blink { 0% { opacity: 0; } 17% { opacity: 0.62; } 34% { opacity: 0.14; } 51% { opacity: 0.62; } 68% { opacity: 0.14; } 85% { opacity: 0.62; } 100% { opacity: 0.42; } }
@keyframes hint-glow { 0%, 100% { opacity: 0.42; } 50% { opacity: 0.16; } }

/* ---------- The fuse ----------
   The line itself, drawn by the script on a canvas of its own in the text's layer (it fades with the text while
   the scene warps; its margin for the sparks may run past a phone's edge). */
.cycle .fuse { position: absolute; left: 0; top: 0; max-width: none; pointer-events: none; }

/* shorter desktop screens: the line and controls lower, the text closer to its line and, where the long text still
   shows (above 760 px), the business's name scaled to the screen's height too, so the longest text keeps clear of
   the header; the hint at the very foot */
@media (min-width: 900.02px) and (max-height: 820px) {
  .cycle { --tl-b: 96px; }
  .cycle.is-tour .panel--line { bottom: calc(var(--tl-b) + 24px); }
  .cycle__hint { bottom: 4px; }
}
@media (min-width: 900.02px) and (min-height: 760.02px) and (max-height: 820px) {
  .cycle.is-tour .panel--line .name { font-size: min(8.6vw, 13.5vh); }
}

/* phones held upright: the text over the full width at the foot of the screen, the line and controls under it */
@media (max-width: 900px) {
  .cycle { --tl-b: 104px; }
  .cycle.is-tour .panel--line { bottom: calc(var(--tl-b) + 20px); }
  .cycle.is-tour .cycle__hud .cnav, [dir="ltr"] .cycle.is-tour .cycle__hud .cnav { left: 50%; bottom: calc(var(--tl-b) - 66px); }
  .cycle.is-tour .cnav .cnav__btn { width: 42px; height: 42px; }
  .cycle__hint, [dir="ltr"] .cycle__hint { left: 50%; bottom: 10px; font-size: 12.5px; }
}
/* phones held sideways: little height, so the line and controls sit lower and the hint is left out */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 540px) {
  .cycle { --tl-b: 64px; }
  .cycle.is-tour .panel--line { bottom: calc(var(--tl-b) + 14px); }
  .cycle.is-tour .cycle__hud .cnav, [dir="ltr"] .cycle.is-tour .cycle__hud .cnav { left: calc(var(--gutter) + 27vw); bottom: 8px; }
  [dir="rtl"] .cycle.is-tour .cycle__hud .cnav { left: calc(100% - var(--gutter) - 27vw); }
  .cycle__hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cycle.is-tour.is-hinting .cnav .cnav__btn { animation: none; }
  .cycle.is-tour .cycle__hint { animation: none; opacity: 0.45; }
}
