:root {
  --bg: #fcf8f3;
  --surface: #ffffff;
  --ink: #081849;
  --ink-soft: #5f3475;
  --link: #293b83;
  --line: rgba(8, 24, 73, 0.12);

  --rust: #893172;
  --nav: #5f3475;
  --nav-ink: #ffffff;
  --blue: #213885;
  --blue-soft: #cccacc;
}

/* Thème sombre : regroupement media query et data-attribute */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #081849;
    --surface: #142252;
    --ink: #ecdfd2;
    --ink-soft: #cccacc;
    --link: #a0b1f3;
    --line: rgba(236, 223, 210, 0.12);

    --rust: #893172;
    --nav: #5f3475;
    --nav-ink: #ecdfd2;
    --blue: #6e86e8;
    --blue-soft: #213885;
  }
}

:root[data-theme="dark"] {
  --bg: #081849;
  --surface: #142252;
  --ink: #ecdfd2;
  --ink-soft: #cccacc;
  --link: #a0b1f3;
  --line: rgba(236, 223, 210, 0.12);

  --rust: #893172;
  --nav: #5f3475;
  --nav-ink: #ecdfd2;
  --blue: #6e86e8;
  --blue-soft: #213885;
}

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

html { 
  scroll-padding-top: 84px; 
  scroll-behavior: smooth; 
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Header ---------- */
header {
  position: sticky; 
  top: 0; 
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: env(safe-area-inset-top, 0px) 0 0 0;
}

.header-inner {
  max-width: 1180px; 
  margin: 0 auto;
  display: flex; 
  align-items: center; 
  justify-content: space-between;
  padding: 14px 24px; 
  gap: 24px; 
  flex-wrap: wrap;
}

.brand { 
  display: flex; 
  align-items: center; 
  gap: 14px; 
}

.brand .logo {
  border-radius: 50%;
  flex: none;
}

.brand .name {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
}

nav {
  background: var(--nav);
  border-radius: 14px;
  padding: 6px;
  display: flex; 
  gap: 4px; 
  flex-wrap: wrap;
}

nav a {
  color: var(--nav-ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 18px;
  border-radius: 14px;
  white-space: nowrap;
  transition: background 0.2s ease;
}

nav a:hover, 
nav a:focus-visible,
nav a.active { 
  background: rgba(255, 255, 255, 0.25); 
}

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

/* ---------- Layout global ---------- */
main { 
  max-width: 1180px; 
  margin: 0 auto; 
  padding: 40px 24px 20px; 
  flex: 1; 
  width: 100%;
}

section { 
  padding: 18px 0 64px; 
  scroll-margin-top: 84px; 
}

/* ---------- Hero ---------- */
.hero .imgblock {
  min-height: 420px;
  padding: 44px;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.hero .imgblock::before {
  content: "";
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
}

.hero h1 {
  position: relative;
  z-index: 2;
  color: #fff;
  font-size: 4.5rem;
  margin: 0;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

/* ---------- Blocs d'images & crédits ---------- */
.imgblock {
  border-radius: 44px;
  display: flex; 
  align-items: flex-start;
  position: relative;
  overflow: hidden;
}

.imgblock .credit {
  position: absolute;
  bottom: 10px;
  right: 12px;
  margin: 0;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: 6px;
  z-index: 2;
}

.imgblock .credit.left {
  right: auto;
  left: 12px;
}

.credit a {
  color: #ffffff;
  text-decoration: underline;
  opacity: 0.9;
}

.credit a:hover {
  opacity: 1;
}

.pill-title {
  display: inline-block;
  background: var(--rust);
  color: #fff;
  font-weight: 700;
  font-size: 1.3rem;
  padding: 12px 26px;
  border-radius: 14px;
  margin: 0 0 20px;
}

.full-title {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--nav);
  color: #fff;
  font-weight: 700;
  font-size: 2rem;
  padding: 14px 20px;
  border-radius: 14px;
  margin: 0 0 20px;
}

.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: start;
}

.split p, 
.split a {
  color: var(--ink);
  line-height: 1.7;
  max-width: 62ch;
}

.project-date {
  font-size: 0.9rem;
  color: #6c757d;
  margin: 3px 0 3px 0;
  font-weight: 500;
}

@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; }
  .hero h1 { font-size: 3rem; }
}

/* ---------- Timeline ---------- */
.card-timeline {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.timeline-entry {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--rust);
  border-radius: 12px;
  padding: 16px 20px;
}

.timeline-date {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--rust);
  letter-spacing: 0.04em;
}

.timeline-entry h3 {
  margin: 4px 0 2px;
  font-size: 1.1rem;
  color: var(--ink);
}

.timeline-entry .institution {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.timeline-entry p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ---------- Compétences (Profil) ---------- */
.skills-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.skills-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
}

.skills-card h3 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  color: var(--ink);
}

.badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.badge:hover {
  transform: translateY(-2px);
  border-color: var(--rust);
}

/* ---------- Bannière Next Step ---------- */
.next-step-section {
  padding: 40px 0 20px;
}

.next-step-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 44px 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.next-step-card h2 {
  margin: 0;
  font-size: 1.6rem;
  color: var(--ink);
  font-weight: 800;
}

.next-step-card p {
  margin: 0;
  max-width: 55ch;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.next-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--rust);
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px 32px;
  border-radius: 50px;
  margin-top: 10px;
  box-shadow: 0 4px 14px rgba(137, 49, 114, 0.35);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.next-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

/* ---------- Footer ---------- */
footer {
  background: var(--nav);
  color: var(--nav-ink);
  padding: 18px 24px calc(18px + env(safe-area-inset-bottom, 0px));
}

.footer-inner {
  max-width: 1180px; 
  margin: 0 auto;
  display: flex; 
  justify-content: center; 
  gap: 36px;
  font-weight: 600; 
  font-size: 0.95rem;
  flex-wrap: wrap;
}

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

footer a:hover { 
  text-decoration: underline; 
}

/* ---------- Scroll reveal ---------- */
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: translateY(0); }
}

@supports (animation-timeline: view()) {
  .reveal {
    animation: reveal-up linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 30%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none !important; }
}