:root {
  --bg-0: #0f1317;
  --bg-1: #12181d;
  --bg-2: #161d22;
  --glass: rgba(255, 255, 255, 0.06);
  --text: #d5dbe0;
  --muted: #a6b0b8;
  --accent: #8aa7b7;
  --accent-2: #5e7d8e;
  --ok: #9ec6aa;
  --warn: #c6b39e;
  --border-1: color-mix(in oklab, var(--text) 12%, transparent);
  --scrim: rgba(0,0,0,.45);
  /* Dots background tokens */
  --dots-bg-top: #0f1317;
  --dots-bg-bottom: #12181d;
  --dot-rgb: 180,190,200;
  --dot-accent-rgb: 200,60,60;
}

/* Light theme tokens */
html.theme-light {
  --bg-0: #ffffff;
  --bg-1: #ffffff;
  --bg-2: #ffffff;
  --glass: rgba(255, 255, 255, 0.95);
  --text: #1a202c;
  --muted: #718096;
  --accent: #3182ce;
  --accent-2: #2b6cb0;
  --ok: #38a169;
  --warn: #d69e2e;
  --border-1: rgba(226, 232, 240, 0.8);
  --scrim: rgba(0,0,0,.25);
  /* Light dots background */
  --dots-bg-top: #ffffff;
  --dots-bg-bottom: #ffffff;
  --dot-rgb: 30,41,59;
  --dot-accent-rgb: 15,23,42;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg-0);
  overflow-x: hidden;
  padding-top: 64px; /* keep space for fixed header */
}

/* Light mode gets a clean white background */
html.theme-light body {
  background: #ffffff;
}
/* Hide UI until intro is ready to prevent flash */
html.intro-pending body > *:not(#site-intro):not(canvas):not(.scene-vignette) { visibility: hidden; }
html.intro-done body > * { visibility: visible; }
body.no-scroll { overflow: hidden; }

html { scroll-behavior: smooth; }

/* Anchor offset no longer needed with fixed header + body padding */
:target::before { content: ""; display: block; height: 0; margin-top: 0; }

/* Nav active indicator on click */
.nav a { position: relative; }
.nav a:focus-visible::after, .nav a:hover::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 2px; opacity: .9; }

.container { width: min(1100px, 92vw); margin: 0 auto; }

#webgl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none; /* disabled 3D scene */
  z-index: -1;
  pointer-events: none;
}

/* Animated dots background */
.dots-bg { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: -1; pointer-events: none; opacity: 1; }

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  backdrop-filter: blur(12px);
  background: color-mix(in oklab, var(--bg-0) 90%, transparent);
  border-bottom: 1px solid var(--border-1);
  z-index: 25;
}

/* Light mode header gets more opacity and subtle shadow */
html.theme-light .site-header {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.nav { 
  display: flex; 
  align-items: center; 
  height: 64px; 
  gap: 16px; 
  justify-content: space-between;
}

.nav .nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav .nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand { font-weight: 800; letter-spacing: 0.6px; color: var(--text); text-decoration: none; }
.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 22px; }
.nav-links { list-style: none; display: flex; gap: 22px; margin: 0 0 0 auto; padding: 0; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--text); }

/* Language Toggle */
.lang-toggle {
  background: var(--glass);
  border: 1px solid var(--border-1);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  height: 32px;
  line-height: 1;
}

.lang-toggle:hover {
  background: color-mix(in oklab, var(--glass) 80%, var(--accent) 20%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.lang-toggle:active {
  transform: translateY(0) scale(0.95);
  transition: all 0.1s ease;
}

.lang-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}

.lang-toggle:hover::before {
  left: 100%;
}

/* Shimmer effect during language switching */
.lang-toggle.switching::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(138,167,183,0.2), transparent);
  animation: shimmer 0.6s ease-in-out;
}

@keyframes shimmer {
  0% { left: -100%; }
  50% { left: 100%; }
  100% { left: 100%; }
}

/* Language indicator positioning for mobile */
@media (max-width: 768px) {
  .lang-indicator {
    top: 80px;
    right: 12px;
    font-size: 11px;
    padding: 6px 12px;
  }
}

html[lang="ar"] .lang-toggle {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--glass);
}

/* Highlight Contact button */
.nav a.contact-cta { color: color-mix(in oklab, var(--bg-0) 95%, #000); background: linear-gradient(180deg, var(--accent), var(--accent-2)); padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border-1); }
.nav a.contact-cta:hover { filter: brightness(1.05); }

.section { padding: 88px 0; }
.section[data-dots-bg] { position: relative; overflow: visible; }
.section[data-dots-bg] .dots-local { position: absolute; inset: -60px 0 -60px 0; width: 100%; height: calc(100% + 120px); z-index: -1; pointer-events: none; }
.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; align-items: end; gap: 24px; }
.hero__content h1 { margin: 0 0 12px; }
.eyebrow { display: block; color: var(--muted); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; font-size: 12px; }
.title { display: block; font-size: clamp(32px, 5vw, 56px); font-weight: 800; letter-spacing: -0.02em; }
.subtitle { color: var(--muted); max-width: 58ch; }
.cta-row { display: flex; gap: 12px; margin-top: 18px; }

.hero__badge { display: flex; align-items: end; justify-content: flex-end; }
.badge { background: var(--glass); border: 1px solid var(--border-1); padding: 10px 14px; border-radius: 12px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; text-decoration: none; font-weight: 600; }
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: #0a0f13; }

/* Light mode button text */
html.theme-light .btn.primary { color: #ffffff; }
.btn.ghost { background: var(--glass); border: 1px solid var(--border-1); color: var(--text); }
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }

.about .split { display: grid; grid-template-columns: 1.2fr .8fr; gap: 24px; }
.panel { background: var(--glass); border: 1px solid var(--border-1); border-radius: 16px; padding: 22px; }

/* Light mode panels get better contrast and shadow */
html.theme-light .panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 232, 240, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.panel--accent { background: linear-gradient(180deg, rgba(138,167,183,.12), rgba(138,167,183,.06)); }
.traits { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 16px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { display: grid; gap: 4px; place-items: start; }
.stat .num { font-weight: 800; font-size: 28px; }
.stat .label { color: var(--muted); }

.experience h2, .work h2, .contact h2 { margin-top: 0; }
.timeline { display: grid; gap: 18px; }
.timeline-item { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start; background: var(--glass); border: 1px solid var(--border-1); border-radius: 16px; padding: 18px; }

/* Light mode timeline items */
html.theme-light .timeline-item {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(226, 232, 240, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.timeline .time { color: var(--muted); }
.timeline .content h3 { margin: 0 0 6px; }
.timeline .content ul { margin: 8px 0 0; padding-left: 18px; }

/* Timeline levels + progress connector */
.timeline { position: relative; }
.timeline { --timeline-x: -18px; }
.timeline-progress { position: absolute; left: var(--timeline-x); top: 0; bottom: 0; width: 2px; background: linear-gradient(180deg, rgba(138,167,183,.2), rgba(138,167,183,.5)); transform-origin: top; transform: scaleY(0); border-radius: 2px; }
.timeline-item { position: relative; overflow: visible; }
.timeline-item::before { display: none; }
.timeline-indicators { position: absolute; left: var(--timeline-x); top: 0; right: auto; bottom: 0; pointer-events: auto; }
.timeline-badge { position: absolute; left: -12px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text); background: linear-gradient(180deg, rgba(138,167,183,.24), rgba(138,167,183,.12)); border: 1px solid rgba(158,198,170,.5); box-shadow: 0 2px 10px rgba(0,0,0,.25); transform: scale(.95); opacity: .9; transition: transform 260ms cubic-bezier(.2,.7,.1,1), box-shadow 600ms ease, opacity 200ms ease, background 200ms ease; cursor: pointer; }
.timeline-badge.active { transform: scale(1); box-shadow: 0 0 0 10px rgba(158,198,170,0); }
.timeline-badge.open { background: linear-gradient(180deg, rgba(158,198,170,.5), rgba(158,198,170,.25)); }

/* Responsive adjustments for timeline indicators */
@media (max-width: 1024px) {
  .timeline { --timeline-x: -8px; }
}
@media (max-width: 960px) {
  .timeline { --timeline-x: 18px; padding-left: 36px; }
  .timeline-badge { left: -12px; width: 22px; height: 22px; font-size: 11px; }
}
@media (max-width: 560px) {
  .timeline { --timeline-x: 14px; padding-left: 32px; }
  .timeline-badge { left: -10px; width: 20px; height: 20px; font-size: 10px; }
}

/* Reveal-on-scroll upgrades */
.reveal { opacity: 0; transform: translateY(10px); transition: all .6s cubic-bezier(.2,.7,.1,1); }
.reveal.visible { opacity: 1; transform: translateY(0); }
.timeline-item.reveal { clip-path: inset(0 0 12% 0 round 16px); }
.timeline-item.reveal.visible { clip-path: inset(0 0 0 0 round 16px); }

/* Expandable timeline details */
.timeline-item { transition: box-shadow 300ms ease, transform 300ms ease, background 300ms ease; }
.timeline-item .content { position: relative; }
.timeline-item .content h3 { cursor: pointer; padding-right: 20px; }
.timeline-item .content h3::after { content: "▾"; position: absolute; right: 0; top: 0; color: var(--muted); transition: transform 200ms ease; }
.timeline-item.open .content h3::after { transform: rotate(180deg); }
.timeline-item .details { max-height: 0; overflow: hidden; opacity: 0; transition: max-height 500ms cubic-bezier(.2,.7,.1,1), opacity 300ms ease; border-top: 1px solid var(--border-1); margin-top: 10px; padding-top: 10px; }
.timeline-item.open { box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.timeline-item.open .details { max-height: 1200px; opacity: 1; }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.details-grid h4 { margin: 0 0 6px; font-size: 14px; letter-spacing: .02em; }
.details-grid p, .details-grid ul { margin: 0; }
@media (max-width: 960px) { .details-grid { grid-template-columns: 1fr; } }

.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.work-card { position: relative; isolation: isolate; overflow: hidden; border-radius: 16px; padding: 18px; background: linear-gradient(180deg, color-mix(in oklab, var(--text) 4%, transparent), color-mix(in oklab, var(--text) 2%, transparent)); border: 1px solid var(--border-1); text-decoration: none; color: var(--text); transform-style: preserve-3d; will-change: transform; }

/* Light mode work cards */
html.theme-light .work-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 232, 240, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.work-card::after { content: ""; position: absolute; inset: -20%; background: radial-gradient(400px 200px at var(--mx,50%) var(--my,50%), rgba(138,167,183,.12), transparent 60%); z-index: -1; transition: 200ms ease; }
.work-card:hover { transform: translateY(-2px) rotateX(3deg) rotateY(-3deg); }
.work-card__meta h3 { margin: 0 0 6px; }
.work-card__meta p { margin: 0 0 8px; color: var(--muted); }
.work-card__meta .stack { color: var(--muted); font-size: 12px; }

/* Inline expand for project cards */
.work-card { transition: box-shadow 300ms ease, background 300ms ease; }
.work-card .work-details { margin-top: 12px; color: var(--muted); display: block; max-height: 0; opacity: 0; overflow: hidden; transition: max-height 500ms cubic-bezier(.2,.7,.1,1), opacity 300ms ease; }
.work-card.expanded { background: linear-gradient(180deg, color-mix(in oklab, var(--text) 5%, transparent), color-mix(in oklab, var(--text) 3%, transparent)); box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.work-card.expanded .work-details { max-height: 1600px; opacity: 1; }
.work-grid .work-card.expanded { grid-column: 1 / -1; }
.work-details .project-meta { display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 6px 0; }
.work-details .project-meta .chip { background: var(--glass); border: 1px solid var(--border-1); }
.work-gallery { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 38vh); gap: 10px; overflow-x: auto; padding: 4px 2px; scroll-snap-type: x mandatory; margin: 6px 0 10px; }
.work-gallery img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; border: 1px solid var(--border-1); box-shadow: 0 6px 18px rgba(0,0,0,.12); scroll-snap-align: start; background: color-mix(in oklab, var(--bg-1), #000 6%); }

.contact .contact-card { background: linear-gradient(180deg, color-mix(in oklab, var(--ok) 14%, transparent), color-mix(in oklab, var(--ok) 6%, transparent)); border: 1px solid var(--border-1); border-radius: 16px; padding: 22px; }
.contact-actions { display: flex; gap: 12px; margin-top: 12px; }

.site-footer { padding: 28px 0 56px; color: var(--muted); text-align: center; }
.social-links { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 10px; }
.social { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--glass); border: 1px solid var(--border-1); color: var(--text); text-decoration: none; transition: transform 160ms ease, background 160ms ease; }
.social:hover { transform: translateY(-2px); background: color-mix(in oklab, var(--text) 9%, transparent); }
.social svg { width: 18px; height: 18px; fill: currentColor; display: block; }

.reveal { opacity: 0; transform: translateY(10px); transition: all .6s cubic-bezier(.2,.7,.1,1); }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Profile Card */
.hero { grid-template-columns: 1.1fr 0.9fr; }
.hero__profile { display: flex; justify-content: flex-end; align-items: end; }
.profile-card { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: linear-gradient(180deg, color-mix(in oklab, var(--text) 5%, transparent), color-mix(in oklab, var(--text) 3%, transparent)); border: 1px solid var(--border-1); box-shadow: 0 10px 26px rgba(0,0,0,.10); }

/* Light mode profile card */
html.theme-light .profile-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(226, 232, 240, 1);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}
.profile-img { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; border: 1px solid var(--border-1); background: color-mix(in oklab, var(--bg-1), #000 6%); }
.profile-meta { display: grid; gap: 4px; }
.profile-name { font-weight: 800; }
.profile-role { color: var(--muted); }
.profile-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 4px 8px; border-radius: 999px; background: rgba(138,167,183,.12); border: 1px solid rgba(138,167,183,.28); color: var(--text); font-size: 12px; }
.profile-tags .more { display: none; }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .about .split { grid-template-columns: 1fr; }
  .work-grid { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
  .nav-links { position: fixed; right: 16px; top: 72px; background: var(--glass); border: 1px solid var(--border-1); border-radius: 12px; padding: 12px; display: grid; gap: 8px; transform: translateY(-10px); opacity: 0; pointer-events: none; transition: 200ms ease; }
  .nav[aria-expanded="true"] .nav-links, .nav.open .nav-links { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .hero__profile { justify-content: flex-start; }
}

/* AI Widget */
.ai-button {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--border-1);
  background: radial-gradient(120px 80px at 40% 0%, rgba(138,167,183,.22), rgba(138,167,183,.10)) , var(--glass);
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(0,0,0,.25), 0 0 0 1px rgba(138,167,183,.1);
  z-index: 20;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.ai-button:hover { 
  transform: translateY(-2px) scale(1.05); 
  box-shadow: 0 8px 24px rgba(0,0,0,.3), 0 0 0 1px rgba(138,167,183,.2), 0 0 20px rgba(138,167,183,.1);
}

/* AI Hint Popover */
.ai-button.hinting { animation: pulseSoft 3.6s ease-in-out infinite; }
.ai-hint {
  position: fixed;
  right: 20px;
  bottom: 86px;
  width: min(280px, 92vw);
  background: linear-gradient(180deg, color-mix(in oklab, var(--bg-0) 92%, transparent), color-mix(in oklab, var(--bg-0) 84%, transparent));
  border: 1px solid var(--border-1);
  border-radius: 12px;
  padding: 12px 12px 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.35);
  backdrop-filter: blur(10px);
  color: var(--text);
  z-index: 25;
  opacity: 0;
  transform: translateY(6px) scale(.98);
  pointer-events: none;
  transition: opacity 280ms cubic-bezier(.2,.7,.1,1), transform 280ms cubic-bezier(.2,.7,.1,1);
  will-change: opacity, transform;
  visibility: hidden; /* Ensure it's hidden by default */
}
.ai-hint.open { 
  opacity: 1; 
  transform: translateY(0) scale(1); 
  pointer-events: auto; 
  visibility: visible; /* Show when open */
}
.ai-hint .title { font-weight: 700; display: block; margin-bottom: 4px; font-size: 14px; line-height: 1.25; letter-spacing: 0.2px; }
.ai-hint .desc { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.ai-hint .close { position: absolute; top: 6px; right: 8px; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.ai-hint::after {
  content: "";
  position: absolute;
  right: 24px;
  bottom: -8px;
  border-width: 8px 8px 0 8px;
  border-style: solid;
  border-color: var(--border-1) transparent transparent transparent;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.2));
}
.ai-hint::before {
  content: "";
  position: absolute;
  right: 24px;
  bottom: -7px;
  border-width: 8px 8px 0 8px;
  border-style: solid;
  border-color: color-mix(in oklab, var(--bg-0) 90%, transparent) transparent transparent transparent;
}

.ai-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  width: min(420px, 92vw);
  max-height: min(70vh, 640px);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  background: linear-gradient(180deg, color-mix(in oklab, var(--bg-0) 86%, transparent), color-mix(in oklab, var(--bg-0) 78%, transparent));
  border: 1px solid var(--border-1);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 28px rgba(0,0,0,.35);
  transform: translateY(12px) scale(.98);
  opacity: 0;
  pointer-events: none;
  transition: all 180ms ease;
  z-index: 20;
}
.ai-panel.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
.ai-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--glass); border-bottom: 1px solid var(--border-1); }
.ai-header span { font-weight: 700; }
.ai-close { background: none; border: none; color: var(--text); font-size: 18px; cursor: pointer; }
.ai-messages { padding: 10px 12px; overflow: auto; display: grid; gap: 10px; }
.ai-message { display: grid; gap: 6px; }
.ai-message .role { font-size: 12px; color: var(--muted); }
.ai-message .bubble { background: var(--glass); border: 1px solid color-mix(in oklab, var(--text) 12%, transparent); padding: 10px 12px; border-radius: 12px; line-height: 1.45; }
.ai-message.user .bubble { background: linear-gradient(180deg, rgba(138,167,183,.22), rgba(138,167,183,.12)); }
.ai-input { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border-1); background: color-mix(in oklab, var(--bg-1), #000 2%); }
.ai-input input { background: var(--glass); border: 1px solid var(--border-1); border-radius: 10px; padding: 10px 12px; color: var(--text); outline: none; }
.ai-input input::placeholder { color: var(--muted); }
.ai-footnote { text-align: center; color: var(--muted); font-size: 12px; padding: 6px 0 10px; }

@media (max-width: 520px) {
  .ai-panel { right: 12px; left: 12px; width: auto; }
  .ai-button { right: 12px; bottom: 12px; width: 52px; height: 52px; font-size: 22px; }
  .ai-hint { right: 12px; bottom: 72px; width: auto; left: 12px; }
  .settings-panel { left: 12px; right: 12px; width: auto; }
  .settings-button { left: 12px; bottom: 12px; width: 52px; height: 52px; font-size: 22px; }
}

/* Cursor effects */
#cursor-dot.hidden, #cursor-ring.hidden { opacity: 0; }

/* Settings Widget */
.settings-button {
  position: fixed;
  left: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--border-1);
  background: radial-gradient(120px 80px at 40% 0%, rgba(138,167,183,.22), rgba(138,167,183,.10)) , var(--glass);
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(0,0,0,.25), 0 0 0 1px rgba(138,167,183,.1);
  z-index: 20;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.settings-button:hover { 
  transform: translateY(-2px) scale(1.05); 
  box-shadow: 0 8px 24px rgba(0,0,0,.3), 0 0 0 1px rgba(138,167,183,.2), 0 0 20px rgba(138,167,183,.1);
}

.settings-panel {
  position: fixed;
  left: 20px;
  bottom: 88px;
  width: min(360px, 92vw);
  display: grid;
  grid-template-rows: auto 1fr;
  background: linear-gradient(180deg, color-mix(in oklab, var(--bg-0) 86%, transparent), color-mix(in oklab, var(--bg-0) 78%, transparent));
  border: 1px solid var(--border-1);
  border-radius: 14px;
  overflow: hidden;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 28px rgba(0,0,0,.35);
  transform: translateY(12px) scale(.98);
  opacity: 0;
  pointer-events: none;
  transition: all 180ms ease;
  z-index: 20;
}
.settings-panel.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
.settings-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--glass); border-bottom: 1px solid var(--border-1); }
.settings-header span { font-weight: 700; }
.settings-close { background: none; border: none; color: var(--text); font-size: 18px; cursor: pointer; }
.settings-body { padding: 12px; display: grid; gap: 12px; }
.setting-item { display: inline-flex; align-items: center; gap: 10px; background: var(--glass); border: 1px solid color-mix(in oklab, var(--text) 8%, transparent); border-radius: 10px; padding: 10px 12px; }
.settings-footnote { text-align: left; color: var(--muted); font-size: 12px; }

@media (max-width: 520px) {
  .settings-panel { left: 12px; right: 12px; width: auto; }
  .settings-button { left: 12px; bottom: 12px; width: 52px; height: 52px; font-size: 22px; }
}
#cursor-dot { position: fixed; width: 6px; height: 6px; border-radius: 50%; background: rgba(207,227,238,.6); mix-blend-mode: screen; pointer-events: none; z-index: 22; transition: transform 80ms ease, opacity 160ms ease; }
#cursor-ring { position: fixed; width: 32px; height: 32px; border-radius: 50%; border: 2px solid rgba(138,167,183,.35); box-shadow: inset 0 0 14px rgba(138,167,183,.10); pointer-events: none; z-index: 22; transition: transform 140ms ease, border-color 160ms ease, opacity 160ms ease; opacity: .85; }
#cursor-dot.cursor-active { transform: scale(1.15); }
#cursor-ring.cursor-active { border-color: rgba(158,198,170,.55); }
#cursor-dot.cursor-idle, #cursor-ring.cursor-idle { opacity: .22; }
#cursor-dot.hidden, #cursor-ring.hidden { opacity: 0; }

/* Approach & Skills */
.skills-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.skill-card { background: var(--glass); border: 1px solid var(--border-1); border-radius: 14px; padding: 18px; }

/* Light mode skill cards */
html.theme-light .skill-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 232, 240, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.skill-card h3 { margin: 0 0 6px; }

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

/* Case Studies */
.cases-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.case { position: relative; border-radius: 16px; overflow: hidden; cursor: pointer; border: 1px solid rgba(255,255,255,.08); background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.03)); }
.case-cover { padding: 18px; }
.case:hover { transform: translateY(-2px); }

.case-overlay { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: end; opacity: 0; pointer-events: none; transition: 180ms ease; z-index: 30; }
.case-overlay.open { opacity: 1; pointer-events: auto; }
.case-sheet { width: min(960px, 96vw); max-height: 86vh; background: linear-gradient(180deg, color-mix(in oklab, var(--bg-0) 94%, transparent), color-mix(in oklab, var(--bg-0) 88%, transparent)); border: 1px solid var(--border-1); border-radius: 16px 16px 0 0; overflow: auto; box-shadow: 0 -10px 28px rgba(0,0,0,.12); animation: sheetUp .2s ease; }
.case-header { position: sticky; top: 0; background: var(--glass); border-bottom: 1px solid var(--border-1); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.case-close { background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }
.case-body { padding: 16px; display: grid; gap: 10px; }

@keyframes sheetUp { from { transform: translateY(12px); opacity: .6; } to { transform: translateY(0); opacity: 1; }}

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

/* Animations */
@keyframes floatY { 0% { transform: translateY(0); } 50% { transform: translateY(-6px); } 100% { transform: translateY(0); } }
@keyframes shimmer { from { background-position: 0% 0%; } to { background-position: 200% 0%; } }
@keyframes pulseSoft { 0% { box-shadow: 0 0 0 0 rgba(138,167,183,.28);} 70% { box-shadow: 0 0 0 12px rgba(138,167,183,0);} 100% { box-shadow: 0 0 0 0 rgba(138,167,183,0);} }

.profile-card { animation: floatY 6s ease-in-out infinite; }
.chip { background-image: linear-gradient(90deg, rgba(138,167,183,.12), rgba(138,167,183,.28), rgba(138,167,183,.12)); background-size: 200% 100%; animation: shimmer 4s linear infinite; }
.btn.primary { animation: pulseSoft 3.6s ease-in-out infinite; }
.work-card { transition: transform 220ms ease, filter 220ms ease, box-shadow 260ms ease; }

/* Project overlay sheet (replaces inline card expansion) */
.project-overlay { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; opacity: 0; pointer-events: none; transition: 180ms ease; z-index: 40; }
.project-overlay.open { opacity: 1; pointer-events: auto; }
.project-sheet { width: min(960px, 96vw); max-height: 86vh; background: linear-gradient(180deg, color-mix(in oklab, var(--bg-0) 94%, transparent), color-mix(in oklab, var(--bg-0) 88%, transparent)); border: 1px solid var(--border-1); border-radius: 16px; overflow: auto; box-shadow: 0 10px 28px rgba(0,0,0,.12); animation: sheetUp .2s ease; }
.project-header { position: sticky; top: 0; background: var(--glass); border-bottom: 1px solid var(--border-1); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.project-close { background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }
.project-body { padding: 16px; display: grid; gap: 10px; }
.project-body h4 { margin: 10px 0 0; }

/* Project gallery */
.project-gallery { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 38vh); gap: 12px; overflow-x: auto; padding: 6px 2px; scroll-snap-type: x mandatory; }
.project-gallery img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; border: 1px solid var(--border-1); box-shadow: 0 6px 18px rgba(0,0,0,.12); scroll-snap-align: start; background: color-mix(in oklab, var(--bg-1), #000 6%); }
.project-meta { display: flex; flex-wrap: wrap; gap: 8px 10px; color: var(--muted); }
.project-meta .chip { background: var(--glass); border-color: var(--border-1); }

/* Lightbox image inside overlay */
.project-body .lightbox-img { max-width: 92vw; max-height: 80vh; width: 100%; height: auto; object-fit: contain; border-radius: 12px; border: 1px solid var(--border-1); background: color-mix(in oklab, var(--bg-1), #000 6%); display: block; margin: 8px auto; box-shadow: 0 10px 28px rgba(0,0,0,.15); }

/* Featured project */
.featured-card { position: relative; display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; padding: 18px; border-radius: 16px; border: 1px solid color-mix(in oklab, var(--text) 12%, transparent); background: linear-gradient(180deg, color-mix(in oklab, var(--text) 6%, transparent), color-mix(in oklab, var(--text) 3%, transparent)); box-shadow: 0 14px 38px rgba(0,0,0,.15); overflow: hidden; isolation: isolate; }

/* Light mode featured card */
html.theme-light .featured-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(226, 232, 240, 1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}
.featured-card::before { content: ""; position: absolute; inset: -30%; background: radial-gradient(600px 300px at 20% 0%, rgba(138,167,183,.18), transparent 60%); z-index: -1; filter: blur(6px); }
.featured-media { display: grid; gap: 10px; }
.featured-media .hero-shot { width: 100%; max-height: 380px; border-radius: 12px; border: 1px solid var(--border-1); object-fit: contain; background: color-mix(in oklab, var(--bg-1), #000 6%); box-shadow: 0 10px 28px rgba(0,0,0,.15); align-self: start; }
@media (max-width: 960px) { .featured-media .hero-shot { max-height: 300px; } }
.featured-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.featured-thumbs img { width: 100%; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border-1); cursor: pointer; opacity: .85; }
.featured-thumbs img:hover { opacity: 1; }
.featured-body { display: grid; gap: 10px; align-content: start; }
.featured-meta { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.featured-title { margin: 0; }
.featured-cta { display: inline-flex; gap: 10px; margin-top: 8px; }
.featured-cta .btn { padding: 10px 14px; }
@media (max-width: 960px) { .featured-card { grid-template-columns: 1fr; } .featured-thumbs { grid-template-columns: repeat(4, 1fr); } }

/* Remove previous expanded card visuals */
.work-card.expanded { position: static; inset: auto; transform: none; width: auto; box-shadow: none; }
.work-dim, .work-dim.open { display: none; }

.work-details { margin-top: 12px; color: var(--muted); display: none; }
.work-card.expanded .work-details { display: block; }
.work-details ul { margin: 8px 0 0; padding-left: 18px; }

.nav a { transition: color 200ms ease; }
.section.reveal.visible { transition-delay: .1s; }

/* Case sheet slight motion */
.case-sheet { animation: sheetUp .2s ease, floatY 10s ease-in-out infinite; }

/* Scene integration */
.scene-vignette { position: fixed; inset: 0; pointer-events: none; z-index: -1; background:
  radial-gradient(800px 400px at 50% 80%, rgba(10,12,14,.0), rgba(10,12,14,.25) 60%, rgba(10,12,14,.55) 100%),
  radial-gradient(1200px 600px at 10% -10%, rgba(10,12,14,.0), rgba(10,12,14,.28) 70%),
  radial-gradient(1200px 600px at 90% -10%, rgba(10,12,14,.0), rgba(10,12,14,.28) 70%);
  mix-blend-mode: normal;
}

/* Improve hero readability over scene */
.hero .title, .hero .subtitle, .eyebrow { text-shadow: 0 2px 12px rgba(0,0,0,.35); }
.profile-card { backdrop-filter: blur(12px); }

/* Active nav state */
.nav a.active { color: var(--text); }

/* Profile morph */
.profile-card { transition: transform 600ms cubic-bezier(.2,.7,.1,1), background 300ms ease, width 500ms cubic-bezier(.2,.7,.1,1), height 500ms cubic-bezier(.2,.7,.1,1), padding 400ms cubic-bezier(.2,.7,.1,1); transform-origin: 80% 80%; }
.hero__profile { position: relative; }
.profile-card .profile-img { transition: transform 600ms cubic-bezier(.2,.7,.1,1), border-radius 600ms cubic-bezier(.2,.7,.1,1), width 600ms cubic-bezier(.2,.7,.1,1), height 600ms cubic-bezier(.2,.7,.1,1); }
.profile-card.expanded-inline {
  width: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.03));
  box-shadow: 0 8px 22px rgba(0,0,0,.25);
  min-height: 240px;
  overflow: hidden;
  padding: 18px 20px;
  column-gap: 20px;
  row-gap: 8px;
  grid-template-columns: 220px 1fr;
  grid-template-areas:
    "img name"
    "img role"
    "tags tags";
  align-items: start;
  border: 1px solid var(--border-1);
  border-radius: 16px;
}
.profile-card.expanded-inline .profile-img {
  width: 200px;
  height: 200px;
  border-radius: 16px;
  grid-area: img;
  align-self: start;
  object-fit: cover;
  border: 1px solid var(--border-1);
}
.profile-card .profile-meta { transition: opacity 300ms ease; }
.profile-card.expanded-inline .profile-meta { opacity: 1; display: contents; }
.profile-card.expanded-inline .profile-name { grid-area: name; align-self: start; font-size: 20px; font-weight: 800; }
.profile-card.expanded-inline .profile-role { grid-area: role; color: var(--muted); margin-top: 2px; }
.profile-card.expanded-inline .profile-tags {
  grid-area: tags;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border-1);
}
.profile-card.expanded-inline .profile-tags .more { display: inline-flex; }
.profile-card.expanded-inline .profile-tags { margin-top: 4px; }

/* Dim background when expanded */
.profile-dim { position: fixed; inset: 0; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity 300ms ease; z-index: 24; }
.profile-dim.open { opacity: 1; pointer-events: auto; }

/* About section single-card layout (match other sections) */
#about .split { grid-template-columns: 1fr; max-width: none; margin-left: 0; margin-right: 0; }
#about .panel { border-radius: 16px; padding: 22px; background: var(--glass); box-shadow: none; }
#about h2 { margin-top: 0; }

/* Approach side-by-side panels */
.approach .split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 960px) { .approach .split { grid-template-columns: 1fr; } }

/* Education panels two-column layout */
/* Education timeline reuses experience timeline styles */
#education .timeline { display: grid; gap: 18px; }
#education .timeline-item { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start; background: var(--glass); border: 1px solid var(--border-1); border-radius: 16px; padding: 18px; }
@media (max-width: 960px) { #education .timeline-item { grid-template-columns: 1fr; } }

/* RTL Support */
html[dir="rtl"] {
  text-align: right;
}

html[dir="rtl"] .nav-links {
  margin: 0 auto 0 0;
}

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

html[dir="rtl"] .timeline-item {
  grid-template-columns: 1fr 120px;
}

html[dir="rtl"] .timeline .content h3::after {
  right: auto;
  left: 0;
}

html[dir="rtl"] .timeline-indicators {
  left: auto;
  right: var(--timeline-x);
}

html[dir="rtl"] .timeline-badge {
  left: auto;
  right: -12px;
}

/* RTL Experience Section Fixes */
html[dir="rtl"] .experience {
  text-align: right;
}

html[dir="rtl"] .experience h2 {
  text-align: right;
  margin-right: 0;
  margin-left: 0;
}

html[dir="rtl"] .timeline {
  text-align: right;
  width: 100%;
}

html[dir="rtl"] .timeline-item {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 16px;
  align-items: start;
  text-align: right;
  width: 100%;
  margin-bottom: 24px;
}

html[dir="rtl"] .timeline .content {
  text-align: right;
  padding: 20px;
  background: var(--glass);
  border: 1px solid var(--border-1);
  border-radius: 16px;
  width: 100%;
}

html[dir="rtl"] .timeline .content h3 {
  text-align: right;
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
}

html[dir="rtl"] .timeline .content ul {
  text-align: right;
  padding-right: 0;
  padding-left: 20px;
  margin: 0;
  list-style: none;
}

html[dir="rtl"] .timeline .content li {
  text-align: right;
  margin: 0 0 12px 0;
  line-height: 1.6;
  position: relative;
}

html[dir="rtl"] .timeline .content li::before {
  content: "•";
  position: absolute;
  right: -15px;
  color: var(--accent);
}

html[dir="rtl"] .timeline .content strong {
  text-align: right;
  font-weight: 600;
  color: var(--text);
}

html[dir="rtl"] .timeline .content span {
  text-align: right;
  color: var(--muted);
}

/* RTL Timeline Time */
html[dir="rtl"] .timeline .time {
  text-align: left;
  padding: 8px 12px;
  background: var(--glass);
  border: 1px solid var(--border-1);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  align-self: start;
  white-space: nowrap;
  min-width: fit-content;
}

/* RTL Panel Content */
html[dir="rtl"] .panel {
  text-align: right;
}

html[dir="rtl"] .panel h2,
html[dir="rtl"] .panel h3,
html[dir="rtl"] .panel p {
  text-align: right;
}

html[dir="rtl"] .panel ul {
  text-align: right;
  padding-right: 0;
  padding-left: 20px;
}

html[dir="rtl"] .panel li {
  text-align: right;
}

/* RTL Skills Section */
html[dir="rtl"] .skills-grid {
  text-align: right;
}

html[dir="rtl"] .skill-card {
  text-align: right;
}

html[dir="rtl"] .skill-card h3,
html[dir="rtl"] .skill-card p {
  text-align: right;
}

/* RTL Work/Project Cards */
html[dir="rtl"] .work-grid {
  text-align: right;
}

html[dir="rtl"] .work-card {
  text-align: right;
}

html[dir="rtl"] .work-card__meta h3,
html[dir="rtl"] .work-card__meta p {
  text-align: right;
}

/* RTL Story Section */
html[dir="rtl"] .story-content {
  text-align: right;
}

html[dir="rtl"] .story-card {
  text-align: right;
}

html[dir="rtl"] .story-card h3,
html[dir="rtl"] .story-card p {
  text-align: right;
}

/* RTL Contact Section */
html[dir="rtl"] .contact-card {
  text-align: right;
}

html[dir="rtl"] .contact-card h2,
html[dir="rtl"] .contact-card p {
  text-align: right;
}

/* RTL About Section */
html[dir="rtl"] .about .panel {
  text-align: right;
}

html[dir="rtl"] .about .panel h2,
html[dir="rtl"] .about .panel p {
  text-align: right;
}

/* RTL Approach Section */
html[dir="rtl"] .approach .panel {
  text-align: right;
}

html[dir="rtl"] .approach .panel h3,
html[dir="rtl"] .approach .panel p {
  text-align: right;
}

html[dir="rtl"] .approach .traits {
  text-align: right;
  padding-right: 0;
  padding-left: 20px;
}

html[dir="rtl"] .approach .traits li {
  text-align: right;
}

/* Prevent white flash on fast scroll/overscroll */
html { background-color: var(--bg-1); color-scheme: dark; }
html.theme-light { color-scheme: light; }
body { background-color: var(--bg-1); overscroll-behavior-y: contain; }

/* Brand logo zoom */
.brand { display: inline-flex; align-items: center; }
.brand-logo { height: 28px; width: auto; display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); transform-origin: 50% 50%; transition: transform 220ms cubic-bezier(.2,.7,.1,1); }
.brand:hover .brand-logo { transform: scale(1.08); }
@keyframes logoZoom { 0% { transform: scale(1); } 50% { transform: scale(1.22); } 100% { transform: scale(1); } }
.brand-logo.zoom { animation: logoZoom 450ms cubic-bezier(.2,.7,.1,1); }

/* Site intro */
.site-intro { position: fixed; inset: 0; background: radial-gradient(600px 400px at 50% 40%, color-mix(in oklab, var(--bg-0) 85%, transparent), color-mix(in oklab, var(--bg-0) 95%, transparent)), var(--bg-0); display: grid; place-items: center; z-index: 100; opacity: 0; pointer-events: none; transition: opacity 400ms ease; }
.site-intro.active { opacity: 1; pointer-events: auto; }
.intro-wrap { position: relative; width: 140px; height: 140px; display: grid; place-items: center; }
.intro-logo { width: 96px; height: 96px; object-fit: contain; filter: drop-shadow(0 8px 24px rgba(0,0,0,.45)); opacity: 0; transform: scale(.8); }
.intro-ring { position: absolute; inset: -14px; border-radius: 50%; border: 2px solid rgba(138,167,183,.45); box-shadow: 0 0 0 0 rgba(138,167,183,.2); opacity: 0; }
@keyframes introPop { 0% { transform: scale(.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes ringPulse { 0% { box-shadow: 0 0 0 0 rgba(138,167,183,.35); opacity: 1;} 70% { box-shadow: 0 0 0 28px rgba(138,167,183,0); opacity: 1;} 100% { box-shadow: 0 0 0 0 rgba(138,167,183,0); opacity: 0; } }
.site-intro.show .intro-logo { animation: introPop 520ms cubic-bezier(.2,.7,.1,1) forwards; }
.site-intro.show .intro-ring { animation: ringPulse 900ms ease-out 320ms forwards; }

/* Page entrance animation */
.page-fade { opacity: 0; transform: translateY(8px); transition: opacity 600ms cubic-bezier(.2,.7,.1,1), transform 600ms cubic-bezier(.2,.7,.1,1); }
.page-fade.show { opacity: 1; transform: none; }

/* Simple list styling for education/certs */
.list { margin: 8px 0 0; padding-left: 18px; }
.list li { margin: 6px 0; }

/* Personal Story Section */
.story-content { text-align: center; }
.story-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-top: 32px; }
.story-card { background: var(--glass); border: 1px solid var(--border-1); border-radius: 16px; padding: 24px; text-align: left; transition: transform 300ms ease, box-shadow 300ms ease; }
.story-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,.1); }
.story-icon { font-size: 48px; margin-bottom: 16px; }
.story-card h3 { margin: 0 0 12px; color: var(--text); }
.story-card p { margin: 0; color: var(--muted); line-height: 1.6; }

/* Light mode story cards */
html.theme-light .story-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 232, 240, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
  .story-grid { grid-template-columns: 1fr; gap: 16px; }
  .story-card { padding: 20px; }
}

/* Enhanced micro-interactions */
.btn { 
  transition: all 200ms ease; 
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 8px 24px rgba(0,0,0,.15); 
}

.btn:active { 
  transform: translateY(0); 
}

/* Enhanced card interactions */
.panel, .timeline-item, .work-card, .skill-card, .featured-card {
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.panel:hover, .timeline-item:hover, .work-card:hover, .skill-card:hover, .featured-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
}

/* Smooth link transitions */
a {
  transition: color 200ms ease, opacity 200ms ease;
}

a:hover {
  opacity: 0.8;
}

/* Enhanced profile card interactions */
.profile-card {
  transition: all 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-card:hover {
  transform: scale(1.05);
}

.profile-img {
  transition: transform 300ms ease;
}

.profile-card:hover .profile-img {
  transform: scale(1.1);
}

/* Chip hover effects */
.chip {
  transition: all 200ms ease;
  position: relative;
  overflow: hidden;
}

.chip::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.3s;
}

.chip:hover::before {
  left: 100%;
}

.chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Navigation hover effects */
.nav a {
  position: relative;
  transition: color 200ms ease;
}

.nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 300ms ease;
}

.nav a:hover::after {
  width: 100%;
}

/* Section reveal animations */
.page-fade {
  opacity: 0;
  transform: translateY(30px);
  transition: all 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.page-fade.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Enhanced Loading States */
.loading-skeleton {
  background: linear-gradient(90deg, var(--glass) 25%, color-mix(in oklab, var(--glass) 60%, transparent) 50%, var(--glass) 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
  border-radius: 8px;
}

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

/* Enhanced Page Transitions */
.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-0);
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-transition.active {
  transform: translateY(0);
}

/* Smooth Section Transitions */
.section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Enhanced Button Loading States */
.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: button-spin 0.8s linear infinite;
}

@keyframes button-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Enhanced Image Loading */
.image-loading {
  position: relative;
  overflow: hidden;
}

.image-loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--glass);
  animation: image-pulse 1.5s ease-in-out infinite;
}

@keyframes image-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.3; }
}

/* Smooth Scroll Progress */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 1000;
  transition: width 0.1s ease;
}

/* Enhanced Intro Animation */
.intro-logo {
  animation: logo-entrance 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes logo-entrance {
  0% {
    opacity: 0;
    transform: scale(0.8) rotate(-10deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.1) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Content Reveal Animation */
.content-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered Animation for Lists */
.stagger-item {
  opacity: 0;
  transform: translateX(-20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-item.revealed {
  opacity: 1;
  transform: translateX(0);
}

/* Enhanced Hover Effects */
.hover-lift {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 1;
  transition: opacity 0.5s ease;
}

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

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--glass);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Focus states for accessibility */
.btn:focus, .nav a:focus, .chip:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Enhanced mobile interactions */
@media (hover: none) {
  .btn:hover, .panel:hover, .timeline-item:hover, .work-card:hover, .skill-card:hover, .featured-card:hover {
    transform: none;
  }
  
  .profile-card:hover {
    transform: none;
  }
  
  .chip:hover {
    transform: none;
  }
}

/* Mobile optimization improvements */
@media (max-width: 480px) {
  .hero__content h1 {
    font-size: clamp(24px, 6vw, 32px);
  }
  
  .title {
    font-size: clamp(20px, 5vw, 28px);
  }
  
  .subtitle {
    font-size: 16px;
    line-height: 1.5;
  }
  
  .cta-row {
    flex-direction: column;
    gap: 12px;
  }
  
  .btn {
    width: 100%;
    text-align: center;
  }
  
  .nav-links {
    gap: 16px;
  }
  
  .nav a {
    font-size: 14px;
  }
  
  .timeline-item {
    padding: 16px;
  }
  
  .timeline .time {
    font-size: 12px;
  }
  
  .work-card {
    padding: 16px;
  }
  
  .featured-card {
    padding: 20px;
  }
  
  .story-card {
    padding: 16px;
  }
  
  .story-icon {
    font-size: 36px;
  }
  
  .profile-card {
    padding: 16px;
  }
  
  .profile-img {
    width: 80px;
    height: 80px;
  }
  
  .profile-tags {
    gap: 6px;
  }
  
  .chip {
    font-size: 11px;
    padding: 4px 8px;
  }
  
  .ai-panel {
    width: calc(100vw - 32px);
    max-width: 400px;
  }
  
  .settings-panel {
    width: calc(100vw - 32px);
    max-width: 300px;
  }
}

/* Touch-friendly interactions */
@media (pointer: coarse) {
  .btn, .nav a, .chip, .profile-card {
    min-height: 44px;
    min-width: 44px;
  }
  
  .nav-toggle {
    min-height: 44px;
    min-width: 44px;
  }
  
  .ai-button, .settings-button {
    min-height: 48px;
    min-width: 48px;
  }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: 60vh;
  }
  
  .hero__content {
    padding: 20px 0;
  }
  
  .section {
    padding: 40px 0;
  }
}

/* RTL Mobile Responsiveness */
@media (max-width: 768px) {
  html[dir="rtl"] .timeline-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  html[dir="rtl"] .timeline .time {
    text-align: right;
    padding: 8px 12px;
    font-size: 12px;
  }
  
  html[dir="rtl"] .timeline .content {
    padding: 16px;
  }
  
  html[dir="rtl"] .timeline .content h3 {
    font-size: 16px;
    margin-bottom: 12px;
  }
  
  html[dir="rtl"] .timeline .content ul {
    padding-right: 0;
    padding-left: 16px;
  }
  
  html[dir="rtl"] .timeline .content li {
    margin-bottom: 8px;
    font-size: 14px;
  }
  
  html[dir="rtl"] .timeline .content li::before {
    right: -12px;
  }
  
  html[dir="rtl"] .panel ul {
    padding-left: 0;
    padding-right: 20px;
  }
  
  html[dir="rtl"] .approach .traits {
    padding-left: 0;
    padding-right: 20px;
  }
}

/* Technologies marquee */
.stack h2 { margin-top: 0; text-align: center; }
.stack .muted { color: var(--muted); margin-top: -6px; text-align: center; }
.stack-marquee { position: relative; overflow: hidden; border-radius: 16px; margin-top: 16px; border: 1px solid var(--border-1); background: linear-gradient(180deg, color-mix(in oklab, var(--text) 5%, transparent), color-mix(in oklab, var(--text) 3%, transparent)); }
.stack-marquee .marquee-track { display: inline-flex; align-items: center; gap: 42px; padding: 18px 24px; animation: none; will-change: transform; }
.stack-marquee.ready .marquee-track { animation: marquee 26s linear infinite; }
.stack-logo { height: 56px; width: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); opacity: .95; transition: transform 200ms ease, opacity 200ms ease; }
.stack-logo:hover { transform: translateY(-3px) scale(1.05); opacity: 1; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
/* Next.js icon can be too dark; invert slightly for dark background */
.stack .logo-next { filter: invert(.85) brightness(1.1) drop-shadow(0 2px 6px rgba(0,0,0,.25)); }

/* Language Transition Animations */
.language-transition {
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.language-transition.transitioning {
  opacity: 0;
  transform: translateY(10px);
}

.language-transition.transitioned {
  opacity: 1;
  transform: translateY(0);
}

/* Language Toggle Button Animation */
.lang-toggle {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lang-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}

.lang-toggle:hover::before {
  left: 100%;
}

.lang-toggle:active {
  transform: scale(0.95);
}

/* Smooth RTL/LTR Transition */
html {
  transition: direction 0.3s ease;
}



/* Enhanced language indicator */
.lang-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, var(--glass), color-mix(in oklab, var(--glass) 80%, var(--accent) 20%));
  border: 1px solid var(--border-1);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  backdrop-filter: blur(10px);
  z-index: 1000;
  opacity: 0;
  transform: translateY(-20px) scale(0.9);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.lang-indicator.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: indicator-pulse 0.3s ease-out;
}

@keyframes indicator-pulse {
  0% { transform: translateY(-20px) scale(0.9); }
  50% { transform: translateY(-5px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}

.lang-indicator::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 20px;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.05), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lang-indicator.show::before {
  opacity: 1;
}



/* Mobile Navigation */
@media (max-width: 768px) {
  .nav {
    gap: 12px;
    position: relative;
  }
  
  .nav-links {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, 
      color-mix(in oklab, var(--bg-0) 95%, transparent),
      color-mix(in oklab, var(--bg-0) 90%, transparent)
    );
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-1);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 30;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  }
  
  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  .nav-links a {
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
  }
  
  .nav-links a:hover {
    background: var(--glass);
    border-color: var(--border-1);
    transform: translateX(4px);
  }
  
  .nav-links a.contact-cta {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    font-weight: 600;
    margin-top: 8px;
  }
  
  .nav-links a.contact-cta:hover {
    transform: translateX(4px) scale(1.02);
    box-shadow: 0 4px 12px rgba(138, 167, 183, 0.3);
  }
  
  .nav-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--glass);
    border: 1px solid var(--border-1);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
  }
  
  .nav-toggle:hover {
    background: color-mix(in oklab, var(--glass) 80%, var(--accent) 20%);
    transform: scale(1.05);
  }
  
  .nav-toggle.active {
    background: var(--accent);
    color: white;
  }
  
  .nav-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .lang-toggle {
    padding: 6px 12px;
    font-size: 12px;
    min-width: 50px;
    height: 28px;
  }
  
  /* Mobile menu overlay */
  .nav-overlay {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 25;
    backdrop-filter: blur(4px);
  }
  
  .nav-overlay.active {
    opacity: 1;
    visibility: visible;
  }
  
  /* Staggered animation for nav items */
  .nav-links a {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .nav-links.open a {
    opacity: 1;
    transform: translateX(0);
  }
  
  .nav-links.open a:nth-child(1) { transition-delay: 0.1s; }
  .nav-links.open a:nth-child(2) { transition-delay: 0.15s; }
  .nav-links.open a:nth-child(3) { transition-delay: 0.2s; }
  .nav-links.open a:nth-child(4) { transition-delay: 0.25s; }
}

/* Tablet Navigation */
@media (min-width: 769px) and (max-width: 1024px) {
  .nav-links {
    gap: 12px;
  }
  
  .lang-toggle {
    padding: 7px 14px;
    font-size: 12px;
    min-width: 55px;
    height: 30px;
  }
}

/* Elegant Language Transition Animations */
[data-i18n] {
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.lang-fade-in {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Staggered fade-in for different sections */
.lang-fade-in:nth-child(1) { transition-delay: 0ms; }
.lang-fade-in:nth-child(2) { transition-delay: 20ms; }
.lang-fade-in:nth-child(3) { transition-delay: 40ms; }
.lang-fade-in:nth-child(4) { transition-delay: 60ms; }
.lang-fade-in:nth-child(5) { transition-delay: 80ms; }
.lang-fade-in:nth-child(6) { transition-delay: 100ms; }
.lang-fade-in:nth-child(7) { transition-delay: 120ms; }
.lang-fade-in:nth-child(8) { transition-delay: 140ms; }
.lang-fade-in:nth-child(9) { transition-delay: 160ms; }
.lang-fade-in:nth-child(10) { transition-delay: 180ms; }

/* RTL-specific transitions */
html[dir="rtl"] .lang-fade-out {
  transform: translateY(-8px) !important;
}

html[dir="rtl"] .lang-fade-in {
  transform: translateY(0) !important;
}

/* Smooth text direction change */
html {
  transition: direction 0.3s ease;
}

/* Enhanced button transitions during language switch */
.lang-toggle.switching {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Subtle background transition */
body {
  transition: background-color 0.3s ease;
}

/* Language switching background effect */
html[lang="ar"] body {
  background: linear-gradient(135deg, 
    color-mix(in oklab, var(--bg-0) 98%, var(--accent) 2%),
    color-mix(in oklab, var(--bg-0) 99%, var(--accent-2) 1%)
  );
}

html[lang="en"] body {
  background: var(--bg-0);
}

/* Smooth section transitions */
.section {
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Elegant content reveal */
.content-reveal {
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile Navigation Enhancements */
@media (max-width: 768px) {
  /* Better touch targets */
  .nav-links a {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Active state for current page */
  .nav-links a.active {
    background: var(--glass);
    border-color: var(--accent);
    color: var(--accent);
  }
  
  /* Improved hamburger icon */
  .nav-toggle {
    position: relative;
    overflow: hidden;
  }
  
  .nav-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
  }
  
  .nav-toggle:hover::before {
    left: 100%;
  }
  
  /* Smooth scroll behavior for mobile */
  html {
    scroll-behavior: smooth;
  }
  
  /* Better spacing for mobile */
  .nav {
    padding: 0 16px;
  }
  
  /* Improved brand logo on mobile */
  .brand-logo {
    height: 32px;
    width: auto;
  }
  
  /* Better language toggle on mobile */
  .lang-toggle {
    font-size: 11px;
    padding: 8px 10px;
    min-width: 45px;
    height: 32px;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .nav-links {
    padding: 16px;
  }
  
  .nav-links a {
    padding: 14px 16px;
    font-size: 15px;
  }
  
  .nav-toggle {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .lang-toggle {
    min-width: 40px;
    height: 30px;
    font-size: 10px;
    padding: 6px 8px;
  }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
  .nav-links {
    max-height: 60vh;
    overflow-y: auto;
    padding: 12px 20px;
  }
  
  .nav-links a {
    padding: 8px 16px;
    min-height: 40px;
  }
}

/* Scroll-Triggered Reveal Animations */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-on-scroll.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Different reveal directions */
.reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-up {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-up.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* Staggered reveal animations */
.stagger-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.stagger-reveal:nth-child(1) { transition-delay: 0ms; }
.stagger-reveal:nth-child(2) { transition-delay: 100ms; }
.stagger-reveal:nth-child(3) { transition-delay: 200ms; }
.stagger-reveal:nth-child(4) { transition-delay: 300ms; }
.stagger-reveal:nth-child(5) { transition-delay: 400ms; }
.stagger-reveal:nth-child(6) { transition-delay: 500ms; }
.stagger-reveal:nth-child(7) { transition-delay: 600ms; }
.stagger-reveal:nth-child(8) { transition-delay: 700ms; }

/* RTL support for reveal animations */
html[dir="rtl"] .reveal-left {
  transform: translateX(50px);
}

html[dir="rtl"] .reveal-left.revealed {
  transform: translateX(0);
}

html[dir="rtl"] .reveal-right {
  transform: translateX(-50px);
}

html[dir="rtl"] .reveal-right.revealed {
  transform: translateX(0);
}

/* Interactive Project Cards - Enhanced Hover Effects (No 3D Tilt) */
.work-card {
  position: relative;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  overflow: hidden;
}

.work-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, 
    rgba(138, 167, 183, 0.1),
    rgba(138, 167, 183, 0.05)
  );
  opacity: 0;
  transition: left 0.6s ease;
  z-index: 1;
}

.work-card:hover::before {
  left: 100%;
}

.work-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

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

.work-card:hover .work-card-content {
  transform: translateY(-5px);
}

/* Project card image hover effect */
.work-card-image {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

/* Project card content hover effect */
.work-card-content {
  transition: transform 0.3s ease;
  position: relative;
  z-index: 2;
}

/* Enhanced project card shadows */
.work-card {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.work-card:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 
              0 0 0 1px rgba(138, 167, 183, 0.1);
}

/* Project card glow effect */
.work-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    transparent 0%,
    rgba(138, 167, 183, 0.05) 50%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.work-card:hover::after {
  opacity: 1;
}

/* Enhanced Timeline - Interactive Experience Items */
.timeline-item {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  transform: scaleY(0);
  transition: transform 0.3s ease;
  border-radius: 2px;
}

.timeline-item:hover::before {
  transform: scaleY(1);
}

.timeline-item:hover {
  transform: translateX(8px);
  background: color-mix(in oklab, var(--glass) 60%, transparent);
  border-radius: 12px;
  padding: 16px;
  margin: -16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.timeline-item:hover .timeline .content {
  transform: translateY(-2px);
}

.timeline-item:hover .timeline .time {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  transform: scale(1.05);
}

/* Timeline indicator animations */
.timeline-indicators .indicator {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.timeline-indicators .indicator:hover {
  transform: scale(1.2);
  background: var(--accent);
  box-shadow: 0 0 20px rgba(138, 167, 183, 0.4);
}

.timeline-indicators .indicator.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 20px rgba(138, 167, 183, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Timeline content hover effects */
.timeline .content {
  transition: all 0.3s ease;
}

.timeline .content h3 {
  transition: color 0.3s ease;
}

.timeline-item:hover .timeline .content h3 {
  color: var(--accent);
}

/* Timeline time hover effects */
.timeline .time {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* RTL support for timeline */
html[dir="rtl"] .timeline-item::before {
  left: auto;
  right: 0;
}

html[dir="rtl"] .timeline-item:hover {
  transform: translateX(-8px);
}

/* Performance Indicators - Animated Skill Bars */
.skill-bar {
  position: relative;
  background: var(--glass);
  border-radius: 8px;
  height: 8px;
  overflow: hidden;
  margin: 8px 0;
}

.skill-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 8px;
  transform: translateX(-100%);
  transition: transform 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.skill-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: skill-shimmer 2s infinite;
}

@keyframes skill-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.skill-bar.animate .skill-bar-fill {
  transform: translateX(0);
}

/* Skill labels */
.skill-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 500;
}

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

.skill-percentage {
  color: var(--accent);
  font-weight: 600;
}

/* Skill cards with bars */
.skill-card-with-bar {
  background: var(--glass);
  border: 1px solid var(--border-1);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s ease;
}

.skill-card-with-bar:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--accent);
}

/* Skill grid with animations */
.skills-grid-animated {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

/* Micro-Interactions - Subtle Animations */
.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn:active {
  transform: scale(0.98);
  transition: transform 0.1s ease;
}

/* Enhanced button hover effects */
.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(138, 167, 183, 0.3);
}

.btn.ghost:hover {
  background: color-mix(in oklab, var(--glass) 80%, var(--accent) 20%);
  transform: translateY(-1px);
}

/* Card hover effects */
.card, .panel {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover, .panel:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* Visual Feedback - Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background: var(--glass);
  border: 1px solid var(--border-1);
  border-radius: 12px;
  padding: 16px 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  max-width: 320px;
  position: relative;
  overflow: hidden;
}

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

.toast.hide {
  transform: translateX(100%);
  opacity: 0;
}

.toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
}

.toast.success::before {
  background: var(--ok);
}

.toast.error::before {
  background: #e74c3c;
}

.toast.warning::before {
  background: var(--warn);
}

.toast.info::before {
  background: var(--accent);
}

.toast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.toast-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.toast-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.toast-close:hover {
  background: var(--glass);
  color: var(--text);
}

.toast-message {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

/* Toast progress bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  width: 100%;
  transform-origin: left;
  animation: toast-progress 5s linear forwards;
}

@keyframes toast-progress {
  0% { transform: scaleX(1); }
  100% { transform: scaleX(0); }
}

/* Toast icons */
.toast-icon {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
}

.toast.success .toast-icon {
  background: var(--ok);
}

.toast.error .toast-icon {
  background: #e74c3c;
}

.toast.warning .toast-icon {
  background: var(--warn);
}

.toast.info .toast-icon {
  background: var(--accent);
}

/* Mobile toast positioning */
@media (max-width: 768px) {
  .toast-container {
    top: 80px;
    right: 12px;
    left: 12px;
  }
  
  .toast {
    max-width: none;
    transform: translateY(-100%);
  }
  
  .toast.show {
    transform: translateY(0);
  }
  
  .toast.hide {
    transform: translateY(-100%);
  }
}

/* Analysis Section Styles */
.analysis .split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px !important; /* Increased gap from 32px to 48px with !important to override any conflicting styles */
}

.plo-chart-container {
  text-align: center;
  margin: 24px 0;
  padding: 16px;
  background: var(--glass);
  border-radius: 16px;
  border: 1px solid var(--border-1);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
}

.plo-chart {
  max-width: 100%;
  max-height: 400px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  object-fit: contain;
}

.plo-comparison {
  margin-top: 32px;
}

.plo-comparison h4 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 20px;
}

.plo-table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-1);
  background: var(--glass);
}

.plo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.plo-table th {
  background: rgba(138, 167, 183, 0.1);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border-1);
}

.plo-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-1);
  color: var(--muted);
}

.plo-table tr:last-child td {
  border-bottom: none;
}

.plo-table tr:hover {
  background: rgba(138, 167, 183, 0.05);
}

.plo-table th:first-child,
.plo-table td:first-child {
  width: 60px;
  font-weight: 700;
  color: var(--accent);
}

.plo-table th:nth-child(2),
.plo-table td:nth-child(2) {
  min-width: 200px;
}

.plo-table th:nth-child(3),
.plo-table td:nth-child(3) {
  width: 80px;
  text-align: center;
}

.plo-table th:nth-child(4),
.plo-table td:nth-child(4) {
  min-width: 250px;
}

.score {
  font-weight: 700;
  text-align: center;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
}

.score.high {
  background: rgba(158, 198, 170, 0.15);
  color: var(--ok);
}

.score.good {
  background: rgba(138, 167, 183, 0.15);
  color: var(--accent);
}

.score.medium {
  background: rgba(198, 179, 158, 0.15);
  color: var(--warn);
}

.plo-details {
  margin-top: 32px;
}

.plo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}

.plo-item {
  padding: 16px;
  background: var(--glass);
  border-radius: 12px;
  border: 1px solid var(--border-1);
  transition: all 0.3s ease;
}

.plo-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--accent);
}

.plo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.plo-number {
  font-weight: 700;
  color: var(--accent);
  font-size: 14px;
  background: rgba(138, 167, 183, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
}

.plo-name {
  font-weight: 600;
  flex: 1;
  margin: 0 12px;
}

.plo-score {
  font-weight: 700;
  color: var(--ok);
  background: rgba(158, 198, 170, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
}

.plo-description {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.swot-analysis {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px; /* Increased gap from 24px to 32px */
}

.swot-category {
  padding: 24px; /* Increased padding from 20px to 24px */
  border-radius: 16px; /* Increased border radius from 12px to 16px */
  background: var(--glass);
  border: 1px solid var(--border-1);
}

.swot-category h4 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 20px; /* Increased font size from 18px to 20px */
}

.swot-category ul {
  padding-left: 20px;
  margin: 12px 0 0 0;
}

.swot-category li {
  margin-bottom: 12px; /* Increased margin from 8px to 12px */
  line-height: 1.6; /* Increased line height from 1.5 to 1.6 */
  font-size: 15px; /* Increased font size from default to 15px */
}

.swot-category.strengths {
  border-left: 6px solid var(--ok); /* Increased border width from 4px to 6px */
}

.swot-category.weaknesses {
  border-left: 6px solid var(--warn); /* Increased border width from 4px to 6px */
}

.swot-category.opportunities {
  border-left: 6px solid var(--accent); /* Increased border width from 4px to 6px */
}

.swot-category.threats {
  border-left: 6px solid #e74c3c; /* Increased border width from 4px to 6px */
}

/* Responsive styles for analysis section */
@media (max-width: 960px) {
  .analysis .split {
    grid-template-columns: 1fr;
    gap: 40px; /* Adjusted gap for medium screens */
  }
  
  .plo-grid {
    grid-template-columns: 1fr;
  }
  
  .swot-analysis {
    gap: 24px; /* Adjusted gap for medium screens */
  }
  
  .swot-category {
    padding: 20px;
  }
  
  .plo-chart-container {
    min-height: 200px;
  }
}

@media (max-width: 768px) {
  .plo-header {
    flex-wrap: wrap;
  }
  
  .plo-name {
    flex: 0 0 100%;
    margin: 8px 0;
  }
  
  .plo-item {
    padding: 12px;
  }
  
  .plo-chart-container {
    min-height: 150px;
    padding: 12px;
  }
  
  .plo-table {
    font-size: 13px;
  }
  
  .plo-table th,
  .plo-table td {
    padding: 8px 12px;
  }
  
  .plo-table th:nth-child(2),
  .plo-table td:nth-child(2) {
    min-width: 150px;
  }
  
  .plo-table th:nth-child(4),
  .plo-table td:nth-child(4) {
    min-width: 150px;
  }
  
  .plo-comparison h4 {
    font-size: 18px;
  }
  
  .swot-category {
    padding: 16px;
  }
  
  .swot-category h4 {
    font-size: 18px;
  }
  
  .swot-category li {
    font-size: 14px;
    margin-bottom: 8px;
  }
}
