/*
 * CookinBreak : page Menu du jour (/meal/menus-du-jour). Balisage : app/views/menu/{page,day}.php · comportement : static/js/pages/menu.js
 * ------------------------------------------------------------------
 * Préfixe mj-. Tons chauds (crème, orange doux), grands arrondis, badges en rectangles arrondis (pas de gélules).
 * Les cartes de recettes sont celles du design system (static/css/ds/recipe-card.css).
 * Tout lit les tokens (mode sombre automatique). La feuille globale (g-style) pose `* { font-family: Poppins }` :
 * tout élément en Unbounded, liens compris, déclare sa police.
 */

.mj {
  --mj-gutter: 24px;
  --mj-cream: #fff6ec;
  --mj-cream-2: #ffeedd;
  /* teintes des plats (icône sur fond doux) */
  --mj-green: #2f7a3f;  --mj-green-bg: #e5f4e3;
  --mj-orange: #c2410c; --mj-orange-bg: #ffead9;
  --mj-rose: #be185d;   --mj-rose-bg: #fde7f1;
  --mj-blue: #1d4ed8;   --mj-blue-bg: #e8effd;

  display: block;
  background: var(--ds-bg);
  color: var(--ds-text);
  font-family: var(--ds-font-body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--ds-space-12);
}
.dark-mode .mj {
  --mj-cream: #231c16;
  --mj-cream-2: #2b2119;
  --mj-green: #86efac;  --mj-green-bg: rgba(134, 239, 172, 0.13);
  --mj-orange: #fdba74; --mj-orange-bg: rgba(253, 186, 116, 0.14);
  --mj-rose: #f9a8d4;   --mj-rose-bg: rgba(249, 168, 212, 0.14);
  --mj-blue: #93c5fd;   --mj-blue-bg: rgba(147, 197, 253, 0.14);
}
.mj *, .mj *::before, .mj *::after { box-sizing: border-box; }
.mj :focus-visible { outline: none; box-shadow: var(--ds-focus-ring); }
.mj img { max-width: 100%; }
.mj-wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--mj-gutter); }
@media (max-width: 599px) { .mj { --mj-gutter: 16px; } }

@keyframes mj-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes mj-swap { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }

/* ==================================================================
 * Bandeau : fil d'Ariane et semaine
 * ================================================================== */
.mj-hero {
  padding: 18px 0 28px;
  background: linear-gradient(180deg, var(--mj-cream) 0%, var(--mj-cream-2) 70%, var(--ds-bg) 100%);
}
.mj-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; font-size: 0.82rem; color: var(--ds-text-3); }
.mj-crumbs a { color: inherit; text-decoration: none; }
.mj-crumbs a:hover { text-decoration: underline; }
.mj-crumbs [aria-current] { color: var(--ds-text); font-weight: 600; }

.mj-week { display: flex; align-items: center; gap: 10px; }
.mj-week__arrow {
  display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 44px; height: 44px;
  border-radius: var(--ds-radius-sm); background: var(--ds-surface); color: var(--ds-text); text-decoration: none;
  box-shadow: var(--ds-shadow-sm); transition: transform var(--ds-duration) var(--ds-ease), color var(--ds-duration) var(--ds-ease);
}
.mj-week__arrow:hover { color: var(--ds-accent-text); transform: translateY(-2px); }
.mj-week__arrow.is-off { opacity: 0.35; box-shadow: none; pointer-events: none; }
.mj-week__days {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; flex: 1; min-width: 0; margin: 0; padding: 0; list-style: none;
}
.mj-week__days li { margin: 0; padding: 0; list-style: none; min-width: 0; }

.mj .mj-dayl {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px 10px;
  border-radius: var(--ds-radius-md); background: var(--ds-surface); color: var(--ds-text); text-decoration: none;
  border: 2px solid transparent; box-shadow: var(--ds-shadow-sm);
  transition: transform var(--ds-duration) var(--ds-ease), box-shadow var(--ds-duration) var(--ds-ease), border-color var(--ds-duration) var(--ds-ease), background var(--ds-duration) var(--ds-ease);
}
.mj .mj-dayl:hover { transform: translateY(-3px); box-shadow: var(--ds-shadow-md); }
.mj-dayl__name { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ds-text-3); }
.mj-dayl__num { font-family: var(--ds-font-display); font-size: 1.6rem; font-weight: 600; line-height: 1.15; }
/* repère du thème (feuille, poisson, café, fête…) : toujours la même hauteur pour que les jours restent alignés */
.mj-dayl__mark { display: grid; place-items: center; width: 24px; height: 24px; margin-top: 4px; border-radius: 8px; font-size: 0.95rem; color: var(--ds-text-3); }
.mj-dayl__mark--veggie { background: var(--mj-green-bg); color: var(--mj-green); }
.mj-dayl__mark--poisson { background: var(--mj-blue-bg); color: var(--mj-blue); }
.mj-dayl__mark--weekend { background: var(--mj-rose-bg); color: var(--mj-rose); }
.mj-dayl__mark--fete { background: var(--mj-orange-bg); }
.mj-dayl__emoji { font-size: 0.85rem; line-height: 1; }
.mj .mj-dayl.is-today .mj-dayl__name { color: var(--ds-accent-text); }
.mj .mj-dayl.is-on { border-color: var(--ds-accent); background: var(--ds-accent-soft); box-shadow: 0 10px 24px -12px rgba(242, 107, 75, 0.55); }
.mj .mj-dayl.is-on .mj-dayl__num { color: var(--ds-accent-text); }
.mj .mj-dayl.is-later { opacity: 0.55; box-shadow: none; background: transparent; border: 2px dashed var(--ds-border-strong); }
.mj .mj-dayl.is-none { opacity: 0.6; }

@media (max-width: 719px) {
  .mj-week { gap: 6px; }
  .mj-week__arrow { width: 34px; height: 44px; border-radius: 14px; }
  .mj-week__days { gap: 5px; }
  .mj .mj-dayl { padding: 10px 0 8px; border-radius: 16px; }
  .mj-dayl__name { font-size: 0.62rem; letter-spacing: 0.03em; }
  .mj-dayl__num { font-size: 1.25rem; }
  .mj-dayl__mark { width: 22px; height: 22px; border-radius: 7px; font-size: 0.85rem; }
}
@media (max-width: 380px) {
  .mj-week__arrow { display: none; }
}

/* ==================================================================
 * Le jour : titre, chiffres, actions
 * ================================================================== */
.mj-day { margin-top: 8px; transition: opacity 200ms var(--ds-ease); }
.mj-day.is-loading { opacity: 0.45; pointer-events: none; }
.mj-day.is-entering { animation: mj-in 420ms var(--ds-ease) both; }

.mj-head { padding: 8px 0 26px; }
.mj-theme {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 7px 14px;
  border-radius: var(--ds-radius-badge); background: var(--mj-orange-bg); color: var(--mj-orange);
  font-size: 0.82rem; font-weight: 700;
}
.mj-theme--veggie { background: var(--mj-green-bg); color: var(--mj-green); }
.mj-theme--poisson { background: var(--mj-blue-bg); color: var(--mj-blue); }
.mj-theme--weekend { background: var(--mj-rose-bg); color: var(--mj-rose); }
.mj-theme--event { background: color-mix(in srgb, var(--mj-event) 14%, var(--ds-surface)); color: var(--mj-event); }
.dark-mode .mj-theme--event { color: color-mix(in srgb, var(--mj-event) 60%, #fff); }

.mj-title {
  margin: 0; max-width: 22ch; font-family: var(--ds-font-display); font-size: clamp(1.9rem, 1.2rem + 3vw, 3.2rem); font-weight: 600;
  line-height: 1.08; letter-spacing: -0.015em; color: var(--ds-text); text-wrap: balance;
}
.mj-title em { display: inline; font-family: var(--ds-font-display); font-style: normal; color: var(--ds-accent-text); }
.mj-lead { margin: 14px 0 0; max-width: 60ch; color: var(--ds-text-2); font-size: 1.02rem; line-height: 1.6; }

.mj-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; padding: 0; list-style: none; }
.mj-stats li {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  margin: 0; padding: 12px 18px 12px 14px; list-style: none; border-radius: var(--ds-radius-md);
  background: var(--ds-surface); box-shadow: var(--ds-shadow-sm);
}
.mj-stats .cb-icon {
  grid-row: 1 / 3; box-sizing: border-box; width: 38px; height: 38px; padding: 9px; border-radius: 13px;
  background: var(--ds-accent-soft); color: var(--ds-accent-text);
}
.mj-stats strong { font-family: var(--ds-font-display); font-size: 1.02rem; font-weight: 600; line-height: 1.2; color: var(--ds-text); white-space: nowrap; }
.mj-stats span { font-size: 0.78rem; color: var(--ds-text-3); }

.mj-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.mj .mj-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 20px;
  border: 1px solid var(--ds-border-strong); border-radius: var(--ds-radius-btn); background: var(--ds-surface); color: var(--ds-text);
  font-family: var(--ds-font-body); font-size: 0.95rem; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform var(--ds-duration) var(--ds-ease), background var(--ds-duration) var(--ds-ease), box-shadow var(--ds-duration) var(--ds-ease);
}
.mj .mj-btn:hover { transform: translateY(-2px); box-shadow: var(--ds-shadow-md); }
.mj .mj-btn--primary { border-color: transparent; background: var(--ds-primary); color: var(--ds-on-primary); }
.mj .mj-btn--primary:hover { background: var(--ds-primary-hover); }
.mj-short { display: none; }
@media (max-width: 599px) {
  .mj-stats li { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .mj-actions .mj-btn { flex: 1 1 0; padding: 0 14px; }
  .mj-actions .mj-btn--primary { flex-grow: 1.6; }
  .mj-long { display: none; }
  .mj-short { display: inline; }
}

.mj-profile {
  display: flex; align-items: center; gap: 14px; margin: 18px 0 0; max-width: 560px; padding: 12px 12px 12px 14px;
  border-radius: var(--ds-radius-md); background: var(--mj-green-bg); color: var(--ds-text);
}
.mj-profile__icon {
  display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 14px;
  background: var(--ds-surface); color: var(--mj-green); font-size: 1.35rem;
}
.mj-profile__text { display: grid; flex: 1; gap: 2px; min-width: 0; margin: 0; font-size: 0.88rem; line-height: 1.4; color: var(--ds-text-2); }
.mj-profile__text strong { font-size: 0.95rem; color: var(--ds-text); }
.mj .mj-profile__btn {
  display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: var(--ds-radius-btn);
  background: var(--ds-surface); color: var(--ds-text); font-family: var(--ds-font-body); font-size: 0.88rem; font-weight: 600; text-decoration: none;
  box-shadow: var(--ds-shadow-sm); transition: transform var(--ds-duration) var(--ds-ease), box-shadow var(--ds-duration) var(--ds-ease), color var(--ds-duration) var(--ds-ease);
}
.mj .mj-profile__btn:hover { transform: translateY(-2px); box-shadow: var(--ds-shadow-md); color: var(--ds-accent-text); }
.mj-profile--setup { background: var(--ds-primary-soft); }
.mj-profile--setup .mj-profile__icon { color: var(--ds-primary-text); }
@media (max-width: 479px) {
  .mj-profile { flex-wrap: wrap; }
  .mj-profile__text { flex-basis: calc(100% - 70px); }
  .mj .mj-profile__btn { flex: 1 1 100%; justify-content: center; }
}

/* ==================================================================
 * Les trois plats
 * ================================================================== */
.mj-courses { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--ds-space-6); margin: 0; padding: 0; list-style: none; counter-reset: mj; }
@media (min-width: 720px) { .mj-courses { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--ds-space-5); } }
.mj-course { display: flex; flex-direction: column; gap: 12px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.mj-course__head { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.mj-course__icon {
  display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 14px;
  background: var(--mj-orange-bg); color: var(--mj-orange); font-size: 1.4rem;
}
.mj-course--entree .mj-course__icon { background: var(--mj-green-bg); color: var(--mj-green); }
.mj-course--dessert .mj-course__icon { background: var(--mj-rose-bg); color: var(--mj-rose); }
.mj-course__label { margin: 0; flex: 1; font-family: var(--ds-font-display); font-size: 1.15rem; font-weight: 600; color: var(--ds-text); }

.mj .mj-swap {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-btn); background: var(--ds-surface); color: var(--ds-text-2); cursor: pointer;
  font-family: var(--ds-font-body); font-size: 0.85rem; font-weight: 600; transition: color var(--ds-duration) var(--ds-ease), border-color var(--ds-duration) var(--ds-ease);
}
.mj .mj-swap:hover { color: var(--ds-accent-text); border-color: var(--ds-accent); }
.mj .mj-swap .cb-icon { transition: transform 500ms var(--ds-ease); }
.mj .mj-swap:active .cb-icon { transform: rotate(180deg); }
.mj-swap__count { padding: 2px 7px; border-radius: 8px; background: var(--ds-accent-soft); color: var(--ds-accent-text); font-size: 0.75rem; }

.mj-course__card { min-width: 0; }
.mj-course__card.is-entering { animation: mj-swap 380ms var(--ds-ease) both; }
.mj-course__card .ds-recipe { aspect-ratio: 4 / 5; }
@media (max-width: 719px) { .mj-course__card .ds-recipe { aspect-ratio: 5 / 4; } }
.mj-course__note { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--mj-green); font-size: 0.85rem; font-weight: 600; }

/* Par où commencer */
.mj-plan {
  margin-top: var(--ds-space-6); padding: 20px 24px; border-radius: var(--ds-radius-lg); background: var(--ds-surface); box-shadow: var(--ds-shadow-sm);
}
.mj-plan__title { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-family: var(--ds-font-display); font-size: 1.05rem; font-weight: 600; color: var(--ds-text); }
.mj-plan__title .cb-icon { color: var(--ds-accent-text); }
.mj-plan__steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: mj-step; }
.mj-plan__steps li {
  position: relative; margin: 0; padding-left: 38px; list-style: none; color: var(--ds-text-2); line-height: 1.55; counter-increment: mj-step;
}
.mj-plan__steps li::before {
  content: counter(mj-step); position: absolute; left: 0; top: -1px; display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 9px; background: var(--ds-accent-soft); color: var(--ds-accent-text); font-size: 0.8rem; font-weight: 700;
}

/* Jour sans menu */
.mj-empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 20px; text-align: center;
  border-radius: var(--ds-radius-lg); background: var(--ds-surface); box-shadow: var(--ds-shadow-sm);
}
.mj-empty__icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 22px; background: var(--ds-accent-soft); color: var(--ds-accent-text); font-size: 1.6rem; }
.mj-empty__title { margin: 6px 0 0; font-family: var(--ds-font-display); font-size: 1.25rem; font-weight: 600; color: var(--ds-text); }
.mj-empty__text { margin: 0 0 8px; max-width: 46ch; color: var(--ds-text-2); line-height: 1.6; }

.mj-ad { margin: var(--ds-space-10) 0 0; }

/* ==================================================================
 * Sections du bas
 * ================================================================== */
.mj-section { margin-top: clamp(40px, 6vw, 64px); }
.mj-section__head { margin-bottom: var(--ds-space-5); }
.mj-section__title {
  margin: 0; font-family: var(--ds-font-display); font-size: clamp(1.4rem, 1.05rem + 1.3vw, 2rem); font-weight: 600;
  line-height: 1.15; letter-spacing: -0.01em; color: var(--ds-text); text-wrap: balance;
}
.mj-section__lead { margin: 8px 0 0; max-width: 64ch; color: var(--ds-text-2); line-height: 1.6; }

/* La semaine en un coup d'œil */
.mj-weeklist__days {
  display: grid; gap: 0; margin: 0; padding: 6px 0; list-style: none; border-radius: var(--ds-radius-lg);
  background: var(--ds-surface); box-shadow: var(--ds-shadow-sm); overflow: hidden;
}
.mj-wl {
  display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 8px 24px; align-items: start;
  margin: 0; padding: 16px 24px; list-style: none; border-top: 1px solid var(--ds-border); transition: background var(--ds-duration) var(--ds-ease);
}
.mj-wl:first-child { border-top: 0; }
.mj-wl.is-on { background: var(--mj-cream); }
.mj .mj-wl__day { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; color: var(--ds-text); text-decoration: none; }
.mj-wl__date { font-family: var(--ds-font-display); font-size: 0.98rem; font-weight: 600; }
.mj .mj-wl__day:hover .mj-wl__date { color: var(--ds-accent-text); }
.mj-wl__tag { padding: 3px 9px; border-radius: 8px; background: var(--ds-accent); color: var(--ds-on-accent); font-size: 0.72rem; font-weight: 700; }
.mj-wl__tag--soft { background: var(--ds-surface-2); color: var(--ds-text-2); }
.mj-wl__dishes { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.mj-wl__dishes li { display: flex; align-items: baseline; gap: 10px; margin: 0; padding: 0; list-style: none; min-width: 0; }
.mj-wl__type { flex: 0 0 64px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--mj-orange); }
.mj-wl__type--entree { color: var(--mj-green); }
.mj-wl__type--dessert { color: var(--mj-rose); }
.mj .mj-wl__dishes a { min-width: 0; color: var(--ds-text); text-decoration: none; line-height: 1.4; }
.mj .mj-wl__dishes a:hover { color: var(--ds-primary-text); text-decoration: underline; }
.mj-wl__none { margin: 0; color: var(--ds-text-3); font-size: 0.9rem; }
@media (max-width: 599px) {
  .mj-wl { grid-template-columns: minmax(0, 1fr); padding: 14px 18px; }
  .mj .mj-wl__day { flex-direction: row; align-items: center; flex-wrap: wrap; }
}

/* Comment on compose le menu */
.mj-how__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--ds-space-4); margin: 0; padding: 0; list-style: none; }
@media (min-width: 640px) { .mj-how__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .mj-how__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mj-how__item {
  display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 22px; list-style: none;
  border-radius: var(--ds-radius-lg); background: var(--ds-surface); box-shadow: var(--ds-shadow-sm);
}
.mj-how__item strong { font-family: var(--ds-font-display); font-size: 1rem; font-weight: 600; color: var(--ds-text); }
.mj-how__item > span:last-child { color: var(--ds-text-2); font-size: 0.92rem; line-height: 1.55; }
.mj-how__icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 4px; border-radius: 15px; font-size: 1.5rem; }
.mj-how__icon--green { background: var(--mj-green-bg); color: var(--mj-green); }
.mj-how__icon--orange { background: var(--mj-orange-bg); color: var(--mj-orange); }
.mj-how__icon--blue { background: var(--mj-blue-bg); color: var(--mj-blue); }
.mj-how__icon--rose { background: var(--mj-rose-bg); color: var(--mj-rose); }

.mj-cta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; margin-top: var(--ds-space-5); padding: 22px 24px;
  border-radius: var(--ds-radius-lg); background: linear-gradient(135deg, var(--mj-cream) 0%, var(--ds-accent-soft) 100%);
}
.mj-cta__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 18px; background: var(--ds-surface); color: var(--ds-accent-text); font-size: 1.7rem; }
.mj-cta__text { display: flex; flex: 1 1 320px; flex-direction: column; gap: 4px; min-width: 0; }
.mj-cta__text strong { font-family: var(--ds-font-display); font-size: 1.05rem; font-weight: 600; color: var(--ds-text); }
.mj-cta__text span { color: var(--ds-text-2); line-height: 1.55; }

@media (prefers-reduced-motion: reduce) {
  .mj-day.is-entering, .mj-course__card.is-entering { animation: none; }
  .mj .mj-dayl, .mj .mj-btn, .mj-week__arrow { transition: none; }
  .mj .mj-dayl:hover, .mj .mj-btn:hover, .mj-week__arrow:hover { transform: none; }
}
