:root {
  --bg: #f7f4ef;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #857e74;
  --line: #e6e0d6;
  --accent: #a3825a;
  --fav: #c4524a;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --row: 260px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 300 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1 { font: 400 clamp(2.2rem, 6vw, 4.2rem)/1.05 var(--serif); margin: 0 0 .4em; letter-spacing: .01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { text-transform: uppercase; letter-spacing: .28em; font-size: 11px; font-weight: 500; margin: 0 0 1.2em; }

.btn {
  display: inline-block; border: 1px solid var(--text); background: transparent; color: var(--text);
  padding: .85em 1.8em; font: 500 12px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; transition: background .25s, color .25s;
}
.btn:hover { background: var(--text); color: var(--bg); }
.btn-primary { background: var(--text); color: var(--bg); width: 100%; }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-ghost { border-color: rgba(255,255,255,.8); color: #fff; }
.btn-ghost:hover { background: #fff; color: var(--text); }
.btn-small { padding: .7em 1.2em; font-size: 11px; }
.btn-link { border: 0; padding-inline: .4em; color: var(--muted); }
.btn-link:hover { background: none; color: var(--text); }

/* ---- Connexion ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; position: relative; }
.login-bg { position: fixed; inset: 0; background: center/cover no-repeat; filter: brightness(.55); }
.login-card {
  position: relative; width: min(400px, 100%); background: var(--surface); padding: 48px 40px;
  display: flex; flex-direction: column; gap: 18px; text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,.12); animation: rise .8s ease both;
}
.login-card h1 { font-size: 2.3rem; margin: 0; }
.login-card p { margin: 0; }
.login-logo { max-width: 160px; max-height: 80px; margin: 0 auto 8px; object-fit: contain; }
.login-card label { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }
.login-card input {
  display: block; width: 100%; margin-top: 6px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line);
  font: 400 16px var(--sans); color: var(--text); background: transparent; outline: none; transition: border-color .2s;
}
.login-card input:focus { border-color: var(--text); }
.alert { background: #fbeeec; color: #8a2f28; padding: 10px 12px; font-size: 14px; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

/* ---- Couverture ---- */
.hero { position: relative; height: 100vh; height: 100svh; display: grid; place-items: center; overflow: hidden; background: #222; color: #fff; text-align: center; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: zoom 14s ease-out both; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.15), rgba(0,0,0,.45)); }
.hero-text { position: relative; z-index: 1; padding: 0 16px; animation: rise 1.2s .2s ease both; }
.hero-date { font: italic 400 1.3rem var(--serif); margin: 0 0 2em; }
@keyframes zoom { from { transform: scale(1.08); } }

/* ---- Barre d'outils ---- */
.toolbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 12px 24px; background: rgba(247,244,239,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.toolbar-title { display: flex; gap: 12px; align-items: baseline; }
.toolbar-title strong { font: 500 1.35rem var(--serif); }
.toolbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-actions form { margin: 0; }
.segmented { display: flex; border: 1px solid var(--line); }
.segmented button { border: 0; background: none; padding: .7em 1em; font: 500 11px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.segmented button.active { background: var(--text); color: var(--bg); }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); box-shadow: 0 12px 40px rgba(0,0,0,.12); min-width: 220px; display: none; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a { display: block; padding: 12px 16px; text-decoration: none; font-size: 14px; }
.dropdown-menu a:hover { background: var(--bg); }

.welcome { max-width: 640px; margin: 56px auto 0; padding: 0 16px; text-align: center; font: italic 400 1.35rem/1.5 var(--serif); }

/* ---- Grille justifiée : chaque ligne remplit la largeur en gardant les proportions ---- */
.grid { display: flex; flex-wrap: wrap; gap: 8px; padding: 40px 24px; }
.grid::after { content: ""; flex-grow: 999999; }
.tile {
  position: relative; margin: 0; overflow: hidden; background: var(--line);
  flex: calc(var(--w) / var(--h)) 1 calc(var(--row) * var(--w) / var(--h));
  aspect-ratio: var(--w) / var(--h);
}
.grid.animate .tile { opacity: 0; transform: translateY(12px); transition: opacity .6s ease, transform .6s ease; }
.grid.animate .tile.visible { opacity: 1; transform: none; }
.tile[hidden] { display: none; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s ease, filter .3s; }
.tile:hover img { transform: scale(1.03); }
.tile .fav, .tile .dl {
  position: absolute; bottom: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: rgba(255,255,255,.9); color: var(--text); font-size: 16px; cursor: pointer; text-decoration: none;
  opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s, color .2s;
}
.tile .fav { right: 10px; }
.tile .dl { right: 54px; }
.tile:hover .fav, .tile:hover .dl, .tile.is-fav .fav { opacity: 1; transform: none; }
.tile.is-fav .fav { color: var(--fav); }
.fav.pop { animation: pop .35s ease; }
@keyframes pop { 50% { transform: scale(1.35); } }
@media (hover: none) { .tile .fav, .tile .dl { opacity: 1; transform: none; } }
.empty-favs { width: 100%; text-align: center; color: var(--muted); padding: 60px 0; }

.footer { text-align: center; padding: 40px 16px 60px; border-top: 1px solid var(--line); font-size: 14px; }
.footer p { margin: .4em 0; }

.center-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--surface); padding: 40px; text-align: center; max-width: 420px; }

/* ---- Visionneuse PhotoSwipe : boutons ajoutés ---- */
.pswp__button--fav-button, .pswp__button--dl-button { color: #fff; font-size: 22px; display: grid !important; place-items: center; text-decoration: none; }
.pswp__button--fav-button.is-fav { color: #ff6b61; }

@media (max-width: 640px) {
  :root { --row: 150px; }
  .grid { padding: 24px 8px; gap: 4px; }
  .toolbar { padding: 8px 12px; gap: 6px; }
  .toolbar-title { width: 100%; }
  .toolbar-title strong { font-size: 1.15rem; }
  .toolbar-title span { display: none; }
  .toolbar-actions { gap: 6px; flex-wrap: nowrap; width: 100%; }
  .segmented button, .toolbar-actions .btn-small { padding: .7em .65em; letter-spacing: .06em; font-size: 10px; }
  .toolbar-actions .btn-link { padding-inline: .3em; }
  .login-card { padding: 36px 24px; }
}

/* ---- Page Confidentialité ---- */
.legal { max-width: 680px; margin: 0 auto; padding: 48px 16px 80px; }
.legal h1 { font-size: clamp(2.2rem, 6vw, 3.2rem); }
.legal h2 { font: 500 1.5rem/1.2 var(--serif); margin: 2em 0 .5em; }
.legal .lead { font: italic 400 1.25rem/1.5 var(--serif); }
.legal ul { padding-left: 1.2em; }
.legal li { margin-bottom: .6em; }
.legal .pre { white-space: pre-line; }
.back-link { color: var(--muted); text-decoration: none; font-size: 13px; }
.back-link:hover { color: var(--text); }
.legal-link { color: var(--muted); font-size: 12px; text-decoration: none; }
.legal-link:hover { color: var(--text); text-decoration: underline; }
.login-legal { position: relative; margin: 0; }
.login.has-bg .login-legal .legal-link { color: rgba(255,255,255,.75); }
