/* ==========================================================================
   css/eggs.css — the Hatchery (js/ui/eggs.js, DECISIONS 210-212).

   Incubators are warm "nests": a soft orange glow behind the Egg, a shadow under it, a
   progress bar in egg-yolk colours. A ready incubator glows gold, its Egg wobbles and a "!"
   bobs above it (concept point 6). The hatch scene sits on the same night-blue stage as the
   evolution overlay (css/game.css .evo-overlay) with the white dialogue box of the games.
   Tokens from css/base.css; the few literal colours are the egg/stage palette.
   ========================================================================== */

.eggs-root { display: grid; gap: 12px; }
.eggs-section { display: grid; gap: 10px; align-content: start; }
.eggs-section-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.eggs-section-head h3 { margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.eggs-section-head .muted, .eggs-section-head .tag { margin-left: auto; }
.eggs-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; align-items: start; }

.egg-canvas { image-rendering: pixelated; width: 80px; height: 96px; display: block; }
.egg-canvas-sm { width: 40px; height: 48px; flex: none; }

/* What the shell shows (DECISIONS 350): js/ui/egg-art.js draws a rare form's own shell and marks the
   canvas (data-egg-form, .egg-legendary); the glow here is the one its sprite has (css/game.css
   .variant-*), and a legendary adds a golden halo. Two variables, so a legendary shiny Egg gets both.
   No animation: the Egg's own wobble (egg-wobble, egg-gift-bob) already owns `animation`. */
canvas[data-egg-form], canvas.egg-legendary {
  --egg-aura: drop-shadow(0 0 0 transparent);
  --egg-crown: drop-shadow(0 0 0 transparent);
  filter: var(--egg-crown) var(--egg-aura);
}
canvas[data-egg-form="shiny"] { --egg-aura: drop-shadow(0 0 4px rgba(255, 240, 190, 0.85)); }
canvas[data-egg-form="golden"] { --egg-aura: drop-shadow(0 0 5px rgba(255, 176, 32, 0.7)); }
canvas[data-egg-form="dark"] { --egg-aura: drop-shadow(0 0 5px rgba(167, 139, 250, 0.75)); }
canvas[data-egg-form="frozen"] { --egg-aura: drop-shadow(0 0 4px rgba(120, 220, 255, 0.8)) drop-shadow(0 0 9px rgba(80, 165, 255, 0.35)); }
canvas[data-egg-form="shadow"] { --egg-aura: drop-shadow(0 0 3px rgba(18, 8, 30, 0.9)) drop-shadow(0 0 9px rgba(72, 34, 110, 0.6)); }
canvas.egg-legendary { --egg-crown: drop-shadow(0 0 2px rgba(255, 215, 90, 0.95)) drop-shadow(0 0 10px rgba(255, 190, 60, 0.55)); }

/* The keeper's welcome Egg */
.eggs-gift {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  border: 1px solid rgba(255, 216, 107, 0.4);
  background: linear-gradient(100deg, rgba(255, 216, 107, 0.14), transparent 65%), var(--panel);
}
.eggs-gift h3 { margin: 0 0 4px; }
.eggs-gift p { margin: 0; }
.eggs-gift .egg-canvas { animation: egg-wobble 2.4s ease-in-out infinite; transform-origin: 50% 90%; }

/* Incubators */
.egg-incubators { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.incubator {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-height: 262px; padding: 12px 12px 12px; text-align: center;
  border-radius: var(--radius); border: var(--panel-border-strong);
  background: radial-gradient(circle at 50% 32%, rgba(255, 170, 80, 0.16), transparent 58%), var(--panel-2);
}
.incubator-name { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
/* The incubator itself (owner, 26 September: "je zet het ei gewoon neer" - the device was invisible): a glass
   dome over a metal base plate with a heat light, drawn in CSS around the Egg, so an incubator reads as a
   machine and not as an Egg on the floor. The light: orange while warming, gold when ready, grey when empty. */
.incubator-nest { position: relative; width: 120px; height: 112px; display: grid; place-items: end center; --inc-light: #ffb347; --inc-glow: rgba(255, 179, 71, 0.45); }
.incubator-nest::before {
  content: ''; position: absolute; left: 50%; bottom: 14px; z-index: 0; width: 92px; height: 90px; transform: translateX(-50%);
  border-radius: 46px 46px 12px 12px / 54px 54px 9px 9px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.05) 42%, rgba(120, 160, 220, 0.10));
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 -12px 20px rgba(255, 170, 80, 0.2), inset 8px 12px 14px rgba(255, 255, 255, 0.12);
}
.incubator-nest::after {
  content: ''; position: absolute; left: 50%; bottom: 0; z-index: 0; width: 112px; height: 18px; transform: translateX(-50%);
  border-radius: 9px;
  background:
    radial-gradient(circle at 86% 50%, var(--inc-light) 0 3px, var(--inc-glow) 4px, transparent 7px),
    linear-gradient(180deg, #5c6679, #2e3646);
  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.incubator-nest .egg-canvas { position: relative; z-index: 1; margin-bottom: 18px; transform-origin: 50% 90%; }
.incubator.is-empty, .incubator.is-locked { border-style: dashed; background: var(--panel-2); }
.incubator.is-empty .incubator-nest, .incubator.is-locked .incubator-nest { --inc-light: #7c8798; --inc-glow: transparent; }
.incubator.is-locked { opacity: 0.62; }
/* For sale (DECISIONS 394): the card stays readable, only the empty dome is dimmed. */
.incubator.is-for-sale { opacity: 1; border-style: solid; }
.incubator.is-for-sale .incubator-nest { opacity: 0.6; }
.incubator.is-for-sale .incubator-lock { color: var(--variant-shiny); }
.incubator .egg-buy-btn { min-width: 150px; }
.incubator-ring {
  position: relative; z-index: 1; width: 60px; height: 70px; margin-bottom: 20px;
  border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%; border: 2px dashed rgba(255, 255, 255, 0.22);
}
.incubator-lock { position: relative; z-index: 1; margin-bottom: 36px; color: var(--muted); }
.incubator.is-ready {
  border-color: var(--variant-shiny);
  box-shadow: 0 0 0 1px rgba(255, 216, 107, 0.5), 0 0 22px rgba(255, 216, 107, 0.3);
  background: radial-gradient(circle at 50% 32%, rgba(255, 216, 107, 0.26), transparent 60%), var(--panel-2);
  animation: incubator-glow 1.8s ease-in-out infinite;
}
.incubator.is-ready .incubator-nest { --inc-light: var(--variant-shiny); --inc-glow: rgba(255, 216, 107, 0.6); }
.incubator.is-ready .incubator-nest::before { border-color: rgba(255, 216, 107, 0.75); box-shadow: inset 0 -14px 24px rgba(255, 216, 107, 0.32), inset 8px 12px 14px rgba(255, 255, 255, 0.14); }
.incubator.is-ready .egg-canvas { cursor: pointer; animation: egg-wobble 1.6s ease-in-out infinite; }
.egg-bang {
  position: absolute; top: -2px; left: 50%; z-index: 2; width: 26px; height: 26px; margin-left: -13px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--variant-shiny); color: #1a1a2e; font-weight: 800; font-size: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); animation: egg-bang 1s ease-in-out infinite;
}
.egg-bar { width: 100%; height: 8px; border-radius: 4px; overflow: hidden; background: var(--hp-track); }
.egg-bar > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #f5b25e, #ffd86b); transition: width 1s linear; }
.egg-time { font-weight: 650; font-variant-numeric: tabular-nums; }
.incubator.is-ready .egg-time { color: var(--variant-shiny); }
.egg-hint { font-size: 0.8rem; line-height: 1.35; color: var(--muted); min-height: 2.2em; }
.egg-origin { font-size: 0.72rem; color: var(--muted); opacity: 0.85; }
.incubator .btn { margin-top: auto; }
.egg-hatch-btn { min-width: 110px; }
.egg-warm-icon { width: 16px; height: 16px; vertical-align: -3px; image-rendering: pixelated; }
/* Speed up with a Warm Stone: the button plus a line with its cost (DECISIONS 214). */
.egg-warm { margin-top: auto; display: grid; justify-items: center; gap: 3px; }
.egg-warm .btn { margin-top: 0; }
.egg-warm-note { font-size: 0.7rem; color: var(--muted); }

/* Egg Bag */
.egg-bag-list { display: grid; gap: 6px; }
.egg-bag-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: var(--radius-sm); background: var(--panel-2);
}
.egg-bag-row .grow { flex: 1 1 160px; min-width: 0; }
.egg-bag-title { font-weight: 600; }
.egg-bag-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Day Care */
.daycare-body { display: grid; gap: 10px; }
.daycare-body > p { margin: 0; }
.daycare-body > .btn { justify-self: start; }
.daycare-pair { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.daycare-mon {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 132px;
  padding: 10px; border-radius: var(--radius-sm); background: var(--panel-2);
}
.daycare-mon img { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; }
.daycare-mon-name { font-weight: 650; }
.daycare-heart { color: #ff8fb1; }
.daycare-mood { text-align: center; font-style: italic; display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; }
.daycare-status {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: var(--radius-sm); background: var(--panel-2);
}
.daycare-status.is-egg { background: rgba(255, 216, 107, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 216, 107, 0.4); }
.daycare-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.daycare-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.daycare-picker label { display: grid; gap: 4px; min-width: 0; }
.daycare-picker select { width: 100%; min-width: 0; }
.daycare-picker-actions { grid-column: 1 / -1; display: flex; gap: 8px; }

/* How it works */
.eggs-how { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.eggs-step { display: flex; gap: 10px; align-items: flex-start; }
.eggs-step-icon {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-light);
}

/* The menu tag and the "Egg ready" toast */
/* "3 eggs · 1 ready" behind the menu row (DECISIONS 214): neutral, green (.ok) when one is ready. */
.nav-item .egg-count-tag { font-size: 9px; padding: 0 5px; white-space: nowrap; }
.toast.egg-toast { box-shadow: inset 3px 0 0 var(--variant-shiny), var(--shadow-sm); }

@keyframes egg-wobble {
  0%, 70%, 100% { transform: rotate(0); }
  78% { transform: rotate(-7deg); }
  86% { transform: rotate(7deg); }
  94% { transform: rotate(-4deg); }
}
@keyframes egg-bang { 50% { transform: translateY(-4px); } }
@keyframes incubator-glow { 50% { box-shadow: 0 0 0 1px rgba(255, 216, 107, 0.75), 0 0 32px rgba(255, 216, 107, 0.5); } }

/* ==========================================================================
   The hatch scene (playHatch)
   ========================================================================== */
.hatch-overlay {
  position: fixed; inset: 0; z-index: 1150;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(circle at 50% 38%, #2a3470, #141a3a 70%);
  color: #fff; overflow: hidden; animation: hatch-in 0.3s ease-out;
}
.hatch-overlay::before {
  content: ''; position: fixed; inset: 0; background: #04050c; opacity: 0;
  transition: opacity 1.4s ease; pointer-events: none;
}
.hatch-overlay.dark::before { opacity: 0.86; }
.hatch-stage { position: relative; z-index: 1; width: min(70vw, 300px); aspect-ratio: 1; display: grid; place-items: center; }
.hatch-rays {
  position: absolute; inset: -45%;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.16) 0 7deg, transparent 7deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 15%, transparent 62%);
          mask: radial-gradient(circle, #000 15%, transparent 62%);
  opacity: 0; transition: opacity 1.2s; animation: hatch-spin 14s linear infinite;
}
.hatch-stage.rays-on .hatch-rays { opacity: 1; }
.hatch-egg { position: relative; z-index: 1; width: 60%; height: auto; image-rendering: pixelated; transform-origin: 50% 90%; }
/* The catch scene (js/ui/caught.js, DECISIONS 354) uses this same stage: the ball that caught it,
   big and pixel-sharp where the Egg would stand, rocking on its bottom edge. */
.caught-ball { position: relative; z-index: 1; width: 34%; height: auto; image-rendering: pixelated; transform-origin: 50% 88%; }
.hatch-egg.is-waiting { cursor: pointer; animation: egg-wobble 1.6s ease-in-out infinite; }
.hatch-shadow {
  position: absolute; left: 50%; bottom: 14%; width: 42%; height: 12px; transform: translateX(-50%);
  border-radius: 50%; background: rgba(0, 0, 0, 0.35);
}
.hatch-mon {
  position: absolute; inset: 10%; z-index: 2; width: 80%; height: 80%;
  object-fit: contain; image-rendering: pixelated; opacity: 0; transform: scale(0.7);
  transition: opacity 0.25s, transform 0.45s cubic-bezier(0.2, 1.6, 0.4, 1), filter 0.9s ease 0.25s;
}
.hatch-mon.silhouette { filter: brightness(0) invert(1) drop-shadow(0 0 14px #fff); }
.hatch-mon.show { opacity: 1; transform: scale(1); }
.hatch-shard, .hatch-spark { position: absolute; left: 50%; top: 50%; z-index: 3; pointer-events: none; }
.hatch-shard { width: 8px; height: 8px; background: #f7f0dd; border: 1px solid #6a5a48; animation: hatch-burst 1.1s ease-out forwards; }
.hatch-spark {
  width: 6px; height: 6px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 8px #fff, 0 0 16px #ffd84d; animation: hatch-burst 1.3s ease-out forwards;
}
.hatch-text {
  position: relative; z-index: 1; width: min(92vw, 520px); min-height: 5.4rem;
  padding: 14px 18px; border: 4px solid #2b2f3a; border-radius: 10px;
  background: #fbfbf7; color: #2b2f3a; box-shadow: inset 0 0 0 3px #d6d8de;
  font-size: 1.1rem; line-height: 1.45;
}
.hatch-title { font-weight: 700; }
.hatch-sub { color: #555b6e; font-size: 0.95rem; }
.hatch-variant { margin-top: 6px; }
.hatch-where { margin-top: 4px; color: #6b7185; font-size: 0.85rem; }
.hatch-actions { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.hatch-tap { animation: hatch-pulse 1.4s ease-in-out infinite; }
.hatch-skip, .hatch-sound { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 4; color: rgba(255, 255, 255, 0.8); }
.hatch-skip { right: 12px; border: 1px solid rgba(255, 255, 255, 0.35); }
.hatch-sound { left: 12px; }
.hatch-skip[hidden] { display: none; }
.hatch-flash { position: fixed; inset: 0; z-index: 10; background: #fff; opacity: 0; pointer-events: none; }
.hatch-flash.on { animation: hatch-flash 1.3s ease-out; }

@keyframes hatch-in { from { opacity: 0; } }
@keyframes hatch-spin { to { transform: rotate(360deg); } }
@keyframes hatch-flash { 15% { opacity: 1; } 100% { opacity: 0; } }
@keyframes hatch-pulse { 50% { box-shadow: 0 0 0 6px rgba(214, 69, 69, 0.25); } }
@keyframes hatch-burst {
  0% { transform: translate(-50%, -50%) rotate(0); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(var(--r, 180deg)) scale(0.2); opacity: 0; }
}

/* ==========================================================================
   The wiki (wiki.html #eggs, DECISIONS 215): the real incubator cards and menu row in one
   solid dark frame (same idea as .wiki-fight: nothing of the article column shines through),
   the twelve shells, and the end of a hatch on the night-blue stage.
   ========================================================================== */
.wiki-eggs {
  --panel: #1e2840;
  display: grid; gap: 10px; margin: 10px 0 18px; padding: 10px;
  background: #0d1524; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: var(--radius); box-shadow: var(--shadow);
}
.wiki-eggs figcaption { font-size: 0.82rem; line-height: 1.5; color: var(--muted); }
.text-page main .wiki-eggs a { text-decoration: none; }
.wiki-egg-menu { width: 236px; padding: 6px; border-radius: var(--radius-sm); background: var(--panel); }
.wiki-egg-menu .nav-item { background: var(--accent-soft); cursor: default; }
.wiki-egg-looks { display: grid; grid-template-columns: repeat(6, 80px); justify-content: center; gap: 6px 14px; margin: 6px 0 14px; }
.wiki-egg-looks canvas { width: 80px; height: 96px; image-rendering: pixelated; }
/* The special Eggs with their chip under them (DECISIONS 350); Legendary gets a gold chip of its own. */
.wiki-egg-form { display: grid; justify-items: center; gap: 6px; }
/* In the colours of the new chips (DECISIONS 473): old gold, a gold edge, no icon. */
.wiki-egg-form .variant-label.legendary {
  --c0: #2e2408; --c1: #3f320c; --c2: #574512; --edge: #d9b23c; --label: #ffd75a;
  --ring: #1c1604; --hi: #b99a3a; --lo: #1a1403;
}
.wiki-hatch {
  display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 6px 0 18px; padding: 16px 12px 18px;
  border-radius: var(--radius); border: 1px solid rgba(255, 255, 255, 0.1); overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #2a3470, #141a3a 70%);
}
.wiki-hatch-stage { position: relative; width: 150px; height: 130px; display: grid; place-items: center; }
.wiki-hatch-stage .hatch-rays { opacity: 1; inset: -35%; }
.wiki-hatch-stage .sprite { position: relative; z-index: 1; width: 112px; height: 112px; object-fit: contain; }
.wiki-hatch .hatch-text { width: min(100%, 460px); min-height: 0; }
@media (max-width: 600px) {
  .wiki-egg-looks { grid-template-columns: repeat(3, 80px); }
  .wiki-egg-menu { width: 100%; }
}

/* Phone: two incubators per row, the pair picker in one column. */
@media (max-width: 520px) {
  .egg-incubators { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .incubator { min-height: 240px; padding: 10px 8px; }
  .incubator-nest { width: 100px; }
  .incubator-nest::before { width: 78px; height: 82px; bottom: 13px; }
  .incubator-nest::after { width: 96px; height: 16px; }
  .daycare-picker { grid-template-columns: 1fr; }
  .eggs-two { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .eggs-gift .egg-canvas, .incubator.is-ready, .incubator.is-ready .egg-canvas, .egg-bang,
  .hatch-egg.is-waiting, .hatch-rays, .hatch-tap, .hatch-flash.on, .hatch-overlay { animation: none; }
  .hatch-shard, .hatch-spark { display: none; }
}

/* An admin's message under a gift Egg in the Egg Bag (DECISIONS 300). */
.egg-note { font-size: 0.78rem; font-style: italic; color: #ffe28a; margin: 1px 0 2px; }

/* The pop-up for an admin's gift Eggs (js/ui/egggift.js, DECISIONS 303): the Eggs in their own colours,
   bobbing one after the other like an Egg that is about to move, above the message. */
.egg-gift { display: grid; gap: 8px; text-align: center; }
.egg-gift-eggs {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 6px;
  padding: 10px 0 4px; border-radius: var(--radius-sm);
  background: radial-gradient(ellipse at 50% 80%, rgba(255, 226, 138, 0.18), transparent 70%);
}
.egg-gift-egg { width: 64px; height: 77px; image-rendering: pixelated; transform-origin: 50% 90%; animation: egg-gift-bob 1.8s ease-in-out infinite both; }
.egg-gift-more { font-weight: 800; color: var(--muted); align-self: center; }
.egg-gift-lead { margin: 0; font-weight: 700; font-size: 1.02rem; }
.egg-gift-note { margin: 0 auto; max-width: 34em; padding: 6px 10px; border-left: 3px solid #ffe28a; border-radius: 4px; background: rgba(255, 226, 138, 0.1); font-style: italic; color: #ffe9a8; text-align: left; }
@keyframes egg-gift-bob { 0%, 70%, 100% { rotate: 0deg; } 78% { rotate: -7deg; } 86% { rotate: 6deg; } 93% { rotate: -3deg; } }
@media (prefers-reduced-motion: reduce) { .egg-gift-egg { animation: none; } }
