/* ═══════════════════════════════════════════════════
   Samarth's Assistant — floating blob + chat panel
   Self-contained: defines its own fallbacks so it works
   on index.html (inline styles) and the site.css pages.
══════════════════════════════════════════════════ */
.sa-root {
  --sa-bone: #f4ecd8;
  --sa-cream: #ede3c9;
  --sa-ink: #141210;
  --sa-forest: #1f3a2a;
  --sa-lime: #c6e36b;
  --sa-terra: #e25a2a;
  --sa-mustard: #e8b53a;

  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 400;
  font-family: 'Inter', system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* ── the blob ── */
.sa-blob {
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 3px solid var(--sa-ink);
  background: var(--sa-forest);
  box-shadow: 4px 4px 0 var(--sa-ink);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: saBreathe 4s ease-in-out infinite;
}
.sa-blob:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--sa-ink); }
.sa-blob:active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--sa-ink); }
.sa-blob:focus-visible { outline: 3px solid var(--sa-mustard); outline-offset: 3px; }

@keyframes saBreathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.045); }
}

/* the siri-ish drifting colour field */
.sa-blob i {
  position: absolute;
  border-radius: 50%;
  filter: blur(9px);
  opacity: 0.95;
  display: block;
}
.sa-blob i:nth-child(1) { width: 42px; height: 42px; background: var(--sa-lime);    top: 4px;  left: 2px;  animation: saDrift1 5.5s ease-in-out infinite; }
.sa-blob i:nth-child(2) { width: 34px; height: 34px; background: var(--sa-terra);   top: 20px; left: 24px; animation: saDrift2 6.5s ease-in-out infinite; }
.sa-blob i:nth-child(3) { width: 26px; height: 26px; background: var(--sa-mustard); top: 2px;  left: 26px; animation: saDrift3 7.5s ease-in-out infinite; }

@keyframes saDrift1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(9px,7px) scale(1.15); } }
@keyframes saDrift2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-11px,-8px) scale(0.85); } }
@keyframes saDrift3 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-6px,12px) scale(1.2); } }

.sa-blob b {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Archivo Black', system-ui, sans-serif;
  font-size: 21px; color: var(--sa-ink);
  text-shadow: 0 1px 0 rgba(244,236,216,0.55);
}

.sa-badge {
  position: absolute; top: -3px; right: -3px;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--sa-terra); border: 2px solid var(--sa-ink);
  display: none;
}
.sa-root.has-unread .sa-badge { display: block; }

/* ── panel ── */
.sa-panel {
  width: 358px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 130px);
  background: var(--sa-bone);
  border: 3px solid var(--sa-ink);
  box-shadow: 6px 6px 0 var(--sa-ink);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.sa-root.is-open .sa-panel { display: flex; }

.sa-head {
  background: var(--sa-forest);
  border-bottom: 3px solid var(--sa-ink);
  padding: 13px 14px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.sa-head-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sa-lime); flex-shrink: 0; animation: saPulse 1.9s ease-in-out infinite; }
@keyframes saPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.sa-head-txt { flex: 1; min-width: 0; }
.sa-head-title {
  font-family: 'Anton', 'Archivo Black', system-ui, sans-serif;
  font-size: 16px; letter-spacing: 0.7px; text-transform: uppercase;
  color: var(--sa-bone); line-height: 1.1;
}
.sa-head-sub {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--sa-lime); margin-top: 2px;
}
.sa-close {
  background: var(--sa-bone); border: 2px solid var(--sa-ink);
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; color: var(--sa-ink); font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-family: inherit; padding: 0;
}
.sa-close:hover { background: var(--sa-terra); color: var(--sa-bone); }

/* ── messages ── */
.sa-log {
  flex: 1; overflow-y: auto; padding: 16px 14px;
  display: flex; flex-direction: column; gap: 11px;
  background: var(--sa-cream);
  background-image:
    linear-gradient(rgba(20,18,16,0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20,18,16,0.055) 1px, transparent 1px);
  background-size: 26px 26px;
}
.sa-msg { max-width: 84%; font-size: 14px; line-height: 1.5; padding: 10px 12px; border: 2px solid var(--sa-ink); white-space: pre-wrap; word-wrap: break-word; }
.sa-msg.bot     { align-self: flex-start; background: var(--sa-bone); box-shadow: 3px 3px 0 rgba(20,18,16,0.18); }
.sa-msg.visitor { align-self: flex-end;  background: var(--sa-lime); box-shadow: 3px 3px 0 rgba(20,18,16,0.18); }
.sa-msg.samarth { align-self: flex-start; background: var(--sa-terra); color: var(--sa-bone); box-shadow: 3px 3px 0 var(--sa-ink); }
.sa-who {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 8.5px; letter-spacing: 1.6px; text-transform: uppercase;
  font-weight: 700; margin-bottom: 5px; opacity: 0.8;
}
.sa-note {
  align-self: center; text-align: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9.5px; letter-spacing: 1.2px; text-transform: uppercase;
  color: rgba(20,18,16,0.55); padding: 3px 0;
}

.sa-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px; border: 2px solid var(--sa-ink); background: var(--sa-bone); }
.sa-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--sa-ink); animation: saBounce 1.1s ease-in-out infinite; }
.sa-typing span:nth-child(2) { animation-delay: 0.15s; }
.sa-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes saBounce { 0%,60%,100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* ── note-taking form ── */
.sa-form { border: 2px solid var(--sa-ink); background: var(--sa-bone); box-shadow: 3px 3px 0 var(--sa-ink); padding: 13px; align-self: stretch; }
.sa-form h4 {
  font-family: 'Anton', 'Archivo Black', system-ui, sans-serif;
  font-size: 15px; text-transform: uppercase; letter-spacing: 0.4px; margin: 0 0 3px;
}
.sa-form .sa-form-sub { font-size: 12px; color: rgba(20,18,16,0.66); margin-bottom: 11px; line-height: 1.4; }
.sa-field { margin-bottom: 9px; }
.sa-field label {
  display: block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9px; letter-spacing: 1.3px; text-transform: uppercase;
  color: rgba(20,18,16,0.6); margin-bottom: 4px; font-weight: 500;
}
.sa-field input, .sa-field textarea, .sa-field select {
  width: 100%; font-family: inherit; font-size: 13.5px; color: var(--sa-ink);
  background: var(--sa-cream); border: 2px solid var(--sa-ink); padding: 8px 9px;
  border-radius: 0; -webkit-appearance: none; appearance: none;
}
.sa-field textarea { min-height: 62px; resize: vertical; }
.sa-field input:focus, .sa-field textarea:focus, .sa-field select:focus { outline: 2px solid var(--sa-mustard); outline-offset: 1px; }
.sa-phone { display: grid; grid-template-columns: 88px 1fr; gap: 7px; }
.sa-err { color: var(--sa-terra); font-size: 12px; font-weight: 600; min-height: 16px; margin-bottom: 4px; }
.sa-form-actions { display: flex; gap: 8px; }

.sa-btn {
  font-family: inherit; font-size: 13px; font-weight: 700;
  background: var(--sa-forest); color: var(--sa-bone);
  border: 2px solid var(--sa-ink); box-shadow: 3px 3px 0 var(--sa-ink);
  padding: 9px 15px; cursor: pointer; border-radius: 999px;
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}
.sa-btn:hover { background: var(--sa-terra); transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--sa-ink); }
.sa-btn.ghost { background: var(--sa-bone); color: var(--sa-ink); }
.sa-btn.ghost:hover { background: var(--sa-mustard); }
.sa-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── input row ── */
.sa-input-row {
  display: flex; gap: 8px; padding: 11px;
  border-top: 3px solid var(--sa-ink); background: var(--sa-bone); flex-shrink: 0;
}
.sa-input-row input {
  flex: 1; min-width: 0; font-family: inherit; font-size: 14px; color: var(--sa-ink);
  background: var(--sa-cream); border: 2px solid var(--sa-ink); padding: 9px 11px; border-radius: 0;
}
.sa-input-row input:focus { outline: 2px solid var(--sa-mustard); outline-offset: 1px; }
.sa-send {
  background: var(--sa-forest); color: var(--sa-bone);
  border: 2px solid var(--sa-ink); box-shadow: 2px 2px 0 var(--sa-ink);
  width: 40px; flex-shrink: 0; cursor: pointer; font-size: 16px; font-family: inherit;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.sa-send:hover { background: var(--sa-terra); }
.sa-send:disabled { opacity: 0.45; cursor: not-allowed; }

.sa-foot {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 8px; letter-spacing: 1px; text-transform: uppercase;
  color: rgba(20,18,16,0.4); text-align: center; padding: 0 0 7px; background: var(--sa-bone);
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .sa-root { right: 14px; bottom: 14px; }
  .sa-panel { height: calc(100vh - 110px); }
  .sa-blob { width: 54px; height: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  .sa-blob, .sa-blob i, .sa-head-dot, .sa-typing span { animation: none; }
}
