/*
==================================================
|  Portfolio — Clean Minimal Redesign            |
|  Inspired by dahbiahmed.com                    |
==================================================
*/

/* ---- Theme Tokens ---- */
:root {
  --bg: #111111;
  --bg-subtle: #1a1a1a;
  --text: #e8e8e3;
  --text-muted: #9a9a94;
  --text-link: #c8c8c2;
  --accent: #8b5cf6;
  --border: rgba(255, 255, 255, 0.1);
  --border-light: transparent;
  --border-hover: transparent;
  --font-sans: "Instrument Sans", "Cairo", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Fraunces", "Cairo", Georgia, serif;
  --font-mono: "IBM Plex Mono", "Cairo", "Courier New", monospace;
  --page-width: 680px;
  --page-px: clamp(1.25rem, 4vw, 2rem);
  --transition: 0.25s ease;
}

[data-theme="light"] {
  --bg: #f8f8f6;
  --bg-subtle: #efefe9;
  --text: #1a1a1a;
  --text-muted: #6b6b65;
  --text-link: #333330;
  --border: rgba(0, 0, 0, 0.1);
  --border-light: rgba(0, 0, 0, 0.05);
  --border-hover: rgba(0, 0, 0, 0.15);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: clamp(0.95rem, 1.8vw, 1.05rem);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background var(--transition), color var(--transition), opacity 0.4s ease;
  opacity: 1;
  touch-action: pan-x pan-y;
}

.loading body {
  opacity: 0;
  pointer-events: none;
}

.fonts-loading body {
  visibility: hidden;
}

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

a {
  color: var(--text-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: opacity var(--transition);
}

a:hover {
  opacity: 0.7;
}

ul {
  list-style: none;
  padding: 0;
}

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

/* ---- Page Shell ---- */
.page {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) var(--page-px) clamp(1rem, 3vw, 2rem);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* ---- Header ---- */
.site-header {
  text-align: center;
  margin-bottom: clamp(1.2rem, 4vw, 2.2rem);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: clamp(1.2rem, 3vw, 1.8rem);
  position: relative;
}

.avatar-wrap {
  width: clamp(80px, 15vw, 120px);
  height: clamp(80px, 15vw, 120px);
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  pointer-events: none;         /* Prevent click, hover, drag, and tap events */
  -webkit-touch-callout: none;  /* Disable the callout context menu on iOS Safari */
  user-select: none;            /* Prevent image selection */
}

.header-left {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

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

.header-controls {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 0.5rem;
}

body[dir="rtl"] .header-controls {
  right: auto;
  left: 0;
}

.ctrl-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-grid;
  place-content: center;
  font-size: 0.85rem;
  transition: border-color var(--transition), opacity var(--transition);
  color: var(--text-muted);
  text-decoration: none;
}

.ctrl-btn:hover {
  border-color: var(--text-muted);
  opacity: 0.8;
  text-decoration: none;
}

.site-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.6rem;
}

.tagline {
  font-size: clamp(0.9rem, 1.6vw, 1rem);
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 560px;
  margin: 0 auto;
}

.tagline a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border);
  font-weight: 500;
}

.tagline a:hover {
  text-decoration-color: var(--text-muted);
  opacity: 1;
}



/* ---- Social Links (footer-style in header) ---- */
.social-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1rem;
}

.social-row a {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  transition: border-color var(--transition), transform var(--transition);
}

.social-row a:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
  opacity: 1;
}

.social-row img {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  transition: opacity var(--transition);
}

[data-theme="light"] .social-row img {
  filter: invert(1);
}

.social-row a:hover img {
  opacity: 1;
}

/* ---- Details / Summary Sections ---- */
.section-details {
  border-top: 1px solid var(--border);
  padding: 0;
}

.section-details:last-of-type {
  border-bottom: 1px solid var(--border);
}

.section-details summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(0.6rem, 1.5vw, 0.9rem) 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.section-details summary::-webkit-details-marker {
  display: none;
}

.section-details summary::marker {
  content: "";
}

.section-details summary h2 {
  font-family: var(--font-sans);
  font-size: clamp(0.88rem, 1.6vw, 0.95rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

.section-details summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.2s ease-out;
  margin-right: 0.8rem;
  display: inline-block;
  flex-shrink: 0;
  margin-bottom: 2px;
}

body[dir="rtl"] .section-details summary::before {
  transform: rotate(135deg);
  margin-right: 0;
  margin-left: 0.8rem;
}

.section-details[open]:not(.collapsing) > summary::before {
  transform: rotate(45deg);
}

body[dir="rtl"] .section-details[open]:not(.collapsing) > summary::before {
  transform: rotate(45deg);
}

.section-content {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.25s ease-out;
}

.section-details[open]:not(.collapsing):not(.expanding) > .section-content {
  max-height: none;
  opacity: 1;
}

.section-details.expanding > .section-content {
  opacity: 1;
}

.section-details.collapsing > .section-content {
  opacity: 0;
}

.section-inner {
  overflow: hidden;
  padding-bottom: clamp(0.8rem, 2vw, 1.2rem);
}

/* ---- Section Content Styles ---- */
.section-text {
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 1rem;
}

.section-text:last-child {
  margin-bottom: 0;
}

/* ---- Career / Experience Items ---- */
.career-list {
  display: grid;
  gap: 0;
}

.career-item {
  display: grid;
  grid-template-columns: clamp(80px, 12vw, 110px) 1fr;
  gap: clamp(1rem, 3vw, 1.6rem);
  padding: clamp(0.8rem, 2vw, 1.2rem) 0;
  border-top: 1px solid var(--border);
}

.career-item:first-child {
  border-top: none;
}

.career-date {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-top: 0.15rem;
  white-space: nowrap;
}

.career-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.career-company {
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}

.career-company a {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
}

.career-description {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.career-bullets {
  padding-left: 1rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  list-style: disc;
}

body[dir="rtl"] .career-bullets {
  padding-left: 0;
  padding-right: 1rem;
}

/* ---- Education Items (reuse career style) ---- */
.edu-item {
  padding: clamp(0.6rem, 1.5vw, 0.9rem) 0;
  border-top: 1px solid var(--border);
}

.edu-item:first-child {
  border-top: none;
}

.edu-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.edu-description {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}



/* ---- Content Creation ---- */
.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  margin-bottom: 1.4rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.video-wrap {
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}

.video-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.content-actions {
  margin-top: 1rem;
}

.content-actions a {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
}

/* ---- Services ---- */
.service-item {
  padding: clamp(0.6rem, 1.5vw, 0.9rem) 0;
  border-top: 1px solid var(--border);
}

.service-item:first-child {
  border-top: none;
}

.service-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

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

/* ---- Projects ---- */
.project-list {
  display: grid;
  gap: 0;
}

.project-item {
  display: block;
  padding: clamp(0.8rem, 2vw, 1.1rem) 0;
  border-top: 1px solid var(--border);
  text-decoration: none;
}

.project-item:first-child {
  border-top: none;
}

.project-item-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.project-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid var(--border-light);
}

.project-item-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

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

.project-item-links a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
}

.project-item-links a:hover {
  color: var(--text);
  text-decoration-color: var(--text-muted);
}

/* ---- Art Gallery ---- */
.art-grid {
  columns: 2;
  column-gap: 0.8rem;
}

.art-piece {
  margin-bottom: 0.8rem;
  break-inside: avoid;
  border-radius: 8px;
  overflow: hidden;
}

.art-piece img {
  width: 100%;
  display: block;
  transition: opacity var(--transition);
}

.art-piece:hover img {
  opacity: 0.85;
}

.art-cta {
  margin-top: 1rem;
}

.art-cta a {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
}

/* ---- Contact ---- */
.contact-text {
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.7;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.contact-links a {
  font-size: 0.88rem;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-muted);
  transition: border-color var(--transition), color var(--transition);
}

.contact-links a:hover {
  border-color: var(--text-muted);
  color: var(--text);
  opacity: 1;
}

/* ---- Footer ---- */
.site-footer {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3rem) var(--page-px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.footer-links {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0.6rem 1.2rem;
  width: 100%;
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.footer-links::-webkit-scrollbar {
  display: none;
}

.footer-links a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 0.3em;
  transition: color var(--transition), text-decoration-color var(--transition);
}

.footer-links a:hover {
  color: var(--text);
  text-decoration-color: var(--text-muted);
}

.site-footer .copyright {
  font-size: 0.82rem;
  color: var(--text-muted);
  width: 100%;
  text-align: center;
}

/* ---- Hero Details (location, phone, email) ---- */
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.4rem;
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-meta a {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
}

.hero-meta a:hover {
  color: var(--text);
  text-decoration-color: var(--text-muted);
}

/* ---- Toast Notifications ---- */
.toast-container {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  display: grid;
  gap: 0.5rem;
  z-index: 5000;
}

body[dir="rtl"] .toast-container {
  right: auto;
  left: 1.2rem;
}

.toast {
  padding: 0.7rem 1.2rem;
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.fade-out {
  opacity: 0;
  transform: translateY(-8px);
}

/* ---- Mobile Nav ---- */
.nav-toggle {
  display: none;
}

.mobile-nav {
  display: none;
}

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

/* ---- Founder Row ---- */
.founder-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.6rem;
  font-size: 0.9rem;
}

.founder-label {
  color: var(--text-muted);
  font-weight: 500;
}

.founder-projects {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.founder-project-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.founder-project-btn:hover {
  transform: translateY(-2px) scale(1.15);
  border-color: var(--border-hover);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.founder-project-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- Project Category Headers ---- */
.project-category-header {
  padding: clamp(1.2rem, 3vw, 1.8rem) 0 clamp(0.4rem, 1vw, 0.6rem);
}

.project-category-header h3 {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 600;
}

.project-category-description {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.5;
  text-transform: none;
  letter-spacing: normal;
}

.project-category-header:first-child {
  padding-top: 0;
}

/* Remove top border if immediately following a category header */
.project-category-header + .project-item {
  border-top: none;
}

/* ---- Scroll highlight animation ---- */
@keyframes projectPulse {
  0% {
    background-color: rgba(139, 92, 246, 0.15);
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.2);
  }
  100% {
    background-color: transparent;
    box-shadow: inset 0 0 0 1px transparent;
  }
}

.project-item.highlight-pulse {
  animation: projectPulse 1.5s ease-out;
  border-radius: 8px;
  padding-left: 0.6rem;
  padding-right: 0.6rem;
  margin-left: -0.6rem;
  margin-right: -0.6rem;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem 0.5rem;
    justify-items: center;
    overflow-x: visible;
  }

  .footer-links a {
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .career-item {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .career-date {
    font-size: 0.78rem;
  }

  .art-grid {
    columns: 1;
  }

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

  .stats-row {
    gap: 1rem;
  }

  .hero-meta {
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
  }
}

/* ---- Print ---- */
@media print {
  .ctrl-btn,
  .toast-container {
    display: none;
  }

  .section-details[open] > .section-content {
    grid-template-rows: 1fr;
  }
}
