@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0a0f;
  --bg-elevated: #12121a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8e8ed;
  --text-muted: #8b8b9e;
  --accent: #00d4aa;
  --accent-2: #7c5cff;
  --accent-glow: rgba(0, 212, 170, 0.25);
  --gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
  --font: 'Vazirmatn', Tahoma, 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'Courier New', monospace;
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 72px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
em { font-style: normal; color: var(--accent); }

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

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.cursor-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s;
  opacity: 0;
}

body:hover .cursor-glow { opacity: 1; }

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-h);
  transition: var(--transition);
}

.header.scrolled {
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

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

.logo {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 600;
}

.logo-bracket { color: var(--text-muted); }
.logo-accent {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color var(--transition);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  right: 0;
  width: 0;
  height: 2px;
  background: var(--gradient);
  transition: width var(--transition);
}

.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { width: 100%; }

.nav-cta {
  padding: 0.5rem 1.25rem !important;
  background: var(--gradient);
  border-radius: 999px;
  color: var(--bg) !important;
  font-weight: 600;
}

.nav-cta::after { display: none !important; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: var(--transition);
}

/* Hero */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding-top: var(--header-h);
}

.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: float 8s ease-in-out infinite;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: rgba(0, 212, 170, 0.15);
  top: -100px;
  left: -100px;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: rgba(124, 92, 255, 0.12);
  bottom: -50px;
  right: -50px;
  animation-delay: -4s;
}

.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
}

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

.hero-content {
  position: relative;
  z-index: 1;
  padding-block: 4rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.pulse {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.5); }
  50% { opacity: 0.8; box-shadow: 0 0 0 8px rgba(0, 212, 170, 0); }
}

.hero-title {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1.25rem;
}

.hero-greeting {
  display: block;
  font-size: 0.45em;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.hero-name {
  display: block;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-role {
  display: block;
  font-size: 0.55em;
  font-weight: 600;
  color: var(--text);
  font-family: var(--mono);
  margin-top: 0.5rem;
}

.typed-cursor {
  color: var(--accent);
  animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.hero-desc {
  max-width: 540px;
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 3rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

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

.btn-ghost {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-block { width: 100%; }

.hero-stats {
  display: flex;
  gap: 3rem;
  flex-wrap: wrap;
}

.stat-num {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: var(--mono);
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-plus { color: var(--accent); font-weight: 700; }
.stat-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 40px;
  border: 2px solid var(--border);
  border-radius: 12px;
}

.scroll-hint span {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  animation: scrollDown 2s infinite;
}

@keyframes scrollDown {
  0% { opacity: 1; top: 8px; }
  100% { opacity: 0; top: 20px; }
}

/* Sections */
.section {
  padding: 6rem 0;
  position: relative;
}

.section-header { margin-bottom: 3.5rem; }

.section-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.3;
}

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 4rem;
  align-items: center;
}

.about-frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.about-frame img { width: 100%; height: auto; }

.about-frame-deco {
  position: absolute;
  inset: -2px;
  border: 2px solid transparent;
  border-image: var(--gradient) 1;
  border-radius: var(--radius);
  pointer-events: none;
}

.about-card {
  position: absolute;
  bottom: -20px;
  left: -20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.about-card-icon {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 1.25rem;
}

.about-card span:last-child { font-size: 0.8rem; color: var(--text-muted); }

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

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

.about-highlights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.about-highlights li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.about-highlights svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}

/* Skills */
.skills { background: var(--bg-elevated); }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.skill-category {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: var(--transition);
}

.skill-category:hover {
  border-color: rgba(0, 212, 170, 0.3);
  transform: translateY(-4px);
}

.skill-category h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.skill-tags span {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: var(--mono);
}

.skill-bar {
  margin-bottom: 0.85rem;
}

.skill-bar:last-child { margin-bottom: 0; }

.skill-bar > span {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}

.bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.bar .fill {
  height: 100%;
  width: 0;
  background: var(--gradient);
  border-radius: 3px;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-bar.animated .fill {
  width: calc(var(--level) * 1%);
}

/* Resume */
.resume-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 3rem;
}

.timeline {
  position: relative;
  padding-right: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  right: 7px;
  width: 2px;
  height: 100%;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 2.5rem;
  padding-right: 2rem;
}

.timeline-dot {
  position: absolute;
  right: 0;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  z-index: 1;
}

.timeline-date {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
}

.timeline-content h3 {
  font-size: 1.15rem;
  margin: 0.35rem 0;
}

.timeline-company {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.timeline-content p:last-child {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.education h3 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.edu-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.edu-year {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
}

.edu-card h4 {
  font-size: 1rem;
  margin: 0.35rem 0;
}

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

/* Projects */
.project-filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 170, 0.08);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.project-card.hidden { display: none; }

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(0, 212, 170, 0.3);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.project-image {
  position: relative;
  height: 180px;
  overflow: hidden;
}

.project-gradient {
  width: 100%;
  height: 100%;
}

.g-1 { background: linear-gradient(135deg, #00d4aa, #007a5e); }
.g-2 { background: linear-gradient(135deg, #7c5cff, #4a2db8); }
.g-3 { background: linear-gradient(135deg, #ff6b6b, #c0392b); }
.g-4 { background: linear-gradient(135deg, #f39c12, #e67e22); }
.g-5 { background: linear-gradient(135deg, #3498db, #2980b9); }
.g-6 { background: linear-gradient(135deg, #1abc9c, #16a085); }

.project-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

.project-card:hover .project-overlay { opacity: 1; }

.project-link {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg);
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: 700;
  transition: transform var(--transition);
}

.project-link:hover { transform: scale(1.1); }

.project-body { padding: 1.25rem; }

.project-tags {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.project-tags span {
  font-size: 0.7rem;
  font-family: var(--mono);
  color: var(--accent);
  padding: 0.2rem 0.5rem;
  background: rgba(0, 212, 170, 0.1);
  border-radius: 4px;
}

.project-body h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.project-body p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 200px;
  gap: 1rem;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
}

.gallery-item.wide { grid-column: span 2; }
.gallery-item.tall { grid-row: span 2; }

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-item:hover img { transform: scale(1.08); }

.gallery-item figcaption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  font-size: 0.85rem;
  transform: translateY(100%);
  transition: transform var(--transition);
}

.gallery-item:hover figcaption { transform: translateY(0); }

/* Contact */
.contact-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem;
}

.contact-info p {
  color: var(--text-muted);
  margin: 1rem 0 2rem;
}

.contact-links li { margin-bottom: 1rem; }

.contact-links a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

.contact-links a:hover { color: var(--accent); }
.contact-links svg { width: 20px; height: 20px; flex-shrink: 0; }

.contact-form .form-group { margin-bottom: 1.25rem; }

.contact-form label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.contact-form textarea { resize: vertical; min-height: 100px; }

.form-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  text-align: center;
}

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

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-code span {
  font-family: var(--mono);
  color: var(--accent);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius-sm);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255,255,255,0.2); }

.lightbox-close { top: 1.5rem; left: 1.5rem; }
.lightbox-prev { right: 2rem; }
.lightbox-next { left: 2rem; }

/* Responsive */
@media (max-width: 992px) {
  .about-grid,
  .resume-layout,
  .contact-wrapper { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .skills-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .about-image { max-width: 400px; margin-inline: auto; }
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: fixed;
    top: var(--header-h);
    right: 0;
    left: 0;
    background: rgba(10, 10, 15, 0.98);
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
    transform: translateY(-120%);
    transition: transform var(--transition);
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open { transform: translateY(0); }
  .projects-grid { grid-template-columns: 1fr; }
  .about-highlights { grid-template-columns: 1fr; }
  .hero-stats { gap: 2rem; }
  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 180px;
  }
  .gallery-item.wide,
  .gallery-item.tall {
    grid-column: span 1;
    grid-row: span 1;
  }
  .contact-wrapper { padding: 1.5rem; }
}
