/* ==========================================================================
   Biox Nexevo — Main Stylesheet
   Sections: Base / Container / Hero / Scroll-to-top / Map animations /
             Safari-iOS fixes / Opacity polyfills / Mobile Nav (slide-in) /
             Responsive overrides
   ========================================================================== */

/* ---------- Base ---------- */
body {
  background-color: #F7F4EE;
  color: #1A1A1A;
  font-family: 'IBM Plex Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: #F5A523; color: #0D1E2C; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #F7F4EE; }
::-webkit-scrollbar-thumb { background: #D1CCC2; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #B87410; }

/* ---------- Responsive container ----------
   Replaces the old fixed "max-w-[80%]" utility.
   Mobile: full width with side padding.
   Tablet/Desktop: capped width, centered. */
.container-app {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 0;
  padding-right: 0;
}
@media (min-width: 768px) {
  .container-app { max-width: 92%; }
}
@media (min-width: 1024px) {
  .container-app { max-width: 85%; }
}
@media (min-width: 1280px) {
  .container-app { max-width: 80%; }
}

.hero-radial {
  background-image:
    radial-gradient(circle at 15% 50%, rgba(245, 165, 35, 0.10) 0%, transparent 50%),
    radial-gradient(circle at 85% 20%, rgba(14, 116, 144, 0.08) 0%, transparent 50%);
}

/* ---------- Hero video + CTA reveal ----------
   The hero video plays once (autoplay, muted, no loop). While it plays,
   the heading/copy is visible but the CTA buttons stay hidden. Once the
   video finishes (or fails to load / can't autoplay), the "hero-ready"
   class is added to the section and the CTA fades + slides smoothly into
   view — matching the "video plays, then the CTA comes out" request. */
#hero-video {
  position: absolute;
  inset: 0;
  object-fit: cover;
}
.hero-cta {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .6s cubic-bezier(.22,1,.36,1), transform .6s cubic-bezier(.22,1,.36,1);
  pointer-events: none;
}
#hero.hero-ready .hero-cta {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
/* Safety net: if JS fails for any reason, still show the CTA after a short delay */
@media (prefers-reduced-motion: reduce) {
  .hero-cta { opacity: 1; transform: none; transition: none; pointer-events: auto; }
}

/* Hero mute toggle: fades out once the video has finished playing —
   nothing left to mute/unmute, and it shouldn't linger over the CTA. */
#hero-mute-toggle {
  transition: opacity .4s ease, transform .4s ease;
}
#hero-mute-toggle.hero-mute-hidden {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

/* Reveal: all visible in static export */
.reveal { opacity: 1 !important; transform: none !important; }

/* ---------- Ingredient filter transitions ----------
   Cards fade + lift out when a filter is clicked, then the new set
   fades + rises in with a slight per-card stagger, so switching
   categories reads as a smooth, deliberate motion rather than a snap. */
.ing-card {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .38s cubic-bezier(.22,1,.36,1), transform .38s cubic-bezier(.22,1,.36,1);
}
.ing-card.ing-card-in {
  opacity: 1;
  transform: translateY(0);
}
.ing-card.ing-card-out {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease;
  transition-delay: 0ms !important;
}
@media (prefers-reduced-motion: reduce) {
  .ing-card, .ing-card.ing-card-in, .ing-card.ing-card-out {
    opacity: 1; transform: none; transition: none;
  }
}

/* ---------- Audience panel transitions ---------- */
.panel-fade {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .32s cubic-bezier(.22,1,.36,1), transform .32s cubic-bezier(.22,1,.36,1);
}
.panel-fade.panel-fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Retail "+more" toggle transitions ---------- */
.more-wrap {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .32s cubic-bezier(.22,1,.36,1), transform .32s cubic-bezier(.22,1,.36,1);
}
.more-wrap.more-wrap-in {
  opacity: 1;
  transform: translateY(0);
}
.more-btn-out {
  opacity: 0 !important;
  transform: scale(.92);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .panel-fade, .panel-fade.panel-fade-in,
  .more-wrap, .more-wrap.more-wrap-in, .more-btn-out {
    opacity: 1; transform: none; transition: none;
  }
}

/* ---------- Ingredient filter tabs: sliding pill indicator ----------
   Each tab is its own bordered pill (matching the reference design), and
   a navy fill slides/resizes behind whichever tab is active — so
   switching categories still reads as one continuous motion rather than
   separate colour swaps, while each pill keeps its own visible border. */
#ing-filters {
  isolation: isolate; /* keeps the pill's z-index scoped to this control */
}
.ing-filter-pill {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  border-radius: 9999px;
  background-color: #0D1E2C;
  transition: transform .38s cubic-bezier(.65,0,.35,1), width .38s cubic-bezier(.65,0,.35,1);
  will-change: transform, width;
}
.ing-filter-btn {
  position: relative;
  z-index: 1;
  background-color: #ffffff;
  border: 1.5px solid #E5E0D8;
  color: rgba(26,26,26,0.6);
  transition: color .28s ease, border-color .28s ease;
}
.ing-filter-btn:hover {
  color: rgba(26,26,26,0.85);
  border-color: rgba(26,26,26,0.25);
}
.ing-filter-btn.is-active {
  background-color: #0D1E2C;
  color: #ffffff;
  border-color: #0D1E2C;
}
.ing-filter-btn.is-active:hover {
  background-color: #0D1E2C;
  color: #ffffff;
  border-color: #0D1E2C;
}
@media (prefers-reduced-motion: reduce) {
  .ing-filter-pill { transition: none; }
}

/* ---------- Scroll-to-top button ---------- */
#stt-btn {
  position: fixed;
  bottom: 94px;
  right: 24px;
  z-index: 50;
  width: 52px;
  height: 52px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(12px) scale(0.88);
  transition: opacity .36s cubic-bezier(.22,1,.36,1),
              transform .36s cubic-bezier(.22,1,.36,1);
  pointer-events: none;
}
#stt-btn.stt-on {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
#stt-btn:active { transform: scale(.93); }
#stt-track { transition: fill .22s; }
#stt-ring  { transition: stroke-dashoffset .1s linear, stroke .22s; }
#stt-arrow { transition: stroke .22s; }
#stt-btn:hover #stt-track { fill: #F5A523; }
#stt-btn:hover #stt-ring  { stroke: #B87410; }
#stt-btn:hover #stt-arrow { stroke: #ffffff; }

@media (max-width: 480px) {
  #stt-btn { bottom: 84px; right: 16px; width: 46px; height: 46px; }
}

/* Floating WhatsApp button: tighten offset to match scroll-to-top on small phones */
@media (max-width: 480px) {
  a[aria-label="Talk to us on WhatsApp"] { bottom: 16px; right: 16px; padding: 0.875rem; }
}

/* ---------- ASEAN map animations ---------- */
.pin-glow { opacity: .18; animation: pinPulse 2.8s ease-in-out infinite; }
@keyframes pinPulse {
  0%, 100% { opacity: .10; transform: scale(1); }
  50%      { opacity: .30; transform: scale(1.35); }
}
.net-line {
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  animation: netDraw 2.4s ease-out forwards, netFlow 6s linear 2.4s infinite;
}
@keyframes netDraw { to { stroke-dashoffset: 0; } }
@keyframes netFlow {
  from { stroke-dasharray: 4 6; stroke-dashoffset: 0; }
  to   { stroke-dasharray: 4 6; stroke-dashoffset: -40; }
}
.net-spark { opacity: .9; }
@media (prefers-reduced-motion: reduce) {
  .pin-glow, .net-line, .net-spark { animation: none; }
  .net-line { stroke-dashoffset: 0; }
}

/* ---------- Safari / iOS fixes ---------- */
* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { -webkit-overflow-scrolling: touch; overflow-x: hidden; }

/* Anchor targets: offset for the fixed header so sections land cleanly below it */
#ingredients, #start-conversation, #audience-nav, #how-it-works, #journey, #philosophy, #retail {
  scroll-margin-top: 88px;
}

/* Force header stacking context for iOS */
header { -webkit-transform: translateZ(0); transform: translateZ(0); }

/* ---------- Tailwind opacity-modifier polyfill (Safari, custom colors) ---------- */
.bg-navy\/90  { background-color: rgba(13,30,44,0.9)  !important; }
.bg-navy\/85  { background-color: rgba(13,30,44,0.85) !important; }
.bg-navy\/80  { background-color: rgba(13,30,44,0.8)  !important; }
.bg-navy\/60  { background-color: rgba(13,30,44,0.6)  !important; }
.bg-navy\/50  { background-color: rgba(13,30,44,0.5)  !important; }
.bg-navy\/40  { background-color: rgba(13,30,44,0.4)  !important; }
.bg-navy\/30  { background-color: rgba(13,30,44,0.3)  !important; }
.bg-navy\/10  { background-color: rgba(13,30,44,0.1)  !important; }
.bg-amber\/20 { background-color: rgba(245,165,35,0.2)!important; }
.bg-amber\/10 { background-color: rgba(245,165,35,0.1)!important; }
.bg-white\/10 { background-color: rgba(255,255,255,0.1)!important; }
.bg-white\/20 { background-color: rgba(255,255,255,0.2)!important; }
.bg-cream\/40 { background-color: rgba(247,244,238,0.4)!important; }

.text-white\/70 { color: rgba(255,255,255,0.70) !important; }
.text-white\/60 { color: rgba(255,255,255,0.60) !important; }
.text-white\/55 { color: rgba(255,255,255,0.55) !important; }
.text-white\/50 { color: rgba(255,255,255,0.50) !important; }
.text-white\/40 { color: rgba(255,255,255,0.40) !important; }
.text-white\/30 { color: rgba(255,255,255,0.30) !important; }
.text-white\/20 { color: rgba(255,255,255,0.20) !important; }
.text-white\/90 { color: rgba(255,255,255,0.90) !important; }
.text-ink\/80   { color: rgba(26,26,26,0.80) !important; }
.text-ink\/70   { color: rgba(26,26,26,0.70) !important; }
.text-ink\/60   { color: rgba(26,26,26,0.60) !important; }
.text-ink\/55   { color: rgba(26,26,26,0.55) !important; }
.text-ink\/50   { color: rgba(26,26,26,0.50) !important; }
.text-ink\/40   { color: rgba(26,26,26,0.40) !important; }
.text-amber\/90 { color: rgba(245,165,35,0.90)!important; }
.text-amber\/20 { color: rgba(245,165,35,0.20)!important; }
.border-white\/30{ border-color: rgba(255,255,255,0.3)!important; }
.border-white\/10{ border-color: rgba(255,255,255,0.1)!important; }
.border-hairline\/60{ border-color: rgba(229,224,216,0.6)!important; }

/* backdrop-blur webkit prefix */
.backdrop-blur-sm { -webkit-backdrop-filter:blur(4px);  backdrop-filter:blur(4px);  }
.backdrop-blur-md { -webkit-backdrop-filter:blur(12px); backdrop-filter:blur(12px); }

/* gradient polyfill helpers */
.from-navy   { --tw-gradient-from: #0D1E2C; }
.to-transparent { --tw-gradient-to: transparent; }

/* Hero min-height — dvh for iOS URL bar */
.min-h-\[88vh\] { min-height: 88vh; min-height: 88dvh; }

/* ==========================================================================
   MOBILE NAVIGATION — Slide-in drawer (left side)
   ========================================================================== */
#mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(13, 30, 44, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease;
}
#mobile-menu-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

#mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 70;
  height: 100%;
  height: 100dvh;
  width: min(80vw, 300px);
  max-width: 300px;
  background-color: #F7F4EE;
  transform: translateX(-100%);
  transition: transform .34s cubic-bezier(.22,1,.36,1);
  box-shadow: 4px 0 24px rgba(13,30,44,0.18);
  display: flex !important; /* header / scrollable links / bottom action bar */
  flex-direction: column;
  overflow: hidden;
}
#mobile-menu.is-open {
  transform: translateX(0);
}

#mobile-menu-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: #0D1E2C;
}
#mobile-menu-close:active { background-color: rgba(13,30,44,0.06); }

/* Inner scrollable link list gets iOS momentum scrolling; the header and
   bottom action bar stay pinned via flex-shrink-0 in the markup. */
#mobile-menu > .overflow-y-auto {
  -webkit-overflow-scrolling: touch;
}

/* Prevent body scroll when drawer is open */
body.menu-open {
  overflow: hidden;
}

/* ==========================================================================
   RESPONSIVE OVERRIDES — mobile-first refinements
   ========================================================================== */

/* ==========================================================================
   SECTION SPACING — unified rhythm across the whole page
   Rule: 50px top/bottom on small devices, 80px on large devices.
   ========================================================================== */
.section-y {
  padding-top: 50px;
  padding-bottom: 50px;
}
@media (min-width: 768px) {
  .section-y {
    padding-top: 80px;
    padding-bottom: 80px;
  }
}
/* Larger "story" sections that need a bit more breathing room on desktop
   but still respect the 50px / 80px floor. */
.section-y-lg {
  padding-top: 50px;
  padding-bottom: 50px;
}
@media (min-width: 768px) {
  .section-y-lg {
    padding-top: 80px;
    padding-bottom: 80px;
  }
}
@media (min-width: 1024px) {
  .section-y-lg {
    padding-top: 100px;
    padding-bottom: 100px;
  }
}

/* Hero */
@media (max-width: 767px) {
  section.mt-16 { margin-top: 4rem; }
}

/* Footer link grid: single column on very small phones for readability */
@media (max-width: 420px) {
  footer .grid-cols-2 { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
}

/* Story stage sections: ensure comfortable padding on mobile */
@media (max-width: 767px) {
  .p-6.sm\:p-10.md\:p-16.lg\:p-20 { padding: 1.5rem 1.25rem; }
}

/* Footer marquee text should not force horizontal scroll on small screens */
@media (max-width: 640px) {
  footer .font-heading.text-\[7vw\] { font-size: 9vw; }
}

/* Audience tab grid: stack to 1 column on very small phones */
@media (max-width: 420px) {
  #audience-tabs { grid-template-columns: 1fr; }
}

/* Retail market rows: tighten gap on small phones */
@media (max-width: 480px) {
  #retail-rows > div { padding: 1.25rem 1rem; }
}

/* Ensure all sections use consistent horizontal padding at the very small breakpoint */
@media (max-width: 380px) {
  .container-app { padding-left: 0; padding-right: 0; }
  .px-6 { padding-left: 1rem !important; padding-right: 1rem !important; }
}
/* ============ LANGUAGE SWITCHER ============ */
.lang-switcher-btn { cursor: pointer; }
.lang-switcher-menu {
  animation: langMenuIn .15s ease-out;
  transform-origin: top right;
}
@keyframes langMenuIn {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.lang-switcher-menu button { transition: all .15s ease; }
