/* ============================================================================
   DISH GRID — scoped styles. Everything lives under .dishgrid so it will not
   collide with the host project. UI chrome follows the Apple-page design
   family (SF stack, white cards, frosted pills).
   ============================================================================ */

.dishgrid {
  --dg-ink: #1d1d1f;
  --dg-soft: #6e6e73;
  --dg-faint: #a1a1a6;
  --dg-paper: #f7f7f7;
  --dg-line: rgba(0, 0, 0, .08);
  --dg-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  position: relative;
  overflow: hidden;
  background: var(--dg-paper);
  color: var(--dg-ink);
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  font-family: var(--dg-sans);
  -webkit-font-smoothing: antialiased;
}
.dishgrid * { box-sizing: border-box; margin: 0; padding: 0; }
.dishgrid.is-grab     { cursor: grab; }
.dishgrid.is-grabbing { cursor: grabbing; }
.dishgrid.is-pointer  { cursor: pointer; }

.dishgrid__canvas,
.dishgrid__canvas canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
}
.dishgrid__canvas { background: var(--dg-paper, #f7f7f7); }

/* floating hint pill — fades away after the first drag */
.dishgrid__hint {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5; pointer-events: none;
  display: flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: 980px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, .10);
  font-size: 14px; letter-spacing: -.01em; color: var(--dg-ink);
  white-space: nowrap;
  opacity: 1; visibility: visible;
  transition: opacity .5s ease, visibility 0s linear 0s;
  animation: dishgrid-hint-float 3.2s ease-in-out infinite;
}
.dishgrid__hint svg { width: 17px; height: 17px; display: block; color: var(--dg-soft); }
.dishgrid--dragged .dishgrid__hint,
.dishgrid.is-expanded .dishgrid__hint {
  opacity: 0; visibility: hidden;
  transition: opacity .5s ease, visibility 0s linear .5s;
}
@keyframes dishgrid-hint-float {
  0%, 100% { transform: translate(-50%, calc(-50% - 4px)); }
  50%      { transform: translate(-50%, calc(-50% + 4px)); }
}

/* close button — frosted Apple circle */
.dishgrid__close {
  position: absolute; right: 28px; top: 28px;
  width: 36px; height: 36px; z-index: 6;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 0; border-radius: 50%; padding: 0; cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .12);
  visibility: hidden; opacity: 0;
  transition: background-color .25s ease;
}
.dishgrid__close:hover { background: #ffffff; }
.dishgrid__close span {
  display: block; position: absolute; width: 14px; height: 1.5px; border-radius: 2px;
  background: var(--dg-ink); top: 50%; left: 50%;
  transition: transform .25s ease;
}
.dishgrid__close span:nth-child(1) { transform: translate(-50%, -50%) rotate(45deg); }
.dishgrid__close span:nth-child(2) { transform: translate(-50%, -50%) rotate(-45deg); }
.dishgrid__close:hover span:nth-child(1) { transform: translate(-50%, -50%) rotate(135deg); }
.dishgrid__close:hover span:nth-child(2) { transform: translate(-50%, -50%) rotate(45deg); }

/* dish detail — white Apple card on the left, image sits right */
.dishgrid__panel {
  position: absolute; left: 28px; top: 50%;
  transform: translateY(-50%) translateX(-14px);
  width: clamp(310px, 27vw, 430px); z-index: 6;
  pointer-events: none;
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .14);
  padding: 30px 28px;
  opacity: 0; visibility: hidden;
  transition: opacity .5s cubic-bezier(.16,1,.3,1), transform .5s cubic-bezier(.16,1,.3,1), visibility 0s linear .5s;
}
.dishgrid__panel.is-visible {
  opacity: 1; visibility: visible;
  transform: translateY(-50%) translateX(0);
  pointer-events: auto;
  transition: opacity .6s cubic-bezier(.16,1,.3,1), transform .6s cubic-bezier(.16,1,.3,1);
}
.dishgrid__tags {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  line-height: 1.4; color: var(--dg-soft); margin-bottom: 12px;
}
.dishgrid__name {
  font-weight: 600; font-size: clamp(22px, 2vw, 28px);
  line-height: 1.12; letter-spacing: -.02em; color: var(--dg-ink);
  margin-bottom: 8px;
}
.dishgrid__sides {
  font-size: 15px; line-height: 1.45; letter-spacing: -.016em; color: var(--dg-soft);
  margin-bottom: 24px;
}
.dishgrid__macros { border-top: 1px solid var(--dg-line); margin-bottom: 14px; }
.dishgrid__spec {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--dg-line);
}
.dishgrid__spec-lbl {
  font-size: 12px; letter-spacing: .02em; text-transform: capitalize;
  color: var(--dg-soft);
}
.dishgrid__spec-val {
  font-size: 15px; font-weight: 600; letter-spacing: -.01em;
  color: var(--dg-ink); font-variant-numeric: tabular-nums;
}
.dishgrid__serving {
  font-size: 12px; letter-spacing: -.01em;
  color: var(--dg-faint); margin-bottom: 20px;
}
.dishgrid__ing-label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dg-soft); margin-bottom: 6px;
}
.dishgrid__ing {
  font-size: 12px; line-height: 1.65; letter-spacing: -.01em; color: var(--dg-soft);
  max-height: 6.6em; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}

/* graceful fallback when WebGL is unavailable */
.dishgrid--no-webgl::after {
  content: "WebGL not available";
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--dg-sans); font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--dg-faint);
}

@media (max-width: 900px) {
  .dishgrid__panel {
    left: 12px; right: 12px; top: auto; bottom: 12px; width: auto;
    transform: translateY(14px);
    padding: 14px 16px 12px;
    max-height: none;
    overflow-x: hidden;
    overflow-y: visible;
    border-radius: 18px;
  }
  .dishgrid__panel.is-visible { transform: translateY(0); }
  .dishgrid__tags { margin-bottom: 6px; }
  .dishgrid__name { font-size: 19px; margin-bottom: 4px; }
  .dishgrid__sides { margin-bottom: 10px; font-size: 13px; }
  .dishgrid__macros { margin-bottom: 8px; }
  .dishgrid__spec { padding: 5px 0; }
  .dishgrid__spec-lbl { font-size: 11px; }
  .dishgrid__spec-val { font-size: 14px; }
  .dishgrid__serving { margin-bottom: 0; }
  /* Ingredients are secondary on phone — hide to keep the card short */
  .dishgrid__ing-label,
  .dishgrid__ing { display: none; }
  .dishgrid__close { right: 14px; top: 14px; }
  .dishgrid__hint { font-size: 13px; padding: 10px 18px; }
}

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