/* ─────────────────────────────────────────────────────────────────────────────
   Edu360 home hero rotator — "ribbon and sticker" (7 Oct 2026)
   HOME PAGE ONLY. Linked from homePage()'s extraHead in scripts/build.mjs, not
   from the shared shell in scripts/lib/site.mjs. That is deliberate: the shell
   ships on all 22,852 pages against a byte budget that is already dropping
   2,259 of them, so a link tag there would cost real pages. Home is
   add("/", 0, ...) — priority 0, never dropped.

   Nothing here is position:fixed, so this file adds NOTHING to the floating
   element register in scripts/css-parts/ticker.css. If you ever make the
   sticker float, add it there and clear the 48px news band.

   Layout: panel height is reserved with aspect-ratio so rotation causes zero
   layout shift (CLS). All four slides are in the DOM; only `hidden` moves.
   ──────────────────────────────────────────────────────────────────────────── */

/* ── pills (timer tabs) ─────────────────────────────────────────────────── */
.hr-rot { display: grid; gap: var(--space-3); }
.hr-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.hr-tab {
  position: relative; overflow: hidden; isolation: isolate;
  font: inherit; font-family: var(--font-accent); font-size: var(--text-xs);
  font-weight: var(--fw-bold); letter-spacing: .02em;
  color: #fff; background: rgb(255 255 255 / .10);
  border: 1px solid rgb(255 255 255 / .22); border-radius: var(--radius-full);
  padding: 7px 14px; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.hr-tab:hover { background: rgb(255 255 255 / .18); }
.hr-tab > span { position: relative; z-index: 1; }
/* the fill is a child, not a background-position trick, so the JS can reset it
   by removing the class and the bar never fights the hover colour. */
.hr-tab i {
  position: absolute; inset: 0 auto 0 0; z-index: 0;
  width: 0; background: var(--amber-500); border-radius: inherit;
}
.hr-tab[aria-selected="true"] { color: var(--navy-900); background: #fff; border-color: #fff; }
.hr-tab[aria-selected="true"] i { background: var(--amber-400); }
.hr-tab.is-timing i { animation: hr-fill var(--hr-dwell, 5s) linear forwards; }
@keyframes hr-fill { from { width: 0 } to { width: 100% } }
.hr-tab:focus-visible { outline: 3px solid var(--amber-400); outline-offset: 2px; }

/* ── the panel ──────────────────────────────────────────────────────────── */
.hr-panels {
  position: relative; border-radius: var(--radius-xl); overflow: hidden;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
  box-shadow: var(--shadow-xl);
  /* Height is reserved here, once, for every slide. Do not move this to the
     slide or the panel will jump as slides swap. */
  aspect-ratio: 4 / 3;
}
.hr-slide { position: absolute; inset: 0; display: grid; grid-template-rows: 1fr auto; }
.hr-slide[hidden] { display: none; }
.hr-shot { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--navy-900), var(--navy-700)); }
/* Both fits are `cover`. The fallbacks in /assets/img/streams/ are PHOTOGRAPHS, not
   flat illustrations — `contain` rendered a 236px photo as a small inset floating on
   the gradient, which looks unfinished. Upscaled ~2.5x they are soft but read as a
   hero. is-art survives only to mark which slides are still on a fallback. */
.hr-shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.hr-shot::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 55%;
  background: linear-gradient(to top, rgb(10 28 45 / .25), transparent);
}

/* 🔴 TWO gradients stack here and BOTH set how much photograph shows through. The one on
   .hr-shot::after darkens the bottom 55% of the image, and this one sits on top of it, so
   the effective cover under the text is 1-(1-shot)(1-copy). At the original .85 and .97
   that was 0.9955 — only HALF A PERCENT of the photo came through, which is why the block
   read as flat navy. Now .25 and .84/.80: 0.88 effective, so about 12% of the photograph
   shows, roughly 27x more. Change one of these two without the other and the result will
   not be what you expect.

   📐 Which one to turn is NOT obvious, and a sweep settled it. The .hr-shot::after value
   barely moves text contrast at all — dropping it .70 -> 0 moved the worst kicker only
   4.24 -> 5.14, because the .hr-copy layer sits on top of it exactly where the glyphs are.
   So .hr-shot::after is nearly free: take the photo back THERE, and spend the contrast
   budget on .hr-copy. A first attempt at .50 / .62-.58 looked right and measured
   2.63-3.02:1 on the kicker — a hard fail on all four slides. Measure, do not eyeball.

   The scrim lives on .hr-copy, not only on the image, so it always covers exactly the text
   whatever photo ends up behind it. The 26px taper sits ENTIRELY inside the 40px
   padding-top, so no glyph ever lands on a partly transparent stop. A % taper did once, and
   the amber kicker measured 2.41:1.

   📐 Measured at these values, compositing BOTH gradients over each slide's real
   photograph and taking the WORST pixel under each run of type: kicker 5.54:1, headline
   9.74:1, body 9.01:1. The amber kicker (#FFBD35, luminance .58) is the binding
   constraint and it fails first — at .78 here it is 5.14 and at .72 it is 4.24, under the
   bar. If you want the photo lighter still, the kicker colour has to change; the scrim has
   no room left. */
.hr-copy {
  position: absolute; inset: auto 0 0 0;
  padding: var(--space-10) var(--space-5) calc(var(--space-5) + 30px); /* padding-top 40px > the 26px taper, so no glyph sits on a partly transparent stop */
  background: linear-gradient(to top, rgb(10 28 45 / .84) 0, rgb(10 28 45 / .80) calc(100% - 26px), rgb(10 28 45 / 0) 100%);
}
/* ⚠️ These selectors are DOUBLE-CLASSED on purpose. `.hero p` in components.css is
   (0,1,1) and these are <p> elements inside .hero, so a single `.hr-h` (0,1,0) loses
   and the headline renders at body size in body colour. Do not simplify them. */
.hr-slide .hr-kicker {
  margin: 0; font-family: var(--font-accent); font-size: var(--text-xs); font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--amber-400);
}
.hr-slide .hr-h { margin: 6px 0 0; font-family: var(--font-display); font-weight: var(--fw-bold);
  font-size: clamp(1.3rem, 2vw, 1.65rem); line-height: var(--lh-tight); color: #fff; }
.hr-slide .hr-p { margin: 6px 0 var(--space-4); font-size: var(--text-sm); line-height: var(--lh-snug); color: #E6EDF6; }
.hr-slide .btn { box-shadow: var(--shadow-md); }

/* ── ribbons: two tilted CSS-only marquees across the panel bottom ──────── */
.hr-ribbons { position: absolute; inset: auto 0 0 0; height: 30px; pointer-events: none; }
.hr-rib {
  position: absolute; left: -12%; width: 124%; overflow: hidden;
  display: flex; white-space: nowrap;
  font-family: var(--font-accent); font-size: 11px; font-weight: var(--fw-bold);
  letter-spacing: .08em; text-transform: uppercase;
}
.hr-rib--a { bottom: 14px; transform: rotate(-2.2deg); background: var(--amber-500); color: var(--navy-900); }
.hr-rib--b { bottom: -2px; transform: rotate(1.6deg); background: var(--navy-900); color: var(--amber-400); border-block: 1px solid rgb(255 189 53 / .35); }
.hr-rib b { flex: 0 0 auto; padding: 4px 0; font-weight: inherit; animation: hr-run 22s linear infinite; }
.hr-rib--b b { animation-duration: 28s; animation-direction: reverse; }
.hr-rib b span { padding: 0 10px; }
@keyframes hr-run { from { transform: translateX(0) } to { transform: translateX(-50%) } }

/* ── spinning sticker ───────────────────────────────────────────────────── */
.hr-sticker {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 86px; height: 86px; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  background: var(--amber-500); color: var(--navy-900);
  font-family: var(--font-accent); font-size: 11px; font-weight: var(--fw-bold);
  line-height: 1.15; letter-spacing: .02em; text-decoration: none;
  box-shadow: 0 6px 18px rgb(15 41 66 / .45);
  animation: hr-spin 18s linear infinite;
}
.hr-sticker span { display: block; width: 60px; }
.hr-sticker:hover { background: var(--amber-400); }
.hr-sticker:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@keyframes hr-spin { from { transform: rotate(-8deg) } 50% { transform: rotate(8deg) } to { transform: rotate(-8deg) } }

/* ── phone ──────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .hr-panels { aspect-ratio: 1 / 1; }
  .hr-copy { padding: var(--space-8) var(--space-4) calc(var(--space-4) + 28px); }
  .hr-slide .hr-h { font-size: var(--text-lg); }
  .hr-sticker { width: 68px; height: 68px; font-size: 10px; }
  .hr-sticker span { width: 50px; }
}
@media (max-width: 420px) {
  .hr-tab { padding: 6px 11px; font-size: 10px; }
}

/* ── reduced motion: no rotation, no marquee, no spin ───────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hr-tab.is-timing i, .hr-rib b, .hr-sticker { animation: none; }
  .hr-tab[aria-selected="true"] i { width: 100%; }
}

/* ── Browse by stream: equal-height tiles ───────────────────────────────────
   .ptiles itself lives in portal-v2.css, which ships on all 22,852 pages — but the
   grid is used on HOME ONLY, so the one rule it was missing goes here instead.
   A CSS grid stretches tiles within a row and NOT across rows, so the row holding a
   two-line name ("Computer Applications", "Mass Communication") measured 245px while
   the others were 228px. grid-auto-rows:1fr makes every row match the tallest.
   Keeping it in this file avoids editing a shared stylesheet and the ?v= bump on
   every page that would have had to come with it. */
.ptiles { grid-auto-rows: 1fr; }

/* ── the LEFT hero column, which rotates with the panel ─────────────────────
   Eyebrow tail, the phrase inside the H1, the lede and the quick chips all change
   with the slide, so the whole hero moves rather than just the picture.

   🔴 Zero layout shift is the whole design here, and it is not automatic:

   (a) .hr-stack puts every lede (and every chip set) in ONE grid cell, so the block
       is always as tall as the TALLEST variant and swapping cannot move the search
       box or the chips below it. Inactive variants are `visibility:hidden` — NOT
       `display:none` — because display:none would collapse the cell and bring the
       jump straight back.
   (b) .hr-h1 reserves a min-height, because the phrases are different lengths
       ("engineering college" vs "PG medical seat") and a shorter one can reflow the
       headline from three lines to two. The values below are measured against the
       longest phrase at each width. Re-measure if you change the H1 copy. */
.hr-stack { display: grid; }
.hr-stack > * { grid-area: 1 / 1; }
.hr-stack .is-off { visibility: hidden; }
.hr-stack--chips { margin-top: var(--space-4); }
.hr-stack--chips > * { margin-top: 0; align-content: start; }

/* 🔴 The H1 is THREE FIXED LINES and that is the whole point of this block.

     line 1   Find the right
     line 2   <engineering college>,     <- the ONLY thing that changes
     line 3   with facts you can check

   Before this, the four phrases were different lengths, so the headline reflowed: words
   jumped between lines, the block went 4 lines to 3, and the hero height, the chips, the
   stats strip AND the right-hand panel all moved every 5 seconds. A rotation is not user
   input, so that shift counted in full against Core Web Vitals CLS.

   Each line is its own block with `white-space: nowrap`, so a longer or shorter course
   word can never push a word onto another line — it only makes line 2 wider or narrower.
   The line COUNT is constant BY CONSTRUCTION at every width: no min-height, no ::after
   sizer, nothing measured per breakpoint that can rot.

   ⚠️ THE SELECTOR IS DOUBLE-CLASSED, AND IT HAS TO BE. `.hero--home h1` in portal-v2.css
   is (0,1,1) and sets `font-size: var(--text-4xl)` AND `max-width: 16ch`. A plain
   `.hr-h1` is (0,1,0) and loses to it — the first version of this block was silently
   ignored and the headline still overflowed. Same trap as `.hero p` beating `.hr-h`.
   Do not simplify to `.hr-h1`.

   ⚠️ `max-width: 16ch` is overridden because a nowrap line cannot wrap out of a narrow
   box — it just overflows and the page scrolls sideways. The H1 now uses the full hero
   column, and the font below is sized so the WIDEST line fits that column.

   📐 Measured, not guessed. Line 3 "with facts you can check" is the widest line (about
   11.4x the font size); line 2's longest phrase, "management college,", is only 9.9x. So
   the fixed text sets the ceiling, not the rotating word. Hero column widths measured in
   a browser with max-width removed:

     two columns (>=1024px):  1024->479px  1100->518  1200->569  1280->610  1440+->622
     one column  (<1024px):   1000->952   768->720   600->568   480->448   ~375->358

   Those two-column figures are the DESIGNED 1.05fr track, measured after min-width:0 —
   not the inflated track the nowrap lines produced before it.

   The two clamps below keep 11.4x the font inside those, with headroom. Re-measure if
   you change the H1 copy, the hero grid ratio or the container width. */
/* 🔴 min-width:0 on the grid children, and it is load-bearing.
   `.hero--home .hero__grid` is `1.05fr 1fr`, and an `fr` track's automatic minimum is
   MIN-CONTENT. A nowrap headline line wider than the track's fair share therefore pushes
   the track open and steals that width from the right-hand panel — measured at 1024px,
   the panel went 465px wide to 382px and, being aspect-ratio'd, got shorter with it. It
   did not move between the four variants (the widest line is the fixed one), so it was
   not the bug Sagar reported — but the panel was quietly smaller than designed on every
   width. min-width:0 lets the tracks keep their designed ratio; the font clamps below are
   then measured against THAT width, not against an inflated one. */
.hero--home .hero__grid > * { min-width: 0; }
.hero--home .hr-h1 { max-width: none; font-size: clamp(22px, 7.1vw, 56px); line-height: 1.12; }
@media (min-width: 1024px) {
  /* the 1024 breakpoint here MUST match portal-v2.css's `.hero--home .hero__grid`
     two-column query — that is the width where the column suddenly halves. */
  .hero--home .hr-h1 { font-size: clamp(32px, 3.95vw, 54px); }
}
/* 🔴 `color:#fff` here is NOT redundant. `.hero h1 { color:#fff }` with
   `.hero h1 span { color: var(--amber-400) }` lives in components.css — and the three
   lines are <span>s, so ALL THREE turned gold the moment they became spans. Only
   "facts you can check" is meant to be gold. This rule is (0,2,1) against that rule's
   (0,1,2), so it wins on class count; the gold is then put back on the <i> alone.
   That is also why the rotating course word is a <b>, not a <span>: a <span> would pick
   the gold straight back up. Do not change those two tag names. */
.hero--home .hr-h1 > span { display: block; white-space: nowrap; color: #fff; }
.hero--home .hr-h1 i { font-style: normal; color: var(--amber-400); }
.hero--home .hr-h1 [data-hr-word] { font-weight: inherit; color: inherit; }
