:root {
  --bg: #0b1120;
  --bg-alt: #101a30;
  --surface: #16223c;
  --border: #24304d;
  --text: #e8edf7;
  --text-muted: #9aa8c4;
  --primary: #5b8cff;
  --primary-hover: #4378f5;
  --gradient: linear-gradient(135deg, #5b8cff, #9a5bff);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --font-ar: "Tajawal", sans-serif;
  --font-en: "Inter", sans-serif;
}

html[data-theme="light"] {
  --bg: #f5f8ff;
  --bg-alt: #eaf0fb;
  --surface: #ffffff;
  --border: #dbe3f2;
  --text: #14203a;
  --text-muted: #5a6a89;
  --primary: #2f6bf5;
  --primary-hover: #2459d1;
  --gradient: linear-gradient(135deg, #2f6bf5, #7a3df0);
  --shadow: 0 10px 30px rgba(30, 60, 130, 0.12);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ar);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background 0.3s ease, color 0.3s ease;
}

html[dir="ltr"] body {
  font-family: var(--font-en);
}

.container {
  width: min(1120px, 90%);
  margin-inline: auto;
}

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

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

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.logo {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.5px;
}

.main-nav {
  display: flex;
  gap: 8px;
}

.main-nav a {
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
}

.main-nav a:hover {
  color: var(--text);
  background: var(--surface);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  font-family: inherit;
  transition: background 0.2s, transform 0.15s, border-color 0.2s;
}

.icon-btn:hover {
  background: var(--bg-alt);
  border-color: var(--primary);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-sun {
  display: none;
}

html[data-theme="light"] .icon-sun {
  display: block;
}

html[data-theme="light"] .icon-moon {
  display: none;
}

.menu-btn {
  display: none;
}

/* ===== Hero ===== */
.hero {
  padding: 90px 0 70px;
  background:
    radial-gradient(600px 300px at 85% 10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent),
    radial-gradient(500px 280px at 10% 90%, color-mix(in srgb, #9a5bff 14%, transparent), transparent);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 48px;
}

.hero-greeting {
  color: var(--primary);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.hero-name {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.2;
}

.hero-role {
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  color: var(--text-muted);
  font-weight: 500;
  margin: 10px 0 18px;
}

.hero-bio {
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 13px 28px;
  border-radius: 12px;
  font-weight: 700;
  font-family: inherit;
  transition: background 0.2s, transform 0.15s, border-color 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-primary:hover {
  filter: brightness(1.1);
}

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

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

/* Code card */
.code-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  direction: ltr;
  text-align: left;
  font-family: "Consolas", "Courier New", monospace;
}

.code-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.code-file {
  margin-inline-start: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.code-card-body {
  padding: 22px;
  font-size: 0.92rem;
  line-height: 1.8;
  overflow-x: auto;
}

.c-key { color: #ff7ab2; }
.c-str { color: #7ee787; }
.c-fn { color: #79b8ff; }

html[data-theme="light"] .c-key { color: #c026d3; }
html[data-theme="light"] .c-str { color: #15803d; }
html[data-theme="light"] .c-fn { color: #1d4ed8; }

/* ===== Sections ===== */
.section {
  padding: 80px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 800;
  text-align: center;
}

.section-sub {
  text-align: center;
  color: var(--text-muted);
  margin: 8px 0 44px;
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 24px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.about-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

.about-icon {
  font-size: 2rem;
  margin-bottom: 14px;
}

.about-card h3 {
  margin-bottom: 10px;
  font-size: 1.15rem;
}

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

/* Skills */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.skill-chip {
  padding: 11px 24px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.95rem;
  transition: border-color 0.2s, color 0.2s, transform 0.15s;
}

.skill-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-3px);
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 26px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

.project-thumb {
  position: relative;
  aspect-ratio: 800 / 520;
  background: var(--surface);
  overflow: hidden;
}

.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.project-card:hover .project-thumb img {
  transform: scale(1.04);
}

.project-badge {
  position: absolute;
  top: 14px;
  inset-inline-start: 14px;
  background: var(--bg);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.project-body {
  padding: 24px;
}

.project-body h3 {
  font-size: 1.25rem;
  margin-bottom: 10px;
}

.project-body p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-tags span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  padding: 4px 12px;
  border-radius: 999px;
}

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
  max-width: 720px;
  margin-inline: auto;
}

.contact-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.contact-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

.contact-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.contact-card h3 {
  margin-bottom: 6px;
}

.contact-card p {
  color: var(--text-muted);
}

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

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-bio {
    margin-inline: auto;
  }

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

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

  .menu-btn {
    display: inline-flex;
  }

  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px 20px;
    display: none;
  }

  .main-nav.open {
    display: flex;
  }

  .main-nav a {
    border-radius: 10px;
  }
}
