/* ==========================================================================
   ZARREL — Core styles (hero + shared chrome)
   Import order: variables → style → home → animations → responsive
   Structure:
     1. Reset & base
     2. Page shell
     3. Navbar
     4. Hero (video card)
     5. Hero content
     6. Utilities
   Story sections live in home.css.
   ========================================================================== */

/* 1. Reset & base --------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  color: var(--color-ink-dark);
  background-color: var(--page-bg);
  line-height: var(--lh-relaxed);
  min-height: 100vh;
  overflow-x: hidden;          /* never allow horizontal scroll */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

img,
video {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* 2. Page shell ----------------------------------------------------------- */
/* Centered content column with generous white space. The hero card and the
   navbar both live inside this max-width column. */
.page {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-lg) var(--page-gutter) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.5rem, 3vw, 2.75rem);
}

/* 3. Navbar — light glass, centered above the card ------------------------ */
.navbar {
  position: sticky;
  top: var(--space-lg);
  z-index: var(--z-navbar);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur-idle)) saturate(150%);
  backdrop-filter: blur(var(--blur-idle)) saturate(150%);
  box-shadow: var(--shadow-nav);
  transition:
    background var(--dur-med) var(--ease-out),
    backdrop-filter var(--dur-med) var(--ease-out),
    -webkit-backdrop-filter var(--dur-med) var(--ease-out),
    border-color var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out),
    padding var(--dur-med) var(--ease-out);
}

/* Scrolled state: more opacity + blur, toggled by js/navbar.js */
.navbar.is-scrolled {
  background: var(--glass-bg-scrolled);
  border-color: var(--glass-border-strong);
  -webkit-backdrop-filter: blur(var(--blur-scrolled)) saturate(160%);
  backdrop-filter: blur(var(--blur-scrolled)) saturate(160%);
  box-shadow: var(--shadow-nav-strong);
}

/* Subtle top glass reflection */
.navbar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0) 45%
  );
  pointer-events: none;
}

.navbar__logo {
  font-size: var(--fs-logo);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--tracking-wide);
  color: var(--color-ink-dark);
  text-transform: uppercase;
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2.25rem);
  list-style: none;
}

.navbar__link {
  position: relative;
  font-size: var(--fs-nav);
  font-weight: var(--fw-medium);
  color: var(--color-ink-dark-muted);
  letter-spacing: 0.01em;
  padding: 0.25rem 0.1rem;
  transition: color var(--dur-fast) var(--ease-out);
}

/* animated underline on hover */
.navbar__link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1.5px;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-med) var(--ease-out);
}

.navbar__link:hover,
.navbar__link:focus-visible {
  color: var(--color-ink-dark);
}

.navbar__link:hover::after,
.navbar__link:focus-visible::after {
  transform: scaleX(1);
}

/* 4. Hero ----------------------------------------------------------------- */
/* Vertical stack: the video card on top, the text block below. The wrapper
   just spaces the two; all the visual weight lives in .hero__card. */
.hero {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(1.75rem, 4vw, 3rem);   /* breathing room between card and text */
}

/* Rounded floating card — now holds ONLY the video + fallback.
   overflow:hidden + isolate clip the video and fallback to the rounded
   corners. `contain: paint` keeps the card its own paint layer so the looping
   video repaints don't ripple into the rest of the page. Card stacking:
     .hero__fallback / .hero__video  -> --z-video (0) */
.hero__card {
  position: relative;
  width: 100%;
  max-width: var(--card-max-width);
  margin-inline: auto;
  aspect-ratio: var(--card-aspect-ratio);
  height: auto;
  border-radius: var(--radius-card);
  overflow: hidden;
  isolation: isolate;
  contain: paint;
  box-shadow: var(--shadow-card);
  background: var(--bg-deep);   /* base color while media loads */
}

/* Fallback background: premium gradient shown before / without hero.mp4.
   Always painted underneath the video so the card never looks broken.
   On video error main.js adds .hero.is-video-error, layering in a static
   image for a richer fallback than the gradient alone. */
.hero__fallback {
  position: absolute;
  inset: 0;
  z-index: var(--z-video);
  background: var(--bg-gradient), var(--bg-deep);
  background-color: var(--bg-deep);
  background-size: cover;
  background-position: center;
}

.hero.is-video-error .hero__fallback {
  background:
    var(--bg-gradient),
    var(--hero-fallback-image) center / cover no-repeat,
    var(--bg-deep);
}

.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: var(--z-video);
  /* Fade the video in once it can play (toggled from main.js). */
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
  pointer-events: none;      /* no interaction jank on the looping video */
  background: transparent;
  /* Promote the video to its own GPU layer for smooth, stutter-free playback.
     No CSS filters/animations run on this element during playback. */
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.hero__video.is-ready {
  opacity: 1;
}

/* Hard-hide the media once we know it can't play, revealing the fallback. */
.hero.is-video-error .hero__video {
  display: none;
}

/* 5. Hero content — dark ink on the white page, below the card ------------ */
.hero__content {
  width: 100%;
  max-width: 52rem;
  padding: 0 clamp(0.25rem, 2vw, 1.5rem);
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-md);
}

.hero__headline {
  font-size: var(--fs-hero);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  max-width: 20ch;
  color: var(--color-ink-dark);
}

.hero__subtitle {
  font-size: var(--fs-subtitle);
  font-weight: var(--fw-regular);
  line-height: var(--lh-snug);
  color: var(--color-ink-dark-muted);
  max-width: 52ch;
}

/* 6. Site footer — full-bleed black bar ---------------------------------- */
.site-footer {
  width: 100%;
  margin-top: clamp(3rem, 8vw, 5rem);
  padding: clamp(1.75rem, 4vw, 2.5rem) var(--page-gutter);
  background: #0b1220;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.875rem;
}

.site-footer__inner {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.site-footer__brand {
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: #fff;
}

.site-footer__copy {
  flex: 1 1 auto;
  text-align: center;
}

.site-footer__social {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.site-footer__social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-pill);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition:
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.site-footer__social-link:hover,
.site-footer__social-link:focus-visible {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  transform: translateY(-1px);
}

.site-footer__social-link svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

/* 7. Utilities ------------------------------------------------------------ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
