/* Galerie photo — feuille unique : thèmes publics + interface d'administration */
:root {
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --accent: #c9a227;
  --radius: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  --gap: clamp(6px, 1.2vw, 14px);
}

body.theme-white { --bg: #ffffff; --bg-soft: #f4f4f4; --text: #141414; --muted: #6b6b6b; --line: #e3e3e3; --bar: rgba(255,255,255,.86); }
body.theme-gray-light { --bg: #eceae6; --bg-soft: #e2dfd9; --text: #1d1b18; --muted: #6d675f; --line: #d3cec6; --bar: rgba(236,234,230,.88); }
body.theme-gray-dark { --bg: #232323; --bg-soft: #1c1c1c; --text: #f1efec; --muted: #a09a93; --line: #343434; --bar: rgba(28,28,28,.85); }
body.theme-black { --bg: #0b0b0b; --bg-soft: #060606; --text: #f5f3ef; --muted: #8e8880; --line: #1e1e1e; --bar: rgba(6,6,6,.85); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* ---------------------------------------------------------------- public */
body.public {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 14px clamp(16px, 4vw, 46px);
  background: var(--bar);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-family: var(--serif); font-size: 18px; letter-spacing: .14em; text-transform: uppercase; }
.topbar .brand img { max-height: 34px; width: auto; }
.topbar .gname { flex: 1; text-align: center; font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.topbar .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.hero { padding: clamp(26px, 6vw, 72px) clamp(16px, 4vw, 46px) clamp(10px, 2vw, 24px); max-width: 1100px; }
.hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 5vw, 52px); margin: 0 0 10px; letter-spacing: .01em; }
.hero .lead { color: var(--muted); max-width: 62ch; line-height: 1.65; font-size: 15px; white-space: pre-line; margin: 0; }
.hero .meta { margin-top: 16px; display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--text); font-size: 13px; letter-spacing: .04em;
  transition: background .18s ease, border-color .18s ease, opacity .18s ease;
}
.btn:hover { background: var(--bg-soft); border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #16130a; font-weight: 600; }
.btn.primary:hover { opacity: .9; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 6px 12px; font-size: 12px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 22vw, 300px), 1fr));
  gap: var(--gap);
  padding: var(--gap) clamp(10px, 2.4vw, 30px) 90px;
}
.tile { position: relative; overflow: hidden; border-radius: 4px; background: var(--bg-soft); cursor: zoom-in; aspect-ratio: 2/3; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2,.7,.2,1), opacity .3s; }
.tile:hover img { transform: scale(1.045); }
.tile .badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; }
.tile .stars-on { position: absolute; bottom: 8px; left: 8px; display: flex; gap: 2px; }
.tile .stars-on svg { width: 13px; height: 13px; fill: var(--accent); filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.tile .fav { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.45); color: #fff; font-size: 13px; opacity: 0; transition: opacity .2s; }
.tile:hover .fav, .tile .fav.on { opacity: 1; }
.tile .fav.on { background: var(--accent); color: #16130a; }
.tile.hidden-photo { outline: 2px dashed #d1453b; outline-offset: -2px; }
.tile .tag { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; padding: 4px 7px; border-radius: 4px; background: rgba(0,0,0,.6); color: #fff; }
.tile .tag.final { background: #2e7d5b; }
.tile .tag.hidden { background: #d1453b; }
.fname { position: absolute; bottom: 0; left: 0; right: 0; padding: 18px 10px 8px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.72)); opacity: 0; transition: opacity .2s; }
.tile:hover .fname { opacity: 1; }

.empty { padding: 80px 24px; text-align: center; color: var(--muted); }

/* sous-albums */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px clamp(12px, 3vw, 30px) 10px; }
.chip {
  display: inline-flex; align-items: baseline; gap: 7px; cursor: pointer;
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-size: 12.5px; letter-spacing: .04em;
}
.chip span { font-size: 10.5px; opacity: .7; }
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip.on { background: var(--text); border-color: var(--text); color: var(--bg); }

.gal-foot {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center;
  padding: 34px 20px 50px; margin-top: 20px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px; letter-spacing: .05em;
}
.gal-foot a { text-decoration: underline; text-underline-offset: 3px; }
.gal-foot .sep { opacity: .5; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 90; display: none; background: rgba(6,6,6,.97); }
.lightbox.open { display: grid; grid-template-rows: auto 1fr auto; }
.lightbox header, .lightbox footer { padding: 14px clamp(14px, 3vw, 30px); display: flex; align-items: center; gap: 14px; color: #f2f0ec; }
.lightbox header .spacer { flex: 1; }
.lightbox .stage { display: grid; place-items: center; overflow: hidden; padding: 0 8px; }
.lightbox .stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 3px; }
.lightbox .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.35); color: #fff; cursor: pointer; font-size: 18px; }
.lightbox .nav.prev { left: 14px; }
.lightbox .nav.next { right: 14px; }
.stars { display: flex; gap: 4px; }
.stars button { background: none; border: none; cursor: pointer; padding: 2px; line-height: 0; }
.stars svg { width: 22px; height: 22px; fill: none; stroke: #cfc9c0; stroke-width: 1.4; }
.stars button.on svg { fill: var(--accent); stroke: var(--accent); }
.stars.small svg { width: 16px; height: 16px; }
.commentbox { width: min(520px, 60vw); }
.commentbox textarea { width: 100%; min-height: 46px; resize: vertical; border-radius: 8px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: #fff; padding: 9px 11px; font-size: 13px; }
.counter { color: #a09a93; font-size: 12px; letter-spacing: .14em; }

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate .card { width: min(430px, 100%); background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; text-align: center; box-shadow: var(--shadow); }
.gate h1 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 0 0 6px; }
.gate p { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.gate input { width: 100%; margin: 16px 0 12px; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); text-align: center; letter-spacing: .3em; }
.gate .err { color: #d1453b; font-size: 13px; margin-bottom: 10px; }

.flash-note { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #16130a; color: #f6f2e6; border: 1px solid var(--accent); padding: 10px 18px; border-radius: 999px; font-size: 13px; opacity: 0; transition: opacity .25s, transform .25s; z-index: 120; }
.flash-note.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ---------------------------------------------------------------- admin */
body.admin { margin: 0; font-family: var(--sans); background: #101014; color: #e9e7e3; }
.admin-shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.admin-nav { background: #0a0a0d; border-right: 1px solid #1f1f26; padding: 22px 16px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.admin-nav .logo { font-family: var(--serif); font-size: 17px; letter-spacing: .16em; text-transform: uppercase; padding: 6px 10px 20px; color: #fff; }
.admin-nav a { padding: 9px 12px; border-radius: 8px; color: #9a979f; font-size: 13.5px; }
.admin-nav a:hover { background: #16161c; color: #fff; }
.admin-nav a.active { background: #1d1d25; color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.admin-nav .sep { height: 1px; background: #1f1f26; margin: 12px 6px; }
.admin-main { padding: 26px clamp(16px, 3vw, 40px) 70px; }
.admin-main h1 { font-family: var(--serif); font-weight: 400; font-size: 30px; margin: 0 0 4px; }
.admin-main .sub { color: #8d8a93; font-size: 13px; margin-bottom: 22px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; margin-bottom: 26px; }
.card-stat { background: #16161c; border: 1px solid #232330; border-radius: 12px; padding: 16px 18px; }
.card-stat .k { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #8d8a93; }
.card-stat .v { font-size: 26px; font-family: var(--serif); margin-top: 6px; }
.panel { background: #14141a; border: 1px solid #232330; border-radius: 14px; padding: 20px; margin-bottom: 18px; }
.panel h2 { font-size: 15px; margin: 0 0 14px; letter-spacing: .04em; }
.panel h2 .hint { font-size: 12px; color: #8d8a93; font-weight: 400; margin-left: 8px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-weight: 500; color: #8d8a93; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid #232330; }
table.tbl td { padding: 10px; border-bottom: 1px solid #1b1b23; vertical-align: middle; }
table.tbl tr:hover td { background: #17171f; }
label.field { display: block; margin-bottom: 12px; font-size: 12.5px; color: #b6b3bb; }
label.field input[type=text], label.field input[type=email], label.field input[type=password],
label.field input[type=number], label.field input[type=date], label.field select, label.field textarea {
  width: 100%; margin-top: 6px; padding: 9px 11px; border-radius: 8px; border: 1px solid #2a2a36;
  background: #0f0f14; color: #eae8e4; font-size: 13.5px;
}
label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #cfccd3; margin: 7px 0; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.admin-main .btn { border-color: #2a2a36; color: #e9e7e3; }
.admin-main .btn:hover { background: #1c1c26; }
.admin-main .btn.primary { background: var(--accent); color: #16130a; border-color: var(--accent); }
.admin-main .btn.danger { border-color: #59262a; color: #e78b8b; }
.admin-main a.link { color: var(--accent); font-size: 13px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.thumbs .t { position: relative; border-radius: 8px; overflow: hidden; background: #0f0f14; border: 1px solid #232330; }
.thumbs .t img { aspect-ratio: 1/1; object-fit: cover; width: 100%; }
.thumbs .t.hidden { opacity: .45; border-color: #59262a; }
.thumbs .t .ops { display: flex; gap: 4px; padding: 6px; justify-content: center; flex-wrap: wrap; }
.thumbs .t .ops button, .thumbs .t .ops a { font-size: 10.5px; padding: 4px 7px; border-radius: 6px; border: 1px solid #2a2a36; background: #14141a; color: #cfccd3; cursor: pointer; }
.thumbs .t .flag { position: absolute; top: 6px; left: 6px; font-size: 10px; padding: 3px 6px; border-radius: 5px; background: #2e7d5b; color: #fff; }
.thumbs .t .flag.no { background: #d1453b; }
.pill { display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 999px; background: #1d1d25; color: #b6b3bb; }
.pill.sel { background: #2b2a4a; color: #b9b6f0; }
.pill.dl { background: #24402f; color: #8fd3ac; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 7px 0; border-bottom: 1px solid #1b1b23; }
.kv span:first-child { color: #8d8a93; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.copy { cursor: pointer; color: var(--accent); }

@media (max-width: 780px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-nav { position: static; height: auto; flex-direction: row; overflow-x: auto; }
  .admin-nav .logo, .admin-nav .sep { display: none; }
  .topbar .gname { display: none; }
  .lightbox .commentbox { width: 70vw; }
}
