/* ---------- Tokens ---------- */
:root {
  --bg: #fafaf9;
  --text: #111111;
  --muted: #5c5c5c;      /* contraste AA sobre --bg */
  --line: #e4e4e2;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

/* Tema oscuro: por elección (data-theme) o, sin JS, por preferencia del sistema */
:root[data-theme="dark"] {
  --bg: #111111;
  --text: #f2f1ee;
  --muted: #a3a3a0;      /* contraste AA sobre --bg */
  --line: #2a2a29;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #111111;
    --text: #f2f1ee;
    --muted: #a3a3a0;
    --line: #2a2a29;
    color-scheme: dark;
  }
}

/* Transición de tema: main.js añade la clase solo mientras dura el cambio */
.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease !important;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- Contenido ---------- */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1.5rem 5rem;
}

.hero__name {
  margin: 0;
  font-size: clamp(2.75rem, 10vw, 6.5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.045em;
}

.hero__role {
  margin: 1.25rem 0 0;
  font-size: clamp(1.0625rem, 2.4vw, 1.375rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--muted);
}

.hero__message {
  margin: 3rem 0 0;
  max-width: 42ch;
  font-size: 1rem;
  color: var(--text);
}

.hero__message span {
  display: block;
  text-wrap: balance;
}

/* Línea discreta de contacto */
.hero__contact { margin-top: 2.5rem; }

.hero__contact ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 0;
  font-size: 0.875rem;
}

.hero__contact li { display: flex; align-items: center; }

/* Separador "·" entre enlaces */
.hero__contact li + li::before {
  content: "·";
  margin: 0 0.85rem;
  color: var(--muted);
}

.hero__contact a {
  color: var(--muted);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  padding-bottom: 2px;
  transition: color 0.25s ease, background-size 0.35s ease;
}

.hero__contact a:hover {
  color: var(--text);
  background-size: 100% 1px;
}

.hero__contact a:focus-visible {
  color: var(--text);
  outline: 2px solid var(--text);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ---------- Botón de tema ---------- */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.25s ease, background-color 0.25s ease;
}

.theme-toggle:hover { color: var(--text); background-color: var(--line); }

.theme-toggle:focus-visible {
  color: var(--text);
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* Icono según el tema activo: luna en claro, sol en oscuro */
.theme-toggle__icon--sun,
[data-theme="dark"] .theme-toggle__icon--moon { display: none; }
[data-theme="dark"] .theme-toggle__icon--sun { display: block; }

/* Sin JS el botón no haría nada */
.no-js .theme-toggle { display: none; }

/* ---------- Barra de carga ---------- */
.progress {
  position: relative;
  width: 100%;
  height: 2px;
  background: var(--line);
  overflow: hidden;
}

.progress__bar {
  position: absolute;
  inset: 0;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left center;
}

/* ---------- Estados de animación ---------- */
/* Oculta los elementos solo si hay JS; main.js los revela (con o sin GSAP) */
.js .reveal { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { visibility: visible; }
  /* Barra estática: indica "en proceso" sin movimiento */
  .progress__bar { transform: scaleX(0.4); }
}

/* ---------- Móvil ---------- */
@media (max-width: 480px) {
  .hero { padding: 3rem 1.25rem 4rem; }
  .hero__message { margin-top: 2.25rem; }
  .hero__contact { margin-top: 2rem; }
  /* En pantallas estrechas, los enlaces se apilan sin separador */
  .hero__contact ul { flex-direction: column; align-items: center; gap: 0.6rem; }
  .hero__contact li + li::before { content: none; }
}
