/* ============================================================
   Salah Elhachmi — portfolio (elhechmi.com)
   Light theme, dark hero, indigo accent. No framework.
   ============================================================ */

:root {
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-dark: #4338ca;
  --border: #e2e8f0;
  --dark: #0f172a;
  --dark-soft: #1e293b;
  --white: #f8fafc;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

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

h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; }

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

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand { font-size: 1.35rem; font-weight: 800; color: var(--dark); letter-spacing: .5px; }
.nav-brand span { color: var(--accent); }
.nav-brand:hover { color: var(--dark); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav-links a {
  color: var(--muted);
  font-size: .95rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
}
.nav-links a:hover { color: var(--accent); background: var(--accent-soft); }

.lang-toggle {
  margin-left: 10px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}
.lang-toggle:hover { border-color: var(--accent); color: var(--accent); }
.lang-toggle.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.nav-burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px;
}
.nav-burger span { width: 22px; height: 2px; background: var(--dark); border-radius: 2px; }

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

.hero {
  background:
    radial-gradient(700px 420px at 85% -5%, rgba(79, 70, 229, .28), transparent 60%),
    radial-gradient(600px 380px at -10% 110%, rgba(56, 189, 248, .18), transparent 60%),
    var(--dark);
  color: var(--white);
  padding: 150px 24px 0;
}

.hero-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  align-items: center;
  gap: 48px;
  padding-bottom: 72px;
}

.hero-text h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  margin: 16px 0 8px;
  letter-spacing: -.5px;
}

.hero-role {
  font-size: 1.15rem;
  font-weight: 600;
  color: #a5b4fc;
  margin-bottom: 16px;
}

.hero-sub {
  color: #cbd5e1;
  font-size: 1.02rem;
  max-width: 560px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid rgba(165, 180, 252, .35);
  background: rgba(79, 70, 229, .18);
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  color: #c7d2fe;
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .25); }

.hero-actions { margin-top: 28px; display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: .95rem;
  transition: all .2s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-ghost { border: 1px solid rgba(226, 232, 240, .4); color: var(--white); }
.btn-ghost:hover { background: rgba(255, 255, 255, .08); color: var(--white); }

.hero-avatar {
  display: flex;
  justify-content: center;
}
.hero-avatar img {
  width: clamp(180px, 22vw, 260px);
  height: clamp(180px, 22vw, 260px);
  object-fit: cover;
  border-radius: 50%;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, .4));
}


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

.section { max-width: 1080px; margin: 0 auto; padding: 120px 24px 40px; }
.section-alt { max-width: none; background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding-top: 90px; padding-bottom: 90px; }
.section-alt .section-head, .section-alt .proj-grid, .section-alt .timeline { max-width: 1080px; margin-left: auto; margin-right: auto; }

.section-head { margin-bottom: 48px; max-width: 1080px; }
.section-head .eyebrow {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); letter-spacing: -.5px; }
.section-sub { margin-top: 12px; color: var(--muted); max-width: 640px; }

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

.about-grid { display: grid; grid-template-columns: 340px 1fr; gap: 40px; align-items: start; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.profile-card { padding: 32px 28px; text-align: center; }
.profile-avatar { width: 96px; height: 96px; margin: 0 auto 16px; border-radius: 50%; object-fit: cover; }
.profile-card h3 { font-size: 1.25rem; }
.profile-role { color: var(--muted); font-size: .9rem; margin: 4px 0 20px; }

.profile-list { list-style: none; text-align: left; }
.profile-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  font-size: .92rem;
}
.profile-list li span:first-child { color: var(--muted); flex-shrink: 0; }
.profile-list li span:last-child, .profile-list li a { text-align: right; font-weight: 500; color: var(--text); }
.profile-list a:hover { color: var(--accent); }

.lead { font-size: 1.05rem; color: #334155; margin-bottom: 28px; }

.leadership { margin-bottom: 28px; }
.leadership h3 { font-size: 1rem; margin-bottom: 16px; }
.lead-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.lead-card { padding: 20px 22px; }
.lead-card h4 { font-size: .95rem; color: var(--accent-dark); margin-bottom: 6px; }
.lead-card p { font-size: .9rem; color: #334155; }

.chips { margin-bottom: 28px; }
.chips h3 { font-size: 1rem; margin-bottom: 16px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row span {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .85rem;
  font-weight: 500;
}

.tech-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; }
.tech-group h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.tech-group p { font-size: .92rem; }

/* ---------------- Experience timeline ---------------- */

.timeline { display: flex; flex-direction: column; gap: 20px; }

.tl-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
}

.tl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.tl-head h3 { font-size: 1.12rem; }
.tl-date {
  white-space: nowrap;
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 999px;
}
.tl-company { color: var(--muted); font-weight: 500; margin-bottom: 12px; }

.tl-item ul { padding-left: 20px; }
.tl-item li { font-size: .95rem; color: #334155; margin-bottom: 8px; }

/* ---------------- Portfolio ---------------- */

.proj-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }

.proj-card { padding: 0 0 24px; overflow: hidden; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.proj-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.proj-thumb {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.proj-thumb span {
  font-size: 3.4rem;
  font-weight: 800;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 2px 12px rgba(0, 0, 0, .18);
}
.proj-thumb[data-grad="1"] { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.proj-thumb[data-grad="2"] { background: linear-gradient(135deg, #0ea5e9, #4f46e5); }
.proj-thumb[data-grad="3"] { background: linear-gradient(135deg, #10b981, #0ea5e9); }
.proj-thumb[data-grad="4"] { background: linear-gradient(135deg, #f59e0b, #ef4444); }

.proj-card h3 { padding: 0 24px; font-size: 1.12rem; }
.proj-tag { padding: 2px 24px 8px; color: var(--accent); font-weight: 600; font-size: .85rem; }
.proj-meta { padding: 0 24px 8px; color: var(--muted); font-size: .82rem; font-weight: 600; }
.proj-desc { padding: 0 24px 16px; font-size: .93rem; color: #334155; flex: 1; }
.proj-tech { padding: 0 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.proj-tech span {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--muted);
}

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

.contact-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 860px;
  margin: 0 auto;
}

.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 28px;
  text-align: center;
  transition: transform .2s, box-shadow .2s;
  color: var(--text);
}
.contact-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); color: var(--accent); }

.contact-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 1.3rem;
  margin-bottom: 6px;
}
.contact-label { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.contact-value { font-weight: 600; word-break: break-all; }

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

.footer {
  background: var(--dark);
  color: #94a3b8;
  text-align: center;
  padding: 36px 24px;
  font-size: .88rem;
  margin-top: 60px;
}

/* ---------------- Reveal animation ---------------- */

.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

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

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; gap: 32px; text-align: center; }
  .hero-sub { margin: 0 auto; }
  .hero-actions { justify-content: center; }
  .hero-avatar { order: -1; }
  .about-grid { grid-template-columns: 1fr; }
  .nav-links {
    position: fixed;
    inset: 64px 0 auto 0;
    background: var(--card);
    flex-direction: column;
    align-items: stretch;
    padding: 16px 24px 24px;
    border-bottom: 1px solid var(--border);
    gap: 4px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; }
  .lang-toggle { margin-left: 0; margin-top: 8px; }
  .nav-burger { display: flex; }
  .section { padding-top: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}