/* Tokens de color: claro por defecto, oscuro según el sistema. */
:root {
  --bg: #f5f0e6;
  --surface: #fffcf5;
  --surface-2: #ece4d3;
  --ink: #1c1915;
  --ink-2: #4a4439;
  --muted: #6b6356;
  --line: #d9cfbb;
  --accent: #b8381a;          /* sólo para CTAs: contraste 5:1 con texto claro */
  --accent-ink: #fff8f2;
  --accent-soft: #f3d9cc;
  --focus: #0a57a8;
  --ok: #2e6b3b;
  --mid: #7a5410;
  --low: #8a2a2a;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: 16px;
  --radius: 14px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14120f;
    --surface: #1c1915;
    --surface-2: #26221c;
    --ink: #f2ece0;
    --ink-2: #cdc4b3;
    --muted: #a39a88;
    --line: #3a342b;
    --accent: #ff7a4d;
    --accent-ink: #1d0f08;
    --accent-soft: #3a2119;
    --focus: #8fc0ff;
    --ok: #8fd19e;
    --mid: #e6c26d;
    --low: #f09a9a;
  }
}

:root[data-theme="dark"] {
  --bg: #14120f;
  --surface: #1c1915;
  --surface-2: #26221c;
  --ink: #f2ece0;
  --ink-2: #cdc4b3;
  --muted: #a39a88;
  --line: #3a342b;
  --accent: #ff7a4d;
  --accent-ink: #1d0f08;
  --accent-soft: #3a2119;
  --focus: #8fc0ff;
  --ok: #8fd19e;
  --mid: #e6c26d;
  --low: #f09a9a;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.js { scroll-padding-top: 16px; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.15; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
a { color: var(--ink); }
img, svg { display: block; max-width: 100%; }
ul, ol { margin: 0; }
select, textarea, button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: -9999px; top: 8px; }
.skip:focus {
  left: var(--gutter); z-index: 50; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.help { color: var(--muted); font-size: 0.9rem; margin: 0; }
.lead-sm { color: var(--ink-2); font-size: 1.05rem; margin-top: 10px; }

/* ---------- Header ---------- */
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px var(--gutter);
  max-width: 1120px; margin: 0 auto;
}
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; text-decoration: none; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 10px; }
.lang select {
  min-height: 40px; min-width: 112px; padding: 0 30px 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  font-size: 0.9rem;
}
/* En móvil el botón principal ya está fijo abajo: no se repite en el header. */
@media (max-width: 559px) {
  .top .btn-sm { display: none; }
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; padding: 0 20px; border-radius: 999px;
  border: 1.5px solid transparent; font-weight: 600; font-size: 1rem;
  text-decoration: none; text-align: center; cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.25s var(--ease),
    background-color 0.2s, border-color 0.2s, color 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 8px 20px -10px var(--accent);
}
.btn-primary::after {
  content: "→"; display: inline-block; transition: transform 0.25s var(--ease);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 26px -12px var(--accent);
}
.btn-primary:hover:not(:disabled)::after { transform: translateX(4px); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink); background: var(--surface); transform: translateY(-2px); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 0.92rem; }
.btn-lg { min-height: 54px; padding: 0 26px; font-size: 1.05rem; }
.btn-block { width: 100%; }

.link-arrow {
  text-decoration: none; font-weight: 600;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1.5px no-repeat;
  transition: background-size 0.35s var(--ease);
  padding-bottom: 2px;
}
.link-arrow:hover { background-size: 100% 1.5px; }

/* ---------- Chips ---------- */
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  font-size: 0.82rem; padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.chips li:hover { border-color: var(--ink-2); transform: translateY(-1px); }

/* ---------- Hero ---------- */
.hero {
  display: grid; gap: 40px; align-items: center;
  max-width: 1120px; margin: 0 auto;
  padding: 40px var(--gutter) 40px;
}
@media (min-width: 900px) {
  .hero { grid-template-columns: 1.4fr 0.9fr; padding-top: 72px; }
}
.eyebrow {
  display: flex; align-items: center; gap: 10px; margin: 0 0 8px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  flex: 0 0 8px;
}
.hero-title {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(2.1rem, 8vw, 4.4rem);
  line-height: 1.03; letter-spacing: -0.025em;
  margin: 12px 0 18px; text-wrap: balance;
  font-optical-sizing: auto;
}
.lead {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem); color: var(--ink-2);
  max-width: 36em; margin: 0 0 26px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.hero-actions .btn { flex: 1 1 220px; }
@media (min-width: 560px) { .hero-actions .btn { flex: 0 1 auto; } }

.hero-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; box-shadow: 8px 8px 0 var(--line);
}
.hero-card-profile { padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.card-name { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; margin: 0 0 4px; }
.card-title { font-weight: 600; margin: 0 0 2px; }
.card-label {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 12px;
}
.steps { list-style: none; padding: 0; display: grid; gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; color: var(--ink-2); }
.step-n {
  flex: 0 0 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 0.85rem;
  border: 1.5px solid var(--ink);
}

/* ---------- Cinta de plataformas ---------- */
.marquee-wrap { margin: 8px 0 0; }
.marquee {
  overflow: hidden; border-block: 1px solid var(--line);
  padding: 16px 0;
}
.marquee-track { display: flex; flex-wrap: wrap; justify-content: center; }
html.js .marquee-track {
  flex-wrap: nowrap; justify-content: flex-start; width: max-content;
  animation: marquee 40s linear infinite;
}
html.js .marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-group { display: flex; list-style: none; margin: 0; padding: 0; flex-shrink: 0; }
html:not(.js) .marquee-group { flex-wrap: wrap; justify-content: center; }
.marquee-group li {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: clamp(1.3rem, 3.4vw, 2rem); color: var(--ink-2);
  white-space: nowrap; padding-right: 28px; margin-right: 28px;
  position: relative;
}
.marquee-group li::after {
  content: ""; position: absolute; right: 0; top: 50%;
  width: 6px; height: 6px; margin-top: -3px; border-radius: 50%;
  background: var(--line);
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Secciones ---------- */
.section {
  max-width: 1120px; margin: 0 auto;
  padding: 72px var(--gutter);
}
.section-head { margin-bottom: 32px; max-width: 680px; }
.section-head .eyebrow { margin-bottom: 8px; }
h2 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.75rem, 4.2vw, 2.6rem);
  line-height: 1.1; letter-spacing: -0.01em; margin-bottom: 4px;
}
.col-title {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--muted); margin: 0 0 12px;
}

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .cards.three { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s;
}
.card:hover {
  transform: translateY(-4px); border-color: var(--ink-2);
  box-shadow: 0 18px 30px -22px rgba(20, 16, 10, 0.45);
}
.card h3 { font-family: var(--sans); font-size: 1.08rem; font-weight: 700; margin: 8px 0 8px; }
.card p { color: var(--ink-2); margin: 0; }
.card-n { font-family: var(--serif); font-style: italic; font-size: 1.6rem; color: var(--muted); }
.card .chips { margin: 12px 0 10px; }
.card .link-arrow { font-size: 0.92rem; }

/* Timeline de experiencia */
.timeline {
  list-style: none; padding: 0 0 0 22px; margin: 0;
  border-left: 1.5px solid var(--line); display: grid; gap: 36px;
}
.timeline-item { position: relative; }
.timeline-item::before {
  content: ""; position: absolute; left: -29px; top: 8px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--ink);
}
.job-head { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.job-company { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.job-role { font-weight: 600; margin: 0; }
.job-period { margin: 0; color: var(--muted); font-size: 0.9rem; width: 100%; }
.job-points { padding-left: 18px; margin: 12px 0; color: var(--ink-2); }
.job-points li { margin: 4px 0; }
.timeline-item .chips { margin-top: 10px; }

.summary { margin: 0 0 40px; max-width: 72ch; }
.summary .lead-sm { margin-top: 0; }
.edu { margin-top: 56px; }
.edu-grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .edu-grid { grid-template-columns: 1fr 1fr; } }
.plain { list-style: none; padding: 0; }
.plain li { padding: 10px 0; border-bottom: 1px solid var(--line); }

.skills { display: grid; gap: 24px; }
@media (min-width: 640px) { .skills { grid-template-columns: 1fr 1fr; } }
.skill-title { font-size: 0.95rem; font-weight: 700; margin: 0 0 10px; }

/* Contacto */
.contact-links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.contact-links li { display: contents; }
.contact-cv { margin-top: 24px; }

/* ---------- Herramienta ---------- */
.tool {
  background: var(--surface);
  border-block: 1px solid var(--line);
  padding: 64px var(--gutter);
  scroll-margin-top: 8px;
}
.tool > * { max-width: 1120px; margin-inline: auto; }
.tool .section-head { margin-bottom: 28px; }
.tool-form { max-width: 860px; }
.label { display: block; font-weight: 600; margin-bottom: 8px; }
textarea, select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--bg); color: var(--ink);
  transition: border-color 0.2s;
}
textarea {
  min-height: 190px; padding: 16px; resize: vertical;
  font-size: 1rem; line-height: 1.5;
}
textarea:focus, select:focus { border-color: var(--ink); outline: 3px solid var(--focus); outline-offset: 2px; }
select { min-height: 48px; padding: 0 12px; cursor: pointer; }
.form-row {
  display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: space-between; align-items: flex-end; margin-top: 10px;
}
.form-actions { align-items: flex-end; margin-top: 18px; }
.form-actions .field { flex: 1 1 200px; max-width: 280px; }
.form-actions .btn { flex: 1 1 260px; }
.alert {
  margin-top: 16px; padding: 14px 16px; border-radius: 12px;
  border: 1.5px solid var(--low); color: var(--low);
  display: flex; flex-direction: column; gap: 6px;
}
.alert[hidden] { display: none; }
.alert-hint { color: var(--ink-2); font-size: 0.95rem; }

.progress {
  margin-top: 24px; padding: 20px; max-width: 860px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
}
.progress[hidden] { display: none; }
.progress-title { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; margin-bottom: 14px; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar span {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: var(--accent); transition: width 0.3s linear;
}
.stages { list-style: none; padding: 0; margin: 16px 0 10px; display: grid; gap: 8px; }
.stages li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.stages li::before {
  content: ""; width: 12px; height: 12px; flex: 0 0 12px; border-radius: 50%;
  border: 2px solid var(--line); box-sizing: border-box;
}
.stages .is-done { color: var(--ink-2); }
.stages .is-done::before { background: var(--ok); border-color: var(--ok); }
.stages .is-active { color: var(--ink); font-weight: 700; }
.stages .is-active::before {
  border-color: var(--accent); background: var(--accent);
  animation: ring 1.3s infinite;
}
@keyframes ring {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  100% { box-shadow: 0 0 0 10px transparent; }
}

.result { margin-top: 36px; animation: rise 0.6s var(--ease) both; }
.result[hidden] { display: none; }
.result-head { border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 26px; }
.result-title {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.4rem, 3.2vw, 1.95rem); line-height: 1.2; margin: 12px 0 8px;
  max-width: 40em;
}
.badge {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1.5px solid currentColor;
}
.badge[data-nivel="alto"] { color: var(--ok); }
.badge[data-nivel="medio"] { color: var(--mid); }
.badge[data-nivel="bajo"] { color: var(--low); }

.result-grid { display: grid; gap: 36px; }
@media (min-width: 900px) { .result-grid { grid-template-columns: 1.1fr 0.9fr; gap: 40px; } }
.table-wrap { width: 100%; }
.req-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin-bottom: 28px; }
.req-table th {
  text-align: left; font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
  border-bottom: 1px solid var(--line); padding: 8px 10px 8px 0;
}
.req-table td {
  border-bottom: 1px solid var(--line); padding: 12px 10px 12px 0;
  vertical-align: top; overflow-wrap: anywhere;
}
.req-table td:first-child { font-weight: 600; }
.dev-list { padding-left: 20px; margin: 0 0 24px; color: var(--ink-2); }
.dev-list li { margin: 6px 0; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.actions a { flex: 1 1 180px; }
.actions a[hidden] { display: none; }

.cv-view {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; font-size: 0.95rem; overflow-wrap: anywhere;
  box-shadow: 6px 6px 0 var(--line);
}
.cv-name { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; }
.cv-title { font-weight: 600; margin: 2px 0; }
.cv-view .cv-contact { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.9rem; margin: 8px 0; }
.cv-h {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); margin: 18px 0 8px; padding-top: 12px; border-top: 1px solid var(--line);
}
.cv-view p { margin: 4px 0; }
.cv-view ul { padding-left: 18px; margin: 4px 0 6px; }
.cv-job-head { font-weight: 600; margin-top: 10px !important; }
.result-actions { margin-top: 32px; }

/* ---------- Pie y sticky CTA ---------- */
.foot {
  max-width: 1120px; margin: 0 auto; padding: 32px var(--gutter);
  border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem;
}
.foot p { margin: 0 0 8px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 20px; list-style: none; margin: 0 0 12px; padding: 0; }
.foot a { color: var(--ink-2); text-underline-offset: 3px; }
.foot a:hover { color: var(--ink); }
.sticky-cta { display: none; }
@media (max-width: 759px) {
  .foot { padding-bottom: 110px; }
  .sticky-cta {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    transform: translateY(110%); transition: transform 0.35s var(--ease);
  }
  .sticky-cta.is-on { transform: none; }
}

/* ---------- Movimiento de entrada y scroll ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
.rise { animation: rise 0.8s var(--ease) both; }
/* Retrasos de la entrada del hero (clases, no estilos inline: CSP estricta). */
.rise.d0 { animation-delay: 0ms; }
.rise.d1 { animation-delay: 90ms; }
.rise.d2 { animation-delay: 180ms; }
.rise.d3 { animation-delay: 260ms; }
.rise.d4 { animation-delay: 340ms; }

/* Usa la propiedad `translate` para no pisar el `transform` del hover de las tarjetas. */
html.js .reveal {
  opacity: 0; translate: 0 22px;
  transition: opacity 0.7s var(--ease), translate 0.7s var(--ease);
}
html.js .reveal.in { opacity: 1; translate: 0 0; }
html.js .cards .reveal:nth-child(2) { transition-delay: 0.08s; }
html.js .cards .reveal:nth-child(3) { transition-delay: 0.16s; }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html.js .reveal { opacity: 1; translate: none; }
  html.js .marquee-track { animation: none; width: auto; flex-wrap: wrap; justify-content: center; }
  .marquee-group[aria-hidden="true"] { display: none; }
  .marquee-group { flex-wrap: wrap; justify-content: center; }
  .btn:hover, .card:hover, .chips li:hover { transform: none; }
}
