/* Geerho Pet (M590, TJ 2026-12-05): pet.html, the Account page's pet card and the pet card on a member's Community page.
   Colors come from hub.css's tokens, so light and dark match the site. Animations are CSS only; hub.css turns every
   animation off for people who ask for reduced motion. Nothing here may push the page sideways at phone width. */

/* --- The picture ------------------------------------------------------------------------------------------------- */
.pet-art { position: relative; display: inline-grid; place-items: center; flex: none; }
.pet-art.pet-big { width: min(300px, 72vw); aspect-ratio: 1; }
.pet-art.pet-small { width: 84px; height: 84px; }
.pet-body { position: relative; display: block; width: 100%; height: 100%; transform-origin: 50% 90%; }
.pet-body picture, .pet-img { display: block; width: 100%; height: 100%; }
.pet-img { object-fit: contain; user-select: none; -webkit-user-drag: none; transform-origin: 50% 95%;
  filter: drop-shadow(0 10px 14px rgba(12, 16, 36, .18)); animation: pet-idle 3.2s ease-in-out infinite; }
.pet-art.stage-puppy .pet-body { scale: .82; }
.pet-art.stage-young .pet-body { scale: .92; }
.pet-small.pet-art .pet-body { scale: 1; }

/* Idle: a soft bounce with a little wiggle now and then. */
@keyframes pet-idle {
  0%, 100% { transform: translateY(0) rotate(0); }
  20% { transform: translateY(-4%) rotate(0); }
  40% { transform: translateY(0) rotate(0); }
  70% { transform: translateY(0) rotate(0); }
  76% { transform: translateY(0) rotate(-4deg); }
  82% { transform: translateY(0) rotate(4deg); }
  88% { transform: translateY(0) rotate(-2deg); }
  94% { transform: translateY(0) rotate(0); }
}
/* Excited: quicker, bigger hops. */
.pet-art.mood-excited .pet-img { animation: pet-hop 1s ease-in-out infinite; }
@keyframes pet-hop { 0%, 100% { transform: translateY(0) scale(1, 1); } 15% { transform: translateY(0) scale(1.04, .94); }
  45% { transform: translateY(-9%) scale(.98, 1.03); } 75% { transform: translateY(0) scale(1.03, .97); } }
/* Sleepy: grey, drooping and slowly breathing. */
.pet-art.mood-sleepy .pet-img { filter: grayscale(.75) brightness(.92) drop-shadow(0 6px 10px rgba(12, 16, 36, .15));
  animation: pet-breathe 4.5s ease-in-out infinite; }
@keyframes pet-breathe { 0%, 100% { transform: rotate(6deg) translateY(4%) scale(1, .96); } 50% { transform: rotate(6deg) translateY(5%) scale(1.01, .93); } }
/* Hungry: a bit dull and slow. */
.pet-art.mood-hungry .pet-img { filter: saturate(.7) drop-shadow(0 8px 12px rgba(12, 16, 36, .15)); animation-duration: 5s; }

/* Hearts (excited), Zzz (sleepy), the food bubble (hungry). */
.pet-heart { position: absolute; bottom: 55%; font-size: 1.2rem; opacity: 0; pointer-events: none; animation: pet-heart 2.4s ease-out infinite; }
.pet-small .pet-heart { font-size: .7rem; }
.pet-heart.h1 { left: 18%; } .pet-heart.h2 { left: 42%; animation-delay: .6s; } .pet-heart.h3 { left: 64%; animation-delay: 1.2s; }
.pet-heart.h4 { left: 80%; animation-delay: 1.8s; }
@keyframes pet-heart { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-140%) scale(1.15); opacity: 0; } }
.pet-zzz { position: absolute; top: 8%; right: 10%; font-weight: 800; color: var(--muted); letter-spacing: .1em; font-size: 1.2rem;
  pointer-events: none; animation: pet-zzz 3s ease-in-out infinite; }
.pet-small .pet-zzz { font-size: .62rem; top: 0; right: 0; }
@keyframes pet-zzz { 0%, 100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(-10px); opacity: 1; } }
.pet-bubble { position: absolute; top: 4%; right: 6%; font-size: 1.6rem; background: var(--raised); border: 1px solid var(--rule);
  border-radius: 999px; padding: 2px 8px; box-shadow: var(--shadow); animation: pet-zzz 2.6s ease-in-out infinite; }
.pet-small .pet-bubble { font-size: .7rem; padding: 0 3px; top: -4px; right: -4px; }

/* Outfit badge (placeholder until the outfit art is made). */
.pet-outfit { position: absolute; top: 4%; left: 6%; font-size: 2rem; line-height: 1; background: var(--raised); border: 1px solid var(--rule);
  border-radius: 999px; padding: 6px; box-shadow: var(--shadow); }
.pet-small .pet-outfit { font-size: .85rem; padding: 2px; top: -2px; left: -2px; }

/* Tricks (on .pet-body, so they play on top of the idle bounce). */
.pet-body.trick-sit { animation: pet-sit 1.2s var(--ease); }
@keyframes pet-sit { 0%, 100% { transform: none; } 30%, 70% { transform: scale(1.08, .82) translateY(6%); } }
.pet-body.trick-roll { animation: pet-roll 1.3s ease-in-out; transform-origin: 50% 60%; }
@keyframes pet-roll { 0% { transform: rotate(0); } 15% { transform: translateY(6%) rotate(0); } 85% { transform: translateY(6%) rotate(360deg); } 100% { transform: rotate(360deg); } }
.pet-body.trick-dance { animation: pet-dance 1.6s ease-in-out; }
@keyframes pet-dance { 0%, 100% { transform: none; } 12% { transform: translate(-8%, -8%) rotate(-12deg); } 25% { transform: translate(0, 0) rotate(0); }
  37% { transform: translate(8%, -8%) rotate(12deg); } 50% { transform: none; } 62% { transform: translateY(-12%) scaleX(-1); }
  75% { transform: scaleX(-1); } 87% { transform: translateY(-8%); } }
.pet-body.trick-dead { animation: pet-dead 2s ease-in-out; }
@keyframes pet-dead { 0%, 100% { transform: none; } 20% { transform: translateY(-8%) rotate(-20deg); } 35%, 75% { transform: translateY(12%) rotate(100deg) scale(.95); }
  85% { transform: translateY(-6%) rotate(-8deg); } }
.pet-body.trick-nudge { animation: pet-nudge .5s ease-in-out; }
@keyframes pet-nudge { 0%, 100% { transform: none; } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }

/* --- pet.html ------------------------------------------------------------------------------------------------------ */
.pet-hero { text-align: center; overflow: hidden; }
.pet-stage-button { background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 14%, transparent), transparent);
  border: 0; padding: 8px; border-radius: 50%; box-shadow: none; display: inline-grid; place-items: center; cursor: pointer;
  -webkit-tap-highlight-color: transparent; max-width: 100%; }
.pet-stage-button:hover { filter: none; }
.pet-stage-button:active { transform: scale(.98); }
.pet-said { min-height: 1.6em; margin: 4px 0; font-weight: 700; font-size: 1.15rem; color: var(--accent); }
.pet-name-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.pet-name { margin: 0; font-size: 1.6rem; overflow-wrap: anywhere; }
.pet-mood { background: var(--tint); color: var(--text); }
.pet-mood.mood-hungry { background: color-mix(in srgb, #ff9500 18%, var(--surface)); }
.pet-mood.mood-sleepy { background: color-mix(in srgb, var(--muted) 18%, var(--surface)); }
.pet-mood.mood-excited { background: color-mix(in srgb, #ff2d55 16%, var(--surface)); }
.pet-tap-hint { margin: 4px 0 0; }
.pet-mood-line { margin: 8px 0; }
.pet-rename { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 14px; }
.pet-rename-form { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.pet-name-input { width: min(100%, 320px); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--rule); background: var(--bg); color: var(--text); font: inherit; text-align: center; }
.pet-rename-form .bad-text { margin: 0; min-height: 1em; }
.pet-btn { padding: 8px 14px; font-size: .92rem; border-radius: 10px; }
.pet-btn:disabled, .pet-card-action button:disabled { opacity: .55; cursor: default; transform: none; }
.pet-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pet-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; text-align: left; margin-top: 6px; }
.pet-stats > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pet-streak { font-size: 1.1rem; }
@media (max-width: 420px) { .pet-stats { grid-template-columns: 1fr; } }

.pet-meter { height: 10px; border-radius: 5px; background: var(--rule); overflow: hidden; }
.pet-fill { display: block; height: 100%; background: var(--good); transition: width .4s var(--ease); }
.pet-fill.warn { background: #e8a200; }
.pet-fill.bad { background: var(--bad); }

.pet-tricks { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.pet-tricks li { background: var(--raised); border: 1px solid var(--rule); border-radius: 12px; padding: 8px 12px; }
.pet-tricks li.locked { color: var(--muted); }

.pet-shop { list-style: none; padding: 0; margin: 8px 0; }
.pet-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.pet-item:first-child { border-top: 0; }
.pet-item.wearing .pet-item-emoji { outline: 2px solid var(--accent); }
.pet-item-emoji { font-size: 1.6rem; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--raised);
  border: 1px solid var(--rule); flex: none; }
.pet-item-text { display: flex; flex-direction: column; flex: 1 1 140px; min-width: 0; }
.pet-item > button, .pet-item > .pet-actions { margin-left: auto; }

/* --- The cards (Account page, a member's Community page) -------------------------------------------------------- */
.pet-card { display: flex; align-items: center; gap: 14px; color: var(--text); flex-wrap: wrap; }
a.card.pet-card { display: flex; flex-wrap: nowrap; transition: box-shadow .2s var(--ease), transform .2s var(--ease); }
a.pet-card:hover { color: var(--text); box-shadow: var(--shadow-hover); }
.pet-card-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 160px; min-width: 0; }
a.pet-card .pet-card-text { flex-basis: 0; }
.pet-card-text .pet-meter { margin: 6px 0 2px; max-width: 260px; }
.pet-card-kicker { text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; font-weight: 700; }
.pet-card-name { font-size: 1.15rem; overflow-wrap: anywhere; }
.pet-card-chev { font-size: 1.8rem; color: var(--muted); line-height: 1; }
.pet-card-action { margin-left: auto; }
.pet-card-action .button, .pet-card-action button { padding: 9px 18px; }
.pet-card-foot { flex-basis: 100%; margin: 0; }
.pet-card .pet-status { flex-basis: 100%; margin: 0; }
.pet-card .pet-status:empty { display: none; }

/* Level-up animation playing (pet-level-up.js): the still picture steps aside so there's only one Geerho on screen. */
body.pet-leveling .pet-hero .pet-art { visibility: hidden; }
