:root {
  --bg-gradient:
    radial-gradient(1200px 600px at 10% -10%, rgba(170, 130, 255, 0.6) 0%, transparent 60%),
    radial-gradient(900px 600px at 90% 10%, rgba(196, 160, 255, 0.45) 0%, transparent 55%),
    linear-gradient(135deg, #12132a 0%, #1b1740 50%, #141a2f 100%);
  --surface: rgba(255, 255, 255, 0.06);
  --card: rgba(34, 28, 64, 0.72);
  --text: #faf7ff;
  --muted: #ddd6f0;
  --primary: #c4b5fd;
  --primary-light: #e4d7ff;
  --accent: #c4a6ff;
  --radius: 18px;
  --shadow: 0 28px 70px rgba(0,0,0,.4);
  --border: rgba(200, 176, 255, 0.2);
  --space-section: 56px;
  --container: 1140px;
  --header-height: 72px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  padding-top: var(--header-height);
  background-color: #12132a;
  color: var(--text);
  font-family: "Cairo", sans-serif;
  scroll-behavior: smooth;
}

.bg-stack {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-layer {
  position: absolute;
  inset: -5%;
  background-repeat: no-repeat;
  background-size: cover;
}

.bg-base {
  background-image:
    radial-gradient(1400px 700px at 10% -10%, rgba(170, 130, 255, 0.6) 0%, transparent 60%),
    radial-gradient(1000px 700px at 90% 10%, rgba(196, 160, 255, 0.45) 0%, transparent 55%),
    radial-gradient(900px 600px at 70% 60%, rgba(160, 120, 220, 0.32) 0%, transparent 60%),
    linear-gradient(135deg, #12132a 0%, #1b1740 50%, #141a2f 100%);
}

.bg-stars {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'><circle cx='22' cy='35' r='1' fill='white' opacity='0.6'/><circle cx='90' cy='80' r='1' fill='white' opacity='0.35'/><circle cx='140' cy='40' r='1' fill='white' opacity='0.5'/><circle cx='210' cy='120' r='1.2' fill='white' opacity='0.55'/><circle cx='260' cy='40' r='1' fill='white' opacity='0.4'/><circle cx='50' cy='170' r='1' fill='white' opacity='0.35'/><circle cx='120' cy='200' r='1.2' fill='white' opacity='0.6'/><circle cx='190' cy='230' r='1' fill='white' opacity='0.45'/><circle cx='270' cy='210' r='1' fill='white' opacity='0.5'/><circle cx='30' cy='250' r='1' fill='white' opacity='0.4'/></svg>");
  background-size: 300px 300px;
  opacity: 0.75;
}

.bg-glow {
  background-image:
    radial-gradient(600px 360px at 22% 8%, rgba(176, 148, 255, 0.45), transparent 70%),
    radial-gradient(760px 420px at 82% 18%, rgba(200, 168, 255, 0.45), transparent 70%),
    radial-gradient(460px 260px at 60% 55%, rgba(196, 160, 255, 0.3), transparent 70%);
  opacity: 0.95;
}

.bg-waves {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1400' height='800' viewBox='0 0 1400 800'><path d='M-50 520 C 260 420, 520 520, 860 450 S 1400 520, 1500 420' stroke='rgba(182,140,255,0.35)' stroke-width='2' fill='none'/><path d='M-80 620 C 280 520, 580 640, 900 560 S 1400 640, 1550 520' stroke='rgba(182,140,255,0.25)' stroke-width='1.5' fill='none'/><path d='M-100 700 C 320 620, 620 720, 960 650 S 1400 720, 1600 600' stroke='rgba(182,140,255,0.2)' stroke-width='1' fill='none'/></svg>");
  background-size: 1400px 800px;
  background-position: center 55%;
  opacity: 0.9;
  animation: wavesFloat 18s ease-in-out infinite;
}

.bg-circuit {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1600' height='900' viewBox='0 0 1600 900'><g stroke='rgba(200,168,255,0.35)' stroke-width='1' fill='none'><path d='M80 160 H360 V240 H520' /><path d='M1200 140 H980 V220 H780' /><path d='M260 500 H540 V420 H700' /><path d='M980 520 H1180 V440 H1360' /><path d='M340 700 H520 V640 H720' /><path d='M900 700 H1120 V640 H1320' /><path d='M760 300 V140 H920' /><path d='M640 620 V760 H820' /></g><g fill='rgba(200,168,255,0.7)'><circle cx='360' cy='160' r='3'/><circle cx='520' cy='240' r='3'/><circle cx='980' cy='220' r='3'/><circle cx='780' cy='220' r='3'/><circle cx='540' cy='420' r='3'/><circle cx='700' cy='420' r='3'/><circle cx='1180' cy='440' r='3'/><circle cx='1360' cy='440' r='3'/><circle cx='520' cy='640' r='3'/><circle cx='720' cy='640' r='3'/><circle cx='1120' cy='640' r='3'/><circle cx='1320' cy='640' r='3'/><circle cx='760' cy='300' r='3'/><circle cx='920' cy='140' r='3'/><circle cx='640' cy='620' r='3'/><circle cx='820' cy='760' r='3'/></g></svg>");
  background-size: 1600px 900px;
  background-position: center 40%;
  opacity: 0.45;
  animation: circuitPulse 6s ease-in-out infinite;
}

.bg-grid {
  background-image:
    linear-gradient(transparent 96%, rgba(200,168,255,0.14) 100%),
    linear-gradient(90deg, transparent 96%, rgba(200,168,255,0.14) 100%);
  background-size: 80px 80px;
  background-position: center;
  opacity: 0.35;
  mix-blend-mode: screen;
  animation: gridDrift 24s linear infinite;
}

.bg-rings {
  background-image:
    radial-gradient(circle at 78% 42%, rgba(200, 168, 255, 0.45) 0%, transparent 55%),
    radial-gradient(circle at 78% 42%, rgba(200, 168, 255, 0.25) 0%, transparent 65%),
    radial-gradient(circle at 78% 42%, rgba(200, 168, 255, 0.16) 0%, transparent 75%);
  opacity: 0.7;
  animation: ringsGlow 8s ease-in-out infinite;
}

@keyframes wavesFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes gridDrift {
  0% { background-position: 0 0; }
  100% { background-position: 160px 160px; }
}

@keyframes circuitPulse {
  0%, 100% { opacity: 0.38; }
  50% { opacity: 0.6; }
}

@keyframes ringsGlow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-waves,
  .bg-circuit,
  .bg-grid,
  .bg-rings,
  .wave {
    animation: none;
  }

  .card,
  .lightbox img {
    animation: none;
  }

  .card:hover,
  .btn-project:hover,
  .btn-download:hover {
    transform: none;
  }
}

header,
main,
footer {
  position: relative;
  z-index: 1;
}

.container {
  width: min(100% - 32px, var(--container));
  margin-inline: auto;
}

/* --------- NAV --------- */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(9, 10, 24, 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu {
  display: flex;
  gap: 14px;
  padding: 8px 6px;
  max-width: var(--container);
  width: 100%;
  justify-content: space-between;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.menu::-webkit-scrollbar { display: none; }

.menu a {
  text-decoration: none;
  color: var(--text);
  opacity: .95;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  font-weight: 700;
  transition: .3s;
  flex: 0 0 auto;
  scroll-snap-align: start;
  white-space: nowrap;
}

.menu a:hover,
.menu a.primary {
  background: linear-gradient(135deg, #b68cff, #d9c2ff);
  color: #1a1430;
  border-color: transparent;
}

.menu a:focus-visible,
.btn-project:focus-visible,
.btn-download:focus-visible,
#contact a:focus-visible,
.lightbox .close:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 3px;
}

.menu a.lang {
  border: 1px solid rgba(182, 140, 255, 0.7);
  background: linear-gradient(135deg, rgba(182, 140, 255, 0.35), rgba(168, 120, 255, 0.25));
  color: #f7f8ff;
  font-weight: 800;
  letter-spacing: 0.2px;
  padding: 10px 18px;
  box-shadow: 0 10px 26px rgba(182, 140, 255, 0.35);
}

.menu-links {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.menu-lang {
  display: flex;
  align-items: center;
}

/* --------- SECTIONS --------- */
section {
  padding: var(--space-section) 0;
  text-align: center;
  position: relative;
}

#intro {
  padding-top: 36px;
  padding-bottom: var(--space-section);
}

#contact {
  padding-bottom: 40px;
}

section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(182, 140, 255, 0.55), transparent);
  opacity: 0.7;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.title {
  margin: 0;
  font-size: 1.4rem;
  color: var(--primary-light);
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
}

.title::after {
  content: "";
  display: block;
  width: 84px;
  height: 2px;
  margin: 10px auto 0;
  background: linear-gradient(90deg, rgba(255,255,255,0), var(--accent), rgba(255,255,255,0));
  opacity: 0.8;
}

#contact .title {
  margin-bottom: 2px;
}

.muted { color: var(--muted); }

/* --------- INTRO --------- */
.intro .avatar {
  width: 118px;
  height: 118px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: url("assets/avatar.png") center/cover no-repeat;
  box-shadow: 0 0 28px rgba(182, 140, 255, 0.3);
  border: 2px solid rgba(232, 220, 255, 0.28);
}

.intro {
  position: relative;
}

.viewer-wrapper {
  position: relative;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.05fr);
  gap: 24px;
  align-items: center;
  padding: 40px 36px;
  border-radius: 28px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(200, 168, 255, 0.3), transparent 40%),
    radial-gradient(120% 120% at 100% 20%, rgba(182, 140, 255, 0.28), transparent 45%),
    linear-gradient(140deg, rgba(30, 28, 62, 0.92), rgba(40, 36, 72, 0.7));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 35px 90px rgba(0,0,0,0.4);
  overflow: hidden;
  text-align: left;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(0px);
  opacity: 0.9;
  pointer-events: none;
}

.hero::before {
  width: 420px;
  height: 420px;
  right: -120px;
  top: -180px;
  background: radial-gradient(circle, rgba(182, 140, 255, 0.5), transparent 60%);
}

.hero::after {
  width: 520px;
  height: 520px;
  left: -180px;
  bottom: -220px;
  background: radial-gradient(circle, rgba(182, 140, 255, 0.3), transparent 60%);
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-visual {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 420px;
}

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

.intro h1 {
  font-size: clamp(1.8rem, 3.2vw, 2.9rem);
  margin: 0;
  font-weight: 800;
  color: #f6f8ff;
}

.intro h1::after {
  content: "";
  display: block;
  width: 120px;
  height: 3px;
  margin-top: 12px;
  background: linear-gradient(90deg, rgba(182, 140, 255, 0.8), transparent);
}

html[dir="rtl"] .intro h1::after {
  margin-left: auto;
  background: linear-gradient(90deg, transparent, rgba(182, 140, 255, 0.8));
}

.intro h2 {
  font-size: clamp(1.08rem, 1.35vw + 0.55rem, 1.28rem);
  margin: 12px 0 0;
  font-weight: 700;
  line-height: 1.45;
  color: #efe6ff;
  text-shadow: 0 0 12px rgba(182, 140, 255, 0.45);
  text-wrap: balance;
}

.nowrap { white-space: nowrap; }

.intro .lead {
  max-width: 42em;
  margin: 16px 0 0;
  font-size: 1rem;
  line-height: 1.8;
  color: #e6def5;
}

.intro-sub {
  max-width: 680px;
  margin: 10px 0 0;
  line-height: 1.85;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* --------- WAVE ICON --------- */
.wave {
  display: inline-flex;
  width: 22px;
  height: 22px;
  margin-inline-start: 10px;
  vertical-align: middle;
  transform-origin: 70% 70%;
  animation: wave 1.6s ease-in-out infinite;
  opacity: 0.95;
}

.wave svg {
  width: 100%;
  height: 100%;
  fill: var(--primary-light);
  filter: drop-shadow(0 0 10px rgba(209,166,255,.25));
}

@keyframes wave {
  0% { transform: rotate(0deg); }
  15% { transform: rotate(18deg); }
  30% { transform: rotate(-10deg); }
  45% { transform: rotate(18deg); }
  60% { transform: rotate(-6deg); }
  75% { transform: rotate(12deg); }
  100% { transform: rotate(0deg); }
}

/* --------- GRID / CARDS --------- */
.grid { display: grid; gap: 26px; }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.card {
  background: linear-gradient(160deg, rgba(18, 24, 45, 0.92), rgba(26, 33, 58, 0.78));
  border: 1px solid rgba(182, 140, 255, 0.22);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 20px 45px rgba(0,0,0,.35);
  transition: transform .3s ease, box-shadow .3s ease;
  text-align: left;
  animation: fadeUp 0.6s ease both;
}

.grid .card { animation-delay: 0.05s; }
.grid .card:nth-child(2) { animation-delay: 0.1s; }
.grid .card:nth-child(3) { animation-delay: 0.15s; }
.grid .card:nth-child(4) { animation-delay: 0.2s; }
.grid .card:nth-child(5) { animation-delay: 0.25s; }
.grid .card:nth-child(6) { animation-delay: 0.3s; }

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

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 50px rgba(182, 140, 255, 0.28);
}

/* --------- CERTS --------- */
.cert figure { margin: 0; }

.cert img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: rgba(10, 12, 28, 0.85);
  border-radius: 12px;
  cursor: zoom-in;
  transition: transform .3s ease;
  border: 1px solid rgba(255,255,255,0.08);
}

.cert img:hover { transform: scale(1.02); }

.cert figcaption {
  margin-top: 10px;
  font-weight: 800;
  color: #e6dcff;
}

.cert .sub {
  color: var(--muted);
  font-size: .85rem;
  margin-top: 3px;
}

/* --------- PROJECTS --------- */
/* --------- EXPERIENCE / EDUCATION --------- */
.experience-list,
.education-list {
  display: grid;
  gap: 20px;
  max-width: 860px;
  margin: 28px auto 0;
}

.experience-card h3,
.education-card h3 {
  margin: 0 0 4px;
  font-size: 1.08rem;
  color: #efe6ff;
}

.experience-card .date,
.education-card .date {
  margin: 0 0 10px;
  font-weight: 700;
  font-size: 0.92rem;
  color: #d9c8ff;
}

.experience-card p,
.education-card p {
  margin: 0 0 10px;
  font-size: 0.92rem;
  line-height: 1.75;
  color: #ece8f7;
}

.experience-card p:last-child,
.education-card p:last-child {
  margin-bottom: 0;
}

.experience-card ul {
  margin: 0;
  padding-inline-start: 1.2em;
  color: #e4dcf5;
  font-size: 0.9rem;
  line-height: 1.8;
}

.experience-card li { margin-bottom: 4px; }
.experience-card li:last-child { margin-bottom: 0; }

.experience-card.current {
  border: 1px solid rgba(200, 168, 255, 0.35);
  box-shadow: 0 22px 55px rgba(200, 168, 255, 0.22);
  background: linear-gradient(160deg, rgba(30, 28, 66, 0.95), rgba(48, 42, 84, 0.8));
}

.education-card { padding: 16px 20px; }

#projects .grid.cols-3 {
  align-items: stretch;
}

@media (min-width: 769px) {
  #projects .grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

#projects .grid > .card {
  height: 100%;
}

.project-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 22px;
}

.project-card h3 {
  margin: 0 0 6px;
  font-size: 1.12rem;
  line-height: 1.35;
  color: #efe6ff;
}

.project-card .year {
  font-weight: 400;
  font-size: 0.9rem;
  color: #d4c8ec;
}

.project-card .role {
  margin: 0 0 12px;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #d9c8ff;
}

.project-card p {
  margin: 0 0 12px;
  font-size: 0.92rem;
  line-height: 1.75;
  color: #ece8f7;
}

.project-card .sub {
  margin-top: 2px;
  color: #ddd2f2;
  font-size: .88rem;
  line-height: 1.6;
}

.project-card .btn-project {
  margin-top: auto;
  align-self: flex-start;
}

.project-card.featured {
  border: 1px solid rgba(200, 168, 255, 0.35);
  box-shadow: 0 22px 55px rgba(200, 168, 255, 0.22);
  background: linear-gradient(160deg, rgba(30, 28, 66, 0.95), rgba(48, 42, 84, 0.8));
}

.project-card.featured:hover {
  box-shadow: 0 26px 60px rgba(200, 168, 255, 0.3);
}

/* --------- BUTTONS --------- */
.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-project,
.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: .95rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, #b68cff, #e0ccff);
  color: #1b1430;
  font-weight: 800;
  text-decoration: none;
  transition: .25s;
}

.btn-secondary {
  background: transparent;
  color: var(--primary-light);
  border: 1px solid rgba(200, 168, 255, 0.5);
  box-shadow: inset 0 0 0 1px rgba(200, 168, 255, 0.2);
}

.btn-secondary:hover {
  color: #151024;
  background: linear-gradient(135deg, rgba(200, 168, 255, 0.8), rgba(182, 140, 255, 0.7));
  border-color: transparent;
}

.btn-project { padding: 7px 14px; font-size: 0.9rem; }

.btn-project:hover,
.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(182, 140, 255, 0.4);
}
/* --------- CONTACT --------- */
#contact a {
  color: var(--primary-light);
  font-weight: 600;
  text-decoration: none;
}

#contact a:hover {
  color: #f6f0ff;
  text-decoration: none;
}

.contact-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  width: 100%;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 720px;
  width: 100%;
  text-align: center;
  color: #e8e0f6;
  font-weight: 600;
}

.contact-grid div {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(200, 176, 255, 0.18);
  backdrop-filter: blur(6px);
  overflow-wrap: anywhere;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.contact-grid div:last-child {
  grid-column: 1 / -1;
  max-width: 360px;
  width: 100%;
  justify-self: center;
}

.contact-grid a {
  color: inherit;
}

.contact-grid div:hover,
.contact-grid div:focus-within {
  border-color: rgba(200, 176, 255, 0.45);
  background: rgba(182, 140, 255, 0.1);
  box-shadow: 0 8px 22px rgba(182, 140, 255, 0.16);
}

/* 3D Viewer */
.viewer.viewer-hero {
  width: 118%;
  max-width: 520px;
  height: 470px;
  position: relative;
}

.viewer.viewer-hero canvas {
  filter: drop-shadow(0 18px 40px rgba(0,0,0,0.45));
}

.viewer.viewer-hero::before {
  content: "";
  position: absolute;
  inset: -15% -10%;
  border-radius: 999px;
  background: radial-gradient(circle at 55% 55%, rgba(182, 140, 255, 0.38), transparent 60%);
  filter: blur(2px);
  z-index: 0;
}

.viewer.viewer-hero canvas {
  position: relative;
  z-index: 1;
}

/* --------- FOOTER --------- */
footer {
  padding: 22px 0;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,.1);
}

/* --------- MOBILE --------- */
@media (max-width: 768px) {
  :root { --header-height: 64px; }

  .nav { justify-content: flex-start; }
  .menu {
    justify-content: flex-start;
    scroll-snap-type: x mandatory;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .menu-links { flex-wrap: nowrap; gap: 8px; }
  .menu a { padding: 8px 12px; font-size: .85rem; }
  .menu a.lang { padding: 8px 14px; font-size: .85rem; }

  section { padding: 40px 0; }
  #intro { padding-top: 24px; padding-bottom: 40px; }
  #contact { padding-bottom: 32px; }

  .grid.cols-3 { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .contact-grid div { min-height: 48px; }
  .contact-grid div:last-child { max-width: none; }
  .cert img { aspect-ratio: 16 / 11; }
}

/* --------- LIGHTBOX --------- */
.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.85);
  z-index: 1000;
}

.lightbox.active { display: flex; }

.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(255,255,255,.25);
  animation: zoom .2s ease-out;
}

@keyframes zoom {
  from { transform: scale(.9); opacity: .6; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox .close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 28px;
  color: #fff;
  cursor: pointer;
  opacity: .85;
  user-select: none;
}

html[dir="rtl"] .lightbox .close { right: auto; left: 16px; }

.lightbox .close:hover { opacity: 1; }



/* ===== 3D Viewer ===== */
.viewer {
  position: relative;
  width: 100%;
  height: 420px;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  border: none;
  box-shadow: none;
}

.viewer-small {
  height: 280px !important;
  width: 100%;
}

.viewer-bottom-wrapper {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  width: 100%;
}

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

.viewer-bottom {
  height: 400px !important;
  width: 400px;
  max-width: 100%;
}

.viewer canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.viewer-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,0.75);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.viewer-hint {
  text-align: center;
  margin-top: 12px;
  opacity: 0.85;
}

/* Responsive */
@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 28px 18px;
    gap: 20px;
  }

  .intro .avatar {
    width: 110px;
    height: 110px;
    margin-bottom: 14px;
  }

  .intro h1 {
    font-size: clamp(1.6rem, 6vw, 2.2rem);
  }

  .intro h2 {
    font-size: clamp(.95rem, 4.2vw, 1.2rem);
  }

  .intro .lead,
  .intro-sub {
    margin-inline: auto;
    font-size: .95rem;
  }

  .hero-actions { justify-content: center; }
  .hero-visual { min-height: 0; }
  .nowrap { white-space: normal; }

  .viewer { height: 320px; }
  .viewer.viewer-hero {
    width: 100%;
    max-width: none;
    height: 290px;
  }

  .project-card .btn-project { align-self: center; }
}

@media (max-width: 480px) {
  :root { --header-height: 58px; }

  .menu a { font-size: .8rem; padding: 7px 10px; }
  .menu a.lang { padding: 7px 12px; }

  .hero { padding: 22px 14px; }
  .intro h1 { font-size: clamp(1.5rem, 7vw, 2rem); }
  .intro h2 { font-size: clamp(.9rem, 4.6vw, 1.1rem); }

  .viewer { height: 280px; }
  .viewer.viewer-hero { height: 250px; }
}
