*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #080808;
  --bg2: #101010;
  --bg3: #161616;
  --text: #e8e8e8;
  --muted: #5a5a5a;
  --muted2: #888;
  --accent: #c8ff00;
  --accent2: #ff2d55;
  --accent3: #0af;
  --border: rgba(255,255,255,0.06);
  --border2: rgba(255,255,255,0.12);
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html { scroll-behavior: smooth; overflow-x: hidden; font-size: 20px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  cursor: none;
  overflow-x: hidden;
  font-size: 16px;
}

@media (max-width: 768px) {
  body { cursor: auto; }
  .cursor, .cursor-ring { display: none; }
}

/* CURSOR */
.cursor {
  position: fixed; width: 12px; height: 12px;
  background: var(--accent); border-radius: 50%;
  pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 0.1s, width 0.3s, height 0.3s, opacity 0.3s;
  mix-blend-mode: difference;
}
.cursor-ring {
  position: fixed; width: 40px; height: 40px;
  border: 1px solid rgba(200,255,0,0.4);
  border-radius: 50%; pointer-events: none; z-index: 9998;
  transform: translate(-50%, -50%);
  transition: transform 0.15s ease-out, width 0.3s, height 0.3s;
}
.cursor.active { width: 6px; height: 6px; }
.cursor-ring.active { width: 60px; height: 60px; border-color: var(--accent); }

/* NAV */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.8rem 4rem;
  transition: background 0.4s, padding 0.4s;
}
nav.scrolled {
  background: rgba(8,8,8,0.92);
  backdrop-filter: blur(20px);
  padding: 1.2rem 4rem;
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--accent); letter-spacing: 0.15em;
}
.nav-links { display: flex; gap: 3rem; list-style: none; }
.nav-links a {
  font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--muted2); text-decoration: none;
  letter-spacing: 0.15em; text-transform: uppercase;
  position: relative; padding-bottom: 4px;
  transition: color 0.3s;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: 0; left: 0;
  width: 0; height: 1px; background: var(--accent);
  transition: width 0.3s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { width: 100%; }
.nav-links a.active { color: var(--accent); }
.nav-links a.active::after { width: 100%; }

/* =================== SECTION 1: HERO =================== */
#hero {
  position: relative; height: 100vh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

/* SMOKE CANVAS */
#smokeCanvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
}

/* HERO CONTENT */
.hero-center {
  position: relative; z-index: 10;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
}

/* PHOTO reveal on hover */
.hero-photo-wrap {
  position: relative; width: 250px; height: 250px;
  margin-bottom: 2rem;
}
.hero-photo-ring {
  position: absolute; inset: -8px;
  border: 1px solid rgba(200,255,0,0.2);
  border-radius: 50%;
  animation: ringPulse 3s ease-in-out infinite;
}
.hero-photo-ring2 {
  position: absolute; inset: -20px;
  border: 1px solid rgba(200,255,0,0.08);
  border-radius: 50%;
  animation: ringPulse 3s ease-in-out infinite 1s;
}
@keyframes ringPulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); }
}
.hero-photo {
    width: 250px; height: 250px; border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 2px solid rgba(200,255,0,0.3);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.6s ease, transform 0.6s ease;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.hero-photo-placeholder {
  width: 180px; height: 180px; border-radius: 50%;
  background: var(--bg3);
  border: 2px dashed rgba(200,255,0,0.2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.6s ease, transform 0.6s ease;
  font-family: var(--font-mono); font-size: 0.6rem; color: var(--muted);
  text-align: center; gap: 0.5rem;
}
.hero-center:hover .hero-photo,
.hero-center:hover .hero-photo-placeholder {
  opacity: 1; transform: scale(1);
}
.hero-name {
  font-family: var(--font-display); font-size: clamp(5rem, 12vw, 10rem);
  line-height: 0.9; color: var(--text); letter-spacing: 0.02em;
  opacity: 0; transform: translateY(30px);
  animation: fadeUp 1s ease 0.3s forwards;
}
.hero-name span { color: var(--accent); }
.hero-role {
  font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--muted2); letter-spacing: 0.3em; text-transform: uppercase;
  margin-top: 1rem; margin-bottom: 2.5rem;
  opacity: 0; animation: fadeUp 1s ease 0.6s forwards;
}
.hero-role span {
  color: var(--accent); animation: blink 1.2s step-end infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* SOCIAL ICONS */
.hero-socials {
  display: flex; gap: 1.5rem;
  opacity: 0; animation: fadeUp 1s ease 0.9s forwards;
}
.social-link {
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; text-decoration: none;
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
}
.social-link:hover {
  background: rgba(200,255,0,0.1);
  border-color: rgba(200,255,0,0.4);
  transform: translateY(-3px);
}
.social-link svg { width: 18px; height: 18px; fill: var(--muted2); transition: fill 0.3s; }
.social-link:hover svg { fill: var(--accent); }

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

/* SCROLL INDICATOR */
.scroll-hint {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  z-index: 10; display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 0.6rem; color: var(--muted); letter-spacing: 0.2em;
  animation: fadeUp 1s ease 1.5s both;
}
.scroll-line {
  width: 1px; height: 50px; background: linear-gradient(to bottom, transparent, var(--muted));
  animation: scrollLine 2s ease-in-out infinite;
}
@keyframes scrollLine {
  0%,100% { transform: scaleY(1); opacity: 1; }
  50% { transform: scaleY(0.5); opacity: 0.3; }
}

/* =================== SHARED SECTION STYLES =================== */
.section-wrap {
  min-height: 100vh;
  padding: 8rem 4rem;
  position: relative;
  overflow: hidden;
}

.section-label {
  font-family: var(--font-mono); font-size: 0.68rem;
  color: var(--accent); letter-spacing: 0.25em; text-transform: uppercase;
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1rem;
}
.section-label::before {
  content: ''; width: 30px; height: 1px; background: var(--accent);
}
.section-num {
  font-family: var(--font-mono); font-size: 0.6rem;
  color: var(--muted); letter-spacing: 0.1em;
}

.section-title-big {
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 6rem);
  line-height: 0.95; letter-spacing: 0.02em;
  margin-bottom: 4rem;
}

/* REVEAL ANIMATION */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-left { opacity: 0; transform: translateX(-40px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal-left.visible { opacity: 1; transform: translateX(0); }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }

/* CODE BG DECORATION */
.code-bg {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 35%; opacity: 0.025;
  font-family: var(--font-mono); font-size: 0.7rem;
  color: var(--text); line-height: 1.8;
  overflow: hidden; pointer-events: none; padding: 8rem 2rem;
  white-space: pre;
}

/* =================== SECTION 2: PROYECTOS =================== */
#proyectos { background: var(--bg); }

.projects-header {
  max-width: 1200px; margin: 0 auto;
}

.phones-container {
  display: flex; justify-content: center; align-items: flex-end;
  gap: 2rem; margin-top: 5rem;
  max-width: 1200px; margin-left: auto; margin-right: auto;
  perspective: 1200px;
}

.phone-wrapper {
  flex: 1; max-width: 320px;
  display: flex; flex-direction: column; align-items: center;
  transition: transform 0.5s ease;
}
.phone-wrapper:nth-child(2) { transform: translateY(-30px); }

.phone-device {
  width: 220px; height: 420px;
  background: #0e0e0e;
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 36px;
  position: relative; overflow: hidden;
  transition: transform 0.5s cubic-bezier(0.23,1,0.32,1), box-shadow 0.5s, border-color 0.4s;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  transform-style: preserve-3d;
}

.phone-wrapper:hover .phone-device {
  transform: rotateY(-8deg) rotateX(4deg) scale(1.05);
  box-shadow: 20px 40px 100px rgba(0,0,0,0.8), 0 0 40px rgba(200,255,0,0.1);
  border-color: rgba(200,255,0,0.4);
}
.phone-wrapper:nth-child(2):hover .phone-device {
  transform: rotateY(0deg) rotateX(4deg) scale(1.05) translateY(0);
}
.phone-wrapper:nth-child(3):hover .phone-device {
  transform: rotateY(8deg) rotateX(4deg) scale(1.05);
}

.phone-screen-img {
  width: 100%; height: 100%;
  object-fit: cover;
  background: #0a0a0a;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.6rem;
  color: var(--muted); gap: 0.5rem; text-align: center; padding: 1rem;
  overflow: hidden;
}
.phone-screen-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
  mix-blend-mode: normal;
}

.phone-notch-bar {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 90px; height: 26px;
  background: #0e0e0e; border-radius: 0 0 18px 18px; z-index: 10;
}

/* OVERLAY INFO */
.phone-overlay {
 position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.98) 0%, rgba(0,0,0,0.7) 50%, rgba(0,0,0,0.1) 100%);
  padding: 1.5rem 1.2rem;
  display: flex; flex-direction: column; justify-content: flex-end;
  opacity: 0; transition: opacity 0.4s ease;
}
.phone-wrapper:hover .phone-overlay { opacity: 1; }

.phone-proj-tag {
  font-family: var(--font-mono); font-size: 0.55rem;
  color: var(--accent); letter-spacing: 0.15em; text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.phone-proj-name {
  font-family: var(--font-display); font-size: 1.3rem;
  color: #fff; margin-bottom: 0.5rem;
}
.phone-proj-desc {
  font-size: 0.72rem; color: rgba(255,255,255,0.7); line-height: 1.6; margin-bottom: 0.8rem;
}
.phone-proj-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.phone-proj-tags span {
  font-family: var(--font-mono); font-size: 0.5rem;
  padding: 2px 8px; border: 1px solid rgba(200,255,0,0.3);
  color: var(--accent); background: rgba(200,255,0,0.05);
}

/* GLOW EFFECT */
.phone-glow {
  position: absolute; bottom: -60px; left: 50%; transform: translateX(-50%);
  width: 120px; height: 60px;
  background: radial-gradient(ellipse, rgba(200,255,0,0.15) 0%, transparent 70%);
  opacity: 0; transition: opacity 0.4s;
}
.phone-wrapper:hover .phone-glow { opacity: 1; }

.phone-proj-info {
  margin-top: 1.5rem; text-align: center;
  font-family: var(--font-mono); font-size: 0.65rem; color: var(--muted);
  letter-spacing: 0.1em;
}

/* =================== SECTION 3: ESTUDIOS =================== */
#estudios { background: var(--bg2); }

.estudios-header { margin-bottom: 3rem; }

.estudios-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  max-width: 100%;
}

.estudio-card {
  display: flex; flex-direction: column;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  transition: border-color 0.4s, transform 0.4s;
  cursor: default;
}
.estudio-card:hover {
  border-color: var(--border2);
  transform: translateY(-6px);
}
.estudio-card::before {
  content: ''; position: absolute; left: 0; top: 0; right: 0;
  height: 3px; background: var(--card-accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.4s ease;
}
.estudio-card:hover::before { transform: scaleX(1); }

.estudio-icon-col {
  width: 100%; height: 90px;
  display: flex; flex-direction: row; align-items: center;
  background: rgba(0,0,0,0.35); border-bottom: 1px solid var(--border);
  gap: 1rem; padding: 0 1.5rem;
}
.estudio-icon-main { font-size: 2.2rem; line-height: 1; }
.estudio-icon-sub {
  font-family: var(--font-mono); font-size: 0.6rem;
  color: var(--card-accent); letter-spacing: 0.1em;
}

.estudio-body { padding: 1.5rem 1.5rem 1.8rem; flex: 1; display: flex; flex-direction: column; }
.estudio-title-row {
  display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.estudio-title {
  font-family: var(--font-display); font-size: 1.5rem;
  color: var(--text);
}
.estudio-badge {
  font-family: var(--font-mono); font-size: 0.55rem;
  padding: 3px 8px; border: 1px solid;
  border-color: var(--card-accent);
  color: var(--card-accent);
  letter-spacing: 0.1em; text-transform: uppercase;
  border-radius: 0;
}
.estudio-subtitle {
  font-size: 0.78rem; color: var(--muted2); margin-bottom: 0.8rem;
  font-style: italic;
}
.estudio-desc {
  font-size: 0.82rem; color: var(--muted2); line-height: 1.7;
  margin-bottom: 1rem; flex: 1;
}
.estudio-techs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: auto; }
.tech-chip {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 0.58rem;
  padding: 4px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--muted2);
  transition: border-color 0.3s, color 0.3s;
}
.estudio-card:hover .tech-chip { border-color: rgba(255,255,255,0.1); }
.tech-chip .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--card-accent);
}

/* =================== SECTION 4: CONTACTO =================== */
#contacto { background: var(--bg); padding: 0; min-height: 100vh; }

.contact-split {
  display: grid; grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.contact-left {
  position: relative; overflow: hidden;
  background: #050505;
}

#techCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
}

.contact-left-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to right, transparent 60%, var(--bg) 100%);
  z-index: 2;
}

.contact-right {
  padding: 8rem 4rem;
  display: flex; flex-direction: column; justify-content: center;
  position: relative; z-index: 3;
}

.contact-right .section-label { margin-bottom: 1.5rem; }
.contact-right .section-title-big { font-size: clamp(2.5rem, 5vw, 4.5rem); margin-bottom: 1.5rem; }

.contact-intro {
  font-size: 0.9rem; color: var(--muted2); line-height: 1.9;
  margin-bottom: 3rem; max-width: 400px;
}

.contact-items { display: flex; flex-direction: column; gap: 1.2rem; margin-bottom: 3rem; }

.contact-item {
  display: flex; align-items: center; gap: 1.2rem;
  padding: 1rem 1.2rem;
  background: var(--bg2); border: 1px solid var(--border);
  text-decoration: none; color: var(--text);
  transition: border-color 0.3s, transform 0.3s, background 0.3s;
  position: relative; overflow: hidden;
}
.contact-item::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 0; background: rgba(200,255,0,0.05);
  transition: width 0.4s ease;
}
.contact-item:hover { border-color: rgba(200,255,0,0.3); transform: translateX(8px); }
.contact-item:hover::after { width: 100%; }

.contact-item-icon {
  width: 36px; height: 36px;
  background: rgba(200,255,0,0.08);
  border: 1px solid rgba(200,255,0,0.2);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; z-index: 1;
}
.contact-item-icon svg { width: 16px; height: 16px; fill: var(--accent); }
.contact-item-text { z-index: 1; }
.contact-item-label {
  font-family: var(--font-mono); font-size: 0.6rem;
  color: var(--muted); letter-spacing: 0.15em; text-transform: uppercase;
  display: block; margin-bottom: 2px;
}
.contact-item-val { font-size: 0.88rem; color: var(--text); }

.contact-cta {
  display: inline-flex; align-items: center; gap: 1rem;
  padding: 1rem 2.5rem;
  background: var(--accent); color: #000;
  font-family: var(--font-mono); font-size: 0.75rem;
  letter-spacing: 0.15em; text-transform: uppercase;
  text-decoration: none; font-weight: 500;
  border: none; cursor: none;
  transition: opacity 0.2s, transform 0.2s;
  width: fit-content;
}
.contact-cta:hover { opacity: 0.85; transform: translateY(-3px); }
.contact-cta svg { width: 14px; height: 14px; fill: #000; transition: transform 0.3s; }
.contact-cta:hover svg { transform: translateX(4px); }

/* FOOTER */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 4rem;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg);
}
footer p { font-family: var(--font-mono); font-size: 0.65rem; color: var(--muted); }
footer span { color: var(--accent); }

/* SCROLLBAR */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--muted); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* SELECTION */
::selection { background: rgba(200,255,0,0.2); color: var(--accent); }

/* HAMBURGER BUTTON */
.nav-hamburger {
  display: none;
  flex-direction: column; gap: 5px;
  cursor: pointer; padding: 4px; background: none; border: none;
}
.nav-hamburger span {
  display: block; width: 24px; height: 1.5px;
  background: var(--muted2);
  transition: transform 0.3s, opacity 0.3s, background 0.3s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); background: var(--accent); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); background: var(--accent); }

/* MOBILE MENU OVERLAY */
.nav-mobile {
  display: none;
  position: fixed; inset: 0; z-index: 400;
  background: rgba(8,8,8,0.97);
  flex-direction: column; align-items: center; justify-content: center;
  gap: 2.5rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease;
}
.nav-mobile.open { opacity: 1; pointer-events: all; }
.nav-mobile a {
  font-family: var(--font-display); font-size: 3rem;
  color: var(--muted2); text-decoration: none; letter-spacing: 0.05em;
  transition: color 0.2s, transform 0.2s;
  display: block;
}
.nav-mobile a:hover { color: var(--accent); transform: translateX(12px); }

@media (max-width: 768px) {
  /* NAV */
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .nav-mobile { display: flex; }

  /* HERO */
  .hero { padding: 0 1.5rem; }

  /* SECTIONS */
  .section-wrap { padding: 5rem 1.5rem; }

  /* PROYECTOS */
  .phones-container { flex-direction: column; align-items: center; gap: 3rem; }
  .phone-wrapper:nth-child(2) { transform: none; }
  .phone-wrapper { max-width: 100%; }

  /* ESTUDIOS: stack vertical en móvil */
  .estudios-grid { grid-template-columns: 1fr; }

  /* CONTACTO */
  .contact-split { grid-template-columns: 1fr; }
  .contact-left { height: 35vh; }
  .contact-right { padding: 4rem 1.5rem; }

  /* FOOTER */
  footer { padding: 1.5rem; flex-direction: column; gap: 0.5rem; text-align: center; }
}

@media (min-width: 769px) and (max-width: 1100px) {
  .estudios-grid { grid-template-columns: repeat(2, 1fr); }

  /* PROYECTOS */
  .phones-container { gap: 1rem; }
  .phone-device { width: 180px; height: 360px; }

  /* NAV */
  nav { padding: 1.2rem 2rem; }
  .nav-links { gap: 1.8rem; }

  /* SECTIONS */
  .section-wrap { padding: 6rem 2rem; }
  .contact-right { padding: 6rem 2.5rem; }
}