:root {
  --mit-red: #A31F34;
  --mit-red-soft: #C9456A;
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --ink-muted: #6b6b6b;
  --paper: #ffffff;
  --paper-warm: #fafaf7;
  --line: #e5e5e5;
  --line-soft: #f0f0f0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 8px 24px rgba(163, 31, 52, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background: var(--paper-warm);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.top-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--mit-red) 0%, var(--mit-red-soft) 100%);
}

/* ---------- HERO ---------- */
.hero {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 4.5rem 1.5rem 3.5rem;
}

.hero-inner {
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
}

.kicker {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mit-red);
  font-weight: 600;
  margin-bottom: 1rem;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid #d8e8d8;
  background: #f1faf1;
  color: #1f6b2c;
  border-radius: 999px;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.phase-badge strong { color: #14541f; font-weight: 700; }

.phase-version {
  display: inline-block;
  background: #14541f;
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  margin: 0 0.1rem;
}

.phase-badge-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2bb24a;
  box-shadow: 0 0 0 0 rgba(43, 178, 74, 0.55);
  animation: phasePulse 1.8s ease-out infinite;
}

@keyframes phasePulse {
  0%   { box-shadow: 0 0 0 0   rgba(43, 178, 74, 0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(43, 178, 74, 0); }
  100% { box-shadow: 0 0 0 0   rgba(43, 178, 74, 0); }
}

.hero h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
  color: var(--ink);
}

.hero h1 .accent { color: var(--mit-red); }

.hero .lead {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--ink-soft);
  max-width: 720px;
  margin: 0 auto 2rem;
}

.hero .signature {
  font-size: 0.95rem;
  color: var(--ink-muted);
  font-style: italic;
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
  max-width: 720px;
  margin: 0 auto;
}

.hero .signature strong { color: var(--ink); font-style: normal; }

/* ---------- PARTICIPANTS ---------- */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.section-head {
  text-align: center;
  margin-bottom: 3rem;
}

.section-head h2 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 600;
  color: var(--ink);
  display: inline-block;
  position: relative;
  padding-bottom: 0.5rem;
}

.section-head h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 3px;
  background: var(--mit-red);
}

.section-head p {
  margin-top: 1rem;
  color: var(--ink-muted);
  font-size: 0.98rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.6rem 1.4rem;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--mit-red);
  box-shadow: var(--shadow-hover);
}

.card .avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f5e6ea 0%, #efd4d9 100%);
  color: var(--mit-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  font-weight: 600;
  margin-bottom: 1rem;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}

.card .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card .name {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}

.card .role {
  font-size: 0.82rem;
  color: var(--mit-red);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
  line-height: 1.4;
}

.card .bio {
  font-size: 0.93rem;
  color: var(--ink-soft);
  line-height: 1.55;
  flex: 1;
  margin-bottom: 1rem;
}

.card .linkedin {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.card .linkedin:hover {
  color: #fff;
  background: #0a66c2;
  border-color: #0a66c2;
}

.card .linkedin svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* ---------- FOOTER ---------- */
footer {
  background: var(--ink);
  color: #d4d4d4;
  padding: 2.5rem 1.5rem;
  text-align: center;
}

footer .footer-inner {
  max-width: 960px;
  margin: 0 auto;
}

footer .footer-link {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 2px solid var(--mit-red);
  padding-bottom: 2px;
  margin-bottom: 1rem;
  transition: color 0.15s ease;
}

footer .footer-link:hover { color: var(--mit-red-soft); }

footer .footer-meta {
  font-size: 0.85rem;
  color: #999;
  margin-top: 0.5rem;
}

/* ---------- EXPLICACIÓN ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--mit-red);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 2rem;
}

.back-link:hover { text-decoration: underline; }

.prose {
  max-width: 760px;
  margin: 0 auto;
}

.prose h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.8rem;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}

.prose h3 .step-num {
  color: var(--mit-red);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.prose p {
  margin-bottom: 1rem;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

.prose .analogy {
  background: var(--paper);
  border-left: 3px solid var(--mit-red);
  padding: 1rem 1.2rem;
  border-radius: 0 6px 6px 0;
  margin: 1.2rem 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.prose .analogy strong { color: var(--ink); }

.prose code {
  background: #f3f3f0;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: 'Consolas', 'Courier New', monospace;
  color: var(--mit-red);
}

/* ---------- CHAT WIDGET ---------- */
.chat-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--mit-red);
  color: #fff;
  border: none;
  box-shadow: 0 6px 18px rgba(163, 31, 52, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  z-index: 999;
}

.chat-toggle:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 24px rgba(163, 31, 52, 0.45);
}

.chat-toggle svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.chat-window {
  position: fixed;
  bottom: 6rem;
  right: 1.5rem;
  width: 360px;
  max-width: calc(100vw - 2rem);
  height: 520px;
  max-height: calc(100vh - 8rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 998;
  animation: chatPop 0.18s ease-out;
}

@keyframes chatPop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-window[hidden] { display: none; }

.chat-header {
  background: linear-gradient(135deg, var(--mit-red) 0%, var(--mit-red-soft) 100%);
  color: #fff;
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-header .chat-title {
  font-weight: 600;
  font-size: 0.98rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.chat-header .chat-title::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6dde6d;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.chat-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.3rem;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.chat-close:hover { opacity: 1; }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--paper-warm);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scroll-behavior: smooth;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.65rem 0.9rem;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  word-wrap: break-word;
  animation: bubbleIn 0.2s ease-out;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-bubble-agente {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

.chat-bubble-usuario {
  align-self: flex-end;
  background: var(--mit-red);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem;
  border-top: 1px solid var(--line);
  background: var(--paper);
  flex-shrink: 0;
}

.chat-form input[type="text"] {
  flex: 1;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.chat-form input[type="text"]:focus {
  border-color: var(--mit-red);
}

.chat-form button {
  background: var(--mit-red);
  color: #fff;
  border: none;
  padding: 0 1rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.chat-form button:hover { background: #8a1a2c; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 600px) {
  .hero { padding: 3rem 1.25rem 2.5rem; }
  .section { padding: 3rem 1.25rem; }
  .grid { grid-template-columns: 1fr; }
  .card { padding: 1.4rem 1.2rem; }

  .chat-window {
    bottom: 5.5rem;
    right: 1rem;
    left: 1rem;
    width: auto;
    height: calc(100vh - 7rem);
  }
  .chat-toggle {
    bottom: 1rem;
    right: 1rem;
  }
}
