/* bayneframe.com/join: the Close Friends -> Cohort announcement.
   The final screen, its failsafe and the animation's layers. src/routes/join.tsx links this sheet in <head> and renders
   the #bfa-final markup on the server, so the final screen is styled (and hidden) from the first frame.
   - announce.js takes over (html.bfa-run) and plays the black hole sequence, then shows the final screen.
   - If announce.js never takes over, the final screen fades in by itself 9 s after this sheet applies.
   - Without JS, a <noscript> style in the page shows it at once.
   Composition = the bayneresearch.com/cohort hero: big title, the statue's head overlapping its bottom (title behind,
   statue in front), the sentence and the house button under the statue, all centred. */
:root { --bfa-css: 1; }
@font-face { font-family: Chicago; src: url(/announce/chicago.woff2) format("woff2"); font-display: block; }

#bfa-final {
  position: fixed; inset: 0; z-index: 2147483600;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: #d9d9dc; opacity: 0; visibility: hidden;
  animation: bfa-failsafe .6s ease 9s forwards;
  /* sizes: the visible viewport height (svh, so iPhone Safari's toolbars never push the button off screen), the title
     width (short landscape screens narrow it so everything still fits) and the statue's overlap on the title */
  --vh: 1vh;
  /* the Cohort logo's width and height (1697 x 1111) and the statue's hood over its lower third, as on the trailer */
  --tw: min(56vw, 300px, calc(var(--vh) * 33));   /* smaller (Bayne 10-31: "cohort logo ... should be smaller") */
  --lh: calc(var(--tw) * 1111 / 1697);
  --ov: calc(var(--lh) * .33);
}
@supports (height: 100svh) { #bfa-final { --vh: 1svh; } }
@keyframes bfa-failsafe { from { opacity: 0; visibility: visible; } to { opacity: 1; visibility: visible; } }
/* once the failsafe has covered it, the old page leaves the tab order and the accessibility tree too (the script, when
   it runs, retires the page itself) */
body > :not(#bfa-final):not(#bf-loader):not(script):not(style):not(link):not(noscript) { animation: bfa-failsafe-off 0s linear 9.6s forwards; }
html.bfa-run body > :not(#bfa-final):not(#bf-loader):not(script):not(style):not(link):not(noscript) { animation: none; }
@keyframes bfa-failsafe-off { to { visibility: hidden; } }

/* the script owns the sequence: no failsafe; .bfa-anim = the stage (transparent, the statue and text are animated
   inline), .bfa-done = the static final screen */
html.bfa-run #bfa-final { animation: none; }
#bfa-final.bfa-anim { opacity: 1; visibility: visible; background: transparent; pointer-events: none; }
#bfa-final.bfa-done { opacity: 1; visibility: visible; background: #d9d9dc; animation: none; pointer-events: auto; }

#bfa-final .bfa-inner {
  box-sizing: border-box; min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  /* 4 px more at the bottom = the button's hard shadow, so the gaps above and below read equal */
  padding: max(24px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  text-align: center;
}
/* the rose petals (announce.js startPetals): over the whole screen, behind the statue (z 0) and in front of it (z 2) */
#bfa-final .bfa-inner { position: relative; }
#bfa-final .bfa-petals { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity .6s ease; }
#bfa-final .bfa-petals.on { opacity: 1; }
#bfa-final .bfa-title { position: relative; z-index: 0; width: var(--tw); height: var(--lh); margin: 0; padding: 0; font-size: 0; line-height: 0; }
#bfa-final .bfa-title img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
/* the script focuses the title when the screen lands, so screen readers start there; it is not a tab stop */
#bfa-final .bfa-title:focus { outline: none; }
#bfa-final .bfa-statue {
  display: block; position: relative; z-index: 1; width: auto; max-width: none;
  height: clamp(130px, calc(var(--vh) * 100 - var(--lh) + var(--ov) - 250px), 290px);   /* smaller (Bayne 10-31) */
  margin-top: calc(var(--ov) * -1);
  transform-origin: 50% 50%;
  -webkit-user-drag: none; user-select: none;
}
#bfa-final .bfa-text {
  margin: 22px 0 0; padding: 0; max-width: 32em;
  font: 400 17px/1.45 Colfax, system-ui, sans-serif; color: #0b0b10;
  text-wrap: balance;
}
/* one sentence per line; a sentence too long for a phone wraps, balanced */
#bfa-final .bfa-text span { display: block; }
/* the bayneresearch.com house button .go, exactly */
#bfa-final .bfa-go {
  display: inline-block; position: relative; margin-top: 22px; padding: 15px 18px 14px;
  background: #0b0b10; color: #fff; border: 1.5px solid #0b0b10; text-align: center; text-decoration: none;
  font: 15px/1 Chicago, system-ui, sans-serif; letter-spacing: .08em; box-shadow: 4px 4px 0 0 #9a9aa0; white-space: nowrap;
}
#bfa-final .bfa-go:hover { background: #fff; color: #0b0b10; }
@media (max-width: 600px) {
  #bfa-final .bfa-statue { height: clamp(130px, calc(var(--vh) * 100 - var(--lh) + var(--ov) - 270px), min(62vw, 250px)); }
  #bfa-final .bfa-text { font-size: 16px; }
}
/* short landscape screens (phones on their side): tighter gaps so the whole screen still fits */
@media (min-width: 601px) and (max-height: 500px) {
  #bfa-final .bfa-inner { padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  #bfa-final .bfa-text { margin-top: 14px; }
  #bfa-final .bfa-go { margin-top: 14px; }
}

/* the animation's layers (created by announce.js): the black hole, under the statue and above everything else, and the
   WebGL canvas that replaces the page during the vacuum, under everything */
#bfa-hole {
  position: fixed; left: 0; top: 0; z-index: 2147483500; pointer-events: none; border-radius: 50%;
  background: radial-gradient(closest-side, #000 calc(100% - 2.5px), rgba(0, 0, 0, 0) 100%);
  transform: scale(0); will-change: transform;
}
/* the rendered black hole (announce.js makeBlackHole): its picture is drawn on the canvas, no disc behind it */
#bfa-hole.bfa-bh { border-radius: 0; background: none; }
#bfa-gl { position: fixed; left: 0; top: 0; z-index: -1; pointer-events: none; visibility: hidden; }
html.bfa-lock { overflow: hidden !important; }
/* after the sequence: nothing of the old page shows, including what its scripts add to <body> later */
html.bfa-retired body > :not(#bfa-final) { display: none !important; }
.bfa-gone { visibility: hidden !important; }
.bfa-keep { visibility: visible !important; }
