/* ===== Mon Humeur — styles ===== */

:root {
  --bg: #FCFAF6;
  --ink: #231F1B;
  --muted: #6F665D;
  --sage: #6B8F71;
  --sage-ink: #4F7556;
  --sage-soft: #E9F0EA;
  --line: #EAE2DA;
  --cell: #F5F1EB;
  --shadow: 0 10px 30px rgba(60, 50, 30, .08);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; min-height: 100dvh; overscroll-behavior-y: none; -webkit-text-size-adjust: 100%; }

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }

button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; user-select: none; -webkit-user-drag: none; }
h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

:focus-visible { outline: 3px solid var(--sage); outline-offset: 2px; }

.eyebrow {
  font-size: 13px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--sage);
}
.eyebrow.muted { color: var(--muted); }

.screen { min-height: 100vh; min-height: 100dvh; }

/* ===== Accueil ===== */

.screen-home {
  padding: calc(30px + var(--safe-t)) 20px calc(28px + var(--safe-b));
  background: linear-gradient(180deg, #EBF1EC 0, var(--bg) 380px);
}
.home-head h1 { font-size: 38px; line-height: 1.05; font-weight: 800; letter-spacing: -.02em; margin: 6px 0; }
.date-line { font-size: 18px; color: var(--muted); }

.today-card {
  display: flex; align-items: center; gap: 18px;
  margin: 26px 0 28px; padding: 16px;
  background: #fff; border-radius: 30px; box-shadow: var(--shadow);
}
.today-art {
  flex: 0 0 92px; height: 92px; border-radius: 26px;
  display: grid; place-items: center; overflow: hidden;
  background: var(--mood-bg, var(--sage-soft)); color: var(--sage);
}
.today-art img { height: calc(80px * var(--z, 1)); max-height: 100%; width: auto; }
.today-art svg { width: 52px; height: 52px; }
.today-text { min-width: 0; }
.today-text .eyebrow { display: block; color: var(--muted); font-size: 12.5px; }
.today-text strong { display: block; margin-top: 4px; font-size: 25px; line-height: 1.15; font-weight: 700; }

.menu { display: grid; gap: 14px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 26px;
}
.menu-icon { flex: 0 0 50px; height: 50px; border-radius: 18px; display: grid; place-items: center; }
.menu-icon svg { width: 28px; height: 28px; }
.menu-icon.is-yellow { --tile-bg: #FFF1BF; background: #FFF1BF; color: #C99A10; }
.menu-icon.is-sage { --tile-bg: var(--sage-soft); background: var(--sage-soft); color: var(--sage); }
.menu-text { flex: 1; min-width: 0; }
.menu-text strong { display: block; font-size: 17px; font-weight: 700; }
.menu-text span { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; line-height: 1.3; }
.menu-chevron { flex: 0 0 20px; height: 20px; }
.menu-chevron svg { width: 20px; height: 20px; }

.moods-section { margin-top: 34px; }
.moods-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 12px 8px; margin-top: 12px; }
.mood-chip { min-width: 0; text-align: center; font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.mood-chip-art {
  display: block; position: relative; overflow: hidden; aspect-ratio: 1 / 1; margin-bottom: 6px;
  background: var(--mood-bg); border-radius: 22px;
}
.mood-chip-art img {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  height: calc(82% * var(--z, 1)); width: auto; max-width: none;
}

/* ===== Barre du haut ===== */

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-t)) 72px 10px 10px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.icon-btn { flex: 0 0 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; }
.icon-btn svg { width: 26px; height: 26px; }
.topbar-text { flex: 1; min-width: 0; }
.topbar-text h1, .topbar-title { font-size: 19px; font-weight: 700; line-height: 1.18; }
.topbar-text p, .topbar-sub { color: var(--muted); font-size: 15px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
  padding: 9px 14px; border-radius: 999px;
  background: var(--sage-soft); color: var(--sage-ink); font-size: 15px; font-weight: 600;
}
.pill-btn svg { width: 20px; height: 20px; }

/* ===== Choix de l'humeur ===== */

.pick { padding: 26px 20px calc(36px + var(--safe-b)); }
.pick h2 { font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; text-wrap: balance; }
.hint { margin: 10px 0 22px; color: var(--muted); font-size: 18px; }

.mood-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mood-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 7px); }

.mood-card {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 18px 10px 14px; border-radius: 32px;
  background: var(--mood-bg); color: var(--mood-fg);
  font-size: 24px; font-weight: 700; box-shadow: 0 8px 20px rgba(60, 50, 30, .07);
  transition: transform .15s ease, opacity .2s ease;
}
.mood-card img { height: calc(clamp(140px, 22vh, 190px) * var(--z, 1)); width: auto; }
.mood-card:active { transform: scale(.97); }
.mood-card.is-selected { outline: 3px solid var(--mood-fg); outline-offset: -3px; }
.mood-card.is-picked { animation: pop .4s ease; }
.mood-card.is-locked:not(.is-picked) { opacity: .4; pointer-events: none; }
@keyframes pop { 50% { transform: scale(1.06); } }

/* ===== Calendrier : jour ===== */

.screen-cal { padding-bottom: calc(28px + var(--safe-b)); overflow-x: hidden; }

.day-view { padding: 18px 16px 0; text-align: center; }
.badge {
  display: inline-block; margin-bottom: 8px; padding: 7px 16px; border-radius: 999px;
  background: var(--sage); color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}
.weekday { font-size: 20px; color: var(--muted); }
.daynum { margin: 2px 0; font-size: 40px; font-weight: 800; letter-spacing: -.02em; }
.year { margin-bottom: 14px; font-size: 18px; color: var(--muted); }

.day-stage { position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.day-slide, .week-slide, .month-slide { transition: transform .2s ease; }

.day-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 46vh; min-height: min(46dvh, 400px); padding: 22px 64px;
  border-radius: 36px; box-shadow: var(--shadow);
}
.day-card.has-mood { background: var(--mood-bg); color: var(--mood-fg); }
.day-art { height: calc(clamp(180px, 34vh, 330px) * var(--z, 1)); max-height: 40vh; width: auto; }
.day-mood { font-size: 34px; font-weight: 800; }
.day-card.is-empty { background: var(--sage-soft); color: var(--sage); padding-left: 58px; padding-right: 58px; }
.day-card.is-empty svg { width: 64px; height: 64px; }
.day-empty-title { margin-top: 8px; color: var(--ink); font-size: 26px; font-weight: 700; }
.day-empty-text { color: var(--muted); font-size: 16px; text-wrap: balance; }

.fab {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%);
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--sage); box-shadow: 0 6px 18px rgba(60, 50, 30, .16);
}
.fab.prev { left: -2px; }
.fab.next { right: -2px; }
.fab svg { width: 28px; height: 28px; }
.fab:disabled { opacity: .45; box-shadow: none; }

/* ===== Calendrier : mois ===== */

.month-view, .week-view { padding: 14px 12px 0; }
.month-nav { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 16px; }
.month-nav h2 { font-size: 26px; font-weight: 800; }
.round-btn {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: var(--sage-soft); color: var(--sage-ink);
}
.round-btn { flex: 0 0 54px; }
.round-btn svg { width: 26px; height: 26px; }
.round-btn:disabled { opacity: .4; }

.month-stage { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.weekdays, .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekdays span { padding: 4px 0 6px; text-align: center; font-size: 16px; font-weight: 700; color: var(--muted); }

.cell {
  position: relative; overflow: hidden; aspect-ratio: 1 / 1.22; border-radius: 16px;
  background: var(--cell); text-align: left;
}
.cell .num { position: absolute; top: 6px; left: 7px; z-index: 1; font-size: 14px; font-weight: 600; }
.cell img { position: absolute; bottom: 4px; right: 4px; height: calc(64% * var(--z, 1)); max-height: 76%; width: auto; }
.cell.has-mood { background: var(--mood-bg); }
.cell.is-future { background: #FBF8F3; color: #B3AAA0; }
.cell.is-pad { background: var(--cell); opacity: .6; }
.cell.is-today { outline: 2.5px solid var(--sage); outline-offset: -2.5px; }

/* ===== Animations de navigation ===== */

.anim-next .day-slide, .anim-next .week-slide, .anim-next .month-slide { animation: slide-in-right .26s ease both; }
.anim-prev .day-slide, .anim-prev .week-slide, .anim-prev .month-slide { animation: slide-in-left .26s ease both; }
@keyframes slide-in-right { from { transform: translateX(44px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-in-left  { from { transform: translateX(-44px); opacity: 0; } to { transform: none; opacity: 1; } }

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

/* Petits écrans */
@media (max-width: 340px) {
  .home-head h1 { font-size: 32px; }
  .day-card { padding-left: 52px; padding-right: 52px; }
  .mood-card { font-size: 20px; }
}

/* ===== Invitation à installer ===== */

.install-sheet, .update-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: center;
  padding: 0 12px calc(12px + var(--safe-b));
  pointer-events: none;
  transform: translateY(115%);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.install-sheet.is-open, .update-sheet.is-open { transform: none; }

.install-card, .update-card {
  pointer-events: auto; width: 100%; max-width: 496px; padding: 18px 18px 16px;
  background: #fff; border-radius: 28px;
  box-shadow: 0 12px 44px rgba(40, 30, 15, .24), 0 0 0 1px var(--line);
}
.install-head { display: flex; align-items: flex-start; gap: 14px; }
.install-icon { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 14px; }
.install-head h2 { font-size: 20px; font-weight: 800; line-height: 1.2; }
.install-head p { margin-top: 4px; color: var(--muted); font-size: 15px; line-height: 1.4; }

.install-steps { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.install-steps li {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px;
  border-radius: 16px; background: var(--sage-soft);
  font-size: 15.5px; font-weight: 600; line-height: 1.3;
}
.install-steps .n {
  flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--sage-ink); color: #fff; font-size: 14px; font-weight: 700;
}
.install-steps .t { flex: 1; }
.install-steps svg { flex: 0 0 26px; width: 26px; height: 26px; color: var(--sage-ink); }

.install-actions { display: flex; gap: 10px; margin-top: 16px; }
.install-actions button { padding: 14px 16px; border-radius: 999px; font-size: 17px; font-weight: 700; }
.install-primary { flex: 1.5; background: var(--sage-ink); color: #fff; }
.install-secondary { flex: 1; background: var(--sage-soft); color: var(--sage-ink); }
.install-actions button:active { transform: scale(.98); }


/* ===== Menu burger ===== */

.menu-btn {
  position: fixed; z-index: 30;
  top: calc(10px + var(--safe-t));
  right: max(14px, calc((100vw - 520px) / 2 + 14px));
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--sage-soft); color: var(--sage-ink);
  box-shadow: 0 2px 10px rgba(60, 50, 30, .14);
}
.menu-btn svg { width: 26px; height: 26px; }

.menu-layer { position: fixed; inset: 0; z-index: 100; visibility: hidden; transition: visibility 0s linear .3s; }
.menu-layer.is-open { visibility: visible; transition-delay: 0s; }
.menu-backdrop { position: absolute; inset: 0; background: rgba(35, 31, 27, .42); opacity: 0; transition: opacity .25s ease; }
.menu-layer.is-open .menu-backdrop { opacity: 1; }

.menu-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(84vw, 320px);
  display: flex; flex-direction: column; overflow-y: auto;
  padding: calc(10px + var(--safe-t)) 14px calc(18px + var(--safe-b)) 16px;
  background: var(--bg); box-shadow: -12px 0 40px rgba(40, 30, 15, .2);
  transform: translateX(100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.menu-layer.is-open .menu-panel { transform: none; }

.menu-head { display: flex; align-items: center; justify-content: space-between; min-height: 46px; padding-left: 6px; }
.menu-head strong { font-size: 20px; font-weight: 800; }
.menu-list { display: grid; gap: 6px; margin-top: 14px; }
.menu-link {
  display: flex; align-items: center; gap: 14px; padding: 14px 14px;
  border-radius: 18px; font-size: 18px; font-weight: 600;
}
.menu-link svg { flex: 0 0 26px; width: 26px; height: 26px; color: var(--sage); }
.menu-link.is-active { background: var(--sage-soft); color: var(--sage-ink); font-weight: 700; }
.menu-link:active { background: var(--sage-soft); }
.menu-foot { margin-top: auto; padding: 16px 6px 0; color: var(--muted); font-size: 14px; }

html.menu-open, html.menu-open body { overflow: hidden; }

/* ===== Sélecteur Jour / Semaine / Mois ===== */

.view-switch { display: flex; gap: 4px; margin: 12px 14px 0; padding: 4px; background: var(--sage-soft); border-radius: 999px; }
.seg { flex: 1; padding: 10px 6px; border-radius: 999px; font-size: 16px; font-weight: 600; color: var(--sage-ink); }
.seg.is-active { background: #fff; font-weight: 700; box-shadow: 0 2px 8px rgba(60, 50, 30, .12); }

/* ===== Calendrier : vue semaine ===== */

.week-view { padding: 14px 12px 0; }
.week-view .month-nav h2 { flex: 1; min-width: 0; margin: 0 8px; font-size: 20px; line-height: 1.2; text-align: center; }
.week-stage { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.week-slide { display: grid; gap: 8px; transition: transform .2s ease; }

.week-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 68px;
  padding: 6px 16px 6px 6px; border-radius: 22px; background: var(--cell); text-align: left;
}
.week-row.has-mood { background: var(--mood-bg); color: var(--mood-fg); }
.week-row.is-today { outline: 2.5px solid var(--sage); outline-offset: -2.5px; }
.week-row.is-future { background: #FBF8F3; opacity: .6; }
.week-thumb {
  flex: 0 0 56px; height: 56px; border-radius: 17px; overflow: hidden;
  display: grid; place-items: center; background: rgba(255, 255, 255, .55); color: #B8AFA5;
}
.week-thumb img { width: 100%; height: 100%; object-fit: cover; }
.week-thumb svg { width: 26px; height: 26px; }
.week-day { flex: 1; min-width: 0; color: var(--ink); }
.week-day strong { display: block; font-size: 17px; font-weight: 700; }
.week-day span { display: block; margin-top: 1px; color: var(--muted); font-size: 14px; }
.week-mood { font-size: 19px; font-weight: 800; text-align: right; }
.week-row:not(.has-mood) .week-mood { color: var(--muted); font-size: 15px; font-weight: 600; }

/* ===== Vue jour : bouton de modification ===== */

.edit-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  margin-top: 16px; padding: 15px 18px; border-radius: 999px;
  background: var(--sage-ink); color: #fff; font-size: 17px; font-weight: 700;
}
.edit-btn svg { width: 22px; height: 22px; }
.edit-btn:active { transform: scale(.98); }

/* ===== Page « En savoir plus » ===== */

.prose { padding: 8px 20px calc(36px + var(--safe-b)); }
.prose h1 { margin: 30px 0 10px; font-size: 26px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
.prose h1:first-child { margin-top: 18px; }
.prose p { margin: 0 0 12px; font-size: 17px; line-height: 1.55; }
.prose p.muted { color: var(--muted); }
.prose a { color: var(--sage-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.update-status { margin-top: 12px; padding: 14px 16px; border-radius: 20px; background: var(--sage-soft); }
.update-msg { margin: 0 0 12px; font-size: 16px; line-height: 1.4; }
.update-btn {
  padding: 12px 20px; border-radius: 999px; background: #fff; color: var(--sage-ink);
  font-size: 16px; font-weight: 700; box-shadow: 0 2px 8px rgba(60, 50, 30, .1);
}
.update-btn.is-primary { background: var(--sage-ink); color: #fff; }
.update-btn:disabled { opacity: .55; }
