:root {
  --bg: #FCFAF6;
  --ink: #2A2522;
  --muted: #73675D;
  --sand: #F2EBE1;
  --sand-2: #E6D9C6;
  --line: #EEE6DA;
  --card: #FFFFFF;
  --accent: #9A4F2C;
  --danger: #A3392B;
  --radius: 14px;
  font-family: "Instrument Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5; }
img { max-width: 100%; display: block; }
a { color: var(--accent); }
a:hover { color: #7A3B1E; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 560px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hidden { display: none !important; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Barre principale + recherche */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.topbar-in { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { font-weight: 600; font-size: 16px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--ink); }
.search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; min-height: 44px; color: var(--muted); }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 16px; color: var(--ink); min-height: 42px; padding: 0; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.results { background: var(--card); border: 1px solid var(--line); border-radius: 16px; margin: 0 0 10px; max-height: 60vh; overflow-y: auto; box-shadow: 0 10px 30px rgba(42,37,34,.08); }
.result { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 56px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.result:last-child { border-bottom: none; }
.result:hover { background: var(--sand); color: var(--ink); }
.result img, .av.big { width: 40px; height: 40px; border-radius: 999px; object-fit: cover; flex: none; font-size: 15px; }
@media (max-width: 360px) { .brand { font-size: 14px; } .topbar-in { gap: 8px; } }

/* Boutons */
.btn { min-height: 52px; border-radius: var(--radius); border: none; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 500; font-size: 16px; text-decoration: none; text-align: center; }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:hover { background: #000; color: var(--bg); }
.btn-soft { background: var(--sand); color: var(--ink); }
.btn-soft:hover { background: var(--sand-2); color: var(--ink); }
.btn-line { background: transparent; border: 1px solid var(--sand-2); color: var(--ink); }
.btn-small { min-height: 40px; font-size: 14px; padding: 0 14px; border-radius: 11px; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid #E8C9C3; }
.btn[disabled] { opacity: .55; cursor: default; }
.link { background: none; border: none; padding: 0; color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }

/* Champs */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.field input, .field textarea, .field select { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-size: 16px; color: var(--ink); width: 100%; min-height: 48px; }
.field textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); margin: 0; }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 4px; border-radius: var(--radius); background: var(--sand); }
.seg button { min-height: 44px; border: none; border-radius: 11px; background: transparent; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--sand-2); background: var(--card); font-size: 14px; color: var(--ink); }
.chip:hover { background: var(--sand); }
.err { color: var(--danger); font-size: 14px; min-height: 0; }

/* En-tête de la page */
.hero { height: clamp(200px, 34vh, 320px); background: var(--sand-2); border-radius: 0 0 28px 28px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero .initial { font-size: 72px; color: #FFFFFFCC; font-weight: 500; }
.ident { text-align: center; padding-top: 22px; }
.ident h1 { margin: 0; font-weight: 500; font-size: 34px; letter-spacing: -0.02em; line-height: 1.1; }
.ident .dates { margin-top: 6px; color: var(--muted); font-size: 16px; }
.ident .intro { margin: 14px auto 0; font-size: 17px; max-width: 460px; }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

/* Onglets */
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin-top: 26px; overflow-x: auto; scrollbar-width: none; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: none; padding: 12px 0; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 15px; min-height: 44px; }
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.panel { padding: 20px 0 64px; }

/* Messages */
.entry { padding: 18px 0; border-bottom: 1px solid var(--line); }
.entry p { margin: 0; font-size: 16px; white-space: pre-line; }
.entry .when { font-size: 14px; color: var(--accent); font-weight: 600; margin-bottom: 6px; }
.by { margin-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.av { width: 26px; height: 26px; border-radius: 999px; background: #D9C7B0; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: var(--ink); font-weight: 600; flex: none; }
.pics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.pics img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--sand); }
.pics.one { grid-template-columns: 1fr; }
.pics.one img { aspect-ratio: 4/3; }
.voice { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.voice audio { width: 100%; }
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; background: var(--danger); margin-right: 8px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.empty { padding: 28px 0; color: var(--muted); text-align: center; }
.note { padding: 14px 16px; border-radius: var(--radius); background: var(--sand); font-size: 15px; }

/* Frise */
.timeline { border-left: 2px solid var(--sand-2); padding-left: 18px; display: flex; flex-direction: column; gap: 22px; }
.timeline .item { position: relative; }
.timeline .item::before { content: ""; position: absolute; left: -25px; top: 6px; width: 12px; height: 12px; border-radius: 999px; background: var(--sand-2); border: 2px solid var(--bg); }
.timeline .item.mark::before { background: var(--accent); }
.timeline .when { font-size: 14px; color: var(--accent); font-weight: 600; }
.timeline p { margin: 6px 0 0; white-space: pre-line; }

/* Feuille (formulaire) */
.sheet-bg { position: fixed; inset: 0; background: rgba(42, 37, 34, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 94vh; max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain; border-radius: 22px 22px 0 0; padding: 20px 20px calc(28px + env(safe-area-inset-bottom)); }
@media (max-width: 360px) {
  .wrap { padding: 0 16px; }
  .sheet { padding-left: 16px; padding-right: 16px; }
  .sheet h2 { font-size: 21px; }
  .ident h1 { font-size: 30px; }
}
html { -webkit-tap-highlight-color: transparent; }
body { padding-bottom: env(safe-area-inset-bottom); overflow-wrap: anywhere; }
@media (min-width: 640px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; } }
.actions .row2 .btn { padding: 0 8px; font-size: 15px; }
.sheet-head { position: sticky; top: -20px; background: var(--bg); padding: 20px 0 10px; margin: -20px 0 4px; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.sheet h2 { margin: 0; font-weight: 500; font-size: 24px; letter-spacing: -0.01em; line-height: 1.2; }
.close { width: 44px; height: 44px; border-radius: 999px; border: none; background: var(--sand); flex: none; display: flex; align-items: center; justify-content: center; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }

/* Espace famille */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.card h3 { margin: 0 0 10px; font-size: 17px; font-weight: 600; }
.badge { display: inline-flex; min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; align-items: center; justify-content: center; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.qr { background: #fff; padding: 12px; border-radius: 12px; display: inline-block; }
.copy { display: flex; gap: 8px; }
.copy input { flex: 1; min-width: 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; z-index: 80; font-size: 15px; max-width: calc(100% - 40px); }
footer.site { padding: 32px 0 40px; text-align: center; color: var(--muted); font-size: 13px; }

@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { position: absolute; inset: 0; display: flex !important; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 20px; }
}
.topbar ~ .wrap .tabs { top: calc(61px + env(safe-area-inset-top)); }
@media (max-width: 400px) { .tabs { gap: 14px; } .tabs button { font-size: 14px; } }
.lang { flex: none; min-width: 44px; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 13px; font-weight: 600; letter-spacing: .04em; padding: 0 10px; }
.lang:hover { background: var(--sand); }
.entry-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.heart { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 10px; margin-top: 6px; border: none; border-radius: 999px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; }
.heart:hover { background: var(--sand); }
.heart.on { color: #B8322A; }
.heart svg { transition: transform .15s ease; }
.heart:active svg { transform: scale(1.25); }
@media (prefers-reduced-motion: reduce) { .heart svg { transition: none; } }
.demo-banner { background: var(--ink); color: var(--bg); font-size: 14px; padding: 10px 16px; text-align: center; line-height: 1.4; }
.demo-banner a { color: #F2C9B0; font-weight: 600; }
.thumb { position: relative; }
.thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
.thumb-x { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 999px; border: none; background: var(--ink); color: var(--bg); font-size: 16px; line-height: 1; }
.verified { margin-left: auto; color: #2F7A4F; font-weight: 700; }
.entry-foot .by { min-width: 0; }
.heart { flex: none; white-space: nowrap; }
.auth:empty { display: none; }
.auth-on { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-radius: var(--radius); background: #EAF3EC; font-size: 14px; }
.g-btn { min-height: 44px; display: flex; justify-content: center; }
.by > span:last-child { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.id-tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.id-tag.ok { background: #E3F1E7; color: #23633E; }
.id-tag.no { background: #F2EBE1; color: #73675D; }
