/* =========================================================
   SFRANKIE — Sistema de diseño
   Metáfora: recepción de un anfitrión, de noche.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* Color */
  --page-bg: #08090b;
  --ink: #0e1116;
  --ink-soft: #12161d;
  --surface: #171b22;
  --surface-raised: #1d222b;
  --border: #2a3038;
  --brass: #c89b5c;
  --brass-dim: #8a6b3e;
  --parchment: #edeae2;
  --slate: #8b92a0;
  --live: #6fcf97;

  /* Type */
  --f-display: 'Fraunces', Georgia, serif;
  --f-body: 'Inter', system-ui, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, monospace;

  /* Layout */
  --stage-max: 430px;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--parchment);
  font-family: var(--f-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

input[type="text"] {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--parchment);
  background: transparent;
}

img { display: block; max-width: 100%; }

/* ---------- Escenario (contenedor de la app) ---------- */

.stage {
  position: relative;
  width: 100%;
  max-width: var(--stage-max);
  min-height: 100dvh;
  overflow: hidden;
  background: var(--ink-soft);
  isolation: isolate;
}

/* En pantallas más anchas que un teléfono, el escenario se comporta
   como una tarjeta centrada en vez de estirarse a lo ancho */
@media (min-width: 640px) {
  body { padding: 48px 24px; align-items: flex-start; }
  .stage {
    min-height: 860px;
    height: 860px;
    margin: 0 auto;
    border-radius: 32px;
    border: 1px solid var(--border);
  }
}

/* ---------- Foto del avatar (imagen estática, sin animación) ---------- */

.avatar-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 38%, #1a2029 0%, var(--ink) 72%);
}

.avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  background: var(--surface);
}

/* Se muestra si la imagen del cliente todavía no está cargada en /assets */
.avatar-photo-fallback {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate);
  font-family: var(--f-mono);
  font-size: 0.7rem;
  text-align: center;
  padding: 12px;
  line-height: 1.4;
}

/* ---------- Franja de instalación (solo primera visita) ---------- */

.install-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--parchment);
}

.install-banner .dismiss {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  color: var(--slate);
  flex-shrink: 0;
}

/* ---------- Pill de estado "en vivo" ---------- */

.status-pill {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--slate);
}

.status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--live);
}

/* ---------- Botones circulares flotantes ---------- */

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--parchment);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn--top {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
}

/* ---------- Arco de latón: firma visual del anfitrión ---------- */

.brass-arc {
  position: absolute;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 340px;
  height: 160px;
  border-radius: 50%;
  border-top: 1.5px solid var(--brass-dim);
  box-shadow: 0 -8px 24px -12px rgba(200, 155, 92, 0.35);
  z-index: 2;
  pointer-events: none;
}

.mic-btn {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 1.5px solid var(--brass);
  color: var(--brass);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 6px rgba(200, 155, 92, 0.08);
}

/* ---------- Slogan ---------- */

.slogan {
  position: absolute;
  bottom: 96px;
  left: 0;
  right: 0;
  z-index: 3;
  text-align: center;
  font-family: var(--f-display);
  font-weight: 400;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--slate);
  letter-spacing: 0.01em;
}

/* ---------- Tarjeta de respuesta (subtítulo + fuentes) ---------- */

.answer-card {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 92px;
  z-index: 4;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.answer-card .status-line {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  color: var(--brass);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
}

.answer-card p.answer-text {
  margin: 0 0 12px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--parchment);
}

.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  color: var(--brass);
  background: rgba(200, 155, 92, 0.1);
  border: 1px solid rgba(200, 155, 92, 0.25);
  padding: 4px 10px;
  border-radius: 999px;
  text-decoration: none;
}

/* ---------- Drawer de historial ---------- */

.scrim {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(14, 17, 22, 0.55);
}

.drawer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 108px;
  z-index: 6;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
}

.drawer-handle-row {
  display: flex;
  justify-content: center;
  padding: 10px 0 4px;
}

.drawer-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

.drawer-title {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  margin: 4px 0 10px;
}

.transcript {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bubble {
  max-width: 80%;
  font-size: 0.88rem;
  line-height: 1.45;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
}

.bubble--user {
  align-self: flex-end;
  background: rgba(200, 155, 92, 0.14);
  color: var(--parchment);
  border: 1px solid rgba(200, 155, 92, 0.2);
}

.bubble-group {
  align-self: flex-start;
  max-width: 82%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bubble--host {
  background: var(--surface-raised);
  color: var(--parchment);
  border: 1px solid var(--border);
}

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

.composer input[type="text"] {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  border-radius: 999px;
  padding: 9px 14px;
}

.composer input[type="text"]::placeholder {
  color: var(--slate);
}

.composer .icon-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

/* ---------- Navegación de demo (solo para revisar pantallas) ---------- */

.demo-nav {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 50;
  display: flex;
  gap: 6px;
  background: rgba(23, 27, 34, 0.9);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  font-family: var(--f-mono);
  font-size: 0.68rem;
}

.demo-nav a {
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--slate);
  text-decoration: none;
}

.demo-nav a[aria-current="page"] {
  background: var(--brass);
  color: var(--ink);
}

/* ---------- Accesibilidad ---------- */

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

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
