:root {
  --tablecloth: #2a1a28;
  --tablecloth-deep: #150c14;
  --paper: #dce3c6;
  --paper-shade: #c4cea9;
  --ink: #1c3024;
  --ink-soft: #3a4d3f;
  --gold: #8f6a28;
  --gold-light: #ecd391;
  --rule: rgb(143 106 40 / 0.55);

  --display: "Pinyon Script", "Snell Roundhand", cursive;
  --serif: "Spectral", Georgia, serif;

  --card-ratio: 0.585;
}

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

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

body {
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, var(--tablecloth) 0%, var(--tablecloth-deep) 80%);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}

body.idle {
  cursor: none;
}

/* Linen weave on the tablecloth */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgb(255 255 255 / 0.018) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgb(0 0 0 / 0.05) 0 1px, transparent 1px 3px);
  pointer-events: none;
}

.candlelight,
.embers {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.candlelight {
  filter: blur(14px);
}

.vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 45%, transparent 50%, rgb(8 3 8 / 0.7) 100%);
  pointer-events: none;
}

.table {
  position: relative;
  display: grid;
  place-items: center;
  height: 100dvh;
}

/* ---------- The card ---------- */

.card,
.card-shadow {
  grid-area: 1 / 1;
  width: min(calc(86dvh / var(--card-ratio)), 94vw);
  aspect-ratio: 1 / var(--card-ratio);
  rotate: -0.5deg;
}

.card-shadow {
  background: rgb(5 0 4 / 0.8);
  filter: blur(30px);
  translate: var(--shadow-x, 1.2vh) var(--shadow-y, 2.2vh);
  scale: 1.01;
  opacity: 0;
  animation: shadow-in 1.6s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.card {
  position: relative;
  container-type: inline-size;
  overflow: hidden;
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.2 0 0 0 0 0.25 0 0 0 0 0.15 0 0 0 0.22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 50% 30%, transparent 40%, var(--paper-shade) 130%);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.5),
    0 1px 0 rgb(0 0 0 / 0.3);
  animation: card-in 1.6s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

/* Warm light from the candles falling across the paper */
.card-glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle at 18% 10%, rgb(255 196 120 / 0.22), transparent 50%);
  opacity: var(--glow, 0.85);
  mix-blend-mode: multiply;
  pointer-events: none;
}

.card-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 4cqi 4cqi 3.2cqi;
  text-align: center;
}

/* Gold double frame, a classic printed-menu border */
.card-inner::before,
.card-inner::after {
  content: "";
  position: absolute;
  border: 0.2cqi solid var(--gold);
  pointer-events: none;
  opacity: 0.85;
}

.card-inner::before {
  inset: 1.7cqi;
}

.card-inner::after {
  inset: 2.3cqi;
  border-width: 0.09cqi;
}

/* ---------- Header ---------- */

.card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.title {
  margin: 0;
  padding: 0 1.5cqi;
  font-family: var(--display);
  font-weight: 400;
  font-size: 6.5cqi;
  line-height: 1.15;
  color: var(--gold);
  background: linear-gradient(
    105deg,
    var(--gold) 0%,
    var(--gold) 40%,
    var(--gold-light) 50%,
    var(--gold) 60%,
    var(--gold) 100%
  );
  background-size: 300% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title.shine {
  opacity: 1;
  animation: foil-shine 2.4s ease-in-out;
}

.date {
  margin: 0.2cqi 0 0;
  font-style: italic;
  font-size: 1.8cqi;
  color: var(--ink-soft);
}

.spear {
  width: 16cqi;
  margin-top: 1cqi;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Courses side by side ---------- */

.courses {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(4, auto);
  width: 100%;
}

.course {
  display: grid;
  grid-row: span 4;
  grid-template-rows: subgrid;
  justify-items: center;
  align-content: start;
  padding: 0.6cqi 1.2cqi 0.8cqi;
}

.course + .course {
  border-left: 0.1cqi solid var(--rule);
}

.course-name {
  margin: 0;
  font-weight: 400;
  font-style: italic;
  font-size: 1.8cqi;
  color: var(--gold);
}

.dish {
  align-self: center;
  margin: 0.8cqi 0 0;
  font-weight: 600;
  font-size: 2.85cqi;
  line-height: 1.12;
  color: var(--ink);
  text-wrap: balance;
}

.description {
  max-width: 26ch;
  margin: 1.8cqi 0 0;
  font-size: 1.9cqi;
  line-height: 1.42;
  color: var(--ink);
  text-wrap: balance;
}

.wine {
  align-self: end;
  margin: 2.8cqi 0 0;
  font-style: italic;
  font-weight: 500;
  font-size: 1.65cqi;
  white-space: nowrap;
  color: var(--ink-soft);
}

.wine::before {
  content: "";
  display: inline-block;
  width: 1.05cqi;
  height: 1.55cqi;
  margin-right: 0.7cqi;
  vertical-align: -0.1cqi;
  background: var(--gold);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 18'%3E%3Cpath d='M1 1h10c0 4.5-1.8 7-5 7S1 5.5 1 1zM5.4 8h1.2v7.6H9V17H3v-1.4h2.4z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.card-footer {
  font-style: italic;
  font-size: 1.7cqi;
  color: var(--ink-soft);
}

/* ---------- Portrait screens: stack the courses ---------- */

@media (max-aspect-ratio: 1/1) {
  :root {
    --card-ratio: 1.55;
  }

  .card-inner {
    padding: 10cqi 9cqi 8cqi;
  }

  .card-inner::before {
    inset: 4cqi;
  }

  .card-inner::after {
    inset: 5.4cqi;
  }

  .title {
    font-size: 11.5cqi;
  }

  .date {
    font-size: 3.4cqi;
  }

  .spear {
    width: 30cqi;
    margin-top: 2cqi;
  }

  .courses {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    row-gap: 5cqi;
  }

  .course {
    grid-row: auto;
    grid-template-rows: none;
    padding: 0;
  }

  .course + .course {
    border-left: 0;
  }

  .course-name {
    font-size: 3.4cqi;
  }

  .dish {
    font-size: 5.8cqi;
  }

  .description {
    max-width: 30ch;
    font-size: 3.5cqi;
  }

  .wine,
  .card-footer {
    font-size: 3.1cqi;
  }

  .wine::before {
    width: 1.8cqi;
    height: 2.6cqi;
    margin-right: 1.2cqi;
  }
}

/* ---------- Fullscreen hint ---------- */

.hint {
  position: fixed;
  right: 2.5vw;
  bottom: 2.5vh;
  margin: 0;
  white-space: nowrap;
  font-style: italic;
  font-size: clamp(12px, 1.6vh, 18px);
  color: rgb(236 211 145 / 0.7);
  opacity: 0;
  transition: opacity 1s;
  pointer-events: none;
}

.hint.visible {
  opacity: 1;
}

@media (hover: none) {
  .hint {
    display: none;
  }
}

/* ---------- Load sequence ---------- */

.reveal {
  opacity: 0;
  animation: ink-in 1.1s cubic-bezier(0.25, 0.6, 0.3, 1) forwards;
  animation-delay: calc(1.3s + var(--order, 0) * 0.12s);
}

.spear.reveal {
  opacity: 1;
  animation: none;
}

.spear path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 2.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  animation-delay: calc(1.3s + var(--order, 0) * 0.12s);
}

@keyframes card-in {
  from {
    opacity: 0;
    translate: 0 6vh;
    rotate: 2deg;
  }
  to {
    opacity: 1;
    translate: 0 0;
    rotate: -0.5deg;
  }
}

@keyframes shadow-in {
  from {
    opacity: 0;
    scale: 1.12;
  }
  to {
    opacity: 1;
    scale: 1.01;
  }
}

@keyframes ink-in {
  from {
    opacity: 0;
    filter: blur(4px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes foil-shine {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .card-shadow,
  .reveal,
  .spear path {
    animation: none;
    opacity: 1;
    stroke-dashoffset: 0;
  }

  .candlelight,
  .embers {
    display: none;
  }
}
