/* ---------- Dyslexia-friendly typeface ---------- */
@font-face {
  font-family: "OpenDyslexic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/@fontsource/opendyslexic@5.0.0/files/opendyslexic-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "OpenDyslexic";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/@fontsource/opendyslexic@5.0.0/files/opendyslexic-latin-700-normal.woff2") format("woff2");
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 93.75%; } /* ~15px base */
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; }

/* ---------- Design tokens ---------- */
:root {
  --bg: #fefae0;
  --bg-soft: color-mix(in srgb, #fefae0 82%, #dda15e 18%);
  --text: #2a291e;
  --text-muted: #606c38;
  --border: color-mix(in srgb, #dda15e 38%, #fefae0 62%);
  --accent: #606c38;
  --accent-gold: #dda15e;
  --on-gold: #283618;
  --card-shadow: 0 1px 2px rgba(40, 54, 24, 0.06), 0 4px 14px rgba(40, 54, 24, 0.09);
  --font-head: "Inter", sans-serif;
  --font-body: "Inter", sans-serif;
  --max-width: 1080px;
  --resume-width: 1180px;
  --radius: 10px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #2f2a22;                  /* brun crème très foncé */
  --bg-soft: #3b352c;             /* cartes / tags */
  --text: #f7f1e3;                /* crème */
  --text-muted: #d8cfbf;          /* texte secondaire */
  --border: #5a5145;              /* bordures */
  --accent: #e0b16f;              /* doré chaud */
  --accent-gold: #dda15e;
  --on-gold: #2f2a22;
  --card-shadow: 0 1px 2px rgba(0,0,0,.30),
                 0 6px 16px rgba(0,0,0,.35);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2f2a22;
    --bg-soft: #3b352c;
    --text: #f7f1e3;
    --text-muted: #d8cfbf;
    --border: #5a5145;
    --accent: #e0b16f;
    --accent-gold: #dda15e;
    --on-gold: #2f2a22;
    --card-shadow: 0 1px 2px rgba(0,0,0,.30),
                   0 6px 16px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

/* ---------- Dyslexia-friendly mode ---------- */
html[data-dyslexic="true"] {
  --font-head: "OpenDyslexic", Verdana, Tahoma, sans-serif;
  --font-body: "OpenDyslexic", Verdana, Tahoma, sans-serif;
}
html[data-dyslexic="true"] body {
  font-size: 1.05rem;
  line-height: 1.9;
  letter-spacing: 0.02em;
  word-spacing: 0.16em;
}
html[data-dyslexic="true"] h1,
html[data-dyslexic="true"] h2,
html[data-dyslexic="true"] h3,
html[data-dyslexic="true"] h4 {
  letter-spacing: 0.01em;
}
html[data-dyslexic="true"] .eyebrow,
html[data-dyslexic="true"] .section-eyebrow {
  text-transform: none;
  letter-spacing: 0.02em;
}
html[data-dyslexic="true"] .hero-text,
html[data-dyslexic="true"] .project-body p,
html[data-dyslexic="true"] .contact-text,
html[data-dyslexic="true"] .music-intro,
html[data-dyslexic="true"] .timeline-content p,
html[data-dyslexic="true"] .resume-aside p {
  text-align: left;
}

.dyslexia-toggle {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.dyslexia-toggle:hover { border-color: var(--accent); color: var(--accent); }
.dyslexia-toggle.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--on-gold);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--text);
  color: var(--bg);
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--card-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 2000;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Theme / dyslexia / language switch fades ---------- */
html.ui-transition,
html.ui-transition * {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease,
    fill 0.3s ease, box-shadow 0.3s ease, letter-spacing 0.3s ease,
    word-spacing 0.3s ease, line-height 0.3s ease, font-size 0.3s ease !important;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 0.96rem;
  -webkit-font-smoothing: antialiased;
  transition: opacity 0.16s ease;
}

body.lang-fade { opacity: 0.4; }

.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; letter-spacing: -0.015em; }

/* ---------- Header / nav ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

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

.logo {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  position: relative;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.4rem 0;
  transition: color 0.2s ease;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 0%;
  height: 2px;
  background: var(--accent);
  transition: width 0.2s ease;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); }
.nav-link.active::after { width: 100%; }

.toggle-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lang-toggle {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.lang-toggle:hover { border-color: var(--accent); color: var(--accent); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 6px;
  border: 1px solid transparent;
  color: var(--text);
  transition: border-color 0.2s ease;
}
.theme-toggle:hover { border-color: var(--border); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 22px;
}
.nav-toggle span {
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.15rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.82rem;
  transition: background 0.2s ease;
}
.btn-primary {
  background: var(--accent-gold);
  color: var(--on-gold);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent-gold) 85%, black);
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  padding-bottom: 2px;
  border-bottom: 1.5px solid var(--border);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.btn-link:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  padding-top: 8.5rem;
  padding-bottom: 4.5rem;
  text-align: center;
}
.eyebrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}
.hero h1 {
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  line-height: 1.15;
}
.hero-role {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 0.5rem;
}
.hero-text {
  max-width: 520px;
  margin: 1.3rem auto 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}
.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.hero-socials {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2rem;
}
.hero-socials a {
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.hero-socials a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Section shared ---------- */
section { padding: 5rem 0; text-align: center; }
.section-eyebrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}
.section-title {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  margin-bottom: 2.5rem;
}

/* ---------- Projects ---------- */
.project-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  text-align: left;
}
.project-card {
  width: 100%;
  max-width: 420px;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent-gold);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.project-card:hover {
  box-shadow: var(--card-shadow);
}
.project-thumb {
  display: block;
  width: 100%;
  height: 190px;
  min-width: 0;
  object-fit: cover;
  object-position: 50% 62%;
}

.project-body { padding: 1.4rem; }
.project-body h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.project-body p { color: var(--text-muted); font-size: 0.88rem; }
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.tags li {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.24rem 0.6rem;
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--text-muted);
}
.project-links {
  display: flex;
  gap: 1.2rem;
  margin-top: 1.15rem;
}
.project-links a {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  transition: color 0.2s ease;
}
.project-links a:hover { color: var(--accent); }

/* ---------- Resume ---------- */
.resume.container { max-width: var(--resume-width); }

.resume-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 3.5rem;
  text-align: left;
}

.resume-aside h3 { font-size: 0.98rem; margin-bottom: 0.65rem; margin-top: 2.25rem; }
.resume-aside h3:first-child { margin-top: 0; }
.resume-aside p { color: var(--text-muted); font-size: 0.9rem; }

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.5rem;
}
.skill-tags li {
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--text-muted);
}

.resume-aside .btn { margin-top: 2rem; }

.resume-main h3 { font-size: 1rem; margin-bottom: 2rem; }
.timeline-subhead { margin-top: 1rem; }

.timeline-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 1.25rem;
  padding-bottom: 2.25rem;
  position: relative;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: 5px; top: 18px; bottom: 0;
  width: 1px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 11px; height: 11px;
  margin-top: 5px;
  border-radius: 2px;
  background: var(--accent-gold);
}
.timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.timeline-head h4 { font-size: 0.96rem; }
.timeline-date { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.timeline-org { color: var(--accent); font-size: 0.85rem; font-weight: 600; margin: 0.3rem 0 0.5rem; }
.timeline-content p:last-child { color: var(--text-muted); font-size: 0.88rem; }

.timeline-content .timeline-list {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding-left: 1.1rem;
  margin: 0;
  display: grid;
  gap: 0.4rem;
}
.timeline-list li { list-style: disc; }
.timeline-list li::marker { color: var(--accent); }

/* ---------- Music ---------- */
.music-intro { color: var(--text-muted); font-size: 0.92rem; max-width: 460px; margin: 0 auto 1.75rem; }
.music-embed {
  max-width: 480px;
  margin-inline: auto;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.music-embed iframe { display: block; }

/* ---------- Contact ---------- */
.contact-text { color: var(--text-muted); font-size: 0.92rem; max-width: 460px; margin: 0 auto; }
.contact-email {
  display: inline-block;
  font-family: var(--font-head);
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  font-weight: 700;
  margin-top: 1.5rem;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.contact-email:hover { color: var(--accent); border-color: var(--accent); }
.contact-socials { justify-content: center; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.back-top { font-weight: 600; color: var(--text); transition: color 0.2s ease; }
.back-top:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .resume-layout { grid-template-columns: 1fr; gap: 2.5rem; }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: fixed;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem;
    gap: 1.25rem;
    transform: translateY(-130%);
    transition: transform 0.3s ease;
  }
  .nav-links.open { transform: translateY(0); }
  .nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}
