/* The evening menu with the dish photo that follows the pointer: the menu of a made-up small restaurant (Ivenna) on
   a warm cream page. Six dishes with serif names, the ingredients small, the price on the right after thin leader
   dots. Over a dish its photo rises as a postcard; a click opens it into a card with the wine. */
:root {
  --page: #f3ece0;          /* the cream of the page */
  --page-light: #faf6ee;    /* the soft light on the page */
  --ink: #241a14;           /* the names and the prices */
  --muted: #8a7c6f;         /* the ingredients and the small words */
  --dots: rgba(36, 26, 20, 0.32); /* the leader dots */
  --line: rgba(36, 26, 20, 0.14); /* the thin rule */
  --accent: #a8432a;        /* terracotta: the price under the pointer, the stamp, the wine */
  --paper: #fffcf6;         /* the white border of the postcard */
  --card: #fdf9f2;          /* the open card */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background:
    radial-gradient(70% 60% at 50% 12%, var(--page-light), transparent 72%),
    var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* a whisper of paper grain on the whole page */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .3 0 0 0 .35 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: min(4vh, 28px) min(5vw, 32px);
}

/* ---------------------------------------------------------------- the menu */
.menu {
  position: relative;
  width: min(600px, 100%);
}

.menu__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: clamp(8px, 2.2vh, 16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.brand__mark {
  width: clamp(18px, 4.4vh, 24px);
  height: clamp(18px, 4.4vh, 24px);
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
}

.brand__name {
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: clamp(20px, min(3.6vw, 5.4vh), 30px);
  font-variation-settings: 'opsz' 72, 'SOFT' 60, 'WONK' 1;
  font-weight: 420;
  letter-spacing: -0.01em;
  line-height: 1;
}

.menu__when {
  display: grid;
  justify-items: end;
  gap: 3px;
  text-align: right;
}

.menu__title {
  font-size: clamp(9.5px, min(1.5vw, 2.5vh), 11.5px);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.menu__hours {
  font-size: clamp(10px, min(1.6vw, 2.6vh), 12.5px);
  color: var(--muted);
}

.menu__rule {
  display: block;
  height: 1px;
  background: var(--line);
  transform-origin: 0 50%;
}

.dishes {
  list-style: none;
  margin: 0;
  padding: clamp(2px, 1vh, 8px) 0 0;
}

.dish {
  position: relative;
}

.dish__hit {
  all: unset;
  box-sizing: border-box;
  display: block;
  width: 100%;
  padding: clamp(5px, 1.5vh, 12px) 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dish__hit:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.dish__line {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.dish__name {
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-size: clamp(15px, min(3vw, 4.3vh), 26px);
  font-variation-settings: 'opsz' 48, 'SOFT' 30, 'WONK' 0;
  font-weight: 380;
  letter-spacing: -0.012em;
  line-height: 1.12;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  transition: font-weight 0.5s cubic-bezier(.23, 1, .32, 1), color 0.4s;
}

/* the leader dots: a row of tiny dots, a little darker under the pointer */
.dish__lead {
  flex: 1 1 24px;
  min-width: 18px;
  height: 1px;
  align-self: baseline;
  position: relative;
  top: -0.22em;
  background-image: radial-gradient(circle, var(--dots) 0.6px, transparent 0.9px);
  background-size: 5px 2px;
  background-repeat: repeat-x;
  background-position: 0 50%;
  opacity: 0.8;
  transition: opacity 0.4s;
}

.dish__price {
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-size: clamp(14px, min(2.6vw, 3.8vh), 22px);
  font-variant-numeric: lining-nums tabular-nums;
  font-weight: 420;
  transition: color 0.4s;
}

.dish__ing {
  display: block;
  margin-top: clamp(1px, 0.5vh, 4px);
  font-size: clamp(10px, min(1.6vw, 2.6vh), 13px);
  font-stretch: 104%;
  letter-spacing: 0.01em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* the line on show and the others resting back: set by the script with .is-on on the menu */
.dish > .dish__hit {
  transition: opacity 0.45s cubic-bezier(.23, 1, .32, 1);
}

.is-on .dish:not(.is-hot) > .dish__hit {
  opacity: var(--dim, 0.42);
}

.dish.is-hot .dish__name {
  font-weight: 520;
}

.dish.is-hot .dish__price {
  color: var(--accent);
}

.dish.is-hot .dish__lead {
  opacity: 1;
}

/* ---------------------------------------------------------------- the postcard */
.post {
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(132px, min(30vw, 40vh), 290px);
  pointer-events: none;
  z-index: 5;
}

.post__rise {
  clip-path: inset(-30% -30% 100% -30%);
}

.post__tilt {
  transform-origin: 50% 100%;
}

.post__card {
  padding: clamp(4px, 1.2vh, 8px) clamp(4px, 1.2vh, 8px) 0;
  background: var(--paper);
  border-radius: 3px;
  box-shadow:
    0 0 0 0.5px rgba(36, 26, 20, 0.12),
    0 1px 1px rgba(36, 26, 20, 0.06),
    0 6px 12px -4px rgba(36, 26, 20, 0.14),
    0 22px 40px -12px rgba(60, 34, 18, 0.32);
}

.post__photos {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 1.5px;
  background: #e6dccd;
}

.ph {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.ph img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* the veil of grain on the photo */
.post__grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* the glossy light that slides across the photo when it tilts */
.post__gloss {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 250, 240, 0.34) 50%, transparent 62%);
  mix-blend-mode: soft-light;
}

.post__cap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: clamp(22px, 5.6vh, 40px);
}

.post__name {
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: clamp(10px, min(1.7vw, 2.8vh), 14px);
  font-variation-settings: 'opsz' 24, 'SOFT' 80;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 2px;
}

.post__stamp {
  flex: none;
  width: clamp(16px, 4.6vh, 30px);
  height: clamp(16px, 4.6vh, 30px);
  fill: none;
  stroke: var(--accent);
  stroke-width: 0.8;
  opacity: 0.8;
}

.post__stamp text {
  fill: var(--accent);
  stroke: none;
  font-size: 5.2px;
  font-weight: 600;
  letter-spacing: 0.9px;
}

/* ---------------------------------------------------------------- the open card */
.veil {
  position: absolute;
  inset: 0;
  background: rgba(243, 236, 224, 0.62);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  z-index: 6;
}

.open {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(620px, 92vw);
  max-height: 92vh;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  z-index: 7;
  transform-origin: 0 0;
  box-shadow:
    0 0 0 0.5px rgba(36, 26, 20, 0.14),
    0 2px 4px rgba(36, 26, 20, 0.06),
    0 18px 36px -10px rgba(36, 26, 20, 0.22),
    0 50px 90px -30px rgba(60, 34, 18, 0.4);
}

.open[hidden] {
  display: none;
}

.open__photo {
  position: relative;
  height: min(44vh, 300px);
  overflow: hidden;
}

.open__photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.open__body {
  padding: clamp(10px, 3vh, 26px) clamp(14px, 3vw, 28px) clamp(12px, 3vh, 26px);
  display: grid;
  align-content: start;
  gap: clamp(3px, 1vh, 8px);
}

.open__kicker {
  margin: 0;
  font-size: clamp(9px, 2.2vh, 11px);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.open__name {
  margin: 0;
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: clamp(18px, min(4vw, 5.6vh), 32px);
  font-variation-settings: 'opsz' 96, 'SOFT' 40;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.open__ing {
  margin: 0;
  font-size: clamp(10.5px, 2.8vh, 14px);
  color: var(--muted);
}

.open__price {
  margin: 0;
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-size: clamp(14px, 3.6vh, 20px);
  font-variant-numeric: lining-nums;
}

.wine {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: clamp(4px, 1.4vh, 12px);
  padding: clamp(7px, 1.8vh, 12px) clamp(10px, 2vh, 14px);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.35));
  box-shadow: inset 0 0 0 0.5px rgba(36, 26, 20, 0.14), 0 1px 2px rgba(36, 26, 20, 0.05);
}

.wine__glass {
  width: clamp(14px, 4.4vh, 20px);
  height: clamp(21px, 6.6vh, 30px);
  overflow: visible;
}

.wine__fill {
  fill: var(--accent);
}

.wine__line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wine__text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.wine__label {
  font-size: clamp(8.5px, 2vh, 10px);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.wine__name {
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: clamp(13px, 3.4vh, 17px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wine__note {
  font-size: clamp(9.5px, 2.4vh, 12px);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wine__glassprice {
  display: grid;
  justify-items: end;
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-size: clamp(14px, 3.4vh, 18px);
}

.wine__per {
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  font-size: clamp(8.5px, 2vh, 10px);
  color: var(--muted);
}

.open__close {
  all: unset;
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(253, 249, 242, 0.86);
  box-shadow: 0 0 0 0.5px rgba(36, 26, 20, 0.16), 0 4px 10px -4px rgba(36, 26, 20, 0.3);
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(.34, 1.56, .64, 1);
}

.open__close svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.4;
  stroke-linecap: round;
}

.open__close:active {
  transform: scale(0.9);
}

@media (hover: hover) {
  .open__close:hover {
    transform: rotate(90deg);
  }
}

/* side by side when there is room */
@media (min-width: 620px) and (min-height: 380px) {
  .open {
    grid-template-columns: 1.05fr 1fr;
    grid-template-rows: 1fr;
    height: min(380px, 80vh);
  }

  .open__photo {
    height: 100%;
  }

  .open__body {
    align-content: center;
  }
}

/* ---------------------------------------------------------------- the pointer of the walk on its own */
.cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: var(--ink);
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  pointer-events: none;
  opacity: 0;
  z-index: 10;
}

@media (prefers-reduced-motion: reduce) {
  .dish__name,
  .dish > .dish__hit {
    transition: opacity 0.3s;
  }
}
