/* Couleurs et polices de la maquette. */
:root {
  --bg: #f5f3fb; --card: #fff; --ink: #24193d; --soft: #625a78; --accent: #c4284a; --sun: #ffd25a;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 Figtree, system-ui, sans-serif; }
h1, h2 { font-family: 'Bricolage Grotesque', Figtree, sans-serif; font-weight: 800; line-height: 1.1; margin: 0; }
h1 { font-size: 29px; }
h2 { font-size: 20px; }
p { margin: 0; }

/* L'auvent festonné. */
.awning {
  /* Sur iPhone, l'auvent commence sous la barre d'état, sinon elle l'estompe. */
  height: 30px;
  margin-top: calc(env(safe-area-inset-top) * 1.2);
  background:
    radial-gradient(19.5px 13px at 19.5px 0, var(--accent) 98%, #0000) 0 100% / 78px 13px repeat-x,
    radial-gradient(19.5px 13px at 19.5px 0, var(--sun) 98%, #0000) 39px 100% / 78px 13px repeat-x,
    repeating-linear-gradient(90deg, var(--accent) 0 39px, var(--sun) 39px 78px) 0 0 / 100% calc(100% - 13px) no-repeat;
}

#app { max-width: 440px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
.loading { text-align: center; color: var(--soft); padding-top: 40px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--soft); }
.card { background: var(--card); border-radius: 24px; padding: 18px; box-shadow: 0 10px 30px rgba(36, 25, 61, .08); }
.empty { text-align: center; padding: 32px 20px; }
.empty svg { width: 56px; height: 56px; color: var(--accent); }
.muted { color: var(--soft); font-size: 15px; }

.btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 56px; padding: 0 16px;
  border: 0; border-radius: 20px; background: var(--accent); color: #fff; font: 700 18px Figtree, system-ui, sans-serif;
  text-decoration: none; cursor: pointer; }
.btn.secondary { background: var(--card); color: var(--ink); font-size: 15px; min-height: 48px; border-radius: 16px; }
.card .btn.secondary { background: var(--bg); }
.btn:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--soft); margin-bottom: 6px; }
input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #d8d3e8; border-radius: 14px;
  font: inherit; color: inherit; background: #fff; margin-bottom: 10px; }

.welcome { text-align: center; gap: 22px; padding-top: 4vh; }
.welcome img { width: 200px; height: 200px; border-radius: 40px; margin: 0 auto; }
.welcome h1 { font-size: 36px; }
.welcome .lead { font-size: 19px; color: #4a4263; }
.welcome .small { font-size: 13px; color: var(--soft); }
.alert { background: #ffe3e8; color: #7a1029; border-radius: 16px; padding: 14px; font-size: 15px; font-weight: 600; }

nav { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 440px; margin: 0 auto; background: var(--card); padding: 8px 8px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 18px rgba(36, 25, 61, .08); }
nav a { min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--soft); text-decoration: none; }
nav a[aria-current=page] { color: var(--accent); font-weight: 700; }
nav svg { width: 24px; height: 24px; }

.tip { text-align: left; font-size: 14px; display: flex; flex-direction: column; gap: 8px; }
.center { text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; padding: 0; border: 0; }
label.btn { margin: 0; color: #fff; font-size: 18px; position: relative; }
label.btn:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }
label.btn.busy { opacity: .6; }
.btn.dark { background: var(--ink); }
.btn.link { background: none; color: var(--accent); font-size: 15px; min-height: 44px; text-decoration: underline; }

.folders { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.folder, .chip { border: 2px solid transparent; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.folder { min-height: 54px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px; }
.folder strong { font-size: 14px; }
.folder span { font-size: 12px; }
.plats { background: #ffd9df; }
.desserts { background: #ffe3c2; }
.ambiance { background: #dcd6fa; }
.equipe { background: #cdebdd; }
.lieu { background: #cce3fa; }
.folder[aria-pressed=true], .chip[aria-pressed=true] { border-color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 99px; font-size: 14px; font-weight: 700; }
.chip[aria-pressed=true]::before { content: '✓ '; }
.pill { align-self: flex-end; min-height: 44px; padding: 0 14px; border: 0; border-radius: 99px; background: var(--card); color: var(--ink); font: 700 13px Figtree, system-ui, sans-serif; cursor: pointer; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.thumb { padding: 0; border: 0; border-radius: 18px; overflow: hidden; aspect-ratio: 1; background: #e4e0ef; cursor: pointer; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

.sheet { width: 100%; max-width: 440px; max-height: 92dvh; margin: auto auto 0; border: 0; border-radius: 30px 30px 0 0; background: var(--bg); color: var(--ink); padding: 16px 18px calc(24px + env(safe-area-inset-bottom)); overflow: auto; }
.sheet::backdrop { background: rgba(36, 25, 61, .45); }
.sheet .full { display: block; width: 100%; height: auto; max-height: 45dvh; object-fit: contain; border-radius: 22px; background: #e4e0ef; }

textarea { width: 100%; padding: 12px 14px; border: 1px solid #d8d3e8; border-radius: 14px; font: inherit; color: inherit; background: #fff; resize: vertical; }
.counter { text-align: right; font-size: 12px; }
input[type=range] { padding: 0; border: 0; background: transparent; accent-color: var(--accent); }
.preview { display: block; width: 100%; height: auto; border-radius: 22px; background: #e4e0ef; }
.card input[type=datetime-local] { margin: 0; }
.post-row { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 10px; border: 2px solid transparent; border-radius: 20px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; box-shadow: 0 6px 18px rgba(36, 25, 61, .07); }
.post-row.failed { border-color: var(--accent); }
.post-row img, .no-picture { width: 72px; height: 72px; flex-shrink: 0; border-radius: 14px; object-fit: cover; background: #e4e0ef; }
.post-row > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.post-row strong { font-size: 15px; }
.excerpt { font-size: 14px; color: var(--soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-detail > img { display: block; max-width: 100%; max-height: 40dvh; margin: 0 auto; border-radius: 22px; }
.caption { white-space: pre-wrap; overflow-wrap: anywhere; }

.link-row { text-decoration: none; justify-content: space-between; padding: 14px 16px; }
.link-row::after { content: '›'; font-size: 24px; color: var(--soft); }
a.btn.link { background: none; color: var(--accent); }
.chip.word { background: var(--card); }
.chip.word[aria-pressed=true] { background: var(--ink); color: #fff; }
.chip:disabled { opacity: .4; cursor: default; }

.week-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 4px; border-radius: 20px; background: var(--card); }
.week-row.off { background: #e9e6f3; }
.theme { flex: 1; min-width: 0; min-height: 48px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0 10px; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.switch { position: relative; width: 52px; height: 32px; flex-shrink: 0; border: 2px solid #8a829e; border-radius: 99px; background: transparent; cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 99px; background: #8a829e; transition: left .15s; }
.switch[aria-checked=true] { background: #14663a; border-color: #14663a; }
.switch[aria-checked=true]::after { left: 24px; background: #fff; }

.calendar { padding: 12px; }
.month { display: flex; align-items: center; justify-content: space-between; }
.month button, .stepper button { width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 99px; background: var(--bg); color: var(--ink); font: 700 22px Figtree, system-ui, sans-serif; cursor: pointer; }
.week-days, .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.week-days { margin: 10px 0 4px; font-size: 12px; font-weight: 700; color: var(--soft); }
.day { aspect-ratio: 1; min-height: 38px; padding: 0; border: 2px solid transparent; border-radius: 99px; background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.day.today { border-color: #8a829e; font-weight: 700; }
.day.has { background: #ffd9df; font-weight: 700; }
.day[aria-pressed=true] { border-color: var(--ink); }
.date-badge { width: 56px; height: 56px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 16px; background: #ffd9df; line-height: 1.1; }
.date-badge strong { font-size: 20px; }
.date-badge span { font-size: 12px; }
.post-row.past { opacity: .6; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper-value { flex: 1; text-align: center; font-weight: 700; }
.announce { display: block; padding: 12px 16px; border-radius: 18px; background: #fff0b3; color: var(--ink); text-decoration: none; }
input[type=date] { margin: 0; }

button.announce { width: 100%; display: flex; flex-direction: column; gap: 4px; border: 0; font: inherit; text-align: left; cursor: pointer; }
.announce-action { font-size: 14px; font-weight: 700; color: var(--accent); }
.sheet-top { margin-bottom: 18px; }
[hidden] { display: none !important; }

.proposal { border: 2px solid var(--sun); }
.reason { font-size: 14px; }
.fine { font-size: 12px; text-align: center; }
.sparkle { font-size: 34px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.25); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .sparkle { animation: none; } }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.proposal .btn.secondary { background: var(--bg); }
.stack:empty { display: none; }
.reused { padding: 8px 12px; border-radius: 14px; background: #fff0b3; font-size: 14px; font-weight: 600; }

/* Sur l'aperçu à cadrer, les gestes déplacent la photo au lieu de faire défiler la page. */
.preview.framing { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.preview.framing:active { cursor: grabbing; }
.framing-bar { display: flex; align-items: center; gap: 8px; }
.framing-bar p { flex: 1; font-size: 13px; }
.framing-bar button { width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 99px; background: var(--card); color: var(--ink); font: 700 22px Figtree, system-ui, sans-serif; cursor: pointer; }
.cancel { align-self: flex-start; min-height: 44px; padding: 0 14px; border: 0; border-radius: 99px; background: var(--card); color: var(--ink); font: 700 14px Figtree, system-ui, sans-serif; cursor: pointer; }

.photo-box { position: relative; }
.photo-edit { position: absolute; top: 10px; right: 10px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 99px; background: var(--card); color: var(--ink); box-shadow: 0 4px 14px rgba(36, 25, 61, .35); cursor: pointer; }
.photo-edit svg { width: 24px; height: 24px; }
.photo-edit.done { background: #14663a; color: #fff; }
.photo-edit:disabled { opacity: .5; }
.preview.framing { outline: 3px dashed var(--accent); outline-offset: 2px; }

/* Travail en cours : des zébrures défilent dans le bouton. */
.btn.working, .card .btn.secondary.working { opacity: 1; color: var(--ink); background: linear-gradient(135deg, var(--sun) 25%, #ffe9a8 25% 50%, var(--sun) 50% 75%, #ffe9a8 75%) 0 0 / 40px 40px; animation: stripes .9s linear infinite; }
@keyframes stripes { to { background-position: 40px 0; } }
@media (prefers-reduced-motion: reduce) { .btn.working { animation: none; } }

/* Les posts à venir. */
.back { align-self: flex-start; min-height: 44px; display: inline-flex; align-items: center; color: var(--ink); font-size: 15px; font-weight: 700; text-decoration: none; }
.day-post { position: relative; display: flex; flex-direction: column; gap: 12px; width: 100%; padding: 12px; border: 3px solid transparent; color: var(--ink); font: inherit; text-align: left; }
.day-post.done { border-color: #a5e635; cursor: pointer; }
.day-post.quiet { background: #ffffff80; box-shadow: none; }
.day-post.pop { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: scale(.94); } 60% { transform: scale(1.03); } }
.day-line { display: flex; gap: 12px; align-items: flex-start; width: 100%; }
.day-photo { position: relative; width: 84px; flex-shrink: 0; }
.day-photo canvas, .day-photo img, .day-photo .no-picture { display: block; width: 84px; height: 84px; border-radius: 18px; object-fit: cover; background: #e4e0ef; }
.day-check { position: absolute; right: -6px; bottom: -6px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: 3px solid var(--card); border-radius: 99px; background: #a5e635; font-size: 14px; font-weight: 800; }
.day-text { flex: 1; min-width: 0; font-size: 14px; color: var(--soft); overflow-wrap: anywhere; }
.day-text.short { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.day-when { flex-shrink: 0; text-align: right; font-size: 13px; line-height: 1.35; white-space: nowrap; }
.day-when strong { display: block; font-size: 20px; font-family: 'Bricolage Grotesque', Figtree, sans-serif; }
button.day-photo { padding: 0; border: 0; background: none; cursor: zoom-in; }

/* Cartes à glisser. */
.swipable { position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.swipe-tag { position: absolute; top: 12px; z-index: 1; padding: 8px 16px; border-radius: 99px; color: var(--ink); font-size: 16px; font-weight: 800; opacity: 0; pointer-events: none; }
.swipe-tag.right { left: 12px; background: #a5e635; }
.swipe-tag.left { right: 12px; background: #ffd9df; }

/* Photo en grand. */
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; padding: 16px; border: 0; background: rgba(36, 25, 61, .9); overflow: hidden; }
.viewer[open] { display: grid; place-items: center; }
.viewer::backdrop { background: none; }
.viewer canvas { max-width: 100%; max-height: calc(100dvh - 160px); border-radius: 22px; }
.viewer-close { position: absolute; top: calc(16px + env(safe-area-inset-top)); left: 16px; width: 48px; height: 48px; border: 0; border-radius: 99px; background: var(--card); color: var(--ink); font: 700 20px Figtree, system-ui, sans-serif; cursor: pointer; }

/* Posts publiés. */
.post-row.published > .post-date { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; line-height: 1.3; white-space: nowrap; }
.post-date strong { font: 800 20px 'Bricolage Grotesque', Figtree, sans-serif; }
.post-row.published > .figures { flex: 0 0 47%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.figures > span { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.figures svg { width: 22px; height: 22px; }
@media (prefers-reduced-motion: reduce) { .day-post.pop { animation: none; } }

/* Pages publiques : confidentialité et suppression. */
.legal h2 { margin: 12px 0 0; }
.legal ul, .legal ol { margin: 0; padding-left: 20px; }
.legal li { margin-bottom: 8px; overflow-wrap: anywhere; }
.legal a { color: var(--accent); font-weight: 600; }
.legal mark { background: var(--sun); padding: 0 4px; border-radius: 6px; }

/* Titre d'un onglet et ses actions en icônes. */
.title-bar { display: flex; align-items: flex-end; gap: 4px; }
.title-bar > div { flex: 1; min-width: 0; }
.icon-btn { position: relative; width: 48px; height: 48px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; margin: 0; padding: 0; border: 0; border-radius: 99px; background: none; color: var(--accent); cursor: pointer; }
.icon-btn svg { width: 34px; height: 34px; stroke-width: 1.8; }
.icon-btn.busy { opacity: .4; }
label.icon-btn:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }
.pills { display: flex; gap: 8px; }
.pills .pill:last-child { margin-left: auto; }
.option { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 0 16px; border-radius: 20px; background: var(--card); font-weight: 700; }

/* Tirer la page vers le bas pour l'actualiser : notre geste remplace celui du navigateur. */
html, body { overscroll-behavior-y: contain; }
.pull { position: fixed; top: env(safe-area-inset-top); left: 50%; z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.pull-round { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 99px; background: var(--card); color: var(--accent); box-shadow: 0 2px 10px rgba(36, 25, 61, .25); }
.pull-round svg { width: 22px; height: 22px; }
.pull.ready .pull-round { background: var(--accent); color: #fff; }
.pull.spinning .pull-round svg { animation: turn .8s linear infinite; }
.pull-label { padding: 2px 10px; border-radius: 99px; background: var(--card); color: var(--soft); font-size: 13px; font-weight: 600; white-space: nowrap; }
@keyframes turn { to { transform: rotate(360deg); } }

.push-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.push-test { width: auto; justify-content: flex-start; padding: 0; margin-top: 6px; }
.push p:empty { display: none; }
.push p { margin-top: 8px; }
.switch:disabled { opacity: .4; cursor: default; }

/* Fenêtre ouverte : la page derrière ne défile plus. */
html:has(dialog[open]), html:has(dialog[open]) body { overflow: hidden; }
.sheet { overscroll-behavior: contain; }
/* La poignée : « tire-moi vers le bas ». */
.sheet::before { content: ''; display: block; width: 44px; height: 5px; margin: -6px auto 12px; border-radius: 99px; background: #c9c3dc; }
