/* css/hero.css — Hero banner: rings, sparkles, center images, CTA */

/* ========================================
   HERO SECTION STYLES
   ======================================== */

:root {
  /* --- Make hero bleed up under the sticky header --- */
  /* Fallback if JS hasn't measured the header yet */
  --header-h: 4.5rem;
  --hero-fixed: 914px; /* 914 px original */
  /* ← pick the pixel height you liked on Home */
}

.hero,
.hero.hero--bleed {
  height: var(--hero-fixed);
}

/* On smaller screens, use a relative height */
@media (max-width: 800px) {
  .hero,
  .hero.hero--bleed {
    height: 84vh;
  }
}

/* Full-bleed hero that still keeps inner content nicely aligned */
.hero.hero--bleed {
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  width: 100vw;
  max-width: 100vw;
  padding-left: 0;
  padding-right: 0;
  border-radius: 0;
  /* pull the whole hero up so its rings sit behind the header */
  margin-top: calc(-1 * var(--header-h));
  /* give that space back inside so text doesn't collide with the header */
  padding-top: calc(4rem + var(--header-h));
}

.hero.hero--bleed > :not(.sparkles) {
  max-width: var(--maxw);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Base hero visuals */
.hero {
  background: var(--light-peach);
  position: relative;
  display: grid;
  place-items: center;
  min-height: 64vh;
  padding: 4rem 0 2rem;
  text-align: center;
  isolation: isolate;
  overflow: hidden;
  border-bottom: 3px solid var(--ink);
  margin-bottom: 2rem;
  /* breathing room before next section */
  grid-template-columns: 1fr;
  /* rows: brand | title | spacer | subtitle | CTA */
  grid-template-rows: auto auto 1fr auto auto;
  place-items: start center;
  /* vertical start, horizontal center */
  grid-row: 4;
  min-height: clamp(var(--hero-fixed), 64vh, var(--hero-fixed));
  background-color: var(--accent);
}

.hero::before {
  content: "";
  position: absolute;
  inset: -25vmax;

  background: radial-gradient(
      circle at 50% 50%,
      var(--ring1) 0 16%,
      transparent 16% 17%
    ),
    radial-gradient(circle at 50% 50%, var(--ring2) 0 24%, transparent 24% 25%),
    radial-gradient(circle at 50% 50%, var(--ring3) 0 33%, transparent 33% 34%),
    radial-gradient(circle at 50% 50%, var(--ring4) 0 43%, transparent 43% 44%),
    radial-gradient(circle at 50% 50%, var(--ring5) 0 54%, transparent 54% 55%);
  filter: saturate(110%);
  z-index: -2;
  animation: slow-pan 30s linear infinite;
  opacity: 0.95;
  will-change: transform;
  backface-visibility: hidden;
}

@keyframes slow-pan {
  to {
    transform: rotate(360deg);
  }
}

/* Pause hero animations when tab is hidden (set by animation-visibility.js) */
html.animations-paused .hero::before,
html.animations-paused .hero .sparkle {
  animation-play-state: paused;
}

/* Breathing wave effect: subtle in/out scale */
@keyframes waves {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.95;
  }

  50% {
    transform: scale(1.02);
    /* soft expansion */
    opacity: 1;
  }
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 50% 55%,
    rgba(255, 255, 255, 0) 0%,
    rgba(0, 0, 0, 0.12) 70%,
    rgba(0, 0, 0, 0.25) 100%
  );
  z-index: -1;
  pointer-events: none;
}

@media (max-width: 600px) {
  .hero {
    padding-bottom: 1.25rem;
  }
}

/* Ensure text/cta float above center images */
.hero .hero-stack-top {
  position: relative;
  z-index: 2;
}

/* Base center images (bottom aligned by default) */
.hero-center-img {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) scale(var(--scale, 0.6));
  transform-origin: center bottom;
  z-index: 1;
  /* below text, above rings */
  pointer-events: none;
  max-width: none;
}

/* First layer stays bottom aligned */
.hero-center-img.layer1 {
  bottom: 0;
  padding-bottom: 7.5rem;
}

/* On mobile screens, center the character vertically instead of anchoring to bottom */
@media (max-width: 800px) {
  .hero-center-img.layer1 {
    bottom: auto !important;
    top: 30% !important;
    transform: translateX(-50%) scale(var(--scale, 0.55)) !important;
    transform-origin: center top !important;
    padding-bottom: 0 !important;
  }
}

/* Second layer aligns to top */
.hero-center-img.layer2 {
  top: 0;
  transform-origin: center top;
}

/* hover/bob animation (optional) */
.hero-center-img.is-hovering {
  animation: heroBob 6s ease-in-out infinite;
}

@keyframes heroBob {
  0%,
  100% {
    transform: translateX(-50%) translateY(0) scale(var(--scale, 0.6));
  }

  50% {
    transform: translateX(-50%) translateY(calc(-1 * var(--hover-amp, 10px)))
      scale(var(--scale, 0.6));
  }
}

.brand {
  display: inline-block;
  background: var(--light-peach);
  border-radius: var(--radius-pill);
  padding: 0.5rem 0.9rem;
  box-shadow: 0 8px 0 var(--ink);
  border: 3px solid var(--ink);
  transform: rotate(-2deg);

  position: relative;
  top: -1.5rem;
  margin-top: 0;
  overflow: hidden;
  /* clip the shine inside the pill */
}

.hero .brand::after {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.9) 50%,
    transparent 100%
  );
  transform: skewX(-20deg);
  opacity: 0;
}

.hero .brand:hover::after {
  animation: shine 2s ease forwards;
  opacity: 1;
}

@keyframes shine {
  0% {
    left: -75%;
    opacity: 0;
  }

  30% {
    opacity: 1;
  }

  100% {
    left: 125%;
    opacity: 0;
  }
}

.brand b {
  font-family: "Grandstander";
  letter-spacing: 0.5px;
}

h1.title {
  font-family: "Grandstander";
  font-weight: 800;
  font-size: clamp(2.2rem, 7vw, 4.4rem);
  margin: 1rem 0 0.5rem;
  text-shadow: 0 3px 0 var(--peach), 0 8px 0 var(--ink);
}

/* Hero text highlight styling (replaces inline styles) */
.hero-highlight {
  color: var(--peach);
  text-shadow: 0 0 1px var(--offwhite);
}

@media (max-width: 800px) {
  /* Lessen the shadow when on smaller screens */
  h1.title {
    text-shadow: 0 2px 0 var(--peach), 0 5px 0 var(--ink);
  }
}

/* Reset any previous forced placement */
.hero .brand,
.hero h1.title {
  grid-row: auto !important;
  /* don't pin them to the same row */
  justify-self: center;
}

.subtitle {
  font-size: clamp(1.1rem, 2.4vw, 1.3rem);
  max-width: 42ch;
  margin: 0 0 0.75rem !important;
  opacity: 0.9;
}

.hero .cta {
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
  background: linear-gradient(
    180deg,
    var(--light-peach) 0%,
    var(--bg-analogous) 100%
  );
  border: 3px solid var(--ink);
  border-radius: var(--radius-pill);
  padding: 1rem 1.1rem;
  font-weight: 700;
  box-shadow: 0 8px 0 var(--ink), 0 12px 24px rgba(0, 0, 0, 0.25);
  text-decoration: none;
  color: var(--ink);
  transform: translateY(0);
  transition: transform var(--transition-fast);
  background: var(--light-peach);
  user-select: none !important;
  -webkit-user-drag: none !important;
  grid-row: 5;
  margin: 0 !important;
}

.hero .cta:hover {
  background-color: var(--accent);
  color: var(--offwhite);
  box-shadow: 0 10px 0 var(--ink), 0 8px 18px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
}

.hero .cta:active {
  transform: translateY(6px);
  box-shadow: 0 6px 0 var(--ink);
}

.sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sparkles span {
  position: absolute;
  width: 2rem;
  height: 2rem;
  transform: rotate(10deg) scale(1);
  border-radius: var(--radius-xs);
  animation: twinkle 3s ease-in-out infinite;
  opacity: 0.9;
}

.sparkles span::before,
.sparkles span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(10deg);
  border-radius: var(--radius-xs);
}

/* vertical arm */
.sparkles span::before {
  width: 4px;
  height: 20px;
}

/* horizontal arm */
.sparkles span::after {
  width: 20px;
  height: 4px;
}

/* --- Non-selectable / non-draggable decorative layers --- */
.sparkles,
.sparkles *,
.hero-center-img {
  user-select: none !important;
  -webkit-user-drag: none !important;
}

/* Twinkle animation */
@keyframes twinkle {
  0%,
  100% {
    transform: rotate(10deg) scale(0.8);
    opacity: 0.6;
  }

  50% {
    transform: rotate(10deg) scale(1.3);
    opacity: 1;
  }
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }

  50% {
    transform: translateY(-16px) rotate(8deg);
  }
}

/* Simple color themes via CSS variables; override ring colors */
.hero--sunset {
  --ring1: #f44336;
  --ring2: #ff9800;
  --ring3: #ffc107;
  --ring4: #ffeb3b;
  --ring5: #ffcc80;
}

.hero--mint {
  --ring1: #3ad5a2;
  --ring2: #a6f0ce;
  --ring3: #c1fde0;
  --ring4: #e6fff5;
  --ring5: #f8fffb;
}

.hero--blue {
  --ring1: #3a7bd5;
  --ring2: #68a3f1;
  --ring3: #9cc3fb;
  --ring4: #cfe2ff;
  --ring5: #eaf2ff;
}

.hero-textbox {
  z-index: 2;
  color: var(--light-peach);
  text-shadow: 1px 1px 4.5px var(--ink);
  grid-row: 4;
}

/* Hide or reserve space until the hero is ready */
[data-mount-hero].hero-loading {
  visibility: hidden;
  /* prevents flash */
  min-height: 60vh;
  /* reserve vertical space */
}

[data-mount-hero].hero-ready {
  visibility: visible;
  transition: opacity 0.03s ease;
  opacity: 1;
}

/* ===== Dark Mode — Hero overrides ===== */
html.dark-mode .hero {
  border-bottom-color: var(--dm-border);
  background-color: var(--dm-border);
  background: var(--dm-border);
}

/* Muted blue/purple rings instead of bright warm colors */
html.dark-mode .hero::before {
  --ring1: #2a3468;
  --ring2: #35407a;
  --ring3: #3f4d8e;
  --ring4: #4a5ba3;
  --ring5: #5569b5;
  filter: saturate(80%);
  opacity: 0.7;
}

html.dark-mode .hero .cta {
  background: var(--dm-accent-dim);
  border-color: var(--dm-border);
  color: var(--dm-text);
  box-shadow: 0 8px 0 var(--dm-border), 0 12px 24px rgba(0, 0, 0, 0.35);
}

html.dark-mode .hero .cta:hover {
  background: var(--dm-accent);
  color: var(--dm-white);
  box-shadow: 0 10px 0 var(--dm-border), 0 8px 18px rgba(0, 0, 0, 0.35);
}

html.dark-mode .hero .sparkle {
  opacity: 0.5;
}

html.dark-mode h1.title {
  text-shadow: 0 3px 0 var(--dm-border), 0 8px 0 var(--dm-deep);
}

html.dark-mode .hero-highlight {
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.3);
}

@media (max-width: 800px) {
  html.dark-mode h1.title {
    text-shadow: 0 2px 0 var(--dm-border), 0 5px 0 var(--dm-deep);
  }
}
