/* =========================================================
   Sajid Ahsan — Portfolio Stylesheet
   Theme: Black (#000000) + Dark Green (#135C3A)
   ========================================================= */

:root {
  --black: #000000;
  --black-soft: #0a0a0a;
  --surface: #101512;
  --surface-alt: #0d1210;
  --border: #1f2a24;

  --green: #135C3A;
  --green-light: #1E8A57;
  --green-lighter: #2FBE7A;
  --green-dim: rgba(19, 92, 58, 0.35);

  --text: #f2f5f3;
  --text-muted: #a8b3ae;
  --text-dim: #6f7d76;

  --font-main: 'Poppins', sans-serif;
  --font-mono: 'Fira Code', monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --transition: 0.35s cubic-bezier(0.65, 0, 0.35, 1);
  --shadow-green: 0 10px 40px -10px rgba(19, 92, 58, 0.55);
}

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--black);
  color: var(--text);
  font-family: var(--font-main);
  line-height: 1.65;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

::selection { background: var(--green); color: #fff; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--green); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--green-light); }

/* ===== Preloader ===== */
#preloader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--black);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
#preloader.hidden { opacity: 0; visibility: hidden; }
.loader-ring {
  width: 56px; height: 56px;
  border: 3px solid var(--border);
  border-top-color: var(--green-lighter);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Scroll progress bar ===== */
.progress-bar {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--green), var(--green-lighter));
  z-index: 1001;
  transition: width 0.1s linear;
}

/* ===== Reveal on scroll ===== */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
[data-reveal].in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Navbar ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 20px 0;
  transition: var(--transition);
  background: transparent;
}
.navbar.scrolled {
  padding: 12px 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
}
.logo {
  font-size: 1.5rem; font-weight: 700; letter-spacing: 1px;
  color: var(--text);
}
.logo .dot { color: var(--green-lighter); }

.nav-links {
  display: flex; align-items: center; gap: 8px;
}
.nav-link {
  position: relative;
  padding: 8px 16px;
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 20px;
  transition: var(--transition);
}
.nav-link:hover { color: var(--text); }
.nav-link.active-link {
  color: #fff;
  background: var(--green);
}

.theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: var(--transition);
  margin-left: 10px;
}
.theme-toggle:hover { color: var(--green-lighter); border-color: var(--green); }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 30px;
  z-index: 1002;
}
.hamburger span {
  height: 2px; width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 30px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition);
  border: 2px solid transparent;
}
.btn-primary {
  background: var(--green);
  color: #fff;
  box-shadow: var(--shadow-green);
}
.btn-primary:hover {
  background: var(--green-light);
  transform: translateY(-3px);
  box-shadow: 0 14px 30px -8px rgba(19, 92, 58, 0.8);
}
.btn-outline {
  border-color: var(--green);
  color: var(--text);
}
.btn-outline:hover {
  background: var(--green-dim);
  transform: translateY(-3px);
}
.btn-block { width: 100%; }

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex; align-items: center;
  padding-top: 100px;
  overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; z-index: 0; }
#particles { position: absolute; inset: 0; width: 100%; height: 100%; }
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
}
.blob-1 {
  width: 500px; height: 500px;
  background: var(--green);
  top: -100px; right: -150px;
}
.blob-2 {
  width: 400px; height: 400px;
  background: #0a3c26;
  bottom: -150px; left: -120px;
}

.hero-inner {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 40px;
}

.eyebrow {
  color: var(--green-lighter);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}
.hero-name {
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 10px;
  background: linear-gradient(120deg, #fff 40%, var(--green-lighter));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-role {
  font-size: clamp(1.2rem, 2.6vw, 1.7rem);
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 22px;
  font-family: var(--font-mono);
  min-height: 1.6em;
}
.cursor {
  color: var(--green-lighter);
  animation: blink 0.9s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-desc {
  max-width: 560px;
  color: var(--text-muted);
  margin-bottom: 34px;
  font-size: 1.02rem;
}

.hero-btns {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 32px;
}

.hero-socials { display: flex; gap: 14px; }
.social-icon {
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: var(--transition);
}
.social-icon:hover {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
  transform: translateY(-4px);
}

.hero-photo {
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.photo-ring {
  position: relative;
  width: min(360px, 78vw);
  aspect-ratio: 1/1;
  border-radius: 50%;
  padding: 10px;
  background: conic-gradient(from 0deg, var(--green), var(--green-lighter), var(--green));
  animation: rotateRing 8s linear infinite;
}
@keyframes rotateRing { to { transform: rotate(360deg); } }
.profile-img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 6px solid var(--black);
  animation: rotateRing 8s linear infinite reverse;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
  pointer-events: none;
}
.photo-shield {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  z-index: 2;
  background: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

.badge {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  animation: floatY 4s ease-in-out infinite;
}
.badge-1 { top: 6%; left: -8%; animation-delay: 0s; }
.badge-2 { bottom: 12%; right: -10%; animation-delay: 1.2s; }
.badge-3 { top: 46%; right: -16%; animation-delay: 2.4s; }
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

.scroll-down {
  position: absolute;
  bottom: 34px; left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 42px;
  border: 2px solid var(--border);
  border-radius: 20px;
  z-index: 1;
}
.scroll-down span {
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 8px;
  background: var(--green-lighter);
  border-radius: 3px;
  animation: scrollDot 1.6s ease infinite;
}
@keyframes scrollDot {
  0% { top: 8px; opacity: 1; }
  70% { opacity: 1; }
  100% { top: 22px; opacity: 0; }
}

/* ===== Sections ===== */
.section { padding: 120px 0; position: relative; }
.section-alt { background: var(--black-soft); }

.section-tag {
  color: var(--green-lighter);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.section-title {
  text-align: center;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 700;
  margin-bottom: 60px;
  position: relative;
}
.section-title::after {
  content: '';
  display: block;
  width: 70px; height: 4px;
  background: linear-gradient(90deg, var(--green), var(--green-lighter));
  margin: 18px auto 0;
  border-radius: 4px;
}

/* ===== About ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 50px;
  align-items: start;
}
.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
}
.about-card p { color: var(--text-muted); margin-bottom: 16px; }
.about-card p:last-child { margin-bottom: 0; }
.about-card strong { color: var(--green-lighter); font-weight: 600; }

.info-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 24px;
}
.info-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.info-item:last-child { border-bottom: none; }
.info-label { color: var(--text-dim); font-size: 0.9rem; }
.info-value { color: var(--text); font-weight: 500; text-align: right; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.stat-card {
  background: var(--green-dim);
  border: 1px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 20px 10px;
  text-align: center;
}
.stat-num {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--green-lighter);
  font-family: var(--font-mono);
}
.stat-label { font-size: 0.78rem; color: var(--text-muted); }

/* ===== Skills ===== */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
}
.skill-card h3 {
  margin-bottom: 22px;
  font-size: 1.15rem;
  color: var(--text);
}
.skill-card h3.mt { margin-top: 30px; }

.bar-skill { margin-bottom: 20px; }
.bar-skill:last-child { margin-bottom: 0; }
.bar-top {
  display: flex; justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--text-muted);
}
.bar-track {
  height: 8px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--green), var(--green-lighter));
  transition: width 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.tag {
  padding: 9px 18px;
  border-radius: 50px;
  background: var(--green-dim);
  border: 1px solid var(--green);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 500;
  transition: var(--transition);
}
.tag:hover { background: var(--green); transform: translateY(-3px); }
.tag-alt {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.tag-alt:hover { border-color: var(--green); color: var(--text); background: var(--green-dim); }

/* ===== Projects ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 34px;
  max-width: 800px;
  margin: 0 auto;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  transition: var(--transition);
}
.project-card:hover { border-color: var(--green); transform: translateY(-4px); }
.project-card h3 {
  margin-bottom: 14px;
  font-size: 1.15rem;
  color: var(--text);
}
.project-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 20px;
}

/* ===== Timeline (Experience + Education) ===== */
.timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding-left: 34px;
  border-left: 2px solid var(--border);
}
.timeline-item {
  position: relative;
  padding-bottom: 48px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -42px; top: 4px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--black);
  border: 3px solid var(--green-lighter);
  box-shadow: 0 0 0 5px var(--green-dim);
}
.timeline-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 30px;
  transition: var(--transition);
}
.timeline-content:hover {
  border-color: var(--green);
  transform: translateX(6px);
}
.timeline-date {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--green-lighter);
  margin-bottom: 10px;
}
.timeline-content h3 { font-size: 1.15rem; margin-bottom: 4px; }
.timeline-content h4 {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.timeline-content p { color: var(--text-muted); font-size: 0.94rem; }

/* ===== Contact ===== */
.contact-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 50px;
}
.contact-lead { color: var(--text-muted); margin-bottom: 30px; }

.contact-item {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 22px;
}
.contact-icon {
  flex-shrink: 0;
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--green-dim);
  border: 1px solid var(--green);
  color: var(--green-lighter);
}
.contact-label { display: block; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 2px; }
.contact-item a { color: var(--text); font-weight: 500; transition: var(--transition); }
.contact-item a:hover { color: var(--green-lighter); }
.contact-item span:not(.contact-label) { color: var(--text); font-weight: 500; }

.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group {
  position: relative;
  margin-bottom: 22px;
}
.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--black-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 14px 8px;
  color: var(--text);
  font-size: 0.95rem;
  resize: vertical;
  transition: var(--transition);
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--green-lighter);
  box-shadow: 0 0 0 3px var(--green-dim);
}
.form-group label {
  position: absolute;
  left: 14px; top: 15px;
  color: var(--text-dim);
  font-size: 0.95rem;
  pointer-events: none;
  transition: var(--transition);
}
.form-group input:focus + label,
.form-group input:valid + label,
.form-group textarea:focus + label,
.form-group textarea:valid + label {
  top: 4px;
  font-size: 0.72rem;
  color: var(--green-lighter);
}
.form-status {
  margin-top: 14px;
  font-size: 0.88rem;
  color: var(--green-lighter);
  min-height: 1.2em;
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 34px 0;
  background: var(--black-soft);
}
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.footer p { color: var(--text-dim); font-size: 0.88rem; }
.footer-socials { display: flex; gap: 12px; }

/* ===== Back to top ===== */
.back-to-top {
  position: fixed;
  bottom: 30px; right: 30px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-green);
  opacity: 0; visibility: hidden;
  transform: translateY(20px);
  transition: var(--transition);
  z-index: 900;
}
.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--green-light); }

/* Light contrast theme (toggle) */
body.light-mode {
  --black: #f5f7f6;
  --black-soft: #eef2f0;
  --surface: #ffffff;
  --surface-alt: #f0f4f2;
  --border: #dde5e1;
  --text: #0c1210;
  --text-muted: #47554e;
  --text-dim: #78877f;
}
body.light-mode .hero-name {
  background: linear-gradient(120deg, #0c1210 40%, var(--green));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
body.light-mode .navbar.scrolled { background: rgba(245, 247, 246, 0.9); }
body.light-mode .badge,
body.light-mode .timeline-content,
body.light-mode .about-card,
body.light-mode .info-list,
body.light-mode .skill-card,
body.light-mode .project-card,
body.light-mode .contact-form { box-shadow: 0 6px 20px rgba(0,0,0,0.06); }

/* ===== Responsive ===== */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-desc { margin-left: auto; margin-right: auto; }
  .hero-btns, .hero-socials { justify-content: center; }
  .hero-photo { order: -1; margin-bottom: 20px; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .badge-1 { left: 0; }
  .badge-3 { right: 0; }
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 0; right: -100%;
    height: 100vh;
    width: min(320px, 80vw);
    background: var(--black-soft);
    border-left: 1px solid var(--border);
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    transition: right 0.4s ease;
  }
  .nav-links.open { right: 0; }
  .nav-link { width: 100%; text-align: center; padding: 14px; }
  .hamburger { display: flex; }
  .form-row { grid-template-columns: 1fr; }
  .section { padding: 90px 0; }
  .timeline { padding-left: 26px; }
  .timeline-dot { left: -34px; }
}

@media (max-width: 480px) {
  .hero-btns { flex-direction: column; width: 100%; }
  .hero-btns .btn { width: 100%; }
  .badge { font-size: 0.72rem; padding: 8px 12px; }
  .stat-cards { grid-template-columns: repeat(3, 1fr); gap: 8px; }
   .about-card, .skill-card, .project-card, .contact-form, .info-list { padding: 24px; }
}
