/* Layout — calm sage / soft slate theme */
:root {
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(79, 118, 109, 0.06);
  --font-sans: "Manrope", system-ui, sans-serif;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-arabic: "Cairo", "Manrope", system-ui, sans-serif;
}

html {
  scroll-behavior: smooth;
}

html.dark {
  color-scheme: dark;
}

body {
  overflow-x: clip;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  letter-spacing: -0.011em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html[dir="rtl"] body {
  font-family: var(--font-arabic);
  letter-spacing: 0;
  line-height: 1.8;
}

.font-display {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

html[dir="rtl"] .font-display {
  font-family: var(--font-arabic);
  letter-spacing: 0;
}

.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;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: auto;
  width: var(--sidebar-width);
  z-index: 60;
  background: linear-gradient(180deg, #f3f6f5 0%, #eef3f1 100%);
  border-right: 1px solid rgba(77, 118, 109, 0.12);
  transition: transform 0.3s ease;
  transform: translate3d(-100%, 0, 0);
  pointer-events: auto;
}

html[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid rgba(77, 118, 109, 0.12);
  transform: translate3d(100%, 0, 0);
}

html.dark .sidebar {
  background: linear-gradient(180deg, #1c1917 0%, #0c0a09 100%);
  border-color: rgba(126, 173, 162, 0.15);
}

/* Mobile: hidden until menu button — same for EN & AR */
@media (max-width: 1023px) {
  .sidebar.is-open {
    transform: translate3d(0, 0, 0);
  }

  html[dir="rtl"] .sidebar.is-open {
    transform: translate3d(0, 0, 0);
  }
}

/* Desktop: always visible */
@media (min-width: 1024px) {
  .sidebar,
  html[dir="rtl"] .sidebar {
    transform: none;
  }
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.75rem 1.25rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: #2a423d;
  text-decoration: none;
}

html.dark .sidebar-brand {
  color: #a8c5bc;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5f8f84, #6f8fa3);
  box-shadow: 0 4px 14px rgba(95, 143, 132, 0.2);
  flex-shrink: 0;
}

.brand-photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(77, 118, 109, 0.28);
  box-shadow: 0 4px 12px rgba(79, 118, 109, 0.14);
  display: block;
}

html.dark .brand-photo {
  border-color: rgba(126, 173, 162, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.sidebar-brand .brand-text {
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.nav-link {
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #57534e;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  text-align: start;
  display: block;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

html.dark .nav-link {
  color: #a8a29e;
}

.nav-link:hover,
.nav-link.is-active {
  background: rgba(95, 143, 132, 0.12);
  color: #3f615a;
}

html.dark .nav-link:hover,
html.dark .nav-link.is-active {
  background: rgba(126, 173, 162, 0.15);
  color: #a8c5bc;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(77, 118, 109, 0.1);
}

.btn-ghost {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 0.85rem;
  text-align: start;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 500;
  color: #57534e;
  cursor: pointer;
  transition: background 0.2s;
}

html.dark .btn-ghost {
  color: #d6d3d1;
}

.btn-ghost:hover {
  background: rgba(95, 143, 132, 0.1);
}

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(28, 25, 23, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.menu-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 1rem;
  background: rgba(250, 250, 249, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(77, 118, 109, 0.08);
}

html.dark .mobile-header {
  background: rgba(12, 10, 9, 0.9);
  border-color: rgba(126, 173, 162, 0.1);
}

.btn-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  background: rgba(95, 143, 132, 0.1);
  color: #3f615a;
  cursor: pointer;
  font-size: 1rem;
}

.lang-toggle-mobile-btn {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0;
}

html[dir="rtl"] .lang-toggle-mobile-btn {
  font-family: var(--font-arabic);
}

html.dark .btn-icon {
  color: #a8c5bc;
}

.main-content {
  min-height: 100vh;
  padding-block: calc(var(--header-height) + 2rem) 3rem;
  padding-inline: 1.25rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

@media (min-width: 1024px) {
  .mobile-header {
    display: none;
  }

  .main-content {
    margin-inline-start: var(--sidebar-width);
    margin-inline-end: 0;
    padding-block: 3rem 4rem;
    padding-inline: 2.5rem;
    width: calc(100% - var(--sidebar-width));
    max-width: 1100px;
  }
}

/* Sections */
.section {
  margin-bottom: 4.5rem;
  scroll-margin-top: calc(var(--header-height) + 1rem);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 2.65rem);
  font-weight: 800;
  margin-bottom: 1.35rem;
  background: linear-gradient(135deg, #3f615a, #5a778a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.15;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

/* Gradient clip breaks Arabic glyphs in some browsers */
html[dir="rtl"] .section-title {
  font-family: var(--font-arabic);
  letter-spacing: 0;
  line-height: 1.3;
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  -webkit-text-fill-color: currentColor;
  color: #3f615a;
}

html.dark[dir="rtl"] .section-title {
  color: #a8c5bc;
}

.section-lead {
  font-size: 1.125rem;
  line-height: 1.8;
  color: #57534e;
  max-width: 42rem;
  margin-bottom: 1.5rem;
  text-align: start;
}

html.dark .section-lead {
  color: #a8a29e;
}

/* Intro profile — above hero */
.intro-profile {
  margin-bottom: 2.75rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(77, 118, 109, 0.14);
}

html.dark .intro-profile {
  border-bottom-color: rgba(126, 173, 162, 0.16);
}

.intro-profile-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.intro-photo-wrap {
  flex-shrink: 0;
}

.intro-photo-btn {
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  border-radius: 50%;
  line-height: 0;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease;
}

@media (hover: hover) {
  .intro-photo-btn:hover {
    transform: scale(1.05);
  }

  .intro-photo-btn:hover .intro-photo {
    box-shadow: 0 14px 32px rgba(79, 118, 109, 0.22);
  }
}

.intro-photo-btn:focus-visible {
  outline: 3px solid rgba(77, 118, 109, 0.45);
  outline-offset: 3px;
}

.intro-photo,
.intro-photo-fallback {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.intro-photo {
  border: 3px solid rgba(77, 118, 109, 0.22);
  box-shadow: 0 10px 28px rgba(79, 118, 109, 0.12);
}

html.dark .intro-photo {
  border-color: rgba(126, 173, 162, 0.28);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

/* Profile photo lightbox */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.photo-lightbox[hidden] {
  display: none !important;
}

.photo-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 22, 0.72);
  backdrop-filter: blur(5px);
  animation: lightboxFade 0.2s ease;
}

.photo-lightbox-panel {
  position: relative;
  z-index: 1;
  max-width: min(520px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  animation: lightboxPop 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.photo-lightbox-img {
  display: block;
  width: min(520px, calc(100vw - 2rem));
  height: auto;
  max-height: calc(100vh - 2.5rem);
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  background: #0f1716;
}

.photo-lightbox-close {
  position: absolute;
  top: -0.55rem;
  inset-inline-end: -0.55rem;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #4d766d;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.photo-lightbox-close:hover {
  background: #3f615a;
}

body.lightbox-open {
  overflow: hidden;
}

@keyframes lightboxFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes lightboxPop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.intro-photo-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #4d766d, #5a778a);
  color: #fff;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

html[dir="rtl"] .intro-photo-fallback {
  font-family: var(--font-arabic);
  letter-spacing: 0;
}

.intro-copy {
  flex: 1;
  min-width: min(100%, 220px);
}

.intro-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #4d766d;
  margin-bottom: 0.4rem;
}

html[dir="rtl"] .intro-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
}

html.dark .intro-label {
  color: #7eada2;
}

.intro-name {
  font-size: clamp(1.65rem, 3.5vw, 2.15rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #1c1917;
  margin-bottom: 0.35rem;
}

html[dir="rtl"] .intro-name {
  font-family: var(--font-arabic);
  letter-spacing: 0;
}

html.dark .intro-name {
  color: #fafaf9;
}

.intro-role {
  font-size: 1rem;
  font-weight: 600;
  color: #3f615a;
  margin-bottom: 0.55rem;
}

html.dark .intro-role {
  color: #a8c5bc;
}

.intro-bio {
  font-size: 0.98rem;
  line-height: 1.65;
  color: #57534e;
  max-width: 34rem;
  margin-bottom: 0.9rem;
}

html.dark .intro-bio {
  color: #a8a29e;
}

.intro-meta {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.5rem;
}

.intro-meta li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: #292524;
}

html.dark .intro-meta li {
  color: #e7e5e4;
}

.intro-meta-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #78716c;
}

html[dir="rtl"] .intro-meta-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8rem;
}

html.dark .intro-meta-label {
  color: #a8a29e;
}

@media (max-width: 520px) {
  .intro-profile-inner {
    gap: 1.15rem;
  }

  .intro-photo,
  .intro-photo-fallback {
    width: 88px;
    height: 88px;
  }

  .intro-photo-fallback {
    font-size: 1.9rem;
  }
}

/* Hero */
.hero-section {
  padding-top: 0.5rem;
}

.hero-eyebrow {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #4d766d;
  margin-bottom: 0.9rem;
}

html[dir="rtl"] .hero-eyebrow {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

html.dark .hero-eyebrow {
  color: #7eada2;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.35rem, 6.5vw, 4rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.045em;
  margin-bottom: 1.35rem;
  color: #1c1917;
  text-align: start;
  overflow-wrap: anywhere;
}

html[dir="rtl"] .hero-title {
  font-family: var(--font-arabic);
  letter-spacing: 0;
  line-height: 1.25;
  font-size: clamp(2.1rem, 5.5vw, 3.35rem);
}

html.dark .hero-title {
  color: #fafaf9;
}

.hero-subtitle {
  font-size: 1.2rem;
  line-height: 1.75;
  font-weight: 500;
  color: #57534e;
  max-width: 36rem;
  margin-bottom: 2.15rem;
  text-align: start;
}

html.dark .hero-subtitle {
  color: #a8a29e;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #4d766d, #5a778a);
  box-shadow: 0 4px 16px rgba(77, 118, 109, 0.22);
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(77, 118, 109, 0.28);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  color: #3f615a;
  border: 2px solid rgba(77, 118, 109, 0.35);
  background: transparent;
  transition: background 0.2s, border-color 0.2s;
}

html.dark .btn-secondary {
  color: #a8c5bc;
  border-color: rgba(126, 173, 162, 0.4);
}

.btn-secondary:hover {
  background: rgba(95, 143, 132, 0.08);
}

/* Projects */
.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.project-card {
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid rgba(77, 118, 109, 0.1);
  box-shadow: var(--shadow);
  transition: border-color 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
}

html.dark .project-card {
  background: #1c1917;
  border-color: rgba(126, 173, 162, 0.12);
}

@media (hover: hover) {
  .project-card:hover {
    border-color: rgba(77, 118, 109, 0.32);
    transform: translateY(-6px);
    box-shadow: 0 16px 36px rgba(79, 118, 109, 0.14);
  }

  html.dark .project-card:hover {
    border-color: rgba(126, 173, 162, 0.35);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  }
}

@media (min-width: 640px) {
  .project-card {
    grid-template-columns: 140px 1fr;
  }
}

.project-placeholder {
  aspect-ratio: 4/3;
  border-radius: 10px;
  background: linear-gradient(135deg, #e7efed, #e8eef2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #4d766d;
}

html.dark .project-placeholder {
  background: linear-gradient(135deg, #1a2e2a, #1e2a32);
  color: #a8c5bc;
}

.project-card-visual {
  aspect-ratio: 4/3;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, #eef4f2, #f2f5f7);
  display: flex;
  align-items: center;
  justify-content: center;
}

html.dark .project-card-visual {
  background: linear-gradient(135deg, #1a2e2a, #1e2a32);
}

.project-image {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  padding: 0.5rem;
  box-sizing: border-box;
}

.project-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  text-align: start;
  line-height: 1.4;
}

.project-summary {
  font-size: 0.95rem;
  line-height: 1.75;
  color: #57534e;
  margin-bottom: 0.75rem;
  text-align: start;
  overflow-wrap: anywhere;
}

html.dark .project-summary {
  color: #a8a29e;
}

.project-stack {
  font-size: 0.8rem;
  color: #3f615a;
  margin-bottom: 1rem;
}

html.dark .project-stack {
  color: #7eada2;
}

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

.link-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  background: rgba(95, 143, 132, 0.12);
  color: #3f615a;
  transition: background 0.2s;
}

html.dark .link-btn {
  background: rgba(126, 173, 162, 0.15);
  color: #a8c5bc;
}

.link-btn:hover {
  background: rgba(95, 143, 132, 0.22);
}

.link-muted {
  background: transparent;
  border: 1px solid rgba(77, 118, 109, 0.25);
}

/* About */
.about-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.about-list li {
  position: relative;
  padding-inline-start: 1.5rem;
  padding-inline-end: 0;
  line-height: 1.75;
  color: #44403c;
  text-align: start;
}

html.dark .about-list li {
  color: #d6d3d1;
}

.about-list li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5f8f84, #6f8fa3);
}

/* Services */
.services-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.service-card {
  padding: 1.25rem;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid rgba(77, 118, 109, 0.1);
  transition: border-color 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
}

html.dark .service-card {
  background: #1c1917;
  border-color: rgba(126, 173, 162, 0.1);
}

@media (hover: hover) {
  .service-card:hover {
    border-color: rgba(77, 118, 109, 0.35);
    transform: translateY(-6px);
    box-shadow: 0 14px 30px rgba(79, 118, 109, 0.12);
  }

  html.dark .service-card:hover {
    border-color: rgba(126, 173, 162, 0.35);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  }
}

.service-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  color: #2a423d;
}

html[dir="rtl"] .service-card h3 {
  font-family: var(--font-arabic);
  letter-spacing: 0;
}

html.dark .service-card h3 {
  color: #a8c5bc;
}

.service-card p {
  font-size: 0.9rem;
  line-height: 1.75;
  color: #57534e;
  text-align: start;
}

html[dir="rtl"] .service-card h3,
html[dir="rtl"] .project-stack {
  text-align: start;
}

html.dark .service-card p {
  color: #a8a29e;
}

/* Skills */
.skills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.skill-tag {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(95, 143, 132, 0.15), rgba(111, 143, 163, 0.12));
  color: #34504a;
  border: 1px solid rgba(77, 118, 109, 0.2);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

html.dark .skill-tag {
  color: #a8c5bc;
  border-color: rgba(126, 173, 162, 0.25);
}

@media (hover: hover) {
  .skill-tag:hover {
    transform: translateY(-3px) scale(1.05);
    border-color: rgba(77, 118, 109, 0.4);
    box-shadow: 0 8px 18px rgba(79, 118, 109, 0.14);
    background: linear-gradient(135deg, rgba(95, 143, 132, 0.24), rgba(111, 143, 163, 0.18));
  }

  html.dark .skill-tag:hover {
    border-color: rgba(126, 173, 162, 0.45);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
  }
}

/* Contact */
.contact-channels {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .contact-channels {
    grid-template-columns: repeat(3, 1fr);
  }
}

.channel-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  text-decoration: none;
  background: #fff;
  border: 1px solid rgba(77, 118, 109, 0.12);
  transition: border-color 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
}

html.dark .channel-card {
  background: #1c1917;
  border-color: rgba(126, 173, 162, 0.12);
}

@media (hover: hover) {
  .channel-card:hover {
    border-color: #4d766d;
    transform: translateY(-6px);
    box-shadow: 0 14px 30px rgba(79, 118, 109, 0.12);
  }

  html.dark .channel-card:hover {
    border-color: rgba(126, 173, 162, 0.4);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  }
}

.channel-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #3f615a;
}

html.dark .channel-label {
  color: #7eada2;
}

.channel-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1c1917;
  overflow-wrap: anywhere;
  word-break: normal;
}

html.dark .channel-value {
  color: #fafaf9;
}

.channel-cta {
  font-size: 0.85rem;
  color: #5a778a;
  margin-top: 0.25rem;
}

.contact-form {
  max-width: 32rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(77, 118, 109, 0.2);
  background: #fff;
  font-size: 1rem;
  color: #1c1917;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-align: start;
}

html[dir="rtl"] .form-input {
  font-family: var(--font-arabic);
}

html.dark .form-input {
  background: #1c1917;
  border-color: rgba(126, 173, 162, 0.2);
  color: #fafaf9;
}

.form-input:focus {
  outline: none;
  border-color: #4d766d;
  box-shadow: 0 0 0 3px rgba(77, 118, 109, 0.15);
}

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

.form-error {
  font-size: 0.85rem;
  color: #b65c5c;
}

.form-success {
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
  font-weight: 500;
}

html.dark .form-success {
  color: #86efac;
}

/* Scroll progress bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 100;
  transform-origin: left;
  transform: scaleX(0);
  background: linear-gradient(90deg, #4d766d, #5a778a, #6f8fa3);
  pointer-events: none;
}

html[dir="rtl"] .scroll-progress {
  transform-origin: right;
}

/* English: slightly smaller type for easier reading */
html[lang="en"] .sidebar-brand {
  font-size: 1rem;
}

html[lang="en"] .nav-link {
  font-size: 0.875rem;
}

html[lang="en"] .btn-ghost {
  font-size: 0.85rem;
}

html[lang="en"] .mobile-title {
  font-size: 0.95rem;
}

html[lang="en"] .hero-eyebrow {
  font-size: 0.8rem;
}

html[lang="en"] .hero-title {
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.35;
}

html[lang="en"] .hero-subtitle {
  font-size: 0.95rem;
  line-height: 1.7;
}

html[lang="en"] .section-title {
  font-size: clamp(1.35rem, 3.2vw, 1.75rem);
}

html[lang="en"] .section-lead {
  font-size: 0.9375rem;
  line-height: 1.7;
}

html[lang="en"] .project-title {
  font-size: 1.05rem;
}

html[lang="en"] .project-summary,
html[lang="en"] .project-stack {
  font-size: 0.875rem;
}

html[lang="en"] .service-card h3 {
  font-size: 0.95rem;
}

html[lang="en"] .service-card p {
  font-size: 0.85rem;
}

html[lang="en"] .about-list li {
  font-size: 0.9rem;
}

html[lang="en"] .skill-tag {
  font-size: 0.8rem;
}

html[lang="en"] .channel-label {
  font-size: 0.75rem;
}

html[lang="en"] .channel-value {
  font-size: 0.875rem;
}

html[lang="en"] .channel-cta,
html[lang="en"] .link-btn {
  font-size: 0.8rem;
}

html[lang="en"] .btn-primary,
html[lang="en"] .btn-secondary {
  font-size: 0.875rem;
  padding: 0.65rem 1.25rem;
}

html[lang="en"] .form-input {
  font-size: 0.9375rem;
}

html[lang="en"] .form-success {
  font-size: 0.9rem;
}

/* Project detail page */
.project-detail {
  max-width: 52rem;
}

.project-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  text-decoration: none;
}

html[dir="rtl"] .project-back {
  flex-direction: row-reverse;
}

.project-detail-cover {
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(77, 118, 109, 0.12);
}

.project-detail-hero-img {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  display: block;
}

.project-detail-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 2.85rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.035em;
  margin-bottom: 0.75rem;
  color: #1c1917;
}

html.dark .project-detail-title {
  color: #fafaf9;
}

html[dir="rtl"] .project-detail-title {
  font-family: var(--font-arabic);
  letter-spacing: 0;
  line-height: 1.3;
  background: none;
  -webkit-text-fill-color: currentColor;
  color: #3f615a;
}

html.dark[dir="rtl"] .project-detail-title {
  color: #a8c5bc;
}

.project-detail-stack {
  margin-bottom: 1rem;
}

.project-detail-actions {
  margin-bottom: 2rem;
}

.project-detail-body {
  margin-bottom: 3rem;
}

.project-detail-text {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #57534e;
  white-space: pre-line;
}

html.dark .project-detail-text {
  color: #a8a29e;
}

html[lang="en"] .project-detail-text {
  font-size: 0.95rem;
}

.project-gallery-section {
  margin-bottom: 3rem;
}

.project-gallery-title {
  margin-bottom: 1.25rem;
}

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

@media (min-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

.gallery-item {
  margin: 0;
}

.gallery-thumb-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
  transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-thumb-btn:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow);
}

.gallery-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

.gallery-caption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #57534e;
  text-align: start;
}

html.dark .gallery-caption {
  color: #a8a29e;
}

/* Lightbox — must sit above sidebar (z-index 60) and main */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(12, 10, 9, 0.94);
  padding: 4.5rem 1rem 1.5rem;
  box-sizing: border-box;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.85rem 1rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent);
  pointer-events: none;
}

.lightbox-inner {
  position: relative;
  z-index: 1;
  max-width: min(960px, 100%);
  max-height: calc(100vh - 6rem);
  text-align: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-caption {
  color: #fafaf9;
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  border: none;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  pointer-events: auto;
}

.lightbox-close {
  gap: 0.4rem;
  min-height: 48px;
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  background: #4d766d;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 1rem;
  font-weight: 700;
}

.lightbox-close:hover {
  background: #3f615a;
  transform: scale(1.04);
}

.lightbox-close-x {
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 600;
}

.lightbox-close-text {
  font-size: 0.95rem;
  font-weight: 700;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 1.75rem;
  line-height: 1;
}

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

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

html[dir="rtl"] .lightbox-toolbar {
  justify-content: flex-start;
}

html[dir="rtl"] .lightbox-prev {
  left: auto;
  right: 1rem;
}

html[dir="rtl"] .lightbox-next {
  right: auto;
  left: 1rem;
}

body.lightbox-open {
  overflow: hidden;
}
