/**
 * Direction « argile ».
 *
 * L'écran est utilisé debout, une main occupée, en dix secondes, par des gens de
 * tous âges. D'où : des aplats pleins plutôt que des filets, des cibles tactiles
 * hautes, et une hiérarchie qui tient à la couleur plus qu'à la taille du texte.
 * Pas de police à télécharger — rien ne doit dépendre du réseau le jour J.
 */

:root {
  color-scheme: light dark;

  --clay-900: #5c2a1c;
  --clay-700: #9c4630;
  --clay-600: #b4553c;
  --clay-500: #c86b4a;
  --clay-300: #e8a184;
  --clay-100: #f7ded2;

  --shell: #fbf2ee;
  --surface: #ffffff;
  --surface-2: #f6e9e3;
  --ink: #33211c;
  --ink-soft: #7d675f;
  --edge: #ecd9d0;

  --ok: #2f7d5f;
  --alerte: #b23b2e;

  /* Une seule famille, travaillée par la graisse et le crénage : c'est ce qui
     donne le ton contemporain sans dépendre d'une webfont. */
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;

  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;

  --ombre-clay: 0 12px 28px -10px rgb(156 70 48 / 45%);
  --ombre-carte: 0 1px 2px rgb(51 33 28 / 5%), 0 12px 32px -18px rgb(51 33 28 / 35%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --shell: #1c1310;
    --surface: #2a1e19;
    --surface-2: #35251f;
    --ink: #f6e7e0;
    --ink-soft: #b59c92;
    --edge: #402c25;
    --clay-600: #d1765a;
    --clay-500: #e08a67;
    --clay-100: #4a2e24;
    --ombre-carte: 0 1px 2px rgb(0 0 0 / 30%), 0 12px 32px -18px rgb(0 0 0 / 70%);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--shell);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 18px 120px;
}

.wrap.large {
  max-width: 1140px;
}

/* ── Bandeau d'identité : l'aplat plein, pas un filet ──────── */
.hero {
  background: linear-gradient(158deg, var(--clay-600), var(--clay-700) 74%);
  color: #fff5f0;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  padding: clamp(30px, 8vw, 46px) 24px clamp(28px, 7vw, 38px);
  margin: 0 -18px 26px;
  text-align: center;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.85rem, 7.5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.hero p {
  margin: 10px 0 0;
  font-size: 1rem;
  font-weight: 450;
  color: rgb(255 245 240 / 82%);
}

/* ── Cartes ──────────────────────────────────────────────── */
.carte {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--ombre-carte);
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

label .doux {
  font-weight: 400;
  color: var(--ink-soft);
}

input[type='text'],
textarea {
  width: 100%;
  padding: 15px 16px;
  border: 1.5px solid var(--edge);
  border-radius: var(--r-md);
  font-family: inherit;
  /* 16px minimum : en dessous, iOS zoome tout seul au focus. */
  font-size: 16px;
  background: var(--surface-2);
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}

input[type='text']::placeholder,
textarea::placeholder {
  color: var(--ink-soft);
}

input[type='text']:focus,
textarea:focus {
  outline: none;
  border-color: var(--clay-500);
  background: var(--surface);
}

textarea {
  resize: vertical;
  min-height: 82px;
}

.champ + .champ {
  margin-top: 18px;
}

.aide {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 12px 4px 0;
  text-align: center;
}

/* ── Boutons ─────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 19px 24px;
  border: none;
  border-radius: 999px;
  background: var(--clay-600);
  color: #fff6f2;
  font-family: inherit;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  cursor: pointer;
  box-shadow: var(--ombre-clay);
  transition: transform 0.12s ease, filter 0.15s;
}

.btn:hover {
  filter: brightness(1.06);
}

.btn:active {
  transform: scale(0.982);
}

.btn:disabled {
  opacity: 0.5;
  box-shadow: none;
  cursor: not-allowed;
}

.actions {
  display: grid;
  gap: 10px;
}

.btn.secondaire {
  background: transparent;
  color: var(--clay-600);
  border: 1.5px solid var(--edge);
  box-shadow: none;
  font-size: 1rem;
  padding: 14px;
}

:focus-visible {
  outline: 3px solid var(--clay-500);
  outline-offset: 3px;
}

/* ── File d'envoi ────────────────────────────────────────── */
.file {
  margin-top: 20px;
  display: grid;
  gap: 10px;
}

.file:empty {
  display: none;
}

.item {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 11px 14px 11px 11px;
  box-shadow: var(--ombre-carte);
  animation: monte 0.35s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

@keyframes monte {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.item img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  flex-shrink: 0;
}

.item .nom {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item .etat {
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--ink-soft);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.item.fini .etat {
  color: var(--ok);
}

.item.erreur .etat {
  color: var(--alerte);
}

.barre {
  height: 5px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 7px;
}

.barre > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--clay-500), var(--clay-300));
  width: 0;
  transition: width 0.25s ease;
}

/* ── Bandeau d'état ──────────────────────────────────────── */
.bandeau {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  padding: 15px 20px;
  border-radius: var(--r-md);
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--ink);
  color: var(--shell);
  box-shadow: 0 14px 34px -12px rgb(51 33 28 / 55%);
  transform: translateY(150%);
  transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
  z-index: 50;
}

.bandeau.visible {
  transform: translateY(0);
}

.bandeau.alerte {
  background: var(--alerte);
  color: #fff;
}

/* ── Mur de photos ───────────────────────────────────────── */
.compteur {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 550;
  margin: 0 0 20px;
  font-variant-numeric: tabular-nums;
}

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

.grille .vignette {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
  border: none;
  padding: 0;
  animation: eclot 0.5s cubic-bezier(0.2, 0.9, 0.3, 1) both;
  transition: transform 0.18s ease;
}

.grille .vignette:hover {
  transform: scale(1.035);
}

.grille .vignette img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.grille .vignette .video-badge {
  position: absolute;
  right: 7px;
  bottom: 7px;
  background: rgb(28 19 16 / 62%);
  color: #fff;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  backdrop-filter: blur(4px);
}

@keyframes eclot {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
}

.vide {
  text-align: center;
  color: var(--ink-soft);
  padding: 56px 24px;
  font-size: 1.02rem;
}

/* ── Visionneuse ─────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgb(24 15 12 / 95%);
  display: none;
  place-items: center;
  z-index: 100;
  padding: 24px;
  backdrop-filter: blur(10px);
}

.lightbox.ouvert {
  display: grid;
}

.lightbox img {
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: var(--r-md);
}

.lightbox .legende {
  color: #f9ece6;
  text-align: center;
  margin-top: 20px;
  max-width: 620px;
}

.lightbox .legende .mot {
  font-size: 1.16rem;
  font-weight: 550;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
}

.lightbox .legende .signature {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--clay-300);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0;
}

.lightbox .fermer {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgb(255 255 255 / 12%);
  border: none;
  color: #f9ece6;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

/* ── Navigation ──────────────────────────────────────────── */
nav.liens {
  text-align: center;
  margin-top: 30px;
  font-size: 0.95rem;
  font-weight: 600;
}

nav.liens a {
  color: var(--clay-600);
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 999px;
  display: inline-block;
}

nav.liens a:hover {
  background: var(--clay-100);
}

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