/* The home page hero (James, 17 October 2026). Shards of polished metal gather into "UniOne", melt
   into one piece, then fold into the faceted logo as the page scrolls; a slow liquid-metal backdrop
   moves behind it. The hero is the one place on the site that moves on its own. Everything after it
   is the page as it was. The 3D is hero3d.js (three.js, bundled and self-hosted for the CSP); hero.js
   starts it and moves the words. Under Reduce Motion, or without WebGL, the hero lies flat: the
   words, the buttons and a still of the logo. */

.hero3d {
  --hero-floor: #F4F2EF;
  --hero-glow: rgba(224, 74, 96, .16);
  --veil: rgba(244, 242, 239, .86);
  --shade: rgba(244, 242, 239, .85);
  position: relative; height: 200vh;
}
@media (prefers-color-scheme: dark) {
  .hero3d {
    --hero-floor: #09090D;
    --hero-glow: rgba(160, 36, 56, .3);
    --veil: rgba(9, 9, 13, .86);
    --shade: rgba(9, 9, 13, .8);
  }
}
/* The colour the liquid backdrop settles into (hero3d.js uses the same two). */
.hero-pin {
  position: sticky; top: 0; isolation: isolate; height: 100svh; overflow: clip;
  display: grid; place-items: center; padding: var(--header-h) var(--gutter) 0; text-align: center;
  background: var(--hero-floor);
}
.hero-pin::before { content: ""; position: absolute; inset: 0; z-index: -2; background: radial-gradient(ellipse 30% 42% at 50% 52%, var(--hero-glow), transparent 70%); }
.hero-mark { position: absolute; inset: 0; z-index: -1; -webkit-mask-image: linear-gradient(transparent, #000 13%, #000 90%, transparent); mask-image: linear-gradient(transparent, #000 13%, #000 90%, transparent); }
.hero-mark canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 1.6s var(--ease); }
/* The backdrop melts into the floor over the lower half of the hero, so nothing ends in a line. */
.hero-mark .liquid {
  transition: opacity 2.4s var(--ease);
  -webkit-mask-image: linear-gradient(#000 0%, #000 40%, rgba(0,0,0,.93) 50%, rgba(0,0,0,.8) 59%, rgba(0,0,0,.62) 67%, rgba(0,0,0,.44) 75%, rgba(0,0,0,.28) 82%, rgba(0,0,0,.15) 88%, rgba(0,0,0,.06) 94%, transparent 100%);
  mask-image: linear-gradient(#000 0%, #000 40%, rgba(0,0,0,.93) 50%, rgba(0,0,0,.8) 59%, rgba(0,0,0,.62) 67%, rgba(0,0,0,.44) 75%, rgba(0,0,0,.28) 82%, rgba(0,0,0,.15) 88%, rgba(0,0,0,.06) 94%, transparent 100%);
}
.hero-mark canvas[data-ready] { opacity: 1; }

.hero-copy { position: relative; display: grid; justify-items: center; gap: 20px; max-width: 900px; will-change: opacity, transform; }
/* A soft pool of the floor colour behind the words keeps them clear of the shards. */
.hero-copy::before { content: ""; position: absolute; inset: -22% -26%; z-index: -1; background: radial-gradient(closest-side, var(--veil) 45%, transparent); pointer-events: none; }
.hero3d .display { font: 380 clamp(46px, 7vw, 104px)/.98 var(--serif); letter-spacing: -.026em; color: var(--ink); text-wrap: balance; text-shadow: 0 2px 40px var(--shade); }
.hero3d .display span { display: block; }
.hero3d .lede { max-width: 32em; margin-inline: auto; font-size: clamp(17px, 1.5vw, 20px); line-height: 1.5; color: var(--text-2); text-wrap: pretty; text-shadow: 0 1px 24px var(--shade); }
.hero3d .hero-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 6px; }
.hero3d .btn-lg { height: 46px; padding: 0 24px; font-size: 15.5px; }
.hero3d .meta { margin-top: -6px; }
/* A Windows button before the Windows build is published says so and links nowhere (script.js,
   download()); once latest.json lists a signed Windows build it becomes a real download. */
.hero3d a.btn:not([href]) { color: var(--text-2); background: transparent; cursor: default; }
.hero3d a.btn:not([href]):hover { box-shadow: none; }

/* The words come in once; while the shards play they step aside (hero.js), and the download
   buttons wait at the bottom of the screen, so downloading is always one tap away. */
@media (prefers-reduced-motion: no-preference) {
  html[data-js] .hero-copy > * { opacity: 0; transform: translateY(14px); animation: hero-in 1.1s var(--ease-out) forwards; }
  html[data-js] .hero-copy > :nth-child(2) { animation-delay: .12s; }
  html[data-js] .hero-copy > :nth-child(3) { animation-delay: .22s; }
  html[data-js] .hero-copy > :nth-child(n+4) { animation-delay: .32s; }
}
.hero-dock { position: absolute; left: 0; right: 0; bottom: max(28px, env(safe-area-inset-bottom)); display: flex; justify-content: center; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .5s var(--ease), transform .5s var(--ease); }
.hero-dock[data-on] { opacity: 1; transform: none; pointer-events: auto; }
.hero-dock .hero-actions { margin: 0; }
.hero-dock .btn { height: 38px; padding: 0 18px; font-size: 14px; }

/* Flat: Reduce Motion, or no WebGL. The logo stands still under the words and nothing is pinned. */
.mark-spot { display: none; width: min(64vw, 320px); aspect-ratio: .78; margin: 32px auto 0; background: url(/assets/hero/mark-still-light.webp) center / contain no-repeat; }
@media (prefers-color-scheme: dark) { .mark-spot { background-image: url(/assets/hero/mark-still-dark.webp); } }
.hero3d[data-flat] { height: auto; }
.hero3d[data-flat] .hero-pin { position: relative; height: auto; display: block; padding-top: calc(var(--header-h) + 56px); padding-bottom: 48px; }
.hero3d[data-flat] .hero-copy { margin: 0 auto; }
.hero3d[data-flat] .mark-spot { display: block; }
.hero3d[data-flat] .hero-mark, .hero3d[data-flat] .hero-dock { display: none; }

/* Josh's MacBook with the sample semester comes straight after, on his crimson atmosphere. Its top
   starts as the hero's floor and the crimson comes in below it, so the backdrop flows into it with no
   edge, on a phone or a laptop. */
.hero-demo { padding-top: clamp(24px, 4vw, 64px); }
.hero3d + .hero-demo {
  background-image: linear-gradient(var(--hero-floor-next) 0, color-mix(in srgb, var(--hero-floor-next) 55%, transparent) calc(var(--hero-fade) * .45), transparent var(--hero-fade)), var(--hero-bg);
  --hero-floor-next: #F4F2EF;
  --hero-fade: clamp(200px, 30vw, 420px);
}
@media (prefers-color-scheme: dark) { .hero3d + .hero-demo { --hero-floor-next: #09090D; } }
/* Josh's aura and grain come in with the crimson, not at the seam. */
.hero3d + .hero-demo::after {
  -webkit-mask-image: linear-gradient(transparent 0, #000 var(--hero-fade));
  mask-image: linear-gradient(transparent 0, #000 var(--hero-fade));
}
/* The aura starts 20% above the section (styles.css), so the section's top is 18% down its box. */
.hero3d + .hero-demo::before {
  -webkit-mask-image: linear-gradient(transparent 0, transparent 18.2%, #000 calc(18.2% + var(--hero-fade)));
  mask-image: linear-gradient(transparent 0, transparent 18.2%, #000 calc(18.2% + var(--hero-fade)));
}

@media (max-width: 640px) {
  .hero-pin { padding-inline: 20px; }
  .hero-copy { gap: 16px; }
  .hero3d .display { font-size: clamp(40px, 11.5vw, 52px); }
  .hero3d .lede { font-size: 16.5px; }
  .hero3d .btn-lg { height: 46px; padding: 0 24px; }
  .hero3d .phone-line { margin-top: -4px; }
  .hero3d + .hero-demo { --hero-fade: 180px; }
  /* On a phone the logo ends in the middle of a tall screen, with half a screen of floor under it.
     The MacBook comes up into that floor, so there is no empty screen between the two. */
  .hero3d:not([data-flat]) + .hero-demo { margin-top: -22svh; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-copy > * { animation: none; opacity: 1; transform: none; }
}
