/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/*
 * Homepage hero
 *
 * Keep the navigation and artwork in normal layout flow. The illustration is
 * bounded by the space left below the header, so it cannot slide underneath
 * the controls on short landscape screens.
 */
.home-page,
.home-hero {
  min-block-size: 100svh;
}

.home-hero {
  display: flex;
  flex-direction: column;
  block-size: 100svh;
  inline-size: 100%;
  overflow: hidden;
}

@supports (height: 100dvh) {
  .home-page,
  .home-hero {
    min-block-size: 100dvh;
  }

  .home-hero {
    block-size: 100dvh;
  }
}

/* With photographs the page is an album and runs as long as they do. */
.home-hero.is-album {
  block-size: auto;
  overflow: visible;
}

/* One column down the middle, like the album under it: the mark, the places
   to go, ordering and language, then the hours. */
/* The plants of the sign over the door, taken apart leaf by leaf and
   scattered at random (leaf-pattern.svg): a wallpaper faint enough to be felt
   more than seen, behind the public pages — not the menu, which is read
   fast, often in the sun off a table's QR code, and stays plain. The tile is
   large and has no order in it, so the eye finds no repeat. The bars and
   cards on top keep their own white. */
.leaf-paper {
  background-image: url("/assets/leaf-pattern-d8cf66b2.svg");
  background-size: 40rem;
}

.home-header {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
  inline-size: min(calc(100% - 1.5rem), 42rem);
  margin-inline: auto;
  padding-block: max(clamp(1.5rem, 5vh, 2.75rem), env(safe-area-inset-top), 2.75rem) 0.25rem;
}

.home-wordmark {
  position: relative;
  display: block;
  margin: 0 0 0.5rem;
  line-height: 0;
}

.home-wordmark .wordmark {
  inline-size: clamp(8.5rem, 14vw, 10.5rem);
}

/* The wordmark, wherever it is, and the one thing that moves between the
   homepage and the menu: Turbo runs the visit as a view transition (the
   view-transition meta in the layout), and the mark slides from the middle
   of the homepage into the corner of the menu's bar and back. */
.wordmark {
  display: block;
  block-size: auto;
  view-transition-name: wordmark;
}

::view-transition-group(wordmark) {
  animation-duration: 380ms;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 220ms;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

.home-nav {
  white-space: nowrap;
}

/* tr | en in the header's top right corner, clear of the wordmark: the
   header's top padding leaves it room above the mark, however large the
   text is set. */
.home-language {
  position: absolute;
  inset-block-start: max(0.5rem, env(safe-area-inset-top));
  inset-inline-end: 0;
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.home-nav a,
.home-language button {
  display: inline-flex;
  min-block-size: 2.75rem;
  align-items: center;
  justify-content: center;
}

.home-nav a,
.home-language button {
  min-inline-size: 2.75rem;
}

/* Call and WhatsApp: a glyph each, a finger's width to tap. Solid ink
   rather than a tint, since WhatsApp's mark is only to be shown in its own
   green, black or white. */
.home-contact {
  display: inline-flex;
  gap: 0.35rem;
  min-block-size: 2.75rem;
  min-inline-size: 2.25rem;
  align-items: center;
  justify-content: center;
  color: var(--color-ink);
  font-weight: 600;
  text-decoration: none;
  transition: color 150ms;
}

/* A line of their own, under the hours, on every screen. The links stand a
   finger tall; the line keeps close to the hours all the same. */
.home-intro .home-intro-contact {
  display: flex;
  flex-basis: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  margin-block: -6px -10px;
}

/* The number is for a wide screen, where nobody calls by tapping. */
.home-contact-number {
  display: none;
}

@media (min-width: 48rem) {
  .home-contact-number {
    display: inline;
  }

  /* With words beside two of the glyphs, each link needs air of its own. */
  .home-intro .home-intro-contact {
    gap: 1rem;
  }
}

.home-contact:hover {
  color: var(--color-forest);
}

/* A whole number of pixels, and free to paint past its own box: set at
   16.8px on a fractional line, a glyph's softened edge fell half a pixel
   outside the box and was clipped, and Instagram's heavy frame read as cut
   off along the bottom. */
.home-contact svg {
  flex: none;
  inline-size: 18px;
  block-size: 18px;
  overflow: visible;
  fill: currentColor;
}

.home-showcase {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-block-size: 0;
  inline-size: min(calc(100% - 3rem), 80rem);
  margin: 0 auto clamp(1rem, 2.5vh, 1.75rem);
}

.is-album .home-showcase {
  flex: none;
  gap: clamp(1rem, 3vh, 1.75rem);
}

.home-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  column-gap: 0.85rem;
  row-gap: 0.3rem;
  color: #51605a;
  font-size: clamp(0.75rem, 0.9vw, 0.82rem);
  font-weight: 500;
  line-height: 1.35;
}

.home-intro p {
  margin: 0;
  white-space: nowrap;
}

/* Days with different hours make a line each, which may not all fit across a
   phone: they wrap between lines first, and a line too long on its own wraps
   inside rather than run off the screen. */
.home-intro .home-intro-hours {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.85rem;
  row-gap: 0.3rem;
  white-space: normal;
  color: #20302a;
  font-weight: 650;
}

.home-now {
  color: #2f6a52;
  font-weight: 650;
}

.home-now::before {
  display: inline-block;
  block-size: 0.45rem;
  inline-size: 0.45rem;
  margin-inline-end: 0.4rem;
  border-radius: 999px;
  background: #3f805f;
  box-shadow: 0 0 0 0 rgb(63 128 95 / 28%);
  content: "";
  vertical-align: 0.05em;
  animation: home-open-pulse 2.4s ease-out infinite;
}

.home-now.is-closed {
  color: #51605a;
}

.home-now.is-closed::before {
  background: #a8b0ac;
  animation: none;
}

@keyframes home-open-pulse {
  45%,
  100% {
    box-shadow: 0 0 0 0.35rem rgb(63 128 95 / 0%);
  }
}

.home-illustration {
  display: flex;
  flex: 1 1 auto;
  align-items: flex-end;
  justify-content: center;
  min-block-size: 0;
  overflow: hidden;
  padding-block-start: clamp(0.5rem, 2vh, 1.25rem);
}

.home-illustration img {
  block-size: auto;
  inline-size: auto;
  max-block-size: 100%;
  max-inline-size: min(88vw, 53.75rem);
  object-fit: contain;
}

/*
 * Homepage album
 *
 * One narrow column of photographs, each at its own shape, so a poster keeps
 * its date and a landscape keeps its edges. The shape comes from --ratio
 * (width over height), set from the upload's own measurements: the space is
 * held before the photograph arrives, so the page doesn't jump as it scrolls.
 * A tall one is held under most of the screen's height, narrowing to keep its
 * shape, so it can be seen whole.
 */
.home-album {
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 7vh, 4.5rem);
  inline-size: min(100%, 42rem);
  margin: 0 auto;
  padding: 0 0 clamp(3rem, 10vh, 6rem);
  list-style: none;
}

.home-album figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
}

.home-album picture {
  display: contents;
}

.home-album img {
  display: block;
  aspect-ratio: var(--ratio, auto);
  inline-size: min(100%, calc(85svh * var(--ratio, 100)));
  block-size: auto;
  border-radius: clamp(1rem, 1.6vw, 1.5rem);
  background: #f6f4ef;
}

.home-album figcaption {
  max-inline-size: 32rem;
  color: #51605a;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .home-now::before {
    animation: none;
  }
}

@media (max-width: 55rem) {
  .home-nav {
    gap: 0.5rem;
  }

  .home-language {
    gap: 0;
  }

  .home-nav a {
    font-size: 0.875rem;
    letter-spacing: 0.075em;
  }
}

@media (max-width: 30rem) {
  .home-showcase {
    inline-size: calc(100% - 1.5rem);
    margin-block-end: 0.5rem;
  }

  .home-illustration img {
    max-inline-size: 100vw;
  }

  .home-album {
    gap: 2.5rem;
  }

  .home-album img {
    border-radius: 1rem;
  }
}

/*
 * The cake at the foot of the menu (pages/_cake_orders). Each flame grows up
 * out of its wick as the section scrolls into view, the three a beat apart,
 * then keeps flickering; a spark drifts up off each now and then. Tied to
 * scrolling where the browser can (animation-timeline: view()); elsewhere the
 * candles are just lit.
 */
.cake-fire,
.cake-flame,
.cake-glow,
.cake-spark {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.cake-flame {
  animation: cake-flicker 1.3s ease-in-out infinite alternate;
}

.cake-fire:nth-of-type(2) .cake-flame {
  animation-duration: 1.1s;
  animation-delay: -0.4s;
}

.cake-fire:nth-of-type(3) .cake-flame {
  animation-duration: 1.5s;
  animation-delay: -0.8s;
}

.cake-glow {
  transform-origin: 50% 50%;
  animation: cake-glow 1.3s ease-in-out infinite alternate;
}

.cake-spark {
  opacity: 0;
  animation: cake-spark 2.6s ease-out infinite;
}

.cake-fire:nth-of-type(2) .cake-spark {
  animation-delay: 0.9s;
}

.cake-fire:nth-of-type(3) .cake-spark {
  animation-delay: 1.7s;
}

/* Timed by the section coming up into view rather than by the candles: it
   sits at the very foot of the page, so it may never get far up the screen,
   and the last candle has to be lit by the time it's all in sight. */
@supports (animation-timeline: view()) {
  .cake-orders {
    view-timeline-name: --cake;
  }

  .cake-fire {
    animation: cake-ignite linear both;
    animation-timeline: --cake;
    animation-range: entry 15% entry 55%;
  }

  .cake-fire:nth-of-type(2) {
    animation-range: entry 35% entry 75%;
  }

  .cake-fire:nth-of-type(3) {
    animation-range: entry 55% entry 95%;
  }
}

@keyframes cake-ignite {
  from {
    opacity: 0;
    transform: translateY(0.4rem) scale(0.2, 0);
  }

  60% {
    opacity: 1;
    transform: translateY(-0.15rem) scale(1.05, 1.15);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes cake-flicker {
  0% {
    transform: scale(1, 1) rotate(-3deg);
  }

  50% {
    transform: scale(0.9, 1.1) rotate(2deg);
  }

  100% {
    transform: scale(1.05, 0.94) rotate(-1deg);
  }
}

@keyframes cake-glow {
  from {
    opacity: 0.15;
    transform: scale(0.9);
  }

  to {
    opacity: 0.35;
    transform: scale(1.1);
  }
}

@keyframes cake-spark {
  0% {
    opacity: 0;
    transform: translateY(0);
  }

  15% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(0.15rem, -1.4rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cake-fire,
  .cake-flame,
  .cake-glow,
  .cake-spark {
    animation: none;
  }
}

/* The wordmark, small, in the menu's bar: the way back to the homepage. */
.menu-wordmark .wordmark {
  inline-size: 4.75rem;
}

/*
 * A dish opened over the menu (dish_controller.js). It rises from the bottom
 * on a phone and settles in the middle on a wide screen, over a dimmed list.
 */
.dish-sheet[open] {
  animation: dish-rise 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dish-sheet[open]::backdrop {
  animation: dish-dim 260ms ease-out;
}

@keyframes dish-rise {
  from {
    transform: translateY(2.5rem);
    opacity: 0;
  }
}

@keyframes dish-dim {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dish-sheet[open],
  .dish-sheet[open]::backdrop {
    animation: none;
  }
}

/*
 * The category strip in the menu's sticky bar.
 *
 * It is scrolled sideways — by finger, or by the menu_nav controller centring
 * the current category — so it hides its scrollbar and fades at both ends: the
 * categories on either side of the one you are in should read as the menu
 * continuing off the bar, not as words cut in half. The fade is the width of
 * the strip's own end padding, so the first and last categories come to rest
 * clear of it rather than sitting half-dissolved against the bar's controls.
 */
.menu-nav-strip {
  /* How far a chip's tap area reaches past it above and below, and so how far
     the strip reaches past the title to hold it (menu.html.erb). */
  --chip-reach: 0.625rem;
  --strip-fade: linear-gradient(
    to right,
    transparent,
    #000 1rem,
    #000 calc(100% - 1rem),
    transparent
  );
  scrollbar-width: none;
  /* Prefixed too: Chromium before 120, as in the browser on a Huawei tablet,
     and Safari before 15.4 read only this one. */
  -webkit-mask-image: var(--strip-fade);
  mask-image: var(--strip-fade);
}

.menu-nav-strip::-webkit-scrollbar {
  display: none;
}
