/* splash.css — the ~7.5 second intro: the "A" draws itself, "ya." appears, name + quote, then the logo flies into the navbar */

.splash { display: none; }

/* The tiny script at the top of index.html's <body> adds ONE of these to <html>:
   "has-splash" = play it (first visit in this tab, or a reload) · "no-splash" = skip it (navbar logo shows normally) */
html.no-splash .splash { display: none !important; }

/* <html class="has-splash">: the splash is visible */
html.has-splash {
  overflow: hidden;              /* no scrolling while the splash is visible */
  scrollbar-gutter: stable;      /* keeps the page the same width, so the logo lands in the right place */
  animation: splash-unlock 0s 10s forwards;  /* safety: scrolling comes back after 10s even if JS breaks */
}

html.has-splash .splash {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 1000;
  cursor: pointer;
  animation: splash-safety 0.5s 10s forwards; /* safety: the overlay disappears after 10s even if JS breaks */
}

/* The navbar logo stays hidden until the flying logo lands on it */
html.has-splash .nav__logo { visibility: hidden; animation: splash-show 0s 10s forwards; }

/* While the splash plays, the hero text waits; it fades up when the splash leaves */
html.splash-playing :is(.hero__greeting, .hero__name, .hero__role, .hero__intro, .hero__ctas) { animation-play-state: paused; }
html.splash-playing .hero__visual { opacity: 0; }
html.has-splash .hero__visual { transition: opacity 0.8s 0.2s ease; }

/* ---------- Background: dark + soft yellow glow ---------- */
.splash__bg {
  position: absolute;
  inset: 0;
  background: var(--night);
  transition: opacity 0.9s ease;
}
.splash__bg::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(560px, 90vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--yellow);
  opacity: 0.18;
  filter: blur(110px);
  transform: translate(-50%, -50%);
}

.splash__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

/* ---------- The logo ---------- */
.splash__logo { width: 280px; height: auto; color: var(--white); }

/* "A": a yellow outline that draws itself, then the fill fades in. --len is measured in splash.js (getTotalLength) */
.splash__logo .logo-A {
  fill-opacity: 0;
  stroke: var(--logo-accent);
  stroke-width: 8;
  stroke-linejoin: round;
  stroke-dasharray: var(--len, 4000);
  stroke-dashoffset: var(--len, 4000);
}
.splash.is-playing .logo-A {
  animation:
    splash-draw 1.3s 0.3s cubic-bezier(0.65, 0, 0.35, 1) forwards,
    splash-fill 0.5s 1.4s ease forwards;
}

/* "y", "a" and the dot start hidden */
.splash__logo .logo-y,
.splash__logo .logo-a,
.splash__logo .logo-dot { opacity: 0; transform-box: fill-box; transform-origin: center; }

.splash.is-playing .logo-y   { animation: splash-rise 0.7s 1.9s cubic-bezier(0.22, 1, 0.36, 1) both; }
.splash.is-playing .logo-a   { animation: splash-rise 0.7s 2.15s cubic-bezier(0.22, 1, 0.36, 1) both; }
.splash.is-playing .logo-dot { animation: splash-pop 0.5s 2.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ---------- Name (letter by letter) + quote ---------- */
.splash__name {
  margin-top: 36px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--white);
}
.splash__letter { display: inline-block; white-space: pre; opacity: 0; }
.splash.is-playing .splash__letter { animation: splash-fade 0.45s ease forwards; animation-delay: calc(3.1s + var(--i) * 60ms); }

.splash__quote { margin-top: 14px; font-size: 16px; font-style: italic; color: var(--grey-350); opacity: 0; }
.splash.is-playing .splash__quote { animation: splash-fade 0.8s 4.2s ease forwards; }

/* ---------- Skip button ---------- */
.splash__skip {
  position: absolute;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--grey-500);
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, opacity 0.3s ease;
}
.splash__skip:hover,
.splash__skip:focus-visible { color: var(--white); }

/* ---------- Leaving (6.6s): texts + background fade out, the logo flies (transform set in splash.js) ---------- */
.splash.is-leaving { pointer-events: none; }
.splash.is-leaving .splash__bg { opacity: 0; }
.splash.is-leaving :is(.splash__name, .splash__quote, .splash__skip) { opacity: 0 !important; transition: opacity 0.5s ease; }

/* ---------- Keyframes ---------- */
@keyframes splash-draw { to { stroke-dashoffset: 0; } }
@keyframes splash-fill { to { fill-opacity: 1; stroke-opacity: 0; } }
@keyframes splash-rise {
  from { opacity: 0; transform: translateY(20%); }
  to   { opacity: 1; transform: none; }
}
@keyframes splash-pop {
  0%   { opacity: 0; transform: scale(0); }
  60%  { opacity: 1; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes splash-fade { to { opacity: 1; } }
@keyframes splash-safety { to { opacity: 0; visibility: hidden; pointer-events: none; } }
@keyframes splash-unlock { to { overflow: auto; scrollbar-gutter: auto; } }
@keyframes splash-show { to { visibility: visible; } }

@media (max-width: 760px) {
  .splash__logo { width: 200px; }
}
