/* =========================================================
   Ali Arshad Sadal — Portfolio
   Dark, code-inspired theme with cyan/purple gradient accents
   ========================================================= */

:root {
  --bg: #090b12;
  --bg-alt: #0f1320;
  --card: #131728;
  --card-hover: #171c31;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e7e9f3;
  --muted: #9aa3b8;
  --primary: #22d3ee;
  --secondary: #a855f7;
  --gradient: linear-gradient(135deg, #22d3ee 0%, #6366f1 55%, #a855f7 100%);
  --gradient-soft: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(168, 85, 247, 0.15));
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  --maxw: 1160px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 15% 0%, rgba(34, 211, 238, 0.14), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(168, 85, 247, 0.16), transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(99, 102, 241, 0.12), transparent 50%);
}

h1, h2, h3, h4 {
  font-family: "Space Grotesk", "Inter", sans-serif;
  margin: 0 0 0.5em 0;
  line-height: 1.2;
  color: #fff;
}

p {
  margin: 0 0 1em 0;
  color: var(--muted);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

img {
  max-width: 100%;
  display: block;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.mono {
  font-family: "Fira Code", monospace;
}

/* -------------------- Header / Nav -------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

/* separate layer so backdrop-filter doesn't create a containing block for the fixed mobile nav */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(9, 11, 18, 0.75);
  backdrop-filter: blur(14px);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.logo {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 2px;
}

.logo span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.navbar {
  display: flex;
  align-items: center;
  gap: 32px;
}

.navbar ul {
  display: flex;
  gap: 28px;
}

.navbar ul li a {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  padding: 6px 0;
}

.navbar ul li a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--gradient);
  transition: width 0.25s ease;
}

.navbar ul li a:hover,
.navbar ul li a.active {
  color: #fff;
}

.navbar ul li a:hover::after,
.navbar ul li a.active::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 200;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* -------------------- Buttons -------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient);
  color: #050609;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(99, 102, 241, 0.5);
  color: #050609;
}

.btn-outline {
  border-color: var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

.btn-small {
  padding: 9px 20px;
  font-size: 0.85rem;
}

/* -------------------- Hero -------------------- */

.hero {
  padding: 90px 0 60px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
}

.eyebrow {
  font-family: "Fira Code", monospace;
  color: var(--primary);
  font-size: 0.95rem;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.hero-text h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  margin-bottom: 6px;
}

.typewriter {
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  min-height: 1.5em;
  color: var(--secondary);
  font-family: "Fira Code", monospace;
  font-weight: 500;
  margin-bottom: 18px;
}

.typewriter .cursor {
  display: inline-block;
  width: 2px;
  background: var(--secondary);
  margin-left: 3px;
  animation: blink 0.9s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.lead {
  font-size: 1.05rem;
  max-width: 560px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 26px 0;
}

.hero-meta {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.socials {
  display: flex;
  gap: 14px;
}

.socials a {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: all 0.25s ease;
}

.socials a:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(34, 211, 238, 0.25);
}

.socials svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Hero visual */

.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.orbit {
  position: relative;
  width: min(340px, 80vw);
  height: min(340px, 80vw);
  border-radius: 50%;
  background: var(--gradient);
  padding: 4px;
  animation: spin 14s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.orbit::before {
  content: "";
  position: absolute;
  inset: -14px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 50%;
}

.hero-photo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-alt);
  animation: spin-back 14s linear infinite;
  border: 5px solid var(--bg);
}

@keyframes spin-back {
  to { transform: rotate(-360deg); }
}

.floating-tags {
  position: absolute;
  inset: 0;
}

.floating-tags span {
  position: absolute;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: "Fira Code", monospace;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  animation: float 6s ease-in-out infinite;
}

.floating-tags span:nth-child(1) { top: 0%; left: -6%; animation-delay: 0s; }
.floating-tags span:nth-child(2) { top: 18%; right: -10%; animation-delay: 0.8s; }
.floating-tags span:nth-child(3) { bottom: 30%; left: -14%; animation-delay: 1.6s; }
.floating-tags span:nth-child(4) { bottom: 4%; right: -4%; animation-delay: 2.4s; }
.floating-tags span:nth-child(5) { top: 46%; left: -18%; animation-delay: 3.2s; }
.floating-tags span:nth-child(6) { top: 55%; right: -14%; animation-delay: 4s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* -------------------- Sections -------------------- */

section {
  padding: 70px 0;
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 48px;
}

.section-head .eyebrow {
  justify-content: center;
  display: flex;
}

.section-head h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
}

/* stat strip */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 36px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat {
  text-align: center;
}

.stat strong {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 2.1rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat span {
  color: var(--muted);
  font-size: 0.85rem;
}

/* cards grid generic */

.grid {
  display: grid;
  gap: 24px;
}

.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.15s ease-out, border-color 0.25s ease, background 0.25s ease;
  will-change: transform;
}

.card:hover {
  transform: translateY(-6px);
  border-color: rgba(34, 211, 238, 0.35);
  background: var(--card-hover);
}

.card .icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--gradient-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
}

.card h3 {
  font-size: 1.15rem;
}

.card p {
  font-size: 0.92rem;
  margin-bottom: 0;
}

/* pill tags */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  font-family: "Fira Code", monospace;
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--primary);
  background: rgba(34, 211, 238, 0.06);
}

/* about summary */

.about-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 48px;
  align-items: start;
}

.about-photo-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  padding: 10px;
}

.about-photo-wrap img {
  border-radius: 12px;
}

.info-list {
  margin-top: 22px;
  display: grid;
  gap: 12px;
}

.info-list li {
  display: flex;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--muted);
}

.info-list li b {
  color: var(--text);
  min-width: 90px;
  display: inline-block;
}

/* -------------------- Timeline (Experience/Education) -------------------- */

.timeline {
  position: relative;
  margin-top: 10px;
  padding-left: 32px;
  border-left: 2px solid var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 44px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -41px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.15);
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.timeline-head h3 {
  font-size: 1.2rem;
  margin: 0;
}

.timeline-role {
  color: var(--secondary);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.timeline-date {
  font-family: "Fira Code", monospace;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

.timeline-place {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.timeline ul.bullets {
  display: grid;
  gap: 8px;
}

.timeline ul.bullets li {
  position: relative;
  padding-left: 18px;
  font-size: 0.92rem;
  color: var(--muted);
}

.timeline ul.bullets li::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--primary);
}

.timeline-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
}

/* -------------------- Skills page -------------------- */

.skill-category {
  margin-bottom: 20px;
}

.skill-category h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  margin-bottom: 14px;
}

.cert-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.cert-card .icon {
  flex-shrink: 0;
}

.cert-meta {
  font-family: "Fira Code", monospace;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 8px;
  display: block;
}

/* -------------------- Contact / CTA -------------------- */

.cta {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 56px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient-soft);
  opacity: 0.5;
  z-index: 0;
}

.cta > * {
  position: relative;
  z-index: 1;
}

.cta h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.cta-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* -------------------- Footer -------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 34px 0;
  margin-top: 40px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-inner p {
  margin: 0;
  font-size: 0.85rem;
}

.footer-social {
  display: flex;
  gap: 14px;
}

.footer-social a {
  color: var(--muted);
}

.footer-social a:hover {
  color: var(--primary);
}

/* -------------------- Reveal animation -------------------- */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* -------------------- Page hero (inner pages) -------------------- */

.page-hero {
  padding: 60px 0 20px;
  text-align: center;
}

.page-hero .eyebrow {
  justify-content: center;
  display: flex;
}

.page-hero h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
}

/* -------------------- Scroll progress bar -------------------- */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--gradient);
  z-index: 999;
  transition: width 0.1s ease-out;
}

/* -------------------- Copy email chip -------------------- */

.copy-chip {
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

.copy-chip.copied {
  border-color: var(--secondary);
  color: var(--secondary);
}

/* -------------------- Project filter bar -------------------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 32px;
}

.filter-btn {
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--gradient);
  border-color: transparent;
  color: #050609;
  font-weight: 600;
}

.card[data-category] {
  animation: fade-in 0.35s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* -------------------- Back to top -------------------- */

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--gradient);
  color: #050609;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 90;
  font-size: 1.1rem;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 980px) {
  .about-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); row-gap: 26px; }
}

@media (max-width: 860px) {
  .nav-toggle { display: flex; }

  .navbar {
    position: fixed;
    inset: 0;
    background: rgba(9, 11, 18, 0.98);
    backdrop-filter: blur(14px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 34px;
    padding: 40px;
    transform: translateX(100%);
    transition: transform 0.35s ease;
  }

  .navbar.open {
    transform: translateX(0);
  }

  .navbar ul {
    flex-direction: column;
    gap: 22px;
  }

  .navbar ul li a {
    font-size: 1.2rem;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-text .lead { margin-inline: auto; }
  .hero-actions, .hero-meta { justify-content: center; }
  .socials { justify-content: center; }
  .floating-tags { display: none; }
}

@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  section { padding: 50px 0; }
  .timeline { padding-left: 22px; }
  .timeline-item::before { left: -31px; }
  .cta { padding: 40px 22px; }
  .footer-inner { flex-direction: column; text-align: center; }
}
