/*
 * GraceFX — 15-second welcome intro
 * ---------------------------------
 * Self-contained styles. Every rule is scoped to #gfx-intro or to the
 * temporary html.gfx-intro-active class, which only exists while the intro
 * is playing. Nothing here touches the existing site once the intro ends.
 */

/* While the intro plays: lock scrolling and keep the site hidden underneath. */
html.gfx-intro-active {
  overflow: hidden;
  background: #070a12;
}
html.gfx-intro-active body > :not(#gfx-intro) {
  visibility: hidden;
  /* Safety net: if the script ever fails, the site reveals itself anyway. */
  animation: gfx-failsafe 1ms linear 20s both;
}
@keyframes gfx-failsafe {
  to { visibility: visible; }
}

#gfx-intro {
  --gfx-ink: #e9edf7;
  --gfx-dim: #9aa8c6;
  --gfx-accent: #4d8dff;
  --gfx-accent-soft: #8db4ff;
  --gfx-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --gfx-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  position: fixed;
  inset: 0;
  z-index: 2147483000;
  width: 100%;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(130% 95% at 50% 42%, #0e1a38 0%, #0a1228 38%, #070a14 70%, #04060b 100%),
    #070a12;
  color: var(--gfx-ink);
  font-family: var(--gfx-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#gfx-intro *,
#gfx-intro *::before,
#gfx-intro *::after {
  box-sizing: border-box;
}

/* ---------- Atmosphere layers ---------- */
#gfx-intro .gfx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#gfx-intro .gfx-halo {
  background: radial-gradient(44% 36% at 50% 46%, rgba(77, 141, 255, .22), rgba(77, 141, 255, .07) 55%, transparent 76%);
  opacity: 0;
}
#gfx-intro .gfx-sweep {
  inset: -20% -40%;
  background: linear-gradient(105deg,
    transparent 38%,
    rgba(120, 165, 255, .06) 46%,
    rgba(170, 200, 255, .09) 50%,
    rgba(120, 165, 255, .06) 54%,
    transparent 62%);
  opacity: 0;
}
#gfx-intro .gfx-grid {
  background-image:
    linear-gradient(rgba(120, 150, 210, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 150, 210, .07) 1px, transparent 1px);
  background-size: 72px 72px;
  background-position: center center;
  -webkit-mask-image: radial-gradient(75% 60% at 50% 62%, #000 25%, transparent 80%);
  mask-image: radial-gradient(75% 60% at 50% 62%, #000 25%, transparent 80%);
  opacity: 0;
}
#gfx-intro .gfx-canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
}
#gfx-intro .gfx-vignette {
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(2, 4, 9, .72) 100%);
}

/* ---------- Stage: every scene shares one centred grid cell ---------- */
#gfx-intro .gfx-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding:
    max(64px, calc(env(safe-area-inset-top, 0px) + 48px))
    max(20px, env(safe-area-inset-right, 0px))
    max(64px, calc(env(safe-area-inset-bottom, 0px) + 48px))
    max(20px, env(safe-area-inset-left, 0px));
  pointer-events: none;
}
#gfx-intro:not(.gfx-run) .gfx-stage,
#gfx-intro:not(.gfx-run) .gfx-skip {
  visibility: hidden;
}
#gfx-intro .gfx-scene {
  grid-area: 1 / 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  text-align: center;
  text-shadow: 0 2px 30px rgba(3, 6, 14, .85);
}

/* ---------- Scene 1–2: brand reveal + welcome ---------- */
#gfx-intro .gfx-eyebrow {
  font: 500 clamp(11px, 1.25vw, 14px) / 1.2 var(--gfx-sans);
  letter-spacing: .52em;
  padding-left: .52em;
  color: #a9bce4;
  margin-bottom: clamp(14px, 2.4vh, 26px);
}
#gfx-intro .gfx-mark {
  font-family: var(--gfx-serif);
  font-weight: 300;
  font-size: clamp(40px, min(11.5vw, 17vh), 136px);
  line-height: 1;
  letter-spacing: .09em;
  padding-left: .09em;
  color: var(--gfx-ink);
  white-space: nowrap;
}
#gfx-intro .gfx-mark span {
  display: inline-block;
}
#gfx-intro .gfx-mark .gfx-fx {
  color: var(--gfx-accent);
  font-weight: 500;
  text-shadow: 0 0 34px rgba(77, 141, 255, .45), 0 2px 30px rgba(3, 6, 14, .85);
}
#gfx-intro .gfx-rule {
  height: 1px;
  width: min(420px, 62vw);
  margin: clamp(18px, 3vh, 30px) auto 0;
  background: linear-gradient(90deg, transparent, rgba(141, 180, 255, .85), transparent);
  transform-origin: center;
}

/* ---------- Scene 3: learn the market ---------- */
#gfx-intro .gfx-line {
  overflow: hidden;
  padding: .04em .1em .1em;
}
#gfx-intro .gfx-line + .gfx-line {
  margin-top: .1em;
}
#gfx-intro .gfx-line > span {
  display: inline-block;
  font: 300 clamp(26px, min(5vw, 8vh), 64px) / 1.14 var(--gfx-serif);
  letter-spacing: .03em;
  text-wrap: balance;
}
#gfx-intro .gfx-line em {
  font-style: normal;
  color: var(--gfx-accent-soft);
}

/* ---------- Scene 4: we learn, we execute ---------- */
#gfx-intro .gfx-s4 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.6vh, 14px);
}
#gfx-intro .gfx-phrase {
  display: block;
  font: 300 clamp(22px, min(5.6vw, 7vh), 44px) / 1.15 var(--gfx-serif);
  letter-spacing: .04em;
  text-wrap: balance;
}
#gfx-intro .gfx-phrase em {
  font-style: normal;
  color: var(--gfx-accent-soft);
}
#gfx-intro .gfx-sep {
  display: none;
}
@media (min-width: 1180px) {
  #gfx-intro .gfx-s4 {
    flex-direction: row;
    gap: clamp(20px, 2.2vw, 36px);
  }
  #gfx-intro .gfx-phrase {
    font-size: clamp(26px, 2.6vw, 40px);
    white-space: nowrap;
  }
  #gfx-intro .gfx-sep {
    display: block;
    flex: none;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--gfx-accent);
    box-shadow: 0 0 12px rgba(77, 141, 255, .8);
  }
}

/* ---------- Scene 5: creed, logo and tagline ---------- */
#gfx-intro .gfx-creed {
  display: grid;
  gap: clamp(6px, 1.1vh, 12px);
  font: 500 clamp(11px, 1.35vw, 15px) / 1.45 var(--gfx-sans);
  letter-spacing: .26em;
  color: var(--gfx-dim);
}
#gfx-intro .gfx-creed > div {
  padding-left: .26em;
}
#gfx-intro .gfx-creed b {
  font-weight: 600;
  color: var(--gfx-ink);
}
#gfx-intro .gfx-s5 .gfx-rule {
  width: min(160px, 32vw);
  margin: clamp(18px, 3.2vh, 32px) auto;
}
#gfx-intro .gfx-mark--final {
  font-size: clamp(40px, min(8.4vw, 12vh), 104px);
}
#gfx-intro .gfx-tagline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .5em 0;
  margin-top: clamp(16px, 2.8vh, 28px);
  font: 500 clamp(10px, 1.1vw, 13px) / 1.6 var(--gfx-sans);
  letter-spacing: .3em;
  color: var(--gfx-accent-soft);
}
#gfx-intro .gfx-tagline span {
  white-space: nowrap;
  padding-left: .3em;
}
#gfx-intro .gfx-tagline i {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin: 0 1.1em;
  border-radius: 50%;
  background: var(--gfx-accent);
  opacity: .8;
}
@media (max-width: 640px) {
  #gfx-intro .gfx-tagline {
    flex-direction: column;
  }
  #gfx-intro .gfx-tagline i {
    display: none;
  }
}

/* ---------- Progress line + skip control ---------- */
#gfx-intro .gfx-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(77, 141, 255, .1);
  pointer-events: none;
}
#gfx-intro .gfx-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, rgba(77, 141, 255, .35), rgba(141, 180, 255, .9));
  transform-origin: left center;
  transform: scaleX(0);
}
#gfx-intro .gfx-skip {
  position: absolute;
  right: max(20px, calc(env(safe-area-inset-right, 0px) + 16px));
  bottom: max(20px, calc(env(safe-area-inset-bottom, 0px) + 16px));
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  padding: 12px 18px 12px calc(18px + .24em);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  font: 500 11px / 1 var(--gfx-sans);
  letter-spacing: .24em;
  text-transform: uppercase;
  color: #c9d3e8;
  background: rgba(9, 14, 28, .55);
  border: 1px solid rgba(147, 160, 189, .28);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: color .25s ease, border-color .25s ease, background-color .25s ease;
  pointer-events: auto;
}
#gfx-intro .gfx-skip:hover {
  color: #fff;
  border-color: rgba(141, 180, 255, .6);
  background: rgba(14, 24, 48, .72);
}
#gfx-intro .gfx-skip:focus {
  outline: none;
}
#gfx-intro .gfx-skip:focus-visible {
  outline: 2px solid var(--gfx-accent);
  outline-offset: 3px;
}
#gfx-intro .gfx-skip svg {
  width: 12px;
  height: 12px;
  flex: none;
}

/* Screen-reader text */
#gfx-intro .gfx-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
