/* ==========================================================================
   Montrack Hero Section Styles
   ========================================================================== */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-family-body);
  background-color: var(--color-background);
  color: var(--color-text-primary);
  overflow-x: hidden;
}

/* Skip Link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--color-background);
  color: var(--color-text-primary);
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
}

.skip-link:focus {
  left: 12px;
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ==========================================================================
   Hero Container & Sky Gradient
   ========================================================================== */

.hero {
  position: relative;
  width: 100%;
  min-height: 960px;
  background: var(--gradient-hero-sky);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* T1: Halftone Dot Grid */
.hero-bg-dots {
  position: absolute;
  inset: 0 0 auto 0;
  height: 360px;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.30) 1px, transparent 1.6px);
  background-size: 8px 8px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.55) 45%, transparent 100%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.55) 45%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

.hero-bg-dots.has-pixel-canvas,
.download-bg-dots.has-pixel-canvas {
  background-image: none;
  -webkit-mask-image: none;
  mask-image: none;
}

.pixel-dot-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* T2: Concentric Rings */
.hero-bg-rings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* T3: Accent Arcs (revealed & drawn on scroll, ending behind the phone) */
.hero-bg-arcs {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.hero-arc {
  opacity: 0;
  transition: opacity 260ms var(--ease-out);
  will-change: stroke-dashoffset, opacity;
}

.hero-arc.is-visible {
  opacity: 1;
}

/* T4: Clouds */
.hero-clouds {
  position: absolute;
  inset: 0;
  max-width: 1600px;
  margin: 0 auto;
  pointer-events: none;
  z-index: 4;
}

.hero-cloud {
  position: absolute;
  height: auto;
  user-select: none;
  opacity: 0.92;
}

.hero-cloud--left {
  width: 560px;
  top: 395px;
  left: -40px;
}

.hero-cloud--right {
  width: 520px;
  top: 355px;
  right: -55px;
  transform: scaleX(-1);
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.hero-header {
  position: relative;
  z-index: 20;
  width: 100%;
  padding: 25px var(--container-pad) 0;
}

.hero-nav {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 40px;
}

.hero-logo-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

.hero-logo-link:focus-visible {
  outline: 2px solid var(--color-text-on-hero);
  outline-offset: 4px;
}

.hero-logo {
  width: 112px;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Glass Pill */
.nav-pill {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  min-width: 575px;
  height: 40px;
  padding: 0 28px;
  border-radius: var(--radius-full);
  background: var(--color-glass-fill);
  border: 1px solid var(--color-glass-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-on-hero);
  font-size: var(--text-nav);
  font-weight: var(--font-weight-regular);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0.92;
  padding: 4px 2px;
  border-radius: var(--radius-sm);
  transition: opacity var(--duration-fast) ease, transform var(--duration-fast) var(--ease-out);
}

.nav-link:hover {
  opacity: 1;
}

.nav-link:focus-visible {
  outline: 2px solid var(--color-text-on-hero);
  outline-offset: 3px;
  opacity: 1;
}

.nav-chevron {
  transition: transform var(--duration-fast) var(--ease-out);
}

.nav-link--dropdown:hover .nav-chevron {
  transform: translateY(1.5px);
}

.hero-nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* Accent CTA Button ("Join waitlist") */
.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  height: 30px;
  padding: 0 14px;
  background-color: var(--color-accent);
  color: var(--color-text-on-hero);
  font-size: 13.5px;
  font-weight: var(--font-weight-medium);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: var(--shadow-inset-top), var(--shadow-halo);
  text-shadow: 0 1px 2px rgba(0, 60, 130, 0.22);
  transition:
    background-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

.btn-accent:hover {
  background-color: var(--color-accent-hover);
  transform: translateY(-1px);
}

.btn-accent:active {
  background-color: var(--color-accent-active);
  transform: translateY(0) scale(0.98);
}

.btn-accent:focus-visible {
  outline: 2px solid var(--color-text-on-hero);
  outline-offset: 4px;
}

/* Mobile Menu Button */
.nav-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-glass-fill);
  border: 1px solid var(--color-glass-border);
  color: var(--color-text-on-hero);
  cursor: pointer;
  transition: background-color var(--duration-fast) ease;
}

.nav-menu-toggle:hover {
  background: var(--color-glass-fill-hover);
}

.nav-menu-toggle:focus-visible {
  outline: 2px solid var(--color-text-on-hero);
  outline-offset: 2px;
}

/* Mobile Nav Drawer */
.mobile-nav-drawer {
  margin-top: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: rgba(1, 90, 175, 0.94);
  border: 1px solid var(--color-glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.mobile-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.mobile-nav-link {
  display: block;
  padding: 10px 12px;
  color: var(--color-text-on-hero);
  font-size: var(--text-nav);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.mobile-nav-link:hover,
.mobile-nav-link:focus-visible {
  background: var(--color-glass-fill);
  outline: none;
}

/* ==========================================================================
   Hero Copy & Primary CTA
   ========================================================================== */

.hero-main {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 88px var(--space-5) 0;
}

.hero-copy {
  max-width: 780px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-title {
  font-family: var(--font-family-display);
  font-size: var(--text-display);
  font-weight: var(--font-weight-medium);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  color: var(--color-text-on-hero);
}

/* Shared Word-by-Word Blur-to-Clear Reveal */
.blur-word {
  display: inline-block;
  opacity: 0;
  filter: blur(10px);
  transform: translateY(8px);
  transition:
    opacity 560ms var(--ease-out),
    filter 560ms var(--ease-out),
    transform 560ms var(--ease-out);
  transition-delay: calc(var(--word-i, 0) * 65ms);
  will-change: opacity, filter, transform;
}

.hero-copy .blur-word {
  transition-delay: calc(var(--word-i, 0) * 42ms);
}

[data-blur-reveal].is-in-view .blur-word {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

.hero-subtitle {
  margin-top: 18px;
  max-width: 540px;
  font-size: var(--text-body);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-body);
  color: var(--color-text-on-hero-muted);
}

.hero-cta-wrap {
  margin-top: 28px;
}

/* Light Shiny Button ("Start for free") - Gleam Edge Effect */
@property --gleam-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}
@property --gleam-angle-offset {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}
@property --gleam-percent {
  syntax: "<percentage>";
  initial-value: 6%;
  inherits: false;
}
@property --gleam-shine {
  syntax: "<color>";
  initial-value: #ffffff;
  inherits: false;
}

.btn-light {
  --gleam-base: var(--color-background);
  --gleam-inset: rgba(1, 112, 209, 0.14);
  --gleam-label: var(--color-text-primary);
  --gleam-accent: var(--color-accent);
  --gleam-accent-soft: var(--color-accent-highlight);
  --gleam-anim: gleam-angle linear infinite;
  --gleam-duration: 3.2s;
  --gleam-shadow-size: 2px;
  --gleam-transition: 0.8s cubic-bezier(0.25, 1, 0.5, 1);

  isolation: isolate;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 158px;
  height: 43px;
  color: var(--gleam-label);
  font-size: 14.5px;
  font-weight: var(--font-weight-medium);
  line-height: 1;
  text-decoration: none;
  border: 3px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  background:
    linear-gradient(var(--gleam-base), var(--gleam-base)) padding-box,
    conic-gradient(
      from calc(var(--gleam-angle) - var(--gleam-angle-offset)),
      transparent,
      var(--gleam-accent) var(--gleam-percent),
      var(--gleam-shine) calc(var(--gleam-percent) * 2),
      var(--gleam-accent) calc(var(--gleam-percent) * 3),
      transparent calc(var(--gleam-percent) * 4)
    ) border-box;
  box-shadow:
    inset 0 0 0 1px var(--gleam-inset),
    0 6px 18px rgba(1, 60, 130, 0.14);
  transition:
    var(--gleam-transition),
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
  transition-property:
    --gleam-angle-offset,
    --gleam-percent,
    --gleam-shine,
    transform,
    box-shadow;
}

.btn-light::before,
.btn-light::after,
.btn-light span::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset-inline-start: 50%;
  inset-block-start: 50%;
  translate: -50% -50%;
  z-index: -1;
}

.btn-light::before {
  --size: calc(100% - var(--gleam-shadow-size) * 3);
  --position: 2px;
  --space: calc(var(--position) * 2);
  width: var(--size);
  height: var(--size);
  background: radial-gradient(
    circle at var(--position) var(--position),
    rgba(0, 165, 255, 0.28) calc(var(--position) / 4),
    transparent 0
  ) padding-box;
  background-size: var(--space) var(--space);
  background-repeat: space;
  mask-image: conic-gradient(
    from calc(var(--gleam-angle) + 45deg),
    black,
    transparent 10% 90%,
    black
  );
  border-radius: inherit;
  opacity: 0.35;
}

.btn-light::after {
  --gleam-anim: gleam-shimmer linear infinite;
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(
    -50deg,
    transparent,
    rgba(0, 165, 255, 0.24),
    transparent
  );
  mask-image: radial-gradient(circle at bottom, transparent 40%, black);
  opacity: 0.55;
}

.btn-light span {
  position: relative;
  z-index: 1;
}

.btn-light span::before {
  --size: calc(100% + 1.5rem);
  width: var(--size);
  height: var(--size);
  box-shadow: inset 0 -1ex 1.6rem 2px rgba(0, 165, 255, 0.26);
  opacity: 0;
  transition: opacity var(--gleam-transition);
  animation: calc(var(--gleam-duration) * 1.5) gleam-breathe linear infinite;
}

.btn-light,
.btn-light::before,
.btn-light::after {
  animation:
    var(--gleam-anim) var(--gleam-duration),
    var(--gleam-anim) calc(var(--gleam-duration) / 0.4) reverse paused;
  animation-composition: add;
}

.btn-light:hover,
.btn-light:focus-visible {
  --gleam-percent: 20%;
  --gleam-angle-offset: 95deg;
  --gleam-shine: var(--gleam-accent-soft);
  transform: translateY(-1.5px);
  box-shadow:
    inset 0 0 0 1px rgba(0, 165, 255, 0.32),
    0 10px 26px rgba(1, 60, 130, 0.24);
}

.btn-light:hover,
.btn-light:focus-visible,
.btn-light:hover::before,
.btn-light:focus-visible::before,
.btn-light:hover::after,
.btn-light:focus-visible::after {
  animation-play-state: running;
}

.btn-light:hover span::before,
.btn-light:focus-visible span::before {
  opacity: 1;
}

.btn-light:active {
  transform: translateY(0) scale(0.98);
}

.btn-light:focus-visible {
  outline: 2px solid var(--color-text-on-hero);
  outline-offset: 4px;
}

@keyframes gleam-angle {
  to {
    --gleam-angle: 360deg;
  }
}

@keyframes gleam-shimmer {
  to {
    rotate: 360deg;
  }
}

@keyframes gleam-breathe {
  from,
  to {
    scale: 1;
  }
  50% {
    scale: 1.2;
  }
}

/* ==========================================================================
   Hero Device Cluster
   ========================================================================== */

.hero-devices {
  position: relative;
  width: 100%;
  max-width: 1200px;
  height: 550px;
  margin-top: 52px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.hero-phone {
  position: relative;
  z-index: 3;
  width: 285px;
  flex-shrink: 0;
  filter: drop-shadow(0 20px 50px rgba(1, 60, 130, 0.18));
}

.hero-phone-img {
  width: 100%;
  height: auto;
  display: block;
}

.hero-card {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  user-select: none;
}

.hero-card-perspective {
  width: 100%;
  border-radius: 12px;
  transform-style: preserve-3d;
  will-change: transform;
}

.hero-svg-card {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

/* Left Floating Card (By Category) - opposite orientation: left closer, right receded */
.hero-card--left {
  width: 318px;
  top: 170px;
  left: calc(50% - 435px);
  animation: float-slow-left 9s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

.hero-card--left .hero-card-perspective {
  transform: perspective(820px) rotateY(22deg) rotateX(1.5deg);
  box-shadow: 0 22px 48px rgba(1, 60, 130, 0.16), 0 4px 12px rgba(17, 24, 28, 0.06);
}

/* Right Floating Card (By Weeks) - right closer, left receded; top rises L->R, bottom slopes down L->R */
.hero-card--right {
  width: 356px;
  top: -16px;
  left: calc(50% + 96px);
  animation: float-slow-right 9.5s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

.hero-card--right .hero-card-perspective {
  transform: perspective(820px) rotateY(-22deg) rotateX(1.5deg);
  box-shadow: 0 24px 52px rgba(1, 60, 130, 0.18), 0 4px 14px rgba(17, 24, 28, 0.06);
}

/* Bottom White Fade */
.hero-bottom-fade {
  position: absolute;
  inset: auto 0 0 0;
  height: 68px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #FFFFFF 95%);
  pointer-events: none;
  z-index: 15;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes hero-fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float-slow-left {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes float-slow-right {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(6px);
  }
}

.anim-enter {
  animation: hero-fade-up 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-delay-1 {
  animation-delay: 60ms;
}

.anim-delay-2 {
  animation-delay: 160ms;
}

.anim-delay-3 {
  animation-delay: 260ms;
}

.anim-delay-4 {
  animation-delay: 340ms;
  animation-duration: 820ms;
}

/* ==========================================================================
   SVG Card Internal Animations
   ========================================================================== */

/* Category Card: segmented progress bar reveal + subtle pulse */
@keyframes cat-seg-grow {
  0% {
    opacity: 0;
    transform: scaleX(0.05);
  }
  100% {
    opacity: 1;
    transform: scaleX(1);
  }
}

@keyframes cat-seg-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.80;
  }
}

@keyframes cat-chip-in {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.cat-seg {
  transform-box: fill-box;
  transform-origin: left center;
  animation:
    cat-seg-grow 850ms cubic-bezier(0.16, 1, 0.3, 1) both,
    cat-seg-pulse 6.5s ease-in-out infinite;
}

.cat-seg--1 { animation-delay: 420ms, 1.8s; }
.cat-seg--2 { animation-delay: 540ms, 2.3s; }
.cat-seg--3 { animation-delay: 660ms, 2.8s; }
.cat-seg--4 { animation-delay: 780ms, 3.3s; }

.cat-chip-bg {
  transform-box: fill-box;
  transform-origin: center;
  animation: cat-chip-in 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cat-chip-bg--1 { animation-delay: 480ms; }
.cat-chip-bg--2 { animation-delay: 580ms; }
.cat-chip-bg--3 { animation-delay: 680ms; }
.cat-chip-bg--4 { animation-delay: 780ms; }

/* Graph Card: 7 weekly bars grow from baseline y=197 + gentle ambient wave */
@keyframes graph-bar-grow {
  0% {
    opacity: 0.25;
    transform: scaleY(0.08);
  }
  100% {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes graph-bar-breathe {
  0%, 100% {
    transform: scaleY(1);
  }
  50% {
    transform: scaleY(1.045);
  }
}

.graph-bar {
  transform-box: fill-box;
  transform-origin: bottom center;
  animation:
    graph-bar-grow 880ms cubic-bezier(0.16, 1, 0.3, 1) both,
    graph-bar-breathe 6.8s ease-in-out infinite;
}

.graph-bar--1 { animation-delay: 400ms, 1.7s; }
.graph-bar--2 { animation-delay: 480ms, 2.05s; }
.graph-bar--3 { animation-delay: 560ms, 2.4s; }
.graph-bar--4 { animation-delay: 640ms, 2.75s; }
.graph-bar--5 { animation-delay: 720ms, 3.1s; }
.graph-bar--6 { animation-delay: 800ms, 3.45s; }
.graph-bar--7 { animation-delay: 880ms, 3.8s; }

/* ==========================================================================
   Responsive Breakpoints (per design.md Section 12)
   ========================================================================== */

@media (max-width: 1199px) {
  .nav-pill {
    min-width: auto;
    gap: 22px;
    padding: 0 22px;
  }

  .hero-card--left {
    width: 272px;
    left: calc(50% - 375px);
    top: 175px;
  }

  .hero-card--right {
    width: 305px;
    left: calc(50% + 90px);
    top: -12px;
  }
}

@media (max-width: 960px) {
  .nav-pill {
    gap: 16px;
    padding: 0 18px;
  }

  .nav-link {
    font-size: 14px;
  }

  .nav-chevron {
    display: none;
  }

  .hero-phone {
    width: 255px;
  }

  .hero-card--left {
    width: 230px;
    left: calc(50% - 315px);
    top: 175px;
  }

  .hero-card--right {
    width: 255px;
    left: calc(50% + 80px);
    top: -4px;
  }
}

@media (max-width: 767px) {
  .hero {
    min-height: 820px;
  }

  .hero-header {
    padding-top: 20px;
  }

  .nav-pill {
    display: none;
  }

  .nav-menu-toggle {
    display: inline-flex;
  }

  .hero-main {
    padding-top: 56px;
  }

  .hero-subtitle-break {
    display: none;
  }

  .hero-devices {
    height: 460px;
    margin-top: 40px;
  }

  .hero-phone {
    width: 230px;
  }

  .hero-card--left {
    width: 175px;
    left: calc(50% - 225px);
    top: 170px;
  }

  .hero-card--right {
    width: 195px;
    left: calc(50% + 60px);
    top: 0px;
  }

  .hero-cloud--left {
    width: 340px;
    top: 370px;
    left: -60px;
  }

  .hero-cloud--right {
    width: 320px;
    top: 350px;
    right: -60px;
  }
}

@media (max-width: 599px) {
  .hero {
    min-height: 760px;
  }

  .hero-logo {
    width: 98px;
  }

  .btn-accent {
    min-width: 98px;
    padding: 0 12px;
    font-size: 13px;
  }

  .hero-main {
    padding-top: 44px;
  }

  .hero-title {
    max-width: 340px;
  }

  .hero-subtitle {
    font-size: 15px;
    max-width: 330px;
  }

  .hero-devices {
    height: 420px;
    margin-top: 36px;
  }

  .hero-phone {
    width: 225px;
  }

  /* On small mobile, hide or tuck floating cards per design.md Section 12 */
  .hero-card--left,
  .hero-card--right {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
