/* LeHourki, photographe
   Noir & blanc, fond gris clair #EAEAEA (choisi par LeHourki). Mono pour le texte, seule couleur : le rouge REC du logo.
   Variante fond noir (essayée, non retenue) : <html lang="fr" data-theme="dark"> */

:root {
  --bg: #eaeaea;         /* fond gris clair */
  --fg: #000;            /* texte, filets forts, boutons actifs */
  --muted: #5c5c5c;      /* texte secondaire (contraste AA sur le gris) */
  --line-soft: #c6c6c6;  /* séparateurs discrets */
  --tile: #dcdcdc;       /* case photo pas encore chargée */
  --sig: none;           /* signature (SVG noir) telle quelle */
  --sig-on: invert(1);   /* signature sur cercle plein noir */
  --footer-bg: #000;
  --footer-fg: #fff;
  --footer-line: transparent;
  --rec: #e3001b;
  --rec-dark: #b30016;

  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --serif: "IBM Plex Serif", Georgia, serif;

  --gutter: 16px;
  --max: 1240px;
}

:root[data-theme="dark"] {
  --bg: #000;
  --fg: #ededed;
  --muted: #8c8c8c;
  --line-soft: #2e2e2e;
  --tile: #141414;
  --sig: invert(1);
  --sig-on: none;
  --footer-bg: #000;
  --footer-fg: #8c8c8c;
  --footer-line: #2e2e2e;
}

@media (min-width: 640px)  { :root { --gutter: 32px; } }
@media (min-width: 1024px) { :root { --gutter: 48px; } }

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Chrome décale la page quand un élément change de taille au chargement (Safari non) : on désactive */
  overflow-anchor: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

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

:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }

/* ---------- En-tête : lien / signature / lien ---------- */

/* Géométrie figée (hauteurs fixes) : l'en-tête ne bouge pas pendant le chargement des polices */
.site-header {
  box-sizing: content-box;
  height: 122px;
  padding: calc(24px + env(safe-area-inset-top)) 0 28px;
  overflow: hidden;
}

.nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  height: 76px;
}

.nav__link {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  height: 32px;
  line-height: 1;
  white-space: nowrap;
  padding: 0 4px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-decoration: none;
  text-underline-offset: 7px;
  text-decoration-thickness: 1px;
}
.nav__link--right { justify-self: start; }

.nav__link:hover,
.nav__link[aria-current="page"] { text-decoration-line: underline; }

.nav__logo {
  flex: none;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 1px solid var(--fg);
  border-radius: 50%;
  transition: background-color .2s;
}
.nav__logo img { width: 56%; height: auto; filter: var(--sig); transition: filter .2s; }

.nav__logo:hover,
.nav__logo[aria-current="page"] { background: var(--fg); }
.nav__logo:hover img,
.nav__logo[aria-current="page"] img { filter: var(--sig-on); }

/* Page d'accueil : le logo devient un bouton REC rouge qui remélange la série */
.nav__logo[aria-current="page"] {
  position: relative;
  background: var(--rec);
  border-color: var(--rec);
  transition: background-color .2s, transform .12s ease;
}
.nav__logo[aria-current="page"]:hover { background: var(--rec-dark); border-color: var(--rec-dark); }
.nav__logo[aria-current="page"]:active { transform: scale(.94); }
.nav__logo[aria-current="page"] img { filter: invert(1); }

/* Voyant d'enregistrement : anneau qui pulse doucement autour du bouton */
.nav__logo[aria-current="page"]::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 2px solid var(--rec);
  border-radius: 50%;
  animation: rec 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes rec {
  0%, 100% { opacity: .55; }
  50%      { opacity: .15; }
}

/* Tant que le visiteur n'a jamais cliqué : onde plus marquée qui s'échappe du bouton */
.rec-invite .nav__logo[aria-current="page"]::after {
  animation: rec-invite 1.6s ease-out infinite;
}
@keyframes rec-invite {
  0%   { opacity: .9; transform: scale(1); }
  100% { opacity: 0;  transform: scale(1.22); }
}

/* Portfolio : pas de ligne LeHourki, l'en-tête se limite au menu */
.site-header--bare { height: 76px; }

@media (min-width: 640px) {
  .site-header { padding-top: 28px; height: 154px; }
  .site-header--bare { height: 96px; }
  .nav { gap: 32px; height: 96px; }
  .nav__link { font-size: 13px; height: 36px; padding: 0 6px; }
  .nav__logo { width: 96px; height: 96px; }
}

/* Ligne de marque reprise du logo : trait haut, nom, trait bas */
.brandline {
  display: flex;
  align-items: stretch;
  margin: 22px 0 0;
  font-size: 22px;
  font-weight: 300;
  letter-spacing: .18em;
  line-height: 1;
  height: 1em;
}
.brandline::before,
.brandline::after { content: ""; flex: 1; }
.brandline::before { border-top: 1px solid var(--fg); margin-top: .1em; }
.brandline::after  { border-bottom: 1px solid var(--fg); margin-bottom: .05em; }
.brandline span { padding: 0 .1em 0 .3em; }

@media (min-width: 640px) { .brandline { font-size: 28px; margin-top: 28px; } }

/* ---------- Portfolio : une seule série, recomposée par main.js ---------- */

.series { padding-top: 28px; padding-bottom: 40px; }

/* La mosaïque reste masquée le temps que main.js la compose */
.js .mosaic { visibility: hidden; }
.js .mosaic.is-ready { visibility: visible; }
.mosaic.is-fading { opacity: 0; }

/* Largeur limitée sur grand écran : la mosaïque reste lisible sans écraser la page */
.mosaic-box { container-type: inline-size; min-width: 0; max-width: 860px; margin: 0 auto; }

.mosaic {
  --cell: calc(100cqi / 4);
  transition: opacity .28s ease;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: calc(var(--cell) / 2);
}

/* Position dans la grille : --c colonne, --r demi-rangée, --w largeur, --h hauteur (en demi-cases) */
.tile {
  grid-column: var(--c) / span var(--w, 1);
  grid-row: var(--r) / span var(--h, 2);
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--tile);
  overflow: hidden;
  cursor: zoom-in;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .25s;
}
.tile:hover img { opacity: .82; }

@media (min-width: 640px)  { .series { padding-top: 32px; padding-bottom: 48px; } }
@media (min-width: 1024px) { .series { padding-top: 48px; padding-bottom: 64px; } }

/* ---------- Visionneuse ---------- */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  place-items: center;
  padding: 56px var(--gutter);
  background: #000;
  color: #fff;
}
.viewer.is-open { display: grid; }
.viewer__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 0;
  max-width: 100%;
}
.viewer img { max-width: 100%; max-height: calc(100vh - 190px); object-fit: contain; }
.viewer__caption {
  min-height: 2.8em;
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: .08em;
  text-align: center;
}
.viewer__caption span { display: block; color: #9a9a9a; }
.viewer__bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px var(--gutter);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.viewer button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 8px;
  cursor: pointer;
  letter-spacing: inherit;
  text-transform: inherit;
}
.viewer__nav {
  position: absolute;
  bottom: 12px; left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 40px;
}

/* ---------- Bio ---------- */

.page { padding-top: 48px; padding-bottom: 80px; }

.page__title {
  margin: 0 0 32px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .22em;
  text-transform: uppercase;
}

/* Bio : une photo en regard d'un texte éditorial (serif pour la lecture, mono pour les repères) */
.bio {
  display: grid;
  gap: 40px;
  padding-top: 40px;
  padding-bottom: 80px;
}
.bio__visual { margin: 0; }
.bio__visual img {
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 72vh;
  object-fit: cover;
  background: var(--tile);
}

.bio__body { max-width: 36em; }
.bio__name {
  margin: 0;
  font-size: 30px;
  font-weight: 300;
  letter-spacing: .06em;
  line-height: 1.2;
}
.bio__alias {
  margin: 10px 0 40px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .2em;
  text-transform: uppercase;
}

.bio__text {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.75;
}
.bio__text p { margin: 0 0 1.2em; }
.bio__text p:first-child { font-size: 21px; line-height: 1.5; }

/* Fin du manifeste : trois phrases isolées, détachées du bloc */
.bio__text .bio__coda { margin: 0; }
.bio__text p:not(.bio__coda) + .bio__coda { margin-top: 2.2em; }
.bio__text .bio__coda + .bio__coda { margin-top: 1.1em; }
.bio__text a { color: inherit; text-underline-offset: 4px; text-decoration-thickness: 1px; }

.bio__facts { margin: 44px 0 0; border-top: 1px solid var(--fg); font-size: 12px; }
.bio__facts div {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}
.bio__facts dt { color: var(--muted); letter-spacing: .16em; text-transform: uppercase; }
.bio__facts dd { margin: 0; }
.bio__facts a { text-underline-offset: 3px; }

@media (min-width: 640px) {
  .bio__visual img { max-height: 60vh; }
  .bio__name { font-size: 36px; }
  .bio__text { font-size: 18px; }
  .bio__text p:first-child { font-size: 23px; }
}

/* Ordinateur : la photo reste en place pendant qu'on lit */
@media (min-width: 1024px) {
  .bio {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 80px;
    align-items: start;
    padding-top: 56px;
    padding-bottom: 120px;
  }
  .bio__visual { position: sticky; top: 32px; }
  .bio__visual img { max-height: calc(100vh - 64px); }
  .bio__body { padding-top: 8px; }
}

/* ---------- Contact ---------- */

.contact { display: grid; gap: 56px; }

.contact-list { list-style: none; margin: 0; padding: 0; max-width: 560px; }
.contact-list li { border-bottom: 1px solid var(--line-soft); }
.contact-list li:first-child { border-top: 1px solid var(--fg); }

.contact-list a {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 18px;
  padding: 20px 0;
  text-decoration: none;
  font-size: 15px;
  word-break: break-word;
}
.contact-list svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.2; }
.contact-list small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.contact-list a:hover span:not(small) { text-decoration: underline; text-underline-offset: 4px; }

.contact-note { margin: 32px 0 0; max-width: 46ch; color: var(--muted); font-size: 13px; }

/* Bloc signature, composé comme la page de garde du portfolio PDF */
.signature {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
}
.signature img { width: 150px; height: auto; filter: var(--sig); }
.signature .brandline { align-self: stretch; margin-top: 32px; font-size: 22px; }

@media (min-width: 640px) {
  .contact-list a { font-size: 17px; padding: 24px 0; }
  .signature img { width: 190px; }
}

@media (min-width: 1024px) {
  .contact { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 96px; align-items: center; }
  .signature img { width: 230px; }
  .signature .brandline { font-size: 28px; }
}

/* ---------- Pied de page (Bio et Contact uniquement) ---------- */

/* Pied de page toujours en bas de l'écran, même quand la page est courte (Contact).
   100svh = hauteur avec la barre d'URL visible : rien ne bouge quand elle se replie. */
body:has(.site-footer) { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; }
body:has(.site-footer) > main { flex: 1 0 auto; }

.site-footer { background: var(--footer-bg); color: var(--footer-fg); border-top: 1px solid var(--footer-line); padding: 22px 0; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.site-footer .wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
@media (min-width: 640px) {
  .site-footer .wrap { flex-direction: row; justify-content: space-between; }
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  .nav__logo[aria-current="page"]::after { animation: none; }
  * { transition: none !important; }
}
