/* PROPELA — estilos del home conversacional y del brief */
:root {
  --bg: #151615;
  --bg-elevated: #1f201f;
  --bg-muted: #1a1b1a;
  --user-bubble: rgba(255, 243, 16, 0.09);
  --user-border: rgba(255, 243, 16, 0.22);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f4f1;
  --text-soft: #e9e9e6;
  --text-secondary: #98989d;
  --text-tertiary: #8a8a8f;
  --gray: #d9d8d6;
  --yellow: #fff310;
  --yellow-ring: rgba(255, 243, 16, 0.16);
  --serif: "Noto Serif", Georgia, serif;
  --sans: "Poppins", system-ui, sans-serif;
  --gutter: clamp(20px, 4.5vw, 64px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--yellow); }
a:hover { color: #fff; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }

/* ── Marca de agua ── */
.ghost {
  position: fixed; right: -12vw; bottom: -14vw; width: min(62vw, 860px);
  opacity: 0.055; transform: rotate(-18deg); pointer-events: none; z-index: 0;
  animation: spin 90s linear infinite;
}
@keyframes spin { to { transform: rotate(342deg); } }

/* ── Encabezado ── */
.topbar {
  position: relative; z-index: 3;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 32px var(--gutter);
  transition: padding .4s ease;
}
.topbar .tag { font-size: 13px; color: var(--text-secondary); }
.topbar .logo { justify-self: center; display: block; }
.topbar .logo img { height: 34px; display: block; transition: height .4s ease; }
.topbar .site-link { justify-self: end; font-size: 14px; color: var(--gray); text-decoration: none; padding: 10px 0; }
.topbar .site-link:hover { color: var(--yellow); }

/* ══════════ HOME ══════════ */
.home { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }
.hero {
  position: relative; z-index: 2; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 34px; padding: 0 var(--gutter) 40px; text-align: center;
}
.greeting { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.greeting h1 {
  margin: 0; font-family: var(--serif); font-style: italic; font-weight: 600;
  font-size: clamp(34px, 4.2vw, 58px); line-height: 1.12; letter-spacing: -0.01em;
  max-width: 900px; text-wrap: balance;
}
.greeting p { margin: 0; font-size: clamp(16px, 1.5vw, 20px); line-height: 1.5; color: var(--text-secondary); }
.sketch { position: relative; display: inline-block; }
.sketch svg { position: absolute; left: -2%; bottom: -0.22em; width: 104%; height: 0.32em; overflow: visible; }
.sketch path { stroke-dasharray: 700; stroke-dashoffset: 700; animation: draw 1.1s .5s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.composer { width: min(680px, 100%); display: flex; flex-direction: column; align-items: center; gap: 16px; }
.capsule {
  width: 100%; height: 62px; display: flex; align-items: center; gap: 12px;
  padding: 0 9px 0 26px; background: var(--bg-elevated);
  border: 1px solid var(--border-strong); border-radius: 31px;
  transition: border-color .2s, box-shadow .2s;
}
.capsule:focus-within { border-color: rgba(255, 243, 16, 0.55); box-shadow: 0 0 0 4px var(--yellow-ring); }
.capsule input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: none;
  font-size: 16px; color: var(--text);
}
.capsule input::placeholder { color: var(--text-tertiary); }
.send {
  width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 22px;
  background: var(--yellow); display: grid; place-items: center; cursor: pointer;
  transition: transform .15s, opacity .2s;
}
.send:hover { transform: scale(1.06); }
.send:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.send svg { width: 20px; height: 20px; }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.chip {
  min-height: 44px; padding: 0 18px; border-radius: 999px; background: transparent;
  border: 1px solid var(--border-strong); color: var(--gray); font-size: 14px; cursor: pointer;
  transition: border-color .2s, color .2s;
}
.chip:hover { border-color: var(--yellow); color: var(--yellow); }
.hint { font-size: 13px; color: var(--text-tertiary); }

.footer {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 26px var(--gutter); border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.footer span { font-size: 13px; color: var(--text-secondary); }
.footer a { font-size: 14px; font-weight: 500; text-decoration: none; }

/* ── Conversación ── */
.thread {
  position: relative; z-index: 2; display: none;
  width: min(780px, 100%); margin: 0 auto; padding: 8px var(--gutter) 170px;
  flex-direction: column; gap: 22px;
}
.msg { max-width: 88%; font-size: 15px; line-height: 1.55; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.msg.user {
  align-self: flex-end; max-width: 78%; padding: 14px 18px;
  background: var(--user-bubble); border: 1px solid var(--user-border); border-radius: 18px 18px 4px 18px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.agent { display: flex; gap: 12px; align-items: flex-start; }
.avatar {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%;
  border: 1px solid var(--border-strong); display: grid; place-items: center;
}
.avatar img { width: 20px; }
.bubble {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px 18px; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 4px 18px 18px 18px; color: var(--text-soft);
}
.bubble p { margin: 0; }
.bubble .who { font-size: 12px; color: var(--text-secondary); letter-spacing: .04em; }
.idea { display: flex; gap: 14px; }
.idea .n { font-family: var(--serif); font-style: italic; font-weight: 600; color: var(--yellow); font-size: 17px; }
.idea .t { font-family: var(--serif); font-style: italic; font-weight: 600; color: #fff; font-size: 17px; }
.next-step { padding-top: 12px; border-top: 1px solid var(--border); color: var(--text-secondary); }
.next-step strong { color: var(--text-soft); font-weight: 500; }

.typing { display: flex; gap: 5px; padding: 16px 18px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.handoff {
  margin-left: 44px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 22px 24px; border: 1px solid rgba(255, 243, 16, 0.4); border-radius: 18px;
  animation: rise .4s ease both;
}
.handoff .txt { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; }
.handoff .ttl { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 22px; color: #fff; }
.handoff .det { font-size: 14px; color: var(--text-secondary); }
.btn-yellow {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px; border: 0; border-radius: 999px;
  background: var(--yellow); color: #151615; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .15s;
}
.btn-yellow:hover { color: #151615; transform: translateY(-1px); }
.btn-yellow svg { width: 18px; height: 18px; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; display: none;
  padding: 16px var(--gutter) 26px;
  background: linear-gradient(to top, var(--bg) 70%, rgba(21, 22, 21, 0));
}
.dock .composer { margin: 0 auto; width: min(780px, 100%); gap: 10px; }
.dock .capsule { height: 58px; }
.counter { font-size: 12px; color: var(--text-tertiary); }
.capsule.closed { border-style: dashed; background: var(--bg-muted); }

/* Modo conversación */
body.chatting .hero { display: none; }
body.chatting .footer { display: none; }
body.chatting .thread { display: flex; }
body.chatting .dock { display: block; }
body.chatting .topbar {
  position: sticky; top: 0; padding-top: 20px; padding-bottom: 20px;
  grid-template-columns: auto 1fr auto; background: var(--bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
body.chatting .topbar .tag { display: none; }
body.chatting .topbar .logo { justify-self: start; grid-column: 1; }
body.chatting .topbar .logo img { height: 24px; }
body.chatting .topbar .site-link { grid-column: 3; }

/* ══════════ BRIEF ══════════ */
.brief-page { position: relative; z-index: 2; min-height: 100vh; }
.brief-page .topbar { grid-template-columns: auto 1fr auto; border-bottom: 1px solid rgba(255,255,255,.06); padding-top: 24px; padding-bottom: 24px; }
.brief-page .topbar .logo { justify-self: start; }
.brief-page .topbar .logo img { height: 24px; }
.brief-page .topbar .site-link { grid-column: 3; }
.brief-grid {
  display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 72px;
  padding: 56px var(--gutter) 80px; max-width: 1440px; margin: 0 auto;
}
.brief-side { display: flex; flex-direction: column; gap: 22px; align-self: start; position: sticky; top: 32px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--yellow); }
.brief-side h1 {
  margin: 0; font-family: var(--serif); font-style: italic; font-weight: 600;
  font-size: clamp(32px, 2.8vw, 40px); line-height: 1.1; text-transform: uppercase;
}
.brief-side p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--text-secondary); }
.progress { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.progress .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--gray); }
.progress .row span:last-child { color: var(--text-secondary); }
.track { height: 4px; border-radius: 2px; background: rgba(255,255,255,.08); overflow: hidden; }
.track div { height: 100%; background: var(--yellow); border-radius: 2px; transition: width .4s ease; }
.understood {
  padding: 18px 20px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.understood p { font-size: 14px; color: var(--gray); }
.understood .eyebrow { font-size: 11px; }

.brief-main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.card {
  padding: 18px 20px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.card .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.label { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-secondary); }
.edit { background: none; border: 0; color: var(--yellow); font-size: 13px; padding: 6px 0; cursor: pointer; }
.card textarea {
  width: 100%; min-height: 1.5em; field-sizing: content; resize: none; background: transparent; border: 0; outline: none;
  color: var(--text); font-size: 15px; line-height: 1.5; padding: 0;
}
.card textarea[readonly] { resize: none; cursor: default; }
.card.editing { border-color: rgba(255, 243, 16, 0.55); box-shadow: 0 0 0 4px var(--yellow-ring); }
.routes { padding: 18px 20px; border: 1px solid var(--border); border-radius: 14px; display: flex; gap: 24px; align-items: baseline; flex-wrap: wrap; }
.routes .list { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 16px; color: #fff; }

.missing { display: flex; flex-direction: column; gap: 14px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 13px; color: var(--gray); }
.field input, .field textarea {
  width: 100%; min-height: 50px; padding: 13px 18px; background: var(--bg-elevated);
  border: 1px solid rgba(255, 243, 16, 0.35); border-radius: 12px; color: var(--text); font-size: 15px; outline: none;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus { border-color: rgba(255, 243, 16, 0.7); box-shadow: 0 0 0 4px var(--yellow-ring); }
.field input::placeholder, .field textarea::placeholder { color: var(--text-tertiary); }
.field.error input, .field.error textarea { border-color: #ff8a65; }
.field .err { font-size: 12px; color: #ff9f80; }
.actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding-top: 8px; }
.actions .note { font-size: 13px; color: var(--text-secondary); }
.btn-ghost {
  min-height: 48px; padding: 0 22px; border-radius: 999px; background: transparent;
  border: 1px solid var(--border-strong); color: var(--gray); cursor: pointer; font-size: 14px;
}
.btn-ghost:hover { border-color: var(--yellow); color: var(--yellow); }
.status {
  padding: 18px 22px; border-radius: 14px; font-size: 15px; line-height: 1.55;
  background: var(--bg-elevated); border: 1px solid rgba(255, 243, 16, 0.4); color: var(--text-soft);
}
.status.bad { border-color: #ff8a65; }

/* Brief directo: una pregunta a la vez */
.step { display: flex; flex-direction: column; gap: 18px; animation: rise .35s ease both; }
.step .count { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-tertiary); }
.step h2 { margin: 0; font-family: var(--serif); font-style: italic; font-weight: 600; font-size: clamp(26px, 2.6vw, 34px); line-height: 1.2; }
.step .pista { margin: 0; font-size: 14px; color: var(--text-secondary); line-height: 1.55; }
.hp { position: absolute; left: -9999px; }

/* ── Celular ── */
@media (max-width: 860px) {
  .brief-grid { grid-template-columns: 1fr; gap: 36px; padding-top: 36px; }
  .brief-side { position: static; }
}
@media (max-width: 640px) {
  .topbar { grid-template-columns: auto 1fr auto; padding-top: 20px; padding-bottom: 20px; }
  .topbar .tag { display: none; }
  .topbar .logo { justify-self: start; grid-column: 1; }
  .topbar .logo img { height: 24px; }
  .topbar .site-link { grid-column: 3; }
  .hero { align-items: stretch; text-align: left; gap: 26px; }
  .greeting { align-items: flex-start; }
  .capsule { height: 56px; padding-left: 20px; padding-right: 6px; }
  .chips { justify-content: flex-start; gap: 8px; }
  .chip { font-size: 13px; padding: 0 16px; }
  .hint { display: none; }
  .footer span { display: none; }
  .msg { font-size: 14.5px; }
  .msg.agent { max-width: 96%; }
  .msg.user { max-width: 86%; }
  .avatar { width: 28px; height: 28px; }
  .avatar img { width: 17px; }
  .handoff { margin-left: 0; }
  .handoff .btn-yellow { width: 100%; }
  .cards, .fields { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sketch path { stroke-dashoffset: 0; }
}
@media (hover: none), (max-width: 700px) { .note-keys { display: none; } }
