/* Socle commun du portfolio : variables, base, composants, formulaires, impression. */

@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/plex-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/plex-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --bg: #10151c;
  --bg-alt: #151c25;
  --terminal: #0a0e13;
  --line: #2a3340;
  --text: #e6e9ee;
  --muted: #a3adbb;
  --accent: #f3b03f;
  --loss: #e8825f;
  --ok: #6fd39a;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;
  --space-1: .5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --radius: 10px;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1.0625rem/1.65 var(--font-body); }
h1, h2, h3, p, ul, ol, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1, h2, h3 { font-weight: 600; line-height: 1.15; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 1.5rem + 3vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.2rem); }
h3 { font-size: 1.2rem; line-height: 1.3; }
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: .2em; }
strong { font-weight: 600; color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.container { width: min(100% - 2.5rem, 70rem); margin-inline: auto; }
.prose { max-width: 42rem; }
.prose p + p { margin-top: var(--space-2); }
.skip-link { position: absolute; left: var(--space-2); top: -4rem; z-index: 30; padding: .6rem 1rem; background: var(--accent); color: var(--bg); }
.skip-link:focus { top: var(--space-1); }

/* En-tête */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; min-height: 4rem; }
.logo { font-family: var(--font-mono); color: var(--accent); text-decoration: none; padding-block: .6rem; }
.nav-toggle { display: none; min-height: 44px; padding: 0 .9rem; background: none; color: var(--text); border: 1px solid var(--line); border-radius: 6px; font: inherit; cursor: pointer; }
.nav-list { display: flex; gap: var(--space-3); }
.nav-list a { display: block; padding-block: .6rem; color: var(--muted); text-decoration: none; font-size: 1rem; }
.nav-list a:hover { color: var(--text); }
.nav-list a[aria-current="page"] { color: var(--text); box-shadow: 0 2px 0 var(--accent); }

/* Sections */
.section { padding-block: var(--space-5); }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.section__head { max-width: 42rem; margin-bottom: var(--space-4); }
.section__head p { margin-top: .6rem; color: var(--muted); }
.section__more { margin-top: var(--space-4); }
.kicker { display: block; margin-bottom: .6rem; font: 400 .875rem/1.4 var(--font-mono); color: var(--accent); }
.page-intro { padding-block: var(--space-5) var(--space-4); border-bottom: 1px solid var(--line); }
.page-intro p { max-width: 42rem; margin-top: var(--space-2); font-size: 1.2rem; color: var(--muted); }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: .55rem 1.2rem; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: var(--bg); font: 600 1rem/1.3 var(--font-body); text-decoration: none; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s; }
.btn:hover { background: #ffc766; border-color: #ffc766; }
.btn--ghost { background: transparent; color: var(--text); border-color: #4b5869; }
.btn--ghost:hover { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }

/* Cartes et grilles */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: var(--space-3); }
.card { display: flex; flex-direction: column; gap: .6rem; padding: var(--space-3); background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius); }
.section--alt .card { background: var(--bg); }
.card p, .card li { color: var(--muted); font-size: 1rem; }
.card__media { margin: calc(var(--space-3) * -1) calc(var(--space-3) * -1) .4rem; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; background: var(--terminal); }
.card__media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.card__foot { margin-top: auto; padding-top: .6rem; }
.card ul:not(.tags) { display: grid; gap: .3rem; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { padding: .1rem .5rem; border: 1px solid var(--line); border-radius: 4px; font: 400 .8125rem/1.6 var(--font-mono); color: var(--muted); }
.card .status, .status { font: 400 .875rem/1.4 var(--font-mono); color: var(--muted); }
.card .status--ok { color: var(--ok); }
.card .status--now { color: var(--accent); }

/* Frise */
.timeline { display: grid; gap: var(--space-3); border-left: 2px solid var(--line); padding-left: var(--space-3); }
.timeline__item { position: relative; }
.timeline__item::before { content: ""; position: absolute; left: calc(var(--space-3) * -1 - 7px); top: .5rem; width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.timeline__item--now::before { background: var(--accent); }
.timeline__date { font: 400 .875rem/1.4 var(--font-mono); color: var(--accent); }
.timeline__place { color: var(--muted); }
.timeline__item ul { margin-top: .4rem; display: grid; gap: .2rem; color: var(--muted); font-size: 1rem; }
.timeline__item li::before { content: "– "; }

/* Tableau */
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: 1rem; }
th, td { padding: .7rem .8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font-weight: 600; }
td { color: var(--muted); }

/* Fenêtres (élément natif dialog) */
.dialog { width: min(100% - 1.5rem, 56rem); max-height: calc(100dvh - 1.5rem); padding: 0; background: var(--bg-alt); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); }
.dialog::backdrop { background: rgba(5, 8, 12, .8); }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: .75rem var(--space-3); border-bottom: 1px solid var(--line); }
.dialog__head h2 { font-size: 1.15rem; }
.dialog__body { padding: var(--space-3); }
.dialog__body img { width: 100%; max-height: 55vh; object-fit: contain; margin-bottom: var(--space-2); }
.dialog__body p { color: var(--muted); margin-bottom: var(--space-2); }
.dialog__frame { width: 100%; height: 65vh; border: 0; background: #fff; border-radius: 4px; }

/* Formulaires */
.form { display: grid; gap: var(--space-2); max-width: 36rem; }
.form label { display: block; margin-bottom: .25rem; font-weight: 600; font-size: 1rem; }
.form input, .form textarea { width: 100%; min-height: 46px; padding: .6rem .75rem; background: var(--terminal); color: var(--text); border: 1px solid #4b5869; border-radius: 6px; font: inherit; }
.form textarea { min-height: 9rem; resize: vertical; }
.form__trap { position: absolute; left: -9999px; }
.form__status--ok { color: var(--ok); }
.form__status--error { color: var(--loss); }

/* Pied de page */
.site-footer { padding-block: var(--space-4); border-top: 1px solid var(--line); color: var(--muted); font-size: 1rem; }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: space-between; align-items: center; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.site-footer a { display: inline-block; padding-block: .4rem; color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* Mise en page des pages intérieures */
.page-intro__actions { margin-top: var(--space-3); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.split .prose h2 { margin-bottom: var(--space-2); }
.split__side { display: grid; gap: var(--space-3); }
.portrait { width: 100%; border-radius: var(--radius); }
.facts { display: grid; gap: .7rem; font-size: 1rem; }
.facts span { display: block; font: 400 .8125rem/1.4 var(--font-mono); color: var(--accent); }

/* Filtres */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: var(--space-4); }
.filter { min-height: 44px; padding: .4rem 1rem; background: none; color: var(--muted); border: 1px solid #4b5869; border-radius: 99px; font: inherit; font-size: 1rem; cursor: pointer; transition: color .15s, border-color .15s; }
.filter:hover { color: var(--text); border-color: var(--text); }
.filter[aria-pressed="true"] { color: var(--bg); background: var(--accent); border-color: var(--accent); font-weight: 600; }
.card[hidden] { display: none; }
html:not(.js) .js-only { display: none; }

/* Apparition au défilement */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease-out, transform .5s ease-out; }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* Téléphone */
@media (max-width: 760px) {
  body { font-size: 1rem; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .section { padding-block: var(--space-4); }
  .js .nav-toggle { display: block; }
  .js .site-nav { display: none; position: absolute; inset: 100% 0 auto; background: var(--bg); border-bottom: 1px solid var(--line); }
  .js .site-nav.is-open { display: block; }
  .site-header__inner { flex-wrap: wrap; }
  .nav-list { flex-wrap: wrap; gap: 0 var(--space-2); }
  .js .nav-list { flex-direction: column; flex-wrap: nowrap; gap: 0; width: min(100% - 2.5rem, 70rem); margin-inline: auto; padding-block: var(--space-1); }
  .nav-list a { padding-block: .7rem; }
  .nav-list a[aria-current="page"] { box-shadow: none; color: var(--accent); }
}

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

/* Impression */
@media print {
  :root { --bg: #fff; --bg-alt: #fff; --terminal: #fff; --line: #bbb; --text: #111; --muted: #333; --accent: #111; --loss: #111; --ok: #111; }
  strong { color: #111; }
  .site-header, .site-footer, .btn, .form, .skip-link { display: none; }
  .js .reveal { opacity: 1; transform: none; }
  .section { padding-block: 1rem; break-inside: avoid; }
}
