/* Elovia demo — same look as elovia.io (Navy #1A3A5C, accent #3F72AD, light gray #F2F2F7) */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("assets/inter-latin-wght-normal.woff2") format("woff2"); }

:root {
  --navy: #1A3A5C; --navy-deep: #122B45; --accent: #3F72AD; --accent-light: #9CC0E8;
  --gray: #F2F2F7; --ink: #1A2B3C; --muted: #5A6B7D; --line: #E1E5EC;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--gray); -webkit-font-smoothing: antialiased; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, textarea { font: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- desktop layout: intro + phone ---------- */
.page { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: clamp(32px, 6vw, 96px); max-width: 1180px; margin: 0 auto; padding: 32px; }
.intro { max-width: 520px; }
.intro-logo img { height: 34px; width: auto; display: block; }
.intro-badge { display: inline-block; margin: 36px 0 18px; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.intro h1 { margin: 0 0 18px; color: var(--navy); font-size: clamp(32px, 3.6vw, 48px); line-height: 1.08; letter-spacing: -0.03em; }
.intro-text { margin: 0 0 22px; font-size: 18px; line-height: 1.6; color: var(--muted); }
.intro-list { list-style: none; margin: 0 0 26px; padding: 0; display: grid; gap: 10px; }
.intro-list li { position: relative; padding-left: 28px; font-weight: 500; }
.intro-list li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 12px; height: 6px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
.intro-note { margin: 0 0 22px; padding: 14px 16px; border-left: 3px solid var(--accent); background: #fff; border-radius: 10px; color: var(--ink); font-size: 15px; }
.intro-back { color: var(--accent); font-weight: 600; text-decoration: none; }

.phone { width: 390px; height: min(820px, calc(100vh - 64px)); min-height: 600px; background: #0E1A28; border-radius: 52px; padding: 12px; box-shadow: 0 40px 80px -30px rgba(18,43,69,.45), inset 0 0 0 2px #2A3B4F, inset 0 0 0 5px #0B1520; }
.phone-screen { position: relative; height: 100%; border-radius: 41px; overflow: hidden; background: #F5F6FA; display: flex; flex-direction: column; }

/* ---------- app bar ---------- */
.app-bar { flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 46px 16px 14px; background: var(--navy); color: #fff; }
.app-logo { height: 22px; width: auto; }
.app-title { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.app-project { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-demo { justify-self: start; margin-top: 3px; padding: 2px 8px; border-radius: 999px; background: #F2B544; color: #3A2A00; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.app-reset { flex-shrink: 0; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; }
.app-reset:hover { background: rgba(255,255,255,.2); }

/* ---------- messages ---------- */
.chat { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; overscroll-behavior: contain; }
.msg { display: flex; animation: pop .35s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 86%; padding: 11px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.bot .bubble { background: #fff; color: var(--ink); border-bottom-left-radius: 6px; box-shadow: 0 1px 2px rgba(26,58,92,.06), 0 2px 8px rgba(26,58,92,.05); }
.bubble p { margin: 0 0 8px; }
.bubble p:last-child, .bubble ul:last-child { margin-bottom: 0; }
.bubble ul { margin: 0 0 8px; padding-left: 18px; }
.bubble li { margin: 2px 0; }
.bubble strong { font-weight: 650; }
.bubble .es { color: var(--accent); font-weight: 600; }
.source { display: flex; gap: 6px; align-items: flex-start; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--accent); line-height: 1.4; }
.source svg { flex-shrink: 0; margin-top: 1px; }
.msg.error .bubble { background: #FFF4F2; color: #8A2E25; box-shadow: none; border: 1px solid #F3D2CD; white-space: pre-wrap; }
.typing { display: inline-flex; gap: 4px; padding: 3px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #9AA8B8; animation: dot 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* ---------- composer ---------- */
.composer { flex-shrink: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; max-width: 240px; padding: 8px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--gray); color: var(--navy); font-size: 13px; font-weight: 500; line-height: 1.3; text-align: left; cursor: pointer; transition: background .2s, border-color .2s; white-space: normal; }
.chip:hover { background: #E8EEF6; border-color: #C9D6E6; }
.chip:disabled { opacity: .5; cursor: default; }
.input-row { display: flex; align-items: flex-end; gap: 8px; }
.input-row textarea { flex: 1; resize: none; max-height: 120px; min-height: 42px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 21px; background: #F8F9FB; color: var(--ink); font-size: 16px; line-height: 1.35; }
.input-row textarea:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(63,114,173,.14); }
.send { flex-shrink: 0; width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--accent); color: #fff; cursor: pointer; transition: transform .15s, background .2s; }
.send:hover { background: #3566A0; }
.send:active { transform: scale(.92); }
.send:disabled { background: #C9D2DD; cursor: default; }
.fineprint { margin: 8px 0 0; text-align: center; font-size: 11px; color: var(--muted); }

/* ---------- phones: the chat is the whole page ---------- */
@media (max-width: 900px) {
  html, body { height: 100%; overflow: hidden; }
  body { background: #F5F6FA; }
  .page { display: block; padding: 0; height: 100%; height: 100dvh; max-width: none; }
  .intro { display: none; }
  .phone { width: 100%; height: 100%; min-height: 0; padding: 0; border-radius: 0; box-shadow: none; background: none; }
  .phone-screen { border-radius: 0; }
  .app-bar { padding: calc(12px + env(safe-area-inset-top)) 14px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .msg { animation: none; }
  .typing span { animation: none; opacity: .7; }
  .chat { scroll-behavior: auto; }
}
