/* ============================================================
   Hunch — Coming Soon
   Design tokens pulled from the brand logo:
   electric blue background + cream wordmark.
   ============================================================ */

:root {
  /* Brand palette */
  --brand: #3b35f5;
  --brand-600: #322cdb;
  --brand-800: #211d9c;
  --brand-900: #15125f;

  --cream: #f4eee1;
  --cream-soft: rgba(244, 238, 225, 0.72);
  --cream-faint: rgba(244, 238, 225, 0.5);
  --cream-line: rgba(244, 238, 225, 0.16);

  --ink: #0d0a33;

  /* Layout */
  --max-width: 1120px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius: 14px;

  /* Type */
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  font-family: var(--font-body);
  color: var(--cream);
  background-color: var(--brand);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

::selection {
  background: rgba(124, 104, 255, 0.55);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============================================================
   Backdrop (swap for an animated background later)
   ============================================================ */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(
      140% 120% at 50% -20%,
      #4a44ff 0%,
      #2a25c4 42%,
      var(--brand-900) 100%
    );
  overflow: hidden;
}

/* Soft, blurred color blobs (mesh gradient) for depth and richness */
.backdrop__mesh {
  position: absolute;
  inset: -25%;
  background:
    radial-gradient(38% 42% at 16% 20%, rgba(124, 104, 255, 0.6) 0%, transparent 62%),
    radial-gradient(34% 40% at 86% 14%, rgba(56, 196, 255, 0.18) 0%, transparent 64%),
    radial-gradient(46% 52% at 82% 82%, rgba(126, 64, 246, 0.5) 0%, transparent 64%),
    radial-gradient(42% 44% at 10% 88%, rgba(59, 53, 245, 0.55) 0%, transparent 62%),
    radial-gradient(30% 30% at 50% 46%, rgba(244, 238, 225, 0.1) 0%, transparent 70%);
  filter: blur(60px) saturate(125%);
  /* Very slow ambient drift so the background feels alive, not static */
  animation: meshDrift 34s ease-in-out infinite;
  will-change: transform;
}

@keyframes meshDrift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(2.5%, -2%, 0) scale(1.08) rotate(1.5deg);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* WebGL animated gradient canvas (sits above the CSS mesh fallback) */
.backdrop__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Once WebGL is running, the CSS mesh fallback is no longer needed */
.backdrop.is-webgl .backdrop__mesh {
  display: none;
}

/* Vignette to focus the center and remove flatness */
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    120% 120% at 50% 38%,
    transparent 38%,
    rgba(8, 6, 40, 0.68) 100%
  );
  pointer-events: none;
}

/* Fine film grain to add texture and kill gradient banding */
.backdrop__noise {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  opacity: 0.045;
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* ============================================================
   Layout container
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ============================================================
   Header
   ============================================================ */

.header {
  position: relative;
  z-index: 1;
  padding: clamp(0.7rem, 1.8vw, 1.05rem) 0;
  border-bottom: 1px solid var(--cream-line);
  animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  transition: opacity 0.2s ease;
}

.brand:hover {
  opacity: 0.82;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--cream);
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.5rem;
  padding: clamp(3rem, 8vh, 6rem) 0 clamp(4rem, 8vh, 6rem);
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.8rem, 9vw, 6rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
  /* One shared shadow on the whole title keeps every word crisp and legible
     against the moving gradient (applies to accent words too). */
  filter:
    drop-shadow(0 1px 1px rgba(8, 6, 40, 0.45))
    drop-shadow(0 6px 24px rgba(8, 6, 40, 0.35));
}

/* Word-by-word reveal for the rotating headline.
   Words are visible by default (no-JS fallback); the rotator (script.js)
   adds .is-entering / .is-leaving and sets per-word delays for the stagger. */
.hero__title .word {
  display: inline-block;
  padding-bottom: 0.2em;
  color: var(--cream);
}

.hero__title .word.is-entering {
  animation: wordRise 0.55s cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.hero__title .word.is-leaving {
  animation: wordFall 0.4s cubic-bezier(0.4, 0, 0.6, 1) both;
}

@keyframes wordRise {
  from {
    opacity: 0;
    transform: translateY(0.35em);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes wordFall {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-0.25em);
  }
}

/* Accent words: same crisp cream as the rest, with a subtle moving sheen.
   Legibility comes from the title's shared shadow, not a glow halo. */
.hero__accent {
  background-image: linear-gradient(
    110deg,
    #f4eee1 0%,
    #f4eee1 38%,
    #ffffff 50%,
    #f4eee1 62%,
    #f4eee1 100%
  );
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 9s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: 200% center;
  }
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 0.4rem 0;
  border-top: 1px solid var(--cream-line);
  background: linear-gradient(
    to top,
    rgba(8, 6, 40, 0.55),
    rgba(8, 6, 40, 0)
  );
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s both;
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 1.5rem;
}

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

.footer__link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  color: var(--cream);
  opacity: 0.6;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.footer__link::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.footer__link:hover,
.footer__link:focus-visible {
  opacity: 1;
}

.footer__link:hover::before,
.footer__link:focus-visible::before {
  background: rgba(244, 238, 225, 0.1);
  border-color: rgba(244, 238, 225, 0.22);
}

.footer__link--inactive {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.footer__svg {
  position: relative;
  z-index: 1;
  display: block;
  width: 14px;
  height: 14px;
}

/* ============================================================
   Mobile / touch refinements
   (env() insets resolve to 0 on desktop, so the desktop layout
   is unchanged; the rest is gated behind a max-width query.)
   ============================================================ */

/* Remove the grey tap flash on touch devices */
a,
.footer__link {
  -webkit-tap-highlight-color: transparent;
}

/* Respect the home indicator / notch safe area on phones */
.footer {
  padding-bottom: calc(0.4rem + env(safe-area-inset-bottom));
}

@media (max-width: 600px) {
  /* Finger-friendly tap targets for the footer icons */
  .footer__social {
    gap: 0.35rem;
  }

  .footer__link {
    width: 2.75rem;
    height: 2.75rem;
    /* No hover on touch, so keep active icons a touch more visible */
    opacity: 0.8;
  }

  .footer__svg {
    width: 16px;
    height: 16px;
  }

  /* Slightly tighter heading on small screens for comfortable wrapping */
  .hero {
    gap: 1.25rem;
    padding-top: clamp(2rem, 6vh, 4rem);
  }
}

@media (max-width: 380px) {
  .hero__title {
    font-size: clamp(2.2rem, 10.5vw, 2.6rem);
  }
}

/* ============================================================
   Motion
   ============================================================ */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }

  .header,
  .hero__title,
  .hero__title .word,
  .footer {
    opacity: 1;
    transform: none;
  }
}
