/* Portfolio Photo — direction A · Galerie */
:root {
  --bg: #ffffff;
  --surface: #f4f4f2;
  --ink: #111111;
  --muted: #666666;
  --hairline: #e4e4e2;
  --accent: #111111;
  --font-sans: "Inter Tight", system-ui, sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-4: 16px;
  --space-6: 24px;
  --space-12: 48px;
  --space-24: 96px;
  --radius-sm: 2px;
  --gutter: var(--space-12);
}

* { box-sizing: border-box; }
/* « hidden » doit toujours masquer, même sur un élément en display:flex/grid */
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 26px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* En-tête */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-12) var(--gutter) var(--space-6);
}
.name { text-decoration: none; }
.name span { display: block; font-size: 40px; line-height: 44px; font-weight: 600; letter-spacing: -0.02em; }
.name small { display: block; font-size: 13px; line-height: 20px; color: var(--muted); margin-top: var(--space-1); }

#nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); }
#nav a {
  font-size: 13px; line-height: 20px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  padding-bottom: 3px; border-bottom: 1px solid transparent;
}
#nav a:hover { color: var(--ink); }
#nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.menu-toggle { display: none; }

/* Grille mosaïque : colonnes remplies par le JS (la plus courte d'abord) */
.grid { display: flex; gap: var(--space-4); padding: 0 var(--gutter); align-items: flex-start; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.photo { margin: 0; cursor: zoom-in; }
.photo img {
  display: block; width: 100%; height: auto;
  background: var(--surface);
  opacity: 0; transition: opacity .3s;
}
.photo img.ok { opacity: 1; }
.photo figcaption {
  font-size: 12px; line-height: 18px; color: var(--muted);
  margin-top: var(--space-1); opacity: 0; transition: opacity .2s;
}
.photo:hover figcaption, .photo:focus-within figcaption { opacity: 1; }
.photo button { all: unset; display: block; width: 100%; }
.photo button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

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

/* À propos */
.about { padding: var(--space-6) var(--gutter); max-width: 640px; }
.about h1 { font-size: 32px; line-height: 38px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 var(--space-6); }
.about p { margin: 0 0 var(--space-4); }

/* Pied de page */
.site-footer {
  margin: var(--space-24) var(--gutter) 0;
  padding: var(--space-6) 0 var(--space-12);
  border-top: 1px solid var(--hairline);
  font-size: 12px; color: var(--muted);
  display: flex; justify-content: space-between; gap: var(--space-4);
}
.admin-link { color: var(--muted); text-decoration: none; }
.admin-link:hover { color: var(--ink); text-decoration: underline; }

/* Visionneuse */
.lightbox {
  position: fixed; inset: 0; z-index: 10;
  background: var(--bg);
  display: grid; grid-template-columns: 64px 1fr 64px; align-items: center;
  animation: fade .2s ease-out;
}
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; grid-column: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; padding: var(--space-12) 0; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; display: block; }
.lightbox figcaption { font-size: 13px; color: var(--muted); margin-top: var(--space-2); text-align: center; }
.lb-btn {
  background: none; border: 0; border-radius: var(--radius-sm);
  color: var(--ink); font: 300 32px/1 var(--font-sans);
  cursor: pointer; padding: var(--space-2) var(--space-4);
}
.lb-btn:hover { background: var(--surface); }
.lb-btn:focus-visible { outline: 2px solid var(--ink); }
.lb-tools { position: absolute; top: var(--space-4); right: var(--space-4); display: flex; align-items: center; gap: var(--space-2); z-index: 1; }
.lb-close { font-size: 24px; }
.lb-full {
  font-size: 13px; line-height: 20px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm);
}
.lb-full:hover { color: var(--ink); background: var(--surface); }
.lb-full:focus-visible { outline: 2px solid var(--ink); }

/* Interrupteur « Technique » */
.lb-tech {
  display: inline-flex; align-items: center; gap: var(--space-2);
  background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  font: 500 13px/20px var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding: var(--space-2) var(--space-4);
}
.lb-tech:hover { color: var(--ink); background: var(--surface); }
.lb-tech:focus-visible { outline: 2px solid var(--ink); }
.lb-tech[aria-checked="true"] { color: var(--ink); }
.switch {
  position: relative; width: 28px; height: 16px; flex: none;
  border: 1px solid var(--muted); border-radius: 999px; transition: background .2s, border-color .2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px;
  border-radius: 999px; background: var(--muted); transition: transform .2s, background .2s;
}
.lb-tech[aria-checked="true"] .switch { background: var(--ink); border-color: var(--ink); }
.lb-tech[aria-checked="true"] .switch::after { transform: translateX(12px); background: var(--bg); }

/* Données techniques sous l'image */
.lightbox .tech { font-size: 13px; line-height: 20px; color: var(--muted); margin-top: var(--space-2); text-align: center; }
.lightbox .tech span + span::before { content: "·"; margin: 0 var(--space-2); }
.lightbox .tech b { font-weight: 500; color: var(--ink); }
.lb-prev { grid-column: 1; justify-self: center; }
.lb-next { grid-column: 3; justify-self: center; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Tablette */
@media (max-width: 900px) {
  :root { --gutter: var(--space-6); }
  .site-header { flex-direction: column; align-items: flex-start; }
}

/* Mobile */
@media (max-width: 600px) {
  :root { --gutter: var(--space-4); }
  .site-header { flex-direction: row; align-items: center; flex-wrap: wrap; padding-top: var(--space-6); }
  .name span { font-size: 28px; line-height: 32px; }
  .menu-toggle {
    display: block; margin-left: auto;
    background: none; border: 1px solid var(--hairline); border-radius: var(--radius-sm);
    font: 500 12px/20px var(--font-sans); letter-spacing: .08em; text-transform: uppercase;
    color: var(--ink); padding: var(--space-1) var(--space-2); cursor: pointer;
  }
  #nav { display: none; width: 100%; flex-direction: column; gap: var(--space-2); }
  #nav.open { display: flex; }
  .lightbox { grid-template-columns: 44px 1fr 44px; }
  .lb-btn { padding: var(--space-2); }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox, .photo img, .photo figcaption { animation: none; transition: none; }
}
