/* Milk pie recipe page (works with pie.css) */

.pie-recipe-sections {
  margin: 2rem auto 0;
  width: fit-content;
  max-width: 100%;
}

.pie-recipe-section + .pie-recipe-section {
  margin-top: 2rem;
}

.pie-recipe-section h2 {
  margin: 0 0 1rem;
  text-align: left;
}

.pie-recipe-section ul {
  margin: 0;
  padding-left: 0;
  list-style-position: inside;
}

.pie-recipe-section li + li {
  margin-top: 0.5rem;
}

.pie-recipe-section .pie-recipe-link {
  margin-top: 1.25rem;
}

.pie-milk-progress {
  margin: 0 0 1rem;
  text-align: center;
  font-size: 0.9rem;
  font-family: system-ui, sans-serif;
  opacity: 0.75;
}

.pie-milk-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.pie-milk-nav {
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  cursor: pointer;
  line-height: 1;
  transition: transform 0.2s ease;
}

.pie-milk-nav:hover {
  transform: scale(1.12);
}

.pie-milk-nav:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
  border-radius: 4px;
}

.pie-milk-nav-big {
  display: block;
  font-size: 4.5rem;
}

@media (width <= 480px) {
  .pie-milk-nav-big {
    font-size: 4.25rem;
  }
}

/* "Got Pie?" milk mustache finale */

.pie-milk-show {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10000;
  overflow: hidden;
  background: rgb(10 10 16 / 78%);
  transition: opacity 0.3s ease;
  animation: pie-milk-show-in 0.3s ease-out both;
}

.pie-milk-show.is-fading {
  opacity: 0;
}

@keyframes pie-milk-show-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Act 1: the gulp */

.pie-milk-glass {
  position: absolute;
  left: 50%;
  top: 40%;
  font-size: 7rem;
  line-height: 1;
  filter: drop-shadow(0 6px 14px rgb(0 0 0 / 40%));
  transform-origin: 50% 85%;
  animation: pie-milk-glass-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both,
    pie-milk-gulp 0.7s ease-in-out 0.45s 2,
    pie-milk-glass-out 0.4s ease-in 1.85s both;
}

@keyframes pie-milk-glass-in {
  from {
    transform: translate(-50%, -50%) scale(0);
  }

  to {
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes pie-milk-gulp {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  40% {
    transform: translate(-50%, -54%) rotate(-32deg);
  }

  60% {
    transform: translate(-50%, -54%) rotate(-26deg);
  }
}

@keyframes pie-milk-glass-out {
  from {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  to {
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0;
  }
}

/* Act 2: the milk mustache reveal */

.pie-milk-face {
  position: absolute;
  left: 50%;
  top: 40%;
  font-size: 9rem;
  line-height: 1;
  animation: pie-milk-face-pop 0.55s cubic-bezier(0.22, 1, 0.36, 1) 2.3s both;
}

.pie-milk-face-glyph {
  display: block;
  filter: drop-shadow(0 6px 16px rgb(0 0 0 / 45%));
}

@keyframes pie-milk-face-pop {
  0% {
    transform: translate(-50%, -50%) scale(0);
  }

  70% {
    transform: translate(-50%, -50%) scale(1.1);
  }

  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

.pie-milk-mustache {
  position: absolute;
  left: 50%;
  top: 0.62em;
  width: 0.56em;
  height: 0.26em;

  /* Transparent box with a thick white top border renders as a curved arc */
  background: transparent;
  border-top: 0.09em solid #fff;
  border-radius: 50%;
  filter: drop-shadow(0 2px 4px rgb(0 0 0 / 25%));
  transform-origin: 50% 50%;
  animation: pie-milk-mustache-swipe 0.45s cubic-bezier(0.22, 1, 0.36, 1) 2.85s both;
}

@keyframes pie-milk-mustache-swipe {
  from {
    transform: translateX(-50%) rotate(-3deg) scaleX(0);
  }

  to {
    transform: translateX(-50%) rotate(-3deg) scaleX(1);
  }
}

/* Act 3: the tagline */

.pie-milk-tagline {
  position: absolute;
  left: 50%;
  top: 40%;
  margin-top: 6.5rem;
  transform: translateX(-50%);
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 700;
  font-size: 3.5rem;
  letter-spacing: 0.02em;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 3px 12px rgb(0 0 0 / 50%);
  animation: pie-milk-tagline-in 0.6s ease-out 3.3s both;
}

@keyframes pie-milk-tagline-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Milk splash droplets */

.pie-milk-droplet {
  position: absolute;
  left: 50%;
  top: 40%;
  width: var(--drop-size, 10px);
  height: var(--drop-size, 10px);
  background: #fff;
  border-radius: 50% 50% 50% 10%;
  animation: pie-milk-droplet-fly var(--drop-duration, 1s) ease-out both;
}

@keyframes pie-milk-droplet-fly {
  from {
    transform: translate(0, 0) scale(1) rotate(0deg);
    opacity: 0.95;
  }

  to {
    transform: translate(var(--drop-dx, 0), var(--drop-dy, 0)) scale(0.3) rotate(180deg);
    opacity: 0;
  }
}

@media (width <= 480px) {
  .pie-milk-glass {
    font-size: 5.5rem;
  }

  .pie-milk-face {
    font-size: 7rem;
  }

  .pie-milk-tagline {
    margin-top: 5.25rem;
    font-size: 2.5rem;
  }
}

/* Reduced motion: skip the theatrics, show the settled mustache + tagline */
@media (prefers-reduced-motion: reduce) {
  .pie-milk-show,
  .pie-milk-face,
  .pie-milk-mustache,
  .pie-milk-tagline {
    animation: none;
  }

  .pie-milk-mustache {
    transform: translateX(-50%) rotate(-3deg);
  }

  .pie-milk-tagline {
    transform: translateX(-50%);
  }
}
