/* Charte provisoire : à remplacer quand les logos et la charte seront fournis */
:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6b66;
  --accent: #2f5d62;
  --accent-text: #ffffff;
  --border: #dcdcd6;
  --radius: 8px;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161716;
    --surface: #1f201f;
    --text: #ecece8;
    --muted: #9a9a94;
    --accent: #7fb3b8;
    --accent-text: #101111;
    --border: #333431;
  }
}

:root[data-theme="dark"] {
  --bg: #161716;
  --surface: #1f201f;
  --text: #ecece8;
  --muted: #9a9a94;
  --accent: #7fb3b8;
  --accent-text: #101111;
  --border: #333431;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); }

header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

header.site .brand { font-weight: 700; text-decoration: none; color: var(--text); }

nav.main { display: flex; flex-wrap: wrap; gap: 14px; }
nav.main a { text-decoration: none; color: var(--text); }
nav.main a[aria-current="page"] { color: var(--accent); font-weight: 600; }

.role-switch { font-size: 0.9rem; color: var(--muted); }
.role-switch select { margin-left: 6px; padding: 4px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }

main { padding: var(--gutter); max-width: 1100px; margin: 0 auto; }

h1 { font-size: 1.6rem; margin: 0.5em 0; }
h2 { font-size: 1.2rem; margin: 1em 0 0.5em; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gutter);
  margin-bottom: var(--gutter);
}

.hero {
  padding: 48px var(--gutter);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  margin-bottom: var(--gutter);
}
.hero h1 { margin-top: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.photo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.photo .thumb {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, var(--accent), var(--border));
}
.photo .info { padding: 8px; font-size: 0.9rem; }
.photo .info small { color: var(--muted); display: block; }

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--gutter); }
.filters button, button, .btn {
  font: inherit;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.filters button.secondary, button.secondary {
  background: transparent;
  color: var(--accent);
}
.filters button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

form .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
input, select, textarea {
  font: inherit;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  max-width: 100%;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }

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

footer.site {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px var(--gutter);
}

@media (max-width: 600px) {
  h1 { font-size: 1.35rem; }
  .hero { padding: 28px var(--gutter); }
}

/* ---- Ajouts : formulaires, listes, cases à cocher ---- */
[hidden] { display: none !important; }

.grid-1 { display: grid; gap: var(--gutter); margin-bottom: var(--gutter); }

a.gallery-link { display: block; text-decoration: none; color: inherit; }
a.gallery-link:hover h2 { color: var(--accent); }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}
.checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px 16px;
  margin-bottom: 12px;
}

.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.thumb.mini { width: 72px; height: 54px; border-radius: 6px; }

table button, td button { padding: 4px 10px; }

button.toggle { margin-bottom: 12px; }

/* ---- Vignettes cliquables et visionneuse plein écran ---- */
.thumb-btn { background: none; border: 0; padding: 0; cursor: pointer; display: block; width: 100%; color: inherit; }
.thumb-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
td .thumb-btn { width: auto; }

.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.92); color: #fff;
  display: flex; flex-direction: column;
}
.lb-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; min-height: 44px; }
.lb-title { font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-actions { display: flex; gap: 6px; flex-shrink: 0; }
.lb-small, .lb-close {
  background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px; padding: 2px 10px; font-size: 0.9rem; opacity: 0.6; cursor: pointer;
}
.lb-small:hover, .lb-close:hover { opacity: 1; }
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.lb-stage img { max-width: calc(100% - 110px); max-height: calc(100vh - 70px); object-fit: contain; }
.lb-nav {
  background: rgba(255, 255, 255, 0.12); color: #fff; border: 0; border-radius: 6px;
  font-size: 2rem; line-height: 1; padding: 6px 14px; margin: 0 6px; cursor: pointer;
}

.meta-modal {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
.meta-box {
  background: var(--surface); color: var(--text);
  border-radius: var(--radius); padding: var(--gutter);
  width: calc(100% - 32px); max-width: 420px; max-height: 80vh; overflow-y: auto;
}
.meta-box td { border-bottom: 1px solid var(--border); vertical-align: top; }

/* ---- Détail des notes au survol des moyennes ---- */
.hoverable { cursor: help; text-decoration: underline dotted; }
.score-pop {
  position: absolute; z-index: 1200;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
  min-width: 200px; max-width: 280px; font-size: 0.9rem;
}
.score-pop table td { padding: 3px 6px; border-bottom: 1px solid var(--border); }

/* ---- Outils d'une photo (fenêtre) ---- */
.tool-btn {
  background: transparent; border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 8px; font-size: 1rem; cursor: pointer; margin-top: 4px;
}
.tool-btn:hover { border-color: var(--accent); }
.tools-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.tools-list button, .tools-list a { text-align: left; }
