/* Thème repris de mathildelagarrigue.fr : fond crème, texte noir, titres à empattements,
   texte en Helvetica Neue, boutons « pilule » noirs. */

@font-face { font-family: "Newsreader"; src: url("/fonts/newsreader-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("/fonts/newsreader-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("/fonts/newsreader-latin-300-normal.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }

:root {
  --cream: #f2e4cf;
  --paper: #f4f0eb;
  --rose: #e1ccbe;
  --white: #ffffff;
  --ink: #000000;
  --muted: #5e5248;
  --line: rgba(0, 0, 0, .14);
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --gap: 8px;
  --pad: clamp(16px, 4vw, 48px);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.logo {
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: -.01em;
  text-decoration: none;
  margin: 0;
  white-space: nowrap;
}
.logo.small { font-size: 20px; }
.sun { font-size: .7em; vertical-align: .12em; margin: 0 .05em; }

.kicker {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 0 0 14px;
}
h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 5.5vw, 64px);
  line-height: 1.05;
  letter-spacing: -.015em;
  margin: 0;
}
.client { font-family: var(--serif); font-style: italic; font-size: clamp(18px, 2.2vw, 24px); margin: 10px 0 0; }

/* Boutons pilule, comme sur le site */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: var(--white);
  border: 1px solid var(--ink); border-radius: 300px;
  padding: 13px 26px;
  font: 14px/1 var(--sans); letter-spacing: .02em;
  text-decoration: none; white-space: nowrap;
  transition: opacity .15s, background .15s, color .15s;
}
.pill:hover { opacity: .82; }
.pill:disabled { opacity: .35; cursor: default; }
.pill.outline { background: transparent; color: var(--ink); }
.pill.outline:hover { background: var(--ink); color: var(--white); opacity: 1; }
.pill.small { padding: 9px 18px; font-size: 13px; }

.round {
  width: 46px; height: 46px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .75);
  font: 20px/1 var(--sans);
  display: inline-flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
  transition: background .15s;
}
.round:hover { background: var(--white); }

/* ---- Mot de passe ---- */
#login {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--pad);
  text-align: center;
}
.login-card { width: min(520px, 100%); }
.login-card .logo { margin-bottom: 64px; }
#loginForm { margin-top: 48px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
#password {
  width: min(320px, 100%);
  background: transparent; border: 0; border-bottom: 1px solid var(--ink); border-radius: 0;
  padding: 10px 4px; text-align: center;
  font: 17px var(--sans); color: var(--ink);
  outline: none;
}
#password::placeholder { color: var(--muted); }
.login-hint { margin: 28px 0 0; font-size: 14px; color: var(--muted); }
.error { color: #8a2b1a; min-height: 1.4em; margin: 0; font-size: 14px; }

/* ---- En-tête ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px var(--pad);
}
.actions { display: flex; align-items: center; gap: 10px; }

.cover { padding: 0 var(--pad); }
.cover img { width: 100%; height: min(78vh, 900px); object-fit: cover; display: block; }

.hero { text-align: center; padding: clamp(48px, 9vw, 110px) var(--pad) clamp(36px, 6vw, 64px); max-width: 860px; margin: 0 auto; }
.intro { max-width: 560px; margin: 26px auto 0; font-size: 15px; }

/* ---- Barre d'outils ---- */
.toolbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px var(--pad);
  background: rgba(242, 228, 207, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.toolbar.stuck { border-bottom-color: var(--line); }
.filters { display: flex; gap: 22px; }
.filters button {
  background: none; border: 0; padding: 4px 0;
  font: 16px var(--sans);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.filters button.on { border-bottom-color: var(--ink); }
.filters .n { color: var(--muted); font-size: 13px; margin-left: 4px; }
.toolbar-right { display: flex; align-items: center; gap: 14px; }
.counter { font-family: var(--serif); font-size: 19px; white-space: nowrap; }

.notice {
  margin: 8px var(--pad) 0;
  padding: 16px 20px;
  background: var(--paper);
  text-align: center;
  font-family: var(--serif); font-size: 18px;
}

/* ---- Grille justifiée ---- */
.grid { padding: 16px var(--pad) 40px; }
.row { display: flex; gap: var(--gap); margin-bottom: var(--gap); }
.tile {
  position: relative; flex: none; overflow: hidden;
  background: var(--rose);
  cursor: zoom-in;
}
.tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transition: opacity .35s, transform .6s;
  -webkit-user-drag: none; user-select: none;
}
.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.015); }

.heart {
  position: absolute; right: 8px; bottom: 8px;
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .82);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s, transform .15s;
}
.heart svg { width: 20px; height: 20px; }
.tile:hover .heart, .heart.on, .heart:focus-visible { opacity: 1; }
.heart.on { background: var(--white); }
.heart:active { transform: scale(.9); }
@media (hover: none) { .heart { opacity: 1; } }
.locked .heart:not(.on) { display: none; }
.play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 58px; height: 58px; border-radius: 50%;
  background: rgba(255, 255, 255, .85);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.play::before { content: ""; margin-left: 4px; border-style: solid; border-width: 10px 0 10px 16px; border-color: transparent transparent transparent var(--ink); }
.tile .tag {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(255, 255, 255, .85); border-radius: 300px;
  padding: 3px 10px; font-size: 12px; letter-spacing: .04em;
}

.empty { text-align: center; padding: 40px var(--pad) 80px; font-family: var(--serif); font-size: 20px; }
.heart-inline { font-family: var(--sans); }

.footer {
  text-align: center;
  padding: 56px var(--pad) 64px;
  background: var(--paper);
  font-size: 14px;
}
.footer p { margin: 6px 0; }

/* ---- Visionneuse ---- */
.viewer {
  position: fixed; inset: 0; z-index: 20;
  background: var(--paper);
  display: flex; flex-direction: column;
}
.viewer-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px var(--pad);
  padding-top: max(14px, env(safe-area-inset-top));
}
.viewer-bar .count { flex: 1; font-family: var(--serif); font-size: 17px; }
.viewer-actions { display: flex; gap: 10px; }
.viewer-stage { flex: 1; position: relative; min-height: 0; margin: 0 var(--pad) var(--pad); }
.viewer-stage video { position: absolute; inset: 0; width: 100%; height: 100%; background: transparent; }
.viewer-stage img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  -webkit-user-drag: none; user-select: none;
  transition: opacity .2s;
}
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); }
.viewer .prev { left: 14px; }
.viewer .next { right: 14px; }
.viewer .close { background: transparent; }
.viewer .close:hover { background: rgba(0, 0, 0, .06); }

/* ---- Fenêtre de validation ---- */
.dlg {
  border: 0; padding: 36px 32px 28px;
  width: min(480px, calc(100vw - 32px));
  background: var(--cream); color: var(--ink);
}
.dlg::backdrop { background: rgba(30, 22, 15, .45); }
.dlg h2 { font: 400 30px/1.1 var(--serif); margin: 0 0 12px; }
.dlg label { display: block; margin: 20px 0 8px; }
.dlg textarea {
  width: 100%; resize: vertical;
  background: var(--white); border: 1px solid var(--line); border-radius: 6px;
  padding: 12px; font: 15px/1.45 var(--sans); color: var(--ink);
}
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 24px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 30;
  background: var(--ink); color: var(--white);
  padding: 12px 22px; border-radius: 300px; font-size: 14px;
}

@media (max-width: 640px) {
  :root { --gap: 4px; }
  .logo { font-size: 21px; }
  .topbar { padding-top: 16px; padding-bottom: 16px; }
  .toolbar { padding-top: 10px; padding-bottom: 10px; }
  .filters { gap: 16px; }
  .filters button { font-size: 15px; }
  .toolbar-right .pill { padding: 10px 16px; font-size: 13px; }
  .counter { font-size: 17px; }
  .grid { padding-left: 4px; padding-right: 4px; }
  .heart { width: 34px; height: 34px; right: 5px; bottom: 5px; }
  .heart svg { width: 17px; height: 17px; }
  .viewer .nav { display: none; }
  .viewer-stage { margin: 0 0 12px; }
  .cover img { height: 58vh; }
  .cover { padding: 0; }
}
.home-link { margin-top: 48px; }
