/* Family — un album relié : couverture en toile verte, pages gris-vert,
   photos en tirages à bord blanc. Corps de texte large pour tous les âges. */

:root {
  --toile: #1F4D3F;
  --toile-clair: #2D6553;
  --page: #EEF2EE;
  --page-fonce: #E1E8E2;
  --tirage: #FFFFFF;
  --encre: #1C2422;
  --encre-douce: #5B6863;
  --souci: #E2A33A;
  --coeur: #C2413A;
  --trait: #CBD5CE;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--encre);
  font: 18px/1.5 var(--sans);
  padding-bottom: calc(var(--tabs-h) + var(--safe-b) + 24px);
}
img, video { display: block; max-width: 100%; }
a { color: var(--toile); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--souci); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- en-tête */

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: calc(var(--safe-t) + 22px) 18px 16px;
  background: var(--toile);
  color: #F3F6F2;
}
.brand {
  display: block; flex: none;
  font: 600 25px/1 var(--serif);
  color: inherit; text-decoration: none; letter-spacing: .01em;
}
.top-title { margin-left: auto; font-size: 15px; opacity: .8; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main { max-width: 640px; margin: 0 auto; padding: 8px 16px; outline: none; }

/* ---------------------------------------------------------------- onglets */

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  height: calc(var(--tabs-h) + var(--safe-b));
  padding: 0 max(4px, calc(50% - 320px)) var(--safe-b);
  background: var(--tirage);
  border-top: 1px solid var(--trait);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tabs-h);
  font-size: 13px; color: var(--encre-douce); text-decoration: none;
}
.tabs a[aria-current="page"] { color: var(--toile); font-weight: 600; }
.ico svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs .tab-publish .ico {
  display: grid; place-items: center;
  width: 58px; height: 58px; margin-bottom: 14px;
  border-radius: 50%;
  background: var(--souci); color: var(--encre);
  box-shadow: 0 4px 14px rgba(31, 77, 63, .28);
}
.tabs .tab-publish svg { width: 30px; height: 30px; stroke-width: 2.4; }
body.no-tabs .tabs { display: none; }
body.no-tabs { padding-bottom: 32px; }

/* ---------------------------------------------------------------- titres */

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; }
h1 { font-size: 30px; margin: 20px 0 6px; }
h2 { font-size: 23px; margin: 30px 0 10px; }
h3 { font-size: 19px; margin: 18px 0 8px; }
.lede { color: var(--encre-douce); margin: 0 0 18px; }
.muted { color: var(--encre-douce); }
.small { font-size: 15px; }

/* ---------------------------------------------------------------- boutons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px;
  border: 0; border-radius: 12px;
  background: var(--toile); color: #fff;
  font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:active { background: var(--toile-clair); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.secondaire { background: var(--tirage); color: var(--toile); border: 1.5px solid var(--toile); }
.btn.danger { background: var(--tirage); color: var(--coeur); border: 1.5px solid var(--coeur); }
.btn.large { width: 100%; }
.btn.publier { background: var(--souci); color: var(--encre); }
.lien {
  background: none; border: 0; padding: 6px 0; cursor: pointer;
  color: var(--toile); text-decoration: underline; text-underline-offset: 3px; font-size: 16px;
}
.lien.danger { color: var(--coeur); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0; }

/* ---------------------------------------------------------------- formulaires */

label.champ { display: block; margin: 16px 0; }
label.champ > span { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], textarea, select {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border: 1.5px solid var(--trait); border-radius: 10px;
  background: var(--tirage);
  font-size: 18px;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
/* Safari iOS donne au champ date une largeur propre qui déborde du formulaire. */
input[type=date] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: left; }
input[type=date]::-webkit-date-and-time-value { text-align: left; }
input:focus, textarea:focus, select:focus { border-color: var(--toile); outline: none; box-shadow: 0 0 0 3px rgba(31, 77, 63, .18); }
.erreur { color: var(--coeur); font-weight: 600; min-height: 1.5em; margin: 8px 0; }
.aide { color: var(--encre-douce); font-size: 15px; margin-top: 6px; }

/* ---------------------------------------------------------------- les tirages */

.tirage {
  background: var(--tirage);
  padding: 7px;
  box-shadow: 0 1px 2px rgba(28, 36, 34, .12), 0 6px 18px rgba(28, 36, 34, .10);
}
.tirage img, .tirage video { width: 100%; height: 100%; object-fit: cover; background: var(--page-fonce); }

/* ---------------------------------------------------------------- publications */

.post { margin: 26px 0 40px; }
.post-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.post-qui { font: 600 20px/1.25 var(--serif); }
.post-quand { color: var(--encre-douce); font-size: 15px; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 14px 2px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--encre-douce); font-size: 15px; margin: 8px 2px; }
.post-meta a { color: inherit; }
.post-menu { margin-left: auto; }

.photos { display: grid; gap: 10px; }
.photos.n1 .tirage { aspect-ratio: var(--ratio, 4 / 3); max-height: 80vh; }
.photos.n2 { grid-template-columns: 1fr 1fr; }
.photos.n2 .tirage, .photos.nn .tirage { aspect-ratio: 1; }
.photos.nn { grid-template-columns: repeat(var(--petites, 2), 1fr); gap: 8px; }
.photos.nn .tirage:first-child { grid-column: 1 / -1; aspect-ratio: 4 / 3; }
.photos button { all: unset; cursor: zoom-in; display: block; position: relative; }
.photos button:focus-visible { outline: 3px solid var(--souci); }
.plus-photos {
  position: absolute; inset: 7px; display: grid; place-items: center;
  background: rgba(28, 36, 34, .5); color: #fff; font: 600 30px var(--serif);
}
.lecture {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px;
  border-radius: 50%; background: rgba(255, 255, 255, .9);
  display: grid; place-items: center;
}
.lecture::after { content: ""; border-left: 20px solid var(--encre); border-top: 12px solid transparent; border-bottom: 12px solid transparent; margin-left: 5px; }

/* Neuf réactions sur une seule ligne : chaque bouton prend un neuvième de la
   largeur ; le compte est une pastille posée dans le coin, pour ne pas élargir. */
.reactions { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; margin: 14px 0 6px; }
.reaction {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  min-width: 0; min-height: 44px; padding: 0;
  border: 1.5px solid var(--trait); border-radius: 12px;
  background: var(--tirage); font-size: 20px; line-height: 1; cursor: pointer;
}
.reaction .n {
  position: absolute; top: -7px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--toile); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}
.reaction.mine { border-color: var(--toile); background: #DDEBE3; }
.qui-reagit { font-size: 15px; color: var(--encre-douce); margin: 2px 2px 0; }

.comments { margin: 10px 0 0; padding: 0; list-style: none; }
.comments li { padding: 10px 0; border-top: 1px solid var(--trait); }
.comments .c-qui { font-weight: 600; }
.comments .c-texte { white-space: pre-wrap; overflow-wrap: anywhere; }
.comments .c-quand { font-size: 14px; color: var(--encre-douce); }
.c-suppr {
  margin-left: 8px; padding: 4px 2px; border: 0; background: none; cursor: pointer;
  font-size: 14px; color: var(--encre-douce); text-decoration: underline; text-underline-offset: 2px;
}
.comment-form { display: flex; gap: 8px; margin-top: 8px; }
.comment-form input { flex: 1; }
.comment-form .btn { padding: 0 16px; }

.sep-jour {
  font: 600 17px var(--serif); color: var(--encre-douce);
  margin: 34px 0 -10px; padding-bottom: 6px; border-bottom: 1px solid var(--trait);
}

/* ---------------------------------------------------------------- souvenirs */

.ce-jour {
  margin: 18px -16px 10px; padding: 26px 20px 22px;
  background: var(--toile); color: #F3F6F2;
}
.ce-jour h1 { margin: 0 0 4px; font-size: 34px; }
.ce-jour .date { font: italic 19px var(--serif); opacity: .85; margin: 0; }
.ce-jour .vide { margin: 14px 0 0; opacity: .85; }
.annee-titre { font: 600 22px var(--serif); margin: 26px 0 8px; }
.mois { display: flex; flex-wrap: wrap; gap: 8px; }
.mois a {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 74px; min-height: 56px; padding: 6px 10px;
  background: var(--tirage); border-radius: 10px; text-decoration: none; color: var(--encre);
  border: 1px solid var(--trait);
}
.mois a b { font-weight: 600; text-transform: capitalize; }
.mois a span { font-size: 13px; color: var(--encre-douce); }

/* ---------------------------------------------------------------- albums */

.albums { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 16px; margin-top: 16px; }
.album { text-decoration: none; color: var(--encre); }
.album .tirage { aspect-ratio: 1; }
.album .vide-couv { display: grid; place-items: center; height: 100%; background: var(--page-fonce); color: var(--encre-douce); font: 600 34px var(--serif); }
.album-titre { font: 600 18px/1.25 var(--serif); margin: 10px 2px 2px; }
.album-info { font-size: 14px; color: var(--encre-douce); margin: 0 2px; }

/* ---------------------------------------------------------------- famille */

.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--trait); }
.liste .grow { flex: 1; min-width: 0; }
.liste a.grow { text-decoration: none; color: var(--encre); }
.initiale {
  flex: none; display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--page-fonce); color: var(--toile); font: 600 20px var(--serif);
}
.lien-invitation {
  padding: 14px; margin: 12px 0; background: var(--tirage); border: 1.5px dashed var(--toile); border-radius: 10px;
  word-break: break-all; font-size: 15px;
}

/* ---------------------------------------------------------------- publier */

.choix-fichiers {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 130px; padding: 18px; margin: 12px 0;
  border: 2px dashed var(--toile); border-radius: 14px; background: var(--tirage);
  color: var(--toile); font-weight: 600; text-align: center; cursor: pointer;
}
.choix-fichiers input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.apercus { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.apercu { position: relative; aspect-ratio: 1; }
.apercu .tirage { height: 100%; padding: 4px; }
.apercu .barre { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.7); overflow: hidden; }
.apercu .barre i { display: block; height: 100%; width: 0; background: var(--toile); transition: width .2s; }
.apercu .etat-err { position: absolute; inset: 4px; display: grid; place-items: center; text-align: center; padding: 6px; background: rgba(194, 65, 58, .85); color: #fff; font-size: 13px; }
.apercu .retirer {
  position: absolute; top: -8px; right: -8px; width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: var(--encre); color: #fff; font-size: 18px; line-height: 1; cursor: pointer;
}
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce {
  min-height: 42px; padding: 0 14px; border-radius: 21px;
  border: 1.5px solid var(--trait); background: var(--tirage); cursor: pointer;
}
.puce[aria-pressed="true"] { background: var(--toile); border-color: var(--toile); color: #fff; }

/* ---------------------------------------------------------------- visionneuse */

.visionneuse {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(14, 18, 17, .97);
  display: grid; grid-template-rows: auto 1fr auto;
  color: #fff;
}
.visionneuse header, .visionneuse footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(var(--safe-t) + 10px) 14px 10px;
}
.visionneuse footer { padding: 10px 14px calc(var(--safe-b) + 14px); }
.visionneuse .scene { position: relative; display: grid; place-items: center; overflow: hidden; touch-action: pan-y; }
.visionneuse .scene img, .visionneuse .scene video { max-width: 100%; max-height: 100%; object-fit: contain; }
.visionneuse button, .visionneuse a {
  min-height: 46px; min-width: 46px; padding: 0 14px; border-radius: 23px;
  border: 1.5px solid rgba(255,255,255,.4); background: transparent; color: #fff; font-size: 16px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.visionneuse .nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.35); border: 0; font-size: 26px; }
.visionneuse .prec { left: 8px; }
.visionneuse .suiv { right: 8px; }

/* ---------------------------------------------------------------- connexion */

.accueil { max-width: 420px; margin: 0 auto; padding-top: 6vh; }
.accueil h1 { font-size: 38px; margin-bottom: 4px; }
.pile {
  position: relative; height: 150px; margin: 10px 0 26px;
}
.pile span {
  position: absolute; width: 120px; height: 100px; background: var(--tirage); padding: 7px;
  box-shadow: 0 1px 2px rgba(28,36,34,.12), 0 6px 18px rgba(28,36,34,.12);
}
.pile span::after { content: ""; display: block; height: 100%; background: var(--page-fonce); }
.pile span:nth-child(1) { left: 6%; top: 24px; transform: rotate(-7deg); }
.pile span:nth-child(2) { left: 32%; top: 6px; transform: rotate(3deg); }
.pile span:nth-child(2)::after { background: #C9D8CE; }
.pile span:nth-child(3) { left: 58%; top: 30px; transform: rotate(-2deg); }
.pile span:nth-child(3)::after { background: #E9D7AE; }

/* ---------------------------------------------------------------- divers */

.vide-page { text-align: center; padding: 40px 10px; color: var(--encre-douce); }
.vide-page p { margin: 0 0 18px; }
.chargement { text-align: center; padding: 40px; color: var(--encre-douce); }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--safe-b) + 18px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--encre); color: #fff; font-size: 16px;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--coeur); }

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

/* Sur un téléphone, le nom de la famille prend la place du titre de page. */
@media (max-width: 480px) {
  .top-title { display: none; }
}

@media (min-width: 700px) {
  .albums { grid-template-columns: repeat(3, 1fr); }
  .apercus { grid-template-columns: repeat(4, 1fr); }
}

/* ---------------------------------------------------------------- gazette */

.gazette { max-width: 820px; margin: 0 auto; background: var(--tirage); padding: 34px 38px 40px; }
.gz-tete { text-align: center; border-bottom: 3px double var(--encre); padding-bottom: 14px; margin-bottom: 18px; }
.gz-tete h1 { font-size: 44px; margin: 0; letter-spacing: .01em; }
.gz-tete .gz-mois { font: italic 22px var(--serif); margin: 4px 0 0; }
.gz-chapo { font: 18px/1.55 var(--serif); text-align: center; margin: 0 auto 22px; max-width: 34em; }
.gz-colonnes { column-count: 2; column-gap: 30px; }
.gz-article { break-inside: avoid; margin: 0 0 24px; font-family: var(--serif); }
.gz-article .gz-date { font-size: 14px; color: var(--encre-douce); margin: 0 0 2px; }
.gz-article h3 { margin: 0 0 8px; font-size: 19px; }
.gz-article p { margin: 8px 0 0; font-size: 16px; line-height: 1.5; white-space: pre-wrap; }
.gz-photos { display: grid; gap: 6px; }
.gz-photos.n2, .gz-photos.n3 { grid-template-columns: 1fr 1fr; }
.gz-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gz-photos.n1 img { aspect-ratio: auto; max-height: 320px; }
.gz-photos.n3 img:first-child { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.gz-mots { font-size: 14px; color: var(--encre-douce); font-style: italic; margin-top: 6px; }
.gz-encadre { border: 1.5px solid var(--encre); padding: 14px 18px; margin: 10px 0 0; break-inside: avoid; font-family: var(--serif); }
.gz-encadre h3 { margin: 0 0 6px; }
.gz-outils { max-width: 820px; margin: 12px auto; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }

@media (max-width: 600px) {
  .gazette { padding: 22px 16px; margin: 0 -16px; }
  .gz-colonnes { column-count: 1; }
  .gz-tete h1 { font-size: 34px; }
}

@media print {
  @page { size: A4; margin: 14mm 13mm; }
  body { background: #fff; padding: 0; font-size: 12pt; }
  .top, .tabs, .gz-outils, .toast { display: none !important; }
  main { max-width: none; padding: 0; }
  .gazette { padding: 0; max-width: none; margin: 0; }
  .gz-colonnes { column-count: 2; }
  .gz-photos.n1 img { max-height: 75mm; }
}

/* Journal des connexions (administration) : replié par défaut. */
details { margin: 28px 0 8px; }
details > summary { cursor: pointer; font: 600 23px/1.2 var(--serif); padding: 8px 0; }
.liste .danger { color: var(--coeur); }
