:root {
  --color-primary: #ff6b00;
  --color-secondary: #ccff00;
  --color-dark: #1e293b;
  --color-white: #ffffff;
  --color-bg-light: #f8fafc;
  --font-main: 'Inter', sans-serif;
  --font-heading: 'Space Grotesk', sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--color-bg-light);
  color: var(--color-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: radial-gradient(circle at top right, #fff9f5, transparent),
              radial-gradient(circle at bottom left, #f7ffea, transparent);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* ========================= HEADER ========================= */
header {
  padding: 40px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
header.visible { opacity: 1; transform: translateY(0); }

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--color-dark);
}
.logo img { width: 44px; height: 44px; }

.logo-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.1;
}

.tagline {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-primary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ========================= MAIN ========================= */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  z-index: 5;
  contain: layout style;
}

.badge-mini {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(255, 107, 0, 0.1);
  color: var(--color-primary);
  border-radius: 100px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  margin-bottom: 20px;
}

/* ========================= HERO FLEX ========================= */
.hero-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  max-width: 900px;
  margin: 0 auto 10px;
  gap: 40px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.hero-flex.visible { opacity: 1; transform: translateY(0); }

.hero-text {
  flex: 1;
  margin-bottom: 0;
  padding: 0;
}

h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 8vw, 3.8rem);
  line-height: 1.05;
  margin-bottom: 12px;
  color: var(--color-dark);
}
.text-orange { color: var(--color-primary); }

.hero-context {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 600;
  color: var(--color-dark);
  margin-bottom: 24px !important;
  opacity: 0.9;
}

p {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: #64748b;
  max-width: 600px;
}
.hero-flex p { margin-bottom: 30px; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  background: var(--color-primary);
  color: white;
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: 16px;
  box-shadow: 0 20px 40px -10px rgba(255, 107, 0, 0.4);
  transition: all 0.4s var(--ease-out);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 50px -12px rgba(255, 107, 0, 0.5);
  background: #ff7b1a; /* slightly lighter */
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.btn-primary:hover::after {
  opacity: 1;
}

.btn-primary i {
  font-size: 1.2rem;
  transition: transform 0.4s var(--ease-out);
}

.btn-primary:hover i {
  transform: scale(1.2) rotate(5deg);
}

/* ========================= BLOBS ========================= */
.blob-light {
  position: absolute;
  width: 600px;
  height: 600px;
  filter: blur(100px);
  z-index: -1;
  animation: float-slow 15s infinite alternate ease-in-out;
  will-change: transform;
}
@keyframes float-slow {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 100px) scale(1.1); }
}

/* ========================= KAROTTE TRAVAUX ========================= */
.karotte-travaux-wrapper {
  flex: 0 0 280px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 280px;
  margin: -40px 0 0;
}

.karotte-jackhammer {
  width: 240px;
  height: auto;
  position: relative;
  z-index: 10;
  filter: drop-shadow(0 15px 25px rgba(255, 91, 35, 0.3));
}

.debris-container {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 180px;
  height: 50px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 5;
}

.debris {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 8px;
  height: 8px;
  background: #cbd538;
  border-radius: 2px;
  opacity: 0;
  animation: shoot-debris 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  will-change: transform, opacity;
}
.debris.stone  { background: #9a9999; }
.debris.orange { background: #ff5b23; }

@keyframes shoot-debris {
  0%   { transform: translate(0, 0) scale(0.5) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.5) rotate(var(--rot)); opacity: 0; }
}

/* ========================= IPHONE MOCKUP ========================= */
.iphone-showcase.landscape {
  margin-top: 40px;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 20px 0;
  contain: layout style;
}

.iphone-container {
  position: relative;
  perspective: 1500px;
  will-change: transform;
}

/*
 * Glow: fades in when .visible is added, then pulses subtly.
 * The pulse keyframe overrides the base transform carefully so the
 * translate(-50%,-50%) centering is preserved inside the animation.
 */
.iphone-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(circle, rgba(255, 107, 0, 0.08) 0%, transparent 70%);
  z-index: 1;
  filter: blur(60px);
  opacity: 0;
  transition: opacity 1s var(--ease-out);
  will-change: opacity, transform;
}
.iphone-glow.visible {
  opacity: 1;
  animation: glow-pulse 4s ease-in-out infinite;
}
@keyframes glow-pulse {
  0%, 100% { opacity: 1;    transform: translate(-50%, -50%) scale(1); }
  50%       { opacity: 0.6; transform: translate(-50%, -50%) scale(1.08); }
}

/* -- Desktop default: 650×290 (ratio 0.4461) -- */
.iphone-device-landscape {
  width: 650px;
  height: 290px; /* 650 * 0.4461 */
  background: #050505;
  border-radius: 54px;
  padding: 12px;
  position: relative;
  box-shadow:
    0 50px 100px -20px rgba(0, 0, 0, 0.4),
    inset 0 0 15px rgba(255, 255, 255, 0.1);
  border: 5px solid #1a1a1a;
  z-index: 5;

  /* START: portrait, above the viewport (translateY outermost = screen-space) */
  opacity: 0;
  transform: translateY(-110vh) rotate(90deg) scale(1.3);
  transition: transform 1.2s var(--ease-out), opacity 0.6s var(--ease-out);
  will-change: transform, opacity;
}

/*
 * ENTERING: phone slides from top to viewport centre, still portrait.
 * --phone-center-y is set by JS (offset needed to perfectly centre the phone).
 */
.iphone-device-landscape.entering {
  opacity: 1;
  transform: translateY(var(--phone-center-y, -10vh)) rotate(90deg) scale(1);
}

/* SETTLED: landscape, natural document position */
.iphone-device-landscape.settled {
  opacity: 1;
  transform: translateY(0) rotate(0deg) scale(1);
}

.iphone-device-landscape::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50px;
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 50%, rgba(255,255,255,0.02) 100%);
  pointer-events: none;
  z-index: 10;
}

.iphone-screen-wrap-landscape {
  width: 100%;
  height: 100%;
  border-radius: 42px;
  overflow: hidden;
  background: #000;
  position: relative;
  isolation: isolate;
}

/* ========================= SCREEN CONTENTS ========================= */

/* Intro: splashscreen.mp4 */
.iphone-intro-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: #000;
  transition: opacity 0.6s var(--ease-out);
}

.iphone-intro-content video {
  /*
   * Screen is 650×290. In portrait (rotated 90deg), user sees 290×650.
   * width  = 290/650 ≈ 44.6%
   * height = 650/290 ≈ 224.1%
   * Centered via flexbox, rotated -90deg → fills 650×290 exactly.
   */
  width: 44.6%;
  height: 260%;
  object-fit: cover;
  background: #000;
  transform: rotate(-90deg);
  transition: transform 1.2s var(--ease-out),
              width 1.2s var(--ease-out),
              height 1.2s var(--ease-out);
  will-change: transform, width, height;
}

/* Settled: video fills landscape screen normally */
.iphone-device-landscape.settled .iphone-intro-content video {
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
}

/* Video YouTube (hidden initially) */
.iphone-video-content {
  position: absolute;
  inset: 0;
  background: #000;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.8s var(--ease-out);
}
.iphone-video-content iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Phase: show video */
.iphone-device-landscape.show-video .iphone-intro-content {
  opacity: 0;
  pointer-events: none;
}
.iphone-device-landscape.show-video .iphone-video-content {
  opacity: 1;
}

/* Notch */
.iphone-notch-landscape {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 100px;
  background: #000;
  border-radius: 20px;
  z-index: 20;
}

/*
 * Side buttons — expressed as % of device width so they scale at every
 * breakpoint automatically without per-breakpoint overrides.
 * Base reference: 650px wide device.
 *   btns:  left = 100/650 ≈ 15.38%  width = 60/650  ≈ 9.23%
 *   power: left = 180/650 ≈ 27.69%  width = 80/650  ≈ 12.31%
 */
.iphone-btns-landscape {
  position: absolute;
  top: -5px;
  left: 15.38%;
  width: 9.23%;
  height: 5px;
  background: #1a1a1a;
  border-radius: 4px 4px 0 0;
}
.iphone-power-landscape {
  position: absolute;
  bottom: -5px;
  left: 27.69%;
  width: 12.31%;
  height: 5px;
  background: #1a1a1a;
  border-radius: 0 0 4px 4px;
}

/* ========================= IPHONE + GAINAGE WRAPPER ========================= */
.iphone-with-gainage {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ========================= GAINAGE ANIMATION ========================= */
.gainage-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  /* Carrot's bottom edge slightly overlaps the phone's top border */
  margin-bottom: -18px;
  z-index: 10;
  position: relative;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.gainage-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.gainage-container {
  position: relative;
  width: 150px;
  height: 88px;
  will-change: transform;
}

.gainage-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Inspire visible by default, expire completely hidden */
.gainage-inspire { visibility: visible; }
.gainage-expire  { visibility: hidden; }

/* When exhaling, swap visibility instantly */
.gainage-container.exhale .gainage-inspire { visibility: hidden; }
.gainage-container.exhale .gainage-expire  { visibility: visible; }

/* Subtle body movement to simulate breathing */
.gainage-container.inhale {
  animation: breathe-in 3s ease-in-out forwards;
}
.gainage-container.exhale {
  animation: breathe-out 3s ease-in-out forwards;
}

@keyframes breathe-in {
  0%   { transform: scaleY(0.96); }
  100% { transform: scaleY(1.04); }
}
@keyframes breathe-out {
  0%   { transform: scaleY(1.04); }
  100% { transform: scaleY(0.96); }
}

/* Label — now above the carrot image */
.gainage-label {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.gainage-text {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 1px;
  transition: opacity 0.4s ease;
}

/*
 * Progress bar — driven entirely by JS via class toggles.
 * .filling  → width goes to 100% (inhale phase, 3s)
 * .draining → width goes to 0%   (exhale phase, 3s)
 * No CSS animation here to avoid drift with the JS timer.
 */
.gainage-progress {
  width: 120px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 107, 0, 0.15);
  overflow: hidden;
  position: relative;
}
.gainage-progress::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  border-radius: 4px;
  /* Duration matches the breathing cycle so fill & drain are always in sync */
  transition: width 3s ease-in-out;
}
.gainage-progress.filling::after  { width: 100%; }
.gainage-progress.draining::after { width: 0%;   }

/* ========================= SOCIAL / FOOTER ========================= */
.social-links {
  padding: 40px 0;
  display: flex;
  justify-content: center;
  gap: 15px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
.social-links.visible { opacity: 1; transform: translateY(0); }

.social-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 12px;
  color: #64748b;
  font-size: 20px;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}
.social-btn:hover {
  transform: translateY(-5px);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.footer-info {
  padding-bottom: 40px;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}
.footer-info.visible { opacity: 1; }

/* ========================= RESPONSIVE ========================= */

/* --- Tablet: 900px – 1099px --- */
@media (max-width: 1099px) and (min-width: 900px) {
  .iphone-device-landscape {
    width: 540px;
    height: 241px; /* 540 * 0.4461 */
    border-radius: 46px;
  }
  .iphone-screen-wrap-landscape { border-radius: 36px; }
  .iphone-notch-landscape        { width: 20px; height: 84px; left: 12px; }
  .iphone-glow                   { width: 500px; height: 340px; }

  .karotte-travaux-wrapper { flex: 0 0 240px; height: 240px; }
  .karotte-jackhammer      { width: 200px; }
}

/* --- Large mobile: 601px – 899px — PORTRAIT PHONE --- */
@media (max-width: 899px) and (min-width: 601px) {
  .hero-flex {
    flex-direction: column;
    text-align: center;
    gap: 24px;
  }
  .hero-flex .hero-text { margin-bottom: 0; }
  .hero-flex p          { margin: 0 auto; }

  .karotte-travaux-wrapper { flex: 0 0 200px; height: 200px; margin: 0; }
  .karotte-jackhammer      { width: 170px; }

  .blob-light { width: 350px; height: 350px; filter: blur(60px); }

  /* Portrait: width ≈ 48vw, height = width × 2.2414 (650/290) */
  .iphone-device-landscape {
    width: 48vw;
    height: calc(48vw * 2.2414);
    border-radius: 40px;
    padding: 8px;
    /* translateY outermost = screen-space, no rotation (already portrait) */
    opacity: 0;
    transform: translateY(-110vh) scale(0.9);
    transition: transform 1.2s var(--ease-out), opacity 0.6s var(--ease-out);
  }
  .iphone-device-landscape.entering {
    opacity: 1;
    transform: translateY(var(--phone-center-y, -10vh)) scale(1);
  }
  .iphone-device-landscape.settled {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  .iphone-screen-wrap-landscape { border-radius: 32px; }

  /* Notch → top centre (Dynamic Island style) */
  .iphone-notch-landscape {
    left: 50%;
    top: 10px;
    transform: translateX(-50%);
    width: 70px;
    height: 14px;
    border-radius: 10px;
  }

  /* Volume buttons on left side */
  .iphone-btns-landscape {
    top: 22%;
    left: -5px;
    bottom: auto;
    width: 5px;
    height: 34px;
    border-radius: 4px 0 0 4px;
  }
  /* Power button on right side */
  .iphone-power-landscape {
    top: 28%;
    right: -5px;
    left: auto;
    bottom: auto;
    width: 5px;
    height: 50px;
    border-radius: 0 4px 4px 0;
  }

  /* Splashscreen: video is already portrait — no counter-rotation needed */
  .iphone-intro-content video {
    width: 100%;
    height: 100%;
    transform: rotate(0deg);
  }
  .iphone-device-landscape.settled .iphone-intro-content video {
    width: 100%;
    height: 100%;
    transform: rotate(0deg);
  }

  .iphone-glow { width: 260px; height: 460px; }

  .gainage-container { width: 180px; height: 108px; }
}

/* --- Small mobile: ≤600px — PORTRAIT PHONE --- */
@media (max-width: 600px) {
  header { padding: 24px 0; }

  .hero-flex {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  .hero-flex .hero-text { margin-bottom: 0; }
  .hero-flex p          { margin: 0 auto; }

  .karotte-travaux-wrapper { flex: 0 0 150px; height: 150px; margin: 0; }
  .karotte-jackhammer      { width: 130px; }

  .blob-light { width: 260px; height: 260px; filter: blur(50px); }

  /* Portrait: width ≈ 58vw */
  .iphone-device-landscape {
    width: 58vw;
    height: calc(58vw * 2.2414);
    border-radius: 34px;
    padding: 6px;
    border-width: 4px;
    /* translateY outermost = screen-space, no rotation (already portrait) */
    opacity: 0;
    transform: translateY(-110vh) scale(0.9);
    transition: transform 1.2s var(--ease-out), opacity 0.6s var(--ease-out);
  }
  .iphone-device-landscape.entering {
    opacity: 1;
    transform: translateY(var(--phone-center-y, -10vh)) scale(1);
  }
  .iphone-device-landscape.settled {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  .iphone-screen-wrap-landscape { border-radius: 28px; }

  .iphone-notch-landscape {
    left: 50%;
    top: 8px;
    transform: translateX(-50%);
    width: 58px;
    height: 12px;
    border-radius: 8px;
  }

  .iphone-btns-landscape {
    top: 22%;
    left: -4px;
    bottom: auto;
    width: 4px;
    height: 28px;
    border-radius: 4px 0 0 4px;
  }
  .iphone-power-landscape {
    top: 28%;
    right: -4px;
    left: auto;
    bottom: auto;
    width: 4px;
    height: 42px;
    border-radius: 0 4px 4px 0;
  }

  .iphone-intro-content video {
    width: 100%;
    height: 100%;
    transform: rotate(0deg);
  }
  .iphone-device-landscape.settled .iphone-intro-content video {
    width: 100%;
    height: 100%;
    transform: rotate(0deg);
  }

  .iphone-glow { width: 200px; height: 360px; }

  .gainage-container { width: 160px; height: 96px; }
  .gainage-progress  { width: 80px; }
}

/* --- XS: ≤380px --- */
@media (max-width: 380px) {
  .logo     { font-size: 20px; gap: 8px; }
  .logo img { width: 32px; height: 32px; }

  h1 { font-size: clamp(1.6rem, 9vw, 2.4rem); }

  .karotte-travaux-wrapper { flex: 0 0 120px; height: 120px; }
  .karotte-jackhammer      { width: 105px; }

  .iphone-device-landscape {
    width: 66vw;
    height: calc(66vw * 2.2414);
    border-radius: 28px;
  }
  .iphone-screen-wrap-landscape { border-radius: 22px; }
  .iphone-notch-landscape {
    width: 50px;
    height: 11px;
  }

  .gainage-container { width: 140px; height: 84px; }
  .gainage-text      { font-size: 0.9rem; }
  .gainage-progress  { width: 70px; }
}

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

  /*
   * Ensure all content is immediately visible — no fade-in, no slide-in.
   * The JS respects this flag too and will skip setting .visible classes
   * on animated elements, so we force the final state here in CSS as well.
   */
  header,
  .hero-flex,
  .gainage-section,
  .social-links,
  .footer-info {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* iPhone immediately settled (landscape on desktop, portrait on mobile) */
  .iphone-device-landscape,
  .iphone-device-landscape.entering {
    transform: translateY(0) rotate(0deg) scale(1) !important;
    opacity: 1 !important;
    transition: none !important;
  }
  .iphone-intro-content video {
    width: 100% !important;
    height: 100% !important;
    transform: rotate(0deg) !important;
    transition: none !important;
  }

  .blob-light          { animation: none !important; }
  .iphone-glow.visible { animation: none !important; opacity: 1; }
  .gainage-container   { animation: none !important; }
  .debris              { display: none !important; }

  .gainage-progress::after { transition: none !important; }
}
