/* =========================================================
   Ahmad Umar Mahdi — Portfolio
   Modern dark theme
   ========================================================= */

:root {
  --bg: #0a0f1c;
  --bg-alt: #0e1526;
  --surface: #131c31;
  --surface-2: #1a2440;
  --border: #223052;
  --text: #dbe4f3;
  --text-muted: #8b98b5;
  --heading: #f2f6ff;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --gradient: linear-gradient(135deg, #38bdf8, #818cf8);
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --nav-h: 68px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
}

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}

.mono {
  font-family: "JetBrains Mono", monospace;
}

h1, h2, h3, h4 {
  color: var(--heading);
  line-height: 1.25;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.25s;
}

a:hover {
  color: #7dd3fc;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: min(1140px, 92%);
  margin-inline: auto;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  transition: transform 0.25s, box-shadow 0.25s, background 0.25s, color 0.25s;
}

.btn-sm {
  padding: 8px 18px;
  font-size: 14px;
}

.btn-primary {
  background: var(--gradient);
  color: #071120;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.35);
  color: #071120;
}

.btn-outline {
  border: 1.5px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent-soft);
  transform: translateY(-2px);
}

/* ---------- Navbar ---------- */
#navbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  z-index: 1000;
  background: rgba(10, 15, 28, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}

#navbar.scrolled {
  border-bottom-color: var(--border);
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 800;
  font-size: 22px;
  color: var(--heading);
  letter-spacing: 0.5px;
}

.brand-mark {
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
}

#nav-menu ul {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.nav-link {
  padding: 8px 14px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 15px;
  border-radius: 8px;
}

.nav-link:hover,
.nav-link.active {
  color: var(--heading);
  background: var(--accent-soft);
}

.nav-cv {
  margin-left: 10px;
}

.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--heading);
  font-size: 30px;
  cursor: pointer;
  line-height: 0;
}

/* ---------- Hero ---------- */
#hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding-top: var(--nav-h);
  background:
    radial-gradient(600px 400px at 85% 20%, rgba(129, 140, 248, 0.14), transparent 65%),
    radial-gradient(700px 500px at 10% 80%, rgba(56, 189, 248, 0.10), transparent 65%),
    var(--bg);
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  padding: 60px 0;
}

.hero-hello {
  color: var(--accent);
  font-size: 16px;
  margin-bottom: 14px;
}

#hero h1 {
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 10px;
}

#hero h2 {
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 22px;
}

#hero h2 .typed {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.typed-cursor {
  color: var(--accent);
}

.hero-sub {
  max-width: 560px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 32px;
}

.hero-social {
  display: flex;
  gap: 10px;
}

.hero-social a {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 20px;
  transition: all 0.25s;
}

.hero-social a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-3px);
}

.hero-photo {
  flex-shrink: 0;
}

.photo-ring {
  width: clamp(220px, 26vw, 320px);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 6px;
  background: var(--gradient);
  box-shadow: 0 0 60px rgba(56, 189, 248, 0.25);
}

.photo-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 6px solid var(--bg);
}

.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  font-size: 30px;
  color: var(--text-muted);
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* ---------- Sections ---------- */
.section {
  padding: 96px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  margin-bottom: 48px;
}

.section-kicker {
  color: var(--accent);
  font-size: 15px;
  display: block;
  margin-bottom: 6px;
}

.section-title h2 {
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 800;
  display: inline-block;
  position: relative;
  padding-bottom: 12px;
}

.section-title h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 56px;
  height: 4px;
  border-radius: 4px;
  background: var(--gradient);
}

.section-title p {
  color: var(--text-muted);
  margin-top: 14px;
  max-width: 640px;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 48px;
  align-items: start;
}

.about-text p {
  margin-bottom: 18px;
  color: var(--text-muted);
}

.about-text strong {
  color: var(--heading);
}

.about-facts {
  list-style: none;
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.about-facts li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.about-facts i {
  color: var(--accent);
  font-size: 20px;
}

.about-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.stat {
  text-align: center;
  padding: 14px 6px;
  border-radius: 10px;
  background: var(--surface-2);
}

.stat-num {
  display: block;
  font-size: 28px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  max-width: 760px;
  padding-left: 34px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 44px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -34px;
  top: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
}

.timeline-date {
  display: inline-block;
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.timeline-item h3 {
  font-size: 20px;
  font-weight: 700;
}

.timeline-item h4 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  margin: 4px 0 12px;
}

.timeline-item ul {
  list-style: none;
  display: grid;
  gap: 8px;
}

.timeline-item ul li {
  position: relative;
  padding-left: 22px;
  color: var(--text-muted);
}

.timeline-item ul li::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.timeline-item strong {
  color: var(--text);
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.skill-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform 0.25s, border-color 0.25s;
}

.skill-group:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.skill-group h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  margin-bottom: 16px;
}

.skill-group h3 i {
  color: var(--accent);
  font-size: 22px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  font-size: 13px;
  font-weight: 500;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.2s;
}

.chip:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.chip-hl {
  background: var(--accent-soft);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--accent);
}

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.project-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.project-qr {
  flex-shrink: 0;
  width: 84px;
  height: 84px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  padding: 4px;
  transition: transform 0.25s, box-shadow 0.25s;
}

.project-qr img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.project-card:hover .project-qr {
  transform: scale(1.35);
  border-radius: 8px;
  margin-right: 10px;
  margin-bottom: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.project-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 4px;
}

.project-head h3 {
  font-size: 19px;
  font-weight: 700;
}

.project-head h3 a {
  color: var(--heading);
}

.project-head h3 a:hover {
  color: var(--accent);
}

.project-card > p {
  color: var(--text-muted);
  font-size: 14.5px;
  flex-grow: 1;
}

.project-card .chip {
  font-size: 12px;
  padding: 4px 11px;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14.5px;
}

.project-link i {
  font-size: 18px;
}

.more-projects {
  margin-top: 56px;
}

.more-projects h3 {
  font-size: 22px;
  margin-bottom: 18px;
}

.more-projects ul {
  list-style: none;
  display: grid;
  gap: 12px;
}

.more-projects li {
  color: var(--text-muted);
}

.more-projects li a {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Education ---------- */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.edu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.25s, border-color 0.25s;
}

.edu-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.edu-icon {
  font-size: 34px;
  color: var(--accent);
  margin-bottom: 14px;
}

.edu-card h3 {
  font-size: 18px;
  margin-bottom: 6px;
}

.edu-card h4 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.edu-card p {
  font-size: 14.5px;
  color: var(--text-muted);
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 26px;
  text-align: center;
  color: var(--text);
  transition: transform 0.25s, border-color 0.25s;
}

.contact-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
}

.contact-card i {
  font-size: 34px;
  color: var(--accent);
  margin-bottom: 12px;
}

.contact-card h3 {
  font-size: 17px;
  margin-bottom: 6px;
}

.contact-card p {
  font-size: 14px;
  color: var(--text-muted);
  word-break: break-word;
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 36px 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

footer p {
  font-size: 13px;
  color: var(--text-muted);
}

footer .bx-heart {
  color: #f87171;
  vertical-align: middle;
}

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 999;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gradient);
  color: #071120;
  font-size: 26px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.35s;
}

.back-to-top.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  color: #071120;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.4);
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
  .hero-inner {
    flex-direction: column-reverse;
    text-align: center;
    justify-content: center;
    gap: 32px;
  }

  .hero-sub {
    margin-inline: auto;
  }

  .hero-actions,
  .hero-social {
    justify-content: center;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .mobile-nav-toggle {
    display: block;
  }

  #nav-menu {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: rgba(10, 15, 28, 0.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
  }

  body.nav-open #nav-menu {
    max-height: 420px;
  }

  #nav-menu ul {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 4px;
  }

  .nav-link {
    display: block;
    padding: 12px 16px;
  }

  .nav-cv {
    margin: 10px 16px 0;
    justify-content: center;
  }

  .section {
    padding: 72px 0;
  }
}
