:root {
  --brand-green: #2FA84F;
  --brand-orange: #F4812E;
  --ink: #2B2A28;
  --paper: #FBF9F4;
  --line: rgba(43, 42, 40, 0.12);

  --flavor-primary: var(--brand-green);
  --flavor-a: #EAF7EE;
  --flavor-b: #FBF9F4;
}

[data-flavor="litchi"] { --flavor-primary: #E8536B; --flavor-a: #FDE3E8; --flavor-b: #FBF9F4; }
[data-flavor="lemon"]  { --flavor-primary: #7CB342; --flavor-a: #EAF7D8; --flavor-b: #FBF9F4; }
[data-flavor="orange"] { --flavor-primary: #F4812E; --flavor-a: #FFE7CC; --flavor-b: #FBF9F4; }

.is-hidden { display: none !important; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.eyebrow {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--flavor-primary);
  margin: 0 0 0.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.75rem;
  border-radius: 50vw;
  background: var(--flavor-primary);
  color: #fff;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.4s ease;
  white-space: nowrap;
}
.button:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
.button--large { font-size: 1.05rem; padding: 1.1rem 2.25rem; gap: 0.6rem; }
.button.is-alternate {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line);
  gap: 0.6rem;
}
.button.is-alternate:hover { border-color: var(--flavor-primary); color: var(--flavor-primary); }

.button__icon {
  display: inline-flex;
  width: 1.1rem;
  height: 1.1rem;
  transition: transform 0.3s ease;
}
.button__icon svg { width: 100%; height: 100%; }
.button--large:hover .button__icon { transform: translateX(4px); }
.button__icon.is-plus { transition: transform 0.3s ease; }
#ingredientsToggle[aria-expanded="true"] .button__icon.is-plus { transform: rotate(45deg); }

/* preloader */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.preloader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader__logo {
  width: 5rem;
  animation: preloader-pulse 1.3s ease-in-out infinite;
}
@keyframes preloader-pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.08); opacity: 1; }
}

/* page transition overlay */
.page-transition {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
}

/* nav */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1.25rem 0;
}
.navbar__inner {
  position: relative;
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.navbar__brand {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.navbar__logo { height: 1.75rem; width: auto; }
.navbar__right { display: flex; align-items: center; gap: 0.75rem; }
.navbar__toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 101;
  position: relative;
}
.navbar__toggle span {
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.navbar__toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar__toggle.is-open span:nth-child(2) { opacity: 0; }
.navbar__toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.icon-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--ink);
  transition: transform 0.2s ease, color 0.2s ease;
}
.icon-pill svg { width: 1.15rem; height: 1.15rem; }
.icon-pill:hover { transform: translateY(-2px); }
#favoriteBtn[aria-pressed="true"] { color: var(--brand-orange); }
#favoriteBtn[aria-pressed="true"] svg { fill: currentColor; }

.corner-icon {
  position: fixed;
  left: 1.5rem;
  bottom: 1.5rem;
  z-index: 90;
}

.social-row {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 90;
  display: flex;
  gap: 0.75rem;
}
.social-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: background 0.2s ease, transform 0.2s ease;
}
.social-icon svg { width: 1.1rem; height: 1.1rem; }
.social-icon:hover { background: #fff; transform: translateY(-2px); }

.navbar__overlay {
  position: fixed;
  inset: 0;
  background: var(--ink);
  color: var(--paper);
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  transform: translateY(-100%);
  transition: transform 0.5s cubic-bezier(0.65, 0, 0.35, 1);
}
.navbar__overlay.is-open { transform: translateY(0); }
.navbar__overlay-emblem { width: 6rem; }
.navbar__overlay-tagline { font-weight: 600; color: var(--brand-orange); margin: 0; }

/* shelf (landing view) */
.shelf {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  text-align: center;
}
.shelf__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.shelf__intro {
  position: absolute;
  z-index: 2;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
}
.shelf__intro .eyebrow {
  color: var(--ink);
  text-shadow: 0 1px 12px rgba(255,255,255,0.85);
}
.shelf__intro h1 {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  margin: 0;
  line-height: 1;
  color: var(--ink);
  text-shadow: 0 1px 4px rgba(255,255,255,0.9), 0 0 24px rgba(255,255,255,0.6);
}

.shelf__row {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 15%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(1rem, 4vw, 3rem);
  flex-wrap: nowrap;
}
.shelf__item {
  position: relative;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  /* grounded by default; only lift/float on hover */
  transition: transform 0.35s ease;
}
.shelf__item:hover { transform: translateY(-0.6rem); }
.shelf__item img {
  position: relative;
  z-index: 1;
  width: clamp(11rem, 19vw, 16rem);
  /* two stacked shadows for depth: a crisp near shadow for contact/weight,
     plus a softer, longer one cast toward the bottom-right (the sun) for
     ambient depth — a single flat shadow read as thin/characterless */
  filter:
    drop-shadow(3px 4px 3px rgba(0,0,0,0.38))
    drop-shadow(16px 24px 14px rgba(0,0,0,0.22));
  transition: filter 0.35s ease;
}
.shelf__item:hover img {
  filter:
    drop-shadow(4px 6px 4px rgba(0,0,0,0.4))
    drop-shadow(22px 34px 20px rgba(0,0,0,0.28));
}
/* grounding contact shadow, built from two layers: a tight dark core right
   under the object, and a softer wash bleeding out toward the bottom-right
   to match the top-left sun — a single soft ellipse looked flat/weak */
.shelf__item::after {
  content: "";
  position: absolute;
  z-index: 0;
  bottom: -0.4rem;
  left: 50%;
  transform: translateX(-50%);
  width: 78%;
  height: 1.3rem;
  background:
    radial-gradient(ellipse 40% 100% at 38% 50%, rgba(0,0,0,0.5) 0%, transparent 75%),
    radial-gradient(ellipse 55% 100% at 62% 50%, rgba(0,0,0,0.3) 0%, transparent 78%);
  filter: blur(2px);
  transition: width 0.35s ease, height 0.35s ease, opacity 0.35s ease, filter 0.35s ease;
}
.shelf__item:hover::after { width: 88%; height: 1.5rem; opacity: 0.7; filter: blur(3px); }

.shelf__cta {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 5%;
  transform: translateX(-50%);
}

/* detail (single-flavour view) */
.detail {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.detail__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 0%, var(--flavor-a), var(--flavor-b) 70%);
  transition: background 0.6s ease;
  z-index: 0;
}

.detail__carousel { position: absolute; inset: 0; z-index: 1; }
.detail__carousel .splide__track,
.detail__carousel .splide__list,
.detail__carousel .splide__slide {
  height: 100%;
}
.detail__carousel .splide__slide {
  position: relative;
  overflow: hidden;
}

.detail__marquee {
  position: absolute;
  top: 8%;
  left: 0;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
}
.detail__marquee-track {
  display: inline-flex;
  gap: 6rem;
  animation: marquee 18s linear infinite;
}
.detail__marquee-track span {
  font-size: clamp(4rem, 14vw, 11rem);
  font-weight: 800;
  color: var(--flavor-primary);
  opacity: 0.14;
  letter-spacing: 0.01em;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ambient scattered fruit in the background — subtle, spread around, never
   competing with the main cup/fruit for attention */
.detail__scatter {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.detail__scatter .scatter {
  position: absolute;
  opacity: 0.16;
  filter: blur(1.5px);
  animation: float 9s ease-in-out infinite;
}
.detail__scatter .is-a { width: 9rem; top: 8%; left: 6%; transform: rotate(-18deg); animation-delay: -1s; }
.detail__scatter .is-b { width: 6rem; top: 15%; right: 10%; transform: rotate(22deg); animation-delay: -4s; }
.detail__scatter .is-c { width: 7rem; bottom: 20%; left: 12%; transform: rotate(10deg); animation-delay: -2.5s; }
.detail__scatter .is-d { width: 8rem; bottom: 12%; right: 7%; transform: rotate(-12deg); animation-delay: -6s; }

.detail__floats {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
}
.detail__floats img {
  position: absolute;
  animation: float 6s ease-in-out infinite;
}
.detail__floats .is-1 {
  width: min(18rem, 42vw);
  z-index: 3;
  filter: drop-shadow(0 30px 40px rgba(0,0,0,0.25));
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out;
  will-change: transform;
}
/* is-2/is-3's transform + opacity are fully GSAP-driven (see emergeFruits()
   in app.js) — an "emerge from behind the cup" motion needs a one-shot
   entrance followed by a different, continuous idle loop on the same
   transform, and CSS can't express "play once, then hand off to a loop" on
   one property. This is just their pre-JS resting state. */
.detail__floats .is-2 {
  width: min(11rem, 26vw);
  opacity: 0;
  filter: drop-shadow(0 12px 20px rgba(0,0,0,0.15));
  z-index: 2;
}
.detail__floats .is-3 {
  width: min(8rem, 20vw);
  opacity: 0;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,0.12));
  z-index: 1;
}
@keyframes float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -1.25rem; }
}

.detail__carousel .splide__arrow {
  z-index: 4;
  background: rgba(255,255,255,0.8);
  opacity: 1;
}
.detail__carousel .splide__pagination { display: none; }

.detail__info {
  position: absolute;
  z-index: 2;
  left: clamp(1.5rem, 6vw, 5rem);
  top: 50%;
  transform: translateY(-50%);
  max-width: 22rem;
  text-align: left;
  pointer-events: none;
}
/* the bottom progress bar is the only position indicator — Splide's own
   pagination dots are kept mounted (harmless) but hidden, not disabled */
.detail__info .splide__pagination { display: none; }
.detail__text-carousel { margin: 0 0 0.75rem; pointer-events: auto; }
.detail__text-carousel h3 { margin: 0 0 0.5rem; font-size: 1.5rem; color: var(--flavor-primary); transition: color 0.4s ease; }
.detail__text-carousel p {
  margin: 0;
  opacity: 0.65;
  line-height: 1.6;
  font-size: 0.9rem;
  mix-blend-mode: multiply;
}
.detail__price { font-weight: 700; pointer-events: auto; }

.detail__ingredients {
  position: relative;
  z-index: 2;
  margin: auto auto 0;
  max-width: 30rem;
  overflow: hidden;
  max-height: 0;
  text-align: center;
  transition: max-height 0.35s ease;
}
.detail__ingredients p {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  opacity: 0.75;
  padding: 0 1.5rem;
}
.detail__ingredients.is-open { max-height: 6rem; }

.detail__bottom-nav {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem 1.5rem 2rem;
  flex-wrap: wrap;
}
.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 50vw;
  width: 3rem;
  height: 3rem;
  padding: 0;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
.nav-pill svg { width: 1.1rem; height: 1.1rem; flex-shrink: 0; }
.nav-pill:hover { transform: translateY(-2px); background: #fff; }
.nav-pill.is-wide { width: auto; padding: 0 1.5rem; font-weight: 600; }
.nav-pill[aria-expanded="true"] { color: var(--flavor-primary); border-color: var(--flavor-primary); }

.detail__progress {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 0.4rem;
  /* no padding here on purpose: the thumb below is absolutely positioned
     against this element's padding box, so any padding would make its
     percentage-based width/position mismatch the actual track area */
  width: min(20rem, calc(100% - 3rem));
  margin: 0 auto 1.5rem;
  box-sizing: border-box;
}
.detail__progress-track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(0,0,0,0.12);
}
/* a single thumb slides across the tracks to show the current flavour, so
   moving from the 3rd to the 1st flavour visibly travels back across 2 and 1
   rather than jumping straight there. Sized/positioned entirely with CSS
   calc() against the container's own percentage width — not measured with
   JS — so there's no dependency on layout having settled by the time the
   index changes (an earlier getBoundingClientRect()-based version was fragile
   here and easy to get out of sync). JS only ever sets the --i custom
   property to the current flavour's index (0/1/2). */
.detail__progress-thumb {
  /* width and position are set directly in JS (measured from the actual
     track elements and animated with GSAP) rather than via CSS calc(). A
     transform driven by calc(var(...)) turned out to be unreliable to
     transition — browsers don't consistently pick up custom-property changes
     as a proper transition start/end pair, so it would visually land in the
     wrong place or not move at all. Plain JS-measured pixel values sidestep
     that entirely. */
  position: absolute;
  top: 0;
  left: 0;
  height: 4px;
  border-radius: 2px;
  background: var(--flavor-primary);
  transition: background 0.4s ease;
}

@media (max-width: 640px) {
  .detail__floats .is-1 { width: 48vw; }
  .shelf__item img { width: 22vw; }
  .shelf__row { gap: 3vw; }
}

.flip-clone {
  position: fixed;
  z-index: 300;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 30px 40px rgba(0,0,0,0.25));
}

/* shelf/detail overlap during the click-to-open transition */
.shelf.is-transitioning,
.detail.is-transitioning {
  position: fixed;
  inset: 0;
  min-height: 100vh;
}
.shelf.is-transitioning { z-index: 20; }
.detail.is-transitioning { z-index: 10; }

/* how-it's-made modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(43, 42, 40, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal.is-open { opacity: 1; pointer-events: auto; }
.modal__card {
  background: #fff;
  border-radius: 1.5rem;
  padding: 2.5rem;
  max-width: 26rem;
  text-align: center;
  transform: translateY(1rem);
  transition: transform 0.25s ease;
}
.modal.is-open .modal__card { transform: translateY(0); }
.modal__card h2 { margin: 0 0 1rem; }
.modal__card p { opacity: 0.8; line-height: 1.6; margin: 0 0 1.5rem; }

/* floating newsletter card */
.news-card {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 90;
}
.news-card__toggle {
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 50vw;
  padding: 1rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.news-card .is-open-label { display: none; }
.news-card.is-open .is-closed-label { display: none; }
.news-card.is-open .is-open-label { display: inline; }

.news-card__panel {
  position: absolute;
  right: 0;
  bottom: 4.5rem;
  width: 20rem;
  max-width: calc(100vw - 3rem);
  background: #fff;
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.18);
  transform: translateY(1rem) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.news-card.is-open .news-card__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.news-card__title { font-weight: 700; font-size: 1.15rem; margin: 0 0 0.35rem; }
.news-card__subtitle { margin: 0 0 1rem; font-size: 0.9rem; opacity: 0.75; }
.news-card__form { display: flex; gap: 0.5rem; }
.news-card__form input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 50vw;
  padding: 0.6rem 1rem;
  font: inherit;
  min-width: 0;
}
.news-card__note { margin: 0.75rem 0 0; font-size: 0.85rem; font-weight: 600; color: var(--brand-green); }
