:root {
  --paper: #EDECE7;
  --ink: #24211D;
  --muted: #5E5A53;
  --cinnabar: #9E3324;
  --seal-text: #F1E9E2;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Shippori Mincho", "Hiragino Mincho ProN", "Songti SC", Georgia, serif;
}

.sheet {
  position: relative;
  overflow-x: clip;
  background: var(--paper);
}

.menu {
  position: relative;
  max-width: 440px;
  margin: 0 auto;
  padding: calc(96px + env(safe-area-inset-top, 0px)) 36px 0;
}

/* Plum branch stencil, pinned to the top-right corner of the page */
.branch {
  position: absolute;
  top: 0;
  right: 0;
  width: max(390px, 34vw);
  max-width: 100%;
  height: auto;
  overflow: visible;
  pointer-events: none;
}

/* Loose petals only appear once scrolling starts shedding them */
.petal {
  opacity: 0;
}

.masthead {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 80px;
}

.masthead p {
  margin: 0;
}

.hosts {
  font-size: 15px;
  color: var(--cinnabar);
}

.masthead h1 {
  margin: 0;
  font-size: 46px;
  font-weight: 600;
  line-height: 1.05;
}

.masthead hr {
  width: 40px;
  height: 2px;
  margin: 8px 0 0;
  border: 0;
  background: var(--cinnabar);
}

.date {
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted);
}

.course {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.course + .course {
  margin-top: 64px;
}

.course-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.seal {
  width: 26px;
  height: 26px;
  background: var(--cinnabar);
  color: var(--seal-text);
  font-size: 15px;
  font-weight: 600;
  line-height: 26px;
  text-align: center;
}

.dish {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 18px;
  align-items: start;
}

.native {
  writing-mode: vertical-rl;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--cinnabar);
}

/* Shippori Mincho has no Thai; use a serif that matches it */
.native:lang(th) {
  font-family: "Noto Serif Thai", "Shippori Mincho", serif;
  letter-spacing: 0.05em;
}

.dish h3 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
}

.dish p {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

/* Sun and mountain stencil closing out the page, full window width. The
   ridges sink into bands of mist and fade to paper, so the page ends on
   paper and a bounce past the bottom shows more of it.
   Phones get the 390-wide drawing; wider screens get a longer range. */
.mountains {
  display: block;
  width: 100%;
  margin-top: 0;
  /* Risen peaks may reach up behind the last course; the menu sits on top */
  overflow: visible;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Motion. On load the plum blossoms open one by one. Scrolling away from the
   top sheds them: each closes back towards a bud as its petals drift down,
   and the branch lags behind the text; scrolling back up reverses it all.
   As the mountains come in, the sun rises behind them and the mist bands
   slide in from the nearest side. Reduced motion gets the still page;
   browsers without scroll timelines get the bloom and then a still page. */
@media (prefers-reduced-motion: no-preference) {
  .bloom {
    transform-box: fill-box;
    transform-origin: center;
    animation: bloom 2.1s cubic-bezier(0.3, 1.6, 0.5, 1) var(--delay, 0s) both;
  }

  @keyframes bloom {
    from {
      transform: scale(0);
    }
  }

  @supports (animation-timeline: scroll()) {
    .shed {
      transform-box: fill-box;
      transform-origin: center;
      animation: shed linear both;
      animation-timeline: scroll(nearest);
      animation-range: 0 500px;
    }

    @keyframes shed {
      to {
        transform: scale(0.35) rotate(-20deg);
      }
    }

    .petal {
      transform-box: fill-box;
      transform-origin: center;
      animation: petal-fall linear both;
      animation-timeline: scroll(nearest);
      animation-range: 0 500px;
    }

    @keyframes petal-fall {
      0% {
        opacity: 0;
        transform: none;
      }

      5% {
        opacity: 0.95;
      }

      80% {
        opacity: 0.8;
      }

      100% {
        opacity: 0;
        transform: translate(var(--dx), var(--dy)) rotate(var(--spin));
      }
    }

    .branch {
      animation: branch-drift linear both;
      animation-timeline: scroll(nearest);
      animation-range: 0 600px;
    }

    @keyframes branch-drift {
      to {
        transform: translateY(338px);
      }
    }

    .mountains {
      view-timeline-name: --mountains;
    }

    .sun {
      animation: sunrise ease-out both;
      animation-timeline: --mountains;
      animation-range: entry 0% entry 100%;
    }

    @keyframes sunrise {
      from {
        transform: translateY(300px);
      }

      to {
        transform: translateY(-60px);
      }
    }

    /* The ridges rise too, slower than the sun, ending a little above their
       resting place so the tallest peaks reach up behind the last course */
    .range {
      --rise-to: -90px;
      animation: range-rise ease-out both;
      animation-timeline: --mountains;
      animation-range: entry 0% entry 100%;
    }

    /* The wide range has no valley wide enough to show the sun once risen */
    .mountains--wide .range {
      --rise-to: 0px;
    }

    @keyframes range-rise {
      from {
        transform: translateY(100px);
      }

      to {
        transform: translateY(var(--rise-to));
      }
    }

    .mist {
      animation: mist-in ease-out both;
      animation-timeline: --mountains;
      animation-range: entry 0% entry 100%;
    }

    /* Far enough out that each band starts fully off-screen */
    .mist--l {
      --mist-from: -360px;
    }

    .mist--r {
      --mist-from: 360px;
    }

    .mountains--wide .mist--l {
      --mist-from: -820px;
    }

    .mountains--wide .mist--r {
      --mist-from: 820px;
    }

    @keyframes mist-in {
      from {
        transform: translateX(var(--mist-from));
      }
    }
  }
}

.mountains--narrow {
  height: auto;
}

.mountains--wide {
  display: none;
  height: clamp(471px, 45.8vw, 680px);
}

@media (min-width: 700px) {
  .mountains--narrow {
    display: none;
  }

  .mountains--wide {
    display: block;
  }

  .menu {
    max-width: 520px;
    padding-top: 128px;
  }

  .hosts {
    font-size: 17px;
  }

  .masthead h1 {
    font-size: 60px;
  }

  .date {
    font-size: 15px;
  }

  .course-label {
    font-size: 14px;
  }

  .native {
    font-size: 19px;
  }

  .dish h3 {
    font-size: 24px;
  }

  .dish p {
    font-size: 14px;
  }

  .mountains {
    margin-top: 16px;
  }
}
