/* ============================================================
   AdrianZgzDev · Portfolio v2
   Design system + layout + animations
   ============================================================ */

:root {
  --bg: #070b16;
  --bg-2: #0b1020;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: rgba(255, 255, 255, 0.94);
  --muted: rgba(255, 255, 255, 0.66);
  --faint: rgba(255, 255, 255, 0.42);

  --brand: #00e5ff;
  --brand-2: #7c3aed;
  --warm: #f59e0b;
  --hot: #f97316;
  --green: #22c55e;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.3);

  --maxw: 1180px;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font-body);
  --font-brand: "Orbitron", var(--font-display);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(124, 58, 237, 0.55); color: #fff; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0; letter-spacing: -0.02em; }

/* ---------- Animated background ---------- */
.bg-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(120% 90% at 50% -10%, #0d1428 0%, var(--bg) 60%); }
.bg-grid {
  position: absolute; inset: -2px;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(100% 70% at 50% 0%, #000 40%, transparent 100%);
}
.bg-glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; }
.bg-glow--1 { width: 620px; height: 620px; top: -180px; left: -120px; background: rgba(124, 58, 237, 0.4); animation: float1 18s ease-in-out infinite; }
.bg-glow--2 { width: 560px; height: 560px; top: 120px; right: -160px; background: rgba(0, 229, 255, 0.22); animation: float2 22s ease-in-out infinite; }
.bg-glow--3 { width: 480px; height: 480px; bottom: -160px; left: 30%; background: rgba(34, 197, 94, 0.16); animation: float1 26s ease-in-out infinite reverse; }

@keyframes float1 { 50% { transform: translate(40px, 50px); } }
@keyframes float2 { 50% { transform: translate(-50px, 30px); } }

/* ---------- Scroll progress ---------- */
.scroll-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100; background: transparent; }
.scroll-progress span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); box-shadow: 0 0 12px var(--brand); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; gap: 20px;
  max-width: var(--maxw); margin: 0 auto; padding: 14px 24px;
  transition: padding 0.25s ease;
}
.nav.scrolled {
  padding: 10px 18px;
  background: rgba(9, 13, 25, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 16px 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-brand); font-weight: 800; letter-spacing: 0.5px; }
.brand__icon { width: 30px; height: 30px; border-radius: 8px; }
.brand__name { font-size: 16px; }
.nav__links { display: flex; gap: 6px; margin-left: auto; }
.nav__links a { padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--muted); transition: color 0.2s, background 0.2s; }
.nav__links a:hover { color: var(--text); background: var(--surface); }
.nav__links a.active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.nav__actions { display: flex; gap: 10px; }
.nav__burger { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav__burger span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.3s, opacity 0.3s; }

/* ---------- Buttons ---------- */
.btn {
  --pad-y: 12px; --pad-x: 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: var(--pad-y) var(--pad-x);
  border-radius: 999px; border: 1px solid var(--line-strong);
  font: 600 15px/1 var(--font-body); color: var(--text);
  cursor: pointer; transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s, border-color 0.2s;
  background: var(--surface);
}
.btn:hover { transform: translateY(-2px); }
.btn--sm { --pad-y: 9px; --pad-x: 15px; font-size: 13.5px; }
.btn--block { width: 100%; --pad-y: 14px; }
.btn--primary {
  background: linear-gradient(120deg, var(--brand-2), #a855f7);
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
}
.btn--primary:hover { box-shadow: 0 12px 30px rgba(124, 58, 237, 0.5); }
.btn--ghost { background: var(--surface); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--line-strong); }

/* ---------- Hero ---------- */
.hero { position: relative; max-width: var(--maxw); margin: 0 auto; padding: 60px 24px 90px; min-height: 88vh; display: flex; flex-direction: column; justify-content: center; }
.pill {
  display: inline-flex; align-items: center; gap: 9px; align-self: flex-start;
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 13.5px; font-weight: 500; color: var(--muted);
}
.pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse 2s infinite; }
.pill__arrow { color: var(--brand); font-weight: 700; }
@keyframes pulse { 50% { opacity: 0.4; } }

.hero__title { font-size: clamp(2.4rem, 6vw, 4.6rem); font-weight: 700; margin: 26px 0 0; letter-spacing: -0.03em; }
.grad { background-clip: text; -webkit-background-clip: text; color: transparent; }
.grad--warm { background-image: linear-gradient(100deg, #fbbf24, #f97316); }
.grad--cool { background-image: linear-gradient(100deg, var(--brand), #818cf8); }

.hero__sub { max-width: 720px; margin: 24px 0 0; font-size: clamp(1rem, 2vw, 1.18rem); color: var(--muted); }
.hero__sub b { color: var(--text); font-weight: 600; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero__loc { margin: 20px 0 0; color: var(--faint); font-size: 14px; }

.hero__stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 48px; }
.stat { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat__num { display: block; font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 700; color: #fff; }
.stat__label { font-size: 13px; color: var(--muted); }

.hero__scroll { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); width: 26px; height: 42px; border: 2px solid var(--line-strong); border-radius: 14px; }
.hero__scroll span { position: absolute; top: 8px; left: 50%; width: 4px; height: 8px; margin-left: -2px; background: var(--brand); border-radius: 2px; animation: scrolldot 1.8s infinite; }
@keyframes scrolldot { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 80% { opacity: 0; transform: translateY(14px); } }

/* ---------- Sections ---------- */
.hero, .section { scroll-margin-top: 84px; }
.section { max-width: var(--maxw); margin: 0 auto; padding: 80px 24px; }
.section__head { max-width: 720px; margin-bottom: 46px; }
.eyebrow { display: inline-block; font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brand); margin-bottom: 12px; }
.section__head h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
.section__lead { margin: 16px 0 0; color: var(--muted); font-size: 1.05rem; }

/* ---------- Timeline ---------- */
.timeline { display: grid; gap: 18px; }
.tl { display: grid; grid-template-columns: 64px 1fr; gap: 20px; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); position: relative; overflow: hidden; transition: border-color 0.25s, transform 0.25s; }
.tl:hover { border-color: var(--line-strong); transform: translateX(4px); }
.tl::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line-strong); }
.tl--accent::before { background: linear-gradient(var(--brand), var(--brand-2)); }
.tl--goal::before { background: var(--warm); }
.tl__marker { width: 56px; height: 56px; display: grid; place-items: center; font-size: 26px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.tl__year { display: inline-block; font-family: var(--font-display); font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand); margin-bottom: 8px; }
.tl__body h3 { font-size: 1.3rem; margin-bottom: 8px; }
.tl__body p { margin: 0 0 14px; color: var(--muted); }

/* ---------- Chips & Tags ---------- */
.chips, .tags { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; color: var(--muted); }
.chip--hot { border-color: rgba(0, 229, 255, 0.4); color: #7dd3fc; background: rgba(0, 229, 255, 0.07); }
.tag { padding: 5px 11px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 12.5px; font-weight: 500; color: var(--muted); }
.tag--blue { border-color: rgba(59, 130, 246, 0.5); color: #93c5fd; }
.tag--purple { border-color: rgba(168, 85, 247, 0.5); color: #d8b4fe; }
.tag--yellow { border-color: rgba(234, 179, 8, 0.5); color: #fde047; }
.tag--orange { border-color: rgba(249, 115, 22, 0.5); color: #fdba74; }
.tag--red { border-color: rgba(248, 113, 113, 0.5); color: #fca5a5; }
.tag--green { border-color: rgba(34, 197, 94, 0.5); color: #86efac; }
.tag--cyan { border-color: rgba(6, 182, 212, 0.5); color: #67e8f9; }

/* ---------- Bullets ---------- */
.bullets { margin: 14px 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.bullets li { position: relative; padding-left: 22px; color: var(--muted); font-size: 0.95rem; }
.bullets li::before { content: "▹"; position: absolute; left: 0; color: var(--brand); }
.bullets b { color: var(--text); font-weight: 600; }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* ---------- Featured project ---------- */
.feature { display: grid; grid-template-columns: 1fr; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); overflow: hidden; background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(255, 255, 255, 0.02)); box-shadow: var(--shadow); margin-bottom: 34px; }
.feature__media { position: relative; background: #05070f; border-bottom: 1px solid var(--line); }
.feature__media img { width: 100%; height: auto; display: block; }
.feature__badge { position: absolute; top: 14px; left: 14px; z-index: 2; background: rgba(34, 197, 94, 0.92); color: #04120a; font-size: 11px; font-weight: 800; padding: 5px 12px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.5px; }
.feature__body { padding: 32px; }
.feature__body h3 { font-size: 1.6rem; }
.feature__tagline { color: var(--brand); font-size: 0.9rem; font-weight: 600; margin: 8px 0 14px; }
.feature__body > p { color: var(--muted); margin: 0 0 16px; }

/* ---------- Project grid ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.pcard { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease; }
.pcard:hover { transform: translateY(-6px); border-color: var(--line-strong); box-shadow: var(--shadow-soft); }
.pcard__media--split { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: #05070f; }
.pcard__media img { width: 100%; height: 180px; object-fit: cover; border-bottom: 1px solid var(--line); }

/* Tarjeta a todo el ancho: imágenes grandes arriba, texto debajo (estilo feature) */
.pcard--wide {
  grid-column: 1 / -1;
  border-color: rgba(0, 229, 255, 0.32);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.09), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
}
.pcard--wide .pcard__media { border-bottom: 1px solid var(--line-strong); }
.pcard--wide .pcard__media img { height: auto; object-fit: contain; }
.pcard__body { padding: 26px; display: flex; flex-direction: column; gap: 10px; }
.pcard__body h3 { font-size: 1.3rem; }
.pcard__tagline { color: var(--brand); font-size: 0.85rem; font-weight: 600; margin: -4px 0 4px; }
.pcard__body p { color: var(--muted); margin: 0; font-size: 0.95rem; }
.pcard .links { margin-top: auto; }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.scard { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 26px; transition: transform 0.25s, border-color 0.25s; }
.scard:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.scard h3 { font-size: 1.2rem; margin-bottom: 10px; }
.scard > p { color: var(--muted); font-size: 0.95rem; margin: 0 0 14px; }
.scard--focus { border-color: rgba(234, 179, 8, 0.4); background: rgba(234, 179, 8, 0.05); grid-column: span 1; }

.levels { display: grid; gap: 12px; }
.lvl { display: grid; gap: 6px; }
.lvl span { font-size: 13px; color: var(--text); font-weight: 500; }
.lvl i { display: block; height: 7px; border-radius: 999px; background: var(--surface-2); position: relative; overflow: hidden; }
.lvl i::after { content: ""; position: absolute; inset: 0; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--brand-2), var(--brand)); transition: width 1.1s cubic-bezier(0.2, 0.8, 0.2, 1); }
.lvl i.animate::after { width: var(--w); }

/* ---------- Contact ---------- */
.section--contact { padding-bottom: 60px; }
.contact { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); padding: 40px; background: linear-gradient(135deg, rgba(0, 229, 255, 0.06), rgba(124, 58, 237, 0.06)); }
.contact__intro h2 { font-size: 2rem; margin-bottom: 14px; }
.contact__intro p { color: var(--muted); }
.contact__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.contact__form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field input, .field textarea { width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: rgba(0, 0, 0, 0.25); color: var(--text); font: 400 15px var(--font-body); transition: border-color 0.2s, box-shadow 0.2s; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15); }
.field textarea { resize: vertical; }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }
.status { margin: 4px 0 0; min-height: 20px; font-size: 14px; color: var(--muted); }

/* ---------- Zoomable images + Lightbox ---------- */
.zoomable { cursor: zoom-in; }
.feature__media, .pcard__media { position: relative; }
.feature__media::after, .pcard__media::after {
  content: "🔍 Ampliar"; position: absolute; bottom: 12px; right: 12px;
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(7, 11, 22, 0.78); color: #fff; border: 1px solid var(--line-strong);
  opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s;
  pointer-events: none; backdrop-filter: blur(6px);
}
.feature__media:hover::after, .pcard__media:hover::after { opacity: 1; transform: none; }

.lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 4vmin;
  background: rgba(4, 6, 14, 0.9); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity 0.25s ease;
}
.lightbox.open { display: flex; opacity: 1; }
.lightbox__img {
  max-width: 96vw; max-height: 92vh; width: auto; height: auto;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); transform: scale(0.97); transition: transform 0.25s ease;
}
.lightbox.open .lightbox__img { transform: none; }
.lightbox__close {
  position: absolute; top: 18px; right: 22px; width: 44px; height: 44px;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line-strong); color: #fff;
  font-size: 20px; line-height: 1; transition: background 0.2s, transform 0.15s;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.14); transform: scale(1.05); }

@media (prefers-reduced-motion: reduce) {
  .lightbox, .lightbox__img { transition: none; }
}

/* ---------- Footer ---------- */
.footer { max-width: var(--maxw); margin: 0 auto; padding: 30px 24px 50px; display: flex; justify-content: space-between; gap: 12px; color: var(--faint); font-size: 14px; border-top: 1px solid var(--line); }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--brand); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nav__links, .nav__actions { display: none; }
  .nav__burger { display: flex; margin-left: auto; }
  .nav.open .nav__links {
    display: flex; flex-direction: column; position: absolute; top: 100%; left: 12px; right: 12px;
    padding: 12px; gap: 4px; background: rgba(9, 13, 25, 0.96); backdrop-filter: blur(14px);
    border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  }
  .nav.open .nav__burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav.open .nav__burger span:nth-child(2) { opacity: 0; }
  .nav.open .nav__burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .proj-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .contact { grid-template-columns: 1fr; padding: 28px; }
}

@media (max-width: 620px) {
  .hero__stats { grid-template-columns: repeat(2, 1fr); }
  .skills-grid { grid-template-columns: 1fr; }
  .tl { grid-template-columns: 1fr; }
  .tl__marker { display: none; }
  .section { padding: 60px 20px; }
  .footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
