/* ============================================
   Colince Tcheussieu Mendji — Portfolio
   ============================================ */

:root {
  --ink:        #14181f;
  --ink-soft:   #4a5462;
  --ink-mute:   #737f8f;
  --line:       #e3e7ec;
  --bg:         #ffffff;
  --bg-alt:     #f7f9fb;
  --accent:     #1b6ef3;
  --accent-dk:  #1557c4;
  --accent-sft: #eaf1fe;

  --wrap: 1120px;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(20, 24, 31, .05);
  --shadow-md: 0 6px 24px rgba(20, 24, 31, .07);
  --shadow-lg: 0 14px 40px rgba(20, 24, 31, .10);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 .5em; }
p { margin: 0 0 1.1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dk); }
img { max-width: 100%; height: auto; display: block; }

code {
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: .88em;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: .1em .38em;
}

.container { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 760px; }
.center { text-align: center; }
.muted { color: var(--ink-mute); font-size: .93rem; }

.skip-link {
  position: absolute; left: -9999px;
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 0 0 8px 0; z-index: 200;
}
.skip-link:focus { left: 0; top: 0; color: #fff; }

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

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.site-header.is-stuck { border-bottom-color: var(--line); box-shadow: var(--shadow-sm); }

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

.nav-brand {
  font-weight: 700; font-size: 1.05rem; letter-spacing: .04em;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 9px;
}
.nav-brand:hover { background: var(--ink); color: #fff; }

.nav-menu { display: flex; gap: 30px; list-style: none; margin: 0; padding: 0; }
.nav-menu a {
  color: var(--ink-soft); font-size: .94rem; font-weight: 500;
  padding: 6px 0; position: relative;
}
.nav-menu a::after {
  content: ''; position: absolute; left: 0; right: 100%; bottom: 0;
  height: 2px; background: var(--accent); transition: right .25s ease;
}
.nav-menu a:hover { color: var(--ink); }
.nav-menu a:hover::after { right: 0; }

.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: 8px;
}
.nav-toggle span {
  width: 22px; height: 2px; background: var(--ink); border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

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

.hero { padding: 104px 0 88px; border-bottom: 1px solid var(--line); }
.hero-inner { max-width: 800px; }

.hero-eyebrow {
  font-size: .8rem; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-mute); margin-bottom: 18px;
}
.hero-title { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 700; margin-bottom: .35em; }
.hero-sub {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--ink-soft); max-width: 62ch; margin-bottom: 2em;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 56px; }

.btn {
  display: inline-block; padding: 12px 26px;
  border-radius: 9px; font-weight: 600; font-size: .95rem;
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-dk); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: #fff; }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); transform: translateY(-1px); }

.hero-stats { display: flex; flex-wrap: wrap; gap: 48px; margin: 0; }
.hero-stats div { margin: 0; }
.hero-stats dt {
  font-size: .78rem; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-mute); margin-bottom: 4px;
}
.hero-stats dd {
  margin: 0; font-size: 1.9rem; font-weight: 700;
  font-family: 'JetBrains Mono', monospace; letter-spacing: -.02em;
}

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

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

.section-title {
  font-size: clamp(1.6rem, 3.2vw, 2.1rem); font-weight: 700; margin-bottom: .5em;
}
.section-intro { color: var(--ink-soft); max-width: 62ch; margin-bottom: 44px; }
.lead { font-size: 1.1rem; color: var(--ink-soft); }

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

.grid {
  display: grid; gap: 26px;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .25s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #d3dae3; }
.card-feature { grid-column: span 2; }

.card-media { background: var(--bg-alt); border-bottom: 1px solid var(--line); overflow: hidden; }
.card-media img {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top center;
  transition: transform .4s ease;
}
.card:hover .card-media img { transform: scale(1.02); }
.card-media-contain { display: grid; place-items: center; padding: 34px; }
.card-media-contain img { aspect-ratio: auto; max-height: 130px; width: auto; object-fit: contain; }

.card-body { padding: 26px; display: flex; flex-direction: column; flex: 1; }
.card-title { font-size: 1.2rem; font-weight: 650; margin-bottom: .5em; }
.card-text { color: var(--ink-soft); font-size: .96rem; flex: 1; }

.badge {
  display: inline-block; vertical-align: middle;
  font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  background: var(--bg-alt); color: var(--ink-mute);
  border: 1px solid var(--line); border-radius: 20px;
  padding: 3px 10px; margin-left: 8px;
}

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 20px; padding: 0; }
.tags li {
  font-size: .78rem; font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  background: var(--accent-sft); color: var(--accent-dk);
  border-radius: 5px; padding: 4px 9px;
}

.card-links { margin-top: auto; font-size: .93rem; font-weight: 600; }

/* ---------- Coursework ---------- */

.course-list { display: flex; flex-direction: column; gap: 12px; }

.course {
  display: flex; align-items: center; justify-content: space-between; gap: 26px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 28px; color: inherit;
  transition: border-color .2s ease, box-shadow .2s ease, transform .15s ease;
}
.course:hover {
  border-color: var(--accent); box-shadow: var(--shadow-md);
  transform: translateX(3px); color: inherit;
}
.course-main { flex: 1; min-width: 0; }
.course h3 { font-size: 1.08rem; margin-bottom: .35em; }
.course p { color: var(--ink-soft); font-size: .93rem; margin: 0; max-width: 74ch; }
.course-lang {
  flex-shrink: 0; font-family: 'JetBrains Mono', monospace; font-size: .8rem; font-weight: 500;
  color: var(--ink-mute); border: 1px solid var(--line); border-radius: 20px; padding: 5px 14px;
}

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

.skills { display: grid; gap: 34px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.skill-group h3 {
  font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-mute); margin-bottom: 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.skill-group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.skill-group li {
  font-size: .88rem; font-weight: 500;
  background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 6px 12px;
  transition: border-color .18s ease, color .18s ease;
}
.skill-group li:hover { border-color: var(--accent); color: var(--accent-dk); }

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

.contact-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 30px; }

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

.site-footer { border-top: 1px solid var(--line); padding: 34px 0; background: var(--bg-alt); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }
.footer-inner p { margin: 0; font-size: .9rem; color: var(--ink-soft); }

/* ---------- Reveal on scroll ---------- */

/* Elements stay visible by default; the reveal only applies once JS has
   confirmed it can observe them, so content is never hidden if JS fails. */
.js-reveal .reveal { opacity: 0; transform: translateY(16px); transition: opacity .55s ease, transform .55s ease; }
.js-reveal .reveal.is-visible { opacity: 1; transform: none; }

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

@media (max-width: 860px) {
  .card-feature { grid-column: span 1; }

  .nav-toggle { display: flex; }

  /* The header is the positioning context, so the panel always sits directly
     below it regardless of scroll position or header height. */
  .site-header { position: sticky; }
  .nav { position: relative; }

  /* Closed by default: `display: none` is unambiguous and cannot be left in a
     half-open state by an interrupted transition. */
  .nav-menu {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 8px 24px 20px;
    box-shadow: var(--shadow-md);
  }
  .nav-menu.is-open { display: flex; animation: menu-in .22s ease both; }

  @keyframes menu-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: none; }
  }
  .nav-menu a { display: block; padding: 13px 0; border-bottom: 1px solid var(--line); }
  .nav-menu li:last-child a { border-bottom: 0; }
  .nav-menu a::after { display: none; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding: 68px 0 60px; }
  .section { padding: 62px 0; }
  .hero-stats { gap: 30px; }
  .hero-stats dd { font-size: 1.55rem; }
  .course { flex-direction: column; align-items: flex-start; gap: 14px; }
  .grid { grid-template-columns: 1fr; }
  .btn { width: 100%; text-align: center; }
  .contact-actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header, .nav-toggle, .hero-actions, .contact-actions { display: none; }
  body { font-size: 11pt; }
  .card, .course { break-inside: avoid; border-color: #ccc; }
  .section { padding: 20px 0; }
}
