/* ============================================================
   LT-01 Desktop Pet — floating holo companion on Agency Home
   ============================================================ */
.lt-pet {
  --lt-pet-size: 112px;
  position: fixed;
  z-index: 80;
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  max-width: min(280px, calc(100vw - 1.5rem));
  font-family: "Share Tech Mono", ui-monospace, monospace;
  pointer-events: none;
  animation: lt-pet-in 0.55s ease-out;
}

.lt-pet.is-hidden {
  display: none !important;
}

@keyframes lt-pet-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.lt-pet-controls {
  display: flex;
  gap: 0.25rem;
  pointer-events: auto;
}

.lt-pet-ctrl {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid rgba(100, 255, 160, 0.35);
  background: rgba(6, 16, 12, 0.85);
  color: #7dffb0;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lt-pet-ctrl:hover {
  border-color: #ff9a4a;
  color: #ffb070;
}

.lt-pet-ctrl:focus-visible {
  outline: 2px solid #ff9a4a;
  outline-offset: 1px;
}

.lt-pet-bubble {
  pointer-events: none;
  max-width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 6px 6px 2px 6px;
  border: 1px solid rgba(100, 255, 160, 0.4);
  background: rgba(4, 18, 12, 0.94);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(40, 255, 140, 0.12);
  color: #9dffc0;
  font-size: 0.72rem;
  line-height: 1.4;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.lt-pet-bubble.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.lt-pet-bubble::after {
  content: "";
  position: absolute;
  /* decorative only — bubble is not position relative needed for simple look */
}

.lt-pet-shell {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.lt-pet-frame {
  position: relative;
  width: var(--lt-pet-size);
  height: var(--lt-pet-size);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(80, 255, 180, 0.45);
  background: #000;
  cursor: pointer;
  box-shadow:
    0 0 28px rgba(40, 255, 140, 0.28),
    0 10px 28px rgba(0, 0, 0, 0.5),
    inset 0 0 18px rgba(0, 255, 120, 0.08);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.lt-pet-frame:hover {
  border-color: rgba(255, 154, 74, 0.55);
  box-shadow:
    0 0 36px rgba(255, 140, 40, 0.25),
    0 0 28px rgba(40, 255, 140, 0.3),
    0 10px 28px rgba(0, 0, 0, 0.5);
}

.lt-pet-frame:focus-visible {
  outline: 2px solid #ff9a4a;
  outline-offset: 2px;
}

.lt-pet.is-eo .lt-pet-frame {
  border-color: rgba(248, 113, 113, 0.65);
  box-shadow:
    0 0 30px rgba(248, 80, 80, 0.35),
    0 0 24px rgba(40, 255, 140, 0.2);
}

.lt-pet-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  filter: contrast(1.12) saturate(1.2);
  mix-blend-mode: screen;
  animation: lt-pet-breathe 4s ease-in-out infinite;
  transition: opacity 0.35s ease;
}

.lt-pet-img.is-swap {
  opacity: 0;
}

.lt-pet-frame.is-glitch .lt-pet-img {
  animation: lt-pet-glitch 0.32s steps(2) 1;
}

@keyframes lt-pet-breathe {
  0%,
  100% {
    opacity: 0.9;
    filter: contrast(1.1) brightness(1);
  }
  50% {
    opacity: 1;
    filter: contrast(1.15) brightness(1.08);
  }
}

@keyframes lt-pet-glitch {
  0% {
    transform: translate(0, 0);
  }
  30% {
    transform: translate(-2px, 1px);
  }
  60% {
    transform: translate(2px, -1px);
  }
  100% {
    transform: translate(0, 0);
  }
}

.lt-pet-scan {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 140, 0.05) 2px,
    rgba(0, 255, 140, 0.05) 4px
  );
}

.lt-pet-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: #ff9a4a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.lt-pet-id {
  color: #7dffb0;
}

.lt-pet-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: center;
  pointer-events: auto;
}

.lt-pet-link {
  pointer-events: auto;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: #60a5fa;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.lt-pet-link:hover {
  color: #ffb070;
  border-bottom-color: rgba(255, 176, 112, 0.5);
}

.lt-pet-link-ext {
  color: #b8c98a;
}

.lt-pet-link-ext:hover {
  color: #d4e8a8;
  border-bottom-color: rgba(184, 201, 138, 0.5);
}

/* Minimized: tiny chip */
.lt-pet.is-minimized .lt-pet-bubble,
.lt-pet.is-minimized .lt-pet-link,
.lt-pet.is-minimized .lt-pet-links,
.lt-pet.is-minimized .lt-pet-meta {
  display: none;
}

.lt-pet.is-minimized .lt-pet-frame {
  --lt-pet-size: 56px;
  width: 56px;
  height: 56px;
}

.lt-pet.is-minimized {
  max-width: none;
}

/* Speaking pulse */
.lt-pet.is-speaking .lt-pet-frame {
  box-shadow:
    0 0 32px rgba(40, 255, 140, 0.4),
    0 10px 28px rgba(0, 0, 0, 0.5);
}

@media (max-width: 640px) {
  .lt-pet {
    --lt-pet-size: 72px;
    right: max(0.35rem, env(safe-area-inset-right, 0px));
    bottom: max(0.35rem, env(safe-area-inset-bottom, 0px));
    max-width: min(200px, calc(100vw - 1rem));
  }

  .lt-pet-bubble {
    font-size: 0.62rem;
    padding: 0.4rem 0.5rem;
    max-width: 11rem;
  }

  /* Don't cover primary CTAs / Blue Channel — keep compact */
  .lt-pet:not(.is-minimized) .lt-pet-frame {
    width: 68px;
    height: 68px;
  }

  .lt-pet-controls {
    gap: 0.2rem;
  }

  .lt-pet-ctrl {
    min-width: 32px;
    min-height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lt-pet,
  .lt-pet-img,
  .lt-pet-bubble {
    animation: none !important;
    transition: none !important;
  }
}
