/* ==========================================================================
   Public portfolio styles
   Theme colors live in CSS variables so the dark/light toggle only has to
   swap one attribute on <html>.
   ========================================================================== */

/* ---------- Theme tokens ---------- */

:root,
:root[data-theme="dark"] {
  --bg:          #0a0a12;
  --bg-alt:      #0f0f1c;
  --surface:     rgba(255, 255, 255, 0.04);
  --surface-2:   rgba(255, 255, 255, 0.07);
  --text:        #e9e9f2;
  --muted:       #9898b0;
  --border:      rgba(255, 255, 255, 0.10);
  --accent:      #a855f7;
  --accent-2:    #ec4899;
  --accent-soft: rgba(168, 85, 247, 0.15);
  --shadow:      0 20px 45px rgba(0, 0, 0, 0.45);
  --particle:    168, 85, 247;
  --nav-bg:      rgba(10, 10, 18, 0.72);
}

:root[data-theme="light"] {
  --bg:          #ffffff;
  --bg-alt:      #f6f6fb;
  --surface:     #ffffff;
  --surface-2:   #f2f2f9;
  --text:        #14141f;
  --muted:       #5c5c74;
  --border:      rgba(15, 15, 35, 0.10);
  --accent:      #7c3aed;
  --accent-2:    #db2777;
  --accent-soft: rgba(124, 58, 237, 0.10);
  --shadow:      0 18px 40px rgba(30, 20, 70, 0.10);
  --particle:    124, 58, 237;
  --nav-bg:      rgba(255, 255, 255, 0.78);
}

:root {
  --gradient: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  --radius:   16px;
  --maxw:     1140px;
}

/* ---------- Reset & base ---------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 82px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.35s ease, color 0.35s ease;
}

/* Kurdish reads right-to-left and needs an Arabic-script face. */
html[dir="rtl"] body {
  font-family: "Noto Kufi Arabic", "Inter", system-ui, sans-serif;
  line-height: 1.95;
}

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

a { color: inherit; text-decoration: none; }

h1, h2, h3 {
  line-height: 1.2;
  margin: 0 0 0.5em;
  font-weight: 800;
  letter-spacing: -0.02em;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3 { letter-spacing: 0; }

p { margin: 0 0 1rem; }

.container {
  width: min(100% - 2.5rem, var(--maxw));
  margin-inline: auto;
}

/* ---------- Particle canvas ---------- */

#particles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.75;
}

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

/* ---------- Navigation ---------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: transparent;
  transition: background 0.3s ease, box-shadow 0.3s ease, backdrop-filter 0.3s ease;
}

.nav.scrolled {
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  width: min(100% - 2.5rem, var(--maxw));
  margin-inline: auto;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-weight: 800;
  font-size: 1.15rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 1.6rem;
  font-size: 0.93rem;
  font-weight: 500;
}

.nav-links a {
  color: var(--muted);
  position: relative;
  padding: 0.25rem 0;
  transition: color 0.2s ease;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient);
  transition: width 0.28s ease;
}

.nav-links a:hover,
.nav-links a.active { color: var(--text); }
.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lang-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.lang-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.theme-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}

.theme-btn:hover { border-color: var(--accent); transform: rotate(18deg); }

/* Only one icon shows, depending on the active theme. */
:root[data-theme="dark"]  .icon-sun  { display: block; }
:root[data-theme="dark"]  .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun  { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  padding: 0 9px;
}

.burger span {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */

.hero {
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 7rem 1.25rem 5rem;
  position: relative;
}

/* Soft glow behind the hero text. */
.hero::before {
  content: "";
  position: absolute;
  top: 22%;
  left: 50%;
  width: min(760px, 92vw);
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 62%);
  pointer-events: none;
  filter: blur(18px);
}

.hero-inner {
  max-width: 860px;
  position: relative;
}

.hero-greeting {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.82rem;
  margin-bottom: 0.9rem;
}

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

.hero-title {
  font-size: clamp(2.4rem, 7.5vw, 4.6rem);
  margin-bottom: 0.35rem;
  background: linear-gradient(135deg, var(--text) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-typed {
  font-size: clamp(1.05rem, 3.2vw, 1.7rem);
  font-weight: 600;
  color: var(--muted);
  min-height: 1.9em;
  margin-bottom: 1rem;
}

#typed { color: var(--accent-2); }

.cursor {
  color: var(--accent);
  font-weight: 400;
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink { to { visibility: hidden; } }

.hero-bio {
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 620px;
  margin-inline: auto;
  margin-bottom: 2rem;
}

.hero-cta {
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2.2rem;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 0.85rem 1.9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 10px 26px -8px var(--accent);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px -8px var(--accent);
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface);
}

.btn-ghost:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.btn-block { width: 100%; }

/* ---------- Hero socials ---------- */

.hero-socials {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
}

.social {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 1.05rem;
  background: var(--surface);
  transition: all 0.2s ease;
}

.social:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- Scroll hint ---------- */

.scroll-hint {
  position: absolute;
  bottom: 1.8rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

html[dir="rtl"] .scroll-hint { letter-spacing: 0; text-transform: none; }

.scroll-line {
  width: 1px;
  height: 42px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scrollPulse 1.9s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.25; transform: scaleY(0.6); }
  50%      { opacity: 1;    transform: scaleY(1); }
}

/* ---------- Sections ---------- */

.section { padding: 6rem 0; }

.section-alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--border);
}

.section-title {
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  text-align: center;
  margin-bottom: 0.5rem;
}

.section-title::after {
  content: "";
  display: block;
  width: 68px;
  height: 4px;
  border-radius: 4px;
  background: var(--gradient);
  margin: 0.9rem auto 0;
}

.section-sub {
  text-align: center;
  color: var(--muted);
  max-width: 620px;
  margin: 0 auto 3rem;
}

.section-title + .skills-grid,
.section-title + .timeline,
.section-title + .projects-grid,
.section-title + .about-grid { margin-top: 3rem; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 0;
}

/* ---------- About ---------- */

.about-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 3rem;
  align-items: start;
}

.about-photo {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
}

.about-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient);
  opacity: 0.14;
  pointer-events: none;
}

.about-photo img {
  width: 100%;
  aspect-ratio: 1 / 1.15;
  object-fit: cover;
}

.about-text p { color: var(--muted); }

.about-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.stat {
  flex: 1 1 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  text-align: center;
}

.stat strong {
  display: block;
  font-size: 1.9rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat span {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---------- Skills ---------- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.skill-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
}

.skill-group h3 {
  font-size: 1.05rem;
  margin-bottom: 1.3rem;
  color: var(--accent);
}

.skill { margin-bottom: 1.05rem; }
.skill:last-child { margin-bottom: 0; }

.skill-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 0.45rem;
}

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

.bar {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--border);
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--gradient);
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

/* JS adds .in-view once the group scrolls into frame, so bars animate in. */
.skill-group.in-view .bar i { width: var(--level); }

/* ---------- Timeline (experience + education) ---------- */

.timeline {
  position: relative;
  max-width: 780px;
  margin-inline: auto;
  padding-inline-start: 2rem;
}

.timeline::before {
  content: "";
  position: absolute;
  inset-inline-start: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-2));
  opacity: 0.45;
}

.tl-item {
  position: relative;
  margin-bottom: 1.6rem;
}

.tl-item:last-child { margin-bottom: 0; }

.tl-dot {
  position: absolute;
  inset-inline-start: -2rem;
  top: 1.5rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gradient);
  border: 3px solid var(--bg-alt);
  transform: translateX(-1px);
}

html[dir="rtl"] .tl-dot { transform: translateX(1px); }

.tl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.tl-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.tl-date {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  margin-bottom: 0.7rem;
}

.tl-card h3 { font-size: 1.15rem; margin-bottom: 0.2rem; }

.tl-org {
  color: var(--accent-2);
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.6rem;
}

.tl-desc {
  color: var(--muted);
  font-size: 0.93rem;
  margin: 0;
}

/* ---------- Project cards ---------- */

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  transform: translateY(-7px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.card-featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card:hover .card-media img { transform: scale(1.06); }

.card-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  font-weight: 800;
  color: #fff;
  background: var(--gradient);
  opacity: 0.9;
  letter-spacing: 0.05em;
}

.badge {
  position: absolute;
  top: 0.8rem;
  inset-inline-end: 0.8rem;
  background: var(--gradient);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

html[dir="rtl"] .badge { letter-spacing: 0; }

.card-body {
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-body h3 { font-size: 1.18rem; }

.card-body > p {
  color: var(--muted);
  font-size: 0.92rem;
  flex: 1;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 0.22rem 0.6rem;
}

.card-links {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.87rem;
  font-weight: 600;
  margin-top: auto;
}

.link-primary { color: var(--accent); }
.link-ghost   { color: var(--muted); }
.link-primary:hover,
.link-ghost:hover { text-decoration: underline; }

/* ---------- Contact ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 2.5rem;
  align-items: start;
}

.info-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin-bottom: 0.9rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.info-row:hover { border-color: var(--accent); transform: translateY(-2px); }

.info-ico {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  color: #fff;
  background: var(--gradient);
}

.info-row small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

html[dir="rtl"] .info-row small { letter-spacing: 0; text-transform: none; }

.info-row a { font-weight: 600; word-break: break-word; }
.info-row a:hover { color: var(--accent); }

.contact-socials {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-top: 1.2rem;
}

.contact-socials a {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  transition: all 0.2s ease;
}

.contact-socials a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Forms ---------- */

.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.contact-form label {
  display: block;
  margin-bottom: 1rem;
}

.contact-form label > span {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.93rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

.alert {
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1.2rem;
}

.alert-ok {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #22c55e;
}

.alert-bad {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

/* ---------- Footer ---------- */

.footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}

.footer-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  text-align: center;
}

.footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ---------- Back to top ---------- */

.to-top {
  position: fixed;
  bottom: 1.5rem;
  inset-inline-end: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--gradient);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: all 0.3s ease;
  z-index: 90;
  box-shadow: 0 8px 22px -6px var(--accent);
}

.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { transform: translateY(-3px); }

/* ---------- Scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.in-view {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .about-grid,
  .contact-grid { grid-template-columns: 1fr; }

  .about-photo { max-width: 280px; margin-inline: auto; }
}

@media (max-width: 780px) {
  .burger { display: flex; }

  .nav-links {
    position: fixed;
    inset: 72px 0 auto 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1.25rem 1.25rem;
    transform: translateY(-120%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: var(--shadow);
  }

  .nav-links.open { transform: translateY(0); }

  .nav-links a {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
  }

  .nav-links a:last-child { border-bottom: none; }
  .nav-links a::after { display: none; }

  .section { padding: 4.5rem 0; }
  .field-row { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .hero-cta { flex-direction: column; }
  .btn { width: 100%; }
  .contact-form { padding: 1.3rem; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal { opacity: 1; transform: none; }
  #particles { display: none; }
}

/* ---------- Print ---------- */

@media print {
  #particles, .nav, .to-top, .contact-form, .scroll-hint { display: none !important; }
  body { background: #fff; color: #000; }
}
