/* =========================================================
   Ayan Abbasi — Portfolio
   ========================================================= */

:root {
  --bg: #040914;
  --bg-alt: #0d1424;
  --panel: #121b2e;
  --panel-2: #16213a;
  --border: rgba(232, 237, 245, 0.09);
  --border-strong: rgba(232, 237, 245, 0.16);
  --text: #eaeef6;
  --muted: #8ea0c2;
  --muted-2: #5c6d8f;
  --blue: #5b8def;
  --green: #34d399;
  --amber: #f5a623;
  --rose: #ef6f6c;

  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Courier New", monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --maxw: 1120px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { 
    animation-duration: 0.01ms !important; 
    animation-iteration-count: 1 !important; 
    transition-duration: 0.01ms !important; 
    scroll-behavior: auto !important; 
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; line-height: 1.15; letter-spacing: -0.01em; }

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

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Top Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 15, 28, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 15px; font-weight: 600; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(52,211,153,0.15); }
.nav-links { display: flex; gap: 28px; font-family: var(--font-mono); font-size: 13.5px; color: var(--muted); }
.nav-links a { position: relative; padding: 4px 2px; transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }
.nav-links a::before { content: "./"; color: var(--muted-2); }
.nav-cta {
  font-family: var(--font-mono); font-size: 13px; color: var(--bg);
  background: var(--green); padding: 8px 16px; border-radius: 999px; font-weight: 600;
  border: 1px solid var(--green);
}
.nav-cta:hover { filter: brightness(1.08); }

/* =========================================================
   HERO SECTION & 3D BACKGROUND
   ========================================================= */
.hero {
  position: relative;
  overflow: hidden;
  background: #040914;
  padding: 88px 0 64px;
}

/* 3D Wireframe Grid Background */
.hero::before {
  content: '';
  position: absolute;
  inset: -50%;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 45px 45px;
  perspective: 1000px;
  transform: rotateX(60deg) scale(1.8);
  opacity: 0.35;
  pointer-events: none;
  z-index: 1;
}

/* Floating 3D Orb */
.hero::after {
  content: '';
  position: absolute;
  width: 150px;
  height: 150px;
  top: 15%;
  right: 40%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffffff, #88bbfd 40%, #031333 90%);
  box-shadow: 0 0 35px rgba(255, 255, 255, 0.7), inset 0 0 20px rgba(255, 255, 255, 0.9);
  animation: float3D 8s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 1;
}

@keyframes float3D {
  0% { transform: translateY(0px) rotate(0deg) scale(1); }
  50% { transform: translateY(-25px) rotate(180deg) scale(1.08); }
  100% { transform: translateY(15px) rotate(360deg) scale(0.95); }
}

.hero .wrap {
  position: relative;
  z-index: 2;
}

.hero-grid { 
  display: grid; 
  grid-template-columns: 1.05fr 0.95fr; 
  gap: 56px; 
  align-items: center; 
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--green);
  border: 1px solid rgba(52,211,153,0.35); background: rgba(52,211,153,0.07);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 18px;
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: blink 1.6s infinite; }
@keyframes blink { 0%, 45% { opacity: 1; } 50%, 95% { opacity: 0.25; } 100% { opacity: 1; } }

.hero h1 { font-size: clamp(34px, 4.6vw, 52px); }
.hero h1 .line2 { display: block; color: var(--muted); font-size: 0.55em; font-weight: 500; margin-top: 10px; font-family: var(--font-mono); }

.hero-role {
  font-family: var(--font-mono); font-size: 17px; color: var(--blue); margin-top: 20px; min-height: 26px;
}
.hero-role .caret { display: inline-block; width: 9px; height: 1.1em; background: var(--blue); margin-left: 3px; vertical-align: -2px; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

.hero-tagline { color: var(--muted); margin-top: 18px; max-width: 46ch; font-size: 15.5px; }

.hero-actions { display: flex; gap: 14px; margin-top: 30px; flex-wrap: wrap; }
.btn {
  font-family: var(--font-mono); font-size: 13.5px; font-weight: 600; padding: 12px 22px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); transition: all 0.18s;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--blue); border-color: var(--blue); color: #08111f; }
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-ghost { color: var(--text); background: var(--panel); }
.btn-ghost:hover { border-color: var(--border-strong); background: var(--panel-2); }

.hero-stats { display: flex; gap: 30px; margin-top: 40px; }
.hero-stats .num { font-family: var(--font-mono); font-size: 24px; font-weight: 700; color: var(--text); }
.hero-stats .lbl { font-size: 12px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

/* =========================================================
   HERO ROUNDED PROFILE IMAGE CONTAINER
   ========================================================= */
.hero-image-column {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.rounded-profile-frame {
  position: relative;
  width: 290px;
  height: 290px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-pic {
  width: 95%;
  height: 95%;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid #040914;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6);
  z-index: 2;
  transition: transform 0.4s ease;
}

.picture-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: 
    0 0 30px rgba(255, 255, 255, 0.45),
    inset 0 0 20px rgba(255, 255, 255, 0.2);
  animation: liquidGlowPulse 4s ease-in-out infinite alternate;
  z-index: 1;
}

@keyframes liquidGlowPulse {
  0% {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    transform: scale(0.98);
  }
  100% {
    border-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 45px rgba(255, 255, 255, 0.7), 0 0 80px rgba(136, 187, 253, 0.3);
    transform: scale(1.02);
  }
}

.rounded-profile-frame:hover .profile-pic {
  transform: scale(1.03);
}

.rounded-profile-frame:hover .picture-glow {
  box-shadow: 0 0 55px rgba(255, 255, 255, 0.85);
}

/* ---------- Section Shell ---------- */
section { padding: 92px 0; border-top: 1px solid var(--border); }
.sec-head { margin-bottom: 46px; }
.sec-idx { font-family: var(--font-mono); font-size: 12.5px; color: var(--green); margin-bottom: 10px; }
.sec-title { font-size: clamp(24px, 3vw, 32px); }
.sec-sub { color: var(--muted); margin-top: 10px; max-width: 60ch; font-size: 15px; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.about-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px;
}
.about-card p { color: var(--muted); font-size: 15px; margin: 0 0 14px; }
.about-card p:last-child { margin-bottom: 0; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; margin-top: 6px; }
.kv { border-left: 2px solid var(--border-strong); padding-left: 12px; }
.kv .k { font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.06em; }
.kv .v { font-size: 14.5px; margin-top: 3px; }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 22px; }
.skill-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.skill-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.skill-card-head .icon { font-size: 20px; }
.skill-card-head h3 { font-size: 16px; }
.skill-row { margin-bottom: 14px; }
.skill-row:last-child { margin-bottom: 0; }
.skill-row-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.skill-row-top .pct { font-family: var(--font-mono); color: var(--muted-2); }
.meter { height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.meter > span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  width: var(--w, 0%);
  transform: scaleX(0); transform-origin: left; transition: transform 1.1s cubic-bezier(.2,.7,.3,1);
}
.skill-card.in-view .meter > span { transform: scaleX(1); }

/* ---------- Education Timeline ---------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--border-strong); }
.tl-item { position: relative; padding-bottom: 34px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -28px; top: 4px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--green);
}
.tl-year { font-family: var(--font-mono); font-size: 12px; color: var(--green); margin-bottom: 4px; }
.tl-degree { font-size: 17px; font-weight: 600; }
.tl-inst { color: var(--muted); font-size: 14px; margin-top: 3px; }
.tl-desc { color: var(--muted-2); font-size: 13.5px; margin-top: 6px; }

/* ---------- Projects ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.project-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: transform 0.2s, border-color 0.2s;
}
.project-card:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.project-thumb { aspect-ratio: 16/10; background: linear-gradient(135deg, var(--panel-2), var(--bg-alt)); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); color: var(--muted-2); font-size: 12px; overflow: hidden; }
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.project-body h3 { font-size: 17px; }
.project-body p { color: var(--muted); font-size: 14px; margin: 0; flex: 1; }
.tech-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tech-tag { font-family: var(--font-mono); font-size: 11px; color: var(--amber); background: rgba(245,166,35,0.08); border: 1px solid rgba(245,166,35,0.25); padding: 3px 9px; border-radius: 999px; }
.project-links { display: flex; gap: 16px; margin-top: 4px; font-family: var(--font-mono); font-size: 12.5px; }
.project-links a { color: var(--blue); border-bottom: 1px solid transparent; }
.project-links a:hover { border-color: var(--blue); }

/* ---------- Certificates ---------- */
.cert-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.cert-item { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; }
.cert-mark { font-family: var(--font-mono); color: var(--green); font-size: 16px; }
.cert-title { font-size: 14.5px; font-weight: 600; }
.cert-meta { font-size: 12.5px; color: var(--muted-2); margin-top: 2px; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 40px; }
.contact-info { display: flex; flex-direction: column; gap: 18px; }
.contact-row { display: flex; align-items: center; gap: 12px; font-size: 14.5px; }
.contact-row .lbl { font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.05em; min-width: 70px; }
.social-row { display: flex; gap: 10px; margin-top: 8px; }
.social-row a {
  font-family: var(--font-mono); font-size: 12.5px; border: 1px solid var(--border-strong); padding: 8px 14px;
  border-radius: 999px; color: var(--text); transition: all 0.2s;
}
.social-row a:hover { border-color: var(--green); color: var(--green); }

.form-panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 7px; }
.form-row input, .form-row textarea {
  width: 100%; background: var(--bg-alt); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 11px 13px; color: var(--text); font-family: var(--font-body); font-size: 14px; resize: vertical;
}
.form-row input:focus, .form-row textarea:focus { outline: none; border-color: var(--green); }
.form-msg { font-family: var(--font-mono); font-size: 13px; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.form-msg.success { background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.3); color: var(--green); }
.form-msg.error { background: rgba(239,111,108,0.1); border: 1px solid rgba(239,111,108,0.3); color: var(--rose); }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--border); padding: 32px 0; }
footer .wrap { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted-2); flex-wrap: wrap; gap: 10px; }

/* ---------- Reveal-on-Scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ---------- Responsive Adjustments ---------- */
@media (max-width: 880px) {
  .hero-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .hero { padding: 56px 0 40px; }
  section { padding: 64px 0; }
  
  .rounded-profile-frame {
    width: 230px;
    height: 230px;
    margin-top: 20px;
  }
}