/* Livre Kongo — interface pensée pour le téléphone et pour des yeux fatigués :
   grands caractères (police Atkinson Hyperlegible), contrastes forts, cibles tactiles ≥ 52px. */

:root {
  color-scheme: light;
  --bg: #f7f1e8;
  --paper: #fffdf9;
  --ink: #241a14;
  --ink-2: #5b4a3f;
  --line: #e4d6c3;
  --clay: #8a3416;        /* terre cuite */
  --clay-dark: #6a2610;
  --ochre: #c98a2b;
  --ochre-soft: #f6e6c8;
  --leaf: #2f6a3e;        /* Kikongo */
  --leaf-soft: #e5f0e3;
  --sky: #2b4f8a;         /* Français */
  --sky-soft: #e4ebf6;
  --danger: #a8231a;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(60, 30, 10, .06), 0 8px 24px rgba(60, 30, 10, .08);
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 19px/1.5 var(--font);
  min-height: 100vh;
}
a { color: var(--clay); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; margin-top: 1.4em; }
p { margin: 0 0 .7em; }
.muted { color: var(--ink-2); }
.hint { color: var(--ink-2); font-size: .9rem; margin: .8em 0 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--clay); margin: 0 0 .3em; }
:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--clay); color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
}
.topbar::after { /* liseré à motif géométrique, inspiré des tissus kongo */
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 6px;
  background: repeating-linear-gradient(135deg, var(--ochre) 0 6px, var(--clay-dark) 6px 12px);
}
.brand, .topbar-back { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; min-height: 48px; }
.topbar-back span { font-size: 2rem; line-height: 1; margin-top: -4px; }
.brand { font-family: var(--display); font-size: 1.3rem; }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; background:
  conic-gradient(from 45deg, var(--ochre) 0 25%, #fff 0 50%, var(--ochre) 0 75%, #fff 0); }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar {
  display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--ochre-soft); color: var(--clay-dark); font-weight: 700; font-size: 1rem; flex: none;
}
.avatar.sm { width: 34px; height: 34px; font-size: .8rem; }
.usermenu-panel {
  position: absolute; right: 0; top: 56px; min-width: 240px; padding: 8px;
  background: var(--paper); color: var(--ink); border-radius: 14px; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.usermenu-panel a { display: block; padding: 14px 14px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.usermenu-panel a:hover { background: var(--bg); }
.usermenu-name { padding: 8px 14px 10px; margin: 0; color: var(--ink-2); border-bottom: 1px solid var(--line); margin-bottom: 6px; }

/* ---------- Mise en page ---------- */
.wrap { max-width: 980px; margin: 0 auto; padding: 28px 16px 64px; }
.wrap-wide { max-width: 1400px; }
.hello { margin-bottom: 22px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 14px; border: 2px solid transparent;
  font: 700 1.02rem var(--font); text-decoration: none; cursor: pointer; text-align: center;
  transition: transform .08s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--clay); color: #fff; }
.btn-primary:hover { background: var(--clay-dark); }
.btn-secondary { background: var(--ochre-soft); color: var(--clay-dark); border-color: #ecd3a3; }
.btn-ghost { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ochre); }
.btn-light { background: rgba(255,255,255,.92); color: var(--ink); }
.btn-lg { min-height: 58px; font-size: 1.08rem; }
.btn-xl { min-height: 62px; font-size: 1.15rem; width: 100%; }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: .9rem; }
.btn-chip { min-height: 44px; padding: 0 16px; font-size: .92rem; background: var(--leaf-soft); color: var(--leaf); border-color: #c8dfc4; margin: 2px 0 10px; }
.btn[disabled] { opacity: .6; pointer-events: none; }

/* ---------- Formulaires ---------- */
.field { display: block; margin-bottom: 18px; }
.field > span { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 8px; }
input, textarea, select {
  width: 100%; font: 400 1.1rem/1.45 var(--font); color: var(--ink);
  padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line); background: #fff;
  min-height: 56px;
}
textarea { resize: vertical; min-height: 120px; }
input:focus, textarea:focus, select:focus { border-color: var(--ochre); outline: none; box-shadow: 0 0 0 4px rgba(201,138,43,.2); }
.pass-wrap { display: flex; gap: 8px; }
.pass-toggle { flex: none; border: 2px solid var(--line); background: var(--bg); border-radius: 14px; padding: 0 14px; font: 700 .95rem var(--font); color: var(--ink-2); cursor: pointer; }
.alert { background: #fbe4e1; color: var(--danger); border-radius: 12px; padding: 12px 16px; font-weight: 700; }

/* ---------- Connexion ---------- */
.login { max-width: 480px; margin: 0 auto; padding: 0 16px 48px; }
.page-login .topbar { display: none; }
.login-hero { text-align: center; padding: 48px 8px 24px; position: relative; }
.login-hero h1 { font-size: clamp(2.4rem, 11vw, 3.4rem); color: var(--clay-dark); }
.login-hero .lead { font-size: 1.15rem; color: var(--ink-2); max-width: 22em; margin: 0 auto; }
.kente { height: 64px; width: 64px; margin: 0 auto 18px; border-radius: 16px; transform: rotate(45deg);
  background:
    linear-gradient(45deg, transparent 40%, var(--ochre) 40% 60%, transparent 60%),
    linear-gradient(-45deg, transparent 40%, var(--ochre) 40% 60%, transparent 60%),
    var(--clay);
  box-shadow: 0 0 0 6px var(--bg), 0 0 0 8px var(--ochre); }
.login-card { padding: 26px 22px; }

/* ---------- Albums ---------- */
.banner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; padding: 16px 20px; border-radius: var(--radius);
  background: var(--leaf); color: #fff; text-decoration: none; margin-bottom: 20px; font-size: 1.05rem; }
.albums { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.album-card { background: var(--paper); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.album-cover { display: block; position: relative; aspect-ratio: 16/10; background: var(--ochre-soft); }
.album-cover .img { position: absolute; inset: 0; background-size: cover; background-position: center; }
.album-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 45%, rgba(30,15,5,.75)); }
.album-title { position: absolute; left: 20px; bottom: 14px; z-index: 1; color: #fff; font: 600 2rem var(--display); }
.album-body { padding: 18px 20px 20px; }
.album-stats { margin: 10px 0 14px; color: var(--ink-2); }
.album-stats strong { color: var(--ink); font-size: 1.2rem; }
.album-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.album-actions .btn { flex: 1 1 160px; }
.progress { height: 12px; border-radius: 99px; background: var(--bg); overflow: hidden; border: 1px solid var(--line); }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--leaf), #4f9a5f); border-radius: 99px; }
.done-pill { display: inline-flex; align-items: center; min-height: 52px; padding: 0 18px; border-radius: 14px; background: var(--leaf-soft); color: var(--leaf); font-weight: 700; flex: 1 1 160px; justify-content: center; }

/* ---------- Grille de photos ---------- */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 14px; margin: 0 -2px 6px; scrollbar-width: none; }
.tabs a { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 50px; padding: 0 18px; border-radius: 99px;
  background: var(--paper); border: 2px solid var(--line); color: var(--ink); font-weight: 700; text-decoration: none; }
.tabs a span { background: var(--bg); border-radius: 99px; padding: 1px 9px; font-size: .85rem; }
.tabs a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tabs a.on span { background: rgba(255,255,255,.2); }
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 420px) { .grid { grid-template-columns: repeat(2, 1fr); } }
.tile { display: block; position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--ochre-soft); }
.tile .img { position: absolute; inset: 0; background-size: cover; background-position: center; transition: opacity .3s; }
.tile .img.lazy { opacity: 0; }
.tile-num { position: absolute; left: 8px; bottom: 8px; background: rgba(20,10,5,.65); color: #fff; font-size: .8rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.tile-check { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; background: var(--leaf); color: #fff; display: grid; place-items: center; font-weight: 700; box-shadow: 0 0 0 3px #fff; }
.tile-star { position: absolute; top: 8px; left: 8px; width: 34px; height: 34px; border-radius: 50%; background: var(--ochre); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 3px #fff; }
.tile.is-done::after { content: ""; position: absolute; inset: 0; border: 4px solid var(--leaf); border-radius: 12px; }
.empty { text-align: center; padding: 40px 16px; background: var(--paper); border-radius: var(--radius); border: 2px dashed var(--line); font-size: 1.1rem; }

/* ---------- Page photo ---------- */
.wrap-photo { padding-top: 16px; }
.photo-layout { display: grid; gap: 22px; }
@media (min-width: 960px) {
  .wrap-photo { max-width: 1400px; }
  .photo-layout { grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr); align-items: start; }
  .photo-col { position: sticky; top: 90px; }
}
.counter { color: var(--ink-2); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.counter strong { color: var(--ink); font-size: 1.2rem; }
.tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--ochre-soft); color: var(--clay-dark); }
.tag-warn { background: #fbe4e1; color: var(--danger); }

.stage {
  position: relative; margin: 0; width: 100%; aspect-ratio: var(--ratio, 4/3); max-height: 72vh;
  border-radius: var(--radius); overflow: hidden; background: #1b130e; box-shadow: var(--shadow); cursor: zoom-in;
}
.stage .img { position: absolute; inset: 0; background: center / contain no-repeat; }
.shield { position: absolute; inset: 0; } /* couche transparente : l'appui long n'atteint jamais l'image */
.zoom-btn { position: absolute; right: 12px; bottom: 12px; z-index: 3; min-height: 46px; padding: 0 16px; border-radius: 99px; border: 0;
  background: rgba(255,255,255,.9); font: 700 .95rem var(--font); color: var(--ink); cursor: pointer; }
.write-btn { position: absolute; left: 12px; bottom: 12px; z-index: 3; min-height: 46px; padding: 0 18px; border-radius: 99px; border: 0;
  background: var(--clay); color: #fff; font: 700 .98rem var(--font); cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
@media (max-width: 959px) { .page-photo .stage { max-height: 58vh; } }
.watermark { position: absolute; left: 12px; top: 10px; z-index: 2; color: rgba(255,255,255,.55); font-size: .75rem; font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,.6); pointer-events: none; letter-spacing: .03em; }
.pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.pager .btn { flex: 1; max-width: 50%; }
.swipe-hint { text-align: center; color: var(--ink-2); font-size: .85rem; margin-top: 10px; }
@media (hover: hover) { .swipe-hint { display: none; } }

/* Protection : pas de sélection, pas de menu « Enregistrer l'image », pas de glisser-déposer */
.protect, .protect * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; }

.proposal-card { border-top: 6px solid var(--clay); scroll-margin-top: 84px; }
.proposal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.author { margin: 0; display: flex; align-items: center; gap: 8px; }
.status { font-size: .88rem; font-weight: 700; padding: 6px 12px; border-radius: 99px; background: var(--bg); color: var(--ink-2); }
.status:empty { display: none; }
.status.is-saved { background: var(--leaf-soft); color: var(--leaf); }
.status.is-dirty { background: var(--ochre-soft); color: var(--clay-dark); }
.status.is-error { background: #fbe4e1; color: var(--danger); }
.field-kg textarea { border-color: #c8dfc4; background: #fbfdfb; }
.field-kg textarea:focus { border-color: var(--leaf); box-shadow: 0 0 0 4px rgba(47,106,62,.15); }
.field-fr textarea { border-color: #c9d6ea; background: #fbfcfe; }
.field-fr textarea:focus { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(43,79,138,.15); }
.flag { display: inline-block; width: 30px; height: 20px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); flex: none; }
.flag-kg { background: linear-gradient(135deg, #009543 0 38%, #fbde4a 38% 62%, #dc241f 62%); } /* couleurs du Congo */
.flag-fr { background: linear-gradient(90deg, #002395 0 33.3%, #fff 33.3% 66.6%, #ed2939 66.6%); }
.field-more { margin: 4px 0 18px; }
.field-more summary { cursor: pointer; font-weight: 700; min-height: 48px; display: flex; align-items: center; color: var(--ink-2); }
.field-more summary em { font-weight: 400; margin-left: 6px; }
.field-more .field { margin-top: 10px; }
.save-row { display: grid; gap: 10px; }
@media (min-width: 560px) { .save-row { grid-template-columns: 1fr 1.4fr; } }

.final-card { border-top: 6px solid var(--ochre); background: #fffaf0; }
.lang-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--ink-2); margin: 10px 0 2px; }
.quote { font-size: 1.1rem; margin: 0 0 6px; white-space: normal; }
.quote.small { font-size: .98rem; }
.others h2, .section-title { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.count { font: 700 .85rem var(--font); background: var(--ink); color: #fff; border-radius: 99px; padding: 2px 10px; }
.other-card { padding: 18px; }
.coord-tools { margin-top: 18px; padding: 18px; border: 2px dashed var(--line); border-radius: var(--radius); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.coord-tools .eyebrow { width: 100%; color: var(--ink-2); }

/* Visionneuse plein écran */
.lightbox { position: fixed; inset: 0; z-index: 50; background: #0d0907; display: flex; }
.lightbox[hidden] { display: none; }
.lightbox .img { flex: 1; background: center / contain no-repeat; margin: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.lightbox-close { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; z-index: 3; }

/* ---------- Séance collective ---------- */
.seance-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.tabs-inline { padding-bottom: 0; }
.seance-grid { display: grid; gap: 24px; }
@media (min-width: 1000px) {
  .seance-grid { grid-template-columns: 1.4fr 1fr; align-items: start; }
  .seance-grid > section:first-child { position: sticky; top: 90px; }
  .page-seance .stage { max-height: 78vh; }
}

/* ---------- Coordination ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat strong { display: block; font: 600 2rem var(--display); color: var(--clay-dark); }
.stat span { color: var(--ink-2); font-size: .9rem; }
.settings { display: grid; gap: 14px; }
.switch { display: flex; gap: 14px; align-items: flex-start; cursor: pointer; }
.switch input { width: 28px; height: 28px; min-height: 0; flex: none; accent-color: var(--clay); margin-top: 2px; }
.switch small { color: var(--ink-2); }
.members { display: grid; gap: 10px; }
.member { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.member.is-off { opacity: .5; }
.member-info { flex: 1 1 200px; }
.member-info small { display: block; color: var(--ink-2); }
.add-member { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.add-member .btn { margin-bottom: 18px; }
.flash-ok { border-left: 6px solid var(--leaf); }
.flash-err { border-left: 6px solid var(--danger); }
.bigcode { font-size: 1.4rem; background: var(--ochre-soft); padding: 4px 12px; border-radius: 8px; letter-spacing: .05em; }

/* Notification */
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 150%); z-index: 60;
  background: var(--ink); color: #fff; padding: 16px 24px; border-radius: 16px; font-weight: 700; font-size: 1.05rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.3); transition: transform .3s ease; max-width: calc(100% - 32px); text-align: center; }
.toast.show { transform: translate(-50%, 0); }
.toast.ok::before { content: "✓ "; color: #8fd19e; }

@media print { body { display: none; } } /* pas d'impression des pages de travail */
