:root {
  --bg: #0b1220;
  --bg-soft: #121a2b;
  --bg-elev: #172235;
  --surface: rgba(255,255,255,0.04);
  --surface-2: rgba(255,255,255,0.08);
  --text: #edf5f2;
  --muted: #9fb0ad;
  --line: rgba(255,255,255,0.1);
  --accent: #00D4AA;
  --accent-2: #5ee7c5;
  --accent-rgb: 0, 212, 170;
  --danger: #ff7b7b;
  --shadow: 0 20px 60px rgba(0,0,0,.28);
  --radius: 20px;
  --container: 1180px;
  --header-bg: rgba(11,18,32,.72);
  --hero-glow: radial-gradient(ellipse at top, rgba(0,212,170,.13) 0%, rgba(11,18,32,0) 55%);
}
html[data-theme="light"] {
  --bg: #f4fbf9;
  --bg-soft: #ffffff;
  --bg-elev: #ffffff;
  --surface: rgba(11,18,32,0.03);
  --surface-2: rgba(11,18,32,0.06);
  --text: #13211d;
  --muted: #526763;
  --line: rgba(19,33,29,0.12);
  --accent: #00b892;
  --accent-2: #009c7c;
  --accent-rgb: 0, 184, 146;
  --danger: #d94f4f;
  --shadow: 0 18px 50px rgba(17, 40, 34, .08);
  --header-bg: rgba(244,251,249,.8);
  --hero-glow: radial-gradient(ellipse at top, rgba(0,212,170,.16) 0%, rgba(244,251,249,0) 58%);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color .35s ease, color .35s ease;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: var(--hero-glow);
  transition: background .35s ease;
}
body[dir="rtl"] { font-family: Tahoma, "Segoe UI", Arial, sans-serif; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
.container { width: min(calc(100% - 2rem), var(--container)); margin-inline: auto; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  transition: background-color .35s ease, border-color .35s ease;
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 0; min-height: 72px; position: relative; }
.brand { font-weight: 800; font-size: 1.2rem; letter-spacing: .02em; white-space: nowrap; transition: transform .25s ease, color .25s ease; }
.brand span { color: var(--accent); }
.brand:hover { transform: translateY(-1px); }
.nav-links { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; justify-content: center; margin-inline: auto; }
.nav-actions { display: flex; align-items: center; gap: .45rem; margin-inline-start: auto; }
.nav-links a, .lang-switch, .theme-toggle, .menu-toggle {
  color: var(--muted); padding: .55rem .9rem; border-radius: 999px; font-size: .95rem;
  transition: color .25s ease, background-color .25s ease, border-color .25s ease, transform .25s ease;
  border: 1px solid transparent; background: transparent; cursor: pointer;
}
.nav-links a:hover, .nav-links a.active, .lang-switch:hover, .theme-toggle:hover, .menu-toggle:hover {
  color: var(--text); background: var(--surface); border-color: var(--line); transform: translateY(-1px);
}
.theme-toggle { display: inline-flex; align-items: center; gap: .4rem; }
.theme-toggle svg, .menu-toggle svg { width: 18px; height: 18px; flex: 0 0 auto; }
.menu-toggle { display: none; align-items: center; justify-content: center; width: 42px; height: 42px; padding: 0; border-color: var(--line); background: var(--surface); color: var(--text); }
.menu-toggle:hover { border-color: rgba(var(--accent-rgb),.45); color: var(--accent); }

.hero { padding: 5.5rem 0 3rem; position: relative; }
.hero-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: 2rem; align-items: stretch; }
.eyebrow { color: var(--accent); font-weight: 700; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .75rem; }
body[dir="rtl"] .eyebrow { letter-spacing: 0; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.8rem); line-height: 1.2; margin: 0 0 1rem; max-width: 18ch; }
body[dir="rtl"] .hero h1 { max-width: 20ch; }
.hero p, .section-head p { color: var(--muted); font-size: 1.05rem; margin: 0; max-width: 62ch; }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.7rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .85rem 1.25rem; border-radius: 12px; font-weight: 700; border: 1px solid transparent;
  transition: transform .25s ease, box-shadow .25s ease, background-color .25s ease, border-color .25s ease, color .25s ease;
  cursor: pointer; position: relative; overflow: hidden;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #35e0be); color: #062019; box-shadow: 0 10px 30px rgba(var(--accent-rgb), .25); }
.btn-primary:hover { box-shadow: 0 14px 34px rgba(var(--accent-rgb), .35); filter: saturate(1.03); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-secondary:hover { border-color: rgba(var(--accent-rgb),.45); color: var(--accent); }

.hero-card, .card, .contact-card, .project-card {
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  background-color: var(--bg-soft);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease, background-color .35s ease;
}
html[data-theme="light"] .hero-card, html[data-theme="light"] .card, html[data-theme="light"] .contact-card, html[data-theme="light"] .project-card {
  background: linear-gradient(180deg, rgba(255,255,255,1), rgba(246,252,250,1));
}
.hero-card:hover, .card:hover, .project-card:hover { transform: translateY(-4px); border-color: rgba(var(--accent-rgb),.35); box-shadow: 0 24px 60px rgba(0,0,0,.22); }
html[data-theme="light"] .hero-card:hover, html[data-theme="light"] .card:hover, html[data-theme="light"] .project-card:hover { box-shadow: 0 24px 55px rgba(19,33,29,.12); }
.hero-card { padding: 1.5rem; display: flex; flex-direction: column; justify-content: center; gap: 1rem; }
.stat { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.stat:last-child { border-bottom: 0; padding-bottom: 0; }
.stat-label { color: var(--muted); font-size: .9rem; }
.stat-value { font-size: 1.05rem; font-weight: 700; word-break: break-word; }
.stat-value a { color: var(--accent); transition: opacity .2s ease; }
.stat-value a:hover { opacity: .85; }

.section { padding: 3.2rem 0; }
.section-head { display: flex; justify-content: space-between; gap: 1.5rem; align-items: end; margin-bottom: 1.8rem; }
.section-head h2 { margin: 0 0 .5rem; font-size: clamp(1.6rem, 3vw, 2.5rem); line-height: 1.25; }
.projects-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1.25rem; }
.project-card { overflow: hidden; display: flex; flex-direction: column; min-height: 100%; }
.project-media { position: relative; aspect-ratio: 16 / 10; background: var(--bg-elev); overflow: hidden; }
.project-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease, filter .5s ease; }
.project-card:hover .project-media img { transform: scale(1.04); filter: saturate(1.04); }
.project-body { padding: 1.25rem; display: flex; flex-direction: column; gap: .8rem; flex: 1; }
.project-body h3 { margin: 0; font-size: 1.3rem; line-height: 1.4; }
.project-body p { margin: 0; color: var(--muted); white-space: pre-line; }
.project-actions { margin-top: auto; padding-top: .5rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.tag { display: inline-flex; padding: .25rem .65rem; border-radius: 999px; background: rgba(var(--accent-rgb),.12); color: var(--accent); font-size: .78rem; font-weight: 600; }
.empty-state { padding: 2rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

.about-grid, .contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.card { padding: 1.4rem; }
.card h3 { margin: 0 0 1rem; font-size: 1.15rem; }
.card p, .card li { color: var(--muted); }
.card ul { margin: 0; padding-inline-start: 1.2rem; }
.timeline-item { padding: .9rem 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { padding-bottom: 0; border-bottom: 0; }
.timeline-item h4 { margin: 0; font-size: 1rem; }
.meta { color: var(--accent); font-size: .88rem; font-weight: 600; margin: .2rem 0 .35rem; }
.skills-list { display: flex; flex-wrap: wrap; gap: .6rem; }
.skill-pill { padding: .45rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: .92rem; transition: .25s ease; }
.skill-pill:hover { border-color: rgba(var(--accent-rgb),.4); color: var(--accent); transform: translateY(-1px); }

.contact-list { display: grid; gap: .8rem; }
.contact-item { padding: .9rem 1rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); transition: .25s ease; }
.contact-item:hover { border-color: rgba(var(--accent-rgb),.3); background: rgba(var(--accent-rgb),.04); }
.contact-item .label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .15rem; }
.contact-item a, .contact-item span:not(.label) { color: var(--text); word-break: break-word; }
.contact-item a:hover { color: var(--accent); }
.form { display: grid; gap: .9rem; }
.field label { display: block; font-size: .9rem; margin-bottom: .35rem; color: var(--muted); }
.field input, .field textarea {
  width: 100%; padding: .85rem 1rem; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); transition: border-color .25s ease, box-shadow .25s ease, background-color .25s ease;
}
.field input:focus, .field textarea:focus { outline: none; border-color: rgba(var(--accent-rgb),.55); box-shadow: 0 0 0 4px rgba(var(--accent-rgb),.12); }
.field textarea { min-height: 140px; resize: vertical; }
.form-note { color: var(--muted); font-size: .88rem; margin: 0; }

.site-footer { padding: 2rem 0 2.5rem; color: var(--muted); border-top: 1px solid var(--line); margin-top: 2rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.footer-links { display: flex; gap: .8rem; flex-wrap: wrap; }
.footer-links a:hover { color: var(--accent); }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .2rem; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; transition: transform .35s ease, border-color .35s ease, filter .35s ease; }
.gallery img:hover { transform: scale(1.02); border-color: rgba(var(--accent-rgb),.45); filter: saturate(1.03); }
.gallery.single { grid-template-columns: 1fr; }
.gallery.single img { aspect-ratio: 16/10; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.86); display: none; align-items: center; justify-content: center; padding: 1rem; z-index: 100; }
.lightbox.open { display: flex; }
.lightbox img { max-width: min(100%, 1100px); max-height: 85vh; border-radius: 12px; }
.lightbox-close { position: absolute; top: 1rem; right: 1rem; background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.2); width: 42px; height: 42px; border-radius: 50%; font-size: 1.3rem; cursor: pointer; }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; transition-delay: var(--reveal-delay, 0ms); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .hero-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .menu-toggle { display: inline-flex; }
  .nav-links {
    display: none; position: absolute; top: calc(100% + .25rem); left: 0; right: 0;
    flex-direction: column; align-items: stretch; padding: .75rem;
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-links a { width: 100%; justify-content: flex-start; text-align: start; }
  .nav-actions { gap: .35rem; }
  .theme-toggle span { display: none; }
  .theme-toggle, .lang-switch { padding: .55rem .7rem; }
  .hero { padding-top: 3.5rem; }
  .section { padding: 2.5rem 0; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
