/* ═══════════════════════════════════════════════════════════
   3. CHAT PAGE  (service/aime/frontend/index.html)
   ═══════════════════════════════════════════════════════════ */

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 56px;
  align-items: center;
  padding: 56px 64px;
}

@media (max-width: 900px) {
  .stage {
    grid-template-columns: 1fr;
    padding: 32px 20px;
    gap: 28px;
  }
}

/* ─── Profile ────────────────────────────────────────────── */

.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.oval-mat {
  position: relative;
  width: 220px;
  height: 260px;
  border-radius: 50%;
  background: var(--parchment);
  padding: 12px;
  box-shadow: var(--shadow), inset 0 0 0 2px var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold);
  /* gentle float + breathing gold aura, echoing the hero icon */
  animation: float 5s ease-in-out infinite, mat-glow 4s ease-in-out infinite;
}

@keyframes mat-glow {
  0%, 100% { box-shadow: var(--shadow), inset 0 0 0 2px var(--gold-dim), 0 0 0 rgba(212,160,23,0); }
  50%      { box-shadow: var(--shadow), inset 0 0 0 2px var(--gold-dim), 0 0 28px rgba(212,160,23,0.28); }
}

/* faint pulsing ring around the portrait, like the hero's ring */
.oval-mat::before {
  content: '';
  position: absolute;
  inset: -12px;
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  opacity: 0.35;
  pointer-events: none;
  animation: pulse-ring 3s ease-in-out infinite;
}

.oval-mat img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--parchment);
  filter: sepia(0.3) contrast(1.1); /* slight map/vintage filter */
}

/* Back to the map — mirrors the footer links. Every state is set
   explicitly so the browser never falls back to default link colors. */
.back-link,
.back-link:link,
.back-link:visited,
.back-link:hover,
.back-link:focus,
.back-link:active {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 1px dashed var(--gold-dim);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.back-link:hover,
.back-link:focus,
.back-link:active {
  color: var(--gold-lt);
  border-bottom-color: var(--gold);
}
.back-link .x-mark { color: var(--gold-lt); margin-right: 0.15em; }

/* ─── Painting frame ─────────────────────────────────────── */

.frame {
  position: relative;
  padding: 26px;
  border-radius: 8px;
  background: linear-gradient(145deg, #2a1a0a 0%, var(--parchment) 40%, #0d0802 100%);
  border: 1px solid var(--gold-dim);
  box-shadow:
    var(--shadow),
    inset 0 0 0 2px var(--gold-dim);
}

/* glowing corner nodes, echoing the map-card */
.frame .corner { position: absolute; width: 10px; height: 10px; z-index: 2; }
.frame .corner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--gold);
}
.frame .corner.tl { top: -3px;    left: -3px;   }
.frame .corner.tr { top: -3px;    right: -3px;  }
.frame .corner.bl { bottom: -3px; left: -3px;   }
.frame .corner.br { bottom: -3px; right: -3px;  }

.frame-inner {
  position: relative;
  background: rgba(13, 8, 2, 0.6);
  border: 1px dashed rgba(139, 105, 20, 0.3);
  border-radius: 4px;
  padding: 28px 30px 22px;
  height: 600px;
  max-height: calc(100vh - 160px);
  display: flex;
  flex-direction: column;
}

.frame-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  color: var(--gold);
  margin-bottom: 14px;
  letter-spacing: 0.04em;
  text-shadow: 0 0 30px rgba(212,160,23,0.3); /* gold glow, matching .headline */
  animation: flicker 8s ease-in-out infinite;  /* same subtle flicker as the landing page */
}

.frame-title .x-mark {
  display: inline-block;
  animation: spin-wobble 6s ease-in-out infinite;
}

.frame-title::after {
  content: "";
  display: block;
  width: 80px;
  height: 1px;
  background: var(--gold-dim);
  margin: 8px auto 0;
  opacity: 0.6;
}

/* ─── Chat ───────────────────────────────────────────────── */

.chat {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 4px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) transparent;
}

.chat::-webkit-scrollbar {
  width: 8px;
}
.chat::-webkit-scrollbar-track {
  background: transparent;
}
.chat::-webkit-scrollbar-thumb {
  background: var(--gold-dim);
  border-radius: 4px;
}
.chat::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

.bubble {
  /* 78% reads well in a narrow column; past ~46rem a bubble stops looking
     like one, and the user's (right-aligned) would sit a screen away. */
  max-width: min(78%, 69rem);
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 1.18rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: bubble-in 0.35s ease both; /* gentle reveal */
}

@keyframes bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bubble.user {
  align-self: flex-end;
  background: var(--parchment);
  border: 1px solid var(--gold-dim);
  color: var(--text);
}

.bubble.ai {
  align-self: flex-start;
  background: rgba(42, 30, 0, 0.4);
  border: 1px solid rgba(214, 160, 23, 0.3);
  color: var(--text);
}

.bubble.ai.refusal {
  background: rgba(139, 74, 43, 0.2);
  border-color: #ff6b6b;
  color: #ffb3b3;
}

.bubble.typing {
  font-family: var(--sans);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

/* ─── Composer ───────────────────────────────────────────── */

.composer {
  display: flex;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px dashed rgba(139, 105, 20, 0.3);
}

.input {
  flex: 1;
  font-family: var(--serif);
  font-size: 1.1rem;
  padding: 12px 16px;
  border-radius: 4px;
  background: rgba(13, 8, 2, 0.6);
  border: 1px solid var(--gold-dim);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input::placeholder {
  color: var(--text-dim);
  opacity: 0.7;
  font-style: italic;
}

.input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-dim), 0 0 18px rgba(212,160,23,0.22);
}

.send {
  flex-shrink: 0;
  align-self: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--gold-dim);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.send:hover {
  background: rgba(212, 160, 23, 0.12);
  border-color: var(--gold);
}

.send:active {
  transform: scale(0.93);
}

.send svg {
  width: 18px;
  height: 18px;
}

.send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.counter {
  font-family: var(--sans);
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: right;
  margin-top: 6px;
  letter-spacing: 0.1em;
}

/* ─── Site footer (mirrors the landing footer) ───────────── */

.site-footer {
  position: relative;
  z-index: 1;
  font-family: var(--sans);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  text-align: center;
  padding: 0 1.5rem 1.75rem;
  opacity: 0.65;
  line-height: 2;
}

.site-footer a,
.site-footer a:link,
.site-footer a:visited {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px dashed var(--gold-dim);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.site-footer a:hover,
.site-footer a:focus,
.site-footer a:active {
  color: var(--gold-lt);
  border-bottom-color: var(--gold);
}

.site-footer .footer-divider {
  display: inline-block;
  margin: 0 0.5em;
  color: var(--gold-dim);
  opacity: 0.5;
}

.site-footer .attribution {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  opacity: 0.75;
  font-weight: 700;
}
.site-footer .attribution em {
  color: var(--gold);
  font-style: normal;
}
