/* extracted from style.css: chao-core-foundation */

#chao-container,
#darkchao-container,
#herochao-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ============================
   Chao + Items + Eggs (Expanded hitbox, label/title raised and consistent with zoom)
   ============================ */

/* Chao: local anchor for dot, name, title */
.chao {
  position: absolute;
  width: 48px;
  height: 48px;
  pointer-events: auto;
  image-rendering: pixelated;
  z-index: 1;
  overflow: visible;
}

.chao-ground-shadow {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 22px;
  height: 8px;
  transform: translateX(-50%);
  transform-origin: center center;
  background: radial-gradient(ellipse at center,
      rgba(0,0,0,0.34) 0%,
      rgba(0,0,0,0.16) 52%,
      rgba(0,0,0,0) 78%);
  pointer-events: none;
  z-index: 0;
}

.chao.is-flying .chao-ground-shadow {
  bottom: calc(-8px - (var(--fly-altitude, 0px) * 0.18));
  width: 18px;
  height: 6px;
}

.chao.is-swimming .chao-ground-shadow {
  display: none;
}

/* ==========================
   Chao Evolution (Phase 1)
   ========================== */
.chao-evo-dome {
  position: absolute;
  left: -24px;
  top: -32px;
  width: 96px;
  height: 96px;

  /* Evolution cocoon: opacity is animated in JS from 0 → 1 → 0.
     When opacity = 1, this must be FULLY OPAQUE (per spec). */
  background: transparent url("../assets/chao/ChaoCoccoon.png") center/contain no-repeat;
  image-rendering: pixelated;

  pointer-events: none;
  z-index: 10;
}

.chao.is-evolving {
  /* Keep the hitbox visible but locked by JS (pointer-events: none) */
}

/* Eggs and items remain absolute */
.egg,
.garden-item {
  position: absolute;
  width: 48px;
  height: 48px;
  pointer-events: auto;
  image-rendering: pixelated;
  z-index: 1;
}

.garden-decor-shadow {
  position: absolute;
  pointer-events: none;
  width: 44px;
  height: 14px;
  background: radial-gradient(ellipse at center,
      rgba(0,0,0,0.30) 0%,
      rgba(0,0,0,0.14) 58%,
      rgba(0,0,0,0) 80%);
  z-index: 0;
}

/* Expanded invisible click zone */
.chao::before,
.egg::before,
.garden-item::before {
  content: "";
  position: absolute;
  top: -8px;
  left: -8px;
  width: 64px;
  height: 64px;
  background: transparent;
  pointer-events: auto;
  z-index: 0;
}

/* Sprite layer */
.chao > img,
.egg > img,
.garden-item > img {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

/* Dot above head */
.dot {
  position: absolute;
  bottom: -8px; /* adjust this value to lower/raise */
  left: 50%;
  transform: translateX(-50%) scale(2.0);
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 3;
}

/* ============================
   Floating Chao Name + Title
   (Sprite Font Safe)
   ============================ */

.chao-label {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
  image-rendering: pixelated;
}

.chao-title {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
  image-rendering: pixelated;
}

/* ============================
   Sprite text container
   ============================ */

.chao-sprite-text {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  pointer-events: none;
  image-rendering: pixelated;

  /* CRITICAL:
     No CSS filters.
     All recoloring is done in sprite-font.js via canvas.
  */
  filter: none;
}

/* ============================
   Sprite-font color policy
   ============================ */

/*
  Name color:
    renderSpriteText(el, name, { color: "#FFFFFF" })

  Title color:
    renderSpriteText(el, title, { color: "#FFD700" })

  CSS must NEVER attempt recoloring.
*/

/* ============================
   Picked transparency
   ============================ */

.garden-item.picked {
  opacity: 0.7;
}

/* ============================
   Seed workflow visuals
   ============================ */
.garden-item.seed-item.seed-planted {
  filter: brightness(0.95);
}

.garden-item.seed-item.seed-water1 {
  filter: brightness(1.05);
}

.garden-item.seed-item.seed-water2 {
  filter: brightness(1.15);
}

/* Temp held props (shovel / bucket) */
.chao-temp-held {
  image-rendering: pixelated;
}
