/* ============================================
   ARYADEV Portfolio - Main Stylesheet
   ============================================ */

/* CSS Variables */
:root {
  /* Colors - Dark Theme (Default) */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-tertiary: #1a1f2e;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-card-hover: rgba(26, 31, 46, 0.95);

  --text-primary: #f0f4f8;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #00d4ff;
  --accent-secondary: #0ea5e9;
  --accent-tertiary: #06b6d4;
  --accent-glow: rgba(0, 212, 255, 0.3);
  --accent-glow-strong: rgba(0, 212, 255, 0.5);

  --gradient-primary: linear-gradient(135deg, #00d4ff, #0ea5e9);
  --gradient-secondary: linear-gradient(135deg, #0a0e17, #111827);
  --gradient-card: linear-gradient(145deg, rgba(17, 24, 39, 0.6), rgba(26, 31, 46, 0.3));

  --border-color: rgba(0, 212, 255, 0.15);
  --border-hover: rgba(0, 212, 255, 0.4);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(0, 212, 255, 0.15);

  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;

  /* Typography */
  --font-primary: 'Inter', 'Vazirmatn', 'Segoe UI', system-ui, sans-serif;
  --font-heading: 'Caveat', 'Inter', 'Vazirmatn', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;
  --transition-spring: 500ms cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* Layout */
  --nav-width: 260px;
  --nav-width-collapsed: 72px;
  --header-height: 60px;

  /* Z-index */
  --z-nav: 100;
  --z-overlay: 200;
  --z-modal: 300;
  --z-loading: 400;
  --z-toast: 500;
}

/* Light Theme */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 1);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border-color: rgba(0, 212, 255, 0.2);
  --border-hover: rgba(0, 212, 255, 0.5);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 30px rgba(0, 212, 255, 0.1);
}

/* ============================================
   Spiderweb Corner Decoration
   ============================================ */
.spiderweb-decor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0.85;
  transition: opacity var(--transition-slow);
}

[dir="rtl"] .spiderweb-decor {
  left: 0;
  right: auto;
}

@media (max-width: 480px) {
  .spiderweb-decor {
    transform: scale(0.7);
    transform-origin: top left;
  }
}

@media (max-width: 340px) {
  .spiderweb-decor {
    display: none;
  }
}

/* Self-hosted Latin/monospace/Arabic fonts. No external font requests. */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter/inter-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter/inter-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter/inter-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter/inter-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter/inter-800.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono/jetbrains-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono/jetbrains-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono/jetbrains-mono-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Kufi Arabic';
  src: url('../fonts/noto-kufi-arabic/noto-kufi-arabic-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Kufi Arabic';
  src: url('../fonts/noto-kufi-arabic/noto-kufi-arabic-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Kufi Arabic';
  src: url('../fonts/noto-kufi-arabic/noto-kufi-arabic-800.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* Self-hosted Persian typeface: Morabba */
@font-face {
  font-family: 'Morabba';
  src: url('../fonts/morabba/morabba.woff2') format('woff2'),
       url('../fonts/morabba/morabba.woff') format('woff'),
       url('../fonts/morabba/morabba.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* RTL Support */
[dir="rtl"] {
  --nav-left: auto;
  --nav-right: 0;
  /* Morabba is a purpose-built Persian display/text typeface; Vazirmatn covers any weights Morabba lacks */
  --font-primary: 'Morabba', 'Vazirmatn', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-heading: 'Morabba', 'Noto Kufi Arabic', 'Vazirmatn', 'Inter', sans-serif;
}

/* ============================================
   Reset & Base
   ============================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  height: -webkit-fill-available;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  height: -webkit-fill-available;
  width: 100%;
  max-width: 100vw;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(0, 212, 255, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(14, 165, 233, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-secondary);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1000;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--accent-primary);
  transform: translateY(-180%);
  transition: transform var(--transition-fast);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid var(--accent-primary);
  outline-offset: 3px;
}

/* ============================================
   Navigation
   ============================================ */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nav-width);
  max-width: 85vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  z-index: var(--z-nav);
  display: flex;
  flex-direction: column;
  padding: 2rem 0;
  padding-top: calc(2rem + env(safe-area-inset-top, 0px));
  padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  padding-left: env(safe-area-inset-left, 0px);
  transition: transform var(--transition-base);
  overflow-y: auto;
}

[dir="rtl"] .main-nav {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--border-color);
}

.nav-brand {
  padding: 0 1.5rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.nav-brand-logo {
  display: inline-block;
  margin-bottom: 0.5rem;
}

.nav-brand-logo svg {
  width: 48px;
  height: 48px;
}

.nav-brand-name {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--accent-primary);
  text-transform: uppercase;
}

/* --- New avatar-style sidebar header --- */
.nav-brand--avatar {
  padding-top: 0.5rem;
  padding-bottom: 1.25rem;
}

.nav-brand-avatar-ring {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0 auto 0.85rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-brand-avatar-ring::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent-primary), var(--accent-secondary), transparent, var(--accent-primary));
}

.nav-brand-avatar-ring::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  box-shadow: 0 0 18px 2px color-mix(in srgb, var(--accent-primary) 45%, transparent);
  opacity: 0.7;
}

.nav-brand-avatar {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-tertiary, var(--bg-primary));
  border: 3px solid var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  z-index: 1;
}

.nav-brand-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.nav-brand-status {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #22c55e;
  border: 3px solid var(--bg-secondary);
  z-index: 2;
  box-shadow: 0 0 6px 1px rgba(34, 197, 94, 0.7);
}

[dir="rtl"] .nav-brand-status {
  right: auto;
  left: 2px;
}

.nav-brand-role {
  margin-top: 0.3rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  text-transform: none;
}

@keyframes navRingSpin {
  to { transform: rotate(360deg); }
}

@keyframes navGlowPulse {
  0%, 100% { opacity: 0.45; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.06); }
}

.nav-links {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: all var(--transition-fast);
  position: relative;
  cursor: pointer;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--gradient-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: height var(--transition-fast);
}

[dir="rtl"] .nav-link::before {
  left: auto;
  right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(0, 212, 255, 0.05);
}

.nav-link.active {
  color: var(--accent-primary);
  background: rgba(0, 212, 255, 0.08);
}

.nav-link.active::before {
  height: 60%;
}

.nav-link-icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  flex-shrink: 0;
}

.nav-link.active .nav-link-icon {
  opacity: 1;
}

.nav-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-theme-toggle,
.nav-lang-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.nav-theme-toggle:hover,
.nav-lang-toggle:hover {
  color: var(--accent-primary);
  background: rgba(0, 212, 255, 0.1);
}

/* Mobile Menu Toggle (hamburger, mobile only) */
.mobile-toggle {
  display: none;
  position: fixed;
  top: calc(1rem + env(safe-area-inset-top, 0px));
  right: calc(1rem + env(safe-area-inset-right, 0px));
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  z-index: calc(var(--z-nav) + 1);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}

[dir="rtl"] .mobile-toggle {
  right: auto;
  left: 1rem;
}

.mobile-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

.mobile-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.mobile-toggle.active span:nth-child(2) {
  opacity: 0;
}
.mobile-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Nav Arrow Toggle - fixed independently of the sidebar so it never gets carried off-screen
   when the sidebar itself is translated closed */
.nav-arrow-toggle {
  position: fixed;
  top: 50%;
  left: calc(var(--nav-width) - 18px);
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: calc(var(--z-nav) + 1);
  transition: background var(--transition-fast), border-color var(--transition-fast), left var(--transition-base), right var(--transition-base);
}

[dir="rtl"] .nav-arrow-toggle {
  left: auto;
  right: calc(var(--nav-width) - 18px);
}

/* When the sidebar is closed, keep the button visible as a small edge tab so it can reopen it */
.nav-arrow-toggle.nav-closed {
  left: -18px;
}

[dir="rtl"] .nav-arrow-toggle.nav-closed {
  left: auto;
  right: -18px;
}

.nav-arrow-toggle:hover {
  border-color: var(--accent-primary);
  background: rgba(0, 212, 255, 0.1);
}

.nav-arrow-toggle svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-primary);
  transition: transform var(--transition-base);
}

/* Arrow points left (toward nav) when open, flips to point right when nav is closed */
.nav-arrow-toggle.nav-closed svg {
  transform: rotate(180deg);
}

[dir="rtl"] .nav-arrow-toggle svg {
  transform: rotate(180deg);
}

[dir="rtl"] .nav-arrow-toggle.nav-closed svg {
  transform: rotate(0deg);
}

/* Desktop nav collapse (toggled via the arrow button) */
@media (min-width: 1025px) {
  .main-nav.nav-closed {
    transform: translateX(-100%);
  }

  [dir="rtl"] .main-nav.nav-closed {
    transform: translateX(100%);
  }

  .main-content.nav-closed {
    margin-left: 0;
    width: 100%;
  }

  [dir="rtl"] .main-content.nav-closed {
    margin-right: 0;
  }
}

@media (max-width: 1024px) {
  .nav-arrow-toggle {
    display: none;
  }
}

.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: calc(var(--z-nav) - 1);
  backdrop-filter: blur(4px);
}

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
  margin-left: var(--nav-width);
  height: 100vh;
  height: 100dvh;
  width: calc(100% - var(--nav-width));
  position: relative;
  overflow: hidden;
}

[dir="rtl"] .main-content {
  margin-left: 0;
  margin-right: var(--nav-width);
}

/* Section Views */
.section-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 3rem;
}

.section-view.active {
  opacity: 1;
  visibility: visible;
}

.section-view::-webkit-scrollbar {
  width: 4px;
}

.section-view::-webkit-scrollbar-track {
  background: transparent;
}

.section-view::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}

/* Section Header */
.section-header {
  margin-bottom: 3rem;
  position: relative;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-primary);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 4.5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.section-title span {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 500px;
}

/* ============================================
   Home Section
   ============================================ */
.home-section {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  position: relative;
}

.home-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  max-width: 1600px;
  width: 100%;
}

.home-content {
  position: relative;
}

.home-greeting {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-primary);
  letter-spacing: 2px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.home-greeting::before {
  content: '';
  width: 30px;
  height: 1px;
  background: var(--accent-primary);
}

.home-name {
  font-family: var(--font-heading);
  font-size: clamp(1.9rem, 6vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.home-tagline {
  font-size: clamp(1.05rem, 3vw, 1.5rem);
  color: var(--accent-primary);
  font-weight: 600;
  margin-bottom: 1rem;
}

.home-subtitle {
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: var(--text-secondary);
  max-width: 500px;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.home-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.home-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--success);
  letter-spacing: 2px;
  padding: 0.5rem 1rem;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-full);
}

.home-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* Home Visual */
.home-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.home-avatar-wrapper {
  position: relative;
  width: 320px;
  height: 320px;
}

.home-avatar {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 2px solid var(--border-color);
  position: relative;
  z-index: 2;
}

.home-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  color: var(--accent-primary);
  font-size: 4rem;
  font-weight: 800;
  letter-spacing: 4px;
}

.home-avatar-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 340px;
  height: 340px;
  border-radius: var(--radius-xl);
  background: var(--gradient-primary);
  opacity: 0.15;
  filter: blur(40px);
  z-index: 1;
}

@keyframes avatarGlow {
  0%, 100% { opacity: 0.15; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.25; transform: translate(-50%, -50%) scale(1.05); }
}

/* Ambient motion is interaction-triggered so the first viewport can settle for LCP/SI. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .nav-brand-avatar-ring:hover::before { animation: navRingSpin 6s linear infinite; }
  .nav-brand-avatar-ring:hover::after { animation: navGlowPulse 2.4s ease-in-out infinite; }
  .home-visual:hover .home-avatar-glow { animation: avatarGlow 4s ease-in-out infinite; }
  .home-section:hover .home-grid-bg { animation: starsTwinkle 5s ease-in-out infinite; }
  .home-status:hover::before { animation: statusPulse 2s ease-in-out infinite; }
}

/* Floating Elements */
.floating-element {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-primary);
  opacity: 0.3;
  pointer-events: none;
}

.floating-code-1 {
  top: 10%;
  left: -20%;
  transform: rotate(-5deg);
}

.floating-code-2 {
  bottom: 15%;
  right: -15%;
  transform: rotate(3deg);
}

/* Grid Background */
.home-grid-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(1.5px 1.5px at 10% 20%, var(--accent-primary) 0%, transparent 60%),
    radial-gradient(1px 1px at 25% 65%, #ffffff 0%, transparent 60%),
    radial-gradient(2px 2px at 40% 15%, var(--accent-secondary) 0%, transparent 60%),
    radial-gradient(1px 1px at 55% 80%, #ffffff 0%, transparent 60%),
    radial-gradient(1.5px 1.5px at 70% 35%, var(--accent-primary) 0%, transparent 60%),
    radial-gradient(1px 1px at 82% 60%, #ffffff 0%, transparent 60%),
    radial-gradient(2px 2px at 92% 25%, var(--accent-secondary) 0%, transparent 60%),
    radial-gradient(1px 1px at 15% 85%, #ffffff 0%, transparent 60%),
    radial-gradient(1.5px 1.5px at 48% 45%, var(--accent-primary) 0%, transparent 60%),
    radial-gradient(1px 1px at 65% 8%, #ffffff 0%, transparent 60%);
  background-repeat: repeat;
  background-size: 340px 340px;
  opacity: 0.6;
  pointer-events: none;
}

.home-grid-bg::before,
.home-grid-bg::after {
  content: "";
  position: absolute;
  width: 340px;
  height: 340px;
  background-image:
    repeating-conic-gradient(from 0deg, var(--border-color) 0deg 0.6deg, transparent 0.6deg 30deg),
    repeating-radial-gradient(circle, transparent 0, transparent 24px, var(--border-color) 25px);
  background-position: center;
  opacity: 0.22;
  pointer-events: none;
}

.home-grid-bg::before {
  top: -60px;
}

[dir="ltr"] .home-grid-bg::before {
  left: -60px;
}

[dir="rtl"] .home-grid-bg::before {
  right: -60px;
}

.home-grid-bg::after {
  bottom: -90px;
  right: -90px;
  width: 220px;
  height: 220px;
  opacity: 0.14;
}

[dir="rtl"] .home-grid-bg::after {
  right: auto;
  left: -90px;
}

@keyframes starsTwinkle {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.75; }
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

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

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

.btn-secondary {
  background: transparent;
  color: var(--accent-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--accent-primary);
  background: rgba(0, 212, 255, 0.05);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.card:hover::before {
  transform: scaleX(1);
}

/* ============================================
   About Section
   ============================================ */
.about-container {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 3rem;
  max-width: 1400px;
}

.about-image {
  position: relative;
}

.about-image-frame {
  width: 100%;
  aspect-ratio: 4/5;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.about-image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 3rem;
}

.about-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 2rem;
}

.about-info-item {
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.about-info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.25rem;
}

.about-info-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}

.about-bio {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 2rem;
}

/* ============================================
   Skills Section
   ============================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 1500px;
}

.skill-card {
  padding: 1.5rem;
}

.skill-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.skill-card-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.skill-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(0, 212, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  font-size: 1.2rem;
}

.skill-name {
  font-size: 1rem;
  font-weight: 600;
}

.skill-percentage {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-primary);
}

.skill-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.skill-bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width 1s ease-out;
}

.skill-description {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ============================================
   Resume Section
   ============================================ */
.resume-container {
  max-width: 1400px;
}

.resume-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.resume-tab {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.resume-tab.active {
  color: var(--accent-primary);
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--accent-primary);
}

.resume-tab-content {
  display: none;
}

.resume-tab-content.active {
  display: block;
}

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

.resume-timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.resume-item {
  position: relative;
  padding-bottom: 2rem;
  padding-left: 1.5rem;
}

.resume-item::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 0.5rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 3px solid var(--bg-primary);
  transform: translateX(-5px);
}

.resume-item-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.resume-item-subtitle {
  font-size: 0.95rem;
  color: var(--accent-primary);
  margin-bottom: 0.25rem;
}

.resume-item-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.resume-item-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================
   Projects Section
   ============================================ */
.projects-container {
  max-width: 1600px;
}

.projects-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
  cursor: pointer;
}

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

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.project-card {
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}

.project-card-image {
  width: 100%;
  height: 200px;
  background: var(--bg-tertiary);
  overflow: hidden;
  position: relative;
}

.project-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.project-card:hover .project-card-image img {
  transform: scale(1.05);
}

.project-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2rem;
}

.project-card-body {
  padding: 1.5rem;
}

.project-card-category {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-primary);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.project-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.project-card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.project-card-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tech-tag {
  padding: 0.25rem 0.5rem;
  background: rgba(0, 212, 255, 0.08);
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  color: var(--accent-primary);
  font-family: var(--font-mono);
}

.project-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.project-card-links {
  display: flex;
  gap: 0.75rem;
}

.project-card-link {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.project-card-link:hover {
  color: var(--accent-primary);
}

.project-card-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Project Modal */
.project-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
}

.project-modal.active {
  display: flex;
}

.project-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.project-modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
}

.project-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.project-modal-close:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.2);
}

/* ============================================
   Services Section
   ============================================ */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  max-width: 1500px;
}

.service-card {
  text-align: center;
}

.service-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: rgba(0, 212, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  color: var(--accent-primary);
  font-size: 1.5rem;
  transition: all var(--transition-base);
}

.service-card:hover .service-icon {
  background: var(--accent-primary);
  color: var(--bg-primary);
  box-shadow: 0 0 30px var(--accent-glow);
}

.service-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.service-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.service-features {
  text-align: left;
}

.service-feature {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.service-feature::before {
  content: '›';
  color: var(--accent-primary);
  font-weight: bold;
}

/* ============================================
   Contact Section
   ============================================ */
.contact-container {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 3rem;
  max-width: 1400px;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.contact-info-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.contact-info-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(0, 212, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.contact-info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.contact-info-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}

.contact-social-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.social-link {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.social-link:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: rgba(0, 212, 255, 0.08);
}

.social-link img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.social-link-text {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}

/* Contact Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  position: relative;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.form-error {
  font-size: 0.8rem;
  color: var(--error);
  margin-top: 0.25rem;
  display: none;
}

.form-group.error .form-input,
.form-group.error .form-textarea {
  border-color: var(--error);
}

.form-group.error .form-error {
  display: block;
}

.form-success,
.form-message-error {
  padding: 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  display: none;
}

.form-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--success);
}

.form-message-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
}

/* The section being replaced simply fades out */
.section-dragged-out {
  animation: simpleFadeOut 200ms ease forwards;
}

@keyframes simpleFadeOut {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* The incoming section simply fades in */
.section-view.web-reveal {
  animation: simpleFadeIn 250ms ease forwards;
}

@keyframes simpleFadeIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

/* ============================================
   Glitch Transition
   ============================================ */
.glitch-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-overlay);
  pointer-events: none;
  opacity: 0;
}

.glitch-transition.active {
  animation: glitchOverlay 0.4s ease-out;
}

.glitch-transition::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 212, 255, 0.03) 2px,
    rgba(0, 212, 255, 0.03) 4px
  );
}

@keyframes glitchOverlay {
  0% { opacity: 0; }
  10% { opacity: 1; }
  20% { opacity: 0.5; }
  30% { opacity: 1; }
  50% { opacity: 0.3; }
  70% { opacity: 0.8; }
  100% { opacity: 0; }
}

/* ============================================
   Command Palette
   ============================================ */
.command-palette-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  align-items: flex-start;
  justify-content: center;
  padding-top: 20vh;
}

.command-palette-overlay.active {
  display: flex;
}

.command-palette {
  width: 100%;
  max-width: 500px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.command-palette-input {
  width: 100%;
  padding: 1rem 1.25rem;
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 1rem;
}

.command-palette-results {
  max-height: 300px;
  overflow-y: auto;
  padding: 0.5rem;
}

.command-palette-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.command-palette-item:hover,
.command-palette-item.selected {
  background: rgba(0, 212, 255, 0.08);
  color: var(--text-primary);
}

.command-palette-item-icon {
  width: 20px;
  height: 20px;
  opacity: 0.5;
}

.command-palette-item-label {
  font-size: 0.9rem;
  font-weight: 500;
}

.command-palette-shortcut {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0.15rem 0.5rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

/* ============================================
   Utilities & states
   ============================================ */

/* Attribute-based hiding must win over component display values
   (used by modals, filtered project cards and form feedback). */
[hidden] {
  display: none !important;
}

/* Empty states — shown when a section genuinely has no content yet */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-align: center;
  padding: 3rem 1.5rem;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  max-width: 620px;
}

.empty-state-icon {
  font-size: 2rem;
  opacity: 0.5;
}

.empty-state p {
  margin: 0;
  line-height: 1.9;
  font-size: 0.95rem;
}

.nav-brand-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 1px;
  color: var(--accent-primary);
}

/* Project modal extras */
.project-modal-image {
  margin: -2rem -2rem 1.5rem;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  height: 250px;
  background: var(--bg-tertiary);
}

.project-modal-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-modal-section-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

/* Command palette item is a <button> for keyboard support */
.command-palette-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.8rem 1rem;
  background: transparent;
  border: 0;
  border-radius: var(--radius-md);
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.command-palette-item:hover,
.command-palette-item:focus-visible {
  background: var(--bg-tertiary);
}

.command-palette-empty {
  padding: 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Better focus visibility throughout the public site */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Long text blocks should never force horizontal scrolling */
.about-bio {
  overflow-wrap: anywhere;
}

/* 404 page */
.notfound-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  margin: 0;
  background: var(--bg-primary, #0a0e17);
  color: var(--text-primary, #e2e8f0);
  font-family: 'Vazirmatn', system-ui, sans-serif;
  text-align: center;
}

.notfound {
  max-width: 560px;
  width: 100%;
}

.notfound-code {
  font-size: clamp(3.5rem, 2rem + 12vw, 7rem);
  font-weight: 800;
  line-height: 1;
  color: var(--accent-primary, #00d4ff);
  opacity: 0.25;
  letter-spacing: -0.02em;
}

.notfound-title {
  font-size: clamp(1.15rem, 1rem + 1.2vw, 1.6rem);
  margin: 0.5rem 0 0.75rem;
}

.notfound-text {
  color: var(--text-muted, #94a3b8);
  line-height: 2;
  margin: 0 0 1.75rem;
}

.notfound-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.notfound-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.75rem 1.35rem;
  border-radius: var(--radius-md, 10px);
  background: var(--accent-primary, #00d4ff);
  color: #00121a;
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.notfound-btn:hover { opacity: 0.88; }

.notfound-btn--ghost {
  background: transparent;
  color: var(--text-primary, #e2e8f0);
  border: 1px solid var(--border-color, rgba(255,255,255,.15));
}

.notfound-brand {
  margin-top: 2.5rem;
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
  letter-spacing: 1px;
}

/* Honeypot field: visually and programmatically hidden from people */
.form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-footer-note {
  grid-column: 1 / -1;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.9;
}

.contact-footer-note p {
  margin: 0 0 0.35rem;
}

.contact-footer-copy {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
  .main-nav {
    transform: translateX(-100%);
  }

  [dir="rtl"] .main-nav {
    transform: translateX(100%);
  }

  .main-nav.open {
    transform: translateX(0);
  }

  .mobile-toggle {
    display: flex;
  }

  .mobile-overlay.active {
    display: block;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
  }

  [dir="rtl"] .main-content {
    margin-right: 0;
  }

  .home-container {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .home-content {
    order: 2;
  }

  .home-visual {
    order: 1;
  }

  .home-greeting {
    justify-content: center;
  }

  .home-actions {
    justify-content: center;
  }

  .home-status {
    margin: 0 auto;
  }

  .home-avatar-wrapper {
    width: 240px;
    height: 240px;
  }

  .about-container {
    grid-template-columns: 1fr;
  }

  .contact-container {
    grid-template-columns: 1fr;
  }

  .section-view {
    padding: 2rem 1.5rem;
  }
}

/* Large tablets / small laptops: keep nav collapsible but give grids more breathing room */
@media (max-width: 900px) {
  .home-container {
    gap: 2.5rem;
  }
}

@media (max-width: 768px) {
  :root {
    --nav-width: 280px;
  }

  .home-avatar-wrapper {
    width: 200px;
    height: 200px;
  }

  .command-palette-overlay {
    padding: 5vh 1rem 0;
  }

  .project-modal-content {
    padding: 1.5rem;
  }
}

/* Phones: collapse grids to a single column; tablets above this keep 2 columns via auto-fill */
@media (max-width: 640px) {
  .skills-grid,
  .projects-grid,
  .services-grid,
  .about-info-grid {
    grid-template-columns: 1fr;
  }

  .about-image-frame {
    max-width: 320px;
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .section-view {
    padding: 1.5rem 1rem;
    padding-top: calc(1.5rem + env(safe-area-inset-top, 0px));
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  }

  .home-section {
    padding: 4.5rem 1rem 2rem;
  }

  .home-actions {
    flex-direction: column;
    width: 100%;
  }

  .home-actions .btn {
    width: 100%;
  }

  .home-avatar-wrapper {
    width: 160px;
    height: 160px;
  }

  .section-title {
    font-size: clamp(1.4rem, 7vw, 1.8rem);
  }

  .section-subtitle {
    max-width: 100%;
  }

  .nav-brand-avatar-ring {
    width: 64px;
    height: 64px;
  }

  .nav-brand-avatar {
    width: 56px;
    height: 56px;
  }
}

/* Very small / narrow phones */
@media (max-width: 360px) {
  :root {
    --nav-width: 240px;
  }

  .home-avatar-wrapper {
    width: 130px;
    height: 130px;
  }

  .btn {
    padding: 0.7rem 1.1rem;
    font-size: 0.85rem;
  }

  .section-view {
    padding: 1.25rem 0.85rem;
  }
}

/* Short / landscape screens (phones rotated, small laptops with short viewports) */
@media (max-height: 480px) and (orientation: landscape) {
  .home-section {
    padding: 1.5rem 1rem;
  }

  .home-container {
    grid-template-columns: 1fr 1fr;
    text-align: left;
    gap: 1.5rem;
  }

  [dir="rtl"] .home-container {
    text-align: right;
  }

  .home-content {
    order: 1;
  }

  .home-visual {
    order: 2;
  }

  .home-avatar-wrapper {
    width: 120px;
    height: 120px;
  }

  .home-actions {
    margin-bottom: 0.75rem;
  }

  .section-view {
    padding: 1rem 1.25rem;
  }

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

  .main-nav {
    padding: 1rem 0;
  }

  .nav-brand--avatar {
    padding-bottom: 0.5rem;
  }

  .nav-brand-avatar-ring {
    width: 48px;
    height: 48px;
    margin-bottom: 0.4rem;
  }

  .nav-brand-avatar {
    width: 42px;
    height: 42px;
  }

  .command-palette-overlay {
    padding-top: 2vh;
  }

  .command-palette-results {
    max-height: 40vh;
  }
}

/* Large desktop / high-resolution screens: use the extra width instead of leaving it empty */
@media (min-width: 1600px) {
  .home-container {
    max-width: 1800px;
  }

  .about-container,
  .resume-container,
  .contact-container {
    max-width: 1600px;
  }

  .skills-grid,
  .services-grid {
    max-width: 1700px;
  }

  .projects-container {
    max-width: 1800px;
  }

  .section-view {
    padding: 3rem 4rem;
  }
}

@media (min-width: 2000px) {
  .home-container {
    max-width: 2200px;
  }

  .about-container,
  .resume-container,
  .contact-container {
    max-width: 1900px;
  }

  .skills-grid,
  .services-grid,
  .projects-container {
    max-width: 2100px;
  }

  .section-view {
    padding: 3rem 6rem;
  }
}

/* Touch devices: ensure comfortable tap targets, no hover-only affordances relied on */
@media (hover: none) and (pointer: coarse) {
  .nav-link {
    padding: 0.85rem 1.5rem;
  }

  .nav-theme-toggle,
  .nav-lang-toggle,
  .mobile-toggle,
  .project-modal-close {
    min-width: 44px;
    min-height: 44px;
  }

  .btn {
    min-height: 44px;
  }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-accent { color: var(--accent-primary); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }
.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;
}

