/* ============================================================
   Moving background
   ------------------------------------------------------------
   Two layers, on purpose:

     1. Aurora  — slow colour clouds, on every page, behind
                  everything. Deliberately faint: a student is
                  trying to read, and nothing here may compete.
     2. Waves   — three drifting wave shapes, home page only,
                  behind the header and hero. Stronger, because
                  that is the one screen a student looks at the
                  brand rather than at work.

   Everything is tuned from the four numbers below.
   Set --bg-strength to 0 to switch the whole thing off.
   ============================================================ */

:root{
  --bg-strength:    .35;   /* aurora opacity. 0 turns it off entirely  */
  --wave-strength:  .9;    /* hero waves. Louder: little text up there */
  --bg-speed:       .5;    /* 1 = brisk, .5 = half speed, .25 = drifting */

  --bgw1: rgba(12,45,87,.11);    /* navy */
  --bgw2: rgba(30,91,184,.13);   /* blue */
  --bgw3: rgba(244,183,64,.16);  /* gold */
}

/* The page colour moves up to <html> so the body can go clear and
   let the layer underneath show through the gutters. */
html { background: var(--bg); }
body { background: transparent; }


/* ---------- 1. aurora, every page ---------- */

.iba-bg{
  position: fixed; inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  opacity: var(--bg-strength);
}
.iba-bg i{
  position: absolute; display: block;
  width: 58%; height: 78%;
  border-radius: 50%;
  filter: blur(58px);
  /* Its own compositor layer, so the blur is rendered once and
     only the transform changes per frame. */
  will-change: transform;
}
.iba-bg i:nth-child(1){
  left: -6%; top: -12%;
  background: radial-gradient(circle at 50% 50%, var(--bgw2), transparent 68%);
  animation: iba-a1 calc(54s / var(--bg-speed)) ease-in-out infinite alternate;
}
.iba-bg i:nth-child(2){
  right: -10%; top: 4%;
  background: radial-gradient(circle at 50% 50%, var(--bgw3), transparent 68%);
  animation: iba-a2 calc(68s / var(--bg-speed)) ease-in-out infinite alternate;
}
.iba-bg i:nth-child(3){
  left: 18%; bottom: -22%;
  background: radial-gradient(circle at 50% 50%, var(--bgw1), transparent 70%);
  animation: iba-a3 calc(80s / var(--bg-speed)) ease-in-out infinite alternate;
}
@keyframes iba-a1{ to{ transform: translate( 32%, 16%) scale(1.22) } }
@keyframes iba-a2{ to{ transform: translate(-26%, 22%) scale(1.16) } }
@keyframes iba-a3{ to{ transform: translate( 20%,-18%) scale(1.26) } }


/* ---------- 2. waves, home page only ---------- */

.iba-waves{
  position: absolute; left: 0; right: 0; top: 0;
  height: 430px;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  opacity: var(--wave-strength);
  /* The wave body is a solid fill, so without this it would end on a
     ruled line straight across the page. Dissolve it instead: the crest
     stays crisp, the water underneath fades into the page. */
  -webkit-mask-image: linear-gradient(to bottom, #000 58%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 58%, transparent 100%);
}
.iba-waves svg{
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: 100%;
  display: block;
}
/* Each layer slides exactly one wavelength, so the loop has no seam. */
.iba-waves g{
  animation: iba-slide var(--d) linear infinite;
  will-change: transform;
}
@keyframes iba-slide{
  from { transform: translateX(0) }
  to   { transform: translateX(var(--wl)) }
}
.iba-waves .l1 path{ fill: var(--bgw1); }
.iba-waves .l2 path{ fill: var(--bgw2); }
.iba-waves .l3 path{ fill: var(--bgw3); }


/* ---------- the rules that keep it out of the way ---------- */

/* Some students get motion sick. Keep the shapes, stop the movement. */
@media (prefers-reduced-motion: reduce){
  .iba-bg i, .iba-waves g{ animation: none; }
}

/* Phones do the blur in software more often than not. */
@media (max-width: 640px){
  .iba-bg i{ filter: blur(42px); }
  .iba-bg i:nth-child(3){ display: none; }
  .iba-waves{ height: 290px; }
}

/* Never on paper. The marked writing has to print on clean white. */
@media print{
  .iba-bg, .iba-waves{ display: none !important; }
}

/* Escape hatch: put class="iba-flat" on <body> and the page sits still. */
.iba-flat .iba-bg,
.iba-flat .iba-waves{ display: none; }
