:root {
  --fondo: #f6f2ea;
  --carta: #fffdf9;
  --retro: #fbf7f0;
  --inchiostro: #23201c;
  --grigio: #8b857a;
  --tenue: #b9b2a5;
  --linea: #e9e2d5;
  --accento: #c8553d;
  --accento-tenue: #f6e3dc;
  --ombra: 34, 26, 16;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 0 4vw;
  overflow: hidden;
}

/* the whole menu is measured on the height too: four cards in a row on a wide box, two by two on a narrow one */
.menu {
  width: min(92vw, 880px, calc((100vh - 118px) * 2.85));
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2.6vh, 22px);
}

.menu__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 7px; }
.brand__mark { width: 18px; height: 18px; fill: none; stroke: var(--accento); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transform: translateY(2px); }
.brand__name { font-size: 15px; font-weight: 640; font-stretch: 108%; letter-spacing: -0.01em; }
.menu__tag { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--grigio); white-space: nowrap; }
.menu__sep { width: 14px; height: 1px; background: var(--tenue); }
.menu__hint { margin: 0; text-align: center; font-size: 12px; color: var(--grigio); }

.dishes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 1.8vw, 20px);
}

/* one slot per dish: the shadow on the table, then the card that tilts (GSAP) and inside it the part that turns (GSAP) */
.slot { position: relative; perspective: 900px; }
.slot__shadow {
  position: absolute; left: 10%; right: 10%; bottom: -4%; height: 12%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--ombra), 0.22), rgba(var(--ombra), 0));
  filter: blur(6px);
  pointer-events: none;
}
.dish {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transform-style: preserve-3d;
  container-type: inline-size;
  -webkit-tap-highlight-color: transparent;
}
.dish:focus-visible { outline: none; }
.dish:focus-visible .face--front { box-shadow: 0 0 0 2px var(--accento), 0 10px 26px -14px rgba(var(--ombra), 0.4); }
.dish__in { position: absolute; inset: 0; transform-style: preserve-3d; }

.face {
  position: absolute; inset: 0;
  border-radius: clamp(12px, 9cqi, 20px);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  text-align: left;
}
.face--front {
  background: var(--carta);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 0 0 1px var(--linea), 0 10px 26px -14px rgba(var(--ombra), 0.4);
  display: flex; flex-direction: column;
}
.face--back {
  background: var(--retro);
  box-shadow: 0 0 0 1px var(--linea), 0 10px 26px -14px rgba(var(--ombra), 0.4);
  transform: rotateY(180deg);
  display: flex; flex-direction: column;
  padding: 9cqi 8cqi 8cqi;
}

/* the soft light that slides across the front with the tilt */
.face__sheen {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.55) 48%, rgba(255, 255, 255, 0) 64%);
  background-size: 260% 100%;
  background-position: var(--sx, 70%) 0;
  mix-blend-mode: soft-light;
  opacity: var(--so, 0);
}

.plate { position: relative; flex: 1 1 auto; display: grid; place-items: center; padding: 7cqi 7cqi 0; min-height: 0; }
/* the photo of the dish, cut round: a soft shadow under it on the card, a thin rim of light around it */
.plate__turn { position: relative; width: 86%; max-height: 100%; aspect-ratio: 1; border-radius: 50%; }
.plate__photo {
  display: block; width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
  background: var(--linea);
  box-shadow: 0 1px 2px rgba(var(--ombra), 0.16), 0 8px 18px -8px rgba(var(--ombra), 0.42);
  user-select: none; -webkit-user-drag: none;
}
.plate__rim {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), inset 0 -10px 18px -12px rgba(var(--ombra), 0.35);
  background: radial-gradient(120% 90% at 30% 18%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 46%);
}
.plate__steam { position: absolute; inset: -6% 0 auto; width: 100%; height: 100%; overflow: visible; pointer-events: none; filter: drop-shadow(0 0 1.5px rgba(34, 26, 16, 0.25)); }
.steam { fill: none; stroke: #fffaf0; stroke-width: 1.6; stroke-linecap: round; opacity: 0; }

.front__text { padding: 3cqi 8cqi 7.5cqi; display: flex; flex-direction: column; gap: 1.6cqi; }
.front__name { font-size: clamp(10px, 7.4cqi, 16px); font-weight: 620; font-stretch: 104%; letter-spacing: -0.01em; line-height: 1.12; }
.front__row { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: clamp(8.5px, 5.4cqi, 12px); color: var(--grigio); }
.front__turn { display: inline-flex; align-items: center; gap: 4px; }
.front__turn svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.back__name { font-size: clamp(10px, 7cqi, 15px); font-weight: 640; font-stretch: 104%; letter-spacing: -0.01em; line-height: 1.12; margin: 0 0 2.4cqi; }
.back__label { font-size: clamp(7.5px, 4.4cqi, 10px); letter-spacing: 0.08em; text-transform: uppercase; color: var(--grigio); margin: 0 0 2.4cqi; }
.ings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2.2cqi; }
.ing { display: flex; align-items: center; gap: 3.6cqi; font-size: clamp(8.5px, 5.6cqi, 12.5px); line-height: 1.15; }
.ing svg { flex: 0 0 auto; width: clamp(12px, 9cqi, 20px); height: clamp(12px, 9cqi, 20px); fill: none; stroke: var(--inchiostro); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.ing svg .a { stroke: var(--accento); }
.tags { display: flex; flex-wrap: wrap; gap: 1.6cqi; margin-top: auto; padding-top: 3cqi; }
.tag { font-size: clamp(7.5px, 4.6cqi, 10.5px); padding: 0.9cqi 2.6cqi; border-radius: 99px; background: var(--accento-tenue); color: var(--accento); font-weight: 560; }
.back__foot { display: flex; align-items: baseline; justify-content: space-between; margin-top: 3cqi; padding-top: 3cqi; border-top: 1px solid var(--linea); }
.back__price { font-size: clamp(11px, 8cqi, 18px); font-weight: 650; font-stretch: 106%; letter-spacing: -0.02em; }
.back__note { font-size: clamp(7.5px, 4.4cqi, 10px); color: var(--grigio); }

.pointer {
  position: absolute; left: 0; top: 0; width: 22px; height: 22px;
  fill: var(--inchiostro); stroke: #fff; stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
  pointer-events: none; opacity: 0; z-index: 10;
}

/* two by two on a narrow box: the menu is measured on the height, the backs keep three ingredients */
@media (max-width: 620px) {
  .menu { width: min(92vw, 420px, calc((100vh - 118px) * 0.78 + 10px)); gap: clamp(8px, 2vh, 14px); }
  .dishes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .menu__tag span:last-child, .menu__sep { display: none; }
  .ing:nth-child(n + 4) { display: none; }
  .back__note { display: none; }
}

@media (hover: hover) {
  .dish:hover { z-index: 2; }
}
