/* ============================================================
   PELLICULE — identité visuelle inspirée des planches-contact
   et des tirages de laboratoire photo.
   ============================================================ */

:root {
  --bg: #1b1b1d;
  --bg-deep: #100f11;
  --bg-alt: #242327;
  --paper: #f2ede4;
  --paper-dim: #e5ddce;
  --ink: #1b1a17;
  --accent: #e8a33d;   /* lumière inactinique */
  --accent-2: #c1443c; /* voyant rouge de labo */
  --muted: #9a988f;
  --muted-dark: #5c5b57;
  --border: rgba(242, 237, 228, 0.14);
  --font-display: 'Oswald', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 3px;
}

* { box-sizing: border-box; }

html { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--paper);
  font-family: var(--font-body);
  min-height: 100vh;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- perforations façon pellicule 35mm ---------- */
.sprocket-strip {
  height: 18px;
  background-color: var(--bg-deep);
  background-image: radial-gradient(circle, var(--bg) 3.4px, transparent 3.6px);
  background-size: 26px 18px;
  background-position: 13px center;
  background-repeat: repeat-x;
}

/* ---------- typographie générale ---------- */
h1, h2 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.03em; margin: 0; }

.frame-number {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid rgba(232, 163, 61, 0.4);
  padding: 2px 7px;
  border-radius: var(--radius);
  white-space: nowrap;
}

/* ============================================================
   BARRE SUPÉRIEURE / MENU
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 32px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand-block { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { font-size: 22px; color: var(--paper); }

.tagline {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--accent);
  border-left: 1px solid var(--border);
  padding-left: 14px;
}

@media (max-width: 720px) {
  .tagline { border-left: none; padding-left: 0; width: 100%; }
}

.menu { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.menu-item {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--radius);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.menu-item:hover { color: var(--paper); border-color: var(--border); }
.menu-item.active { color: var(--bg); background: var(--paper); }
.menu-item--accent { color: var(--accent); border-color: rgba(232,163,61,0.4); }
.menu-item--accent:hover { background: var(--accent); color: var(--bg); }
.menu-item--ghost { color: var(--accent-2); }
.menu-item--ghost:hover { color: #fff; }

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--paper);
  font-size: 18px;
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
}

@media (max-width: 720px) {
  .menu { display: none; width: 100%; order: 3; }
  .menu.open { display: flex; flex-direction: column; align-items: stretch; }
  .menu-toggle { display: block; }
  .topbar { padding: 14px 18px; }
}

/* ============================================================
   MISE EN PAGE PRINCIPALE
   ============================================================ */
main { max-width: 1200px; margin: 0 auto; padding: 36px 32px 70px; }

.view { display: none; }
.view.active { display: block; animation: fadein 0.25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.empty-state {
  text-align: center;
  color: var(--muted);
  font-family: var(--font-mono);
  padding: 60px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---------- barre de sélection / téléchargement ---------- */
.select-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  min-height: 36px;
}
.select-toolbar button {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.select-toolbar button:hover { color: var(--paper); border-color: var(--paper); }
.select-toolbar button:disabled { opacity: 0.4; cursor: not-allowed; }
.select-toolbar .download-btn { color: var(--accent); border-color: rgba(232,163,61,0.4); }
.select-toolbar .download-btn:hover:not(:disabled) { background: var(--accent); color: var(--bg-deep); }
.select-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.select-count { font-family: var(--font-mono); font-size: 12px; color: var(--paper); }
.select-progress { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }

/* Coche sur les tirages de la grille */
.print-card .select-check { display: none; }
.print-card.selectable .select-check {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 20px;
  left: 20px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(16, 15, 17, 0.65);
  color: var(--accent);
  font-size: 13px;
}
.print-card.selected .select-check { background: var(--accent); color: var(--bg-deep); }
.print-card.selected { outline: 3px solid var(--accent); outline-offset: 2px; }
.print-card.selectable:hover { transform: rotate(0deg); }

/* Coche dans le contact-sheet */
.select-check-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 11px;
}
.contact-sheet-row.selected { background: rgba(232, 163, 61, 0.1); }
.contact-sheet-row.selected .select-check-row { background: var(--accent); color: var(--bg-deep); }

/* ============================================================
   GRILLE — "tirages" avec marge blanche façon labo
   ============================================================ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 24px;
}

.print-card {
  background: var(--paper);
  padding: 12px 12px 30px;
  border-radius: 1px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  cursor: pointer;
  position: relative;
  transform: rotate(0deg);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.print-card:nth-child(3n+1) { transform: rotate(-0.6deg); }
.print-card:nth-child(3n+2) { transform: rotate(0.5deg); }
.print-card:nth-child(3n)   { transform: rotate(-0.3deg); }
.print-card:hover { transform: rotate(0deg) translateY(-4px); box-shadow: 0 16px 30px rgba(0,0,0,0.45); }

.print-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--paper-dim);
}

/* Vignettes vidéo : la vidéo sert d'aperçu, avec un badge ▶ */
.video-thumb {
  position: relative;
  display: block;
}
.print-card .video-thumb video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #000;
}
.thumb-wrap .video-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}
.play-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(16, 15, 17, 0.72);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  padding-left: 3px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(232, 163, 61, 0.5);
}
.thumb-wrap .play-badge {
  width: 26px;
  height: 26px;
  font-size: 10px;
  padding-left: 2px;
}

.print-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted-dark);
}
.print-meta .who { color: var(--ink); font-weight: 500; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.print-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(27,26,23,0.65);
  color: #fff;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.print-card:hover .print-delete { opacity: 1; }
.print-delete:hover { background: var(--accent-2); }

/* ============================================================
   PLANCHE-CONTACT — vue liste
   ============================================================ */
.contact-sheet-head,
.contact-sheet-row {
  display: grid;
  grid-template-columns: 54px 74px 1.4fr 1fr 140px 40px;
  align-items: center;
  gap: 16px;
}

.contact-sheet-head {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border);
}

.contact-sheet { display: flex; flex-direction: column; }

.contact-sheet-row {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease;
}
.contact-sheet-row:hover { background: var(--bg-alt); }

.contact-sheet-row .num { font-family: var(--font-mono); color: var(--accent); font-size: 12px; }

.thumb-wrap {
  width: 74px;
  height: 54px;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 0 1px rgba(242,237,228,0.08);
}
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* marque au crayon gras d'un monteur photo, apparaît au survol */
.thumb-wrap::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  transform: scale(1.3);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}
.contact-sheet-row:hover .thumb-wrap::after { opacity: 1; transform: scale(1); }

.contact-sheet-row .name { font-size: 13.5px; color: var(--paper); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-sheet-row .who { font-size: 12.5px; color: var(--muted); }
.contact-sheet-row .when { font-family: var(--font-mono); font-size: 11px; color: var(--muted-dark); }

.row-delete {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  cursor: pointer;
}
.row-delete:hover { color: #fff; border-color: var(--accent-2); background: var(--accent-2); }

@media (max-width: 720px) {
  .contact-sheet-head { display: none; }
  .contact-sheet-row { grid-template-columns: 40px 60px 1fr 34px; }
  .contact-sheet-row .who, .contact-sheet-row .when { display: none; }
}

/* ============================================================
   FORMULAIRE DE DÉPÔT
   ============================================================ */
.upload-card {
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px;
}
.upload-card h2 { margin: 14px 0 6px; font-size: 20px; }
.upload-hint { color: var(--muted); font-size: 13px; margin: 0 0 22px; }

.upload-card label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.upload-card input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--paper);
  padding: 11px 12px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  margin-bottom: 22px;
}
.upload-card input[type="text"]:focus,
.dropzone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 34px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: rgba(232, 163, 61, 0.06);
}
.dropzone-label { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.dropzone-label span { font-size: 12px; color: var(--muted-dark); }

.file-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--paper);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.file-list .size { color: var(--muted-dark); }

.upload-card button[type="submit"] {
  margin-top: 22px;
  width: 100%;
  background: var(--accent);
  color: var(--bg-deep);
  border: none;
  padding: 13px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: filter 0.15s ease, opacity 0.15s ease;
}
.upload-card button[type="submit"]:hover { filter: brightness(1.08); }
.upload-card button[type="submit"]:disabled { opacity: 0.4; cursor: not-allowed; }

.upload-status { margin-top: 16px; font-size: 13px; font-family: var(--font-mono); }
.upload-status.success { color: #7fbf7f; }
.upload-status.error { color: var(--accent-2); }

/* ============================================================
   DIAPORAMA / VISIONNEUSE PLEIN ÉCRAN
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 7, 0.96);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  flex-direction: column;
}
.lightbox.open { display: flex; }

.lightbox-figure { max-width: 90vw; max-height: 78vh; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.lightbox-figure img { max-width: 90vw; max-height: 70vh; object-fit: contain; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.lightbox-figure video { max-width: 90vw; max-height: 70vh; box-shadow: 0 20px 60px rgba(0,0,0,0.6); background: #000; }
.lightbox-figure figcaption { display: flex; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }

.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute;
  background: none;
  border: 1px solid var(--border);
  color: var(--paper);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close { top: 22px; right: 26px; width: 40px; height: 40px; font-size: 20px; }
.lightbox-prev, .lightbox-next { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; font-size: 26px; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { border-color: var(--accent); color: var(--accent); }

.lightbox-play {
  margin-top: 20px;
  background: none;
  border: 1px solid var(--border);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 9px 16px;
  border-radius: var(--radius);
  cursor: pointer;
}
.lightbox-play.playing { color: var(--accent); border-color: var(--accent); }

@media (max-width: 720px) {
  .lightbox-prev, .lightbox-next { width: 40px; height: 40px; font-size: 20px; }
  .lightbox-close { top: 14px; right: 14px; }
}

/* ============================================================
   PAGE DE CONNEXION
   ============================================================ */
.login-body { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; align-items: center; }
.login-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 44px 38px;
  width: 100%;
  max-width: 380px;
  margin: 40px auto;
  text-align: center;
}
.login-card .brand { margin: 14px 0 6px; font-size: 26px; }
.login-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 24px; }
.login-error { color: var(--accent-2); font-family: var(--font-mono); font-size: 12.5px; margin-bottom: 14px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { text-align: left; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; color: var(--muted); }
.login-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--paper);
  padding: 12px;
  border-radius: var(--radius);
  font-size: 14px;
}
.login-form input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.login-form button {
  margin-top: 6px;
  background: var(--accent);
  color: var(--bg-deep);
  border: none;
  padding: 13px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: var(--radius);
  cursor: pointer;
}
.login-form button:hover { filter: brightness(1.08); }
