/* Touch or mouse focus is retained for accessibility without drawing a ring. */
html.recipe-pointer-focus .recipe-front:focus,
html.recipe-pointer-focus .recipe-flip-back:focus {
  outline: none;
}

html.recipe-pointer-focus .recipe-flip-back:focus {
  box-shadow: none;
}

@font-face {
  font-family: "Smiley Sans";
  src: url("./assets/smiley-sans.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #fbfaf6;
  color: #000;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.page {
  position: relative;
  width: min(100%, 402px);
  min-height: max(874px, 100svh);
  margin: 0 auto;
  overflow: hidden;
  background: #fbfaf6;
}

.hero {
  position: relative;
  height: 207px;
  text-align: center;
  background: #aed1a4;
}

.hero h1 {
  position: absolute;
  z-index: 3;
  top: 37px;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(292px, 100% - 40px);
  height: 87px;
  margin: 0;
  transform: translateX(-50%);
  font-size: 40px;
  font-family: "Smiley Sans", sans-serif;
  font-weight: 400;
  line-height: normal;
  white-space: pre-line;
}

/* Bubbles rise from behind the centre bag and spread across the green area. */
.hero-bubbles {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.bubble-lane {
  display: contents;
}

.bubble {
  position: absolute;
  top: 166px;
  left: 50%;
  width: var(--size);
  height: var(--size);
  border-radius: 48% 52% 51% 49%;
  background: var(--bubble-color);
  opacity: .65;
  animation: bubble-rise var(--duration) ease-out var(--delay) infinite;
  will-change: transform, opacity;
}

.bubble-1 {
  --dx: clamp(-164px, -43vw, -60px);
  --rise: 188px;
  --size: 48px;
  --duration: 9s;
  --delay: -1s;
  --bubble-color: var(--bubble-color-1, #eab2a4);
}

.bubble-2 {
  --dx: clamp(-120px, -31vw, -45px);
  --rise: 210px;
  --size: 38px;
  --duration: 8s;
  --delay: -6s;
  --bubble-color: var(--bubble-color-2, #f2cf9c);
}

.bubble-3 {
  --dx: clamp(-82px, -21vw, -25px);
  --rise: 165px;
  --size: 46px;
  --duration: 11s;
  --delay: -5s;
  --bubble-color: var(--bubble-color-3, #d9b6c4);
}

.bubble-4 {
  --dx: clamp(-158px, -40vw, -58px);
  --rise: 125px;
  --size: 56px;
  --duration: 9s;
  --delay: -3s;
  --bubble-color: var(--bubble-color-4, #dec7a2);
}

.bubble-5 {
  --dx: clamp(-55px, -14vw, -18px);
  --rise: 225px;
  --size: 35px;
  --duration: 7s;
  --delay: -2s;
  --bubble-color: var(--bubble-color-5, #e7b9a4);
}

.bubble-6 {
  --dx: clamp(-140px, -36vw, -50px);
  --rise: 155px;
  --size: 42px;
  --duration: 12s;
  --delay: -9s;
  --bubble-color: var(--bubble-color-6, #e9d49e);
}

.bubble-7 {
  --dx: clamp(60px, 43vw, 164px);
  --rise: 190px;
  --size: 52px;
  --duration: 9s;
  --delay: -7s;
  --bubble-color: var(--bubble-color-7, #c9c9a9);
}

.bubble-8 {
  --dx: clamp(45px, 31vw, 120px);
  --rise: 220px;
  --size: 40px;
  --duration: 11s;
  --delay: -3s;
  --bubble-color: var(--bubble-color-8, #e0b2b9);
}

.bubble-9 {
  --dx: clamp(25px, 21vw, 82px);
  --rise: 160px;
  --size: 58px;
  --duration: 12s;
  --delay: -5s;
  --bubble-color: var(--bubble-color-9, #d8b5c3);
}

.bubble-10 {
  --dx: clamp(58px, 40vw, 158px);
  --rise: 125px;
  --size: 34px;
  --duration: 8s;
  --delay: -1s;
  --bubble-color: var(--bubble-color-10, #efc7a3);
}

.bubble-11 {
  --dx: clamp(18px, 14vw, 55px);
  --rise: 225px;
  --size: 44px;
  --duration: 10s;
  --delay: -9s;
  --bubble-color: var(--bubble-color-11, #d4c3a4);
}

.bubble-12 {
  --dx: clamp(50px, 36vw, 140px);
  --rise: 155px;
  --size: 48px;
  --duration: 9s;
  --delay: -5s;
  --bubble-color: var(--bubble-color-12, #e9b6a0);
}

@keyframes bubble-rise {
  0% {
    transform: translate3d(-50%, -50%, 0) scale(.25);
    opacity: 0;
  }

  16% {
    opacity: .65;
  }

  45% {
    transform: translate3d(calc(-50% + var(--dx)), calc(-50% - 80px), 0) scale(.95);
  }

  78% {
    opacity: .65;
  }

  100% {
    transform: translate3d(calc(-50% + var(--dx)), calc(-50% - var(--rise)), 0) scale(1.05);
    opacity: 0;
  }
}

.hero-bubbles.is-paused .bubble {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .hero-bubbles {
    display: none;
  }
}

.coffee-bag {
  position: absolute;
  z-index: 2;
  top: 139px;
  left: 50%;
  width: 111px;
  height: 107px;
  object-fit: cover;
  transform: translateX(-50%);
}

.recipes {
  position: relative;
  min-height: max(667px, calc(100svh - 207px));
  padding: 129px 24px calc(112px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to bottom, #aed1a4 55px, #fbfaf6 55px);
}

.curve {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 50%;
  max-width: none;
  transform: translateX(-50%);
  pointer-events: none;
}

.recipe-list {
  position: relative;
  z-index: 4;
  width: min(100%, 324px);
  margin: 0 auto;
}

/* The horizontal card remains in place while its foreground copy flips. */
.recipe-card {
  position: relative;
  width: 100%;
  aspect-ratio: 85.6 / 53.98;
  perspective: 1100px;
}

/* Keep the static HTML legible if JavaScript is unavailable. */
.recipe-card.featured-card {
  padding: 18px 20px;
  overflow: hidden;
  border-radius: 24px;
  background: #f4eee3;
  box-shadow: 0 8px 20px rgba(72, 67, 56, 0.13);
}

.recipe-card+.recipe-card {
  margin-top: 31px;
}

.recipe-card:nth-child(3) {
  margin-top: 29px;
}

.recipe-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 560ms cubic-bezier(.2, .7, .2, 1);
}

.recipe-face {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  color: #202a27;
  text-align: left;
  font: inherit;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 8px 20px rgba(72, 67, 56, 0.13);
}

.recipe-front {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 85.6 / 53.98;
  padding: 15px 19px 51px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.recipe-front:focus-visible,
.recipe-flip-back:focus-visible {
  outline: 3px solid #325b3d;
  outline-offset: 3px;
}

.card-title {
  display: block;
  margin-bottom: 3px;
  color: #111827;
  font-size: 15px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.featured-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 5px 8px;
  color: #374151;
  font-size: 12px;
  line-height: 16px;
}

.featured-details span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.featured-details span:nth-child(even) {
  text-align: right;
}

.recipe-description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin-top: 8px;
  color: #374151;
  font-size: 12px;
  line-height: 1.45;
}

/* The backdrop and the moving card sit above the page and fixed menu. */
.recipe-card.is-in-flight {
  visibility: hidden;
}

.recipe-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(28, 43, 33, 0);
  transition: background-color 350ms ease;
}

.recipe-overlay.is-visible {
  background: rgba(28, 43, 33, .23);
}

.recipe-flight {
  position: fixed;
  perspective: 1100px;
  transition: left 1100ms cubic-bezier(.45, 0, .2, 1), top 1100ms cubic-bezier(.45, 0, .2, 1);
}

.recipe-flight-spin {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateZ(0deg) scale(var(--flight-return-scale, 1));
  transition: transform 1100ms cubic-bezier(.45, 0, .2, 1);
}

.recipe-flight.is-flipped .recipe-flight-spin {
  transform: rotateZ(90deg) scale(var(--flight-scale, 1));
}

.recipe-flight-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1100ms cubic-bezier(.45, 0, .2, 1);
}

.recipe-flight.is-flipped .recipe-flight-inner {
  transform: rotateY(180deg);
}

.recipe-flight.is-returning,
.recipe-flight.is-returning .recipe-flight-spin,
.recipe-flight.is-returning .recipe-flight-inner {
  transition-duration: 950ms;
}

.recipe-flight .recipe-face {
  height: 100%;
}

.recipe-flight .recipe-front {
  aspect-ratio: auto;
}

/* The face remains the original horizontal rectangle.  Its content is
   counter-rotated so that the turned card reads upright in portrait. */
.recipe-back {
  transform: rotateY(180deg);
  color: #283d30;
}

.recipe-flight .recipe-back {
  overflow: hidden;
  cursor: pointer;
}

.recipe-back-content {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--card-height);
  height: var(--card-width);
  padding: 15px 14px;
  transform: translate(-50%, -50%) rotate(-90deg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #283d30;
  font-size: 10px;
  line-height: 1.4;
}

.recipe-back-title {
  margin: 0 0 9px;
  color: #1f2e25;
  font-size: 15px;
  line-height: 1.25;
}

.recipe-flip-back {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}

.recipe-flip-back:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px #325b3d;
}

.brew-steps-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.brew-steps-list li {
  padding: 6px 0;
  border-top: 1px solid rgba(54, 82, 63, .18);
}

.brew-step-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #42664c;
  font-size: 10px;
  font-weight: 600;
}

.brew-step-head strong {
  color: #334e3c;
  font-size: 10px;
}

.brew-steps-list p {
  margin: 4px 0 0;
  color: #394940;
  line-height: 1.4;
}

.recipe-empty-steps {
  margin: 4px 0 0;
  color: #394940;
}

.recipe-flip-hint {
  flex: 0 0 auto;
  margin: 8px 0 0;
  color: #5c6f5f;
  font-size: 9px;
  line-height: 1.4;
  text-align: center;
}

@media (max-height: 440px) {
  .recipe-back-content {
    font-size: 13px;
    line-height: 1.45;
  }

  .recipe-back-title {
    font-size: 17px;
  }

  .brew-step-head,
  .brew-step-head strong {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {

  .recipe-card-inner,
  .recipe-overlay,
  .recipe-flight,
  .recipe-flight-spin,
  .recipe-flight-inner {
    transition: none;
  }
}

@media (max-width: 340px) {
  .hero h1 {
    font-size: 34px;
  }
}

@media (min-width: 600px) {
  body {
    background: #dce7d7;
  }

  .page {
    box-shadow: 0 0 50px rgb(39 69 37 / 8%);
  }
}

.recipe-empty-list {
  margin: 20px 0 0;
  color: #69756d;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.recipe-like {
  position: absolute;
  right: 14px;
  bottom: 9px;
  z-index: 2;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 7px;
  max-width: calc(100% - 28px);
  cursor: default;
}

.recipe-flight .recipe-like {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(1px);
}

.recipe-like-button {
  flex: 0 0 auto;
  min-height: 36px;
  border: 0;
  padding: 5px 12px;
  background: transparent;
  color: #385540;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
}

.recipe-like-button.is-liked {
  color: #8f4b4b;
}

.recipe-like-button:disabled {
  cursor: wait;
  opacity: .7;
}

.recipe-like-button:focus-visible {
  outline: 2px solid #325b3d;
  outline-offset: 2px;
}

.recipe-like-status {
  color: #8d3e39;
  font-size: 9px;
  text-align: right;
  line-height: 1.3;
}