/*
 * PULPOFFE — AUTHENTIC HERO & REAL COFFEE BEAN FALL & MERGE
 * 
 * 1. Constant header with elegant ivory (#FAF8F5) matching story.html, shop.html, craft.html
 * 2. Hero single-screen presentation matching original Kodagu dark-roast aesthetic
 * 3. Photorealistic bean extracted directly from hero-poster-user.jpg
 * 4. Smooth gravity plunge -> micro-impact rebound -> 100% seamless pixel lock into background
 */

/* ── Light-Mode Page Base ── */
body.home-hero-light {
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #140D08 !important;
  color: #F5F5F5 !important;
  font-family: var(--body);
}

body.home-hero-light .bar {
  flex-shrink: 0;
  background: #ECE4D4;
  color: #3D2B1F;
  font-size: 0.84rem;
  letter-spacing: 0.04em;
  padding: 9px 16px;
  text-align: center;
  border-bottom: 1px solid rgba(61,43,31,0.1);
  z-index: 60;
  font-weight: 500;
}

body.home-hero-light header {
  flex-shrink: 0;
  background: #FAF8F5 !important;
  border-bottom: 1px solid rgba(61,43,31,0.12) !important;
  position: relative;
  z-index: 50;
  padding: 14px 0 !important;
}

body.home-hero-light header .w {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

body.home-hero-light header .logo {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  font: 600 1.35rem var(--disp) !important;
  letter-spacing: 0.14em !important;
  color: #3D2B1F !important;
  text-decoration: none;
}
body.home-hero-light header .logo small {
  display: block !important;
  font: 500 0.5rem var(--body) !important;
  letter-spacing: 0.3em !important;
  color: #8A6A36 !important;
}

body.home-hero-light header nav[aria-label="Main navigation"] {
  display: flex !important;
  gap: 32px !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  white-space: nowrap;
}
body.home-hero-light header nav[aria-label="Main navigation"] a {
  padding: 6px 0 !important;
  border-bottom: 2px solid transparent !important;
  color: #5E4A3B !important;
  text-decoration: none !important;
  transition: all 0.25s ease;
}
body.home-hero-light header nav[aria-label="Main navigation"] a:hover,
body.home-hero-light header nav[aria-label="Main navigation"] a.on {
  border-color: #B08D57 !important;
  color: #3D2B1F !important;
}

body.home-hero-light header .user-btn {
  background: none;
  border: 1px solid rgba(61,43,31,0.25);
  border-radius: 999px;
  padding: 7px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #3D2B1F !important;
  font-size: 0.88rem;
  font-family: var(--body);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
}
body.home-hero-light header .user-btn:hover {
  border-color: #8A6A36;
  background: rgba(138,106,54,0.08);
}

body.home-hero-light header .bk {
  font-size: 0.92rem !important;
  font-weight: 500 !important;
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
  color: #3D2B1F !important;
  background: none;
  border: none;
  cursor: pointer;
}
body.home-hero-light header .bk b {
  display: grid !important;
  place-items: center !important;
  width: 26px !important;
  height: 26px !important;
  border: 1px solid #8A6A36 !important;
  border-radius: 50% !important;
  font-size: 0.75rem !important;
  color: #8A6A36 !important;
  background: rgba(138,106,54,0.1);
}

/* ── Hero Section (Single Screen) ── */
.hero-stage-container {
  flex: 1;
  position: relative;
  width: 100%;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  background-color: #120C09;
}

/* Continuous Rotating Turntable Video */
.hero-video-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
  z-index: 3;
  opacity: 0;
  transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.hero-video-bg.playing {
  opacity: 1;
}

/* Background image layer (still frame for seed fall alignment) */
.hero-bg-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-image: url('media/products/hero-poster-user.jpg');
  background-position: right center;
  background-size: cover;
  background-repeat: no-repeat;
  z-index: 2;
  opacity: 1;
  transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: 75% 50%;
}
.hero-bg-layer.rotating-out {
  opacity: 0;
}

/* Continuous turntable rotation fallback on background beans */
.hero-bg-layer.css-rotating {
  animation: continuousTurntable 45s linear infinite;
}

@keyframes continuousTurntable {
  from { transform: scale(1.35) rotate(0deg); }
  to { transform: scale(1.35) rotate(360deg); }
}

/* Left Vignette for Typography Legibility */
.hero-bg-vignette {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(90deg, 
    rgba(18, 12, 9, 0.97) 0%, 
    rgba(18, 12, 9, 0.92) 42%, 
    rgba(18, 12, 9, 0.55) 68%, 
    rgba(18, 12, 9, 0.12) 88%, 
    rgba(18, 12, 9, 0) 100%);
}

/* ── Real Coffee Bean Landing Stage ── */
.bean-landing-stage {
  position: absolute;
  z-index: 15;
  pointer-events: none;
  transition: opacity 1.2s ease;
  /* Top, left, width, height are set via JS with pixel-perfect background alignment */
}
.bean-landing-stage.rotating-out {
  opacity: 0;
}

/* The real extracted bean image */
.real-falling-bean {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transform: translateY(-115vh) scale(1.8) rotate(-35deg);
  opacity: 0;
  will-change: transform, opacity;
}

/* Dynamic floor shadow under falling bean */
.bean-dynamic-shadow {
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 80%;
  height: 25%;
  transform: translateX(-50%) scale(0.2);
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.8) 0%, rgba(15, 8, 4, 0.45) 50%, transparent 75%);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

/* Impact shockwave ripple */
.bean-ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120%;
  height: 120%;
  margin-top: -60%;
  margin-left: -60%;
  border-radius: 50%;
  border: 2px solid rgba(201, 165, 107, 0.7);
  box-shadow: 0 0 16px rgba(201, 165, 107, 0.4);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.3);
}

/* Dropping animation classes */
.bean-landing-stage.dropping .real-falling-bean {
  animation: beanFallAndMerge 1.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.bean-landing-stage.dropping .bean-dynamic-shadow {
  animation: beanShadowApproach 1.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.bean-landing-stage.rippling .bean-ripple {
  animation: beanContactRipple 0.75s ease-out forwards;
}

/* Settled state: Bean locks into background */
.bean-landing-stage.settled .real-falling-bean {
  transform: translateY(0) scale(1) rotate(0deg);
  opacity: 1;
}

@keyframes beanFallAndMerge {
  0% {
    transform: translateY(-115vh) scale(2.0) rotate(-38deg);
    opacity: 0.85;
  }
  20% {
    opacity: 1;
  }
  74% {
    /* Hard contact impact with slight physical squish */
    transform: translateY(0) scale(1.06, 0.94) rotate(2deg);
  }
  83% {
    /* Micro-bounce rebound */
    transform: translateY(-10px) scale(0.97, 1.03) rotate(-1deg);
  }
  92% {
    /* Micro-settle */
    transform: translateY(2px) scale(1.01, 0.99) rotate(0.5deg);
  }
  100% {
    /* Exact 1:1 resting position and rotation matching the photo */
    transform: translateY(0) scale(1, 1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes beanShadowApproach {
  0% {
    transform: translateX(-50%) scale(0.2);
    opacity: 0;
    filter: blur(10px);
  }
  50% {
    opacity: 0.35;
    filter: blur(8px);
  }
  74% {
    transform: translateX(-50%) scale(1.15);
    opacity: 0.9;
    filter: blur(3px);
  }
  83% {
    transform: translateX(-50%) scale(0.9);
    opacity: 0.7;
    filter: blur(4px);
  }
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 0.65;
    filter: blur(2.5px);
  }
}

@keyframes beanContactRipple {
  0% {
    transform: scale(0.3);
    opacity: 0.9;
  }
  100% {
    transform: scale(2.8);
    opacity: 0;
  }
}

/* Replay Button */
.replay-bean-btn {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 30;
  background: rgba(30, 20, 14, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(201, 165, 107, 0.35);
  color: #D9CDB6;
  font-family: var(--body);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
  pointer-events: auto;
}
.replay-bean-btn:hover {
  background: rgba(45, 30, 20, 0.95);
  border-color: #B08D57;
  color: #FFFFFF;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

/* ── Hero Content (Estate Coffee Typography) ── */
.hero-content-wrap {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding-top: clamp(24px, 5vh, 60px);
  padding-bottom: clamp(20px, 4.5vh, 44px);
  box-sizing: border-box;
}

.hero-main-body {
  max-width: 620px;
  margin-top: auto;
  margin-bottom: auto;
}

/* Kicker */
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--disp);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #B08D57;
  margin-bottom: 16px;
}

/* Headline */
.hero-headline {
  font-family: var(--disp);
  font-size: clamp(2.8rem, 5.5vw, 4.8rem);
  font-weight: 700;
  line-height: 1.06;
  color: #FFFFFF !important;
  margin: 0 0 18px 0;
  letter-spacing: -0.02em;
}

.hero-headline .soft-accent {
  display: block;
  font-weight: 600;
  color: #C9A56B !important;
}

/* Subtitle */
.hero-sub {
  font-family: var(--body);
  font-size: clamp(1.05rem, 1.35vw, 1.25rem);
  line-height: 1.6;
  color: #D9CDB6;
  max-width: 490px;
  margin: 0 0 32px 0;
}

/* CTA Buttons */
.hero-ctas {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-hero-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #B08D57;
  color: #140D08 !important;
  font-family: var(--disp);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
  padding: 14px 28px;
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 20px rgba(176, 141, 87, 0.35);
}

.btn-hero-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 26px rgba(176, 141, 87, 0.5);
  background: #C9A56B;
}

.btn-hero-primary .arrow {
  display: inline-block;
  transition: transform 0.25s ease;
}
.btn-hero-primary:hover .arrow {
  transform: translateX(4px);
}

.btn-hero-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  color: #FFFFFF !important;
  border: 1.5px solid rgba(255, 255, 255, 0.32);
  font-family: var(--disp);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
  padding: 13px 26px;
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-hero-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #B08D57;
  color: #B08D57 !important;
  transform: translateY(-2px);
}

/* Proof / Stats Bar at bottom */
.hero-proof-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  padding-top: clamp(16px, 2.5vh, 26px);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  width: 100%;
}

.hero-proof-item b {
  display: block;
  font-family: var(--disp);
  font-size: clamp(1.2rem, 1.8vw, 1.55rem);
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.hero-proof-item span {
  display: block;
  font-family: var(--body);
  font-size: 0.86rem;
  color: #A89B8C;
  line-height: 1.4;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  body.home-hero-light header nav[aria-label="Main navigation"] {
    display: none !important;
  }
  .mobile-menu-toggle {
    display: inline-flex !important;
  }
}

@media (max-width: 860px) {
  body.home-hero-light {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }
  .hero-stage-container {
    min-height: calc(100vh - 96px);
  }
  .hero-proof-bar {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .hero-bg-vignette {
    background: linear-gradient(180deg, 
      rgba(18, 12, 9, 0.94) 0%, 
      rgba(18, 12, 9, 0.86) 55%, 
      rgba(18, 12, 9, 0.56) 100%);
  }
  .replay-bean-btn {
    top: 14px;
    right: 14px;
    bottom: auto;
    padding: 6px 12px;
    font-size: 0.76rem;
  }
}

@media (max-width: 540px) {
  body.home-hero-light .bar {
    font-size: 0.75rem;
    padding: 7px 12px;
  }
  body.home-hero-light header {
    padding: 8px 0 !important;
  }
  body.home-hero-light header .w {
    padding: 0 14px !important;
    height: auto !important;
  }
  body.home-hero-light header .logo {
    font-size: 1.04rem !important;
    letter-spacing: 0.08em !important;
    gap: 7px !important;
  }
  body.home-hero-light header .logo img {
    height: 30px !important;
  }
  body.home-hero-light header .logo small {
    display: none !important;
  }
  body.home-hero-light header .user-btn {
    padding: 5px 10px !important;
    font-size: 0.76rem !important;
  }
  body.home-hero-light header .bk {
    font-size: 0.8rem !important;
  }
  body.home-hero-light header .bk b {
    width: 22px !important;
    height: 22px !important;
  }
  .hero-content-wrap {
    padding: 46px 16px 26px;
  }
  .hero-headline {
    font-size: clamp(2.15rem, 9.5vw, 3.1rem) !important;
  }
  .hero-ctas a {
    width: 100%;
  }
}
