:root {
  --ink: #1B1C1F;
  --ink2: #202124;
  --paper: #FFFFFF;
  --tint: #F7F8FA;
  --muted: #5F6368;
  --muted-d: #9AA0A6;
  --line: #E6E8EB;
  --grey-d: #C4C7C5;
  --surface: #FFFFFF;
  --text-body: #3C4043;
  --red: #EA4335;
  --blue: #1A73E8;
  --yellow: #FBBC04;
  --green: #34A853;
  --maxw: 1140px;
  --r: 16px;
  --sans: 'Poppins', system-ui, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* Dark theme: only the light surfaces are re-coloured.
   The nav, hero, contact and footer are dark in both themes. */
[data-theme="dark"] {
  --ink2: #E8EAED;
  --paper: #0F1113;
  --tint: #15171A;
  --muted: #A8AEB5;
  --muted-d: #9AA0A6;
  --line: #2A2D31;
  --surface: #1A1C1F;
  --text-body: #C7CBD1;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink2);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  line-height: 1.12;
  margin: 0;
  font-weight: 700;
  letter-spacing: -.01em;
}

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

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

:focus-visible {
  outline: 2.5px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- skip link ---------- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -120px;
  z-index: 100;
  background: #fff;
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: .9rem;
  box-shadow: 0 6px 24px -8px rgba(0, 0, 0, .4);
  transition: top .2s ease;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- shared decorative dots ---------- */
.dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(20, 21, 24, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand .mk {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.brand b {
  color: #fff;
  font-weight: 700;
  letter-spacing: .01em;
  font-size: 1.02rem;
}

.brand b span {
  color: var(--grey-d);
  font-weight: 500;
  font-size: .78em;
  margin-left: 5px;
}

.navlinks {
  display: flex;
  gap: 30px;
  align-items: center;
}

.navlinks a {
  color: #D7DADE;
  font-size: .92rem;
  font-weight: 500;
  position: relative;
}

.navlinks a:hover {
  color: #fff;
}

.navlinks a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -6px;
  height: 2px;
  background: var(--blue);
  transition: right .25s ease;
}

.navlinks a:hover::after {
  right: 0;
}

.nav .cta-sm {
  background: #fff;
  color: var(--ink);
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .88rem;
}

.nav .cta-sm:hover {
  background: var(--grey-d);
}

/* ---------- language toggle ---------- */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: .82rem;
  font-weight: 500;
  color: #D7DADE;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

.lang-toggle:hover {
  color: #fff;
  border-color: #fff;
}

.lang-toggle .lang-icon {
  font-style: normal;
  color: var(--muted-d);
}

/* theme toggle */
.icon-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  line-height: 1;
  color: #D7DADE;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

.icon-toggle:hover {
  color: #fff;
  border-color: #fff;
}

/* Default (and no-JS) shows the moon; dark theme shows the sun. */
.theme-icon--sun {
  display: none;
}

.theme-icon--moon {
  display: inline;
}

[data-theme="dark"] .theme-icon--sun {
  display: inline;
}

[data-theme="dark"] .theme-icon--moon {
  display: none;
}

.burger {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px;
}

.burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  margin: 4px 0;
  transition: .25s;
}

/* ---------- hero ---------- */
.hero {
  background: var(--ink);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.hero .wrap {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 40px;
  align-items: center;
  min-height: clamp(560px, 82vh, 760px);
  padding-top: 48px;
  padding-bottom: 48px;
}

.hero-eye {
  color: var(--muted-d);
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.3rem);
  margin: 18px 0 0;
  letter-spacing: -.025em;
}

.hero h1 .u {
  position: relative;
  white-space: nowrap;
}

.hero h1 .u::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: .08em;
  height: .13em;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--red) 0 25%, var(--blue) 25% 50%, var(--yellow) 50% 75%, var(--green) 75% 100%);
}

.hero .lead {
  font-size: clamp(1.05rem, 1.6vw, 1.28rem);
  color: #D7DADE;
  margin: 22px 0 0;
  max-width: 40ch;
}

.hero .role {
  font-family: var(--mono);
  color: var(--grey-d);
  margin-top: 14px;
  font-size: .92rem;
  letter-spacing: .02em;
}

.hero .ctas {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .95rem;
  transition: transform .15s ease, background .2s, border-color .2s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: #fff;
  color: var(--ink);
}

.btn-primary:hover {
  background: var(--grey-d);
}

.btn-ghost {
  border: 1.5px solid rgba(255, 255, 255, .28);
  color: #fff;
}

.btn-ghost:hover {
  border-color: #fff;
}

.netwrap {
  position: relative;
  height: clamp(320px, 46vh, 440px);
}

#net {
  width: 100%;
  height: 100%;
  display: block;
}

.netcap {
  position: absolute;
  left: 0;
  bottom: -6px;
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--muted-d);
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ---------- generic section ---------- */
.sec {
  padding: 96px 0;
}

.sec-tint {
  background: var(--tint);
}

.sec-dark {
  background: var(--ink);
  color: #fff;
}

.sec-head {
  max-width: 62ch;
  margin-bottom: 48px;
}

.sec-head h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  margin: 14px 0 0;
}

.sec-dark .eyebrow {
  color: var(--muted-d);
}

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 56px;
  align-items: start;
}

.about-grid p {
  font-size: 1.08rem;
  color: var(--text-body);
  margin: 0 0 16px;
}

.about-h2 {
  margin-bottom: 18px;
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

.fact {
  background: var(--surface);
  padding: 22px;
}

.fact b {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
}

.fact span {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.fact:nth-child(1) b {
  color: var(--red);
}

.fact:nth-child(2) b {
  color: var(--blue);
}

.fact:nth-child(3) b {
  color: var(--yellow);
}

.fact:nth-child(4) b {
  color: var(--green);
}

.fact.cert b {
  font-size: 1.18rem;
  letter-spacing: 0;
}

/* ---------- skills ---------- */
.skills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.skill {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 30px;
  position: relative;
  overflow: hidden;
}

.skill::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.skill.ml::before {
  background: var(--red);
}

.skill.gen::before {
  background: var(--blue);
}

.skill.py::before {
  background: var(--yellow);
}

.skill.ops::before {
  background: var(--green);
}

.skill h3 {
  font-size: 1.18rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.skill .k {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 20px 0 8px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tag {
  font-family: var(--mono);
  font-size: .78rem;
  background: var(--tint);
  border: 1px solid var(--line);
  color: var(--text-body);
  padding: 5px 10px;
  border-radius: 8px;
}

/* ---------- experience timeline ---------- */
.tl {
  position: relative;
  margin-left: 8px;
}

.tl::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--line);
}

.tl-item {
  position: relative;
  padding: 0 0 36px 40px;
}

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

.tl-dot {
  position: absolute;
  left: 0;
  top: 5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--red);
}

.tl-item:nth-child(2) .tl-dot {
  border-color: var(--blue);
}

.tl-item:nth-child(3) .tl-dot {
  border-color: var(--yellow);
}

.tl-when {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .06em;
  color: var(--muted);
}

.tl-item h3 {
  font-size: 1.16rem;
  margin: 6px 0 2px;
}

.tl-item .co {
  color: var(--blue);
  font-weight: 600;
}

.freelance {
  font-style: normal;
  color: var(--muted);
  font-weight: 500;
}

.tl-item p {
  color: var(--text-body);
  margin: 8px 0 0;
  max-width: 64ch;
}

.missions {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.missions li {
  position: relative;
  padding-left: 18px;
  color: var(--text-body);
  max-width: 66ch;
}

.missions li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--grey-d);
}

.missions li b {
  color: var(--ink2);
  font-weight: 600;
}

/* ---------- projects ---------- */
.grid-proj {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 26px;
  transition: transform .18s ease, box-shadow .18s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .28);
}

.card .badge {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.card h3 {
  font-size: 1.22rem;
  margin: 10px 0 0;
}

.card p {
  color: var(--text-body);
  margin: 10px 0 18px;
  flex: 1;
}

.card .tags {
  margin-top: auto;
}

.conf {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .08em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  text-transform: uppercase;
  vertical-align: middle;
}

/* ---------- contact ---------- */
.contact {
  position: relative;
  overflow: hidden;
}

.contact .wrap {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 48px;
  align-items: center;
}

.contact h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.contact p {
  color: #D7DADE;
  margin: 16px 0 28px;
  max-width: 42ch;
}

.clist {
  display: flex;
  flex-direction: column;
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.crow {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: .98rem;
  color: #fff;
}

.crow .d {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.crow:nth-child(1) .d {
  background: var(--red);
}

.crow:nth-child(2) .d {
  background: var(--blue);
}

.crow:nth-child(3) .d {
  background: var(--yellow);
}

.crow:nth-child(4) .d {
  background: var(--green);
}

.crow a:hover {
  color: var(--grey-d);
}

/* ---------- contact form ---------- */
.cform {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cform .field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cform label {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--grey-d);
}

.cform input,
.cform textarea {
  font-family: var(--sans);
  font-size: .98rem;
  color: #fff;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
  resize: vertical;
}

.cform input::placeholder,
.cform textarea::placeholder {
  color: var(--muted-d);
}

.cform input:focus,
.cform textarea:focus {
  border-color: var(--blue);
  background: rgba(255, 255, 255, .1);
}

.cform .btn-primary {
  align-self: flex-start;
  border: 0;
  cursor: pointer;
}

/* spam honeypot — hidden from users and assistive tech */
.hp {
  display: none;
}

/* ---------- footer ---------- */
.foot {
  background: #141518;
  color: #9AA0A6;
  padding: 30px 0;
  font-size: .85rem;
}

.foot .wrap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.foot .mono {
  font-family: var(--mono);
  font-size: .74rem;
}

/* ---------- reveal ---------- */
.rv {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s ease, transform .7s ease;
}

.rv.in {
  opacity: 1;
  transform: none;
}

/* ---------- responsive ---------- */
@media (max-width: 880px) {
  .navlinks {
    display: none;
  }

  .burger {
    display: block;
  }

  .nav.open .navlinks {
    display: flex;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--ink);
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
  }

  .nav.open .navlinks a {
    padding: 14px 24px;
  }

  .nav.open .navlinks a::after {
    display: none;
  }

  .nav.open .lang-toggle,
  .nav.open .icon-toggle {
    margin: 10px 24px;
    align-self: flex-start;
  }

  .hero .wrap {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 20px;
  }

  .netwrap {
    order: -1;
    height: 240px;
    opacity: .9;
  }

  .about-grid,
  .skills,
  .grid-proj,
  .contact .wrap {
    grid-template-columns: 1fr;
  }

  .sec {
    padding: 64px 0;
  }
}

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

  .rv {
    transition: none;
    opacity: 1;
    transform: none;
  }

  .btn:hover,
  .card:hover {
    transform: none;
  }
}
