:root {
  --bg:         #FFFCF0;
  --bg-soft:    #FCF7E5;
  --bg-softer:  #FFFFFF;
  --fg:         #1A1F2E;
  --muted:      #857B6C;
  --rule:       #EAE0C5;
  --accent:     #42C7C4;
  --accent-dk:  #1F8580;
  --terra:      #C04A1F;

  --sans: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --max: 84rem;
  --gutter: clamp(1rem, 3vw, 2rem);
  --nav-h: 60px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1rem);
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

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

/* ──────────── NAV ──────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  background: rgba(255, 252, 240, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--rule);
}

.nav__brand {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.005em;
}

.nav__links {
  display: flex;
  gap: 1.75rem;
}

.nav__links a {
  font-size: 0.9rem;
  color: var(--muted);
  transition: color 0.15s ease;
}

.nav__links a:hover { color: var(--fg); }

.nav__links a.is-active {
  color: var(--fg);
  font-weight: 500;
  position: relative;
}

.nav__links a.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -22px;
  height: 2px;
  background: var(--accent);
}

.nav__section {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-dk);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.nav__section.is-visible {
  opacity: 1;
}

@media (max-width: 880px) {
  .nav__section { display: none; }
}

/* Theme toggle button */
.nav__theme {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  margin-left: 0.25rem;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  font-family: inherit;
}

.nav__theme:hover {
  color: var(--fg);
  border-color: var(--fg);
}

.nav__theme svg { display: block; }

.nav__theme-sun { display: none; }

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

/* ──────────── MAIN LAYOUT ──────────── */

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

section {
  padding: 3.5rem 0;
  border-top: 1px solid var(--rule);
}

section:first-of-type { border-top: none; }

/* ──────────── PAGE HEAD (interior pages) ──────────── */

.page-head {
  padding: 3rem 0 2.5rem;
  border-top: none;
  max-width: 50rem;
}

.page-head .sec-head__kicker {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-dk);
  margin-bottom: 0.85rem;
}

.page-head h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 1rem;
}

.page-head .sec-head__lede {
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1.55;
  max-width: 40rem;
}

/* ──────────── HERO ──────────── */

.hero {
  padding: 3.5rem 0 4.5rem;
  max-width: 56rem;
}

.hero__greet {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 7vw, 4.75rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  margin-bottom: 1.25rem;
}

.hero__lastname { color: var(--accent); }

.hero__lede {
  font-size: clamp(1rem, 1.3vw, 1.15rem);
  line-height: 1.55;
  color: var(--muted);
  max-width: 38rem;
  margin-bottom: 1.75rem;
}

.hero__cta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ──────────── BUTTONS ──────────── */

.btn {
  display: inline-flex;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  font-family: inherit;
}

.btn--primary {
  background: var(--fg);
  color: var(--bg);
}

.btn--primary:hover {
  background: var(--accent-dk);
}

.btn--ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--rule);
}

.btn--ghost:hover {
  border-color: var(--fg);
  background: var(--bg-soft);
}

/* ──────────── SECTION HEADERS ──────────── */

.sec-head {
  margin-bottom: 2rem;
  max-width: 42rem;
}

.sec-head__kicker {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-dk);
  margin-bottom: 0.85rem;
}

.sec-head h2 {
  font-size: clamp(1.85rem, 3.5vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.sec-head__lede {
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ──────────── EXPERTISE CARDS (home) ──────────── */

.expertise {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.expert-card {
  background: var(--bg-soft);
  border-radius: 14px;
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
}

.expert-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.85rem;
}

.expert-card p {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.expert-card__tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.expert-card__tags li {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--accent-dk);
}

/* ──────────── CTA BANNER (home) ──────────── */

.cta {
  border-top: none;
  padding: 3rem 0 4rem;
}

.cta__inner {
  background: linear-gradient(135deg, var(--bg-soft), var(--bg-softer));
  border-radius: 16px;
  padding: clamp(2rem, 4vw, 3rem);
  text-align: center;
}

.cta h2 {
  font-size: clamp(1.85rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.cta p {
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 2rem;
  max-width: 32rem;
  margin-left: auto;
  margin-right: auto;
}

/* ──────────── ABOUT ──────────── */

.about {
  display: grid;
  grid-template-columns: 16rem 1fr;
  gap: 2.5rem;
  align-items: start;
}

.about__profile {
  position: sticky;
  top: calc(var(--nav-h) + 2rem);
}

.about__photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dk) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  font-size: 4rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  margin-bottom: 1.5rem;
}

.about__meta {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.about__meta li {
  display: flex;
  flex-direction: column;
  padding: 0.85rem 1rem;
  background: var(--bg-soft);
  border-radius: 8px;
  font-size: 0.95rem;
}

.about__meta span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.about__sub {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  margin-top: 1.75rem;
}

.about__sub:first-child { margin-top: 0; }

.timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 0.5rem;
}

.timeline li {
  padding: 1rem 1.25rem;
  background: var(--bg-soft);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.timeline__date {
  font-size: 0.78rem;
  color: var(--accent-dk);
  font-weight: 500;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.timeline__title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.timeline__org {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.timeline__desc {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.55;
}

.about__intro {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  max-width: 36rem;
}

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chips li {
  padding: 0.45rem 0.95rem;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--fg);
}

/* ──────────── COMPÉTENCES ──────────── */

.skills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.skill {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 1.5rem 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
}

.skill__title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-dk);
  margin-bottom: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--rule);
}

.skill ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.skill li {
  font-size: 0.95rem;
  color: var(--fg);
}

/* ──────────── PROJETS ──────────── */

.projects {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.project {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  transition: background 0.2s ease, transform 0.2s ease;
}

.project:hover {
  background: var(--bg-softer);
  transform: translateY(-2px);
}

.project__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.project h3 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.project__year {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.project p {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tags li {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--accent-dk);
}

/* ──────────── ARTICLES (list + post) ──────────── */

/* Cover gradients per category */
[data-cover="react"]     { --cover-a: #176E69; --cover-b: #5AD8D5; }
[data-cover="opinion"]   { --cover-a: #1F8580; --cover-b: #42C7C4; }
[data-cover="tutoriel"]  { --cover-a: #176E69; --cover-b: #42C7C4; }
[data-cover="procedure"] { --cover-a: #0F4F4D; --cover-b: #42C7C4; }

.article-filters {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0 0 2rem;
}

.article-filter {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.article-filter:hover {
  color: var(--fg);
  border-color: var(--accent-dk);
}

.article-filter.is-active {
  background: var(--accent-dk);
  border-color: var(--accent-dk);
  color: #FFFFFF;
}

.article-filter__count {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.article-filter:hover .article-filter__count {
  color: var(--fg);
}

.article-filter.is-active .article-filter__count {
  color: rgba(255, 255, 255, 0.7);
}

/* Card grid — catalogue 3 colonnes */
.article-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  padding: 0;
  margin: 0;
}

.article-list > li { width: 100%; }

/* Card — vertical (cover en haut, body en bas) */
.article-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  color: inherit;
  height: 100%;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.article-card:hover {
  background: var(--bg-softer);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -16px rgba(30, 58, 95, 0.18);
  border-color: var(--accent);
}

.article-card__cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--cover-a, var(--accent)), var(--cover-b, var(--accent-dk)));
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 1rem 1.25rem;
  color: rgba(255, 255, 255, 0.95);
  overflow: hidden;
}

.article-card__cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.article-card__cover:has(.article-card__cover-img)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: none;
  z-index: 1;
  pointer-events: none;
}

/* Cover image self-suffisante : on cache pill catégorie + grand label */
.article-card__cover:has(.article-card__cover-img) .article-card__cover-cat,
.article-card__cover:has(.article-card__cover-img) .article-card__cover-label,
.post__cover:has(.post__cover-img) .post__cover-cat,
.post__cover:has(.post__cover-img) .post__cover-label {
  display: none;
}

.article-card__cover-img { z-index: 0; }

.article-card__cover-label {
  position: relative;
  z-index: 2;
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.article-card__cover-cat {
  position: absolute;
  z-index: 2;
  top: 1rem;
  right: 1.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent-dk);
  color: #FFFFFF;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}

.article-card__body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.article-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.article-card__sep { opacity: 0.5; }

.article-card__meta-cat,
.post__meta-cat {
  background: var(--accent-dk);
  color: #FFFFFF;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.article-card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 0.6rem;
}

.article-card p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.article-card__more {
  color: var(--accent-dk);
  font-weight: 500;
  font-size: 0.92rem;
}

.article-card:hover .article-card__more { color: var(--fg); }

/* ─── POST (article page) ─── */

.post {
  max-width: 64rem;
  margin: 0 auto;
  padding: 2rem 0 5rem;
}

.post__main {
  display: grid;
  grid-template-columns: 13rem 1fr;
  gap: 3rem;
  margin-top: 2.5rem;
  align-items: start;
}

.post__main .prose { min-width: 0; }

.post__back {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.post__back a {
  color: var(--accent-dk);
  transition: color 0.15s ease;
}

.post__back a:hover { color: var(--fg); }

/* Cover band at top of article */
.post__cover {
  position: relative;
  height: 280px;
  background: linear-gradient(135deg, var(--cover-a, var(--accent)), var(--cover-b, var(--accent-dk)));
  border-radius: 16px;
  margin-bottom: 2.75rem;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 2rem 2.5rem;
  box-shadow: 0 12px 28px -16px rgba(30, 58, 95, 0.18);
}

.post__cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.post__cover:has(.post__cover-img)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: none;
  z-index: 1;
  pointer-events: none;
}

.post__cover-img { z-index: 0; }
.post__cover-label { position: relative; z-index: 2; }
.post__cover-cat { z-index: 2; }

.post__cover-label {
  font-size: 5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.9;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.post__cover-cat {
  position: absolute;
  top: 1.5rem;
  right: 1.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--accent-dk);
  color: #FFFFFF;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
}

.post__head {
  margin-bottom: 2.75rem;
}

.post__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.post__head h1 {
  font-size: clamp(2.25rem, 4.5vw, 3.25rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}

.post__lede {
  font-size: 1.28rem;
  line-height: 1.55;
  color: var(--fg);
  font-weight: 400;
  max-width: 42rem;
  padding-left: 1.1rem;
  border-left: 3px solid var(--accent);
}

.post__lede code {
  background: var(--bg-soft);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.92em;
  color: var(--accent-dk);
}

/* ─── Reading progress bar ─── */

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  width: 0;
  z-index: 30;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* ─── Inline sticky TOC (desktop only, lives in .post__main grid) ─── */

.toc {
  display: none;
}

@media (min-width: 880px) {
  .toc {
    display: block;
    position: sticky;
    top: calc(var(--nav-h) + 1.5rem);
    align-self: start;
    padding: 0.5rem 0;
    max-height: calc(100vh - var(--nav-h) - 3rem);
    overflow-y: auto;
  }
}

.toc__heading {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-dk);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
}

.toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.toc__list li { margin: 0; }

.toc__list a {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
  padding: 0.45rem 0 0.45rem 0.85rem;
  border-left: 2px solid var(--rule);
  transition: color 0.2s ease, border-color 0.2s ease, padding-left 0.2s ease;
}

.toc__list a:hover {
  color: var(--fg);
  border-left-color: var(--accent-dk);
}

.toc__list a.is-active {
  color: var(--accent-dk);
  font-weight: 500;
  border-left-color: var(--accent);
  padding-left: 1rem;
}

/* ─── Prose body ─── */

.prose {
  font-size: 1.07rem;
  line-height: 1.75;
  color: var(--fg);
}

/* Heading anchor link on hover */
.prose h2 {
  position: relative;
  scroll-margin-top: 5rem;
}

.prose h2 .h-anchor {
  margin-left: 0.5rem;
  color: var(--accent);
  font-weight: 400;
  font-size: 0.7em;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.prose h2:hover .h-anchor { opacity: 0.45; }
.prose h2 .h-anchor:hover { opacity: 1; }

/* Lead paragraph (first one) gets a subtle boost */
.prose > p:first-of-type {
  font-size: 1.12rem;
  color: var(--fg);
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose .codefig {
  margin-bottom: 1.5rem;
}

/* Drop cap on first paragraph */
.prose > p:first-child::first-letter {
  font-family: 'Nunito', sans-serif;
  font-size: 3.2em;
  font-weight: 600;
  float: left;
  line-height: 0.85;
  margin: 0.1em 0.12em 0 0;
  color: var(--accent);
}

.prose h2 {
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.25;
  margin-top: 3.5rem;
  margin-bottom: 1.35rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.prose > h2:first-child,
.prose > p:first-child + h2 {
  border-top: none;
  padding-top: 0;
  margin-top: 2.5rem;
}

.prose h3 {
  font-size: 1.18rem;
  font-weight: 600;
  margin-top: 2.25rem;
  margin-bottom: 0.85rem;
  color: var(--accent-dk);
}

.prose h3::before {
  content: '';
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 0.65rem;
  vertical-align: middle;
  transform: translateY(-2px);
}

.prose ul,
.prose ol {
  padding-left: 1.5rem;
}

.prose li {
  margin-bottom: 0.5rem;
}

.prose li::marker {
  color: var(--accent);
}

.prose strong { font-weight: 600; color: var(--fg); }

.prose a {
  color: var(--accent-dk);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}

.prose a:hover { text-decoration-color: var(--accent); }

.prose code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-softer);
  border: 1px solid var(--rule);
  padding: 0.05em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--accent-dk);
}

.prose pre {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.6;
}

.prose pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--fg);
  font-size: inherit;
}

/* Code block with filename header */
.codefig {
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-soft);
}

.codefig__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 1rem;
  background: var(--bg-softer);
  border-bottom: 1px solid var(--rule);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--muted);
}

.codefig__lang {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.65rem;
  color: var(--accent-dk);
  font-weight: 500;
}

.codefig__head-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.codefig__copy {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.codefig__copy:hover {
  color: var(--fg);
  border-color: var(--accent-dk);
}

.codefig__copy.is-copied {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(66, 199, 196, 0.08);
}

.codefig__copy svg {
  width: 12px;
  height: 12px;
  display: block;
}

.codefig pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.prose blockquote {
  position: relative;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  padding: 1.1rem 1.4rem 1.1rem 1.5rem;
  margin: 2.25rem 0;
  font-size: 1.05rem;
  line-height: 1.6;
  font-style: normal;
  color: var(--fg);
  border-radius: 0 8px 8px 0;
}

.prose blockquote::before { content: none; }

.prose blockquote p { margin-bottom: 0; }
.prose blockquote p + p { margin-top: 0.75rem; }
.prose blockquote strong { color: var(--accent-dk); }

.prose figure {
  margin: 2.25rem 0;
  max-width: 100%;
}

.prose img,
.prose figure img,
.prose video,
.prose figure video {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--rule);
  margin: 1.75rem auto;
  box-shadow: 0 8px 24px -14px rgba(30, 58, 95, 0.12);
  background: var(--bg-soft);
}

.prose figure img,
.prose figure video { margin: 0 auto; }

.prose figcaption {
  font-size: 0.83rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.75rem;
  font-style: italic;
  max-width: 38rem;
  margin-left: auto;
  margin-right: auto;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.94rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}

.prose table th,
.prose table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.prose table th {
  font-weight: 600;
  color: var(--fg);
  background: var(--bg-softer);
  border-bottom: 2px solid var(--accent);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.prose table tbody tr:nth-child(even) td {
  background: var(--bg-soft);
}

.prose table tbody tr:last-child td {
  border-bottom: none;
}

.prose table code {
  font-size: 0.86em;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

.post__foot {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.post__foot .tags { margin-bottom: 0; }
.post__foot .post__back { margin-bottom: 0; }

/* Author card after post */
.author-card {
  margin-top: 3.5rem;
  padding: 2rem 2.25rem;
  background: var(--bg-soft);
  border-radius: 14px;
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 1.5rem;
  align-items: start;
}

.author-card__photo {
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dk));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  font-size: 1.5rem;
  font-weight: 600;
}

.author-card__body h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.author-card__body p {
  font-size: 0.93rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0.75rem;
}

.author-card__body a {
  color: var(--accent-dk);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.author-card__body a:hover { color: var(--fg); }

/* Lire ensuite */
.related {
  max-width: 64rem;
  margin: 5rem auto 0;
  padding: 0 var(--gutter);
}

.related h2 {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-dk);
  margin-bottom: 1.5rem;
}

.related__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.related__card {
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  color: inherit;
  transition: background 0.2s ease, transform 0.2s ease;
}

.related__card:hover {
  background: var(--bg-softer);
  transform: translateY(-2px);
}

.related__card__cat {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-dk);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.related__card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.related__card p {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ──────────── CONTACT ──────────── */

.contact-simple {
  text-align: center;
  padding: 3rem 0 4rem;
  max-width: 36rem;
  margin: 0 auto;
}

.contact-simple__kicker {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.contact-simple__email {
  display: inline-block;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
  margin-bottom: 2.5rem;
}

.contact-simple__email:hover {
  color: var(--accent-dk);
  text-decoration-color: var(--accent);
}

.contact-simple__socials {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 3rem;
  padding: 0;
}

.contact-simple__socials a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent-dk);
  transition: color 0.15s ease;
}

.contact-simple__socials a:hover {
  color: var(--fg);
}

.contact-simple__meta {
  font-size: 0.85rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.04em;
}

@media (max-width: 540px) {
  .contact-simple__socials {
    flex-direction: column;
    gap: 0.75rem;
  }
}


.contact {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

.form {
  background: var(--bg-soft);
  padding: 2rem;
  border-radius: 12px;
}

.form__title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.form__row {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
}

.form label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 0.5rem;
}

.form input,
.form textarea {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.75rem 0.95rem;
  outline: none;
  transition: border-color 0.15s ease;
  resize: vertical;
  width: 100%;
}

.form input::placeholder,
.form textarea::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.form input:focus,
.form textarea:focus {
  border-color: var(--accent);
}

.form__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.contact__side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-card {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
}

.info-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
}

.info-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.info-card li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.93rem;
}

.info-card__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.info-card a {
  color: var(--accent-dk);
  transition: color 0.15s ease;
}

.info-card a:hover { color: var(--fg); }

.info-card__links li {
  flex-direction: row;
}

.info-card__links a {
  font-weight: 500;
}

/* ──────────── FOOT ──────────── */

.foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 3rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ──────────── RESPONSIVE ──────────── */

@media (max-width: 880px) {
  .nav__links { gap: 1rem; font-size: 0.85rem; }
  .nav__links a { font-size: 0.85rem; }

  .hero { padding: 4rem 0 5rem; }

  section { padding: 4rem 0; }

  .about {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .about__profile {
    position: static;
    display: grid;
    grid-template-columns: 8rem 1fr;
    gap: 1.5rem;
    align-items: start;
  }

  .about__photo {
    font-size: 2rem;
    margin-bottom: 0;
  }

  .skills { grid-template-columns: repeat(2, 1fr); }
  .projects { grid-template-columns: 1fr; }
  .expertise { grid-template-columns: 1fr; }

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

  .page-head { padding: 3rem 0 2.5rem; }

  .article-list { grid-template-columns: repeat(2, 1fr); }
  .article-card__cover { padding: 1rem 1.25rem; }
  .article-card__cover-label { font-size: 1.75rem; }

  .post { padding: 1.5rem 0 4rem; }
  .post__main { grid-template-columns: 1fr; gap: 1.5rem; margin-top: 1.5rem; }
  .post__cover { height: 150px; padding: 1.25rem 1.5rem; }
  .post__cover-label { font-size: 3rem; }
  .post__head { margin-bottom: 2rem; }
  .post__lede { font-size: 1.05rem; }
  .prose { font-size: 1rem; }
  .prose h2 { font-size: 1.35rem; margin-top: 2.25rem; }
  .prose pre { font-size: 0.82rem; padding: 1rem; }
  .prose blockquote { font-size: 1.05rem; padding-left: 1.5rem; }

  .author-card { grid-template-columns: 4rem 1fr; gap: 1rem; padding: 1.5rem; }
  .author-card__photo { width: 4rem; height: 4rem; font-size: 1.25rem; }

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

/* ──────────── DARK THEME ──────────── */

[data-theme="dark"] {
  --bg:         #0E1116;
  --bg-soft:    #161A22;
  --bg-softer:  #1F2530;
  --fg:         #E8ECEF;
  --muted:      #8B95A3;
  --rule:       #2A323F;
  --accent:     #42C7C4;
  --accent-dk:  #2A9F9C;
  --terra:      #FF6B6B;
}

[data-theme="dark"] .nav {
  background: rgba(14, 17, 22, 0.85);
}

[data-theme="dark"] [data-cover="react"]     { --cover-a: #1A4B4A; --cover-b: #42C7C4; }
[data-theme="dark"] [data-cover="opinion"]   { --cover-a: #143A39; --cover-b: #2A9F9C; }
[data-theme="dark"] [data-cover="tutoriel"]  { --cover-a: #1F2530; --cover-b: #42C7C4; }
[data-theme="dark"] [data-cover="procedure"] { --cover-a: #0E1116; --cover-b: #42C7C4; }

[data-theme="dark"] .nav__section {
  color: var(--accent);
}

[data-theme="dark"] .article-card:hover,
[data-theme="dark"] .post__cover {
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .prose img {
  box-shadow: 0 8px 24px -14px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .article-card__cover-cat,
[data-theme="dark"] .post__cover-cat {
  background: var(--accent);
  color: var(--bg);
}

@media (max-width: 540px) {
  .nav__brand { font-size: 0.85rem; }

  .nav__links {
    display: none;
  }

  .nav__theme {
    display: none;
  }

  .article-list { grid-template-columns: 1fr; }

  .hero h1 { font-size: 2.75rem; }

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

  .about__photo {
    width: 8rem;
    font-size: 2rem;
  }

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

  .form { padding: 1.5rem; }

  .foot { flex-direction: column; gap: 0.5rem; }
}
