/* ============================================================
   Dinner Divination — aged-book cream / pastel-deck palette
   Sampled from the Rider–Waite–Smith art:
     - frame border:    #181617  (near-black, faintly warm)
     - card creams:     #e0c060, #c0b0a0
     - dusty teal:      #80b0b0
     - faded brick:     #d08050
     - sage / olive:    #707040
   The site is a sheet of old book paper. The cards rest on it.
   ============================================================ */

:root {
  --ink:         #181617;        /* exact frame-border ink */
  --ink-soft:    #3d322a;        /* dim body, faded printer's ink */
  --ink-mute:    rgba(24, 22, 23, 0.55);

  --paper:       #efe2c2;        /* aged book page */
  --paper-2:     #e7d7ac;        /* slightly more sun-tanned */
  --paper-deep:  #d6c290;        /* shadowed page edge */
  --paper-shade: rgba(24, 22, 23, 0.05);

  --rule:        rgba(24, 22, 23, 0.22);
  --rule-strong: rgba(24, 22, 23, 0.55);

  /* Card-derived pastel accents */
  --gold:        #c89740;        /* faded illuminated gold */
  --gold-soft:   #d9b35a;
  --red:         #a8392b;        /* dusty brick */
  --red-deep:    #7a2418;
  --teal:        #5b8589;        /* dusty teal */
  --sage:        #6b7849;
  --green:       #5a7a3a;        /* veg-mode pastel */
  --green-deep:  #3f5829;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Cormorant Garamond", "EB Garamond", "Iowan Old Style",
               "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* The page itself is the paper — soft cream with mottled warmth and a faint
   grain to feel printed, not screened. Two overlaid radial washes plus a
   noise layer give it depth without an asset. */
body {
  min-height: 100dvh;
  background:
    radial-gradient(85vmax 60vmax at 20% 10%, rgba(255, 232, 168, 0.45), transparent 70%),
    radial-gradient(70vmax 55vmax at 90% 95%, rgba(170, 120, 60, 0.18), transparent 65%),
    linear-gradient(180deg, #efe2c2 0%, #e6d6ab 100%);
  position: relative;
}

/* Kill all default focus outlines and tap highlights. iOS Safari treats
   programmatic .focus() as :focus-visible, so the narrower
   :focus:not(:focus-visible) carve-out doesn't help on touch. Keyboard
   focus on desktop still gets our custom inverted style via the per-element
   :focus-visible rules wrapped in @media (hover: hover). */
:focus { outline: none; }
* { -webkit-tap-highlight-color: transparent; }

/* Paper grain — additive noise, very faint. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.10;
  mix-blend-mode: multiply;
  background-image:
    repeating-radial-gradient(circle at 20% 30%, rgba(80, 50, 20, 0.4) 0 1px, transparent 1px 4px),
    repeating-radial-gradient(circle at 70% 60%, rgba(30, 20, 10, 0.3) 0 1px, transparent 1px 5px);
}
/* Soft vignette so the edges feel like a page held up to light. */
.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(80vmax 80vmax at 50% 50%,
              transparent 55%, rgba(60, 40, 20, 0.25) 100%);
}

/* ---------- Header chrome ---------- */
.chrome {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.6rem;
  padding: max(1.1rem, env(safe-area-inset-top)) 1.2rem 0.9rem;
  /* Subtle warm-ink wash so the header reads as a slightly darker band of
     the same paper, with a hairline rule below. */
  background:
    linear-gradient(180deg, rgba(60, 40, 20, 0.085) 0%, rgba(60, 40, 20, 0.055) 100%);
  border-bottom: 1px solid var(--rule-strong);
  box-shadow: 0 1px 0 rgba(255, 240, 200, 0.45) inset;
}
.chrome > :first-child { justify-self: start; }
.chrome > :last-child  { justify-self: end; }

.chrome-left {
  /* Date + "View all" moved into the hamburger menu on every viewport; the
     header keeps only hamburger | wordmark | veg-toggle. */
  display: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  line-height: 1;
  gap: 0.05em;
  transition: opacity 120ms ease;
}
.wordmark:hover,
.wordmark:focus-visible { opacity: 0.85; }
.wordmark:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 2px; }
.wm-cap {
  display: block;
  height: clamp(54px, 8vw, 72px);
  width: auto;
  user-select: none;
  -webkit-user-drag: none;
}
.wm-text {
  font-family: "DM Serif Display", "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.8rem, 4.4vw, 2.5rem);
  font-style: italic;
  letter-spacing: 0.005em;
  line-height: 1;
  white-space: nowrap;
}

.date-display {
  font: inherit;
  font-size: clamp(0.62rem, 2.6vw, 0.74rem);
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.date-display:hover, .date-display:focus-visible {
  background: var(--paper-shade);
  border-color: var(--ink);
  outline: none;
}

/* Veggie switch — paper-toned track, green thumb when on. */
.veg-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font-size: clamp(0.62rem, 2.6vw, 0.74rem);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
}
.veg-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.veg-track {
  position: relative;
  display: inline-block;
  width: 2.4rem;
  height: 1.25rem;
  border-radius: 999px;
  background: var(--paper-deep);
  border: 1px solid var(--rule-strong);
  transition: background 0.2s, border-color 0.2s;
}
.veg-thumb {
  position: absolute;
  top: 50%;
  left: 0.18rem;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: var(--paper);
  transform: translateY(-50%);
  transition: left 0.2s, background 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.30);
}
.veg-toggle input:checked + .veg-track {
  background: var(--green);
  border-color: var(--green-deep);
}
.veg-toggle input:checked + .veg-track .veg-thumb {
  left: calc(100% - 1.15rem);
  background: var(--paper);
}
.veg-toggle input:focus-visible + .veg-track {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
/* The toggle locks the moment a card is picked; if the user wants to change
   it they need to start over from round 1. Dim it visibly to communicate. */
.veg-toggle.is-locked {
  cursor: not-allowed;
  opacity: 0.45;
}
.veg-toggle.is-locked .veg-track { filter: saturate(0.5); }

/* ---------- Screen / stages ---------- */
.screen {
  position: relative;
  z-index: 20;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.stage[hidden] { display: none; }
.stage {
  animation: stage-in 0.32s cubic-bezier(0.2, 0.9, 0.25, 1);
}
@keyframes stage-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.kicker {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 0.5rem;
}

/* ---------- Round stage ---------- */
.stage-round {
  max-width: 64rem;
  margin: 0 auto;
}
.round-head {
  text-align: center;
  margin: 0.4rem 0 1.4rem;
}
.round-num {
  font-family: "Cormorant Garamond", serif;
  font-size: 0.74rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}
.round-hint {
  font-family: "DM Serif Display", "Cormorant Garamond", serif;
  font-style: italic;
  font-size: clamp(1.4rem, 4.4vw, 2rem);
  line-height: 1.1;
  color: var(--ink);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.8rem, 2.6vw, 1.6rem);
  align-items: stretch;
  padding: 0 0.2rem;
}

/* ---------- Hand (mobile only) ----------
   Persistent row of slots that fill with the visitor's picks as they happen.
   Desktop hides the hand and uses the chip strip below the cards instead. */
.hand {
  display: none;       /* shown via mobile media query */
  justify-content: center;
  gap: 0.5rem;
  margin: 1.6rem auto 0;
  padding: 0 0.6rem;
}
.hand-slot {
  width: clamp(60px, 19vw, 90px);
  aspect-ratio: 0.567;            /* matches card art aspect */
  border: 1px dashed var(--rule);
  border-radius: 6px;
  opacity: 0.55;
  position: relative;
  overflow: hidden;
}
.hand-slot.is-filled {
  border: 0;
  opacity: 1;
}
.hand-slot.is-drop-target {
  border-color: var(--ink);
  border-style: solid;
  background: rgba(60, 40, 20, 0.12);
  opacity: 1;
}
.hand-slot .hand-card-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.hand-slot-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1em;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  line-height: 1.25;
  text-align: center;
  pointer-events: none;
}

/* Card button — no nameplate; the card's own art carries its name.
   Hover lift lives on .card-deal so it composes with the deal-in animation. */
.card-pick {
  position: relative;
  display: block;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
  text-align: center;
}
.card-pick:disabled {
  cursor: not-allowed;
  opacity: 0.32;
  filter: saturate(0.55);
}

/* Deal-in wrapper: this is the element each card descends through on entry.
   It's also the transform target for fly-up (other cards on pick) and
   dissolve (chosen card on pick). Keeping these on .card-deal frees the
   inner .card-art to keep running the floating drift animation. */
.card-deal {
  display: block;
  position: relative;
  will-change: transform, opacity;
  transition: transform 0.18s ease;
}
.card-pick .card-deal {
  animation: card-deal-in 0.42s cubic-bezier(0.2, 0.85, 0.3, 1) both;
}
.card-pick:hover  .card-deal { transform: translateY(-4px); }
.card-pick:active .card-deal { transform: translateY(-1px) scale(0.99); }
.card-pick:disabled .card-deal { transform: none; }

/* Stagger the deal so the three cards fall in one after another, quickly. */
.card-pick:nth-child(1) .card-deal { animation-delay: 0ms; }
.card-pick:nth-child(2) .card-deal { animation-delay: 110ms; }
.card-pick:nth-child(3) .card-deal { animation-delay: 220ms; }

@keyframes card-deal-in {
  0%   { opacity: 0; transform: translateY(-110vh) rotate(-6deg); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0)      rotate(0deg); }
}

/* Pick-time animations:
     .is-flying-up   → the two unchosen cards leave upward
     .is-dissolving  → the chosen card fades out alone after they're gone
   Both override the deal-in animation by being applied to the same element. */
.card-pick.is-flying-up { pointer-events: none; }
.card-pick.is-flying-up .card-deal {
  animation: card-fly-up 0.46s cubic-bezier(0.55, 0, 0.9, 0.4) forwards;
}
@keyframes card-fly-up {
  to { opacity: 0; transform: translateY(-130vh) rotate(-10deg); }
}

.card-pick.is-flying-down { pointer-events: none; }
.card-pick.is-flying-down .card-deal {
  animation: card-fly-down 0.5s cubic-bezier(0.55, 0, 0.9, 0.4) forwards;
}
@keyframes card-fly-down {
  to { opacity: 0; transform: translateY(130vh) rotate(8deg); }
}

/* Single composited PNG; warm shadow underneath so it lifts off the paper.
   The container drifts on a slow sine — each card with a different period
   and phase so the three never sync, and amplitudes stay well below the
   grid gap so they can't visually collide. */
.card-art {
  position: relative;
  aspect-ratio: 1103 / 1944;
  width: 100%;
  will-change: transform;
}
.card-pick:nth-child(1) .card-art { animation: card-drift-a 9.7s ease-in-out -1.2s infinite alternate; }
.card-pick:nth-child(2) .card-art { animation: card-drift-b 11.3s ease-in-out -4.1s infinite alternate; }
.card-pick:nth-child(3) .card-art { animation: card-drift-c 10.4s ease-in-out -7.5s infinite alternate; }

@keyframes card-drift-a {
  0%   { transform: translate(0, 0)   rotate(-0.4deg); }
  35%  { transform: translate(4px, -5px) rotate(0.5deg); }
  70%  { transform: translate(-3px, 3px) rotate(-0.6deg); }
  100% { transform: translate(2px, -4px) rotate(0.3deg); }
}
@keyframes card-drift-b {
  0%   { transform: translate(3px, 3px) rotate(0.6deg); }
  30%  { transform: translate(-4px, -3px) rotate(-0.5deg); }
  65%  { transform: translate(2px, -5px) rotate(0.7deg); }
  100% { transform: translate(-2px, 4px) rotate(-0.4deg); }
}
@keyframes card-drift-c {
  0%   { transform: translate(-2px, -3px) rotate(0.3deg); }
  40%  { transform: translate(4px, 4px) rotate(-0.7deg); }
  75%  { transform: translate(-4px, 2px) rotate(0.5deg); }
  100% { transform: translate(3px, -3px) rotate(-0.2deg); }
}
.card-art .art {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 3px 6px rgba(60, 40, 20, 0.35))
          drop-shadow(0 14px 22px rgba(60, 40, 20, 0.25));
  transition: filter 0.22s ease;
}
.card-pick:hover .card-art .art {
  filter: drop-shadow(0 5px 8px rgba(60, 40, 20, 0.45))
          drop-shadow(0 18px 26px rgba(60, 40, 20, 0.30));
}

/* Illuminated vine-and-vegetable frame over vegetarian-eligible cards,
   replacing the old solid olive ring. assets/veg-frame.png is a keyed border
   with a transparent center, stretched to the card box so the art shows
   through the middle. */
.card-pick.is-veg-ok .card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;                      /* above the image, which is at z-index 1 */
  background: url("assets/veg-frame.png") center / 100% 100% no-repeat;
  pointer-events: none;
}

.card-pick:focus-visible .card-art .art {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: 6px;
}

/* ---------- Trail of picks (small chips under the row) ---------- */
.round-trail {
  margin: 1.6rem auto 0;
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.trail-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(255, 247, 220, 0.65);
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.trail-chip .tc-num {
  color: var(--gold);
  font-weight: 700;
  font-style: italic;
}
.trail-chip .tc-name { font-style: italic; }
.trail-chip.is-placeholder { opacity: 0.42; }
.trail-chip.is-placeholder .tc-name::before { content: "—"; }

/* Completed-round chips are real buttons — clickable to jump back. */
button.trail-chip {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
button.trail-chip:hover,
button.trail-chip:focus-visible {
  background: rgba(255, 246, 210, 0.95);
  border-color: var(--ink);
  outline: none;
}
button.trail-chip:active { transform: scale(0.97); }

/* ---------- Buttons (reveal stage only now) ---------- */
.btn {
  display: inline-block;
  font: inherit;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.12s, border-color 0.18s;
}
@media (hover: hover) {
  .btn:hover, .btn:focus-visible {
    background: var(--ink);
    color: var(--paper);
    outline: none;
  }
}
.btn:active { transform: scale(0.97); }
.btn-ghost {
  border-color: var(--rule-strong);
  color: var(--ink-soft);
}
@media (hover: hover) {
  .btn-ghost:hover, .btn-ghost:focus-visible {
    background: var(--paper-shade);
    color: var(--ink);
    border-color: var(--ink);
  }
}

/* ---------- Reveal stage ---------- */
.stage-reveal {
  max-width: 44rem;
  margin: 0 auto;
}
.reveal-trail {
  display: flex;
  justify-content: center;
  gap: clamp(0.5rem, 2.5vw, 1rem);
  margin-bottom: 1.4rem;
}
.reveal-trail .rt-card {
  width: clamp(80px, 17vw, 120px);
}
.reveal-trail .card-art .art {
  filter: drop-shadow(0 2px 4px rgba(60, 40, 20, 0.30))
          drop-shadow(0 8px 14px rgba(60, 40, 20, 0.22));
}

.meal-card {
  position: relative;
  padding: clamp(1.4rem, 4vw, 2.2rem) clamp(1.2rem, 4vw, 2.2rem) clamp(1.2rem, 3.5vw, 1.8rem);
  background:
    radial-gradient(140% 70% at 50% 0%, rgba(255, 240, 195, 0.65), transparent 70%),
    linear-gradient(180deg, #f6e8c5 0%, #ecdaa9 100%);
  color: var(--ink);
  border-radius: 4px;
  border: 1px solid var(--ink);
  box-shadow:
    0 0 0 1px rgba(24, 22, 23, 0.15) inset,
    0 1px 0 var(--ink),
    0 16px 40px rgba(60, 40, 20, 0.28);
}
.card-kicker {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
  text-align: center;
}
.veg-tag {
  display: inline-block;
  margin-left: 0.4em;
  padding: 0.05rem 0.55rem;
  background: var(--green);
  color: var(--paper);
  border-radius: 999px;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  vertical-align: 1px;
}
.veg-tag[hidden] { display: none; }

.meal-name {
  font-family: "DM Serif Display", "Cormorant Garamond", serif;
  font-style: italic;
  font-size: clamp(2rem, 6.5vw, 2.7rem);
  font-weight: 400;
  line-height: 1.1;
  color: var(--ink);
  margin: 0.2rem 0 0.5rem;
  text-align: center;
  text-wrap: balance;
}
.meal-mood {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin-bottom: 1.2rem;
  text-align: center;
}

.section-h {
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 1.5rem 0 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--rule);
}

.meal-ingredients {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.meal-ingredients li {
  font-size: 0.94rem;
  padding: 0.32rem 0.78rem;
  background: rgba(200, 151, 64, 0.18);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--ink);
}

.meal-desc {
  font-size: 1.05rem;
  line-height: 1.62;
  color: var(--ink);
  text-wrap: pretty;
}
.meal-desc p { margin-bottom: 0.8em; }
.meal-desc p:last-child { margin-bottom: 0; }
/* Illuminated drop-cap image on the first paragraph. */
.meal-desc .drop-cap {
  float: left;
  height: 4.2em;
  width: auto;
  margin: 0.05em 0.55em 0.05em 0;
  shape-outside: margin-box;
  user-select: none;
  -webkit-user-drag: none;
}
/* Pull the very first line tight against the illuminated letter while
   leaving wrapped lines below at their normal margin. */
.meal-desc .meal-desc-lead { text-indent: -0.4em; }
@media (max-width: 540px) {
  /* Mobile Safari mishandles shape-outside (wrapped lines drift over the
     floated cap), but text-indent alone is safe — keep the first-line pull
     so the cap looks tied to the text the way it does on desktop. */
  .meal-desc .drop-cap {
    height: 3.6em;
    margin: 0.1em 0.5em 0.15em 0;
    shape-outside: none;
  }
  .meal-desc .meal-desc-lead { text-indent: -0.35em; }
}

.meal-line {
  margin-top: 1.2rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-size: 1rem;
  color: var(--ink);
}
.card-label {
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.74rem;
  margin-right: 0.4em;
}

.meal-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 1.6rem;
  flex-wrap: wrap;
}

/* ---------- Share menu ---------- */
.share-menu {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.share-menu[hidden] { display: none; }
.sm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(36, 24, 12, 0.65);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade-in 0.22s ease both;
}
.sm-panel {
  position: relative;
  width: min(22rem, 100%);
  padding: 1.6rem 1.3rem 1.2rem;
  border-radius: 4px;
  border: 1px solid var(--ink);
  background:
    radial-gradient(140% 80% at 50% 0%, rgba(255, 240, 195, 0.65), transparent 70%),
    linear-gradient(180deg, #f6e8c5 0%, #ecdaa9 100%);
  color: var(--ink);
  box-shadow:
    0 0 0 1px rgba(24, 22, 23, 0.15) inset,
    0 1px 0 var(--ink),
    0 16px 60px rgba(0,0,0,0.5);
  animation: card-in 0.28s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.sm-close {
  position: absolute;
  top: 0.6rem; right: 0.6rem;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
@media (hover: hover) {
  .sm-close:hover { background: var(--ink); color: var(--paper); }
}
.sm-title {
  font-family: "DM Serif Display", serif;
  font-style: italic;
  font-size: 1.6rem;
  color: var(--ink);
  margin-bottom: 1rem;
  text-align: center;
}
.sm-list { display: flex; flex-direction: column; gap: 0.45rem; }
.sm-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
@media (hover: hover) {
  .sm-item:hover, .sm-item:focus-visible {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
    outline: none;
  }
}
/* Click anywhere on the row, including over child <img>/<span>, fires the
   item's handler — don't let nested elements eat the event. */
.sm-item * { pointer-events: none; }

.sm-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem; height: 2rem;
  flex: none;
  border-radius: 6px;
  background: rgba(60, 40, 20, 0.08);
  line-height: 0;
}
.sm-ic img { display: block; width: 1.25rem; height: 1.25rem; }
.sm-ic-copy img { opacity: 0.75; }
/* Reddit/Facebook are single-path negative-space marks: give them a white
   disc behind so the brand cut-out reads white, not the panel bg. */
.sm-ic-disc { background: radial-gradient(circle at 50% 50%, #fff 0 49%, transparent 50%); }
.sm-ic-disc img { width: 100%; height: 100%; }
/* The X / Twitter mark is white-on-transparent — give it a dark backing so
   it's visible on the cream panel. */
.sm-ic-x { background: #000; }
.sm-ic-x img { filter: invert(0); }
.sm-contact {
  display: block;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
}
.sm-contact:hover { color: var(--ink); }

/* ---------- Date picker (uses the same paper panel) ---------- */
.date-picker {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.date-picker[hidden] { display: none; }
.dp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(36, 24, 12, 0.65);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade-in 0.22s ease both;
}
.dp-panel {
  position: relative;
  width: min(22rem, 100%);
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  padding: 1.6rem 1.3rem 1.2rem;
  border-radius: 4px;
  border: 1px solid var(--ink);
  background:
    radial-gradient(140% 80% at 50% 0%, rgba(255, 240, 195, 0.65), transparent 70%),
    linear-gradient(180deg, #f6e8c5 0%, #ecdaa9 100%);
  color: var(--ink);
  box-shadow:
    0 0 0 1px rgba(24, 22, 23, 0.15) inset,
    0 1px 0 var(--ink),
    0 16px 60px rgba(0,0,0,0.5);
  animation: card-in 0.28s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.dp-close {
  position: absolute;
  top: 0.6rem; right: 0.6rem;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
@media (hover: hover) {
  .dp-close:hover { background: var(--ink); color: var(--paper); }
}
.dp-title {
  font-family: "DM Serif Display", serif;
  font-style: italic;
  font-size: 1.5rem;
  color: var(--ink);
  margin-bottom: 0.8rem;
  text-align: center;
}
.dp-list {
  list-style: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.dp-item {
  font: inherit;
  font-size: 0.95rem;
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-radius: 4px;
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
}
@media (hover: hover) {
  .dp-item:hover, .dp-item:focus-visible {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
    outline: none;
  }
  .dp-item:hover .dp-item-weekday,
  .dp-item:focus-visible .dp-item-weekday { color: var(--paper-2); }
}
.dp-item.is-current {
  background: rgba(200, 151, 64, 0.22);
  border-color: var(--gold);
}
.dp-item-weekday {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
/* dp-item-weekday hover handled inside the @media (hover: hover) block above */

/* ---------- View-all panel ---------- */
.view-all {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.view-all[hidden] { display: none; }
.va-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(36, 24, 12, 0.65);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade-in 0.22s ease both;
}
.va-panel {
  position: relative;
  width: min(38rem, 100%);
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
  padding: 1.6rem 1.3rem 1.2rem;
  border-radius: 4px;
  border: 1px solid var(--ink);
  background:
    radial-gradient(140% 80% at 50% 0%, rgba(255, 240, 195, 0.65), transparent 70%),
    linear-gradient(180deg, #f6e8c5 0%, #ecdaa9 100%);
  color: var(--ink);
  box-shadow:
    0 0 0 1px rgba(24, 22, 23, 0.15) inset,
    0 1px 0 var(--ink),
    0 16px 60px rgba(0,0,0,0.5);
  animation: card-in 0.28s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.va-close {
  position: absolute;
  top: 0.4rem; right: 0.55rem;
  width: 2rem; height: 2rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  padding: 0;
}
@media (hover: hover) {
  .va-close:hover, .va-close:focus-visible { color: var(--gold); outline: none; }
}
.va-title {
  font-family: "DM Serif Display", serif;
  font-style: italic;
  font-size: 1.5rem;
  color: var(--ink);
  margin-bottom: 0.8rem;
  text-align: center;
}
.va-list {
  list-style: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-right: 0.2rem;
}
.va-item {
  font: inherit;
  text-align: left;
  padding: 0.45rem 0.7rem;
  border-radius: 4px;
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "thumbs name"
    "thumbs veg"
    "thumbs cuisine";
  align-items: center;
  column-gap: 0.7rem;
  row-gap: 0.05rem;
}
.va-thumbs  { grid-area: thumbs; align-self: center; }
.va-name    { grid-area: name;    align-self: end; }
.va-veg     { grid-area: veg;     align-self: end;   justify-self: start; margin-left: 0; }
.va-cuisine { grid-area: cuisine; align-self: start; }
/* Items without a veg badge: collapse the empty middle row. */
.va-item:not(:has(.va-veg)) {
  grid-template-areas:
    "thumbs name"
    "thumbs cuisine";
}
@media (hover: hover) {
  .va-item:hover, .va-item:focus-visible {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
    outline: none;
  }
}
.va-thumbs {
  display: flex;
  gap: 0.18rem;
  flex-shrink: 0;
}
.va-thumb {
  display: block;
  width: 54px;
  height: auto;
  border-radius: 2px;
  user-select: none;
  -webkit-user-drag: none;
}
.va-name {
  font-family: "DM Serif Display", "Cormorant Garamond", serif;
  font-size: 1.05rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.va-cuisine {
  font-family: "Cormorant Garamond", serif;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
@media (hover: hover) {
  .va-item:hover .va-cuisine,
  .va-item:focus-visible .va-cuisine { color: var(--paper-2); }
}
.va-veg {
  display: inline-block;
  margin-left: 0.4em;
  padding: 0 0.4em;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  border: 1px solid var(--green-deep);
  border-radius: 999px;
  color: var(--green-deep);
  background: rgba(90, 122, 58, 0.10);
  vertical-align: middle;
}
@media (hover: hover) {
  .va-item:hover .va-veg,
  .va-item:focus-visible .va-veg {
    color: var(--paper);
    border-color: var(--green);
    background: var(--green);
  }
}
@media (max-width: 540px) {
  /* Title spans the top row on mobile. Below it, 3 cards + (veg / cuisine). */
  .va-item {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "name name"
      "thumbs veg"
      "thumbs cuisine";
    column-gap: 0.55rem;
    row-gap: 0.15rem;
    padding: 0.6rem 0.7rem;
  }
  .va-item:not(:has(.va-veg)) {
    grid-template-areas:
      "name name"
      "thumbs cuisine";
  }
  .va-name {
    font-size: 1rem;
    white-space: normal;            /* allow wrap if super long */
    overflow: visible;
    text-overflow: clip;
    line-height: 1.15;
    align-self: auto;
  }
  .va-thumbs  { gap: 0.18rem; align-self: center; }
  .va-thumb   { width: 42px; }
  .va-veg     { align-self: end; }
  .va-cuisine { font-size: 0.7rem; align-self: start; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.4rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 400;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
}
.toast[hidden] { display: none; }

/* ---------- Animations ---------- */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Hamburger (all viewports) ---------- */
.hamburger {
  display: inline-flex; /* primary nav on both desktop and mobile */
  background: transparent;
  border: 0;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}
.hamburger:hover, .hamburger:focus-visible { color: var(--ink); outline: none; }
.hamburger:focus-visible .ham-bars::before,
.hamburger:focus-visible .ham-bars::after { box-shadow: 0 0.4rem 0 var(--gold), 0 0 0 1px var(--gold); }
/* Three bars: ::before is the top bar plus a box-shadow that becomes the
   middle bar, ::after is the bottom bar. */
.hamburger .ham-bars {
  display: block;
  width: 1.1rem;
  height: 0.9rem;
  background: transparent;
  position: relative;
}
.hamburger .ham-bars::before,
.hamburger .ham-bars::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}
.hamburger .ham-bars::before { top: 0; box-shadow: 0 0.4rem 0 currentColor; }
.hamburger .ham-bars::after  { bottom: 0; }

/* ---------- Hamburger menu overlay ---------- */
.ham-menu {
  position: fixed;
  inset: 0;
  z-index: 270;
  display: grid;
  place-items: start center;
  padding: 1rem;
}
.ham-menu[hidden] { display: none; }
.ham-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(36, 24, 12, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade-in 0.18s ease both;
}
.ham-panel {
  position: relative;
  margin-top: max(4.5rem, env(safe-area-inset-top));
  width: min(20rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid var(--ink);
  background:
    radial-gradient(140% 80% at 50% 0%, rgba(255, 240, 195, 0.65), transparent 70%),
    linear-gradient(180deg, #f6e8c5 0%, #ecdaa9 100%);
  box-shadow:
    0 0 0 1px rgba(24, 22, 23, 0.15) inset,
    0 1px 0 var(--ink),
    0 16px 50px rgba(0,0,0,0.45);
  animation: card-in 0.22s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.ham-item {
  font: inherit;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-radius: 4px;
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
@media (hover: hover) {
  .ham-item:hover, .ham-item:focus-visible {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
    outline: none;
  }
}
a.ham-item { text-decoration: none; }
/* Desktop keeps the veg switch in the header, so the menu omits it; the mobile
   media query re-enables this row (mobile hides the header switch instead). */
.ham-veg-row { display: none; justify-content: space-between; }
/* The mirrored veg toggle inside the menu reuses .veg-track / .veg-thumb. */
.ham-veg-row input { position: absolute; opacity: 0; pointer-events: none; }
.ham-veg-row .veg-track {
  position: relative;
  display: inline-block;
  width: 2.4rem;
  height: 1.25rem;
  border-radius: 999px;
  background: var(--paper-deep);
  border: 1px solid var(--rule-strong);
  transition: background 0.2s, border-color 0.2s;
  flex: none;
}
.ham-veg-row .veg-thumb {
  position: absolute;
  top: 50%;
  left: 0.18rem;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: var(--paper);
  transform: translateY(-50%);
  transition: left 0.2s, background 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.30);
}
.ham-veg-row input:checked ~ .veg-track {
  background: var(--green);
  border-color: var(--green-deep);
}
.ham-veg-row input:checked ~ .veg-track .veg-thumb {
  left: calc(100% - 1.15rem);
  background: var(--paper);
}
@media (hover: hover) {
  .ham-veg-row:hover .veg-track,
  .ham-veg-row:focus-visible .veg-track { border-color: var(--paper-shade); }
}

/* ---------- Mobile tightening ---------- */
@media (max-width: 540px) {
  /* Header is a 3-column grid: [hamburger | logo | spacer]. Both ends are the
     same width so the logo lands dead-center, and every item is vertically
     centered by the grid (no absolute positioning that could drift on iOS
     when safe-area-inset-top kicks in). */
  .chrome {
    display: grid;
    grid-template-columns: 2.5rem 1fr 2.5rem;
    grid-template-rows: auto;
    grid-template-areas: none;
    align-items: center;
    column-gap: 0.5rem;
    padding-left: 0.8rem;
    padding-right: 0.8rem;
    min-height: 4rem;
  }
  .chrome > :first-child { justify-self: start; }
  .chrome > :last-child  { justify-self: end; }
  .hamburger    { display: inline-flex; grid-column: 1; justify-self: start; }
  .chrome-left  { display: none; }
  .chrome > .veg-toggle { display: none; }
  .ham-veg-row  { display: flex; }   /* mobile: veg switch lives in the menu */
  .wordmark {
    grid-column: 2;
    justify-self: center;
    pointer-events: auto;
  }
  .wm-cap { height: 40px; }
  .wm-text { font-size: 1.35rem; }
  /* Choice cards bump 10% larger on mobile. They share grid cells with the
     bigger transform; overlap with neighbors is intentional and fine. */
  .cards { gap: 0.55rem; }
  .cards .card-pick {
    touch-action: none;        /* allow pointer drag without page-scroll */
  }
  .cards .card-pick.is-dragging { z-index: 500; }
  .card-pick.is-dragging .card-deal { cursor: grabbing; }
  /* Hand row replaces the chip strip on mobile. */
  .hand { display: flex; }
  .round-trail { display: none; }
  .round-hint { font-size: 1.25rem; }
}

/* ---------- Recessive copyright link (page footer + beneath recipe) ---------- */
.page-footer {
  position: relative;
  z-index: 20;
  text-align: center;
  padding: 1.25rem 1rem 2rem;
}
/* On the recipe (reveal) stage the copyright already sits beneath the card via
   .reveal-foot, so hide the global page footer there to avoid showing it twice.
   On the round/landing stage only the page footer shows. */
body:has(#stage-reveal:not([hidden])) .page-footer { display: none; }
.reveal-foot {
  text-align: center;
  margin-top: 1.4rem;
}
.copyright-link {
  font-family: "Cormorant Garamond", serif;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.18s;
}
.copyright-link:hover, .copyright-link:focus-visible {
  color: var(--ink);
  outline: none;
}

/* ---------- Illuminated letters card + copyright card (paper panel) ---------- */
.letters-card, .copyright-card {
  position: fixed;
  inset: 0;
  z-index: 310;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.letters-card[hidden], .copyright-card[hidden] { display: none; }
.lc-backdrop, .cc-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(36, 24, 12, 0.65);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade-in 0.22s ease both;
}
.lc-panel, .cc-panel {
  position: relative;
  padding: 1.6rem 1.3rem 1.3rem;
  border-radius: 4px;
  border: 1px solid var(--ink);
  background:
    radial-gradient(140% 80% at 50% 0%, rgba(255, 240, 195, 0.65), transparent 70%),
    linear-gradient(180deg, #f6e8c5 0%, #ecdaa9 100%);
  color: var(--ink);
  box-shadow:
    0 0 0 1px rgba(24, 22, 23, 0.15) inset,
    0 1px 0 var(--ink),
    0 16px 60px rgba(0,0,0,0.5);
  animation: card-in 0.28s cubic-bezier(0.2, 0.9, 0.25, 1) both;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}
.lc-panel { width: min(40rem, 100%); }
.cc-panel { width: min(30rem, 100%); }
.lc-close, .cc-close {
  position: absolute;
  top: 0.6rem; right: 0.6rem;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
@media (hover: hover) {
  .lc-close:hover, .cc-close:hover { background: var(--ink); color: var(--paper); }
}
.lc-title, .cc-title {
  font-family: "DM Serif Display", serif;
  font-style: italic;
  font-size: 1.6rem;
  text-align: center;
  margin-bottom: 0.3rem;
}
.lc-copyright {
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1.1rem;
}
.lc-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.6rem;
}
.lc-tile {
  display: flex;
  align-items: center;
  justify-content: center;
}
/* All letters share one height; width follows each glyph's aspect ratio. */
.lc-tile img { display: block; height: clamp(2.5rem, 7vw, 4.4rem); width: auto; }
.cc-text p { margin-bottom: 0.8rem; font-size: 0.98rem; line-height: 1.6; }
.cc-text p:last-child { margin-bottom: 0; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .stage, .meal-card, .sm-panel, .dp-panel, .va-panel, .lc-panel, .cc-panel { animation: none; }
  .card-pick:nth-child(1) .card-art,
  .card-pick:nth-child(2) .card-art,
  .card-pick:nth-child(3) .card-art { animation: none; }
  .card-deal,
  .card-pick.is-flying-up .card-deal,
  .card-pick.is-flying-down .card-deal { animation: none; }
  .card-pick.is-flying-up,
  .card-pick.is-flying-down { opacity: 0; }
}
