/* ============================================
   SANTIAGO ABELLA — PORTFOLIO
   Aesthetic: Dark editorial + parallax life
   ============================================ */

/* Fuentes: cargadas vía <link> en el <head> de index.html.
   Antes iban por @import acá, lo que las pedía recién después de bajar
   y parsear este CSS (waterfall). En el <head> bajan en paralelo. */

/* --- VARIABLES --- */
:root {
  --bg:           #030303;
  --bg2:          #080808;
  --surface:      #111111;
  --border:       #1a1a1a;
  --text:         #e8e8e8;
  --text-muted:   #8a8a8a;
  --text-dim:     #2a2a2a;
  --bg-rgb:       3, 3, 3;
  --accent:       #c8f135;
  --accent-rgb:   200, 241, 53;
  --accent-dim:   rgba(200, 241, 53, 0.07);
  --font-display: 'Syne', sans-serif;
  --font-mono:    'DM Mono', monospace;
  --nav-h:        64px;
  --max-w:        760px;
  --ease:         cubic-bezier(0.16, 1, 0.3, 1);
  --ease-back:    cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.claro {
  --bg:           #f5f4f0;
  --bg2:          #edecea;
  --surface:      #e4e3e0;
  --border:       #d0ceca;
  --text:         #0c0c0c;
  --text-muted:   #4a4845;
  --text-dim:     #bfbdb9;
  --bg-rgb:       245, 244, 240;
  --accent:       #5b4cff;
  --accent-rgb:   91, 76, 255;
  --accent-dim:   rgba(91, 76, 255, 0.09);
}

/* --- RESET --- */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior: auto; }

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}

/* Grain */
body::after {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9998;
  opacity: 0.5;
}

/* ─── INTRO OVERLAY ──────────────────────────────────────── */
#intro-overlay {
  position: fixed;
  inset: 0;
  background: #050505;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  transition: clip-path 0.9s cubic-bezier(0.76, 0, 0.24, 1);
  pointer-events: all;
}

#intro-overlay.wipe-out {
  clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
}

#intro-overlay.done {
  display: none;
}

#intro-terminal {
  font-family: var(--font-mono);
  font-size: clamp(11px, 1.4vw, 14px);
  color: #3a3a3a;
  max-width: 420px;
  width: 90%;
  line-height: 1.9;
  position: relative;
}

#intro-lines span {
  display: block;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  white-space: nowrap;
}

#intro-lines span.show {
  max-height: 2em;
  opacity: 1;
}

#intro-lines span.accent {
  color: var(--accent);
}

#intro-lines span.dim {
  color: #1e1e1e;
}

#intro-cursor {
  display: inline-block;
  color: var(--accent);
  font-size: 1.1em;
  animation: blink 0.7s step-end infinite;
  vertical-align: middle;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

#intro-name {
  position: absolute;
  bottom: clamp(24px, 5vw, 52px);
  right: clamp(24px, 5vw, 52px);
  font-family: var(--font-display);
  font-size: clamp(4rem, 12vw, 10rem);
  font-weight: 800;
  color: transparent;
  -webkit-text-stroke: 1px #1e1e1e;
  letter-spacing: -0.04em;
  line-height: 1;
  user-select: none;
  pointer-events: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

#intro-name.show {
  opacity: 1;
  transform: translateY(0);
}

/* ─── PROGRESS LINE ───────────────────────────────────────── */
#progress-line {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  z-index: 9999;
  transition: transform 0.05s linear;
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.6);
}

/* ─── CURSOR SYSTEM ───────────────────────────────────────── */
body:not(.cursor-hidden) { cursor: none; }
body:not(.cursor-hidden) *:not(input):not(textarea) { cursor: none; }
body:not(.cursor-hidden) input,
body:not(.cursor-hidden) textarea { cursor: text; }

/* El cursor visual vive en el canvas neural — sin elementos DOM extra */
#cursor-dot  { display: none; }
#cursor-ring { display: none; }

/* ─── FOCO DE TECLADO ─────────────────────────────────────────
   El cursor nativo está oculto: la navegación por teclado necesita
   un ring visible. Solo :focus-visible → no aparece al click de mouse. */
:focus { outline: none; }
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}
#cursor-ring2 { display: none; }

/* ── Aura difusa ── */
#cursor-glow { display: none; }

/* ── Cursor overlay — flota por encima de todo (navbar, cards, etc.) ── */
#cursor-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  filter: blur(2.5px);
  background: radial-gradient(
    circle,
    rgba(var(--accent-rgb), 0.82) 0%,
    rgba(var(--accent-rgb), 0.35) 40%,
    rgba(var(--accent-rgb), 0) 100%
  );
  transition: width 0.12s, height 0.12s, opacity 0.15s;
  opacity: 0;
}
body.claro #cursor-overlay,
body.cursor-over-nav #cursor-overlay        { opacity: 1; }
body.claro.cursor-hover #cursor-overlay,
body.claro.cursor-card  #cursor-overlay,
body.cursor-over-nav.cursor-hover #cursor-overlay { width: 30px; height: 30px; }
body.claro.cursor-click #cursor-overlay,
body.cursor-over-nav.cursor-click #cursor-overlay { width: 14px; height: 14px; opacity: 0.6; }

/* ─── FLOATING BACKGROUND ELEMENTS ───────────────────────── */
#floaters {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.floater-circle {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  will-change: transform;
  transition: border-color 0.5s;
}

.floater-circle::after {
  content: '';
  position: absolute;
  inset: 25%;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent-rgb), 0.06);
}

.floater-cross {
  position: absolute;
  width: 16px; height: 16px;
  will-change: transform;
}

.floater-cross::before,
.floater-cross::after {
  content: '';
  position: absolute;
  background: rgba(var(--accent-rgb), 0.25);
}

.floater-cross::before {
  width: 1px; height: 100%;
  left: 50%; transform: translateX(-50%);
}

.floater-cross::after {
  height: 1px; width: 100%;
  top: 50%; transform: translateY(-50%);
}

/* ─── NAVBAR ──────────────────────────────────────────────── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  /* SOLO en el tope (hero) el navbar deja ver las partículas del fondo y su
     reacción al cursor: ahí detrás hay hero vacío + partículas, nunca contenido
     de secciones. Va transparente con poco blur (0.28 / blur 4px) para que el
     sombreado se note — en la franja fina caen pocas partículas y hay que
     amplificarlas. Al scrollear pasa a opaco (.scrolled) para que el contenido
     que cruza por debajo NO se asome nunca. */
  background: rgba(var(--bg-rgb), 0.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-bottom: 1px solid transparent;
  z-index: 1000;
  transition: border-color 0.3s, background 0.5s, backdrop-filter 0.5s;
}

/* Grain más visible en modo claro para dar textura */
body.claro::after { opacity: 0.45; }

/* Secciones semitransparentes — dejan pasar el glow del cursor */
body.claro section:not(#hero) {
  background: rgba(245, 244, 240, 0.82);
  box-shadow: 0 1px 0 var(--border), 0 4px 32px rgba(0,0,0,0.04);
  border-radius: 2px;
  border-bottom-color: transparent;
}

/* Ticker opaco en claro */
body.claro .ticker { background: var(--bg); }

/* Cards y grids en modo claro */
body.claro .skills-grid,
body.claro .contact-grid,
body.claro .project-grid { background: rgba(208, 206, 202, 0.40); }

body.claro .skill-item,
body.claro .contact-item,
body.claro .project-card { background: rgba(255, 255, 255, 0.75); }

body.claro .project-card:hover { background: rgba(248, 248, 255, 0.85); }
body.claro .project-card--placeholder:hover { background: rgba(255, 255, 255, 0.75); }

/* Skill dots en claro: usar border como base visible */
body.claro .skill-item::before { background: rgba(var(--accent-rgb), 0.6); }

/* Grupos e iconos de habilidades en claro */
body.claro .group-label .label-text { color: var(--text); }
body.claro .group-label .tick       { background: var(--accent); }

/* Floaters más presentes en claro */
body.claro .floater-circle {
  border-color: rgba(91, 76, 255, 0.18);
}
body.claro .floater-circle::after {
  border-color: rgba(91, 76, 255, 0.10);
}
body.claro .floater-cross::before,
body.claro .floater-cross::after {
  background: rgba(91, 76, 255, 0.35);
}

/* Footer text legible en claro */
body.claro .footer-copy { color: var(--text-muted); }
body.claro footer { background: var(--bg); position: relative; z-index: 2; }

/* Hero SA background más visible en claro */
body.claro #hero::before {
  -webkit-text-stroke-color: rgba(0,0,0,0.07);
}

/* Scrolleado: opaco + blur fuerte (como antes) para que el contenido de las
   secciones que pasa por debajo NO se vea nunca por detrás del navbar. */
#navbar.scrolled {
  border-bottom-color: var(--border);
  background: rgba(var(--bg-rgb), 0.72);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.nav-logo {
  font-size: 26px; font-weight: 800;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text);
}
.nav-logo span { color: var(--accent); }
a.nav-logo { text-decoration: none; cursor: pointer; }

#navbar ul { list-style: none; display: flex; gap: 36px; }

#navbar ul a {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); text-decoration: none;
  transition: color 0.2s;
  position: relative;
}

#navbar ul a::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}
#navbar ul a:hover { color: var(--text); }
#navbar ul a:hover::after { width: 100%; }

#btn-tema {
  background: none; border: 1px solid var(--border);
  border-radius: 4px; width: 34px; height: 34px;
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s, transform 0.3s var(--ease-back);
  font-family: var(--font-mono);
  line-height: 1;
  padding: 0;
  transform-origin: center center;
}
#btn-tema:hover {
  border-color: var(--accent); color: var(--accent);
  transform: rotate(180deg);
}

/* ─── HERO ────────────────────────────────────────────────── */
#hero {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: calc(var(--nav-h) + 40px) 40px 90px;
  position: relative; overflow: hidden;
}


.hero-inner {
  max-width: 900px;
  position: relative; z-index: 2;
}

/* All hero children animate in */
.hero-inner > * {
  opacity: 0;
  transform: translateY(24px);
  animation: fadeUp 0.9s var(--ease) forwards;
}

.foto-perfil     { animation-delay: 0.05s; }
.hero-tag        { animation-delay: 0.15s; }
#hero h1         { animation-delay: 0.28s; }
.hero-sub        { animation-delay: 0.42s; }
.hero-cta        { animation-delay: 0.56s; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

.foto-pic { display: contents; }
.foto-perfil {
  width: 72px; height: 72px;
  border-radius: 50%; object-fit: cover;
  margin-bottom: 28px;
  border: 1px solid var(--border);
  filter: grayscale(20%);
  transition: filter 0.4s, transform 0.4s var(--ease), border-color 0.3s;
  will-change: transform;
}
.foto-perfil:hover {
  filter: grayscale(0%) brightness(1.05);
  transform: scale(1.06) !important;
  border-color: var(--accent);
}

.hero-tag {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.15em; color: var(--accent);
  text-transform: uppercase;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
  will-change: transform, opacity;
}
.hero-tag::before {
  content: ''; width: 32px; height: 1px;
  background: var(--accent); display: block;
  animation: expandLine 0.6s var(--ease) 0.15s both;
}
@keyframes expandLine {
  from { width: 0; } to { width: 32px; }
}

/* Pulse dot */
.hero-tag::after {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

#hero h1 {
  font-size: clamp(52px, 8.5vw, 106px);
  font-weight: 800; line-height: 0.93;
  letter-spacing: -0.03em; color: var(--text);
  margin-bottom: 24px;
  cursor: default;
  will-change: transform, opacity;
}
#hero h1 em { font-style: normal; color: var(--accent); }

.hero-sub {
  font-family: var(--font-mono);
  font-size: 13px; color: var(--text-muted);
  letter-spacing: 0.05em; margin-bottom: 40px; line-height: 1.9;
  will-change: transform, opacity;
}
.hero-sub span { color: var(--text); }

.hero-cta {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  will-change: transform, opacity;
}

.btn-primary {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--bg); background: var(--accent);
  padding: 13px 30px; border-radius: 2px;
  text-decoration: none;
  transition: opacity 0.2s, box-shadow 0.3s;
  display: inline-block;
}
.btn-primary:hover {
  opacity: 0.88;
  box-shadow: 0 8px 30px rgba(var(--accent-rgb), 0.3);
}

.btn-cv {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted); text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 13px 0;
  transition: color 0.2s;
}
.btn-cv:hover { color: var(--text); }
@keyframes cv-dl {
  0%   { transform: translateY(0); }
  45%  { transform: translateY(6px); }
  70%  { transform: translateY(2px); }
  100% { transform: translateY(4px); }
}

.btn-ghost {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted); text-decoration: none;
  padding: 13px 0;
  transition: color 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-ghost::after { content: '↗'; transition: transform 0.25s var(--ease); }
.btn-ghost:hover { color: var(--text); }
.btn-ghost:hover::after { transform: translate(3px, -3px); }
.btn-cv::after { content: '↓'; transition: none; }
.btn-cv:hover::after { transform: none; animation: cv-dl 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }

.hero-scroll {
  position: absolute; bottom: 40px; right: 40px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--text-dim); writing-mode: vertical-rl;
  display: flex; align-items: center; gap: 12px;
  animation: fadeUp 1s var(--ease) 0.8s both;
}
.hero-scroll::before {
  content: ''; width: 1px; height: 48px;
  background: var(--text-dim); display: block;
  animation: growLine 0.8s var(--ease) 1s both;
}
@keyframes growLine { from { height: 0; } to { height: 48px; } }

/* ─── TICKER ──────────────────────────────────────────────── */
.ticker {
  width: 100%; overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  background: var(--bg);
  position: relative; z-index: 2;
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.ticker-inner {
  display: flex; white-space: nowrap;
  animation: ticker-scroll 22s linear infinite;
  will-change: transform;
}

.ticker-inner span {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-right: 0;
}

/* ─── SECTIONS ────────────────────────────────────────────── */
section:not(#hero) {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 88px 40px;
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 2;
}

section:last-of-type { border-bottom: none; }

/* Proyectos por encima de habilidades para que los skill items animen desde atrás */
#proyectos { z-index: 3; }

.section-header {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 48px;
}

.section-num {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--accent); letter-spacing: 0.1em;
}

h2 {
  font-family: var(--font-display); font-size: 13px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted);
  will-change: transform;
}

/* ─── SOBRE MÍ ────────────────────────────────────────────── */
#sobre-mi p {
  font-size: 18px; line-height: 1.8; color: var(--text);
  font-weight: 400; max-width: 600px; margin-bottom: 1.2rem;
}
#sobre-mi strong { color: var(--accent); font-weight: 600; }

/* ─── EXPERIENCIA / EDUCACIÓN ─────────────────────────────── */
.item {
  display: grid; grid-template-columns: 1fr auto;
  gap: 0 24px;
  padding: 28px 0;
  border-top: 1px solid var(--border);
  position: relative;
  transition: background 0.3s;
}
.item:last-child { border-bottom: 1px solid var(--border); }

/* Animated top border on hover */
.item::before {
  content: '';
  position: absolute; left: 0; top: -1px;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.5s var(--ease);
}
.item:hover::before { width: 100%; }

.item-left { grid-column: 1; }
.item-right { grid-column: 2; }

.item h3 {
  font-size: 17px; font-weight: 600; color: var(--text);
  margin-bottom: 4px; letter-spacing: -0.01em;
  transition: color 0.2s;
}
.item:hover h3 { color: var(--accent); }

.empresa {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted); letter-spacing: 0.08em;
  margin-bottom: 14px; text-transform: uppercase;
}

.fecha {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted); letter-spacing: 0.06em;
  white-space: nowrap; padding-top: 4px;
}

.item ul {
  list-style: none; display: flex; flex-direction: column; gap: 6px;
}
.item ul li {
  font-size: 13.5px; color: var(--text-muted);
  padding-left: 16px; position: relative; line-height: 1.6;
}
.item ul li::before {
  content: '—'; position: absolute; left: 0;
  color: var(--accent); font-size: 10px; top: 1px;
}

/* ─── HABILIDADES ─────────────────────────────────────────── */
.skills-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px; background: rgba(15,15,15,0.45);
  border: 1px solid rgba(15,15,15,0.45);
  border-radius: 2px;
}

.skill-item {
  background: rgba(var(--bg-rgb, 3,3,3), 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 20px 18px;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.08em; color: var(--text);
  text-transform: uppercase;
  cursor: default;
  display: flex; align-items: center; gap: 10px;
  will-change: transform, opacity;
  transition: background 0.25s, color 0.2s, box-shadow 0.55s var(--ease);
  box-shadow: inset 0 0 0 1px rgba(42,42,42,0.5);
}
.skill-item::before {
  display: none;
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.5); flex-shrink: 0;
  transition: background 0.25s, transform 0.25s var(--ease-back), box-shadow 0.5s var(--ease);
}
.visible .skill-item {
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.2);
}
.visible .skill-item::before {
  box-shadow: 0 0 5px rgba(var(--accent-rgb), 0.45);
}
.skill-item:hover {
  background: rgba(var(--accent-rgb), 0.12); color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.45);
}
.skill-item:hover::before {
  background: var(--accent); transform: scale(1.5);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.8);
}

/* ─── HABILIDADES · grupos e iconos ──────────────────────── */
.skill-group       { margin-bottom: 36px; }
.skill-group:last-child { margin-bottom: 0; }
.group-label {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.group-label .tick {
  width: 14px; height: 1px;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(var(--accent-rgb), 0.6);
  flex-shrink: 0;
}
.group-label .label-text {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text);
}
/* Ícono SVG monocromático */
.skill-item .ico {
  width: 16px; height: 16px; flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.25s, transform 0.3s var(--ease-back), filter 0.3s;
}
.skill-item .ico.solid { fill: currentColor; }
.skill-item .ico.line {
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.skill-item:hover .ico {
  color: var(--accent);
  transform: scale(1.12);
  filter: drop-shadow(0 0 6px rgba(var(--accent-rgb), 0.5));
}

/* ─── CONTACTO ────────────────────────────────────────────── */
.contact-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px; background: rgba(15,15,15,0.45);
  border: 1px solid rgba(15,15,15,0.45);
}

.contact-item {
  background: rgba(var(--bg-rgb, 3,3,3), 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 28px 24px;
  text-decoration: none;
  display: flex; flex-direction: column; gap: 8px;
  position: relative; overflow: hidden;
  will-change: transform, opacity;
  box-shadow: inset 0 0 0 1px rgba(42,42,42,0.5);
  transition: transform 0.3s var(--ease), box-shadow 0.6s var(--ease);
}
.contact-item::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--accent-dim);
  opacity: 0; transition: opacity 0.25s;
}
.visible .contact-item {
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.25),
    0 4px 28px -6px rgba(var(--accent-rgb), 0.07);
}
.contact-item:hover { transform: translateY(-3px); }
.contact-item:hover::after { opacity: 1; }
.visible .contact-item:hover {
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.5),
    0 8px 32px -4px rgba(var(--accent-rgb), 0.14);
}

.contact-label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted);
}
.contact-value {
  font-family: var(--font-display); font-size: 15px; font-weight: 500;
  color: var(--text); transition: color 0.2s;
  position: relative; z-index: 1;
}
.contact-item:hover .contact-value { color: var(--accent); }

.contact-arrow {
  font-size: 18px; color: var(--text-dim);
  margin-top: auto; align-self: flex-end;
  transition: transform 0.25s var(--ease), color 0.2s;
  position: relative; z-index: 1;
}
.contact-item:hover .contact-arrow {
  transform: translate(4px, -4px);
  color: var(--accent);
}

/* ─── FOOTER ──────────────────────────────────────────────── */
footer {
  max-width: var(--max-w);
  margin: 0 auto; padding: 40px 40px;
  display: flex; justify-content: space-between; align-items: center;
  position: relative; z-index: 2;
}
.footer-copy {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-dim); letter-spacing: 0.06em;
}
.footer-copy span { color: var(--accent); }

/* ─── SCROLL REVEAL ───────────────────────────────────────── */
.oculto {
  opacity: 0; transform: translateY(56px);
  transition: opacity 0.85s var(--ease), transform 0.85s var(--ease);
}
.visible { opacity: 1; transform: translateY(0); }

/* Stagger child items */
.visible .item       { transition-delay: calc(var(--i, 0) * 0.07s); }
.visible .skill-item { transition-delay: calc(var(--i, 0) * 0.04s); }

/* ─── SOBRE MÍ — REVEAL DESDE ABAJO ──────────────────────── */
.sobre-mi-section { /* estado inicial seteado por JS */ }

.sm-num {
  display: inline-block;
}

.sm-title-wrap {
  display: inline-block;
}

.sm-body {
  position: relative;
}
/* Línea que se dibuja cuando entra en viewport */
.sm-body::before {
  content: '';
  display: block;
  height: 1px;
  width: 0;
  background: var(--border);
  margin-bottom: 32px;
  transition: width 0.9s var(--ease);
}
.sobre-mi-section.sm-visible .sm-body::before {
  width: 100%;
}


/* ─── PROYECTOS ───────────────────────────────────────────── */
/* Sin perspective: un ancestro con perspective/3D convierte la grid en
   "backdrop root" y el backdrop-filter de las cards deja de muestrear el
   canvas neural (fixed) → no se verían las partículas detrás. Las skills
   no tienen perspective y por eso sí las dejan ver; igualamos el patrón. */
.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(15,15,15,0.45);
  border: 1px solid rgba(15,15,15,0.45);
}

.project-card {
  background: rgba(var(--bg-rgb, 3,3,3), 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 0 1px rgba(42,42,42,0.5);
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: background 0.3s, box-shadow 0.6s var(--ease);
  will-change: transform, opacity;
  isolation: isolate;
}

.project-card::before { display: none; }
.project-card:hover { background: rgba(var(--bg-rgb, 3,3,3), 0.75); }

.visible .project-card {
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.25),
    0 4px 28px -6px rgba(var(--accent-rgb), 0.07);
}
.visible .project-card:hover {
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.5),
    0 8px 32px -4px rgba(var(--accent-rgb), 0.14);
}

.project-card--placeholder {
  opacity: 0.45;
  cursor: default;
}
.project-card--placeholder:hover { background: rgba(var(--bg-rgb, 3,3,3), 0.58); }
.project-card--placeholder::before { display: none; }
.visible .project-card--placeholder {
  box-shadow: inset 0 0 0 1px rgba(42,42,42,0.5);
}

.project-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  padding: 3px 8px;
  border-radius: 2px;
  transition: background 0.2s;
}
.project-card:hover .project-tag {
  background: rgba(var(--accent-rgb), 0.07);
}

.project-tag--dim {
  color: var(--text-muted);
  border-color: var(--border);
}

.project-link {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: color 0.2s, border-color 0.2s, transform 0.25s var(--ease);
  flex-shrink: 0;
}
.project-link:hover {
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.5);
  transform: translate(2px, -2px);
}

.project-link--disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

.project-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  transition: color 0.2s;
}
.project-card:hover .project-title { color: var(--accent); }
.project-title--dim { color: var(--text-muted); }

.project-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.7;
  flex: 1;
}
.project-desc--dim { color: var(--text-dim); }

.project-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.project-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.project-stats span {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-num {
  color: var(--accent);
  font-weight: 600;
  margin-right: 2px;
}

.project-year {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* Grupo de acciones de la card (arquitectura + GitHub) */
.project-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
button.project-link {
  background: none;
  cursor: pointer;
  font: inherit;
}

/* ─── MODAL DE ARQUITECTURA ───────────────────────────────────
   Lightbox del diagrama de clases; se abre desde la card. */
.arch-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: auto;
}
.arch-modal[hidden] { display: none; }
.arch-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(var(--bg-rgb), 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.28s var(--ease);
}
.arch-modal.open .arch-modal-backdrop { opacity: 1; }
.arch-modal-panel {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  transition: opacity 0.28s var(--ease), transform 0.4s var(--ease);
}
.arch-modal.open .arch-modal-panel {
  opacity: 1;
  transform: none;
}
.arch-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.arch-modal-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 30px; height: 30px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.2s, border-color 0.2s;
}
.arch-modal-close:hover {
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.5);
}
.arch-modal-body {
  overflow: auto;
  padding: 18px;
}
.arch-modal-body img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  .arch-modal-backdrop,
  .arch-modal-panel { transition: none; }
}

/* ─── NAV RIGHT (agrupa tema + hamburger) ─────────────────── */
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* ─── HAMBURGER BUTTON ────────────────────────────────────── */
#nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 34px; height: 34px;
  padding: 7px 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}
#nav-toggle span {
  display: block;
  width: 100%; height: 1px;
  background: var(--text-muted);
  transition: transform 0.3s var(--ease), opacity 0.2s, background 0.2s;
  transform-origin: center;
}
#nav-toggle:hover { border-color: var(--accent); }
#nav-toggle:hover span { background: var(--accent); }

/* Estado abierto: X */
#navbar.nav-open #nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
#navbar.nav-open #nav-toggle span:nth-child(2) { opacity: 0; transform: scaleX(0); }
#navbar.nav-open #nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ─── HERO 3D CANVAS ──────────────────────────────────────── */
/* Fixed + fullscreen: el icosaedro queda anclado donde siempre,
   pero al deconstruirse sus caras pueden volar por toda la
   pantalla antes de disolverse. El JS lo oculta al completarse. */
#hero-3d {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  opacity: 0.85;
  z-index: 1;
}

/* ─── SA POINT CLOUD ──────────────────────────────────────── */
/* Divisor entre Sobre mí y Experiencia, tirado a la derecha.
   Para reubicar con exactitud: ajustar max-width y margin. */
#sa-cloud {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: -44px auto -52px;
  padding: 0 40px;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

/* Aura de acento detrás de la nube */
#sa-cloud::before {
  content: '';
  position: absolute;
  right: 4%;
  top: 50%;
  width: 60%;
  height: 80%;
  transform: translateY(-50%);
  background: radial-gradient(ellipse at center, rgba(var(--accent-rgb), 0.06), transparent 70%);
  pointer-events: none;
}

#sa-cloud-canvas {
  display: block;
  width: min(760px, 100%);
  height: auto;
  aspect-ratio: 8 / 5;
}

/* ─── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 700px) {
  /* Restaurar cursor en touch */
  body, a, button, [role="button"] { cursor: auto !important; }
  a, button { cursor: pointer !important; }

  /* Navbar */
  #navbar { padding: 0 20px; }
  #nav-toggle { display: flex; }

  /* Menú desplegable mobile */
  #nav-links {
    position: fixed;
    top: var(--nav-h); left: 0; right: 0;
    background: rgba(8, 8, 8, 0.97);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    flex-direction: column;
    gap: 0;
    padding: 8px 0 20px;
    border-bottom: 1px solid var(--border);
    transform: translateY(-110%);
    transition: transform 0.4s var(--ease), opacity 0.3s;
    opacity: 0;
    pointer-events: none;
    z-index: 999;
  }
  body.claro #nav-links { background: rgba(245, 244, 240, 0.97); }

  #navbar.nav-open #nav-links {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  #nav-links li { width: 100%; }
  #nav-links a {
    display: block;
    font-size: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.1em;
  }
  #nav-links li:last-child a { border-bottom: none; }
  #nav-links a:hover { color: var(--accent); background: var(--accent-dim); }
  #nav-links a::after { display: none; }

  /* Hero */
  #hero { padding: 100px 24px 80px; }
  #hero::before { font-size: 42vw; }

  /* Secciones */
  section:not(#hero) { padding: 64px 24px; }

  /* Items experiencia/educación */
  .item { grid-template-columns: 1fr; }
  .fecha { order: -1; margin-bottom: 4px; }

  /* Hero scroll indicator */
  .hero-scroll { display: none; }

  /* Grids */
  .contact-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }

  /* Overflow en email/valores de contacto */
  .contact-value { font-size: 13px; word-break: break-all; }

  /* Footer */
  footer { flex-direction: column; gap: 12px; padding: 32px 24px; }

  /* Cursor glow */
  #cursor-glow { display: none; }

  /* Skills grid — min 2 columnas cómodas */
  .skills-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

  /* Hero 3D — oculto en mobile */
  #hero-3d { display: none; }

  /* SA point cloud — centrado y compacto en mobile */
  #sa-cloud { margin: -20px auto -28px; padding: 0 24px; justify-content: center; }
  #sa-cloud-canvas { width: min(500px, 100%); }
}

/* ─── FOCUS RACK + LEAN (composición vía variables) ───────────
   Profundidad de campo en scroll: cada bloque se desenfoca/achica según
   su distancia al centro del viewport. Compone con el lean: el lean escribe
   --lean (skewY) y el focus --fs (escala) / --fb (blur), sin pisarse.
   Solo desktop: en mobile las variables quedan sin setear → identidad. */
@media (min-width: 701px) {
  .section-header,
  #sobre-mi .sm-body,
  #experiencia .item,
  #educacion .item {
    transform: translateY(var(--py, 0px)) skewY(var(--lean, 0deg)) scale(var(--fs, 1));
    transform-origin: left center;
    filter: blur(var(--fb, 0px));
  }
}

/* ─── PREFERS-REDUCED-MOTION ──────────────────────────────────
   El motor JS ya se anula con reduced-motion (reduceMotionMotor /
   reduceMotion3d). Esto cierra el círculo del lado CSS: nada de
   transiciones de entrada, ticker ni animaciones decorativas. */
@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;
  }
  /* El contenido revelado aparece ya en su sitio, sin desplazamiento */
  .oculto { opacity: 1; transform: none; }
  .ticker-inner { animation: none; }
}