/* =========================================================
   Mohamed Lamine Touré — Portfolio
   Palette inspirée des gris/blancs de la veste sur la photo
   ========================================================= */

:root {
  /* Couleurs */
  --white:      #FFFFFF;
  --paper:      #FAFAF9;
  --gray-100:   #F0EFED;
  --gray-200:   #E3E1DD;
  --gray-300:   #CFCCC6;
  --gray-500:   #8F8B84;
  --gray-700:   #4B4842;
  --ink:        #1D1B18;
  --accent:     #7A756B;

  /* Typographie */
  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Rythme */
  --section-pad: clamp(4rem, 9vw, 8rem);
  --container: 1120px;
  --radius: 18px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

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

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

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

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* Empêche la nav collante de cacher le haut des sections lors du défilement vers une ancre */
.hero, .about, .skills, .projects, .contact {
  scroll-margin-top: 6rem;
}

/* Lien d'évitement (accessibilité clavier) */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--ink);
  color: var(--white);
  padding: 0.7rem 1.2rem;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 2000;
  transition: top 0.25s var(--ease);
}
.skip-link:focus {
  top: 1rem;
}

.section-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--section-pad) 1.75rem;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin: 0 0 0.9rem;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  margin: 0 0 2.2rem;
  letter-spacing: -0.01em;
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.9rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease), color 0.35s var(--ease), border-color 0.35s var(--ease);
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary {
  background: var(--ink);
  color: var(--white);
}
.btn-primary:hover { transform: translateY(-2px); background: #000; }
.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--gray-300);
}
.btn-outline:hover { border-color: var(--ink); transform: translateY(-2px); }
.btn-lg { padding: 1.05rem 2.4rem; font-size: 1rem; }

/* ---------- Barre de progression scroll ---------- */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: var(--ink);
  z-index: 1000;
  transition: width 0.1s linear;
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 500;
  background: rgba(250, 250, 249, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s var(--ease);
}
.nav.scrolled { border-bottom-color: var(--gray-200); }

.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1.1rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: 2.1rem;
}

.nav-link {
  font-size: 0.92rem;
  color: var(--gray-700);
  position: relative;
  padding-bottom: 2px;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 0; height: 1px;
  background: var(--ink);
  transition: width 0.3s var(--ease);
}
.nav-link:hover { color: var(--ink); }
.nav-link:hover::after { width: 100%; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px; height: 32px;
  background: none; border: none;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-top: clamp(2.5rem, 6vw, 4rem);
}
.hero-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 2rem 1.75rem 5rem;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3rem;
  align-items: center;
  min-height: calc(100svh - 90px);
}

.hero-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 0 0 1.1rem;
}

.hero-role {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: var(--accent);
  margin: 0 0 1.6rem;
}
.cursor {
  display: inline-block;
  margin-left: 2px;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-tagline {
  max-width: 34ch;
  color: var(--gray-700);
  font-size: 1.05rem;
  margin: 0 0 2.3rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-photo { display: flex; justify-content: center; }

.photo-frame {
  position: relative;
  width: min(340px, 78vw);
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--gray-200);
  box-shadow: 0 30px 60px -30px rgba(29, 27, 24, 0.25);
  background: var(--gray-100);
}
.photo-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.photo-frame--small { width: 100%; max-width: 380px; }

.scroll-hint {
  position: absolute;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%);
}
.scroll-hint span {
  display: block;
  width: 1px; height: 34px;
  background: var(--gray-300);
  position: relative;
  overflow: hidden;
}
.scroll-hint span::after {
  content: '';
  position: absolute;
  top: -34px; left: 0;
  width: 100%; height: 100%;
  background: var(--ink);
  animation: scrollLine 2.2s ease-in-out infinite;
}
@keyframes scrollLine {
  0% { top: -34px; }
  60% { top: 34px; }
  100% { top: 34px; }
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 3.5rem;
  align-items: center;
}
.about-text p {
  color: var(--gray-700);
  margin: 0 0 1.1rem;
  max-width: 56ch;
}
.about-text strong { color: var(--ink); }

/* ---------- Skills ---------- */
.skills { background: var(--white); }
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
}
.skill-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.6rem 1.4rem;
  background: var(--paper);
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.skill-card:hover {
  transform: translateY(-4px);
  border-color: var(--gray-300);
  box-shadow: 0 20px 40px -28px rgba(29,27,24,0.25);
}
.skill-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.9rem;
}
.skill-card p {
  margin: 0;
  color: var(--gray-700);
  font-size: 0.95rem;
}

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.4rem;
}
.project-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 2rem;
  background: var(--white);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.project-card:hover { transform: translateY(-4px); box-shadow: 0 24px 48px -30px rgba(29,27,24,0.25); }
.project-card h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.3rem;
  margin: 0.9rem 0 0.6rem;
}
.project-card p { margin: 0; color: var(--gray-700); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  border: 1px solid var(--gray-300);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1.6s ease-in-out infinite;
}
.project-card--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  color: var(--gray-500);
  font-size: 0.9rem;
  text-align: center;
  background: transparent;
}

/* ---------- Contact ---------- */
.contact { background: var(--ink); color: var(--white); }
.contact .eyebrow { color: var(--gray-300); }
.contact-inner { text-align: center; }
.contact .section-title { color: var(--white); }
.contact-text {
  color: var(--gray-300);
  max-width: 46ch;
  margin: 0 auto 2.2rem;
}
.contact .btn-primary {
  background: var(--white);
  color: var(--ink);
}
.contact .btn-primary:hover { background: var(--gray-200); }
.contact-sub {
  margin: 1.4rem 0 0;
  color: var(--gray-500);
  font-size: 0.9rem;
}

/* ---------- Footer ---------- */
.footer {
  padding: 2.2rem 1.75rem 2.6rem;
  text-align: center;
  background: var(--ink);
  color: var(--gray-500);
  font-size: 0.85rem;
}
.footer p { margin: 0.25rem 0; }
.footer a { color: var(--gray-300); border-bottom: 1px solid transparent; transition: border-color 0.3s var(--ease); }
.footer a:hover { border-color: var(--gray-300); }

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .nav-links {
    position: fixed;
    top: 0; right: 0;
    height: 100svh;
    width: min(78vw, 320px);
    background: var(--paper);
    flex-direction: column;
    justify-content: center;
    gap: 2.2rem;
    padding: 2rem;
    transform: translateX(100%);
    transition: transform 0.4s var(--ease);
    box-shadow: -20px 0 50px -30px rgba(0,0,0,0.3);
  }
  .nav-links.open { transform: translateX(0); }
  .nav-link { font-size: 1.1rem; }
  .nav-toggle { display: flex; }

  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    padding-top: 2rem;
    padding-bottom: 3.5rem;
    min-height: auto;
  }
  .hero-photo { order: -1; }
  .hero-tagline { margin-left: auto; margin-right: auto; }
  .hero-actions { justify-content: center; }

  .about-grid { grid-template-columns: 1fr; text-align: center; }
  .about-text p { margin-left: auto; margin-right: auto; }
  .about-photo { display: flex; justify-content: center; }

  .projects-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .skills-grid { grid-template-columns: 1fr; }
  :root { --section-pad: 3.5rem; }
}
