/* F4NTASTIC landing — redesign 2026.
   Pinned cinematic intro (scroll-scrubbed image sequence + Three.js emblem) and refreshed landing sections.
   JS (js/fx/landing.js) feeds: --p (0..1 intro progress), --finale (0..1 logo finale), per chapter --v / --dir. */

/* ---------- Header floats over the intro ---------- */
.is-landing .site-header {
  position: fixed; inset: 0 0 auto; z-index: 100;
  background: linear-gradient(180deg, rgba(5, 5, 5, .72), rgba(5, 5, 5, 0));
  -webkit-backdrop-filter: none; backdrop-filter: none;
  border-image: none; border-bottom-color: transparent;
}
.is-landing .site-header.is-scrolled {
  /* solid tint instead of backdrop-filter: blurring a canvas that changes every frame is very expensive */
  background: rgba(7, 7, 7, .9);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  border-image: linear-gradient(90deg, transparent, rgba(217, 180, 91, .45) 30%, rgba(255, 255, 255, .12) 60%, transparent) 1;
}
.is-landing main { padding-top: 0 !important; }
.is-landing .page-glow { display: none; }

/* ---------- Intro (pinned) ---------- */
.intro { position: relative; height: 430vh; background: #050505; }
.intro-sticky {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; isolation: isolate;
}
.intro { --p: 0; --finale: 0; }

/* Static glow behind the stage (replaces a per-frame blurred copy of the footage — too costly while scrubbing). */
.intro-sticky::before {
  content: ""; position: absolute; inset: 0; z-index: -3; pointer-events: none;
  background:
    radial-gradient(ellipse 38% 48% at 66% 50%, rgba(217, 180, 91, .13), transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(154, 116, 32, .12), transparent 70%);
}

/* 3D perspective floor — gold grid sliding towards the viewer. The tile layer moves with translate3d
   (JS sets --gy, the scroll offset modulo one tile), so scrolling never repaints the grid. */
.intro-grid {
  position: absolute; left: -50%; right: -50%; bottom: -8%; height: 62%; z-index: -2; overflow: hidden;
  transform: perspective(520px) rotateX(68deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(0deg, #000 10%, transparent 85%);
  mask-image: linear-gradient(0deg, #000 10%, transparent 85%);
  opacity: calc(.35 + var(--finale) * .45);
}
.intro-grid::before {
  content: ""; position: absolute; left: 0; right: 0; top: -64px; bottom: 0;
  background-image:
    linear-gradient(rgba(217, 180, 91, .28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(217, 180, 91, .22) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: translate3d(0, var(--gy, 0px), 0);
  will-change: transform;
}

/* Stage — intro animation on pure black, composited with `screen` so only the light (wolf, flames, logo)
   remains and glows over the grid floor and ambient colour. Layout is driven by js/fx/landing.js. */
.intro-stage {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1;
  mix-blend-mode: screen;
  transform-origin: 50% 50%;
  will-change: transform;
  opacity: 0; transition: opacity 1.2s var(--ease-out-expo);
}
.intro.is-ready .intro-stage { opacity: 1; }

/* Three.js particle layer (emblem hidden: the intro footage ends on the logo). #heroEmblem stays for script.js. */
.intro-logo3d { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; opacity: 0; transition: opacity 1.4s var(--ease-out-expo); }
.has-webgl .intro-logo3d { opacity: 1; }
.intro-emblem-fallback { display: none !important; }

/* Legibility shade */
.intro-shade {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(5, 5, 5, .82) 0%, rgba(5, 5, 5, .4) 34%, transparent 55%),
    linear-gradient(0deg, #050505 0%, transparent 22%),
    linear-gradient(180deg, rgba(5, 5, 5, .55) 0%, transparent 18%);
}

/* Text chapters */
.intro-chapter {
  --v: 0; --dir: 1;
  position: absolute; z-index: 2;
  left: max(clamp(22px, 7vw, 130px), calc((100vw - 1320px) / 2));
  top: 50%; width: min(640px, 52vw);
  opacity: var(--v);
  transform: translateY(calc(-50% + (1 - var(--v)) * 46px * var(--dir)));
  pointer-events: none;
  will-change: opacity, transform;
}
.intro-chapter.is-current { pointer-events: auto; }
.chapter-one { --v: 1; }
.intro-chapter h1, .intro-chapter h2 {
  margin: 0; font: 900 var(--fs-hero)/.82 var(--font-display); letter-spacing: -.02em; text-transform: uppercase;
  text-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.intro-chapter h2 { font-size: clamp(56px, 8.6vw, 140px); }
.intro-chapter .hero-slogan { margin: 26px 0 10px; color: var(--gold-bright); font-size: 12px; font-weight: 800; letter-spacing: .26em; }
.intro-chapter .hero-intro, .intro-note { max-width: 440px; color: #c9c5bb; font-size: var(--fs-body); line-height: 1.85; }
.intro-note { margin-top: 26px; font-size: clamp(15px, 1.3vw, 20px); font-family: var(--font-display); font-weight: 600; letter-spacing: .02em; color: #e3dfd4; }
.intro-chapter .hero-actions { margin-top: 30px; }

.chapter-three {
  left: 50%; top: auto; bottom: clamp(48px, 9vh, 110px); width: min(1000px, 92vw); text-align: center;
  transform: translate(-50%, calc((1 - var(--v)) * 46px * var(--dir)));
}
.chapter-three h2 { font-size: clamp(52px, 7.4vw, 120px); }
.chapter-three h2 br { display: none; }
.chapter-three h2 .gold-text { margin-left: .22em; }
.intro-meta { display: inline-flex; align-items: center; gap: 16px; margin-top: 18px; font-size: 10px; letter-spacing: .3em; font-weight: 800; color: var(--silver); }
.intro-meta strong { color: var(--gold-bright); font: 800 15px var(--font-display); letter-spacing: .1em; }
.intro-meta i { width: 34px; height: 1px; background: var(--grad-gold); }

/* Progress rail, scroll hint, footnote */
.intro-rail { position: absolute; right: clamp(14px, 2.2vw, 36px); top: 50%; width: 1px; height: 32vh; transform: translateY(-50%); background: rgba(255, 255, 255, .14); z-index: 2; }
.intro-rail i { position: absolute; inset: 0; background: var(--grad-gold); transform-origin: top; transform: scaleY(var(--p)); box-shadow: 0 0 10px rgba(246, 221, 147, .6); }
.intro-scroll-hint {
  position: absolute; left: 50%; bottom: 26px; z-index: 2; translate: -50% 0; display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 9px; letter-spacing: .4em; font-weight: 800; color: var(--silver);
  opacity: clamp(0, 1 - var(--p) * 12, 1);
}
.intro-scroll-hint i { width: 1px; height: 46px; background: linear-gradient(var(--gold-bright), transparent); animation: hint-drop 1.8s var(--ease-in-out) infinite; transform-origin: top; }
@keyframes hint-drop { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }
.intro-footnote { position: absolute; left: max(clamp(22px, 7vw, 130px), calc((100vw - 1320px) / 2)); bottom: 30px; margin: 0; z-index: 2; opacity: clamp(0, 1 - var(--p) * 6, 1); }

/* Reduced motion: one static screen. */
.intro.is-static { height: auto; }
.intro.is-static .intro-sticky { position: relative; min-height: 100svh; }
.intro.is-static .chapter-two, .intro.is-static .chapter-three, .intro.is-static .intro-rail, .intro.is-static .intro-scroll-hint { display: none; }

/* ---------- Mobile intro: footage goes full-bleed (portrait fits naturally) ---------- */
@media (max-width: 720px) {
  .intro { height: 360vh; }
  .intro-grid { height: 46%; opacity: .5; }
  .intro-shade {
    background:
      linear-gradient(0deg, rgba(5, 5, 5, .94) 0%, rgba(5, 5, 5, .6) 40%, transparent 62%);
  }
  .intro-chapter { left: 20px; right: 20px; width: auto; top: auto; bottom: 92px; transform: translateY(calc((1 - var(--v)) * 40px * var(--dir))); }
  .intro-chapter h1 { font-size: clamp(64px, 19vw, 96px); }
  .intro-chapter h2 { font-size: clamp(48px, 14vw, 76px); }
  .intro-chapter .hero-intro { font-size: 13px; }
  .intro-chapter .hero-actions { flex-wrap: wrap; }
  .intro-chapter .hero-actions .button { flex: 1 1 auto; }
  .chapter-three { left: 20px; right: 20px; bottom: 80px; width: auto; transform: translateY(calc((1 - var(--v)) * 40px * var(--dir))); }
  .chapter-three h2 br { display: block; }
  .chapter-three h2 .gold-text { margin-left: 0; }
  .intro-meta { gap: 9px; font-size: 8px; letter-spacing: .2em; }
  .intro-meta i { width: 16px; }
  .intro-footnote { display: none; }
  .intro-scroll-hint { display: none; }
  .intro-rail { right: 8px; height: 22vh; }
}

/* ---------- Ticker: angled gold band ---------- */
.is-landing .ticker { transform: rotate(-1.6deg) scale(1.04); margin-top: -28px; z-index: 5; box-shadow: 0 20px 60px -10px rgba(0, 0, 0, .9), 0 0 50px -10px rgba(217, 180, 91, .45); }

/* ---------- Section system ---------- */
.is-landing .section-heading h2,
.is-landing .connect-inner h2,
.is-landing .gallery-feature-copy h2,
.is-landing .promotion-copy h2,
.is-landing .join-copy h2,
.is-landing .report-strip-copy h2 { font-size: var(--fs-h2); line-height: .86; letter-spacing: -.02em; }
.is-landing .heading-note { font-size: var(--fs-body); }
.is-landing .section { overflow: clip; }

/* Glass + gradient-border surfaces */
.is-landing :is(.goal-card, .admin-card, .founder-card, .logo-history-card, .vision-feature, .promotion-panel, .join-panel, .report-strip-panel, .about-aside) {
  background: padding-box var(--glass-bg), border-box var(--grad-border);
  border: 1px solid transparent;
}

/* 3D flip-in reveals for grids */
.is-landing :is(.goals-grid, .admins-grid, .logo-history-grid) { perspective: 1400px; }
.is-landing :is(.goal-card, .admin-card, .logo-history-card).reveal { rotate: x 28deg; transform-origin: 50% 100%; transition-property: opacity, translate, scale, filter, rotate; transition-duration: 1.1s; transition-timing-function: var(--ease-out-expo); }
.is-landing :is(.goal-card, .admin-card, .logo-history-card).reveal.is-visible { rotate: none; }

/* About */
.is-landing .about-aside { min-height: 440px; border-radius: var(--radius); box-shadow: 0 40px 90px -40px #000; }
.is-landing .about-aside.has-photo { background: center / cover no-repeat; }
.is-landing .about-content .lead { font-size: clamp(26px, 2.6vw, 40px); line-height: 1.15; }
.is-landing .quote-line { border-image: var(--grad-gold) 1; }

/* Stats: huge gradient numerals */
.is-landing .community-stats { position: relative; z-index: 2; }
.is-landing .stat-item { background: padding-box var(--glass-bg), border-box var(--grad-border); border: 1px solid transparent; border-radius: var(--radius); }
.is-landing .stat-item strong {
  font-size: clamp(54px, 6vw, 92px) !important;
  background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}

/* Vision / principles */
.is-landing .vision-section { background: radial-gradient(ellipse 60% 50% at 80% 0%, rgba(217, 180, 91, .08), transparent 70%), #0a0a09; }
.is-landing .vision-feature { border-radius: var(--radius); }
.is-landing .vision-symbol { animation: spin-slow 14s linear infinite; display: inline-block; }
@keyframes spin-slow { to { transform: rotate(360deg); } }
@media (min-width: 901px) {
  .is-landing .principles-title { position: sticky; top: 110px; align-self: start; }
}
.is-landing .principle-row { transition: background .4s, padding .4s var(--ease-out-expo); }
.is-landing .principle-row:hover { background: linear-gradient(90deg, rgba(217, 180, 91, .08), transparent); padding-left: 12px; }

/* Founder & crew photos: slow zoom on hover */
.is-landing :is(.founder-photo, .admin-photo) { transition: background-size .8s var(--ease-out-expo); }
.is-landing .founder-card { border-radius: calc(var(--radius) + 6px); overflow: hidden; }
.is-landing .founder-details h3 { font-size: clamp(44px, 5.4vw, 80px); background: var(--grad-silver); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* Gallery album: framed 3D panel */
.is-landing .gallery-album { border-radius: calc(var(--radius) + 6px); box-shadow: 0 0 0 1px rgba(246, 221, 147, .3), 0 60px 120px -40px #000; transform: perspective(1400px) rotateY(-6deg) rotateX(2deg); transition: transform 1s var(--ease-out-expo); }
.is-landing .gallery-album:hover { transform: perspective(1400px) rotateY(0) rotateX(0); }

/* Connect finale */
.is-landing .connect-section { background: radial-gradient(ellipse 70% 60% at 50% 100%, rgba(217, 180, 91, .14), transparent 70%), #070707; }
.is-landing .connect-inner h2 { font-size: clamp(76px, 13vw, 210px); }
.is-landing .connect-section::before {
  content: "F4NTASTIC"; position: absolute; left: 50%; bottom: -4vw; translate: -50% 0; z-index: 0; pointer-events: none; white-space: nowrap;
  font: 900 clamp(120px, 24vw, 420px)/.8 var(--font-display); letter-spacing: -.02em;
  color: transparent; -webkit-text-stroke: 1px rgba(217, 180, 91, .16);
}
.is-landing .connect-inner { z-index: 1; }

@media (prefers-reduced-motion: reduce) {
  .is-landing :is(.goal-card, .admin-card, .logo-history-card).reveal { rotate: none; }
  .is-landing .vision-symbol { animation: none; }
  .intro-chapter { filter: none; }
}
@media (max-width: 650px) {
  .is-landing .stat-item strong { font-size: clamp(26px, 8.4vw, 40px) !important; }
  .is-landing .about-aside { min-height: 260px; }
  .is-landing .gallery-album { transform: none; }
  .is-landing .ticker { margin-top: -18px; }
}

/* Phones: skip layout/paint of sections that are not near the viewport yet (crew photos, gallery, etc.).
   `auto` remembers each section's real size once rendered, so anchors/scroll-spy stay accurate. */
/* Only until html.cv-ready (set by js/fx/landing.js once idle, on the first in-page anchor click, or right
   away when the URL has a #hash) so anchor targets and scroll-spy always see real section heights. */
@media (max-width: 720px), (pointer: coarse) {
  html:not(.cv-ready) .is-landing main > section:not(.intro):not(.ticker) { content-visibility: auto; contain-intrinsic-size: auto 900px; }
}
