/* ==========================================
   ZAHEM PORTFOLIO — MAIN STYLESHEET
   Deep Dark Mode | Teal Accent | .NET Purple
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── CSS Variables ── */
:root {
  --bg-primary: #0d0d0d;
  --bg-secondary: #121212;
  --bg-card: #1a1a1a;
  --bg-card-hover: #1f1f1f;
  --bg-overlay: rgba(13, 13, 13, 0.85);

  --teal: #00bfa5;
  --teal-dim: rgba(0, 191, 165, 0.12);
  --teal-glow: rgba(0, 191, 165, 0.35);
  --teal-dark: #00897b;

  --purple: #512BD4;
  --purple-glow: rgba(81, 43, 212, 0.6);
  --purple-soft: rgba(81, 43, 212, 0.25);

  --text-primary: #f0f0f0;
  --text-secondary: #a0a0a0;
  --text-muted: #5a5a5a;

  --border: rgba(255, 255, 255, 0.07);
  --border-teal: rgba(0, 191, 165, 0.3);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-card: 0 4px 30px rgba(0, 0, 0, 0.5);
  --shadow-teal: 0 0 24px var(--teal-glow);
  --shadow-purple: 0 0 40px var(--purple-glow), 0 0 80px rgba(81, 43, 212, 0.3);

  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);

  /* Surfaces referenced by the theme system (overridden in light mode) */
  --nav-bg: rgba(13, 13, 13, 0.7);
  --nav-bg-scrolled: rgba(13, 13, 13, 0.95);
  --tag-bg: rgba(255, 255, 255, 0.05);
  --skeleton-a: #1f1f1f;
  --skeleton-b: #2a2a2a;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--teal);
  border-radius: 999px;
}

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

/* ── Navigation ── */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 18px 0;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

#navbar.scrolled {
  padding: 12px 0;
  background: var(--nav-bg-scrolled);
  border-bottom-color: var(--border-teal);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--teal);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.nav-logo span {
  color: var(--text-primary);
}

.nav-links {
  display: flex;
  gap: 36px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: var(--transition);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--teal);
  border-radius: 999px;
  transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--teal);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 999px;
  transition: var(--transition);
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Section Shared ── */
section {
  position: relative;
  z-index: 1;
}

.section-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

.section-header {
  text-align: center;
  margin-bottom: 72px;
}

.section-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--teal);
  background: var(--teal-dim);
  border: 1px solid var(--border-teal);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.section-title {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -1px;
}

.section-title span {
  color: var(--teal);
}

.section-line {
  width: 52px;
  height: 3px;
  background: linear-gradient(to right, var(--teal), transparent);
  border-radius: 999px;
  margin: 16px auto 0;
}

/* ── Hero Section ── */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 0 80px;
  position: relative;
  overflow: hidden;
}

/* Animated background grid */
.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 191, 165, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 191, 165, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 100%);
  animation: grid-drift 20s ease-in-out infinite alternate;
}

@keyframes grid-drift {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-20px);
  }
}

/* Ambient orbs */
.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
}

.hero-orb-1 {
  width: 500px;
  height: 500px;
  background: rgba(0, 191, 165, 0.07);
  top: -100px;
  right: -100px;
  animation: orb-float 8s ease-in-out infinite;
}

.hero-orb-2 {
  width: 400px;
  height: 400px;
  background: rgba(81, 43, 212, 0.08);
  bottom: -80px;
  left: -80px;
  animation: orb-float 10s ease-in-out infinite reverse;
}

@keyframes orb-float {

  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-30px) scale(1.05);
  }
}

.hero-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}

/* Hero Text */
.hero-content {
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--teal);
  background: var(--teal-dim);
  border: 1px solid var(--border-teal);
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 28px;
  animation: fadeInUp 0.6s 0.1s both;
}

.hero-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 var(--teal-glow);
  }

  50% {
    box-shadow: 0 0 0 6px transparent;
  }
}

.hero-name {
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -2px;
  margin-bottom: 12px;
  animation: fadeInUp 0.6s 0.2s both;
}

.hero-name .teal {
  color: var(--teal);
}

.hero-role {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: var(--text-secondary);
  margin-bottom: 24px;
  animation: fadeInUp 0.6s 0.3s both;
}

.hero-role .typed-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--teal);
  margin-left: 2px;
  vertical-align: middle;
  animation: blink 1s step-end infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

.hero-description {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 480px;
  margin-bottom: 40px;
  line-height: 1.8;
  animation: fadeInUp 0.6s 0.4s both;
}

.hero-cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  animation: fadeInUp 0.6s 0.5s both;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  border: 2px solid transparent;
  letter-spacing: 0.2px;
  position: relative;
  overflow: hidden;
}

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

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent);
  opacity: 0;
  transition: var(--transition);
}

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

.btn-primary:hover::before {
  opacity: 1;
}

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

.btn-outline:hover {
  border-color: var(--teal);
  color: var(--teal);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 191, 165, 0.15);
}

/* Hero Image */
.hero-image {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  animation: fadeInUp 0.7s 0.3s both;
}

.profile-ring {
  position: relative;
  width: 340px;
  height: 340px;
  border-radius: 50%;
}

.profile-ring::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(var(--teal), var(--purple), var(--teal));
  animation: spin 6s linear infinite;
  z-index: 0;
}

.profile-ring::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--bg-primary);
  z-index: 1;
}

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

.profile-pic {
  position: absolute;
  inset: 8px;
  z-index: 2;
  border-radius: 50%;
  object-fit: cover;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  cursor: pointer;
  transition: box-shadow 0.5s ease, transform 0.4s ease;
  display: block;
}

.profile-pic:hover {
  box-shadow: var(--shadow-purple);
  transform: scale(1.03);
}

/* Floating badges around profile */
.floating-badge {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-card);
  z-index: 10;
  animation: float-badge 4s ease-in-out infinite;
  white-space: nowrap;
}

.floating-badge-1 {
  top: 15%;
  right: -20px;
  animation-delay: 0s;
}

.floating-badge-2 {
  bottom: 20%;
  left: -30px;
  animation-delay: 2s;
}

.floating-badge .badge-icon {
  font-size: 1.1rem;
}

@keyframes float-badge {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* Stats row */
.hero-stats {
  display: flex;
  gap: 40px;
  margin-top: 40px;
  animation: fadeInUp 0.6s 0.6s both;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--teal);
  letter-spacing: -1px;
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ── Skills Section ── */
#skills {
  padding: 120px 0;
  background: var(--bg-primary);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.skill-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--teal), transparent);
  opacity: 0;
  transition: var(--transition);
}

.skill-card:hover {
  border-color: var(--border-teal);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.skill-card:hover::before {
  opacity: 1;
}

.skill-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.skill-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--teal-dim);
  border: 1px solid var(--border-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.skill-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

.skill-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: var(--transition);
}

.skill-tag:hover {
  background: var(--teal-dim);
  border-color: var(--border-teal);
  color: var(--teal);
}

/* ── Projects Section ── */
#projects {
  padding: 120px 0;
  background: var(--bg-secondary);
}

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

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
}

.project-card:hover {
  transform: scale(1.03) translateY(-6px);
  border-color: var(--border-teal);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 191, 165, 0.08);
}

.project-image-wrap {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
}

.project-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

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

.project-image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(26, 26, 26, 0.95) 100%);
}

.project-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.project-description {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 18px;
  flex: 1;
}

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

.project-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--teal-dim);
  border: 1px solid var(--border-teal);
  color: var(--teal);
  font-weight: 500;
}

/* Loading state: shimmer skeleton cards (markup built in app.js).
   When Firestore is empty or unreachable, built-in default projects render —
   visitors never see an empty or broken projects grid. */

/* ── Contact Section ── */
#contact {
  padding: 120px 0;
  background: var(--bg-secondary);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 64px;
  align-items: start;
}

.contact-info-block {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.contact-info-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.contact-info-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 20px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: var(--transition);
}

.contact-item:hover {
  border-color: var(--border-teal);
  transform: translateX(6px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.contact-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--teal-dim);
  border: 1px solid var(--border-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.contact-item-text {
  flex: 1;
}

.contact-item-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.contact-item-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
}

.social-links {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.social-link {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--text-secondary);
  transition: var(--transition);
}

.social-link:hover {
  border-color: var(--border-teal);
  color: var(--teal);
  transform: translateY(-3px);
  box-shadow: var(--shadow-teal);
}

/* Contact Form */
.contact-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  position: relative;
  overflow: hidden;
}

.contact-form::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--teal), var(--purple));
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.form-input,
.form-textarea {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  outline: none;
  transition: var(--transition);
  resize: none;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 191, 165, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-submit {
  width: 100%;
  padding: 15px;
  background: var(--teal);
  color: #000;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.form-submit:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-teal);
}

.form-submit:active {
  transform: translateY(0);
}

.form-status {
  text-align: center;
  font-size: 0.85rem;
  margin-top: 12px;
  min-height: 20px;
  transition: var(--transition);
}

.form-status.success {
  color: var(--teal);
}

.form-status.error {
  color: #ef5350;
}

/* ── Field-level validation (from app.js showFieldError) ── */
.input-error {
  border-color: #ef5350 !important;
  box-shadow: 0 0 0 3px rgba(239, 83, 80, 0.15) !important;
}

.field-error-msg {
  display: block;
  font-size: 0.78rem;
  color: #ef5350;
  margin-top: 5px;
  padding-left: 2px;
  animation: fadeInUp 0.25s ease both;
}

/* ── Footer ── */
footer {
  padding: 40px 20px;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  background: var(--bg-primary);
  cursor: default;
  user-select: none;
}

footer a {
  color: var(--teal);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.footer-tagline {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.footer-name {
  color: var(--text-secondary);
}

.footer-copy {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Admin Panel: full-screen CMS workspace ── */
#admin-panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: var(--bg-primary);
  overflow-y: auto;
}

#admin-panel.visible {
  display: block;
}

.admin-form .form-submit {
  margin-top: 8px;
}

.admin-status {
  text-align: center;
  margin-top: 12px;
  font-size: 0.85rem;
  min-height: 20px;
}

.admin-status.success {
  color: var(--teal);
}

.admin-status.error {
  color: #ef5350;
}

/* ── Scroll Reveal Animations ── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

/* ── Responsive ── */
@media (max-width: 900px) {
  .hero-container {
    grid-template-columns: 1fr;
    gap: 60px;
    text-align: center;
  }

  .hero-content {
    order: 2;
  }

  .hero-image {
    order: 1;
  }

  .hero-description {
    margin: 0 auto 40px;
  }

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

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

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .profile-ring {
    width: 260px;
    height: 260px;
  }

  .floating-badge-1 {
    display: none;
  }

  .floating-badge-2 {
    display: none;
  }
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--nav-bg-scrolled);
    backdrop-filter: blur(20px);
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    padding: 0;
    align-items: center;
  }

  .nav-links.open {
    max-height: 400px;
    padding: 16px 0;
    gap: 4px;
  }

  .nav-links li a {
    padding: 12px 24px;
    display: block;
    width: 100%;
    text-align: center;
  }

  .hamburger {
    display: flex;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .section-wrapper {
    padding: 0 20px;
  }

  .hero-container {
    padding: 0 20px;
  }

  .contact-form {
    padding: 28px 24px;
  }

}

@media (max-width: 500px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }

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

/* ── Admin-only: Edit/Delete buttons (Firebase-Auth-driven visibility) ── */

/*
  The edit/delete buttons are ALWAYS present in the DOM for every project
  card. CSS hides them by default and reveals them only when
  body.admin-unlocked is set by handleAuthStateChanged() in app.js —
  i.e. only after Firebase Auth verifies the signed-in UID. No re-render.
*/
.delete-project-btn,
.edit-project-btn {
  display: none;
  /* hidden for all regular visitors */
}

/* Visible only after Firebase Auth verifies the admin UID */
body.admin-unlocked .delete-project-btn,
body.admin-unlocked .edit-project-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-end;
  margin-bottom: 12px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.35);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.3px;
  line-height: 1;
}

body.admin-unlocked .delete-project-btn:hover {
  background: rgba(255, 107, 107, 0.22);
  border-color: rgba(255, 107, 107, 0.7);
  box-shadow: 0 0 14px rgba(255, 107, 107, 0.3);
  color: #ff4f4f;
  transform: translateY(-1px);
}

body.admin-unlocked .delete-project-btn:active {
  transform: scale(0.96);
  box-shadow: none;
}

/* Logout button */
.admin-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.2px;
}

.admin-logout:hover {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.08);
}

/* Edit button — same layout as delete, teal accent */
body.admin-unlocked .edit-project-btn {
  color: var(--teal);
  background: rgba(0, 191, 165, 0.1);
  border-color: rgba(0, 191, 165, 0.35);
}

body.admin-unlocked .edit-project-btn:hover {
  background: rgba(0, 191, 165, 0.22);
  border-color: rgba(0, 191, 165, 0.7);
  box-shadow: 0 0 14px rgba(0, 191, 165, 0.3);
  color: var(--teal);
  transform: translateY(-1px);
}

/* ── Auth/UI helpers ── */

/* Native hidden attribute always wins (admin views, modal, image group) */
[hidden] {
  display: none !important;
}

/* Honeypot — invisible to humans, auto-filled by bots */
.hp-field {
  position: absolute !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Prevent text-selection flicker while triple-clicking the logo */
.nav-logo {
  user-select: none;
  -webkit-user-select: none;
}

/* ════════════════════════════════════════════════════════════════
   CONTENT UPGRADE — About / Services / Process / Timeline /
   Enhanced project cards / Skeletons / Hero additions
   ════════════════════════════════════════════════════════════════ */

/* ── Anchor offset so sections never hide under the fixed navbar ── */
section[id] {
  scroll-margin-top: 80px;
}

/* 7 navbar links need a tighter gap on mid-size screens */
@media (max-width: 1100px) {
  .nav-links {
    gap: 20px;
  }
}

/* ── Hero additions: static headline ── */
.hero-headline {
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 10px;
  animation: fadeInUp 0.6s 0.28s both;
}

.hero-headline .teal {
  color: var(--teal);
}

/* SVG icon sizing inside previously emoji-based icon boxes */
.skill-icon svg,
.badge-icon svg {
  width: 20px;
  height: 20px;
  color: var(--teal);
}

.contact-item-icon svg {
  color: var(--teal);
}

/* ── About Section ── */
#about {
  padding: 120px 0;
  background: var(--bg-secondary);
}

.about-content {
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
}

.about-lead {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.9;
}

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

.about-lead .about-ar {
  color: var(--teal);
  font-weight: 600;
}

.about-badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0;
}

.badge-bilingual {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--teal-dim);
  border: 1px solid var(--border-teal);
  color: var(--teal);
}

.about-facts {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
}

.fact-chip {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 999px;
}

.fact-chip strong {
  color: var(--text-primary);
  font-weight: 600;
}

.about-cta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 32px;
}

/* ── Services Section ── */
#services {
  padding: 120px 0;
  background: var(--bg-primary);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--teal), transparent);
  opacity: 0;
  transition: var(--transition);
}

.service-card:hover {
  border-color: var(--border-teal);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.service-card:hover::before {
  opacity: 1;
}

.service-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--teal-dim);
  border: 1px solid var(--border-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  margin-bottom: 22px;
}

.service-icon svg {
  width: 22px;
  height: 22px;
}

.service-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.service-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 16px;
}

.service-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.services-cta {
  text-align: center;
  margin-top: 48px;
}

.services-cta-note {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Process Section (How I Work) ── */
#process {
  padding: 120px 0;
  background: var(--bg-secondary);
}

.process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.process-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: var(--transition);
}

.process-step:hover {
  border-color: var(--border-teal);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.process-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--teal);
  background: var(--teal-dim);
  border: 1px solid var(--border-teal);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.process-step-title {
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.process-step-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Experience Timeline ── */
#experience {
  padding: 120px 0;
  background: var(--bg-primary);
}

.timeline {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding-left: 40px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(to bottom, var(--teal), var(--purple), transparent);
  opacity: 0.5;
}

.timeline-item {
  position: relative;
  padding-bottom: 44px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -40px;
  top: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 3px solid var(--teal);
  box-shadow: 0 0 0 4px var(--teal-dim);
}

.timeline-item:nth-child(even) .timeline-dot {
  border-color: var(--purple);
  box-shadow: 0 0 0 4px var(--purple-soft);
}

.timeline-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--teal-dim);
  border: 1px solid var(--border-teal);
  color: var(--teal);
  margin-bottom: 12px;
}

.timeline-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.timeline-org {
  font-size: 0.88rem;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 8px;
}

.timeline-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Project card additions: role line + demo/source links ── */
.project-role {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  color: var(--teal);
  margin: -4px 0 10px;
  letter-spacing: 0.3px;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid var(--border-teal);
  color: var(--teal);
  background: var(--teal-dim);
}

.project-link:hover {
  background: rgba(0, 191, 165, 0.22);
  transform: translateY(-1px);
}

.project-link svg {
  width: 13px;
  height: 13px;
}

.project-link--ghost {
  color: var(--text-secondary);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.project-link--ghost:hover {
  color: var(--text-primary);
  border-color: var(--border-teal);
}

/* ── Skeleton loading states (no layout shift while Firestore loads) ── */
.project-skeleton {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.skeleton-block {
  background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 50%, var(--skeleton-a) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
  border-radius: var(--radius-sm);
}

.skeleton-image {
  aspect-ratio: 16/9;
  border-radius: 0;
}

.skeleton-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-line {
  height: 14px;
}

.skeleton-line.w-90 { width: 90%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-40 { width: 40%; }

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* ── Responsive tweaks for the new sections ── */
@media (max-width: 900px) {
  .timeline {
    padding-left: 34px;
  }

  .timeline-dot {
    left: -34px;
  }

  .services-cta .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ════════════════════════════════════════════════════════════════
   CMS DASHBOARD + LAYOUT REFINEMENTS
   ════════════════════════════════════════════════════════════════ */

/* ── Screen-reader-only text (Arabic SEO anchor, never visible) ── */
.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;
}

/* ── Balanced 2x2 grids: 4 service cards / 4 skill categories ── */
.services-grid,
.skills-grid {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 900px) {
  .services-grid,
  .skills-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Full-screen CMS workspace layout ── */
.cms-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.cms-login .admin-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-card);
}

.cms-login h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.cms-login h2 span {
  color: var(--teal);
}

.cms-login-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.cms-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.cms-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
}

.cms-brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 28px;
  padding: 0 8px;
}

.cms-brand span {
  color: var(--teal);
}

.cms-brand strong {
  color: var(--text-secondary);
  font-weight: 600;
  margin-left: 4px;
}

.cms-sidebar-foot {
  margin-top: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 0 8px;
}

.cms-main {
  min-width: 0;
}

.cms-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 28px;
  background: var(--nav-bg-scrolled);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.cms-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cms-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.2px;
}

.cms-btn:hover {
  color: var(--teal);
  border-color: var(--border-teal);
}

.cms-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--tag-bg);
}

.cms-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.cms-status-badge.cms-status-online .cms-status-dot {
  background: #2ecc71;
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.7);
}

.cms-status-badge.cms-status-offline .cms-status-dot {
  background: #ef5350;
  box-shadow: 0 0 8px rgba(239, 83, 80, 0.7);
}

.cms-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

.admin-thumb {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.admin-sync {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--teal);
  background: var(--teal-dim);
  border: 1px solid var(--border-teal);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.2px;
}

.admin-sync:hover {
  background: rgba(0, 191, 165, 0.22);
  transform: translateY(-1px);
}

.admin-sync:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}

/* ── CMS sidebar navigation ── */
.cms-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.2px;
}

.admin-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.admin-tab:hover {
  color: var(--teal);
  background: var(--tag-bg);
}

.admin-tab.active {
  background: var(--teal-dim);
  border-color: var(--border-teal);
  color: var(--teal);
}

.admin-tab-panel {
  animation: fadeInUp 0.3s ease both;
}

.admin-section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin: 22px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}

.admin-section-label:first-of-type {
  margin-top: 0;
}

.stats-config {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* ── CMS document lists ── */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 26px;
}

.admin-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.admin-list-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-list-info strong {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.admin-list-info span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-list-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.admin-row-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 10px;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.admin-row-btn:hover:not(:disabled) {
  color: var(--teal);
  border-color: var(--border-teal);
}

.admin-row-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.admin-row-danger:hover:not(:disabled) {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.5);
}

.admin-list-empty {
  text-align: center;
  padding: 26px 20px;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.7;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

/* ── CMS form actions ── */
.admin-form-actions {
  display: flex;
  gap: 10px;
}

.admin-form-actions .form-submit {
  flex: 1;
}

.admin-cancel-btn {
  background: transparent !important;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border);
}

.admin-cancel-btn:hover {
  box-shadow: none !important;
  transform: none !important;
  color: var(--text-primary) !important;
}

/* ── CMS responsive ── */
@media (max-width: 768px) {
  .stats-config {
    grid-template-columns: 1fr;
  }

  .admin-list-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ════════════════════════════════════════════════════════════════
   THEME SYSTEM (dark default / light) + WHATSAPP CTA + TOASTS
   ════════════════════════════════════════════════════════════════ */

/* Smooth swap while the theme toggles (class removed after 350 ms) */
html.theme-anim,
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition: background-color 0.3s ease, color 0.3s ease,
    border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* ── Light theme: soft slate surfaces, crisp dark typography ── */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --border: rgba(15, 23, 42, 0.1);
  --border-teal: rgba(20, 184, 166, 0.4);

  --teal-dim: rgba(20, 184, 166, 0.1);
  --purple-soft: rgba(99, 102, 241, 0.12);

  --nav-bg: rgba(248, 250, 252, 0.8);
  --nav-bg-scrolled: rgba(255, 255, 255, 0.95);
  --tag-bg: rgba(15, 23, 42, 0.05);
  --skeleton-a: #e2e8f0;
  --skeleton-b: #f1f5f9;

  --shadow-card: 0 4px 24px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] body::before {
  opacity: 0.15;
}

[data-theme="light"] .form-input,
[data-theme="light"] .form-textarea {
  background: #f8fafc;
}

[data-theme="light"] .skill-card:hover,
[data-theme="light"] .service-card:hover,
[data-theme="light"] .process-step:hover {
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .project-card:hover {
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.14), 0 0 30px rgba(20, 184, 166, 0.08);
}

[data-theme="light"] .floating-badge {
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .contact-item:hover {
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .btn-outline {
  border-color: rgba(15, 23, 42, 0.18);
}

/* ── Navbar actions group (theme toggle + hamburger) ── */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle:hover {
  color: var(--teal);
  border-color: var(--border-teal);
  transform: translateY(-1px);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* Dark mode (default): show the sun — clicking switches to light */
.theme-toggle .icon-moon {
  display: none;
}

.theme-toggle .icon-sun {
  display: block;
}

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

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

/* ── Floating WhatsApp CTA ── */
.whatsapp-cta {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1400;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25d366;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35);
  transition: var(--transition);
}

.whatsapp-cta svg {
  width: 28px;
  height: 28px;
}

.whatsapp-cta:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 32px rgba(37, 211, 102, 0.45);
}

.whatsapp-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #25d366;
  animation: whatsapp-pulse 2s ease-out infinite;
  pointer-events: none;
}

@keyframes whatsapp-pulse {

  0% {
    transform: scale(1);
    opacity: 0.7;
  }

  100% {
    transform: scale(1.55);
    opacity: 0;
  }
}

.whatsapp-tooltip {
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}

.whatsapp-cta:hover .whatsapp-tooltip,
.whatsapp-cta:focus-visible .whatsapp-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ── Toast notifications ── */
#toast-container {
  position: fixed;
  top: 84px;
  right: 20px;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-teal);
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
  font-size: 0.86rem;
  line-height: 1.5;
  cursor: pointer;
  animation: toast-in 0.25s ease both;
}

.toast-success {
  border-color: var(--border-teal);
}

.toast-error {
  border-color: rgba(239, 83, 80, 0.5);
}

.toast-info {
  border-color: var(--border);
}

.toast-icon {
  font-weight: 800;
  color: var(--teal);
  flex-shrink: 0;
}

.toast-error .toast-icon {
  color: #ef5350;
}

.toast-info .toast-icon {
  color: var(--text-secondary);
}

.toast-out {
  opacity: 0;
  transform: translateX(12px);
  transition: 0.3s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Responsive polish: CMS on mobile + WhatsApp spacing ── */
@media (max-width: 900px) {
  .cms-layout {
    grid-template-columns: 1fr;
  }

  .cms-sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }

  .cms-brand {
    margin-bottom: 0;
    white-space: nowrap;
  }

  .cms-nav {
    flex-direction: row;
    gap: 8px;
  }

  .cms-nav .admin-tab {
    width: auto;
    white-space: nowrap;
    padding: 9px 14px;
  }

  .cms-sidebar-foot {
    display: none;
  }

  .cms-content {
    padding: 24px 16px 80px;
  }

  .cms-topbar {
    padding: 12px 16px;
  }
}

@media (max-width: 768px) {
  .whatsapp-cta {
    bottom: 18px;
    right: 16px;
    width: 50px;
    height: 50px;
  }

  .whatsapp-cta svg {
    width: 24px;
    height: 24px;
  }

  .whatsapp-tooltip {
    display: none;
  }

  footer {
    padding-bottom: 88px;
  }
}