/* ==========================================================================
   julien-pintodafonseca.com
   Thème clair / sombre (préférence système + bouton), aucune dépendance.
   ========================================================================== */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #0f1729;
  --muted: #4f5a6d;
  --border: #dde2ea;
  --accent: #ff7047;          /* orange du logo : aplats et décor */
  --accent-text: #b8401c;     /* orange lisible sur fond clair */
  --on-accent: #1b100c;
  --hero-glow: rgba(255, 112, 71, 0.16);
  --grid-line: rgba(15, 23, 41, 0.05);
  --shadow: 0 1px 2px rgba(15, 23, 41, 0.06), 0 8px 24px rgba(15, 23, 41, 0.06);
  --radius: 14px;
  --max: 1120px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120;
    --surface: #111a2e;
    --surface-2: #17223a;
    --text: #e7ecf4;
    --muted: #9ba7bb;
    --border: #243150;
    --accent: #ff7d57;
    --accent-text: #ff9a7a;
    --on-accent: #1b100c;
    --hero-glow: rgba(255, 125, 87, 0.14);
    --grid-line: rgba(231, 236, 244, 0.045);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111a2e;
  --surface-2: #17223a;
  --text: #e7ecf4;
  --muted: #9ba7bb;
  --border: #243150;
  --accent: #ff7d57;
  --accent-text: #ff9a7a;
  --on-accent: #1b100c;
  --hero-glow: rgba(255, 125, 87, 0.14);
  --grid-line: rgba(231, 236, 244, 0.045);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; scrollbar-gutter: stable; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; }
p { margin: 0; }
sup { font-size: 0.7em; line-height: 0; position: relative; top: -0.5em; vertical-align: baseline; }
a { color: var(--accent-text); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.fill { fill: currentColor; stroke: none; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }

.skip-link { position: absolute; left: 12px; top: -48px; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; z-index: 100; font-weight: 600; }
.skip-link:focus { top: 12px; }

.eyebrow { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 10px; }

/* --------------------------------------------------------------- Boutons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: 0.95rem; text-decoration: none; cursor: pointer;
  transition: border-color .15s, transform .15s, background .15s;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }

/* --------------------------------------------------------------- En-tête */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; margin-right: auto; white-space: nowrap; }
.brand img { width: 32px; height: 32px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; padding: 8px 12px; border-radius: 8px; }
.nav a:hover, .nav a.actif { color: var(--text); background: var(--surface-2); }
.header-actions { display: flex; gap: 8px; }
.menu-btn { display: none; }

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

@media (max-width: 820px) {
  .brand span { display: none; }
  .menu-btn { display: inline-grid; }
  .nav {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 8px 20px 16px; display: none;
  }
  .nav.ouvert { display: flex; }
  .nav a { padding: 12px; }
}

/* --------------------------------------------------------------- Accueil */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(56px, 10vw, 112px) 0 clamp(56px, 9vw, 96px);
  background:
    radial-gradient(60% 70% at 85% 30%, var(--hero-glow), transparent 70%),
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 32px 32px;
  border-bottom: 1px solid var(--border);
}
.hero-inner { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 48px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); letter-spacing: -0.02em; font-weight: 800; }
.lead { margin-top: 18px; font-size: clamp(1.05rem, 2.2vw, 1.2rem); color: var(--muted); max-width: 40em; }
.lead strong { color: var(--text); }
.chips { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font-size: 0.85rem; font-weight: 500; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.hero-actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; }
.hero-photo img {
  width: clamp(160px, 22vw, 240px); height: auto; aspect-ratio: 1; object-fit: cover;
  border-radius: 50%; border: 4px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border), 0 20px 50px -10px var(--hero-glow), var(--shadow);
}

@media (max-width: 720px) {
  .hero-inner { grid-template-columns: 1fr; gap: 28px; }
  .hero-photo { order: -1; }
  .hero-photo img { width: 120px; }
}

/* --------------------------------------------------------------- Sections */
.section { padding: clamp(64px, 9vw, 104px) 0; }
.section-alt { background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { margin-bottom: 40px; max-width: 46em; }
.section-head h2 { font-size: clamp(1.7rem, 4vw, 2.3rem); letter-spacing: -0.015em; }
.section-intro { margin-top: 12px; color: var(--muted); font-size: 1.05rem; }

/* --------------------------------------------------------------- Parcours */
.timeline-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 56px; }
@media (max-width: 900px) { .timeline-grid { grid-template-columns: 1fr; gap: 40px; } }

.col-title { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 20px; }
.col-title:not(:first-child) { margin-top: 48px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 28px 28px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline > li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline > li::before {
  content: ""; position: absolute; left: -8px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.timeline > li:first-child::before { background: var(--accent); }
.tl-date { font-family: var(--mono); font-size: 0.8rem; color: var(--accent-text); margin-bottom: 4px; }
.timeline h4 { font-size: 1.05rem; font-weight: 700; }
.tl-org { color: var(--muted); font-size: 0.93rem; margin-top: 2px; }
.timeline ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 0.95rem; }
.timeline ul li { margin-top: 4px; }

.skills { margin: 0; display: grid; gap: 14px; }
.skills div { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.skills dt { font-weight: 700; font-size: 0.95rem; }
.skills dd { margin: 4px 0 0; color: var(--muted); font-size: 0.93rem; }

/* --------------------------------------------------------------- Projets */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter {
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.filter:hover { color: var(--text); border-color: var(--accent); }
.filter[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.project-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.project-grid li[hidden] { display: none; }
.voir-plus { display: none; justify-content: center; margin-top: 24px; }
@media (max-width: 720px) {
  .project-grid.replie li.en-plus { display: none; }
  .project-grid.replie + .voir-plus { display: flex; }
}

.card {
  position: relative;
  display: flex; flex-direction: column; height: 100%; width: 100%;
  cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
/* Le titre est le bouton ; son pseudo-élément étend la zone cliquable à toute la carte */
.card-link {
  all: unset; cursor: pointer;
}
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card:has(.card-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.card-media { aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; border-bottom: 1px solid var(--border); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card-media img { transform: scale(1.03); }
.card-glyph {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-family: var(--mono); font-size: 1.15rem; color: var(--accent-text);
  background:
    radial-gradient(80% 80% at 50% 50%, var(--hero-glow), transparent 70%),
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--surface-2);
}
.card-body { padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-meta { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.card h3 { font-size: 1.1rem; }
.card p { color: var(--muted); font-size: 0.93rem; }
.tags { list-style: none; padding: 0; margin: auto 0 0; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; }
.tags li { font-size: 0.75rem; font-weight: 600; padding: 3px 9px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }

.noscript { color: var(--muted); }

/* --------------------------------------------------------------- Fiche projet */
dialog { color: var(--text); }
.project-dialog {
  width: min(880px, calc(100% - 24px)); max-height: calc(100dvh - 24px);
  padding: 0; border: 1px solid var(--border); border-radius: 18px;
  background: var(--surface); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.project-dialog::backdrop, .lightbox::backdrop { background: rgba(5, 9, 18, 0.7); backdrop-filter: blur(4px); }
.pd-inner { position: relative; padding: clamp(20px, 4vw, 40px); }
.pd-close { position: sticky; top: 0; float: right; margin: -8px -8px 0 12px; z-index: 2; }
.pd-meta { font-family: var(--mono); font-size: 0.8rem; color: var(--accent-text); text-transform: uppercase; letter-spacing: 0.05em; }
.project-dialog h2 { font-size: clamp(1.5rem, 4vw, 2rem); margin-top: 6px; }
.pd-role { color: var(--muted); margin-top: 6px; font-weight: 500; }
.pd-tags { margin-top: 14px; }
.pd-text { margin-top: 20px; display: grid; gap: 12px; }
.pd-points { margin: 20px 0 0; padding: 16px 18px 16px 36px; background: var(--surface-2); border-radius: 12px; }
.pd-points li + li { margin-top: 4px; }
.pd-section-title { margin-top: 28px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.gallery { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, 45%), 1fr)); gap: 10px; }
.gallery button {
  display: block; width: 100%; padding: 0; border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; cursor: zoom-in; background: var(--surface-2); aspect-ratio: 16 / 10;
}
.gallery img { width: 100%; height: 100%; object-fit: contain; padding: 6px; transition: transform .3s; }
.gallery button:hover img { transform: scale(1.04); }
.gallery button:hover { border-color: var(--accent); }
.pd-video { margin-top: 12px; }
.pd-video video { width: 100%; border-radius: 12px; border: 1px solid var(--border); background: #000; }
.pd-video figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.pd-links { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 10px; }

/* --------------------------------------------------------------- Visionneuse */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0;
  padding: 56px 64px; border: 0; background: transparent;
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox figure { margin: 0; display: grid; justify-items: center; gap: 12px; max-height: 100%; }
.lightbox img { max-width: 100%; max-height: calc(100dvh - 150px); object-fit: contain; border-radius: 8px; background: #fff; }
.lightbox figcaption { color: #e7ecf4; font-size: 0.95rem; text-align: center; }
.lightbox .icon-btn { position: fixed; background: rgba(17, 26, 46, 0.85); color: #fff; border-color: rgba(255, 255, 255, 0.2); }
.lb-close { top: 14px; right: 14px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) {
  .lightbox { padding: 60px 12px 80px; }
  .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; }
}

/* --------------------------------------------------------------- Publications */
.press-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.press-card {
  display: flex; flex-direction: column; gap: 8px; height: 100%;
  padding: 22px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); text-decoration: none; color: var(--text);
  transition: border-color .2s, transform .2s;
}
.press-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.press-meta { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.press-title { font-weight: 700; font-size: 1.05rem; line-height: 1.35; }
.press-link { margin-top: auto; padding-top: 8px; color: var(--accent-text); font-weight: 600; font-size: 0.9rem; }
.press-list-docs { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); margin-bottom: 48px; }
.press-card-static:hover { border-color: var(--border); transform: none; }
.press-summary { color: var(--muted); font-size: 0.93rem; }
.press-card .tags { margin-top: 4px; padding-top: 0; }
.section-head + .col-title { margin-top: 0; }

/* --------------------------------------------------------------- Contact */
.contact { border-top: 1px solid var(--border); background: radial-gradient(50% 80% at 50% 100%, var(--hero-glow), transparent 70%); }
.contact-inner { text-align: center; display: flex; flex-direction: column; align-items: center; }
.contact h2 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.contact-actions { margin-top: 28px; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
@media (max-width: 480px) {
  .contact-actions .btn-primary { width: 100%; justify-content: center; font-size: 0.85rem; }
}

/* --------------------------------------------------------------- Pied de page */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: 0.9rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }

/* --------------------------------------------------------------- Pages simples */
.page { padding: clamp(48px, 8vw, 88px) 0; }
.page .container { max-width: 760px; }
.page h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); letter-spacing: -0.015em; margin-bottom: 32px; }
.page h2 { font-size: 1.2rem; margin: 36px 0 10px; }
.page p + p { margin-top: 10px; }
.page address { font-style: normal; color: var(--muted); }

.notfound { min-height: 100dvh; display: grid; place-items: center; text-align: center; padding: 24px; }
.notfound img { width: min(300px, 75vw); border-radius: 16px; margin: 0 auto 24px; box-shadow: var(--shadow); }
.notfound h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
.notfound p { color: var(--muted); margin: 10px 0 24px; }
