/* ============================
   CSS Variables — Light Theme (Default)
   ============================ */
:root,
[data-theme="light"] {
  --bg: #fafafa;
  --bg-alt: #f0f0ff;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-dark: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
  --gradient: linear-gradient(135deg, #6366f1, #a855f7);
  --dot-color: #d1d5db;
  --header-bg: rgba(250, 250, 250, 0.8);
  --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.4);
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-alt: #111118;
  --surface: #141414;
  --border: #1e1e1e;
  --text-primary: #e5e5e5;
  --text-secondary: #888888;
  --accent: #818cf8;
  --accent-light: #a5b4fc;
  --accent-dark: #6366f1;
  --accent-glow: rgba(129, 140, 248, 0.12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --gradient: linear-gradient(135deg, #818cf8, #c084fc);
  --dot-color: #1e1e1e;
  --header-bg: rgba(10, 10, 10, 0.85);
  --focus-ring: 0 0 0 3px rgba(129, 140, 248, 0.4);
}

/* ============================
   Base & Accessibility
   ============================ */
* {
  box-sizing: border-box;
}

body {
  font-family: "Vazirmatn", "Tahoma", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  position: relative;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(
    circle,
    var(--dot-color) 0.7px,
    transparent 0.7px
  );
  background-size: 24px 24px;
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}
body > * {
  position: relative;
  z-index: 1;
}

[dir="ltr"] body {
  font-family: "Inter", system-ui, sans-serif;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 0 0 0.5rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 9999;
  transition: top 0.2s ease;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
  outline: none;
}

/* Focus styles */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================
   RTL Mirrors
   ============================ */
.rtl-mirror {
  transform: scaleX(-1);
}
[dir="ltr"] .rtl-mirror {
  transform: scaleX(1);
}

/* ============================
   Gradient Text
   ============================ */
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================
   Header
   ============================ */
#header {
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition:
    border-color 0.3s,
    padding 0.3s,
    box-shadow 0.3s,
    background 0.3s;
}
#header.scrolled {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}

/* ============================
   Nav Links
   ============================ */
.nav-link {
  position: relative;
}
.nav-link::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
[dir="rtl"] .nav-link::after {
  transform-origin: right;
}
[dir="ltr"] .nav-link::after {
  transform-origin: left;
}
.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
  opacity: 1;
}
.nav-link.active {
  color: var(--accent) !important;
}

/* ============================
   Buttons
   ============================ */
.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9999px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}
.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}

.lang-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 44px;
}
.lang-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ============================
   Section Titles
   ============================ */
.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 3rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}
.section-title::after {
  content: "";
  position: absolute;
  bottom: -8px;
  right: 0;
  width: 48px;
  height: 3px;
  background: var(--gradient);
  border-radius: 2px;
}
[dir="ltr"] .section-title::after {
  right: auto;
  left: 0;
}
.section-title .section-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

/* ============================
   Profile Picture
   ============================ */
.profile-pic-wrapper {
  position: relative;
  display: inline-block;
}
.profile-pic {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  box-shadow: var(--shadow-md);
  transition:
    border-color 0.3s,
    box-shadow 0.3s;
}
.profile-pic:hover {
  border-color: var(--accent);
  box-shadow:
    0 0 0 6px var(--accent-glow),
    var(--shadow-lg);
}
.profile-pic-placeholder {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--border);
  box-shadow: var(--shadow-md);
  transition:
    border-color 0.3s,
    box-shadow 0.3s;
}
.profile-pic-placeholder:hover {
  border-color: var(--accent);
  box-shadow:
    0 0 0 6px var(--accent-glow),
    var(--shadow-lg);
}
.profile-pic-placeholder svg {
  width: 64px;
  height: 64px;
  color: rgba(255, 255, 255, 0.7);
}

/* ============================
   Skill Tags
   ============================ */
.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}
.skill-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.skill-tag svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.skill-tag img {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 2px;
}
[data-theme="dark"] .skill-tag img {
  filter: brightness(0.9);
}

/* ============================
   Skill Bars
   ============================ */
.skill-bar-group {
  margin-bottom: 1.25rem;
}
.skill-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}
.skill-bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 9999px;
  overflow: hidden;
}
.skill-bar-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 9999px;
  width: 0;
  transition: width 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ============================
   Contact Links
   ============================ */
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}
.contact-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.contact-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ============================
   Timeline
   ============================ */
.timeline {
  position: relative;
  padding-right: 2.5rem;
}
.timeline::before {
  content: "";
  position: absolute;
  right: 5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
[dir="ltr"] .timeline {
  padding-right: 0;
  padding-left: 2.5rem;
}
[dir="ltr"] .timeline::before {
  right: auto;
  left: 5px;
}

/* timeline thumbnail logo */
.timeline-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  box-shadow: var(--shadow-md);
  transition:
    border-color 0.3s,
    box-shadow 0.3s;
}
.timeline-logo:hover {
  border-color: var(--accent);
  box-shadow:
    0 0 0 6px var(--accent-glow),
    var(--shadow-lg);
}

.timeline-item {
  position: relative;
  padding-bottom: 2.5rem;
}
.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  right: -2.5rem;
  top: 0.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: 3px solid var(--bg);
  z-index: 1;
  transition: all 0.3s ease;
}
[dir="ltr"] .timeline-dot {
  right: auto;
  left: -2.5rem;
}

.timeline-item:hover .timeline-dot,
.timeline-item[data-expanded="true"] .timeline-dot,
.timeline-item:focus-within .timeline-dot {
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-glow);
  transform: scale(1.2);
}

.timeline-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.timeline-item:hover .timeline-header,
.timeline-item[data-expanded="true"] .timeline-header,
.timeline-item:focus-within .timeline-header {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.timeline-header-text {
  flex: 1;
}
.timeline-date {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.timeline-company {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.125rem;
}
.timeline-position {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* Expand/collapse icon */
.timeline-expand-icon {
  width: 24px;
  height: 24px;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition:
    transform 0.3s ease,
    color 0.3s ease;
}
.timeline-item[data-expanded="true"] .timeline-expand-icon {
  transform: rotate(180deg);
  color: var(--accent);
}

/* Timeline header actions */
.timeline-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.375rem;
  flex-shrink: 0;
}

/* Timeline view hint */
.timeline-view-hint {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  color: var(--accent);
  opacity: 0.7;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}
.timeline-item:hover .timeline-view-hint,
.timeline-item:focus-within .timeline-view-hint {
  opacity: 1;
  font-weight: bold;
}
/* Always show on mobile */
@media (max-width: 768px) {
  .timeline-view-hint {
    opacity: 1;
  }
}

.timeline-details {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height 0.4s ease,
    opacity 0.3s ease,
    padding 0.3s ease;
  padding: 0 1.5rem;
}
.timeline-item[data-expanded="true"] .timeline-details {
  max-height: 500px;
  opacity: 1;
  padding: 1rem 1.5rem 0.5rem;
}

.timeline-summary {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.timeline-achievements {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem 0;
}
.timeline-achievements li {
  position: relative;
  padding-right: 1rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.9;
}
[dir="ltr"] .timeline-achievements li {
  padding-right: 0;
  padding-left: 1rem;
}
.timeline-achievements li::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0.6rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
[dir="ltr"] .timeline-achievements li::before {
  right: auto;
  left: 0;
}

.timeline-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}
.timeline-tech span {
  font-size: 0.6875rem;
  padding: 0.25rem 0.625rem;
  background: var(--accent-glow);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 9999px;
  color: var(--accent);
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-weight: 500;
}

/* ============================
   Project Cards
   ============================ */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}
.project-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.project-image {
  width: 100%;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.project-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-image-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.3;
  transition:
    opacity 0.3s,
    transform 0.3s;
}
.project-card:hover .project-image-placeholder svg {
  opacity: 0.5;
  transform: scale(1.1);
}

.project-content {
  padding: 1.25rem 1.5rem;
}
.project-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.project-card p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}
.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}
.project-tech span {
  font-size: 0.6875rem;
  padding: 0.25rem 0.625rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9999px;
  color: var(--text-secondary);
  font-family: "JetBrains Mono", "Fira Code", monospace;
}

/* ============================
   Testimonials
   ============================ */
.testimonial-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  position: relative;
}
.testimonial-card::before {
  content: "\201C";
  position: absolute;
  top: 0.75rem;
  right: 1.25rem;
  font-size: 3rem;
  line-height: 1;
  color: var(--accent);
  opacity: 0.2;
  font-family: Georgia, serif;
}
[dir="ltr"] .testimonial-card::before {
  right: auto;
  left: 1.25rem;
}
.testimonial-card:hover {
  box-shadow: var(--shadow-md);
}
.testimonial-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1rem;
  font-style: italic;
}
.testimonial-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.testimonial-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}
.testimonial-info .name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}
.testimonial-info .role {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ============================
   Education Items
   ============================ */
.education-item {
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}
.education-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
.education-item h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.education-item .edu-school {
  font-size: 0.875rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
  font-weight: 500;
}
.education-item .edu-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ============================
   Back to Top
   ============================ */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all 0.3s ease;
  z-index: 50;
  cursor: pointer;
  border: none;
}
[dir="ltr"] #back-to-top {
  left: auto;
  right: 2rem;
}
#back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#back-to-top:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ============================
   Stat Cards
   ============================ */
.stat-card {
  text-align: center;
  padding: 1.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.stat-number {
  font-size: 2rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ============================
   Reveal Animations — Multiple Directions
   ============================ */
.reveal {
  opacity: 0;
  transition:
    opacity 0.7s ease,
    transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: none;
}

.reveal-up {
  transform: translateY(32px);
}
.reveal-down {
  transform: translateY(-32px);
}
.reveal-left {
  transform: translateX(-32px);
}
.reveal-right {
  transform: translateX(32px);
}
.reveal-scale {
  transform: scale(0.95);
}

.reveal-up.reveal-left {
  transform: translate(-32px, 32px);
}
.reveal-up.reveal-right {
  transform: translate(32px, 32px);
}

/* Staggered delays */
.reveal-delay-1 {
  transition-delay: 0.1s;
}
.reveal-delay-2 {
  transition-delay: 0.2s;
}
.reveal-delay-3 {
  transition-delay: 0.3s;
}
.reveal-delay-4 {
  transition-delay: 0.4s;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .timeline-details {
    transition: none;
  }
  .skill-bar-fill {
    transition: none;
  }
  .timeline-expand-icon {
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
  .project-card:hover,
  .contact-link:hover,
  .stat-card:hover {
    transform: none;
  }
}

/* ============================
   GitHub Section
   ============================ */
.github-profile {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.github-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}
.github-profile-link:hover {
  color: var(--accent);
}
.github-profile-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.github-stats {
  display: flex;
  gap: 1.25rem;
}
.github-stat {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.github-stat strong {
  color: var(--text-primary);
  font-weight: 600;
}

.github-repos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
@media (max-width: 640px) {
  .github-repos-grid {
    grid-template-columns: 1fr;
  }
}

.github-repo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.github-repo-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.github-repo-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.github-repo-header svg {
  color: var(--accent);
  flex-shrink: 0;
}
.github-repo-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}

.github-repo-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
  margin: 0;
}

.github-repo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
.github-repo-lang {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.github-lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.github-repo-stars {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.github-repo-stars svg {
  color: #eab308;
}

/* ============================
   Project Card — Clickable
   ============================ */
.project-card {
  cursor: pointer;
}
.project-view-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.2s ease;
  margin-top: 0.5rem;
}
.project-card:hover .project-view-hint {
  opacity: 1;
}
.project-view-hint svg {
  width: 14px;
  height: 14px;
}

/* ============================
   Modal
   ============================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
.modal-overlay.open .modal-content {
  transform: scale(1) translateY(0);
}

/* Scrollbar styling */
.modal-content::-webkit-scrollbar {
  width: 6px;
}
.modal-content::-webkit-scrollbar-track {
  background: transparent;
}
.modal-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

.modal-close {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
}
[dir="ltr"] .modal-close {
  left: auto;
  right: 1rem;
}
.modal-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-image {
  width: 100%;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1rem 1rem 0 0;
  overflow: hidden;
}
.modal-image svg {
  width: 64px;
  height: 64px;
  opacity: 0.3;
}

.modal-body {
  padding: 2rem;
}
.modal-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}
.modal-body .modal-description {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.modal-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
}
.modal-features li {
  position: relative;
  padding-right: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 2;
}
[dir="ltr"] .modal-features li {
  padding-right: 0;
  padding-left: 1.25rem;
}
.modal-features li::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0.65rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gradient);
}
[dir="ltr"] .modal-features li::before {
  right: auto;
  left: 0;
}

.modal-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.modal-tech span {
  font-size: 0.75rem;
  padding: 0.375rem 0.875rem;
  background: var(--accent-glow);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 9999px;
  color: var(--accent);
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-weight: 500;
}

.modal-images-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.modal-images-grid .modal-image-thumb {
  height: 120px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.modal-images-grid .modal-image-thumb svg {
  width: 32px;
  height: 32px;
  opacity: 0.25;
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-content {
    transition: none;
  }
}

@media (max-width: 640px) {
  .modal-content {
    max-height: 90vh;
    border-radius: 0.75rem;
  }
  .modal-body {
    padding: 1.5rem;
  }
  .modal-image {
    height: 180px;
  }
  .modal-images-grid {
    grid-template-columns: 1fr;
  }
  .modal-images-grid .modal-image-thumb {
    height: 100px;
  }
}

/* ============================
   Experience Modal
   ============================ */
.exp-modal-content {
  max-width: 800px;
}
.exp-modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
}
.exp-modal-logo {
  width: 56px;
  height: 56px;
  border-radius: 0.5rem;
  object-fit: contain;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.25rem;
  flex-shrink: 0;
}
.exp-modal-logo-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 0.5rem;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.exp-modal-logo-placeholder svg {
  width: 28px;
  height: 28px;
  color: rgba(255, 255, 255, 0.7);
}
.exp-modal-info {
  flex: 1;
}
.exp-modal-info h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}
.exp-modal-info .exp-modal-position {
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.25rem;
}
.exp-modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.exp-modal-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.exp-modal-meta svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  display: inline-block;
}
.exp-modal-website {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}
.exp-modal-website:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ============================
   Image Slider
   ============================ */
.exp-modal-slider {
  margin-bottom: 1.5rem;
}
.slider-container {
  position: relative;
  width: 100%;
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
  touch-action: pan-y pinch-zoom;
}
.slider-track {
  display: flex;
  transition: transform 0.4s ease;
}
.slider-slide {
  min-width: 100%;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.slider-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.slider-slide:hover img {
  transform: scale(1.03);
}
.slider-slide-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}
.slider-slide-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.2;
}
.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.slider-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.slider-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}
.slider-prev {
  right: 0.75rem;
  left: auto;
}
.slider-next {
  left: 0.75rem;
  right: auto;
}
/* RTL: flip the arrow icons so prev points right, next points left */
[dir="rtl"] .slider-prev svg {
  transform: scaleX(-1);
}
[dir="rtl"] .slider-next svg {
  transform: scaleX(-1);
}
[dir="ltr"] .slider-prev {
  left: 0.75rem;
  right: auto;
}
[dir="ltr"] .slider-next {
  right: 0.75rem;
  left: auto;
}

.slider-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.slider-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 8px;
  background-clip: content-box;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slider-dot::after {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.2s ease;
}
.slider-dot.active::after {
  background: var(--accent);
}
.slider-counter {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* ============================
   Lightbox
   ============================ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}
.lightbox-overlay.open {
  opacity: 1;
  visibility: visible;
}
.lightbox-overlay img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 0.5rem;
  transform: scale(0.9);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.lightbox-overlay.open img {
  transform: scale(1);
}
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
[dir="ltr"] .lightbox-close {
  right: 1rem;
  left: auto;
}
[dir="rtl"] .lightbox-close {
  left: 1rem;
  right: auto;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}
.lightbox-close svg {
  width: 20px;
  height: 20px;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.lightbox-prev {
  left: 1rem;
}
.lightbox-next {
  right: 1rem;
}
[dir="ltr"] .lightbox-prev {
  left: 1rem;
  right: auto;
}
[dir="ltr"] .lightbox-next {
  right: 1rem;
  left: auto;
}
[dir="rtl"] .lightbox-prev {
  right: 1rem;
  left: auto;
}
[dir="rtl"] .lightbox-next {
  left: 1rem;
  right: auto;
}
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.2);
}
.lightbox-prev svg,
.lightbox-next svg {
  width: 24px;
  height: 24px;
}

.lightbox-caption {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.875rem;
  text-align: center;
  max-width: 80vw;
}

@media (prefers-reduced-motion: reduce) {
  .slider-track {
    transition: none;
  }
  .lightbox-overlay img {
    transition: none;
  }
  .slider-slide:hover img {
    transform: none;
  }
}

/* ============================
   Mobile Menu
   ============================ */
#mobile-menu.open {
  display: block;
}

/* ============================
   Forms
   ============================ */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}
.form-group textarea {
  resize: vertical;
  min-height: 80px;
}
.form-group input.error,
.form-group textarea.error {
  border-color: #ef4444;
}

/* Button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
  min-height: 44px;
}
.btn-primary:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Outline Button */
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Form status messages */
.form-status {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  min-height: 1.25rem;
}
.form-status.success {
  color: #16a34a;
}
.form-status.error {
  color: #ef4444;
}
.form-hint {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ============================
   User Comments
   ============================ */
.user-comment {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.user-comment-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.user-comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.user-comment-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}
.user-comment-date {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}
.user-comment-message {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ============================
   Tailwind Utility Replacements
   ============================ */

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-flex { display: inline-flex; }
.flex { display: flex; }
.grid { display: grid; }

/* Flex */
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-wrap { flex-wrap: wrap; }

/* Grid */
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Alignment */
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

/* Gap */
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }

/* Spacing — Margin */
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Spacing — Padding */
.p-6 { padding: 1.5rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-24 { padding-top: 6rem; padding-bottom: 6rem; }

/* Spacing — Space Between Children */
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-12 > * + * { margin-top: 3rem; }

/* Sizing */
.min-h-screen { min-height: 100vh; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-5xl { max-width: 64rem; }

/* Position */
.fixed { position: fixed; }
.relative { position: relative; }
.absolute { position: absolute; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.z-50 { z-index: 50; }

/* Typography */
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-6xl { font-size: 3.75rem; line-height: 1; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.leading-relaxed { line-height: 1.625; }
.tracking-tight { letter-spacing: -0.025em; }

/* Colors — using CSS variables */
.text-\[var\(--accent\)\] { color: var(--accent); }
.text-\[var\(--accent-dark\)\] { color: var(--accent-dark); }
.text-\[var\(--text-primary\)\] { color: var(--text-primary); }
.text-\[var\(--text-secondary\)\] { color: var(--text-secondary); }
.bg-\[var\(--bg-alt\)\] { background-color: var(--bg-alt); }
.border-t { border-top: 1px solid var(--border); }

/* Effects */
.opacity-60 { opacity: 0.6; }
.transition-all { transition: all 0.15s ease; }
.transition-colors { transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
.duration-300 { transition-duration: 300ms; }

/* Overflow */
.overflow-hidden { overflow: hidden; }

/* Hover — using CSS variables */
.hover\:text-\[var\(--accent\)\]:hover { color: var(--accent); }
.hover\:text-\[var\(--accent-dark\)\]:hover { color: var(--accent-dark); }
.hover\:text-\[var\(--text-primary\)\]:hover { color: var(--text-primary); }

/* Responsive — md breakpoint (768px) */
@media (min-width: 768px) {
  .md\:flex { display: flex; }
  .md\:hidden { display: none; }
  .md\:flex-row { flex-direction: row; }
  .md\:items-start { align-items: flex-start; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
  .md\:text-2xl { font-size: 1.5rem; line-height: 2rem; }
  .md\:text-6xl { font-size: 3.75rem; line-height: 1; }
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

a, u {
  text-decoration: none;
}