/* ==========================================================================
   Gaayu Foods — animation system
   One easing everywhere: cubic-bezier(0.22, 1, 0.36, 1)
   Reveals animate only opacity + transform. Respects prefers-reduced-motion.
   ========================================================================== */

:root{
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --reveal-duration: .6s;
  --reveal-delay: 0ms;
  --hover-duration: .25s;
}

/* ---------- page entrance / transition ---------- */
body{
  animation: page-fade-in .45s var(--ease) both;
}
html.page-leaving body{
  opacity: 0;
  transition: opacity .18s ease;
}
@keyframes page-fade-in{
  from{ opacity: 0; }
  to{ opacity: 1; }
}

/* ---------- scroll / load reveal system ---------- */
.reveal{
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--reveal-duration) var(--ease), transform var(--reveal-duration) var(--ease);
  transition-delay: var(--reveal-delay);
  will-change: opacity, transform;
}
.reveal.is-visible{
  opacity: 1;
  transform: translateY(0);
}
.reveal-down{ transform: translateY(-16px); }
.reveal-down.is-visible{ transform: translateY(0); }

.reveal-scale{ transform: translateY(16px) scale(.96); }
.reveal-scale.is-visible{ transform: translateY(0) scale(1); }

.reveal-left{ transform: translateX(-36px); }
.reveal-left.is-visible{ transform: translateX(0); }

.reveal-right{ transform: translateX(36px); }
.reveal-right.is-visible{ transform: translateX(0); }

/* ---------- hero food image entrance + gentle float ---------- */
.compose .ph{
  animation: float-y 6s ease-in-out infinite;
  animation-delay: 1.1s;
}
.compose .chapati{ animation-delay: 1.3s; }
.compose .idiyappam{ animation-delay: 1.5s; }
@keyframes float-y{
  0%, 100%{ transform: translateY(0); }
  50%{ transform: translateY(-8px); }
}
/* the .reveal transition (opacity/translateY/scale) settles before the
   float animation-delay above elapses, so the two never fight over transform */

/* ---------- decorative background shapes drift ---------- */
.blob, .blob-soft{
  animation: blob-drift 16s ease-in-out infinite;
}
.banner .blob.b2, .why .blob{
  animation-duration: 20s;
  animation-direction: reverse;
}
@keyframes blob-drift{
  0%, 100%{ transform: translate(0, 0) scale(1); }
  50%{ transform: translate(-16px, 12px) scale(1.03); }
}

/* ---------- header ---------- */
header.site{
  transition: box-shadow .3s var(--ease), background-color .3s ease;
}
header.site.scrolled{
  box-shadow: 0 8px 24px -18px rgba(18, 32, 56, .35);
  background: rgba(255, 255, 255, .98);
}

/* nav underline */
.nav a:not(.brand):not(.btn){
  position: relative;
  padding-bottom: 2px;
}
.nav a:not(.brand):not(.btn)::after{
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 2px;
  background: var(--blue);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform var(--hover-duration) var(--ease);
}
.nav a:not(.brand):not(.btn):hover::after,
.nav a:not(.brand):not(.btn):focus-visible::after,
.nav a.active::after{
  transform: scaleX(1);
}

/* mobile menu toggle */
.nav-toggle{
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  padding: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
  flex: none;
  position: relative;
  z-index: 80;
}
.nav-toggle span{
  display: block;
  width: 100%; height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .3s var(--ease), opacity .2s ease;
}
.nav-toggle.is-open span:nth-child(1){ transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2){ opacity: 0; }
.nav-toggle.is-open span:nth-child(3){ transform: translateY(-7px) rotate(-45deg); }

/* dark overlay behind the slide-in panel.
   Explicit vw/dvh sizing (not inset:0's auto-computed height) because the
   header has a `transform` from .reveal, which makes it a new containing
   block for fixed descendants — inset:0 would then resolve against the
   header's own ~64px box instead of the real viewport. */
.nav-overlay{
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100dvh;
  background: rgba(9, 26, 56, .5);
  z-index: 65;
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s var(--ease), visibility 0s linear .35s;
}
.nav-overlay.open{
  opacity: 1;
  visibility: visible;
  transition: opacity .35s var(--ease), visibility 0s;
}

@media (max-width: 899px){
  .nav{ position: relative; }
  .nav-toggle{ display: inline-flex; }

  /* full-height slide-in panel */
  .nav ul{
    position: fixed;
    top: 0; right: 0; bottom: 0;
    height: 100dvh;
    width: min(84vw, 360px);
    z-index: 70;
    margin: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #fff;
    padding: 88px 28px 28px;
    box-shadow: -20px 0 50px -20px rgba(18, 32, 56, .35);
    transform: translateX(100%);
    transition: transform .35s var(--ease);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav ul.open{
    transform: translateX(0);
  }
  .nav ul li{ display: block !important; width: 100%; }
  .nav ul li a:not(.btn){
    display: block;
    padding: 16px 4px;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--line);
    min-height: 44px;
  }
  /* pin the Order Now button to the bottom of the panel */
  .nav ul li:last-child{
    margin-top: auto;
    padding-top: 24px;
  }
  .nav ul li:last-child a.btn{
    display: flex;
    width: 100%;
    justify-content: center;
    padding: 16px 20px;
    font-size: 1.05rem;
  }
}

@media (min-width: 900px){
  .nav-overlay{ display: none; }
}

/* ---------- how-it-works: growing top line ---------- */
.how li{ border-top: none; }
.how li::after{
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: var(--blue);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform .6s var(--ease);
  transition-delay: var(--reveal-delay);
}
.how li:nth-child(2)::after{ background: var(--green); }
.how li:nth-child(3)::after{ background: var(--gold); }
.how li:nth-child(4)::after{ background: var(--blue); }
.how li.is-visible::after{ transform: scaleX(1); }

/* ---------- cards: lift + image zoom ---------- */
.pcard, .why-item, .cook-card{
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.pcard .ph img{
  transition: transform .4s var(--ease);
}
.link svg{
  transition: transform var(--hover-duration) var(--ease);
}
.btn{
  transition: transform var(--hover-duration) var(--ease), box-shadow var(--hover-duration) var(--ease), background var(--hover-duration) var(--ease);
}

/* Hover-only effects — real pointer devices only, so tap-and-hold on touch
   screens never leaves a "stuck" hover state. Touch feedback instead comes
   from the :active rules below (outside this guard, so they fire everywhere). */
@media (hover: hover) and (pointer: fine){
  .pcard:hover, .cook-card:hover{
    transform: translateY(-6px);
    box-shadow: 0 30px 54px -26px rgba(18, 32, 56, .38);
  }
  .why-item:hover{
    transform: translateY(-6px);
  }
  .pcard:hover .ph img{
    transform: scale(1.05);
  }
  .btn:hover{
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -14px rgba(18, 32, 56, .4);
  }
  .link:hover svg{
    transform: translateX(4px);
  }
  .nav-toggle:hover{ background: var(--mist); }
}

/* ---------- touch feedback (all pointer types) ---------- */
.pcard:active, .cook-card:active, .why-item:active{
  transform: scale(.98);
  transition-duration: .12s;
}
.btn:active{
  transform: translateY(0) scale(.98);
  transition-duration: .12s;
}
.link:active svg{
  transform: translateX(2px);
}

/* ---------- shorter travel distances on small screens ---------- */
@media (max-width: 767px){
  .reveal{ transform: translateY(14px); }
  .reveal-down{ transform: translateY(-10px); }
  .reveal-scale{ transform: translateY(10px) scale(.98); }
  .reveal-left{ transform: translateX(-18px); }
  .reveal-right{ transform: translateX(18px); }
}

/* ---------- smooth scroll (guarded) ---------- */
@media (prefers-reduced-motion: no-preference){
  html{ scroll-behavior: smooth; }
}

/* ---------- reduced motion: strip everything down ---------- */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  body{ animation: none !important; }
  html.page-leaving body{ opacity: 1 !important; }
  .reveal, .reveal-down, .reveal-scale, .reveal-left, .reveal-right{
    opacity: 1 !important;
    transform: none !important;
  }
  .compose .ph, .blob, .blob-soft{ animation: none !important; }
  .how li::after{ transform: scaleX(1) !important; }
}
