/* ============================================
   ALEX RIVERA — PORTFOLIO CSS
   Modern AI Dark Theme with Animations
   ============================================ */

:root {
  --bg: #080c14;
  --bg2: #0d1220;
  --surface: #111827;
  --surface2: #1a2235;
  --border: rgba(99, 179, 237, 0.12);
  --accent: #38bdf8;
  --accent2: #818cf8;
  --accent3: #34d399;
  --text: #e2e8f0;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --gradient: linear-gradient(135deg, #38bdf8, #818cf8, #34d399);
  --gradient-soft: linear-gradient(135deg, rgba(56,189,248,0.15), rgba(129,140,248,0.15));
  --glow: 0 0 40px rgba(56, 189, 248, 0.2);
  --radius: 16px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  overflow-x: hidden;
  cursor: none;
}

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

/* ---- CANVAS BG ---- */
#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
}

/* ---- CURSOR ---- */
.cursor {
  width: 40px; height: 40px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transition: transform 0.15s ease, opacity 0.3s;
  transform: translate(-50%, -50%);
}
.cursor-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 0.05s;
}
body:hover .cursor { opacity: 1; }
a:hover ~ .cursor, button:hover ~ .cursor { transform: translate(-50%, -50%) scale(1.8); }

/* ---- SELECTION ---- */
::selection { background: rgba(56, 189, 248, 0.25); color: var(--accent); }

/* ---- UTILITIES ---- */
.container { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.section { padding: 110px 0; position: relative; z-index: 1; }
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.section-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 5px 14px;
  border-radius: 99px;
  margin-bottom: 20px;
}
.section-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 24px;
  color: #fff;
}

/* ---- REVEAL ANIMATIONS ---- */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.7s cubic-bezier(0.4,0,0.2,1), transform 0.7s cubic-bezier(0.4,0,0.2,1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- NAV ---- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  background: rgba(8, 12, 20, 0.6);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.nav.scrolled { padding: 14px 40px; }
.nav-logo {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}
.dot { color: var(--accent); }
.nav-links { display: flex; gap: 36px; list-style: none; }
.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 0;
  width: 0; height: 2px;
  background: var(--accent);
  transition: var(--transition);
  border-radius: 1px;
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { width: 100%; }
.nav-cta a {
  padding: 9px 22px;
  background: var(--gradient);
  color: #000;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 99px;
  text-decoration: none;
  transition: var(--transition);
}
.nav-cta a:hover { box-shadow: var(--glow); transform: translateY(-1px); }
.hamburger { display: none; background: none; border: none; color: var(--text); font-size: 1.5rem; cursor: none; }

/* ---- HERO ---- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 40px;
  max-width: 1140px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--accent3);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  padding: 6px 16px;
  border-radius: 99px;
  margin-bottom: 28px;
  animation-delay: 0.1s;
}
.hero-tag::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent3);
  animation: blink 1.5s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

.hero-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(3.5rem, 8vw, 7rem);
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 28px;
  color: #fff;
}
.hero-title .line { display: block; }
.hero-title .line:nth-child(1) { transition-delay: 0.1s; }
.hero-title .line:nth-child(2) { transition-delay: 0.2s; }
.hero-title .line:nth-child(3) { transition-delay: 0.3s; }

.hero-sub {
  color: var(--text-dim);
  font-size: 1.15rem;
  line-height: 1.7;
  max-width: 520px;
  margin-bottom: 40px;
  transition-delay: 0.4s;
}
.hero-btns {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  transition-delay: 0.5s;
}
.btn-primary {
  display: inline-block;
  padding: 14px 32px;
  background: var(--gradient);
  color: #000;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 99px;
  text-decoration: none;
  transition: var(--transition);
  border: none; cursor: none;
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(56,189,248,0.35); }
.btn-primary.full-w { width: 100%; text-align: center; font-family: 'Syne', sans-serif; font-size: 1rem; padding: 16px; }
.btn-ghost {
  display: inline-block;
  padding: 14px 32px;
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: 99px;
  text-decoration: none;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: rgba(56,189,248,0.05); }

.hero-scroll {
  position: absolute;
  bottom: 40px; left: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition-delay: 0.7s;
}
.scroll-line {
  width: 50px; height: 1px;
  background: var(--text-muted);
  position: relative;
  overflow: hidden;
}
.scroll-line::after {
  content: '';
  position: absolute;
  left: -100%; top: 0;
  width: 100%; height: 100%;
  background: var(--accent);
  animation: scanLine 2s infinite;
}
@keyframes scanLine { 0%{left:-100%} 100%{left:100%} }

/* Floating badges */
.float-badge {
  position: absolute;
  right: 80px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-dim);
  backdrop-filter: blur(10px);
  animation: float 3s ease-in-out infinite;
}
.badge-1 { top: 38%; animation-delay: 0s; }
.badge-2 { top: 50%; animation-delay: 0.6s; right: 160px; }
.badge-3 { top: 62%; animation-delay: 1.2s; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }

/* ---- ABOUT ---- */
.about { background: var(--bg2); }
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}
.about-text {
  color: var(--text-dim);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 16px;
}
.stats {
  display: flex;
  gap: 40px;
  margin-top: 40px;
}
.stat { text-align: center; }
.stat-num {
  font-family: 'Syne', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat span { font-size: 1.5rem; font-weight: 700; color: var(--accent); margin-left: 2px; }
.stat p { color: var(--text-muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 4px; }

.profile-wrapper { position: relative; display: flex; justify-content: center; }
.profile-blob {
  position: absolute;
  width: 340px; height: 340px;
  border-radius: 60% 40% 70% 30% / 30% 60% 40% 70%;
  background: var(--gradient-soft);
  animation: morphBlob 6s ease-in-out infinite;
  z-index: 0;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
@keyframes morphBlob {
  0%,100%{ border-radius: 60% 40% 70% 30% / 30% 60% 40% 70%; }
  50%{ border-radius: 40% 60% 30% 70% / 60% 30% 70% 40%; }
}
.profile-img {
  width: 300px; height: 360px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  z-index: 1;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.profile-img img { width: 100%; height: 100%; object-fit: cover; }
.profile-card {
  position: absolute;
  bottom: -16px; right: -24px;
  z-index: 2;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.profile-card span { font-size: 1.4rem; }
.profile-card strong { display: block; color: #fff; font-size: 0.9rem; }
.profile-card p { color: var(--text-muted); font-size: 0.75rem; }

/* ---- SKILLS ---- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 20px;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.skill-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}
.skill-card:hover { border-color: rgba(56,189,248,0.3); transform: translateY(-6px); box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.skill-card:hover::before { transform: scaleX(1); }
.skill-icon { font-size: 2rem; margin-bottom: 14px; }
.skill-card h3 { font-family: 'Syne', sans-serif; font-size: 1.1rem; font-weight: 700; color: #fff; margin-bottom: 10px; }
.skill-card p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; margin-bottom: 20px; }
.skill-bar { height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; }
.skill-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 2px;
  width: 0;
  transition: width 1.2s cubic-bezier(0.4,0,0.2,1);
}

/* ---- WORK ---- */
.work { background: var(--bg2); }
.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 20px;
}
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: var(--transition); }
.project-card.featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.2fr 1fr; }
.project-card:hover { transform: translateY(-6px); box-shadow: 0 24px 60px rgba(0,0,0,0.4); border-color: rgba(56,189,248,0.2); }
.project-img { position: relative; overflow: hidden; aspect-ratio: 16/9; }
.project-card.featured .project-img { aspect-ratio: auto; }
.project-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.project-card:hover .project-img img { transform: scale(1.05); }
.project-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8,12,20,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}
.project-card:hover .project-overlay { opacity: 1; }
.project-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid var(--accent);
  padding: 10px 22px;
  border-radius: 99px;
  transition: var(--transition);
}
.project-link:hover { background: var(--accent); color: #000; }
.project-info { padding: 28px; }
.project-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.project-tags span {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.2);
  padding: 3px 12px;
  border-radius: 99px;
  text-transform: uppercase;
}
.project-info h3 { font-family: 'Syne', sans-serif; font-size: 1.3rem; font-weight: 700; color: #fff; margin-bottom: 10px; }
.project-info p { color: var(--text-muted); font-size: 0.92rem; line-height: 1.6; }

/* ---- TESTIMONIALS ---- */
.testi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 20px;
}
.testi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: var(--transition);
}
.testi-card:hover { border-color: rgba(56,189,248,0.25); transform: translateY(-4px); }
.stars { color: #f59e0b; font-size: 1rem; margin-bottom: 16px; letter-spacing: 2px; }
.testi-card p { color: var(--text-dim); font-size: 0.95rem; line-height: 1.75; font-style: italic; margin-bottom: 24px; }
.testi-author { display: flex; align-items: center; gap: 12px; }
.testi-author img { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--border); }
.testi-author strong { display: block; color: #fff; font-size: 0.9rem; }
.testi-author span { color: var(--text-muted); font-size: 0.8rem; }

/* ---- CONTACT ---- */
.contact { background: var(--bg2); }
.contact-wrapper {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}
.contact-sub { color: var(--text-dim); font-size: 1rem; margin-bottom: 48px; }
.contact-form { text-align: left; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { position: relative; margin-bottom: 20px; }
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
  resize: none;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,0.1); }
.form-group label {
  position: absolute;
  top: 50%; left: 20px;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
  transition: var(--transition);
}
.form-group textarea + label { top: 22px; transform: none; }
.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label,
.form-group textarea:focus + label,
.form-group textarea:not(:placeholder-shown) + label {
  top: -10px;
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--bg2);
  padding: 0 6px;
  left: 14px;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: transparent; }
.form-success {
  display: none;
  text-align: center;
  padding: 14px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: var(--radius-sm);
  color: var(--accent3);
  font-size: 0.9rem;
  margin-top: 12px;
}
.social-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 40px;
  flex-wrap: wrap;
}
.social-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}
.social-link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
}
.social-link:hover { color: var(--accent); }
.social-link:hover::after { width: 100%; }

/* ---- FOOTER ---- */
.footer { background: var(--bg); border-top: 1px solid var(--border); padding: 32px 0; position: relative; z-index: 1; }
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-logo { font-family: 'Syne', sans-serif; font-size: 1.2rem; font-weight: 800; color: #fff; }
.footer p { color: var(--text-muted); font-size: 0.85rem; }
.back-top {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}
.back-top:hover { opacity: 0.7; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; gap: 50px; }
  .about-right { display: flex; justify-content: center; }
  .projects-grid { grid-template-columns: 1fr; }
  .project-card.featured { grid-template-columns: 1fr; }
  .float-badge { display: none; }
  .nav-links, .nav-cta { display: none; }
  .hamburger { display: block; }
  .hero { padding: 0 24px; }
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .stats { gap: 24px; }
  .nav { padding: 16px 24px; }
}
