/* ============================================================
   toutsweet: — Premium Effects Styles
   Typewriter, Glassmorphism, Chocolate Melt, Depth Enhancement
   ============================================================ */

/* ============================================================
   TYPEWRITER EFFECT
   ============================================================ */

.typewriter-active {
  display: inline-flex;
  align-items: baseline;
}

.typewriter-char {
  display: inline-block;
  animation: typeCharIn 0.08s ease-out forwards;
}

@keyframes typeCharIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.typewriter-cursor {
  display: inline-block;
  font-weight: 300;
  color: var(--caramel);
  animation: cursorBlink 0.7s ease-in-out infinite;
  margin-left: 2px;
}

.typewriter-cursor--done {
  animation: cursorFadeOut 2s ease forwards;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes cursorFadeOut {
  0% { opacity: 1; }
  60% { opacity: 1; }
  100% { opacity: 0; }
}


/* ============================================================
   GLASSMORPHISM — Frosted glass effect
   ============================================================ */

/* Glass card — menu items, process steps, delivery info */
.glass-card {
  background: rgba(253, 251, 248, 0.55) !important;
  border: 1px solid rgba(232, 221, 208, 0.45) !important;
  transition: background var(--duration-normal),
              border-color var(--duration-normal),
              box-shadow var(--duration-normal) var(--ease-out),
              backdrop-filter var(--duration-normal);
}

@supports (backdrop-filter: blur(1px)) {
  .glass-card {
    backdrop-filter: blur(12px) saturate(1.3);
    -webkit-backdrop-filter: blur(12px) saturate(1.3);
  }
}

.glass-card:hover {
  background: rgba(253, 251, 248, 0.72) !important;
  border-color: rgba(196, 149, 106, 0.3) !important;
  box-shadow: 0 8px 32px rgba(60, 36, 21, 0.08),
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Glass header — activates on scroll past hero */
.glass-header {
  background: rgba(245, 237, 228, 0.65) !important;
  border-bottom: 1px solid rgba(232, 221, 208, 0.3);
}

@supports (backdrop-filter: blur(1px)) {
  .glass-header {
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
  }
}

/* Glass panel — cart drawer */
.glass-panel {
  background: rgba(253, 251, 248, 0.85) !important;
}

@supports (backdrop-filter: blur(1px)) {
  .glass-panel {
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
  }
}

/* Featured product cards — glassmorphism variant */
.product-card {
  background: rgba(253, 251, 248, 0.65);
  border: 1px solid rgba(232, 221, 208, 0.35);
  position: relative;
}

@supports (backdrop-filter: blur(1px)) {
  .product-card {
    backdrop-filter: blur(10px) saturate(1.2);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
  }
}

.product-card:hover {
  background: rgba(253, 251, 248, 0.82);
  border-color: rgba(196, 149, 106, 0.25);
}

/* Glowing separator for glassmorphism feel */
.section-divider {
  background: linear-gradient(
    to right,
    transparent,
    rgba(196, 149, 106, 0.15) 20%,
    rgba(196, 149, 106, 0.25) 50%,
    rgba(196, 149, 106, 0.15) 80%,
    transparent
  );
}


/* ============================================================
   CHOCOLATE MELT HOVER EFFECT — Pure CSS Melted Chocolate Border
   Thick, glossy chocolate wraps around the card on hover.
   ============================================================ */

/* Cards need positioning context and must not clip the frame */
.product-card,
.menu-item:not(.menu-item--flavor-list) {
  position: relative;
  overflow: visible;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Card content sits above the chocolate */
.product-card__image,
.menu-item__image {
  position: relative;
  z-index: 2;
  background: var(--latte, #F5EDE4);
  border-radius: var(--card-radius, 4px) var(--card-radius, 4px) 0 0;
  overflow: hidden;
}

.product-card__body,
.menu-item__info {
  position: relative;
  z-index: 2;
  background: var(--milk, #FDFBF8);
}

.product-card__footer {
  position: relative;
  z-index: 2;
  background: var(--milk, #FDFBF8);
  border-radius: 0 0 var(--card-radius, 4px) var(--card-radius, 4px);
}

/* ---- CHOCOLATE BORDER — thick melted frame ---- */
.choco-border {
  position: absolute;
  inset: -10px;
  border-radius: 8px;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  /* Thick chocolate border using box-shadow layers */
  background: transparent;
  box-shadow:
    /* Outer thick chocolate border */
    inset 0 0 0 10px #3C2415,
    inset 0 0 0 12px #5C3D2E,
    /* Glossy highlight on the chocolate */
    inset 0 2px 0 10px rgba(120, 80, 50, 0.4),
    inset 0 -1px 0 10px rgba(30, 15, 5, 0.3),
    /* Outer glow */
    0 0 20px rgba(60, 36, 21, 0.15),
    0 8px 30px rgba(60, 36, 21, 0.12);
}

/* Inner highlight to simulate glossy chocolate surface */
.choco-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  border: 10px solid transparent;
  background: linear-gradient(
    170deg,
    rgba(140, 95, 60, 0.5) 0%,
    rgba(92, 61, 46, 0.8) 15%,
    #3C2415 30%,
    #2a1a0e 50%,
    #3C2415 70%,
    rgba(92, 61, 46, 0.8) 85%,
    rgba(140, 95, 60, 0.4) 100%
  ) border-box;
  -webkit-mask:
    linear-gradient(#fff 0 0) padding-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) padding-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* Show on hover */
.chocolate-hover .choco-border {
  opacity: 1;
  transform: scale(1);
}

/* ---- CHOCOLATE DRIPS — hang from the top edge ---- */
.choco-drip {
  position: absolute;
  top: -10px;
  background: linear-gradient(180deg,
    #3C2415 0%,
    #4a2c1a 40%,
    #5C3D2E 70%,
    #3C2415 100%
  );
  border-radius: 0 0 50% 50%;
  z-index: 1;
  transform-origin: top center;
  transform: scaleY(0);
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease;
  /* Glossy highlight */
  box-shadow:
    inset 2px 0 0 rgba(140, 95, 60, 0.3),
    inset -1px 0 0 rgba(20, 10, 5, 0.4),
    1px 2px 4px rgba(60, 36, 21, 0.3);
}

.chocolate-hover .choco-drip {
  transform: scaleY(1);
  opacity: 1;
}

/* Stagger drip animations */
.choco-drip:nth-child(1) { transition-delay: 0.1s; }
.choco-drip:nth-child(2) { transition-delay: 0.2s; }
.choco-drip:nth-child(3) { transition-delay: 0.3s; }
.choco-drip:nth-child(4) { transition-delay: 0.15s; }
.choco-drip:nth-child(5) { transition-delay: 0.25s; }

/* ---- CHOCOLATE SPLASH — bottom-right accent ---- */
.choco-splash {
  position: absolute;
  bottom: -16px;
  right: -8px;
  width: 40px;
  height: 20px;
  z-index: 1;
  opacity: 0;
  transform: scale(0.5) rotate(-15deg);
  transition: opacity 0.4s ease 0.3s,
              transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s;
}

.choco-splash::before,
.choco-splash::after {
  content: '';
  position: absolute;
  background: #3C2415;
  border-radius: 50%;
}

.choco-splash::before {
  width: 16px;
  height: 8px;
  top: 0;
  left: 0;
  box-shadow: 12px 4px 0 -1px #3C2415, 24px -2px 0 -2px #5C3D2E;
}

.choco-splash::after {
  width: 10px;
  height: 5px;
  bottom: 0;
  right: 4px;
  box-shadow: -14px 2px 0 -1px #3C2415;
}

.chocolate-hover .choco-splash {
  opacity: 1;
  transform: scale(1) rotate(-15deg);
}

/* ---- WARM GLOW on the image ---- */
.choco-warmth {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(92, 61, 46, 0) 0%,
    rgba(92, 61, 46, 0.03) 40%,
    rgba(60, 36, 21, 0.07) 80%,
    rgba(60, 36, 21, 0.12) 100%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 3;
  border-radius: inherit;
}

.chocolate-hover .choco-warmth {
  opacity: 1;
}

/* ---- Image treatment on hover ---- */
.chocolate-hover .product-card__image img,
.chocolate-hover .menu-item__image img {
  filter: saturate(1.05) brightness(0.97);
  transform: scale(1.02);
}

/* Card lift + shadow */
.chocolate-hover.product-card,
.chocolate-hover.menu-item {
  transform: translateY(-4px);
  box-shadow:
    0 16px 48px rgba(60, 36, 21, 0.12),
    0 6px 16px rgba(92, 61, 46, 0.06);
}

/* Smooth image transitions */
.product-card__image img,
.menu-item__image img {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.5s ease;
  will-change: transform, filter;
}


/* ============================================================
   DEPTH ENHANCEMENT — 3D depth cues
   ============================================================ */

/* Hero depth layering */
.hero {
  perspective: 1200px;
  overflow: hidden;
}

.hero__logo {
  transform-style: preserve-3d;
  text-shadow:
    0 1px 0 rgba(60, 36, 21, 0.05),
    0 2px 4px rgba(60, 36, 21, 0.03),
    0 4px 12px rgba(60, 36, 21, 0.02);
}

/* Story image depth shadow */
.story__image-wrap {
  position: relative;
}

.story__image-wrap::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 8%;
  width: 84%;
  height: 20px;
  background: radial-gradient(
    ellipse at center,
    rgba(60, 36, 21, 0.12) 0%,
    transparent 70%
  );
  border-radius: 50%;
  filter: blur(8px);
  z-index: -1;
}

/* Product card depth shadow — handled by chocolate melt backdrop */

/* Featured section — subtle depth gradient */
.featured {
  position: relative;
}

.featured::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(
    to bottom,
    rgba(245, 237, 228, 0.6),
    transparent
  );
  pointer-events: none;
  z-index: 1;
}


/* ============================================================
   REDUCED MOTION — Disable animated effects
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .typewriter-char {
    animation: none;
    opacity: 1;
  }

  .typewriter-cursor {
    animation: none;
    display: none;
  }

  .choco-border,
  .choco-drip,
  .choco-splash,
  .choco-warmth {
    display: none;
  }

  .glass-card,
  .glass-header,
  .glass-panel {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
