/* ==========================================================================
   maxi.css — mAxI golden doodle chatbot page
   Accent: --neon-amber (#FFB800). Full-height chat layout.
   ========================================================================== */

/* ── Amber gate overrides ─────────────────────────────────────────────────── */
.gate-overlay::before {
  background: radial-gradient(circle, rgba(255,184,0,0.09) 0%, transparent 65%);
}
.gate-card {
  box-shadow: 0 0 60px rgba(255,184,0,0.09), 0 32px 64px rgba(0,0,0,0.45);
}
.gate-emoji {
  color: var(--neon-amber);
  filter: drop-shadow(0 0 8px rgba(255,184,0,0.5));
  --ph-duotone-opacity: 0.3;
}
.gate-digit:focus {
  border-color: var(--neon-amber);
  box-shadow: 0 0 0 1px var(--neon-amber), 0 0 20px rgba(255,184,0,0.2);
}
.btn-primary {
  background: var(--neon-amber);
  color: #07071A;
  box-shadow: 0 0 20px rgba(255,184,0,0.3);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 36px rgba(255,184,0,0.5);
}

/* ── Full-height body layout ─────────────────────────────────────────────── */
/* Only applies on this page since maxi.css is only loaded on maxi.html */
body {
  height: 100vh;
  height: 100dvh; /* accounts for mobile browser chrome */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Nav already flex-shrink:0 in styles.css */

/* ── Main chat shell ─────────────────────────────────────────────────────── */
.maxi-root {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
  /* left/right padding is on children so chat-area scrollbar sits at edge */
}

/* ── Welcome state ───────────────────────────────────────────────────────── */
.maxi-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px 16px;
  text-align: center;
  overflow-y: auto;
}

/* The pixel art sprite — CSS controls rendered size, SVG viewBox provides grid */
.maxi-sprite-welcome {
  width: 180px;
  height: auto;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  margin-bottom: 20px;
  animation: maxi-idle 3.5s ease-in-out infinite;
}

.maxi-sprite-welcome[data-state="thinking"] {
  animation: maxi-think 0.9s ease-in-out infinite;
}
.maxi-sprite-welcome[data-state="happy"] {
  animation: maxi-happy 0.65s ease-out forwards;
}

.maxi-name {
  font-family: 'Syne', sans-serif;
  font-weight: 900;
  font-size: 44px;
  letter-spacing: -0.04em;
  margin: 0 0 8px;
  background: linear-gradient(135deg, #FFB800 0%, #FF8C00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.maxi-tagline {
  font-family: 'Satoshi', sans-serif;
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0 0 26px;
  line-height: 1.5;
}

.maxi-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 480px;
}

.suggestion-chip {
  font-family: 'Satoshi', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.suggestion-chip:hover {
  border-color: var(--neon-amber);
  color: var(--neon-amber);
  background: rgba(255,184,0,0.06);
}

/* ── Chat area ───────────────────────────────────────────────────────────── */
.chat-area {
  flex: 0;           /* grows to flex:1 once chat mode activates */
  min-height: 0;
  overflow-y: auto;
  padding: 12px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

/* JS adds .chat-mode to .maxi-root when first message is sent */
.maxi-root.chat-mode .chat-area {
  flex: 1;
}

/* ── Chat bubbles ────────────────────────────────────────────────────────── */
.chat-wrap {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  max-width: 90%;
}

.chat-user  { align-self: flex-end;   flex-direction: row-reverse; }
.chat-maxi  { align-self: flex-start; }

.chat-bubble {
  font-family: 'Satoshi', sans-serif;
  font-size: 14.5px;
  line-height: 1.65;
  padding: 11px 15px;
  border-radius: 16px;
  word-break: break-word;
}

.chat-user .chat-bubble {
  background: rgba(255,184,0,0.11);
  border: 1px solid rgba(255,184,0,0.22);
  border-radius: 16px 16px 4px 16px;
  color: var(--text-primary);
}

.chat-maxi .chat-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 16px 16px 16px 4px;
  color: var(--text-primary);
}

/* Inline code in bubbles */
.chat-bubble code {
  font-family: 'Geist Mono', monospace;
  font-size: 13px;
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--neon-amber);
}

/* Lists in bubbles */
.chat-bubble ol,
.chat-bubble ul {
  margin: 8px 0 4px;
  padding-left: 22px;
}
.chat-bubble li {
  margin-bottom: 5px;
  line-height: 1.6;
}

.chat-bubble strong { font-weight: 700; }

/* Copy button */
.copy-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: color 0.15s;
  align-self: flex-end;
  margin-bottom: 2px;
  padding: 0;
}
.copy-btn:hover { color: var(--neon-amber); }

/* Typing indicator dots */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 20px;
  min-width: 64px;
}
.typing-bubble span {
  width: 6px;
  height: 6px;
  background: var(--text-faint);
  border-radius: 50%;
  animation: typing-dot 1.2s ease-in-out infinite;
}
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
  0%, 80%, 100% { transform: scale(1);   opacity: 0.4; }
  40%            { transform: scale(1.4); opacity: 1;   }
}

/* ── mAxI bar (appears when welcome is dismissed) ─────────────────────── */
.maxi-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.maxi-sprite-bar {
  width: 48px;
  height: auto;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
  animation: maxi-idle 3.5s ease-in-out infinite;
}

.maxi-sprite-bar[data-state="thinking"] {
  animation: maxi-think 0.9s ease-in-out infinite;
}
.maxi-sprite-bar[data-state="happy"] {
  animation: maxi-happy 0.65s ease-out forwards;
}

.maxi-status {
  font-family: 'Satoshi', sans-serif;
  font-size: 12px;
  color: var(--text-faint);
  flex: 1;
}

/* ── Input bar ───────────────────────────────────────────────────────────── */
.input-bar {
  flex-shrink: 0;
  background: var(--bg-void);
  border-top: 1px solid var(--border-subtle);
  padding: 12px 24px 14px;
}

.input-inner {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.chat-input {
  flex: 1;
  font-family: 'Satoshi', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  color: var(--text-primary);
  resize: none;
  outline: none;
  overflow: hidden;
  min-height: 42px;
  max-height: 120px;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.chat-input::placeholder { color: var(--text-faint); }
.chat-input:focus {
  border-color: var(--neon-amber);
  box-shadow: 0 0 0 1px rgba(255,184,0,0.18);
}

.send-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  background: var(--neon-amber);
  color: #07071A;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 0 18px rgba(255,184,0,0.3);
}
.send-btn:hover:not(:disabled) {
  box-shadow: 0 0 30px rgba(255,184,0,0.55);
}
.send-btn:disabled {
  opacity: 0.35;
  cursor: default;
  box-shadow: none;
}

/* ── Sprite animations ────────────────────────────────────────────────────── */
@keyframes maxi-idle {
  0%, 100% { transform: translateY(0);   }
  50%       { transform: translateY(-4px); }
}

@keyframes maxi-think {
  0%, 100% { transform: rotate(-5deg); }
  50%       { transform: rotate(5deg);  }
}

@keyframes maxi-happy {
  0%   { transform: translateY(0)    scale(1);    }
  25%  { transform: translateY(-14px) scale(1.07); }
  55%  { transform: translateY(-3px)  scale(1);    }
  75%  { transform: translateY(-8px)  scale(1.04); }
  100% { transform: translateY(0)    scale(1);    }
}

/* Tail wag — CSS rotates the tail group around its base */
.maxi-tail {
  transform-box: fill-box;
  transform-origin: 0% 80%;
  animation: tail-wag 1.4s ease-in-out infinite;
}

@keyframes tail-wag {
  0%, 100% { transform: rotate(-12deg); }
  50%       { transform: rotate(18deg);  }
}

/* Gate shake (reused from styles.css pattern) */
@keyframes gate-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px);  }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px);  }
}
.gate-inputs.shake { animation: gate-shake 0.4s ease; }

/* ── Accessibility ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .maxi-sprite-welcome,
  .maxi-sprite-bar   { animation: none; }
  .maxi-tail         { animation: none; transform: rotate(-5deg); }
  .typing-bubble span { animation: none; opacity: 0.7; }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .maxi-welcome   { padding: 24px 16px 12px; }
  .maxi-sprite-welcome { width: 140px; }
  .maxi-name      { font-size: 36px; }
  .maxi-bar       { padding: 10px 16px 6px; }
  .chat-area      { padding: 12px 16px 8px; }
  .input-bar      { padding: 10px 16px 12px; }
  .chat-wrap      { max-width: 95%; }
}
