/* Direction artistique : le faire-part (encre terracotta, Josefin Sans, dessins @adlab.art)
   et trois couleurs seulement, celles de la déco : terracotta (base), orange et jaune orangé. */
:root {
  --cream: #fbf1e4;
  --paper: #fff9f1;
  --terracotta: #de5c4f;   /* encre du faire-part */
  --brick: #9c3b2b;        /* texte courant */
  --orange: #ec7f2d;
  --sun: #f0a530;          /* jaune orangé */
  --blush: #f8dccf;        /* teinte claire du terracotta */
  --sun-tint: #fdeccb;
  --sans: "Josefin Sans", "Futura", system-ui, sans-serif;
  --script: "Parisienne", cursive;
  --nav-h: 60px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--brick);
  font: 400 18px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

.script {
  margin: 0;
  color: var(--terracotta);
  font-family: var(--script);
  font-weight: 400;
  line-height: 1.1;
}

.kicker {
  margin: 0;
  color: var(--orange);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.names {
  margin: 14px 0 6px;
  color: var(--terracotta);
  font: 400 clamp(56px, 11vw, 132px)/1 var(--script);
}
.names .amp { font-size: 0.7em; margin: 0 0.12em; color: var(--orange); }

.date {
  margin: 0;
  color: var(--orange);
  font-size: 14px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

/* Illustrations du faire-part, recolorées : elles servent de masque à une couleur */
.ill {
  display: inline-block;
  background: currentColor;
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
}
.ill-citron { --src: url("/assets/citron.png"); aspect-ratio: 339 / 270; width: 92px; color: var(--sun); }
.ill-olives { --src: url("/assets/olives.png"); aspect-ratio: 249 / 196; width: 66px; color: var(--orange); }
.ill-crevette { --src: url("/assets/crevette.png"); aspect-ratio: 185 / 222; width: 46px; color: var(--sun); }

/* Filet de séparation */
.ribbon { height: 2px; width: 120px; margin: 0 auto; background: var(--terracotta); }

/* ───────── En-tête façon faire-part ───────── */
.hero {
  text-align: center;
  padding: clamp(48px, 7vw, 88px) 16px 8px;
  background: var(--cream);
}
.table-ill {
  display: block;
  width: min(100%, 560px);
  height: auto;
  margin: clamp(28px, 5vw, 56px) auto 0;
}

main { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* ───────── Navigation entre les deux pages ───────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--nav-h);
  padding: 0 clamp(16px, 4vw, 40px);
  background: rgba(255, 249, 241, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--blush);
}
.brand {
  color: var(--terracotta);
  font: 400 28px/1 var(--script);
  text-decoration: none;
  white-space: nowrap;
}
.page-links { display: flex; gap: 6px; }
.page-links a {
  padding: 9px 16px 7px;
  border-radius: 999px;
  color: var(--brick);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.page-links a:hover { background: var(--blush); }
.page-links a[aria-current] { background: var(--terracotta); color: #fff; }
.page[hidden] { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px 12px;
  border: 2px solid var(--terracotta);
  border-radius: 999px;
  background: var(--terracotta);
  color: #fff;
  font: 600 15px/1 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--orange); border-color: var(--orange); }
.btn:focus-visible, .tab:focus-visible, .tile:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
.btn-outline { background: transparent; color: var(--terracotta); }
.btn-outline:hover { color: #fff; }
.btn-small { padding: 10px 16px 8px; font-size: 13px; }
.btn-ghost { background: transparent; border-color: rgba(255, 255, 255, 0.5); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.15); border-color: #fff; }

/* ───────── Carte ───────── */
.card {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
  padding: clamp(56px, 8vw, 100px) 0;
}

.arch {
  position: relative;
  margin: 0;
  padding: 12px;
  background: var(--paper);
  border: 2px solid var(--terracotta);
  border-radius: 999px 999px 16px 16px;
  aspect-ratio: 2 / 3;
  width: min(100%, 420px);
  justify-self: end;
}
.arch img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px 999px 8px 8px;
}

.card-text .ill-citron { display: none; }
.card h1 { font-size: clamp(64px, 9vw, 96px); margin: 0 0 20px; }
.card .btn { background: transparent; color: var(--terracotta); border-width: 1.5px; }
.card .btn:hover { background: var(--terracotta); border-color: var(--terracotta); color: #fff; }
.card-text p { margin: 0 0 16px; max-width: 34em; }
.signature {
  margin: 30px 0 34px !important;
  color: var(--terracotta);
  font: 400 40px/1.15 var(--script);
}
.signature span {
  display: block;
  color: var(--brick);
  font: 400 17px/1.6 var(--sans);
}

/* ───────── Galerie ───────── */
.gallery { padding: clamp(36px, 6vw, 64px) 0 120px; }
.gallery-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin: 0 0 16px;
}
.gallery h2 { font-size: clamp(52px, 8vw, 84px); white-space: nowrap; }

.tabs {
  position: sticky;
  top: var(--nav-h);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 12px 0;
  background: var(--cream);
}
.tab {
  padding: 10px 18px 8px;
  border: 1.5px solid var(--blush);
  border-radius: 999px;
  background: var(--paper);
  color: var(--brick);
  font: 600 15px/1.2 var(--sans);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tab small { color: var(--orange); font-weight: 400; margin-left: 6px; }
.tab:hover { border-color: var(--orange); }
.tab[aria-selected="true"] { background: var(--terracotta); border-color: var(--terracotta); color: #fff; }
.tab[aria-selected="true"] small { color: var(--blush); }
.tab-guests { border-style: dashed; border-color: var(--orange); }

.cat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin: 24px 0 18px;
}
.cat-head h3 { margin: 0; color: var(--terracotta); font: 400 48px/1.1 var(--script); }
.cat-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cat-head .note { font-size: 15px; margin: 2px 0 0; color: var(--orange); font-weight: 600; }

/* Justified rows: each tile grows in proportion to its aspect ratio */
.grid { display: flex; flex-wrap: wrap; gap: 6px; }
.grid::after { content: ""; flex-grow: 999; }
.tile {
  flex: calc(var(--r) * 100) 1 calc(var(--r) * 210px);
  aspect-ratio: var(--r);
  max-height: 420px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--blush);
  cursor: zoom-in;
}
.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.tile:hover img { transform: scale(1.03); }

/* Mode sélection : une pastille à cocher sur chaque photo */
.tile { position: relative; }
.selecting .tile { cursor: pointer; }
.selecting .tile::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.selecting .tile.is-selected::after {
  border-color: var(--terracotta);
  background: var(--terracotta) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.selecting .tile.is-selected img { transform: scale(0.9); border-radius: 4px; }
.selecting .tile.is-selected { background: var(--blush); }

.selbar {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  width: min(calc(100% - 24px), 860px);
  padding: 12px 14px 12px 22px;
  transform: translateX(-50%);
  border-radius: 22px;
  background: var(--terracotta);
  color: #fff;
  box-shadow: 0 12px 32px -12px rgba(120, 40, 20, 0.6);
}
.selbar[hidden] { display: none; }
.selbar-info { margin: 0; font-weight: 600; }
.selbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-sun { background: var(--sun); border-color: var(--sun); color: #4a2a10; }
.btn-sun:hover { background: #fff; border-color: #fff; color: var(--terracotta); }
.btn:disabled { opacity: 0.55; cursor: default; }

.empty { text-align: center; padding: 40px 0; }

/* ───────── Ajout de photos ───────── */
.upload {
  margin: 0 0 24px;
  padding: 20px 24px;
  border: 2px dashed var(--sun);
  border-radius: 18px;
  background: var(--sun-tint);
}
.upload p { margin: 0 0 12px; }
.upload-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.upload label span { display: block; font-size: 14px; font-weight: 600; }
.upload input[name="by"] {
  padding: 11px 14px 9px;
  border: 1.5px solid var(--blush);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  color: inherit;
  min-width: 220px;
}
.upload input[name="by"]:focus { outline: none; border-color: var(--orange); }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn:focus-within { outline: 3px solid var(--sun); outline-offset: 3px; }
.upload-status { list-style: none; margin: 12px 0 0; padding: 0; font-size: 15px; }
.upload-status li.error { font-weight: 600; color: var(--terracotta); }
.upload-status:empty { display: none; }

/* ───────── Lightbox ───────── */
.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(46, 20, 13, 0.96);
  color: #fff;
}
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: rgba(46, 20, 13, 0.96); }
.lightbox img {
  max-width: 100%;
  max-height: calc(100dvh - 72px);
  object-fit: contain;
  margin-bottom: 56px;
  touch-action: pan-y pinch-zoom;
  user-select: none;
}
.lb-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: 300 28px/1 var(--sans);
  cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.25); }
.lb-close { top: 14px; right: 14px; font-size: 20px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
}
.lb-actions { display: flex; gap: 8px; }

/* ───────── Pied de page & page code ───────── */
footer { text-align: center; padding-bottom: 48px; background: var(--cream); }
body[data-page="photos"] footer { padding-bottom: 120px; }
footer .ill-citron { width: 64px; margin-top: 40px; }
footer .script { font-size: 44px; }

.gate {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
.gate main {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 48px 16px;
}
.gate .ill-citron { width: 80px; margin-bottom: 18px; }
.gate p:not(.kicker):not(.date) { margin: 28px 0 20px; }
.gate form { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.gate input {
  padding: 13px 18px 10px;
  border: 2px solid var(--blush);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  color: inherit;
  letter-spacing: 0.1em;
  text-align: center;
  width: 240px;
}
.gate input:focus { outline: none; border-color: var(--orange); }
.gate .error { min-height: 1.6em; margin: 12px 0 0 !important; font-weight: 600; color: var(--terracotta); }

@media (max-width: 760px) {
  body { font-size: 17px; }
  :root { --nav-h: 56px; }
  .brand { font-size: 20px; }
  .page-links { gap: 2px; }
  .page-links a { padding: 8px 10px 6px; font-size: 14px; white-space: nowrap; }
  .brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .cat-actions { width: 100%; }
  .cat-actions .btn { flex: 1 1 auto; }
  .selbar { padding: 12px; border-radius: 18px; }
  .selbar-actions { width: 100%; }
  .selbar-actions .btn { flex: 1 1 auto; }
  .gallery-title { gap: 12px; }
  .gallery-title .ill-olives { width: 48px; }
  .gallery-title .ill-crevette { width: 34px; }
  .card { grid-template-columns: 1fr; text-align: center; padding-top: 48px; }
  .arch { max-width: 290px; margin: 0 auto; justify-self: center; }
  .card-text p { margin-inline: auto; }
  .tabs { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; margin: 0 -16px; padding-inline: 16px; scrollbar-width: none; }
  .tab { flex: none; }
  .tile { flex-basis: calc(var(--r) * 140px); }
  .lb-prev, .lb-next { display: none; }
  .upload { padding: 16px; }
  .upload input[name="by"] { min-width: 0; width: 100%; }
  .upload-row label:first-child { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
