/* ==========================================================================
   Portfolio Samuel Almandin — styles
   Thème sombre par défaut, clair via [data-theme="light"].
   Langue : les éléments [data-l="fr"] / [data-l="en"] sont masqués selon <html lang>.
   ========================================================================== */

@font-face { font-family: "Inter"; src: url("../fonts/inter-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("../fonts/space-grotesk-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --bg: #0B0D10;
  --surface: #14171C;
  --surface-2: #1A1E24;
  --border: #23272F;
  --text: #EDEDED;
  --muted: #9AA0A8;
  --accent: #2EE6A8;
  --accent-text: #2EE6A8;      /* accent utilisé comme couleur de texte */
  --accent-bg: #2EE6A8;        /* fond des boutons principaux */
  --on-accent: #0B0D10;
  --accent-soft: rgba(46, 230, 168, .10);
  --coral: #FF8A4C;
  --coral-text: #FF8A4C;
  --dot: rgba(237, 237, 237, .055);

  --font-head: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --r-card: 12px;
  --r-btn: 8px;
  --r-badge: 6px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t: 200ms;
  --wrap: 1120px;
  --gutter: 16px;
  --header-h: 64px;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --surface-2: #F3F2EE;
  --border: #E6E4DE;
  --text: #16181D;
  --muted: #5E636B;
  --accent: #0E9F74;
  /* #0E9F74 n'atteint pas 4,5:1 sur fond clair : version plus profonde pour le texte et les boutons */
  --accent-text: #0A7A5A;
  --accent-bg: #0A7A5A;
  --on-accent: #FFFFFF;
  --accent-soft: rgba(14, 159, 116, .10);
  --coral: #E0662A;
  --coral-text: #B04A16;     /* #E0662A = 3,3:1 sur fond clair, insuffisant pour du texte */
  --dot: rgba(22, 24, 29, .06);
  color-scheme: light;
}

html:not([lang="en"]) [data-l="en"],
html[lang="en"] [data-l="fr"] { display: none !important; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 56px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; letter-spacing: -.02em; line-height: 1.1; margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--on-accent); }

.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
@media (min-width: 768px) { :root { --gutter: 24px; } }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--font-mono); font-size: .8125rem; }
.muted { color: var(--muted); }
.link { color: var(--accent-text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.link:hover { text-decoration-thickness: 2px; }

.skip { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 12px; background: var(--accent-bg); color: var(--on-accent); border-radius: var(--r-btn); }
.skip:focus { top: 12px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header__bar { display: flex; align-items: center; gap: 12px; height: var(--header-h); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 600; letter-spacing: -.01em; margin-right: auto; }
.logo__mark { width: 30px; height: 30px; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 6px 10px; border-radius: var(--r-btn); color: var(--muted); font-size: .9375rem; transition: color var(--t) var(--ease), background var(--t) var(--ease); }
.nav a:hover { color: var(--text); background: var(--surface); }
.tools { display: flex; gap: 6px; }
.tool {
  display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: var(--r-btn); background: transparent; color: var(--muted);
  font-family: var(--font-mono); font-size: .75rem; transition: color var(--t) var(--ease), border-color var(--t) var(--ease);
}
.tool:hover { color: var(--text); border-color: var(--muted); }
.tool .icon { width: 16px; height: 16px; }
:root:not([data-theme="light"]) .tool .i-moon,
:root[data-theme="light"] .tool .i-sun { display: none; }

/* Mobile : les liens passent sur une 2e ligne, pas de menu burger */
@media (max-width: 639px) {
  :root { --header-h: 56px; }
  .header__bar { flex-wrap: wrap; height: auto; padding-block: 10px 0; row-gap: 4px; }
  .nav { order: 3; width: 100%; justify-content: space-between; border-top: 1px solid var(--border); padding-block: 4px; margin-inline: -10px; width: calc(100% + 20px); }
  .nav a { flex: 1; text-align: center; padding-block: 8px; }
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-btn);
  font-weight: 500; font-size: .9375rem; border: 1px solid transparent;
  transition: transform var(--t) var(--ease), background var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease);
}
.btn--primary { background: var(--accent-bg); color: var(--on-accent); }
.btn--primary:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn--ghost { border-color: var(--border); background: var(--surface); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent-text); }
.btn .icon { width: 16px; height: 16px; }

.badge {
  display: inline-flex; align-items: center; padding: 4px 8px;
  font: 400 .8125rem/1.3 var(--font-mono); color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--r-badge); white-space: nowrap;
}
.badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Hero ---------- */
.hero { position: relative; padding-block: 56px 64px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 30% 30%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 70% at 30% 30%, #000 30%, transparent 75%);
}
.hero__grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 1024px) {
  .hero { padding-block: 96px 104px; }
  .hero__grid { grid-template-columns: 1.35fr 1fr; gap: 56px; }
}
.eyebrow { color: var(--muted); margin-bottom: 20px; }
.eyebrow .dot { display: inline-block; vertical-align: 1px; margin-right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 4px color-mix(in srgb, var(--coral) 18%, transparent); }
.hero h1 { font-size: clamp(2.5rem, 1.7rem + 3.2vw, 4.25rem); }
.hero h1 .sub { display: block; color: var(--muted); }
.tagline { margin-top: 20px; font-size: clamp(1.0625rem, 1rem + .3vw, 1.1875rem); max-width: 34ch; }
.tagline::after {
  content: ""; display: inline-block; width: .55em; height: 1.1em; margin-left: 4px; vertical-align: -.18em;
  background: var(--accent); animation: blink 1s steps(1) 4 forwards;
}
@keyframes blink { 50% { opacity: 0; } 100% { opacity: 0; } }
.hero__cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }

/* Panneau « projets phares » façon outil de dev */
.panel { border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); overflow: hidden; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.panel__row {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center;
  padding: 16px; border-bottom: 1px solid var(--border);
  transition: background var(--t) var(--ease);
}
.panel__row:last-child { border-bottom: 0; }
.panel__row:hover { background: var(--surface-2); }
.panel__row:hover .panel__go { color: var(--accent-text); transform: translateX(3px); }
.panel__ico { width: 40px; height: 40px; border-radius: var(--r-btn); display: grid; place-items: center; border: 1px solid var(--border); background: var(--bg); font: 600 1rem var(--font-head); }
.panel__ico--pistachio { color: var(--coral-text); }
.panel__ico--helpdesk { color: var(--accent-text); }
.panel__title { font-family: var(--font-head); font-weight: 600; letter-spacing: -.01em; }
.panel__desc { color: var(--muted); font-size: .9375rem; line-height: 1.45; }
.panel__meta { display: block; margin-top: 4px; color: var(--muted); }
.panel__go { color: var(--muted); transition: transform var(--t) var(--ease), color var(--t) var(--ease); }

/* ---------- Sections ---------- */
.section { padding-block: 72px; border-top: 1px solid var(--border); }
@media (min-width: 1024px) { .section { padding-block: 104px; } }
.section__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 24px; margin-bottom: 32px; }
.section__kicker { color: var(--muted); margin-bottom: 10px; display: block; }
.section h2 { font-size: clamp(1.875rem, 1.5rem + 1.6vw, 2.75rem); }
.section__lead { color: var(--muted); max-width: 52ch; margin-top: 12px; }

/* Filtres */
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: transparent;
  color: var(--muted); font-size: .875rem; min-height: 36px;
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.filter:hover { color: var(--text); }
.filter[aria-pressed="true"] { color: var(--accent-text); border-color: var(--accent); background: var(--accent-soft); }

/* Grille de projets : 1 / 2 / 3 colonnes */
.grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-card);
  background: var(--surface); overflow: hidden;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.card:hover, .card:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 8px 32px -12px var(--accent-soft); outline: none; }
.card__shot { aspect-ratio: 16 / 10; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.card__shot img { width: 100%; height: 100%; object-fit: cover; object-position: top left; transition: transform 250ms var(--ease); }
.card:hover .card__shot img { transform: scale(1.03); }
.card__body { display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 20px; flex: 1; }
.card__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card__title { font-size: 1.25rem; display: inline-flex; align-items: center; gap: 6px; }
.card__title .icon { width: 16px; height: 16px; color: var(--muted); transition: color var(--t) var(--ease), transform var(--t) var(--ease); }
.card:hover .card__title .icon { color: var(--accent-text); transform: translate(2px, -2px); }
.card__desc { color: var(--muted); font-size: .9375rem; line-height: 1.5; }
.card .badges { margin-top: auto; padding-top: 6px; }

.card--next {
  border-style: dashed; background: transparent; justify-content: center; gap: 10px; padding: 28px 20px; min-height: 220px;
}
.card--next:hover { border-color: var(--border); box-shadow: none; }
.card--next .mono { color: var(--accent-text); }

.empty { color: var(--muted); padding: 24px 0; }

/* ---------- À propos ---------- */
.about { display: grid; gap: 32px; }
@media (min-width: 768px) { .about { grid-template-columns: 200px 1fr; gap: 48px; align-items: start; } }
.avatar { width: 160px; aspect-ratio: 1; border-radius: var(--r-card); border: 1px solid var(--border); background: var(--surface); overflow: hidden; }
@media (min-width: 768px) { .avatar { width: 200px; } }
.about__text { display: grid; gap: 16px; max-width: 62ch; }
.about__text p + p { color: var(--muted); }
.timeline { list-style: none; margin: 4px 0 0; padding: 0; border-left: 1px solid var(--border); display: grid; gap: 12px; }
.timeline li { position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding-left: 16px; font-size: .9375rem; line-height: 1.45; }
.timeline li::before { content: ""; position: absolute; left: -4px; top: .5em; width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.timeline li:first-child::before { background: var(--coral); }
.timeline strong { font-weight: 500; }
.stack { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.about__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 8px; }
.about__meta span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9375rem; }

/* ---------- Contact ---------- */
.contact { display: grid; gap: 28px; }
@media (min-width: 1024px) { .contact { grid-template-columns: 1fr 1fr; align-items: end; } }
@media (min-width: 1024px) { .contact { align-items: start; } }
.form { display: grid; gap: 16px; padding: 20px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); }
.field { display: grid; gap: 6px; }
.field label { font-size: .875rem; font-weight: 500; }
.field input, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-btn);
  background: var(--bg); color: var(--text); font: inherit; font-size: 1rem;
  transition: border-color var(--t) var(--ease);
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:hover, .field textarea:hover { border-color: var(--muted); }
.field input:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.form__status { font-size: .9375rem; color: var(--muted); }
.form__status.is-ok { color: var(--accent-text); }
.form__status.is-err { color: var(--coral-text); }
.form [aria-busy="true"] { opacity: .7; pointer-events: none; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding-block: 28px 40px; color: var(--muted); font-size: .875rem; }
.footer__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.footer summary { cursor: pointer; }
.footer summary:hover { color: var(--text); }
.legal-box[open] { flex-basis: 100%; }
.legal { margin-top: 12px; display: grid; gap: 6px; max-width: 70ch; }

/* ---------- Page projet ---------- */
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); margin-bottom: 24px; }
.crumbs a:hover { color: var(--accent-text); }
.p-head { padding-block: 40px 32px; }
@media (min-width: 1024px) { .p-head { padding-block: 64px 40px; } }
.p-head h1 { font-size: clamp(2.5rem, 1.8rem + 3vw, 4rem); }
.p-head__summary { margin-top: 14px; font-size: clamp(1.0625rem, 1rem + .3vw, 1.25rem); max-width: 56ch; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 20px; color: var(--muted); }
.facts dt { display: inline; color: var(--muted); }
.facts dd { display: inline; margin: 0 0 0 6px; color: var(--text); }
.p-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

.browser { margin: 0; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); overflow: hidden; }
.browser__bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.browser__dots { display: flex; gap: 6px; }
.browser__dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.browser__url { flex: 1; min-width: 0; padding: 4px 10px; border-radius: var(--r-badge); background: var(--bg); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser img { width: 100%; }

.p-body { display: grid; gap: 48px; padding-block: 56px 72px; }
@media (min-width: 1024px) { .p-body { grid-template-columns: 1fr 320px; gap: 72px; align-items: start; } }
.prose { display: grid; gap: 40px; }
.prose h2 { font-size: 1.5rem; margin-bottom: 12px; }
.prose p { max-width: 64ch; }
.prose p + p { margin-top: 12px; }
.aside { display: grid; gap: 28px; }
@media (min-width: 1024px) { .aside { position: sticky; top: calc(var(--header-h) + 24px); } }
.aside h2 { font-size: 1rem; font-family: var(--font-mono); font-weight: 400; letter-spacing: 0; color: var(--muted); margin-bottom: 12px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden; }
.stat { background: var(--surface); padding: 16px; }
.stat strong { display: block; font: 600 1.5rem/1.1 var(--font-head); letter-spacing: -.02em; }
.stat span { display: block; margin-top: 6px; color: var(--muted); font-size: .8125rem; line-height: 1.4; }
.note { padding: 14px 16px; border: 1px solid var(--border); border-left: 2px solid var(--coral); border-radius: var(--r-btn); color: var(--muted); font-size: .9375rem; }

.p-nav { display: grid; gap: 10px; padding-block: 32px 72px; border-top: 1px solid var(--border); }
@media (min-width: 768px) { .p-nav { grid-template-columns: 1fr auto 1fr; align-items: center; } }
.p-nav a { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-card); transition: border-color var(--t) var(--ease); }
.p-nav a:hover { border-color: var(--accent); }
.p-nav a span:first-child { color: var(--muted); }
.p-nav a strong { font-family: var(--font-head); font-weight: 600; }
.p-nav__next { text-align: right; align-items: flex-end; }
.p-nav__back { flex-direction: row !important; align-items: center; justify-content: center; color: var(--muted); }
.p-nav__back:hover { color: var(--accent-text); }

/* ---------- Animations ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 250ms var(--ease), transform 250ms var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 200ms; }

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