/* ============================================================================
   falling-stars.css — §FALL: falling stars in every page hero (2026-09-23)

   The brand's shooting star (the one the sign-in pages carry, auth-sky.css
   §3) in the heroes built like the homepage's — the orbit ring and the
   starfield: the homepage-family `.hpx-hero` (/, /search, /tools) and every
   listing / category / tag hub (`.dir-hh`). Only those, by request
   (2026-09-23): card, form and detail heroes have no sky for a star to fall
   through. assets/js/falling-stars.js injects the layer; both files load
   everywhere via partials/floating-widgets (all five public layouts).

   Each star is a 2px line whose right end is the lit head. Rotated about that
   head to its angle, it grows from 30% while translateX() carries it along
   the rotated axis, so ONE keyframe set serves every angle. Visible for the
   first ~9% of its cycle and dark for the rest: six periods and phases put one
   in the air every couple of seconds without two ever falling together. Four
   on phones, four on tablets.

   Two ways into a hero (the script picks per hero):
     back   — `.dir-hh`: appended LAST at z-index:-1 inside a host isolated
              below (the listing hero isolates itself anyway), so the stars sit
              above any background layer stacked at -1 and under all content.
     under  — `.ait-fall--under`, for the homepage-family `.hpx-hero`, which
              must NOT be isolated (its search suggestions have to spill over
              the sections below): inserted FIRST at z-index 1, the level of
              its orbit and tiles, under the copy and the counters (2).
   ============================================================================ */

/* The host. Zero specificity: a hero's own `position` / `isolation` rules
   win; a static box becomes the containing block the layer needs. */
:where(.ait-fall-host) {
    position: relative;
    isolation: isolate;
}

.ait-fall {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
    /* Light: a deep brand-blue streak with a sky-blue lead-in. The first pass
       borrowed a pale .45 wash of #3680ED that measured 1.75:1 on white — a
       smudge, not a star. Now 4.32:1 along the body, 6.70:1 at the head (on
       #EAF2FD, the hero's glow: 3.91 / 5.94). */
    --fall-tail-a: rgba(96, 164, 245, .45);
    --fall-tail: rgba(37, 99, 235, .9);
    --fall-head: #1D4ED8;
    --fall-glow: rgba(37, 99, 235, .5);
}
.ait-fall--under { z-index: 1; }

/* At night: a white head with a blue-white glow (auth-sky.css §5). */
body.theme-dark .ait-fall {
    --fall-tail-a: rgba(170, 205, 255, .3);
    --fall-tail: rgba(170, 205, 255, .65);
    --fall-head: #FFFFFF;
    --fall-glow: rgba(160, 200, 255, .85);
}

/* --x / --y place the HEAD (the margin pulls the line back by its length). */
.ait-fall__star {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--len, 140px);
    height: 2px;
    margin: -1px 0 0 calc(var(--len, 140px) * -1);
    border-radius: 999px;
    background: linear-gradient(90deg, transparent 0%, var(--fall-tail-a) 45%, var(--fall-tail) 88%, var(--fall-head) 100%);
    transform-origin: 100% 50%;
    opacity: 0;
    animation: ait-fall var(--dur, 12s) cubic-bezier(.4, 0, .7, 1) var(--dl, 0s) infinite;
}
/* The lit head. Physical `right`: the streak's gradient is physical too, so
   in RTL the head stays on the same end. */
.ait-fall__star::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -2px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--fall-head);
    transform: translateY(-50%);
    box-shadow: 0 0 10px 3px var(--fall-glow);
}
/* Light only: a hairline halo so the streak holds its edge on white, and a
   crisper head. At night the glow above already does this job. */
body:not(.theme-dark) .ait-fall__star { filter: drop-shadow(0 0 2px rgba(37, 99, 235, .35)); }
body:not(.theme-dark) .ait-fall__star::after {
    box-shadow: 0 0 0 1px rgba(29, 78, 216, .25), 0 0 12px 4px var(--fall-glow);
}
@keyframes ait-fall {
    0%   { opacity: 0; transform: rotate(var(--ang, 140deg)) translateX(0) scaleX(.3); }
    1.5% { opacity: 1; }
    9%   { opacity: 0; transform: rotate(var(--ang, 140deg)) translateX(var(--dist, 380px)) scaleX(1); }
    100% { opacity: 0; transform: rotate(var(--ang, 140deg)) translateX(var(--dist, 380px)) scaleX(1); }
}

/* Paths plotted on the homepage hero (a centred copy column, open sky either
   side): down between the top tiles and the headline, and down the outer
   margins. On a left-aligned hero they still run the edges. They pass BEHIND
   the copy wherever they cross it. */
.ait-fall__star--1 { --x: 97%; --y: 3%;  --len: 170px; --ang: 142deg; --dist: 440px; --dur: 12s;   --dl: .8s;   }
.ait-fall__star--2 { --x: 33%; --y: 1%;  --len: 120px; --ang: 136deg; --dist: 340px; --dur: 12.5s; --dl: 3s;    }
.ait-fall__star--3 { --x: 88%; --y: 18%; --len: 110px; --ang: 138deg; --dist: 260px; --dur: 13s;   --dl: 5.2s;  }
.ait-fall__star--4 { --x: 99%; --y: 60%; --len: 140px; --ang: 146deg; --dist: 360px; --dur: 13.5s; --dl: 7.4s;  }
.ait-fall__star--5 { --x: 18%; --y: 46%; --len: 100px; --ang: 136deg; --dist: 300px; --dur: 14s;   --dl: 9.6s;  }
.ait-fall__star--6 { --x: 26%; --y: 74%; --len: 120px; --ang: 150deg; --dist: 280px; --dur: 14.5s; --dl: 11.8s; }

/* Tablets: the side sky narrows with the box, so two stand down. */
@media (max-width: 1100px) {
    .ait-fall__star--3,
    .ait-fall__star--6 { display: none; }
}

/* Phones: four shorter streaks re-plotted for a narrow, tall hero — two from
   the top edge, two entering from the right — about one every three seconds. */
@media (max-width: 700px) {
    .ait-fall__star--1 { --x: 100%; --y: 3%;  --len: 110px; --ang: 145deg; --dist: 320px; --dur: 11s;   --dl: .8s;  }
    .ait-fall__star--2 { --x: 58%;  --y: 0%;  --len: 90px;  --ang: 138deg; --dist: 260px; --dur: 12.5s; --dl: 3.6s; }
    .ait-fall__star--4 { --x: 104%; --y: 42%; --len: 110px; --ang: 150deg; --dist: 320px; --dur: 13.5s; --dl: 6.6s; }
    .ait-fall__star--5 { --x: 36%;  --y: 18%; --len: 80px;  --ang: 132deg; --dist: 220px; --dur: 14s;   --dl: 9.4s; }
    .ait-fall__star::after { width: 4px; height: 4px; box-shadow: 0 0 8px 2px var(--fall-glow); }
}

/* A streak held still is a scratch on the screen, not a star: hidden rather
   than frozen mid-fall, like the auth sky's. */
@media (prefers-reduced-motion: reduce) {
    .ait-fall { display: none; }
}
@media (forced-colors: active) {
    .ait-fall { display: none; }
}
@media print {
    .ait-fall { display: none; }
}
