:root {
  --bg: #0b1220;
  --bg2: #0e1730;
  --surface: #14233a;
  --surface-2: #19294a;
  --blue: #3da9fc;
  --cyan: #5bd3ff;
  --orange: #ffaa00;
  --text: #f0f4fa;
  --muted: #9fb0c4;
  --line: #26385a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Vazirmatn", system-ui, sans-serif;
  background: radial-gradient(1200px 700px at 70% -10%, rgba(61, 169, 252, 0.1), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
.skip-link {
  position: fixed; top: -100px; right: 16px; background: var(--blue);
  color: #06223a; padding: 10px 16px; border-radius: 10px; z-index: 200;
  transition: top 0.2s;
}
.skip-link:focus { top: 16px; }

/* preloader */
.preloader {
  position: fixed; inset: 0; z-index: 300; display: flex;
  align-items: center; justify-content: center; background: var(--bg);
  transition: opacity 0.5s ease, visibility 0.5s;
}
.preloader-inner { text-align: center; color: var(--muted); }
.preloader-logo {
  width: 96px; height: 96px; margin: 0 auto 14px;
  filter: drop-shadow(0 0 20px rgba(61, 169, 252, 0.4));
  animation: floaty 2s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.preloader--hide { opacity: 0; visibility: hidden; }
body.preloader-active { overflow: hidden; }

/* background rotating disc */
.bg-disc {
  position: fixed; top: 50%; left: 50%; width: 120vmin; height: 120vmin;
  transform: translate(-50%, calc(-50% + var(--py, 0px))) rotate(var(--r, 0deg)) scale(var(--sc, 1));
  opacity: 0.06; filter: blur(1px); pointer-events: none; z-index: 0; will-change: transform;
}
.bg-disc img { width: 100%; height: 100%; object-fit: contain; }

/* nav pill */
.nav-wrap {
  position: fixed; top: 0; left: 0; right: 0; display: flex;
  justify-content: center; z-index: 100; padding: 16px;
}
.pill {
  display: flex; align-items: center; gap: 18px;
  background: rgba(20, 35, 58, 0.55);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 999px; padding: 10px 20px;
  transition: padding 0.3s, background 0.3s, box-shadow 0.3s;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  position: relative;
}

/* Sliding active indicator */
.nav-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 38px;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(61,169,252,0.18), rgba(91,211,255,0.10));
  border: 1px solid rgba(61,169,252,0.35);
  box-shadow: 0 0 12px rgba(61,169,252,0.15);
  pointer-events: none;
  z-index: 0;
  /* smooth slide between targets */
  transition: left 0.38s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.38s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease;
  opacity: 0;
}
.nav-indicator.is-ready { opacity: 1; }
.pill.scrolled { padding: 6px 16px; background: rgba(12, 18, 32, 0.82); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55); }
.brand {
  width: 38px; height: 38px; border-radius: 50%; overflow: hidden;
  flex: 0 0 auto; box-shadow: 0 0 14px rgba(91, 211, 255, 0.35);
  position: relative; z-index: 1;
}
.brand img { width: 100%; height: 100%; object-fit: contain; }
.nav-links { display: flex; gap: 6px; }
.nav-links {
  position: relative; z-index: 1;
}
.nav-links a {
  padding: 8px 14px; border-radius: 999px; color: var(--muted);
  font-size: 14px; font-weight: 500; min-height: 40px; display: flex;
  align-items: center; transition: color 0.25s;
  position: relative; z-index: 1;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: #fff; }
.menu-btn {
  display: none; background: none; border: 0; color: var(--text);
  font-size: 22px; cursor: pointer; min-width: 44px; min-height: 44px; border-radius: 10px;
}

/* sections */
.section { position: relative; z-index: 1; padding: 110px 24px; max-width: 1080px; margin: 0 auto; scroll-margin-top: 100px; }
.section-title { font-size: clamp(22px, 3.4vw, 34px); font-weight: 700; margin-bottom: 26px; }
.section-title .bar { display: block; width: 54px; height: 4px; border-radius: 4px; margin-top: 10px; background: linear-gradient(90deg, var(--orange), var(--blue)); }
.lead { color: var(--muted); margin-bottom: 28px; max-width: 62ch; }

/* hero */
.hero {
  min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 0.9fr;
  align-items: center; gap: 40px; padding-top: 150px;
}
.hero-eyebrow {
  display: inline-block; color: var(--cyan); font-weight: 600; letter-spacing: 0.5px;
  border: 1px solid rgba(91, 211, 255, 0.27); padding: 4px 12px; border-radius: 999px;
  font-size: 13px; margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 52px); font-weight: 800; line-height: 1.25;
  background: linear-gradient(90deg, #fff, #bfe4ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .subtitle { color: var(--muted); font-size: clamp(15px, 2vw, 18px); margin: 18px 0 28px; max-width: 48ch; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.btn {
  min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 22px; border-radius: 12px; font-weight: 600; font-size: 15px;
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s, color 0.2s;
  cursor: pointer; border: 1px solid transparent; font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.cta-button { background: linear-gradient(120deg, var(--blue), #7cd0ff); color: #06223a; box-shadow: 0 8px 24px rgba(61, 169, 252, 0.33); }
.cta-button:hover { box-shadow: 0 10px 30px rgba(61, 169, 252, 0.47); }
.secondary-button { border-color: var(--line); color: var(--text); }
.secondary-button:hover { border-color: var(--cyan); color: var(--cyan); }
.social-links { display: flex; gap: 16px; align-items: center; }
.social-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; min-height: 40px; }
.social-links a:hover { color: var(--cyan); }
.social-links img { width: 18px; height: 18px; filter: brightness(0) invert(0.8); transition: filter 0.2s; }
.social-links a:hover img { filter: brightness(0) saturate(100%) invert(70%) sepia(60%) saturate(900%) hue-rotate(170deg); }

/* hero visual stage */
.hero-visual { position: relative; display: flex; align-items: center; justify-content: center; }
.stage { position: relative; width: min(360px, 80vw); aspect-ratio: 1; }
.hero-logo-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  clip-path: circle(49% at 50% 50%);
  filter: drop-shadow(0 0 22px rgba(47, 182, 255, 0.33));
  opacity: 0; transform: scale(0.96); animation: logoIn 1s ease 0.1s forwards;
}
.hero-logo-video img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
@keyframes logoIn { to { opacity: 1; transform: scale(1); } }
.stage::after {
  content: ""; position: absolute; inset: -4%; border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 211, 255, 0.13), transparent 62%);
  z-index: -1; animation: pulse 4s ease-in-out 1.6s infinite;
}
@keyframes pulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }
.hero-visual-card {
  position: absolute; bottom: -8px; inset-inline: 0; margin: 0 auto; max-width: 280px;
  background: rgba(11, 18, 32, 0.85); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 18px; display: flex; justify-content: space-between; gap: 10px;
  font-size: 0.92rem; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}
.hero-visual-card span:first-child { color: var(--blue); font-weight: 600; }

/* skills */
.skills-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.skill-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 16px; font-weight: 500; transition: transform 0.2s, border-color 0.2s;
}
.skill-item:hover { transform: translateY(-4px); border-color: var(--cyan); }

/* about */
.about-layout { display: grid; gap: 20px; grid-template-columns: 1.4fr 0.6fr; align-items: start; }
.about-text { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: grid; gap: 14px; color: var(--muted); }
.about-highlights { display: grid; gap: 12px; }
.about-highlights li { padding-inline-start: 24px; position: relative; color: var(--muted); }
.about-highlights li::before { content: "\25C6"; position: absolute; inset-inline-start: 0; color: var(--cyan); }

/* projects */
.projects-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.project-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  display: flex; flex-direction: column;
}
.project-card:hover { transform: translateY(-6px); border-color: var(--cyan); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
.project-image-container { height: 180px; overflow: hidden; background: linear-gradient(135deg, #16263f, #0e1a2e); }
.project-image { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.project-card:hover .project-image { transform: scale(1.05); }
.project-content { padding: 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.project-meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); }
.project-status { color: var(--cyan); }
.project-title { font-size: 19px; }
.project-desc { color: var(--muted); font-size: 14px; flex: 1; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.tags li { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: rgba(91, 211, 255, 0.09); color: var(--cyan); }
.project-links { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.project-link { min-height: 42px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 10px; font-size: 14px; font-weight: 500; transition: 0.2s; }
.project-link-demo { background: linear-gradient(120deg, var(--blue), #7cd0ff); color: #06223a; }
.project-link-demo:hover { box-shadow: 0 8px 20px rgba(61, 169, 252, 0.4); }
.project-link-code { border: 1px solid var(--line); color: var(--text); }
.project-link-code:hover { border-color: var(--cyan); color: var(--cyan); }

/* contact */
.contact-links { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0 28px; }
.contact-btn {
  min-height: 48px; display: inline-flex; align-items: center; gap: 8px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line); color: var(--text); font-weight: 500;
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
}
.contact-btn:hover { border-color: var(--cyan); color: var(--cyan); transform: translateY(-2px); }
.contact-btn img { width: 18px; height: 18px; filter: brightness(0) invert(0.85); }
.contact-btn:hover img { filter: brightness(0) saturate(100%) invert(70%) sepia(60%) saturate(900%) hue-rotate(170deg); }
.contact-form { display: grid; gap: 14px; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.contact-form input, .contact-form textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 16px; color: var(--text); font-family: inherit; font-size: 15px; transition: border-color 0.2s;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--cyan); }
.contact-form textarea { min-height: 130px; resize: vertical; }
.form-status { opacity: 0; transition: opacity 0.3s; color: var(--cyan); font-size: 14px; min-height: 20px; }
.form-status.is-visible { opacity: 1; }

/* footer */
.footer { text-align: center; padding: 40px; color: var(--muted); position: relative; z-index: 1; border-top: 1px solid var(--line); }

/* reveal on scroll */
[data-animate] { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
[data-animate].in { opacity: 1; transform: none; }
[data-animate="slide-left"] { transform: translateX(30px); }
[data-animate="slide-left"].in { transform: none; }

/* responsive */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; text-align: center; gap: 28px; }
  .hero-cta, .social-links { justify-content: center; }
  .hero-eyebrow { margin-inline: auto; }
  .about-layout { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .pill.open .nav-links {
    display: flex; position: absolute; top: 64px; inset-inline: 16px;
    flex-direction: column; background: rgba(12, 18, 32, 0.97);
    border: 1px solid var(--line); border-radius: 16px; padding: 10px;
  }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-logo-video { animation: none; opacity: 1; transform: none; }
  .stage::after, .preloader-logo { animation: none; }
  [data-animate] { opacity: 1; transform: none; transition: none; }
  .bg-disc { transform: translate(-50%, -50%); }
}
