/* ==========================================================================
   Daftar — Hind AI assistant (click-to-open)
   Hind = Hindustan / al-Hind (land beyond the Indus). Character: monsoon clerk
   with a soft knowledge-cloud on his head. anime.js for panel motion.
   ========================================================================== */

.hind-fab {
  position: fixed;
  inset-inline-end: max(1rem, env(safe-area-inset-right));
  inset-block-end: max(1rem, env(safe-area-inset-bottom));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 1.05rem 0.45rem 0.45rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--accent-on);
  font: inherit;
  font-weight: 700;
  font-size: var(--text-sm);
  cursor: pointer;
  box-shadow: var(--shadow-lift);
}

.hind-fab:hover { transform: translateY(-2px); }
.hind-fab[aria-expanded="true"] {
  background: var(--bg-card);
  color: var(--ink);
}

.hind-backdrop {
  position: fixed;
  inset: 0;
  z-index: 85;
  background: oklch(0% 0 0 / 0.35);
}

.hind-panel {
  position: fixed;
  z-index: 90;
  inset-inline-end: max(1rem, env(safe-area-inset-right));
  inset-block-end: max(4.5rem, calc(env(safe-area-inset-bottom) + 4.25rem));
  width: min(24rem, calc(100vw - 2rem));
  max-height: min(34rem, calc(100vh - 6rem));
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  box-shadow: var(--shadow-page);
  overflow: hidden;
}

.hind-panel[hidden],
.hind-backdrop[hidden] { display: none !important; }

.hind-panel__head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--highlight) 12%, transparent) 0%, transparent 42%),
    var(--bg-sunk);
}

.hind-panel__titles { flex: 1; min-width: 0; }
.hind-panel__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
}
.hind-panel__tag {
  margin: 0.1rem 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.hind-panel__close {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
}

/* —— Hind the monsoon clerk ———————————————————————————————————————————— */

.hind-mascot {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0;
}

.hind-mascot__svg {
  display: block;
  overflow: visible;
}

.hind-mascot__cloud {
  transform-origin: 40px 14px;
  animation: hind-cloud-drift 4.5s ease-in-out infinite;
  filter: drop-shadow(0 2px 0 color-mix(in oklab, var(--ink) 12%, transparent));
}

.hind-mascot__puff {
  fill: #dfe7ef;
  stroke: #1a1a1a;
  stroke-width: 1.55;
}

.hind-fab[aria-expanded="false"] .hind-mascot__puff {
  fill: #cfd8e3;
  stroke: #f0f0ee;
}

.hind-mascot__saffron {
  fill: var(--highlight, #f4a261);
  stroke: #1a1a1a;
  stroke-width: 1.2;
}

.hind-mascot__head {
  fill: #f7f1e8;
  stroke: #1a1a1a;
  stroke-width: 2;
}

.hind-mascot__torso {
  fill: #1a1a1a;
  stroke: #1a1a1a;
  stroke-width: 1;
}

.hind-mascot__eye {
  fill: #1a1a1a;
  transform-origin: center;
  animation: hind-blink 5.5s ease-in-out infinite;
}

.hind-mascot__eye--r { animation-delay: 0.12s; }

.hind-mascot__smile {
  stroke: #1a1a1a;
  fill: none;
}

.hind-mascot__rain {
  fill: var(--highlight, #f4a261);
  opacity: 0;
}

.hind-mascot__body {
  transform-origin: 40px 84px;
  animation: hind-breathe 3.2s ease-in-out infinite;
}

.hind-mascot__caption {
  margin-top: 0.15rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.2;
}

.hind-mascot--fab {
  width: 2.35rem;
  height: 2.55rem;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #2a2a2a, #0d0d0d 70%);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.hind-fab[aria-expanded="true"] .hind-mascot--fab {
  background: radial-gradient(circle at 40% 28%, #fff8ef, #e8e4dc 75%);
  border: 1px solid var(--border);
}

.hind-mascot--fab .hind-mascot__svg {
  width: 1.85rem;
  height: 2.2rem;
  margin-top: 0.15rem;
}

.hind-mascot--panel {
  width: 3.6rem;
  min-height: 4.1rem;
}

.hind-mascot--panel .hind-mascot__svg {
  width: 3.4rem;
  height: 4rem;
}

/* Moods */
.hind-mascot[data-mood="think"] .hind-mascot__cloud {
  animation: hind-cloud-think 0.9s ease-in-out infinite;
}

.hind-mascot[data-mood="think"] .hind-mascot__eye {
  animation: none;
  transform: scaleY(0.35);
}

.hind-mascot[data-mood="think"] .hind-mascot__smile {
  d: path("M34 58.5 Q40 56.5 46 58.5");
}

.hind-mascot[data-mood="speak"] .hind-mascot__rain {
  animation: hind-rain 1.1s ease-out infinite;
}

.hind-mascot[data-mood="speak"] .hind-mascot__cloud {
  animation: hind-cloud-speak 1.4s ease-in-out infinite;
}

.hind-mascot[data-mood="speak"] .hind-mascot__smile {
  d: path("M32 56.5 Q40 64.5 48 56.5");
}

.hind-mascot[data-mood="listen"] .hind-mascot__body {
  animation: hind-lean 1.6s ease-in-out infinite;
}

@keyframes hind-cloud-drift {
  0%, 100% { transform: translate(0, 0) rotate(-1deg); }
  50% { transform: translate(1.5px, -2px) rotate(1.5deg); }
}

@keyframes hind-cloud-think {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(0, -3px) scale(1.08); }
}

@keyframes hind-cloud-speak {
  0%, 100% { transform: translate(0, 0); }
  40% { transform: translate(0, -2px) scale(1.04); }
  70% { transform: translate(0, 0) scale(0.98); }
}

@keyframes hind-breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.5px); }
}

@keyframes hind-lean {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-3deg); }
}

@keyframes hind-blink {
  0%, 46%, 52%, 100% { transform: scaleY(1); }
  49% { transform: scaleY(0.12); }
}

@keyframes hind-rain {
  0% { opacity: 0; transform: translateY(-2px); }
  35% { opacity: 0.95; }
  100% { opacity: 0; transform: translateY(10px); }
}

.hind-panel__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem 0.85rem 0;
}

.hind-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 650;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
}
.hind-chip:hover { border-color: var(--ink); }

.hind-panel__log {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 12rem;
}

.hind-bubble {
  max-width: 95%;
  padding: 0.65rem 0.8rem;
  border-radius: 0.85rem;
  font-size: var(--text-sm);
  line-height: 1.45;
}
.hind-bubble--bot {
  align-self: flex-start;
  background: var(--bg-sunk);
  color: var(--text);
}
.hind-bubble--user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--accent-on);
}
.hind-bubble__links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.55rem;
}
.hind-bubble__links a {
  color: inherit;
  font-weight: 650;
  font-size: var(--text-xs);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.hind-bubble--bot .hind-bubble__links a { color: var(--place); }

.hind-panel__form {
  display: flex;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--border);
}
.hind-panel__input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--bg);
  color: var(--text);
}
.hind-panel__send {
  appearance: none;
  border: 0;
  background: var(--ink);
  color: var(--accent-on);
  font: inherit;
  font-weight: 700;
  font-size: var(--text-sm);
  padding: 0.6rem 0.9rem;
  border-radius: 0.65rem;
  cursor: pointer;
}

.hind-panel__disc {
  margin: 0;
  padding: 0 0.85rem 0.75rem;
  font-size: 0.7rem;
  color: var(--text-faint);
  line-height: 1.35;
}

@media (max-width: 30rem) {
  .hind-panel {
    inset-inline: 0.5rem;
    width: auto;
    inset-block-end: max(4.25rem, calc(env(safe-area-inset-bottom) + 4rem));
    max-height: min(70vh, 32rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hind-fab:hover { transform: none; }
  .hind-mascot__cloud,
  .hind-mascot__body,
  .hind-mascot__eye,
  .hind-mascot__rain,
  .hind-mascot[data-mood="think"] .hind-mascot__cloud,
  .hind-mascot[data-mood="speak"] .hind-mascot__cloud,
  .hind-mascot[data-mood="speak"] .hind-mascot__rain,
  .hind-mascot[data-mood="listen"] .hind-mascot__body {
    animation: none !important;
  }
  .hind-mascot[data-mood="speak"] .hind-mascot__rain {
    opacity: 0.7;
  }
}
