/* =========================================================================
   iLoy — Montfort-inspired personal scroll narrative
   Design tokens sampled from mont-fort.com: slate #242729 ground,
   thin geometric uppercase type (Josefin Sans), oversized statements,
   generous whitespace, scroll-reveal animation.
   ========================================================================= */

:root {
  --bg:        #242729;   /* Montfort slate */
  --bg-2:      #2c2f31;   /* slightly raised surface */
  --fg:        #ffffff;
  --fg-muted:  #9aa0a3;
  --fg-dim:    #6b7174;
  --accent:    #7f9cb8;   /* the cool blue-grey from the Montfort logo */
  --border:    rgba(255,255,255,0.10);

  --font: "Josefin Sans", "Century Gothic", system-ui, sans-serif;

  --maxw: 1280px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ===== Intro animation ===== */
.intro {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  transition: opacity 0.8s var(--ease), visibility 0.8s var(--ease);
}
.intro.is-done { opacity: 0; visibility: hidden; pointer-events: none; }

.intro__mark {
  display: grid;
  grid-template-columns: repeat(3, 10px);
  gap: 8px;
  justify-content: center;
}
.intro__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  animation: dotIn 0.5s var(--ease) forwards;
}
.intro__dot:nth-child(1) { animation-delay: 0.05s; }
.intro__dot:nth-child(2) { animation-delay: 0.10s; }
.intro__dot:nth-child(3) { animation-delay: 0.15s; }
.intro__dot:nth-child(4) { animation-delay: 0.20s; }
.intro__dot:nth-child(5) { animation-delay: 0.25s; }
.intro__dot:nth-child(6) { animation-delay: 0.30s; }
.intro__dot:nth-child(7) { animation-delay: 0.35s; }
@keyframes dotIn {
  from { opacity: 0; transform: translateY(8px) scale(0.5); }
  to   { opacity: 1; transform: none; }
}
.intro__word {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 200;
  letter-spacing: 0.3em;
  opacity: 0;
  animation: wordIn 0.8s var(--ease) 0.5s forwards;
}
@keyframes wordIn { to { opacity: 1; } }

/* ===== Top bar ===== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.75rem clamp(1.5rem, 5vw, 4rem);
  mix-blend-mode: difference;  /* stays legible over light/dark sections */
}
.topbar__brand,
.topbar__menu {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.25em;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.topbar__menu { text-transform: uppercase; }  /* MENU/CLOSE stay all-caps; brand keeps iLOY casing */
.topbar__menu:focus-visible,
.topbar__brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* ===== Nav overlay ===== */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--ease), visibility 0.5s var(--ease);
}
.nav-overlay.is-open { opacity: 1; visibility: visible; }
.nav-overlay__list {
  list-style: none;
  margin: 0; padding: 0;
  text-align: center;
}
.nav-overlay__list li { margin: 0.4em 0; }
.nav-overlay__list a {
  font-size: clamp(1.8rem, 6vw, 3.5rem);
  font-weight: 200;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  transition: color 0.3s var(--ease);
}
.nav-overlay__list a:hover { color: #fff; }

/* ===== Panels (full-screen scroll sections) ===== */
.panel {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8rem clamp(1.5rem, 6vw, 6rem);
  max-width: var(--maxw);
  margin: 0 auto;
}
.panel--hero {
  position: relative;          /* anchor the full-bleed bg + overlay */
  align-items: center;
  text-align: center;
  /* no overflow:hidden — the bg layers intentionally break out to 100vw */
}
.panel--gallery { min-height: auto; padding-top: 10rem; padding-bottom: 6rem; }

/* Full-bleed hero background — CSS starfield + earth-glow placeholder.
   Swap to a real asset by setting background-image on .hero__bg (see HTML note). */
.hero__bg {
  position: absolute;
  top: 0;
  bottom: 0;
  /* Break out of the panel's max-width to span the full viewport edge-to-edge. */
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  z-index: 0;
  background-color: #0b0d0f;
  /* layered radial gradients: a cool earth-limb glow + scattered "stars" */
  background-image:
    radial-gradient(120% 90% at 50% 120%, rgba(127,156,184,0.45) 0%, rgba(127,156,184,0) 55%),
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,0.7) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 75% 20%, rgba(255,255,255,0.55) 50%, transparent 51%),
    radial-gradient(1px 1px   at 40% 70%, rgba(255,255,255,0.6) 50%, transparent 51%),
    radial-gradient(1px 1px   at 85% 60%, rgba(255,255,255,0.5) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 60% 45%, rgba(255,255,255,0.45) 50%, transparent 51%),
    radial-gradient(1px 1px   at 10% 80%, rgba(255,255,255,0.5) 50%, transparent 51%),
    radial-gradient(1px 1px   at 92% 35%, rgba(255,255,255,0.55) 50%, transparent 51%);
  background-size: cover, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
  /* If you add a real image/video, this same element can carry it:
     background: #0b0d0f url("assets/hero.jpg") center/cover no-repeat; */
}
/* Heavy dark overlay so the wordmark + white text stay crisp. */
.hero__overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(13,13,15,0.55) 0%, rgba(13,13,15,0.35) 40%, rgba(13,13,15,0.75) 100%);
}

.hero__title {
  position: relative;
  z-index: 2;                  /* above bg + overlay */
  font-size: clamp(4rem, 18vw, 14rem);
  font-weight: 100;
  letter-spacing: 0.15em;
  margin: 0;
  line-height: 1;
  text-shadow: 0 2px 40px rgba(0,0,0,0.5);
}

.panel__eyebrow {
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.5rem;
}

.statement {
  font-size: clamp(2.2rem, 7vw, 5.5rem);
  font-weight: 200;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.08;
  margin: 0;
  max-width: 18ch;
}
.statement--sm { font-size: clamp(1.8rem, 5vw, 3.5rem); max-width: 24ch; }

.signoff {
  font-size: clamp(1.5rem, 5vw, 3rem);
  font-weight: 200;
  letter-spacing: 0.15em;
  color: var(--fg-muted);
  text-align: center;
  width: 100%;
  margin: 0;
}
.panel--signoff { align-items: center; min-height: 60vh; }

/* ===== Scroll reveal =====
   Progressive enhancement: the "hidden initial state" only applies when JS has
   added .js-gsap to <html>. Without JS/GSAP, everything is visible (no blank
   text), and reduced-motion users skip the masking entirely. */

/* Line-clip wrapper: the inner span is translated down and masked by overflow. */
.line-clip { display: block; overflow: hidden; }
.line-clip > span { display: block; will-change: transform; }

/* Initial hidden state for CARDS only (they animate via gsap.to, so CSS must
   paint the hidden start). Line-clip spans animate via gsap.from(), which sets
   their own start state — so they need no CSS pre-hide here. Gated on .js-gsap
   so content is never stranded without JS. */
.js-gsap:not(.reduced) .card { opacity: 0; transform: translateY(40px); }

/* ===== Gallery (cards, routed from exhibits.json by type) ===== */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
  width: 100%;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  color: inherit;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease);
}
a.card:hover { transform: translateY(-6px); border-color: var(--accent); }
a.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.card__media { aspect-ratio: 16/10; width: 100%; object-fit: cover; display: block; background: #1c1f20; }
.card__placeholder {
  aspect-ratio: 16/10;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  font-weight: 200;
  letter-spacing: 0.1em;
  color: var(--bg);
}
.card__body { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.6rem; flex: 1; }
.card__meta {
  font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--fg-dim);
}
.card__title {
  font-size: 1.3rem; font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; margin: 0;
}
.card__desc { font-size: 0.95rem; font-weight: 300; color: var(--fg-muted); margin: 0; }
.card__tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: auto; padding-top: 1rem; }
.tag {
  font-size: 0.7rem; letter-spacing: 0.08em; color: var(--fg-muted);
  border: 1px solid var(--border); border-radius: 3px; padding: 0.2rem 0.55rem;
}
.card__cue { margin-top: 1rem; font-size: 0.8rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent); }

.gallery__empty { color: var(--fg-dim); font-size: 0.95rem; }

/* ===== Globe (Cobe neon, full-screen pinned slide) =====
   Tall track; the stage is pinned (by GSAP, or sticky as fallback) full-viewport.
   The Cobe canvas scales up via a CSS var (--globe-scale, driven by scroll) so it
   grows to span the whole screen as you enter the slide. */
.globe-track {
  position: relative;
  height: 300vh;              /* scroll length of the slide */
}
.globe-stage {
  position: sticky;          /* GSAP pin overrides this when available */
  top: 0;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;          /* the scaled globe shouldn't spill past the slide */
}
.globe {
  display: block;
  /* Base display box = the LARGER viewport dimension, so at full scale the globe
     can span the whole screen (the stage's overflow:hidden crops the overflow).
     The actual pixel buffer is set in JS; this is just the CSS display box. */
  width: max(100vw, 100vh);
  height: max(100vw, 100vh);
  transform: scale(var(--globe-scale, 0.4));
  transform-origin: center center;
  will-change: transform;
}

.globe-kicker {
  position: absolute;
  top: clamp(5rem, 12vh, 9rem);
  left: 0;
  right: 0;
  z-index: 2;
}
.globe-caption {
  position: absolute;
  bottom: clamp(3rem, 10vh, 7rem);
  left: 0;
  right: 0;
  z-index: 2;
  min-height: 1.6em;
  margin: 0;
  font-size: clamp(1rem, 3vw, 1.6rem);
  font-weight: 200;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg);
  text-shadow: 0 2px 30px rgba(0,0,0,0.8);
  transition: opacity 0.4s var(--ease);
}

/* ===== Motion preference ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .line-clip > span { transform: none !important; }
  .card { opacity: 1 !important; transform: none !important; }
  html { scroll-behavior: auto; }
}

@media (max-width: 600px) {
  .panel { padding: 6rem 1.5rem; }
}
