:root {
  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Couleurs d'accent (cyan -> teal), communes aux deux themes */
  --accent: #0891b2;
  --accent-2: #0d9488;
  --accent-grad: linear-gradient(120deg, #0891b2, #0d9488);

  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1080px;
  --transition: 0.25s ease;
}

:root,
[data-theme="light"] {
  --bg: #f6f8fb;
  --bg-2: #eef1f7;
  --surface: #ffffff;
  --surface-2: #f3f5fa;
  --border: #e3e8f0;
  --text: #0f172a;
  --text-soft: #475569;
  --text-muted: #7787a0;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.06);
  --glow: rgba(8, 145, 178, 0.12);
  --nav-bg: rgba(255, 255, 255, 0.72);
}

[data-theme="dark"] {
  --bg: #0a0f1c;
  --bg-2: #0d1424;
  --surface: #111a2e;
  --surface-2: #16203a;
  --border: #223052;
  --text: #e7eef8;
  --text-soft: #a7b6cf;
  --text-muted: #6b7c98;
  --accent: #22d3ee;
  --accent-2: #2dd4bf;
  --accent-grad: linear-gradient(120deg, #22d3ee, #2dd4bf);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.35);
  --glow: rgba(34, 211, 238, 0.18);
  --nav-bg: rgba(13, 20, 36, 0.72);
}

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

html {
  scroll-behavior: smooth;
}

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

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(60rem 60rem at 80% -10%, var(--glow), transparent 60%),
    radial-gradient(50rem 50rem at -10% 10%, var(--glow), transparent 55%),
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 46px 46px, 46px 46px;
  opacity: 0.5;
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, transparent 90%);
}

h1, h2, h3 {
  font-family: var(--font-head);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

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

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

::selection {
  background: var(--accent);
  color: #fff;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 1000;
}
.skip-link:focus {
  left: 0;
}

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

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

.section {
  padding: 96px 0;
}

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

section[id] {
  scroll-margin-top: 90px;
}

.a_propos {
  margin-bottom: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.98rem;
  padding: 13px 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition),
    background var(--transition), border-color var(--transition);
}

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 8px 22px var(--glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px var(--glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.btn-block {
  width: 100%;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), background var(--transition);
}
.navbar.scrolled {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}

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

.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.brand-accent {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  display: flex;
  gap: 6px;
}
.nav-link {
  position: relative;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-soft);
  padding: 8px 14px;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover {
  color: var(--text);
}
.nav-link.active {
  color: var(--accent);
}
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-grad);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle,
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition),
    transform var(--transition);
}
.theme-toggle:hover,
.menu-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Affiche lune OU soleil selon le theme */
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
}
.menu-toggle span {
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.hero {
  position: relative;
  padding: 72px 0 96px;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.25fr 0.9fr;
  align-items: center;
  gap: 48px;
  min-height: calc(100vh - 68px - 90px);
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.hero-status .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.hero-eyebrow {
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent);
}
.hero-name {
  font-size: clamp(2.4rem, 6vw, 3.9rem);
  font-weight: 700;
  margin: 6px 0 4px;
}
.hero-role {
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  font-weight: 600;
  color: var(--text-soft);
}
.grad {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-tagline {
  margin-top: 20px;
  max-width: 30rem;
  color: var(--text-soft);
  font-size: 1.05rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

.hero-socials {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}
.hero-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  transition: transform var(--transition), color var(--transition),
    border-color var(--transition);
}
.hero-socials a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-3px);
}

.hero-photo-wrap {
  position: relative;
  justify-self: center;
}
.hero-photo-ring {
  position: relative;
  width: clamp(220px, 26vw, 320px);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 6px;
  background: var(--accent-grad);
  box-shadow: 0 20px 50px var(--glow);
}
.hero-photo-ring::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px dashed var(--border);
  animation: spin 22s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--bg);
}
.photo-badge {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  color: var(--text-muted);
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 44px;
}
.section-num {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent);
}
.section-title {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 700;
  position: relative;
}
.section-title::after {
  content: "";
  display: block;
  width: 54px;
  height: 4px;
  margin-top: 12px;
  border-radius: 4px;
  background: var(--accent-grad);
}

.about-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 40px;
  align-items: start;
}
.about-text p {
  color: var(--text-soft);
  font-size: 1.06rem;
  margin-bottom: 18px;
}
.about-text strong {
  color: var(--text);
}

.stats {
  list-style: none;
  display: grid;
  gap: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), border-color var(--transition);
}
.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}
.stat-value {
  display: block;
  font-family: var(--font-head);
  font-size: 2.1rem;
  font-weight: 700;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label {
  color: var(--text-soft);
  font-size: 0.95rem;
}

.timeline {
  list-style: none;
  position: relative;
  padding-left: 34px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(var(--accent), transparent);
}
.timeline-item {
  position: relative;
  padding: 4px 0 34px;
}
.timeline-item:last-child {
  padding-bottom: 0;
}
.timeline-dot {
  position: absolute;
  left: -34px;
  top: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg);
  border: 4px solid var(--accent);
}
.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
}
.timeline-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 6px 0 8px;
}
.timeline-desc {
  color: var(--text-soft);
  max-width: 44rem;
}
.timeline-desc strong {
  color: var(--text);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), border-color var(--transition),
    box-shadow var(--transition);
}
.skill-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.skill-icon {
  font-size: 1.8rem;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.skill-card h3 {
  font-size: 1.15rem;
  margin-bottom: 14px;
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tags li {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 999px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.project-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), border-color var(--transition),
    box-shadow var(--transition);
}
.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.project-emoji {
  font-size: 1.7rem;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.project-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text-soft);
  transition: transform var(--transition), color var(--transition),
    border-color var(--transition);
}
.project-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(45deg);
}
.project-title {
  font-size: 1.22rem;
  margin-bottom: 10px;
}
.project-desc {
  color: var(--text-soft);
  font-size: 0.97rem;
  margin-bottom: 18px;
  flex: 1;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 40px;
  align-items: start;
}
.contact-intro h3 {
  font-size: 1.6rem;
  margin-bottom: 14px;
}
.contact-intro p {
  color: var(--text-soft);
  margin-bottom: 24px;
  max-width: 26rem;
}
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.contact-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: transform var(--transition), border-color var(--transition),
    color var(--transition);
}
.contact-pill:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  color: var(--accent);
}

.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow);
}
.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  margin-bottom: 7px;
}
.field input,
.field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-muted);
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow);
}
.field textarea {
  resize: vertical;
  min-height: 120px;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.alert {
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  margin-bottom: 18px;
  font-size: 0.95rem;
  border: 1px solid transparent;
}
.alert-success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.4);
  color: #16a34a;
}
.alert-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
  color: #dc2626;
}

.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding: 30px 0;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.footer-brand {
  font-family: var(--font-head);
  font-weight: 700;
}
.footer-copy {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.footer-socials {
  display: flex;
  gap: 12px;
}
.footer-socials a {
  color: var(--text-soft);
  transition: color var(--transition), transform var(--transition);
}
.footer-socials a:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: #fff;
  background: var(--accent-grad);
  box-shadow: 0 10px 26px var(--glow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity var(--transition), transform var(--transition),
    visibility var(--transition);
  z-index: 90;
}
.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  transform: translateY(-3px);
}

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

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

@media (max-width: 860px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 40px;
    min-height: 0;
    padding-top: 20px;
  }
  .hero-photo-wrap {
    order: -1;
  }
  .hero-cta,
  .hero-socials {
    justify-content: center;
  }
  .hero-tagline {
    margin-left: auto;
    margin-right: auto;
  }
  .about-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .menu-toggle {
    display: inline-flex;
  }
  .nav-menu {
    position: fixed;
    inset: 68px 0 auto 0;
    flex-direction: column;
    gap: 4px;
    background: var(--nav-bg);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px 22px;
    transform: translateY(-130%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow);
  }
  .nav-menu.open {
    transform: translateY(0);
  }
  .nav-link {
    padding: 12px 14px;
    font-size: 1rem;
  }
  .nav-link.active::after {
    display: none;
  }
  .section {
    padding: 72px 0;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 18px;
  }
  .stats {
    grid-template-columns: 1fr;
  }
  .contact-form {
    padding: 22px;
  }
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}
