/* Brand palette taken from tryriders.com */
:root {
  --brand: #004581;        /* Riders navy */
  --brand-deep: #00315e;
  --brand-sky: #96d4ea;    /* CTA on navy */
  --live: #55c980;         /* online / live indicator */

  --bg: #f8faff;
  --surface: #ffffff;
  --surface-2: #f0f6ff;
  --text: #13202e;
  --muted: #5a6b82;
  --border: #e7ecf1;
  --primary: var(--brand);
  --primary-ink: #ffffff;
  --primary-soft: #e5f4fa;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --bubble-me: var(--brand);
  --bubble-me-ink: #ffffff;
  --bubble-them: #e8eef8;
  --shadow: 0 20px 50px -20px rgba(0, 69, 129, .3), 0 2px 6px rgba(19, 32, 46, .06);
  --radius: 18px;
  --font: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: "Urbanist", var(--font);
  --header-bg: var(--brand);
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --dir: 1; /* flips horizontal motion in RTL */
  color-scheme: light;
}

/* Arabic: Plex Sans Arabic for everything (Urbanist has no Arabic glyphs) */
:root:lang(ar) {
  --font: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-heading: "IBM Plex Sans Arabic", "Urbanist", sans-serif;
}
[dir="rtl"] { --dir: -1; }
:lang(ar) h1, :lang(ar) h2, :lang(ar) .eyebrow { letter-spacing: 0; }
:lang(ar) h1 { line-height: 1.35; }
:lang(ar) .eyebrow { text-transform: none; font-size: .9rem; }

/* Theme is set on <html data-theme> by the inline script in index.html */
:root[data-theme="dark"] {
  --bg: #081624;
  --surface: #0e2135;
  --surface-2: #142c45;
  --text: #e8eef8;
  --muted: #9fb3c8;
  --border: #1d3a57;
  --primary: var(--brand-sky);
  --primary-ink: var(--brand-deep);
  --primary-soft: #12324f;
  --danger: #ef4444;
  --danger-soft: #2a1414;
  --bubble-me: var(--brand-sky);
  --bubble-me-ink: var(--brand-deep);
  --bubble-them: #142c45;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .3);
  --header-bg: var(--brand-deep);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
}

a { color: var(--primary); }

.container { width: min(1160px, 100% - 32px); margin-inline: auto; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--header-bg); color: #fff;
  transition: background .2s;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.header-actions { display: flex; align-items: center; gap: 8px; }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand-logo { display: block; height: 28px; width: auto; }
.brand-tag {
  padding: 2px 10px; border-radius: 999px;
  background: rgba(150, 212, 234, .14); border: 1px solid rgba(150, 212, 234, .32);
  color: var(--brand-sky); font-size: .75rem; font-weight: 600;
}

.header-status {
  display: flex; align-items: center; gap: 8px; font-size: .875rem; color: #fff;
  padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: livePulse 2s ease-out infinite; }
.status-dot.offline { background: #9fb3c8; animation: none; }

.lang-toggle {
  font: inherit; font-size: .85rem; font-weight: 600; color: #fff; cursor: pointer;
  height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid rgba(150, 212, 234, .32); background: rgba(150, 212, 234, .1);
  transition: background-color .2s, border-color .2s, transform .2s var(--ease-out);
}
.lang-toggle:hover { background: rgba(150, 212, 234, .2); border-color: var(--brand-sky); }
.lang-toggle:active { transform: scale(.94); }
/* The button shows the *other* language, so give it that language's font */
:lang(en) .lang-toggle { font-family: "IBM Plex Sans Arabic", sans-serif; }
:lang(ar) .lang-toggle { font-family: "IBM Plex Sans", sans-serif; }

.theme-toggle { color: #fff; background: rgba(255, 255, 255, .08); border-radius: 999px; }
.theme-toggle:hover { background: rgba(255, 255, 255, .16); }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Logo that follows the theme (footer) */
.logo-on-dark { display: none; }
[data-theme="dark"] .logo-on-light { display: none; }
[data-theme="dark"] .logo-on-dark { display: block; }

/* ---------- Hero ---------- */
.hero {
  padding: 56px 0 72px;
  background:
    radial-gradient(1100px 640px at 88% 12%, rgba(150, 212, 234, .2), transparent 58%),
    radial-gradient(800px 480px at 8% 88%, rgba(85, 201, 128, .1), transparent 60%);
}
.hero-grid {
  display: grid; gap: 48px; align-items: start;
  grid-template-columns: 1fr minmax(0, 440px);
}

.eyebrow {
  margin: 0 0 12px; color: var(--primary); font-weight: 700;
  font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
}
h1, h2, h3, .chat-title, .stats strong { font-family: var(--font-heading); }
h1 { margin: 0; font-size: clamp(2rem, 4.2vw, 3.25rem); line-height: 1.1; letter-spacing: -.02em; }
h1 .accent { display: block; color: var(--muted); font-weight: 600; }
.lead { margin: 20px 0 0; font-size: 1.125rem; color: var(--muted); max-width: 52ch; }

.stats { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 0; padding: 0; }
.stats li {
  flex: 1 1 140px; padding: 14px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .25s var(--ease-out), box-shadow .25s, border-color .25s;
}
.stats li:hover, .steps li:hover {
  transform: translateY(-3px); border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  box-shadow: 0 12px 28px -16px rgba(0, 69, 129, .35);
}
.stats strong { display: block; font-size: 1.25rem; }
.stats span { color: var(--muted); font-size: .85rem; }

/* ---------- Chat panel ---------- */
.chat {
  position: sticky; top: 88px;
  display: flex; flex-direction: column;
  height: min(640px, calc(100vh - 112px)); min-height: 520px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.chat[data-state="intro"] { height: auto; }

.chat-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff;
}
.chat-title { margin: 0; font-weight: 800; }
.chat-sub { margin: 0; font-size: .8rem; opacity: .85; }
.chat-actions { display: flex; gap: 2px; margin-inline-start: auto; }
.chat-actions .icon-btn { color: inherit; }
.chat-actions [data-end-chat] { animation: popIn .3s var(--ease-out); }
.icon-collapse, .is-fullscreen .icon-expand { display: none; }
.is-fullscreen .icon-collapse { display: block; }

/* ---------- Full-screen chat ---------- */
html.chat-fullscreen { overflow: hidden; }
.chat.is-fullscreen {
  position: fixed; inset: 0; z-index: 100;
  width: auto; height: 100vh; height: 100dvh; min-height: 0;
  border: 0; border-radius: 0; box-shadow: none;
}
.chat.is-fullscreen .chat-head { padding-inline: max(18px, (100% - 820px) / 2); }
/* Keep the conversation a readable width on big screens */
.chat.is-fullscreen .chat-intro,
.chat.is-fullscreen .chat-body,
.chat.is-fullscreen .composer { padding-inline: max(18px, (100% - 820px) / 2); }
.chat.is-fullscreen .chat-intro { flex: 1; overflow-y: auto; align-content: start; }
.chat.is-fullscreen .typing { margin-inline: max(18px, (100% - 820px) / 2); }
.chat.is-fullscreen .jump-latest { inset-inline-end: max(16px, (100% - 820px) / 2); }
.chat.is-fullscreen .composer { padding-block: 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
/* Name used only while toggling, so the panel morphs between its two sizes */
.chat.vt-chat { view-transition-name: chat; }
::view-transition-group(chat) { animation-duration: .45s; animation-timing-function: var(--ease-out); }

.avatars { display: flex; }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--brand); font-size: .8rem; font-weight: 700; color: #fff;
}
.avatar + .avatar { margin-inline-start: -10px; }
.a1 { background: #6c5ce7; } .a2 { background: #e17055; } .a3 { background: #0984e3; }

/* Intro form */
.chat-intro { padding: 20px 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

/* Each chat state animates in when it goes from hidden to shown */
.chat-intro, .chat-body { animation: stateIn .4s var(--ease-out); }
.composer { animation: composerIn .4s var(--ease-out); }
.intro-hello { margin: 0; padding: 12px 14px; border-radius: 14px; border-end-start-radius: 4px; background: var(--bubble-them); }

.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; font-size: .85rem; font-weight: 600; }
.field input {
  font: inherit; font-weight: 400; font-size: .95rem; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus { box-shadow: 0 0 0 4px var(--primary-soft); }
.field input[aria-invalid="true"] { animation: shake .35s; }
.field input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.field input[aria-invalid="true"] { border-color: var(--danger); }

/* Phone with fixed +965 prefix. The wrapper draws the border so prefix + input read as one field. */
.phone-input {
  display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); transition: border-color .2s, box-shadow .2s;
}
.phone-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.phone-input:has(input[aria-invalid="true"]) { border-color: var(--danger); animation: shake .35s; }
.phone-prefix {
  display: flex; align-items: center; gap: 6px; padding: 0 12px; flex: none;
  font-weight: 600; font-size: .95rem; color: var(--text);
  border-inline-end: 1px solid var(--border); background: var(--surface-2); border-radius: 10px 0 0 10px;
}
.phone-prefix .flag { width: 22px; height: 11px; border-radius: 2px; box-shadow: 0 0 0 1px var(--border); }
.phone-input input {
  flex: 1; min-width: 0; width: 100%; /* % width drops the input's built-in ~20ch minimum */ border: 0; background: transparent; letter-spacing: .04em;
}
.phone-input input:focus { outline: none; box-shadow: none; }
.phone-input input[aria-invalid="true"] { animation: none; }

/* Fieldsets default to min-width: min-content, which stopped the chips wrapping on phones */
.topics { border: 0; margin: 0; padding: 0; min-width: 0; }
.topics legend { font-size: .85rem; font-weight: 600; margin-bottom: 8px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 7px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); font-size: .85rem;
  transition: background-color .2s, border-color .2s, color .2s, transform .15s var(--ease-out);
}
.chip span:hover { border-color: var(--primary); transform: translateY(-1px); }
.chip span:active { transform: scale(.95); }
.chip input:checked + span { animation: chipSelect .3s var(--ease-out); }
.chip input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

.form-error { margin: 0; color: var(--danger); font-size: .85rem; }
.fine-print { margin: 0; font-size: .75rem; color: var(--muted); text-align: center; }

.btn {
  font: inherit; font-weight: 600; border: 0; cursor: pointer;
  padding: 12px 18px; border-radius: 12px;
  transition: transform .15s var(--ease-out), filter .15s, box-shadow .25s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 10px 22px -10px var(--primary); }
.btn:disabled { cursor: progress; opacity: .85; }
.btn:disabled::after {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-left: 10px; vertical-align: -2px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-block { width: 100%; }

/* Conversation */
.chat-main { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; overscroll-behavior: contain; }

/* "Jump to latest" button, shown when the driver scrolls up */
.jump-latest {
  position: absolute; bottom: 12px; inset-inline-end: 16px; z-index: 2;
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0; cursor: pointer;
  border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .35);
  opacity: 0; transform: translateY(10px) scale(.8); pointer-events: none;
  transition: opacity .25s, transform .3s var(--ease-out), background-color .2s;
}
.jump-latest.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.jump-latest:hover { background: var(--surface-2); }
.jump-latest:active { transform: scale(.9); }
.jump-latest svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
/* New messages arrived while scrolled up */
.jump-latest.has-new::after {
  content: ""; position: absolute; top: 0; inset-inline-end: 0; width: 10px; height: 10px; border-radius: 50%;
  background: var(--live); border: 2px solid var(--surface); animation: livePulse 2s ease-out infinite;
}

/* ---------- Minimized chat ---------- */
.minimize-btn svg { transition: transform .3s var(--ease-out); }
.chat.is-minimized { height: auto; min-height: 0; }
.chat.is-minimized > :not(.chat-head) { display: none !important; }
.chat.is-minimized .chat-head { cursor: pointer; }
.chat.is-minimized .minimize-btn svg { transform: rotate(180deg); }
.unread-dot { display: none; width: 10px; height: 10px; border-radius: 50%; background: var(--live); animation: livePulse 2s ease-out infinite; }
.chat.has-unread .unread-dot { display: block; }
.messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.msg { max-width: 82%; display: flex; flex-direction: column; animation: pop .25s var(--ease-out); }
.msg.me { animation-name: msgInEnd; transform-origin: bottom right; }
.msg.them { animation-name: msgInStart; transform-origin: bottom left; }
[dir="rtl"] .msg.me { transform-origin: bottom left; }
[dir="rtl"] .msg.them { transform-origin: bottom right; }
.msg-bubble { padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; }
.msg-meta { font-size: .7rem; color: var(--muted); margin-top: 3px; padding-inline: 4px; }

.msg.them { align-self: flex-start; }
.msg.them .msg-bubble { background: var(--bubble-them); border-end-start-radius: 4px; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.me .msg-bubble { background: var(--bubble-me); color: var(--bubble-me-ink); border-end-end-radius: 4px; }
.msg.system { align-self: center; max-width: 100%; }
.msg.system .msg-bubble { background: none; color: var(--muted); font-size: .8rem; padding: 4px 0; text-align: center; }

.msg-file { display: flex; align-items: center; gap: 8px; }
/* Riders logo next to every message from the team */
.msg.them.has-avatar { display: grid; grid-template-columns: 30px minmax(0, auto); column-gap: 8px; justify-content: start; }
/* justify-self: start keeps the bubble sized to its text instead of stretching to the name/time line */
.msg.has-avatar .msg-bubble, .msg.has-avatar .msg-meta { grid-column: 2; justify-self: start; }
.msg-avatar {
  grid-column: 1; grid-row: 1; align-self: end;
  width: 30px; height: 30px; padding: 6px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 1px var(--border);
}

/* Voice message player */
.voice { display: flex; align-items: center; gap: 10px; min-width: 200px; padding: 4px 6px 4px 4px; }
.voice-play {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--primary); color: var(--primary-ink);
  transition: transform .15s var(--ease-out);
}
.voice-play:active { transform: scale(.9); }
.msg.me .voice-play { background: var(--bubble-me-ink); color: var(--bubble-me); }
.voice-play svg { width: 16px; height: 16px; fill: currentColor; }
.voice-play .icon-pause, .voice.is-playing .icon-play { display: none; }
.voice.is-playing .icon-pause { display: block; }
.voice-track {
  position: relative; flex: 1; height: 4px; border-radius: 4px; cursor: pointer;
  background: color-mix(in srgb, currentColor 22%, transparent);
}
.voice-track::before { content: ""; position: absolute; inset: -10px 0; } /* bigger tap target */
.voice-fill { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; border-radius: inherit; background: currentColor; }
.voice-time { flex: none; font-size: .78rem; font-variant-numeric: tabular-nums; opacity: .85; min-width: 34px; }

.msg-file { flex-direction: column; align-items: stretch; padding: 6px; }
.msg-file img { max-width: 220px; max-height: 260px; object-fit: cover; border-radius: 10px; display: block; }
.msg-caption { margin: 0; padding: 4px 8px 2px; }
.msg .msg-bubble.msg-media { background: none; padding: 0; }
.msg-media img { border-radius: 14px; box-shadow: 0 0 0 1px var(--border); }
/* Message the server rejected */
.msg.is-failed .msg-bubble { opacity: .55; }
.msg.is-failed .msg-meta::after { content: " ⚠"; color: var(--danger); }

.typing {
  display: inline-flex; gap: 4px; margin: 8px 18px 0; padding: 12px 14px; border-radius: 16px;
  background: var(--bubble-them); width: fit-content; animation: msgInStart .25s var(--ease-out);
}
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typingBounce 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }

.composer {
  display: flex; align-items: flex-end; gap: 8px; padding: 12px;
  border-top: 1px solid var(--border); background: var(--surface);
}
.composer textarea {
  flex: 1; resize: none; max-height: 120px; font: inherit; font-size: .95rem;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
}
.composer textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }

.icon-btn {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px;
  border: 0; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color .2s, transform .2s var(--ease-out), opacity .2s;
}
.icon-btn:active { transform: scale(.9); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--surface-2); }
.chat-head .icon-btn:hover { background: rgba(255, 255, 255, .15); }
.send { background: var(--primary); color: var(--primary-ink); }
.send:hover { background: var(--primary); filter: brightness(1.05); }
.send svg { fill: currentColor; stroke: none; transition: transform .25s var(--ease-out); }
.composer:not(.has-text) .send { opacity: .45; transform: scale(.9); }

/* Mic replaces Send while the box is empty (like WhatsApp) */
.mic { color: var(--primary); }
.composer:not(.can-record) .mic,
.composer.has-text .mic,
.composer.is-recording .mic { display: none; }
.composer.can-record:not(.has-text):not(.is-recording) .send { display: none; }
.mic, .composer.has-text .send { animation: popIn .25s var(--ease-out); }

/* Recording bar */
.recorder { display: none; flex: 1; align-items: center; gap: 10px; min-height: 42px; }
.composer.is-recording .recorder { display: flex; animation: stateIn .25s var(--ease-out); }
.composer.is-recording .attach,
.composer.is-recording textarea { display: none; }
.composer.is-recording .send { opacity: 1; transform: none; }
.rec-cancel { color: var(--danger); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: recBlink 1s ease-in-out infinite; }
.rec-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.rec-label { color: var(--muted); font-size: .85rem; }
@keyframes recBlink { 50% { opacity: .25; } }
.composer.has-text .send svg { transform: rotate(calc(-12deg * var(--dir))) translateX(calc(1px * var(--dir))); }
/* Point the paper plane the way text flows */
[dir="rtl"] .send svg path, [dir="rtl"] .attach svg path { transform: scaleX(-1); transform-origin: center; transform-box: fill-box; }
.send.is-sending svg { animation: sendFly .4s var(--ease-out); }

/* ---------- How it works ---------- */
.how { padding: 64px 0; background: var(--surface); border-top: 1px solid var(--border); }
h2 { margin: 0 0 28px; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.01em; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr); }
.steps li { padding: 24px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border); }
.step-num {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary-soft); color: var(--primary); font-weight: 800;
  transition: transform .3s var(--ease-out), background-color .3s, color .3s;
}
.steps li { transition: transform .25s var(--ease-out), box-shadow .25s, border-color .25s; }
.steps li:hover .step-num { transform: rotate(-8deg) scale(1.1); background: var(--primary); color: var(--primary-ink); }
.steps h3 { margin: 16px 0 6px; font-size: 1.1rem; }
.steps p { margin: 0; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { padding: 28px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: .875rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand img { height: 22px; width: auto; }
.footer-inner p { margin: 0; }
.footer-inner nav { display: flex; gap: 20px; }
.footer-inner a { color: var(--muted); text-decoration: none; }
.footer-inner a:hover { color: var(--text); }

/* ---------- Animations ---------- */
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(85, 201, 128, .55); }
  70% { box-shadow: 0 0 0 8px rgba(85, 201, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(85, 201, 128, 0); }
}
@keyframes typingBounce { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-4px); } }
@keyframes msgInEnd { from { opacity: 0; transform: translate(calc(12px * var(--dir)), 6px) scale(.96); } }
@keyframes msgInStart { from { opacity: 0; transform: translate(calc(-12px * var(--dir)), 6px) scale(.96); } }
@keyframes stateIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes composerIn { from { opacity: 0; transform: translateY(100%); } }
@keyframes popIn { from { opacity: 0; transform: scale(.6); } }
@keyframes chipSelect { 50% { transform: scale(1.06); } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sendFly {
  50% { transform: translate(calc(6px * var(--dir)), -6px) scale(.8); opacity: 0; }
  51% { transform: translate(calc(-6px * var(--dir)), 6px) scale(.8); }
}
@keyframes iconSwap { from { opacity: 0; transform: rotate(-90deg) scale(.5); } }
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-40px, 30px) scale(1.08); }
}

/* Theme toggle icon spins in each time it appears */
.theme-toggle svg { animation: iconSwap .4s var(--ease-out); }

/* Slow-moving glow behind the hero */
.hero { position: relative; overflow: clip; }
.hero::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 520px; height: 520px; inset-inline-end: -120px; top: -160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(150, 212, 234, .35), transparent 65%);
  animation: drift 14s ease-in-out infinite;
}
/* No z-index here: a stacking context would trap the full-screen chat under the sticky header */
.hero-grid { position: relative; }

/* Entrance + scroll reveal (only when JS runs, so content never stays hidden) */
/* Uses an animation (fill: backwards) rather than a transition so hover transitions keep working after */
.js .reveal { opacity: 0; }
.js .reveal.is-visible { opacity: 1; animation: revealUp .7s var(--ease-out) var(--delay, 0s) backwards; }
.js .reveal-scale.is-visible { animation-name: revealScale; }
@keyframes revealUp { from { opacity: 0; transform: translateY(22px); } }
@keyframes revealScale { from { opacity: 0; transform: translateY(24px) scale(.96); } }

/* Theme switch: circular wipe from the toggle button (View Transitions API) */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .hero { padding-top: 16px; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  /* Phones: the chat is the first thing on screen and fills it; the intro copy follows below */
  .chat {
    order: -1; position: relative; top: 0;
    height: calc(100vh - 64px - 32px); height: calc(100dvh - 64px - 32px); min-height: 460px;
    scroll-margin-top: 80px;
    --delay: 0s !important;
  }
  .steps { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  /* Not enough room in the header on phones; the chat header already shows the reply time */
  .header-status { display: none; }
  .header-inner { gap: 8px; }
  .brand { gap: 8px; }
  .brand-logo { height: 24px; }
  .lang-toggle { padding: 0 12px; }
  .stats li { flex-basis: 100%; }
  .msg { max-width: 90%; }
}
