/* rodrigoballescaba.app. Tokens compartidos con el CV (cobalto + Bricolage/Source Sans). */
:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --ink: #16181d;
  --muted: #5d6470;
  --rule: #dfe2e6;
  --accent: #1b56c8;
  --accent-ink: #ffffff;
  --accent-soft: #e6edfb;
  --chat: #eceff3;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --code: ui-monospace, "Cascadia Code", Consolas, monospace;
  --wrap: 1120px;
  --gutter: clamp(18px, 4vw, 40px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101318;
    --surface: #171b22;
    --ink: #e9ecf1;
    --muted: #9aa3b0;
    --rule: #272d36;
    --accent: #7ea3ff;
    --accent-ink: #0d1320;
    --accent-soft: #1a2439;
    --chat: #1d222b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 20; }
.skip:focus { left: 8px; }

/* Cabecera */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.top .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { font-family: var(--display); font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; text-decoration: none; }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 0.95rem; }
.nav a:hover { color: var(--ink); }
.top-actions { display: flex; align-items: center; gap: 14px; }
.lang { font-weight: 700; font-size: 0.9rem; text-decoration: none; color: var(--muted); }
.lang:hover { color: var(--ink); }
@media (max-width: 820px) { .nav { display: none; } .top-actions { margin-left: auto; } }

/* Botones */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px;
  font-weight: 700; font-size: 0.98rem; text-decoration: none;
  border: 1.5px solid var(--ink);
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost:hover { background: var(--surface); }
.btn-sm { padding: 7px 12px; font-size: 0.88rem; border-radius: 8px; }

/* Hero */
.hero { padding-block: clamp(40px, 7vw, 88px) clamp(48px, 7vw, 96px); }
.hero .wrap { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(32px, 6vw, 72px); align-items: center; }
@media (max-width: 900px) { .hero .wrap { grid-template-columns: 1fr; } }
.who { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.who img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; }
.who strong { display: block; font-size: 1.02rem; }
.who span { color: var(--muted); font-size: 0.95rem; }
h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.35rem, 5.2vw, 4.1rem);
  line-height: 1.02; letter-spacing: -0.035em;
  margin: 0 0 22px; max-width: 14ch;
}
.lead { font-size: clamp(1.08rem, 1.6vw, 1.22rem); color: var(--muted); max-width: 54ch; margin: 0 0 30px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.availability { margin-top: 22px; font-size: 0.95rem; color: var(--muted); }

/* Teléfono con el chat del agente */
.phone {
  width: min(100%, 330px); margin-inline: auto;
  background: var(--chat);
  border: 10px solid var(--ink); border-radius: 40px;
  overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(16, 24, 48, 0.45);
}
.phone-bar { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; background: var(--surface); border-bottom: 1px solid var(--rule); }
.phone-bar .dot { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-family: var(--display); }
.phone-bar b { display: block; font-size: 0.92rem; line-height: 1.2; }
.phone-bar small { color: var(--muted); font-size: 0.78rem; }
.chat { list-style: none; margin: 0; padding: 16px 12px 18px; display: flex; flex-direction: column; gap: 8px; min-height: 430px; font-size: 0.9rem; line-height: 1.4; }
.msg { max-width: 84%; padding: 8px 12px; border-radius: 14px; }
.msg.bot { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 4px; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.tool {
  align-self: flex-start; background: transparent; padding: 2px 4px;
  font-family: var(--code); font-size: 0.74rem; color: var(--muted);
}
.msg.tool::before { content: "↳ "; color: var(--accent); }
.msg.typing { align-self: flex-start; background: var(--surface); display: none; gap: 4px; }
.msg.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.msg.typing i:nth-child(2) { animation-delay: .15s; }
.msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .25; } }
.js .chat .msg:not(.typing) { opacity: 0; transform: translateY(6px); transition: opacity .35s ease, transform .35s ease; }
.js .chat .msg.in { opacity: 1; transform: none; }
.js .chat .msg.typing.show { display: flex; }
.phone-caption { max-width: 330px; margin: 16px auto 0; font-size: 0.9rem; color: var(--muted); }
.replay { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  .js .chat .msg:not(.typing) { opacity: 1; transform: none; transition: none; }
  .replay { display: none; }
}

/* Secciones */
section.block { padding-block: clamp(56px, 8vw, 104px); border-top: 1px solid var(--rule); }
.block h2 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  letter-spacing: -0.03em; line-height: 1.08;
  margin: 0 0 14px;
}
.block .intro { color: var(--muted); max-width: 60ch; margin: 0 0 40px; font-size: 1.1rem; }
h3 { font-family: var(--display); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.015em; margin: 0 0 12px; }

/* IA */
.ai-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 760px) { .ai-grid { grid-template-columns: 1fr; } }
.ai-col { background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 26px 26px 20px; }
.ai-col.primary { background: var(--accent-soft); border-color: transparent; }
.ai-col ul { margin: 0; padding: 0; list-style: none; }
.ai-col li { padding: 11px 0; border-top: 1px solid var(--rule); }
.ai-col.primary li { border-top-color: color-mix(in srgb, var(--accent) 18%, transparent); }
.ai-col li:first-child { border-top: 0; padding-top: 0; }
.ai-col li b { display: block; }
.ai-col li span { color: var(--muted); font-size: 0.96rem; }

/* Proyectos */
.feature {
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 20px;
  padding: clamp(24px, 4vw, 40px); margin-bottom: 40px;
}
@media (max-width: 820px) { .feature { grid-template-columns: 1fr; } }
.feature .kicker { color: var(--accent); font-weight: 700; margin: 0 0 6px; }
.feature p { margin: 0 0 16px; }
.feature ul { margin: 0; padding-left: 1.1em; }
.feature li { margin-bottom: 8px; }
.feature li::marker { color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; padding: 0; list-style: none; }
.tags li { border: 1px solid var(--rule); border-radius: 999px; padding: 3px 11px; font-size: 0.88rem; font-weight: 600; }
.apps-title { margin-top: 8px; }
.apps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
@media (max-width: 900px) { .apps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .apps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.app { background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 16px; }
.app img { width: 56px; height: 56px; border-radius: 13px; margin-bottom: 12px; }
.app b { display: block; margin-bottom: 6px; }
.app a { font-size: 0.88rem; color: var(--muted); text-decoration: none; margin-right: 10px; white-space: nowrap; }
.app a:hover { color: var(--accent); text-decoration: underline; }
.clients { margin-top: 36px; color: var(--muted); }
.clients b { color: var(--ink); }

/* Experiencia: línea temporal (sí es una secuencia) */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--rule); }
.timeline > li { position: relative; padding: 0 0 34px 28px; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before {
  content: ""; position: absolute; left: -7px; top: 7px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.timeline > li.now::before { background: var(--accent); }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; align-items: baseline; }
.job-head h3 { margin: 0; }
.job-when { color: var(--muted); font-size: 0.95rem; white-space: nowrap; }
.job-org { color: var(--accent); font-weight: 700; margin: 2px 0 10px; }
.job-org span { color: var(--muted); font-weight: 400; }
.timeline ul { margin: 0; padding-left: 1.1em; max-width: 72ch; }
.timeline ul li { margin-bottom: 6px; }

/* Stack + formación */
.two { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(32px, 6vw, 72px); }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
.stack { margin: 0; }
.stack div { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 12px 0; border-top: 1px solid var(--rule); }
.stack div:first-child { border-top: 0; padding-top: 0; }
.stack dt { font-weight: 700; }
.stack dd { margin: 0; color: var(--muted); }
@media (max-width: 480px) { .stack div { grid-template-columns: 1fr; gap: 2px; } }
.edu { list-style: none; margin: 0; padding: 0; }
.edu li { padding: 12px 0; border-top: 1px solid var(--rule); }
.edu li:first-child { border-top: 0; padding-top: 0; }
.edu b { display: block; }
.edu span { color: var(--muted); font-size: 0.96rem; }

/* Contacto */
.contact-mail {
  display: inline-block; font-family: var(--display); font-weight: 800;
  font-size: clamp(1.4rem, 4.4vw, 2.9rem); letter-spacing: -0.03em;
  color: var(--accent); text-decoration: none; word-break: break-all; margin: 8px 0 28px;
}
.contact-mail:hover { text-decoration: underline; text-underline-offset: 6px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 12px; }

footer { border-top: 1px solid var(--rule); padding-block: 28px; color: var(--muted); font-size: 0.92rem; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
