/* Product inspection window + Christmas ham visualization */

.chamber-window {
  position: relative;
  border-radius: 6px;
  border: 4px solid #3a4a59;
  background: linear-gradient(160deg, var(--win-top, #b9c9d6), var(--win-bot, #8aa3b5));
  box-shadow: inset 0 0 28px rgba(0,0,0,0.35), inset 0 2px 10px rgba(255,255,255,0.3);
  overflow: hidden;
  aspect-ratio: 300 / 230;
  transition: background 1.2s linear;
}
.ham-svg { position: relative; z-index: 2; width: 100%; height: 100%; display: block; }

/* Optional photographic product images (one per stage). When present they
   replace the SVG; the atmospheric overlays (frost/steam/glow) still apply. */
.ham-photo { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 2; transition: opacity 1s linear; }
.chamber-window.has-photo .ham-svg { visibility: hidden; }
/* photographic stages carry their own frost; keep steam/glow, drop glass frost */
.chamber-window.has-photo .frost-overlay { display: none; }

/* smooth morph between cooking stages */
.ham-body, .ham-fat, .ham-gloss, .ham-frost, .ham-char, .ham-juice,
.ham-score g, .ham-cloves {
  transition: fill 1.4s linear, opacity 1.4s linear, stroke 1.4s linear;
}

/* overlays (window glass) */
.frost-overlay, .glow-overlay {
  position: absolute; inset: 0; z-index: 3; pointer-events: none; transition: opacity 1.2s linear;
}
.frost-overlay {
  opacity: 0;
  background:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,0.8) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 16%, rgba(255,255,255,0.7) 0 2px, transparent 3px),
    radial-gradient(circle at 88% 72%, rgba(255,255,255,0.7) 0 2px, transparent 3px),
    radial-gradient(circle at 12% 82%, rgba(255,255,255,0.6) 0 1.5px, transparent 3px),
    linear-gradient(180deg, rgba(228,241,251,0.4), rgba(210,230,245,0.15));
  mix-blend-mode: screen;
}
.glow-overlay {
  opacity: 0;
  background: radial-gradient(ellipse at 50% 72%, var(--glow, #ff8a2e55) 0%, transparent 65%);
  mix-blend-mode: screen;
}

/* steam */
.steam { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; transition: opacity 1s linear; }
.steam span {
  position: absolute; bottom: 44%; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.7), rgba(255,255,255,0));
  animation: rise 3.4s ease-in infinite;
}
.steam span:nth-child(1) { left: 36%; animation-delay: 0s; }
.steam span:nth-child(2) { left: 46%; animation-delay: 0.8s; }
.steam span:nth-child(3) { left: 54%; animation-delay: 1.5s; }
.steam span:nth-child(4) { left: 62%; animation-delay: 2.1s; }
.steam span:nth-child(5) { left: 50%; animation-delay: 2.7s; }
@keyframes rise {
  0% { transform: translateY(0) scale(0.6); opacity: 0; }
  25% { opacity: 0.75; }
  100% { transform: translateY(-120px) scale(2.4); opacity: 0; }
}

.chamber-readout {
  position: absolute; top: 8px; right: 10px; z-index: 5;
  background: rgba(20,30,40,0.68); color: #eafff0;
  font-size: 13px; font-weight: 700; padding: 3px 8px; border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.2);
}
.ham-message {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 5;
  background: rgba(150,20,15,0.9); color: #fff; font-family: var(--mono);
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 3px;
  letter-spacing: 0.5px; white-space: nowrap; opacity: 0; transition: opacity 0.5s;
}
.ham-message.show { opacity: 1; }

/* ---- stage palettes (meat hue only; form/texture come from SVG overlays) ---- */
.chamber-window[data-stage="frozen"]     { --win-top:#c6d6e2; --win-bot:#90a9bb; --ham-color:#ccb4ac; --ham-stroke:#a1897f; --ham-score:#00000022; }
.chamber-window[data-stage="thawing"]    { --win-top:#c4d0d7; --win-bot:#94a7b3; --ham-color:#d2a89b; --ham-stroke:#a87b6d; --ham-score:#0000002b; }
.chamber-window[data-stage="thawed"]     { --win-top:#ccccc8; --win-bot:#a09a94; --ham-color:#d68f7f; --ham-stroke:#aa6456; --ham-score:#00000033; }
.chamber-window[data-stage="heating"]    { --win-top:#d8c3ac; --win-bot:#b08f6a; --ham-color:#c76f52; --ham-stroke:#9c4e35; --ham-score:#3a1a0a40; --glow:#ff9a3e33; }
.chamber-window[data-stage="cooking"]    { --win-top:#e0b78a; --win-bot:#b37a44; --ham-color:#b35d33; --ham-stroke:#8a3f20; --ham-score:#3a1a0a55; --glow:#ff8a2e66; }
.chamber-window[data-stage="perfect"]    { --win-top:#e9c08a; --win-bot:#bd7f44; --ham-color:#99501f; --ham-stroke:#6f380f; --ham-score:#2a140866; --ham-clove:#2a1608aa; --glow:#ffb14a88; }
.chamber-window[data-stage="overcooked"] { --win-top:#caa070; --win-bot:#8f5e30; --ham-color:#6d3817; --ham-stroke:#49240d; --ham-score:#1a0d0577; --glow:#d65a2088; }
.chamber-window[data-stage="burned"]     { --win-top:#7c6a58; --win-bot:#4a3a2e; --ham-color:#2f231d; --ham-stroke:#17100c; --ham-score:#00000055; --glow:#aa2a1577; }

/* glaze sheen ramp */
.chamber-window .ham-gloss { opacity: 0.2; }
.chamber-window[data-stage="frozen"]     .ham-gloss { opacity: 0.05; }
.chamber-window[data-stage="thawing"]    .ham-gloss { opacity: 0.08; }
.chamber-window[data-stage="thawed"]     .ham-gloss { opacity: 0.20; }
.chamber-window[data-stage="heating"]    .ham-gloss { opacity: 0.34; }
.chamber-window[data-stage="cooking"]    .ham-gloss { opacity: 0.58; }
.chamber-window[data-stage="perfect"]    .ham-gloss { opacity: 0.82; }
.chamber-window[data-stage="overcooked"] .ham-gloss { opacity: 0.45; }
.chamber-window[data-stage="burned"]     .ham-gloss { opacity: 0.12; }

/* frost on the meat */
.chamber-window[data-stage="frozen"]  .ham-frost { opacity: 0.88; }
.chamber-window[data-stage="thawing"] .ham-frost { opacity: 0.4; }

/* window frost (chamber glass) */
.chamber-window[data-stage="frozen"]  .frost-overlay { opacity: 0.6; }
.chamber-window[data-stage="thawing"] .frost-overlay { opacity: 0.28; }

/* caramelised / charred speckle */
.chamber-window[data-stage="cooking"]    .ham-char { opacity: 0.18; }
.chamber-window[data-stage="perfect"]    .ham-char { opacity: 0.3; }
.chamber-window[data-stage="overcooked"] .ham-char { opacity: 0.6; }
.chamber-window[data-stage="burned"]     .ham-char { opacity: 0.95; }

/* rendered juices in the pan */
.chamber-window .ham-juice { opacity: 0; }
.chamber-window[data-stage="thawed"]     .ham-juice { opacity: 0.3; }
.chamber-window[data-stage="heating"]    .ham-juice { opacity: 0.5; }
.chamber-window[data-stage="cooking"]    .ham-juice { opacity: 0.7; }
.chamber-window[data-stage="perfect"]    .ham-juice { opacity: 0.7; }
.chamber-window[data-stage="overcooked"] .ham-juice { opacity: 0.55; }
.chamber-window[data-stage="burned"]     .ham-juice { opacity: 0.4; }

/* glow + steam per stage */
.chamber-window[data-stage="heating"]    .glow-overlay { opacity: 0.4; }
.chamber-window[data-stage="cooking"]    .glow-overlay { opacity: 0.7; }
.chamber-window[data-stage="perfect"]    .glow-overlay { opacity: 0.85; }
.chamber-window[data-stage="overcooked"] .glow-overlay { opacity: 0.8; }
.chamber-window[data-stage="burned"]     .glow-overlay { opacity: 0.6; }
.chamber-window[data-stage="heating"]    .steam { opacity: 0.5; }
.chamber-window[data-stage="cooking"]    .steam { opacity: 0.9; }
.chamber-window[data-stage="perfect"]    .steam { opacity: 1; }
.chamber-window[data-stage="overcooked"] .steam { opacity: 0.8; }
.chamber-window[data-stage="burned"]     .steam { opacity: 0.7; }
.chamber-window[data-stage="burned"] .steam span { background: radial-gradient(circle, rgba(70,70,70,0.8), rgba(70,70,70,0)); }
.chamber-window[data-stage="perfect"] .ham-body { filter: drop-shadow(0 0 7px #ffcf7f66); }

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