/* @blackcircuit/agent-pet — styles. Import once in the host app.

   Host-overridable custom properties (set them on .agent-pet / .activity-pet
   or any ancestor):
     --pet-hue                 0..359; the agent's hue (inline per pet).
     --pet-body                body fill (a rich, colour-forward hue).
     --pet-lit                 key light, shaped by #pet-lit-mask.
     --pet-ao                  darker underside, shaped by #pet-ao-mask.
     --pet-bounce              reflected light on the lower-left edge (#pet-bounce-mask).
     --pet-rim                 crisp rim on the lit edge (#pet-rim-mask).
     --pet-spec                glossy specular + antenna-bulb sparkle.
     --pet-shadow / --pet-floor  contact shadow core / its soft hue-tinted spill.
     --pet-stroke              antenna, ping and ripple stroke.
     --pet-glow-fill           antenna bulb glow (pulses with the mood).
     --pet-feature             leaf, inner ears.
     --pet-horn                horns.
     --pet-cheek               blush.
     --pet-eye                 eye fill (whites, catchlights).
     --pet-pupil               big-eye pupils.
     --pet-wear-dark           wearables: hat felt, cap peak, knots.
     --pet-wear-edge           thin light outline on the dark parts (reads on the
                               dark theme and on dark bodies; no filters).
     --pet-wear-accent         wearables: hat bands, beanie, cap, party hat, bows, ties
                               (the hue's complement, so it reads on any body).
     --pet-wear-gold           crown.
     --pet-wear-light          pompoms, ribbing, party-hat stripe, bow knot, sunglasses glint.
     --pet-wear-shade          sunglasses glass: opaque and dark in both themes
                               (frame, bridge: --pet-wear-accent; glint: --pet-wear-light).
     --indicator-fx-l          lightness of indicator effects (rings, trail, accent).
     --indicator-tint-approval body tint while awaiting approval.
     --indicator-tint-error    body tint on the error outro.
     --indicator-tint-glow     body tint while thinking / on the done outro.
   Light theme: :root[data-theme="light"] (the host's theme switch). */

/* --- Agent pet --------------------------------------------------------- */
.agent-pet {
  flex: 0 0 auto;
  display: block;
  /* Droplet's crown ping and the talking ripple reach past the 32×32 box. */
  overflow: visible;
}
/* Pet colour tokens (PetBody, style D). Everything derives from --pet-hue:
   the brand emerald by default, the agent's own hue when the svg carries an
   inline --pet-hue. Custom properties inherit into <use> shadow trees, so
   PetStatic copies recolour per instance. The body is a rich, colour-forward
   hue; depth comes from the masked light/AO/bounce/rim layers, not filters. */
.agent-pet {
  --pet-hue: 160;
  --pet-body: hsl(var(--pet-hue) 50% 26%);
  --pet-lit: hsl(var(--pet-hue) 74% 57%);
  --pet-ao: hsl(var(--pet-hue) 45% 4%);
  --pet-bounce: hsl(var(--pet-hue) 70% 58%);
  --pet-rim: hsl(var(--pet-hue) 80% 68%);
  --pet-spec: hsl(var(--pet-hue) 60% 97%);
  --pet-shadow: hsl(var(--pet-hue) 50% 1% / 0.95);
  --pet-floor: hsl(var(--pet-hue) 80% 55% / 0.16);
  --pet-stroke: hsl(var(--pet-hue) 75% 62%);
  --pet-glow-fill: hsl(var(--pet-hue) 85% 55% / 0.3);
  --pet-feature: hsl(var(--pet-hue) 75% 66%);
  --pet-horn: hsl(calc(var(--pet-hue) + 30) 35% 86%);
  --pet-cheek: hsl(350 90% 70% / 0.55);
  --pet-eye: #f4f7fb;
  --pet-pupil: hsl(var(--pet-hue) 45% 9%);
  --pet-wear-dark: hsl(228 16% 23%);
  --pet-wear-edge: hsl(220 35% 88% / 0.85);
  --pet-wear-accent: hsl(calc(var(--pet-hue) + 180) 78% 60%);
  --pet-wear-gold: hsl(44 95% 60%);
  --pet-wear-light: #f4f7fb;
  --pet-wear-shade: hsl(226 28% 9%);
}
/* Light theme: a softer, lighter shadow and darker accents so the pet sits on
   a light surface. The body itself stays the same rich hue. */
:root[data-theme="light"] .agent-pet,
/* Light pet tokens for one subtree, whatever the page theme (the gallery shows
   both themes side by side; hosts can use it for light cards in a dark UI). */
[data-pet-theme="light"] .agent-pet {
  --pet-stroke: hsl(var(--pet-hue) 65% 44%);
  --pet-glow-fill: hsl(var(--pet-hue) 75% 45% / 0.3);
  --pet-shadow: hsl(var(--pet-hue) 35% 14% / 0.42);
  --pet-floor: hsl(var(--pet-hue) 40% 30% / 0.1);
  --pet-feature: hsl(var(--pet-hue) 65% 52%);
  --pet-horn: hsl(calc(var(--pet-hue) + 30) 30% 80%);
  --pet-cheek: hsl(350 85% 66% / 0.6);
  --pet-wear-dark: hsl(228 20% 18%);
  --pet-wear-edge: hsl(0 0% 100% / 0.7);
  --pet-wear-accent: hsl(calc(var(--pet-hue) + 180) 70% 48%);
  --pet-wear-gold: hsl(42 90% 50%);
  --pet-wear-shade: hsl(224 22% 15%);
}
/* "Talking" ripple: two rings expanding off the antenna ping, CSS only. */
.pet-ripple circle {
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .agent-pet--talking .pet-ripple circle {
    animation: pet-ripple 1.4s ease-out infinite;
  }
  .agent-pet--talking .pet-ripple circle:nth-child(2) {
    animation-delay: 0.6s;
  }
}
@keyframes pet-ripple {
  0% {
    r: 1.6px;
    opacity: 0.75;
  }
  100% {
    r: 6px;
    opacity: 0;
  }
}
/* Activity indicator (ActivityPet): ring/trail strokes. Motion is rAF-driven.
   The body keeps the agent hue; the EFFECTS are coloured apart from it
   (triadic rings, complementary accent, two-tone streak) so each element is
   identifiable at 28px. Lightness is a token so light theme can darken it. */
.activity-pet {
  --indicator-fx-l: 64%;
  --indicator-tint-approval: hsl(40 95% 58%);
  --indicator-tint-error: var(--signal-red);
  --indicator-tint-glow: hsl(var(--pet-hue, 160) 55% 62%);
}
:root[data-theme="light"] .activity-pet {
  --indicator-fx-l: 46%;
  --indicator-tint-approval: hsl(36 92% 46%);
  --indicator-tint-glow: hsl(var(--pet-hue, 160) 60% 42%);
}
.activity-pet-ring {
  stroke-width: 0.9;
  stroke-linecap: round;
}
.activity-pet-trail {
  stroke-width: 1.5;
  stroke-linecap: round;
}
/* Dev-only pet gallery: indicator filmstrips (no .pet-gallery block exists; kept with the activity-pet rules). */
.pet-gallery-filmstrip { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 12px; }
.pet-gallery-filmstrip figure { margin: 0; display: flex; flex-direction: column; align-items: center; }
.pet-gallery-filmstrip figcaption { font-size: 9px; color: var(--ink-faint); }

/* --- Style lab (dev-only, demo/StyleLab.tsx) ---------------------------------
   D is the production look (PetBody). The other columns are the history of
   the 2026-10-05 design gate: they re-tint the production layers through
   these opt-in token overrides (the pre-D near-black body; A's lighter core). */
.pet-style--base, .pet-style--B, .pet-style--C {
  --pet-body: hsl(var(--pet-hue) 32% 11%);
  --pet-lit: hsl(var(--pet-hue) 55% 33%);
}
.pet-style--A {
  --pet-body: hsl(var(--pet-hue) 36% 15%);
  --pet-lit: hsl(var(--pet-hue) 62% 44%);
}
.style-lab-body { display: flex; flex-direction: column; gap: 18px; }
.style-lab-direction { display: flex; flex-direction: column; gap: 12px; }
.style-lab-caption { font-size: 13px; font-weight: 600; margin-bottom: 10px; opacity: 0.85; }
.style-lab-grid96 { display: grid; grid-template-columns: repeat(auto-fill, 104px); gap: 6px 4px; }
.style-lab-grid96 figure { margin: 0; display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.style-lab-grid96 figcaption, .style-lab-eyesheet figcaption { font-size: 10px; opacity: 0.55; margin-top: 2px; }
.style-lab-strip { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 14px; }
.style-lab-strip[data-size="28"] { gap: 8px; }
.style-lab-compare th { font-weight: 500; font-size: 12px; text-align: left; padding-right: 12px; white-space: nowrap; opacity: 0.8; }
.style-lab-compare td { padding: 4px 6px; }
.style-lab-compare td svg { display: inline-block; vertical-align: bottom; margin-right: 2px; }
.style-lab-eyesheet { display: grid; grid-template-columns: repeat(5, 104px); gap: 8px 4px; }
.style-lab-eyesheet figure { margin: 0; display: flex; flex-direction: column; align-items: center; }
.style-lab-pickers { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; padding: 20px; background: #0b0d10; border-radius: 14px; }
.style-lab-picker {
  width: 420px; padding: 14px; border-radius: 18px; display: flex; flex-direction: column; gap: 12px;
  background: rgba(28, 31, 36, 0.92); border: 1px solid rgba(255, 255, 255, 0.08); color: #e8eaed;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.style-lab-picker[data-light] { background: rgba(255, 255, 255, 0.96); border-color: rgba(0, 0, 0, 0.08); color: #111; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18); }
.style-lab-picker-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
.style-lab-picker-reset { font-weight: 400; opacity: 0.6; }
.style-lab-picker-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.style-lab-picker-cell {
  display: grid; place-items: center; padding: 6px 0 4px; border-radius: 14px; cursor: pointer;
  background: rgba(255, 255, 255, 0.04); border: 1px solid transparent;
}
.style-lab-picker[data-light] .style-lab-picker-cell { background: rgba(0, 0, 0, 0.035); }
.style-lab-picker-cell[aria-pressed="true"] { border-color: hsl(200 80% 60%); box-shadow: 0 0 0 1px hsl(200 80% 60%); }
.style-lab-picker-dots { display: flex; gap: 8px; justify-content: center; }
.style-lab-picker-dots span { width: 20px; height: 20px; border-radius: 50%; }
