/* =========================================
   CSS/style.css — themahdi.ir
   Premium Dark Theme | Vazirmatn
   ========================================= */

/* ---------- RESET & BASE ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: 'Vazirmatn', sans-serif;
  background-color: #050505;
  color: #ffffff;
  line-height: 1.7;
  direction: rtl;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
}

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

/* ---------- VARIABLES ---------- */
:root {
  --bg: #050505;
  --primary: #6366F1;
  --primary-dim: rgba(99, 102, 241, 0.15);
  --secondary: #06B6D4;
  --text: #ffffff;
  --muted: #A1A1AA;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.06);
  --radius: 20px;
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

/* ---------- LOADER ---------- */
.loader {
  position: fixed;
  inset: 0;
  background: #050505;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}
.loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid var(--glass);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 60px;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  background: transparent;
  color: #fff;
  text-align: center;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.45);
  background: #7c7ff7;
}
.btn-secondary {
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}
.btn-outline {
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(4px);
  padding: 8px 20px;
  font-size: 0.85rem;
}
.btn-outline:hover {
  background: var(--primary);
  border-color: var(--primary);
}

/* ---------- SECTION TITLES ---------- */
.section-title {
  font-size: 2.4rem;
  font-weight: 700;
  margin-bottom: 2.5rem;
  background: linear-gradient(135deg, #fff 30%, var(--muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

/* ---------- NAVBAR ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 16px 0;
  transition: all 0.4s ease;
  background: transparent;
}
.navbar.scrolled {
  background: rgba(5, 5, 5, 0.78);
  backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid var(--glass-border);
  padding: 10px 0;
}
.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-menu {
  display: flex;
  gap: 28px;
  align-items: center;
}
.nav-menu a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.3s ease;
  position: relative;
}
.nav-menu a:hover {
  color: #fff;
}
.nav-menu a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  right: 0;
  width: 0%;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s ease;
}
.nav-menu a:hover::after {
  width: 100%;
}
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  padding: 4px;
}
.nav-hamburger span {
  display: block;
  width: 28px;
  height: 2.5px;
  background: #fff;
  border-radius: 4px;
  transition: all 0.3s ease;
}
.nav-hamburger.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.nav-hamburger.active span:nth-child(2) {
  opacity: 0;
}
.nav-hamburger.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ---------- HERO ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 0 60px;
  position: relative;
  overflow: hidden;
}
.hero-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}
.hero-title {
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #fff 30%, var(--muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-desc {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 520px;
  margin-bottom: 36px;
  line-height: 1.9;
}
.hero-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* Hero Visual */
.hero-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.code-editor {
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.code-bar {
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
}
.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot.red { background: #ff5f57; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #28c840; }
.code-body {
  padding: 20px 24px;
  font-family: 'Menlo', 'Monaco', monospace;
  font-size: 0.9rem;
  color: #d4d4d4;
  direction: ltr;
  text-align: left;
  line-height: 2;
}
.code-body .line { display: block; }
.code-body .key { color: #c586c0; }
.code-body .string { color: #ce9178; }

.floating-cards {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.float-card {
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  padding: 10px 24px;
  border-radius: 60px;
  font-weight: 500;
  font-size: 0.95rem;
  animation: floatY 4s ease-in-out infinite;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.float-card:nth-child(2) { animation-delay: 0.6s; }
.float-card:nth-child(3) { animation-delay: 1.2s; }

/* ---------- ABOUT ---------- */
.about {
  padding: 80px 0;
}
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
}
.about-text p {
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 2;
}
.timeline {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.timeline-item {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--glass);
  padding: 14px 24px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(4px);
  transition: all 0.3s ease;
}
.timeline-item:hover {
  background: var(--primary-dim);
  border-color: var(--primary);
}
.timeline-item .year {
  font-weight: 700;
  color: var(--primary);
  min-width: 70px;
}
.timeline-item .desc {
  color: #fff;
  font-weight: 500;
}

/* ---------- SKILLS ---------- */
.skills {
  padding: 80px 0;
}
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.skill-card {
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  transition: all 0.35s ease;
  cursor: default;
}
.skill-card:hover {
  transform: translateY(-8px);
  background: var(--primary-dim);
  border-color: var(--primary);
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.15);
}
.skill-icon {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 12px;
}
.skill-card h3 {
  font-size: 1.15rem;
  margin-bottom: 6px;
}
.skill-card p {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- STATS ---------- */
.stats {
  padding: 60px 0;
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  text-align: center;
}
.stat-number {
  font-size: 3.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
  line-height: 1.2;
}
.stat-label {
  color: var(--muted);
  font-size: 1rem;
  margin-top: 4px;
  display: block;
}

/* ---------- PROJECTS ---------- */
.projects {
  padding: 80px 0;
}
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}
.project-card {
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: all 0.35s ease;
}
.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary);
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.project-img {
  font-size: 3rem;
  margin-bottom: 16px;
}
.project-card h3 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}
.project-card p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
}
.tech-badge {
  display: inline-block;
  background: var(--primary-dim);
  color: var(--primary);
  padding: 4px 14px;
  border-radius: 40px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 6px;
  margin-bottom: 6px;
}
.project-card .btn {
  margin-top: 14px;
}

/* ---------- BLOG ---------- */
.blog {
  padding: 80px 0;
}
.blog-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.blog-card {
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.3s ease;
}
.blog-card:hover {
  transform: translateY(-4px);
  border-color: var(--secondary);
}
.blog-img {
  font-size: 2.4rem;
  margin-bottom: 12px;
}
.blog-cat {
  display: inline-block;
  background: var(--primary-dim);
  color: var(--primary);
  padding: 2px 14px;
  border-radius: 30px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.blog-card h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}
.blog-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- VIDEO ---------- */
.video {
  padding: 80px 0;
}
.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}
.video-card {
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.3s ease;
  text-align: center;
}
.video-card:hover {
  transform: scale(1.02);
  border-color: var(--secondary);
}
.video-thumb {
  font-size: 3.6rem;
  margin-bottom: 12px;
}
.video-card h3 {
  font-size: 1.1rem;
}
.video-dur, .video-cat {
  display: inline-block;
  margin: 6px 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  background: rgba(0,0,0,0.3);
  padding: 2px 12px;
  border-radius: 30px;
}

/* ---------- INSTAGRAM ---------- */
.instagram {
  padding: 80px 0;
}
.insta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.insta-card {
  background: var(--glass);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  transition: all 0.3s ease;
}
.insta-card:hover {
  border-color: var(--primary);
  background: var(--primary-dim);
  transform: scale(1.02);
}

/* ---------- CONTACT ---------- */
.contact {
  padding: 80px 0;
}
.contact-form {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.contact-form input,
.contact-form textarea {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px 20px;
  color: #fff;
  font-size: 1rem;
  font-family: 'Vazirmatn', sans-serif;
  transition: all 0.3s ease;
  outline: none;
}
.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-dim);
}
.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--muted);
}
.contact-form .btn {
  align-self: flex-start;
}

/* ---------- FOOTER ---------- */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--glass-border);
  margin-top: 20px;
}
.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.footer-logo {
  font-weight: 700;
  font-size: 1.2rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.social-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.social-links a {
  color: var(--muted);
  font-size: 0.9rem;
  transition: color 0.3s ease;
}
.social-links a:hover {
  color: #fff;
}
.footer-copy {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- KEYFRAMES ---------- */
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}