/* =========================================================
   Grep IT - Hoja de estilos
   Orden del archivo:
   1. Variables (colores, fuentes, espacios) y tema claro/oscuro
   2. Reset y base
   3. Fondo: cuadrícula y brillo que sigue al mouse
   4. Accesibilidad (skip-link y foco)
   5. Layout general
   6. Header, menú y botón de tema
   7. Botones
   8. Hero y ventana de terminal
   9. Secciones: servicios, cómo trabajo, sobre mí
  10. Contacto (bloque de la portada)
  11. Formulario (/contacto) y página de gracias
  12. Footer
  13. Animación de aparición al hacer scroll
  14. Pantallas medianas y grandes (768px o más)
  15. Movimiento reducido
   ========================================================= */


/* ---------- 1. Variables ----------
   Una variable CSS se declara con --nombre y se usa con var(--nombre).
   Si queremos cambiar un color de TODO el sitio, lo cambiamos acá una sola vez.
   El tema oscuro es el de por defecto; el claro se activa cuando <html> tiene
   data-theme="light" (lo pone js/theme.js). */
:root {
  --bg: #0b0f14;               /* fondo general */
  --surface: #121923;          /* tarjetas */
  --surface-2: #182130;        /* tarjetas al pasar el mouse, campos */
  --text: #e6edf3;             /* texto principal */
  --text-soft: #9aa7b5;        /* texto secundario */
  --border: rgba(230, 237, 243, 0.12);
  --accent: #3ddc97;           /* verde terminal: el color de marca */
  --accent-strong: #19b97a;    /* verde más oscuro (botón al pasar el mouse) */
  --accent-ink: #04130c;       /* texto sobre fondo verde */
  --accent-2: #5ab0ff;         /* celeste secundario (comandos, detalles) */
  --warn: #ffbd4a;             /* amarillo de la etiqueta "Próximamente" */
  --grid-line: rgba(230, 237, 243, 0.045);
  --glow: rgba(61, 220, 151, 0.13);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(11, 15, 20, 0.78);

  --radius: 0.9rem;
  --container: 1100px;

  /* Fuentes del sistema: no se descarga nada, la web carga más rápido */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  color-scheme: dark;          /* le avisa al navegador que use controles oscuros */
}

:root[data-theme="light"] {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --text: #17202b;
  --text-soft: #55626f;
  --border: rgba(23, 32, 43, 0.14);
  --accent: #0a8f5b;
  --accent-strong: #076f46;
  --accent-ink: #ffffff;
  --accent-2: #1d6fd1;
  --warn: #b26a00;
  --grid-line: rgba(23, 32, 43, 0.06);
  --glow: rgba(10, 143, 91, 0.12);
  --shadow: 0 18px 40px rgba(23, 32, 43, 0.12);
  --header-bg: rgba(245, 247, 250, 0.82);
  color-scheme: light;
}


/* ---------- 2. Reset y base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;      /* el padding y el borde NO agrandan la caja */
}

html {
  scroll-behavior: smooth;     /* los enlaces #ancla se deslizan suavemente */
  scroll-padding-top: 5rem;    /* deja lugar para el header fijo al saltar a una sección */
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  transition: background-color 0.3s, color 0.3s;
}

h1, h2, h3 {
  margin: 0 0 0.6em;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

p { margin: 0 0 1em; }

a { color: var(--accent); }
a:hover { color: var(--accent-strong); }

img, svg { max-width: 100%; display: block; }

code, .mono { font-family: var(--font-mono); }


/* ---------- 3. Fondo ----------
   body::before dibuja la cuadrícula y body::after el brillo verde.
   Son "pseudo-elementos": cajas decorativas que CSS crea sin tocar el HTML.
   position: fixed las deja quietas mientras se hace scroll. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;                    /* top, right, bottom y left en 0: ocupa toda la pantalla */
  pointer-events: none;        /* no bloquea clics */
  z-index: -1;                 /* queda detrás del contenido */
}

body::before {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  /* el degradé de la máscara hace que la cuadrícula se desvanezca hacia abajo */
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
          mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
}

/* --mx y --my las actualiza js/main.js con la posición del mouse.
   Si el JS no corre, valen 50% / 20% y el brillo queda arriba al centro. */
body::after {
  background: radial-gradient(
    600px circle at var(--mx, 50%) var(--my, 20%),
    var(--glow),
    transparent 70%
  );
}


/* ---------- 4. Accesibilidad ---------- */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;                  /* escondido arriba; aparece al tocar Tab */
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 0.5rem;
  z-index: 100;
}
.skip-link:focus { top: 1rem; }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}


/* ---------- 5. Layout general ---------- */
.container {
  width: min(100% - 2rem, var(--container));   /* 1rem de aire a cada lado en el celular */
  margin-inline: auto;                         /* centrado */
}

.section { padding: 4.5rem 0; }

.kicker {
  display: inline-block;
  margin-bottom: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
}

.section-title { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.section-lead { max-width: 40rem; color: var(--text-soft); }


/* ---------- 6. Header, menú y botón de tema ---------- */
.site-header {
  position: sticky;            /* se queda pegado arriba al hacer scroll */
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(10px); /* vidrio esmerilado */
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4rem;
}

.brand {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand .prompt { color: var(--accent); }

/* El cursor parpadeante: un cuadradito que aparece y desaparece */
.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 0.15em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.header-actions { display: flex; align-items: center; gap: 0.5rem; }

/* En el celular el menú está escondido y se abre con la clase is-open (la pone el JS) */
.site-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  padding: 0.75rem 1rem 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.site-menu.is-open { display: block; }

.site-menu ul { list-style: none; margin: 0; padding: 0; }
.site-menu a {
  display: block;
  padding: 0.7rem 0;
  color: var(--text-soft);
  text-decoration: none;
}
.site-menu a:hover { color: var(--accent); }

.icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-grid;
  place-items: center;
  font-size: 1.1rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* El ícono del botón cambia según el tema (ver js/theme.js: aria-label y data-theme) */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }


/* ---------- 7. Botones ---------- */
.btn {
  display: inline-block;
  padding: 0.8rem 1.4rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0.6rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); color: var(--accent-ink); }

.btn-ghost { color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.6rem; }


/* ---------- 8. Hero y ventana de terminal ---------- */
.hero { padding: 4rem 0 3rem; }

.hero-grid {
  display: grid;
  gap: 2.5rem;                 /* en el celular: una columna, una cosa debajo de la otra */
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--warn);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.badge::before {               /* puntito que late */
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--warn);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}

.hero h1 {
  margin: 1rem 0;
  font-size: clamp(2.2rem, 6.5vw, 3.6rem);
}
.hero h1 .accent { color: var(--accent); }

.hero .joke {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-soft);
}

.hero .lead { max-width: 34rem; color: var(--text-soft); font-size: 1.15rem; }

.terminal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.92rem;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.9rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.terminal-bar i { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: #ff5f57; }
.terminal-bar i:nth-child(2) { background: #febc2e; }
.terminal-bar i:nth-child(3) { background: #28c840; }
.terminal-bar span { margin-left: 0.6rem; font-size: 0.78rem; color: var(--text-soft); }

.terminal-body { padding: 1.1rem 1.2rem 1.3rem; min-height: 15rem; }
.terminal-body p { margin: 0 0 0.35rem; word-break: break-word; }

.tline.cmd::before { content: "$ "; color: var(--accent); }
.tline.out { color: var(--text-soft); }
.tline.ok { color: var(--accent); }
.tline .flag { color: var(--accent-2); }

/* Si el navegador tiene JS (js/theme.js agrega la clase "js" al <html>),
   las líneas arrancan ocultas y main.js las va mostrando de a una. */
.js .tline { visibility: hidden; }
.js .tline.is-shown { visibility: visible; }


/* ---------- 9. Secciones: servicios, cómo trabajo, sobre mí ---------- */
.card-grid { display: grid; gap: 1.2rem; margin-top: 2rem; }

.card {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.2s, border-color 0.2s, background-color 0.2s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  background: var(--surface-2);
}
.card h3 { font-size: 1.2rem; }
.card p:last-child { margin-bottom: 0; color: var(--text-soft); }
.card .card-icon {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  background: var(--glow);
  border-radius: 0.6rem;
}

.tag {
  display: inline-block;
  margin-bottom: 0.8rem;
  padding: 0.15rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--warn);
  border: 1px dashed var(--warn);
  border-radius: 999px;
}

.steps { counter-reset: paso; }   /* contador automático para numerar los pasos */
.steps .card::before {
  counter-increment: paso;
  content: "0" counter(paso);
  display: block;
  margin-bottom: 0.6rem;
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.about-card { max-width: 42rem; }
.about-card .terminal-body { min-height: 0; }


/* ---------- 10. Contacto (bloque de la portada) ---------- */
.contact-box {
  padding: 2.2rem 1.5rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.contact-box .btn-row { justify-content: center; }
.contact-links { margin-top: 1.5rem; color: var(--text-soft); font-size: 0.98rem; }
.contact-links a { word-break: break-all; }


/* ---------- 11. Formulario (/contacto) y página de gracias ---------- */
.page-narrow { padding: 3.5rem 0 4.5rem; }
.page-narrow .container { max-width: 40rem; }

.form { display: grid; gap: 1.2rem; margin-top: 2rem; }

.field label { display: block; margin-bottom: 0.4rem; font-weight: 600; }
.field .hint { font-weight: 400; color: var(--text-soft); font-size: 0.9rem; }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
}
.field textarea { min-height: 9rem; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow);
}

/* Campo trampa (honeypot): los robots lo llenan, las personas ni lo ven.
   NO usamos display:none porque algunos robots lo detectan; lo sacamos de pantalla. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-note { font-size: 0.9rem; color: var(--text-soft); }

/* Páginas centradas (gracias y 404) y bloque de contacto de la portada.
   Se hace con clases y no con style="..." dentro del HTML, porque la CSP del servidor
   (ver apache/grep-it.com.ar-ssl.conf) bloquea los estilos escritos en línea. */
.center-page { text-align: center; }
.center-page .section-lead,
.contact-box .section-lead { margin-inline: auto; }
.center-page .btn-row { justify-content: center; }
.big-mono {
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: clamp(3rem, 12vw, 5.5rem);
  font-weight: 700;
  color: var(--accent);
}


/* ---------- 12. Footer ---------- */
.site-footer {
  padding: 2rem 0;
  font-size: 0.92rem;
  color: var(--text-soft);
  border-top: 1px solid var(--border);
}
.footer-inner { display: grid; gap: 0.4rem; }
.site-footer p { margin: 0; }


/* ---------- 13. Aparición al hacer scroll ----------
   Solo si hay JS (clase "js") los elementos .reveal arrancan transparentes y
   desplazados. main.js les agrega .is-visible cuando entran en pantalla. */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .reveal.is-visible { opacity: 1; transform: none; }


/* ---------- 14. Pantallas medianas y grandes (768px o más) ---------- */
@media (min-width: 768px) {
  .section { padding: 6rem 0; }
  .hero { padding: 6rem 0 4rem; }

  .hero-grid { grid-template-columns: 1.1fr 0.9fr; }   /* texto a la izquierda, terminal a la derecha */
  .card-grid { grid-template-columns: repeat(3, 1fr); }

  /* El menú pasa a ser una fila horizontal dentro del header */
  .menu-toggle { display: none; }
  .site-menu {
    display: block;
    position: static;
    padding: 0;
    background: transparent;
    border: 0;
  }
  .site-menu ul { display: flex; gap: 1.6rem; }
  .site-menu a { padding: 0; }

  .header-inner { gap: 1rem; }
  .header-actions { order: 3; }
  .footer-inner { grid-template-columns: 1fr auto; align-items: center; }
}


/* ---------- 15. Movimiento reducido ----------
   Quien tiene activado "reducir movimiento" en su sistema no ve animaciones. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
