/*
 * CookinBreak — pages régimes (/regimes/<slug>) et page des régimes (/regimes/).
 * Balisage : app/views/regime/page.php, regimes/index.php · comportement : static/js/pages/regime.js
 *
 * Une couleur par régime (.rg--<tone>, mêmes teintes que les tuiles de l'accueil) : --rg-ink (texte, icônes), --rg-soft (fonds), --rg-hero (bandeau).
 * Les cartes de recettes sont celles du design system (static/css/ds/recipe-card.css).
 * Règle du site : g-style pose Poppins sur tous les éléments, la police des titres (Unbounded) doit donc être déclarée sur chacun.
 */

.rg {
  --rg-gutter: 24px;
  --rg-ink: var(--ds-primary-text);
  --rg-soft: var(--ds-primary-soft);
  --rg-hero: #eef7f5;
  --rg-deco: #cfe8e3;
  display: block; padding-bottom: clamp(56px, 8vw, 96px); background: var(--ds-bg); color: var(--ds-text);
}
@media (max-width: 599px) { .rg { --rg-gutter: 16px; } }
.rg *, .rg *::before, .rg *::after { box-sizing: border-box; }
.rg a:not(.ds-btn) { color: inherit; }
.rg-wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--rg-gutter); }

/* Couleurs (les tuiles « Autres régimes » portent aussi la classe de leur régime) */
.rg--orange { --rg-ink: #c2410c; --rg-soft: #fff1e6; --rg-hero: #fff5ec; --rg-deco: #ffd9bd; }
.rg--green  { --rg-ink: #15803d; --rg-soft: #e7f7ec; --rg-hero: #f0f9f2; --rg-deco: #c6ebd1; }
.rg--teal   { --rg-ink: #0e7490; --rg-soft: #e0f4f7; --rg-hero: #eef8fa; --rg-deco: #bfe6ee; }
.rg--amber  { --rg-ink: #a16207; --rg-soft: #fdf3dc; --rg-hero: #fdf7e9; --rg-deco: #f6e0a8; }
.rg--blue   { --rg-ink: #1d4ed8; --rg-soft: #e8effd; --rg-hero: #f1f5fe; --rg-deco: #c9d8fb; }
.rg--rose   { --rg-ink: #be185d; --rg-soft: #fde7f1; --rg-hero: #fdf1f6; --rg-deco: #f8c8dc; }
.dark-mode .rg--orange { --rg-ink: #fdba74; --rg-soft: rgba(253, 186, 116, 0.14); --rg-hero: #2a211b; --rg-deco: rgba(253, 186, 116, 0.22); }
.dark-mode .rg--green  { --rg-ink: #86efac; --rg-soft: rgba(134, 239, 172, 0.13); --rg-hero: #1c261f; --rg-deco: rgba(134, 239, 172, 0.2); }
.dark-mode .rg--teal   { --rg-ink: #67e8f9; --rg-soft: rgba(103, 232, 249, 0.13); --rg-hero: #1b2629; --rg-deco: rgba(103, 232, 249, 0.2); }
.dark-mode .rg--amber  { --rg-ink: #fcd34d; --rg-soft: rgba(252, 211, 77, 0.13); --rg-hero: #29251a; --rg-deco: rgba(252, 211, 77, 0.2); }
.dark-mode .rg--blue   { --rg-ink: #93c5fd; --rg-soft: rgba(147, 197, 253, 0.14); --rg-hero: #1c212b; --rg-deco: rgba(147, 197, 253, 0.2); }
.dark-mode .rg--rose   { --rg-ink: #f9a8d4; --rg-soft: rgba(249, 168, 212, 0.14); --rg-hero: #2a1d24; --rg-deco: rgba(249, 168, 212, 0.2); }
.dark-mode .rg:not([class*="rg--"]) { --rg-hero: #1b2422; --rg-deco: rgba(0, 130, 142, 0.25); }

/* ==================================================================
 * Bandeau
 * ================================================================== */
.rgh { position: relative; overflow: hidden; isolation: isolate; background: var(--rg-hero); }
.rgh::before { /* grande forme douce derrière les photos */
  content: ""; position: absolute; z-index: -1; right: -12%; top: -30%; width: min(62vw, 760px); aspect-ratio: 1;
  border-radius: 46% 54% 42% 58% / 55% 43% 57% 45%; background: var(--rg-deco); opacity: 0.55; pointer-events: none;
}
.rgh__inner {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; align-items: center;
  max-width: 1200px; margin: 0 auto; padding: clamp(24px, 4.5vw, 60px) var(--rg-gutter) clamp(32px, 4.5vw, 56px);
}
@media (min-width: 960px) {
  .rgh__inner { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 56px; min-height: 480px; }
  .rgh__inner--solo { grid-template-columns: minmax(0, 1fr); min-height: 0; }
}
.rgh__text { min-width: 0; }
.rgh__crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; font-size: 0.82rem; color: var(--ds-text-2); }
.rgh__crumbs a { color: inherit; text-decoration: none; }
.rgh__crumbs a:hover { text-decoration: underline; }
.rgh__crumbs [aria-current] { color: var(--ds-text); font-weight: 600; }
.rgh__crumbs a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.rgh__kicker { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 0.92rem; font-weight: 600; color: var(--rg-ink); }
.rgh__kicker-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 12px;
  background: var(--ds-surface); color: var(--rg-ink); font-size: 1.25rem; box-shadow: var(--ds-shadow-sm);
}
.rgh__title {
  margin: 0 0 18px; font-family: var(--ds-font-display); font-size: clamp(2.1rem, 1.2rem + 3.6vw, 3.8rem);
  font-weight: 600; line-height: 1.06; letter-spacing: -0.02em; color: var(--ds-text); text-wrap: balance;
}
.rgh__title em { display: block; font-family: var(--ds-font-display); font-style: normal; color: var(--rg-ink); }
.rgh__lead { margin: 0 0 22px; max-width: 54ch; font-size: 1.04rem; line-height: 1.65; color: var(--ds-text-2); }
.rgh__facts { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0 0 26px; padding: 0; list-style: none; font-size: 0.9rem; color: var(--ds-text); }
.rgh__facts li { display: inline-flex; align-items: center; gap: 8px; }
.rgh__facts .cb-icon { flex: none; font-size: 1.1em; color: var(--rg-ink); }
.rgh__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.rgh__actions .ds-btn { gap: 8px; }
@media (max-width: 479px) { .rgh__actions .ds-btn { flex: 1 1 100%; justify-content: center; } }

/* Photos : une grande forme organique, deux ronds, la pastille du régime */
.rgh__art { position: relative; min-width: 0; width: 100%; max-width: 520px; height: clamp(240px, 64vw, 440px); margin: 0 auto; }
@media (max-width: 599px) { .rgh__art { max-width: 400px; } }
.rgh__ph { position: absolute; margin: 0; overflow: hidden; background: var(--rg-soft); box-shadow: 0 24px 50px -26px rgba(0, 0, 0, 0.45); }
.rgh__ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rgh__ph--1 { left: 6%; top: 4%; width: 72%; aspect-ratio: 1; border-radius: 44% 56% 48% 52% / 52% 46% 54% 48%; }
.rgh__ph--2 { right: 0; top: 0; width: 34%; aspect-ratio: 1; border-radius: 50%; border: 6px solid var(--rg-hero); }
.rgh__ph--3 { right: 6%; bottom: 2%; width: 40%; aspect-ratio: 1; border-radius: 50%; border: 6px solid var(--rg-hero); }
.rgh__badge {
  position: absolute; left: 0; bottom: 8%; display: inline-flex; align-items: center; justify-content: center; width: 74px; height: 74px;
  border-radius: 24px; background: var(--ds-surface); color: var(--rg-ink); font-size: 2.3rem; box-shadow: var(--ds-shadow-md); transform: rotate(-8deg);
}
@media (max-width: 599px) { .rgh__badge { width: 58px; height: 58px; font-size: 1.8rem; border-radius: 18px; } }

/* ==================================================================
 * Rubriques
 * ================================================================== */
.rgs { margin-top: clamp(52px, 7vw, 88px); scroll-margin-top: 90px; }
.rg-wrap > .rgs:first-child { margin-top: clamp(36px, 5vw, 56px); }
.rgs__head { margin-bottom: var(--ds-space-6); }
.rgs__title {
  margin: 0; font-family: var(--ds-font-display); font-size: clamp(1.4rem, 1.05rem + 1.4vw, 2.05rem); font-weight: 500;
  line-height: 1.15; letter-spacing: -0.01em; color: var(--ds-text); text-wrap: balance;
}
.rgs__lead { margin: 10px 0 0; max-width: 64ch; color: var(--ds-text-2); line-height: 1.6; }
.rg-ad { margin-top: clamp(40px, 5vw, 64px); }

/* ---------- Bon à savoir ---------- */
.rg-tips { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin: 0; padding: 0; list-style: none; }
@media (min-width: 700px) { .rg-tips { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .rg-tips { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.rg-tip { padding: 22px; border-radius: var(--ds-radius-lg); background: var(--rg-soft); }
.rg-tip__icon {
  display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; margin-bottom: 14px;
  border-radius: 15px; background: var(--ds-surface); color: var(--rg-ink); font-size: 1.6rem;
}
.rg-tip__title { margin: 0 0 6px; font-family: var(--ds-font-display); font-size: 1rem; font-weight: 500; line-height: 1.3; color: var(--ds-text); }
.rg-tip__text { margin: 0; color: var(--ds-text-2); font-size: 0.92rem; line-height: 1.6; }

/* ---------- Profil alimentaire ---------- */
.rg-profile {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px 24px; align-items: center;
  margin-top: clamp(52px, 7vw, 88px); padding: clamp(22px, 3vw, 32px); border-radius: var(--ds-radius-lg);
  background: var(--ds-surface); border: 1px solid var(--ds-border); box-shadow: var(--ds-shadow-sm);
}
.rg-profile__icon {
  display: inline-flex; align-items: center; justify-content: center; width: 60px; height: 60px; border-radius: 20px;
  background: var(--rg-soft); color: var(--rg-ink); font-size: 2rem;
}
.rg-profile__title { margin: 0 0 6px; font-family: var(--ds-font-display); font-size: 1.15rem; font-weight: 500; line-height: 1.3; color: var(--ds-text); }
.rg-profile__text { margin: 0; max-width: 62ch; color: var(--ds-text-2); font-size: 0.95rem; line-height: 1.6; }
.rg-profile__btn { gap: 8px; white-space: nowrap; }
@media (max-width: 799px) {
  .rg-profile { grid-template-columns: auto minmax(0, 1fr); }
  .rg-profile__btn { grid-column: 1 / -1; justify-content: center; }
}
@media (max-width: 479px) { .rg-profile__icon { width: 48px; height: 48px; font-size: 1.6rem; border-radius: 16px; } }

/* ---------- Toutes les recettes : filtres ---------- */
.rg-filters { display: flex; flex-direction: column; gap: 12px; margin: -6px 0 24px; }
.rg-filters__group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rg-filters__label { margin-right: 2px; font-size: 0.88rem; font-weight: 600; color: var(--ds-text-2); }
.rg-filter {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 8px 15px; cursor: pointer;
  border: 1px solid var(--ds-border-strong); border-radius: var(--ds-radius-btn); background: var(--ds-surface);
  color: var(--ds-text); font: inherit; font-size: 0.88rem; font-weight: 600;
  transition: background var(--ds-duration) var(--ds-ease), border-color var(--ds-duration) var(--ds-ease), color var(--ds-duration) var(--ds-ease);
}
.rg-filter span { color: var(--ds-text-3); font-weight: 500; }
.rg-filter:hover { border-color: var(--rg-ink); }
.rg-filter.is-on { background: var(--ds-text); border-color: var(--ds-text); color: var(--ds-bg); }
.rg-filter.is-on span { color: inherit; opacity: 0.7; }
.rg-filter--also .cb-icon { color: var(--rg-ink); }
.rg-filter--also.is-on { background: var(--rg-soft); border-color: var(--rg-ink); color: var(--rg-ink); }
.rg-filter:focus-visible { outline: 2px solid var(--rg-ink); outline-offset: 2px; }
.rg-empty { margin: 8px 0 0; padding: 28px; border-radius: var(--ds-radius-lg); background: var(--ds-surface-2); color: var(--ds-text-2); text-align: center; }
.rg-more { margin: 24px 0 0; text-align: center; }
.rg-more .ds-btn { gap: 8px; }
.rgs--all [data-rg-grid] { transition: opacity var(--ds-duration) var(--ds-ease); }
.rgs--all.is-loading [data-rg-grid] { opacity: 0.45; pointer-events: none; }
.rgs--all.is-loading .rg-more .ds-btn { opacity: 0.6; pointer-events: none; }

/* ---------- FAQ ---------- */
.rg-faq { padding: 8px 28px; background: var(--ds-surface); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); }
.rg-faq details { border-top: 1px solid var(--ds-border); }
.rg-faq details:first-child { border-top: 0; }
.rg-faq summary {
  position: relative; padding: 20px 36px 20px 0; cursor: pointer; list-style: none;
  font-weight: 600; font-size: 1rem; line-height: 1.45; color: var(--ds-text);
}
.rg-faq summary::-webkit-details-marker { display: none; }
.rg-faq summary::after {
  content: ""; position: absolute; right: 6px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 2px solid var(--rg-ink); border-bottom: 2px solid var(--rg-ink); transform: rotate(45deg); transition: transform var(--ds-duration) var(--ds-ease);
}
.rg-faq details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.rg-faq summary:focus-visible { outline: 2px solid var(--ds-primary); outline-offset: 2px; border-radius: 6px; }
.rg-faq details p { margin: 0 0 20px; color: var(--ds-text-2); font-size: 0.95rem; line-height: 1.7; }
@media (max-width: 599px) { .rg-faq { padding: 4px 18px; } }

/* ---------- Tuiles des régimes (autres régimes, page des régimes) ---------- */
.rg-diets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
@media (max-width: 959px) { .rg-diets { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 599px) { .rg-diets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rg-diets li { margin: 0; padding: 0; }
.rg .rg-diet {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; height: 100%; padding: 18px;
  background: var(--ds-surface); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md);
  color: var(--ds-text); text-decoration: none; transition: transform 0.25s var(--ds-ease), box-shadow 0.25s var(--ds-ease), border-color 0.25s;
}
.rg .rg-diet:hover { transform: translateY(-3px); box-shadow: var(--ds-shadow-md); border-color: var(--rg-ink); }
.rg .rg-diet:focus-visible { outline: 2px solid var(--rg-ink); outline-offset: 2px; }
.rg-diet__icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-bottom: 8px; border-radius: 14px; background: var(--rg-soft); color: var(--rg-ink); font-size: 1.45rem; }
.rg-diet__name { font-weight: 600; font-size: 1rem; }
.rg-diet__count { font-size: 0.82rem; color: var(--ds-text-3); }

/* ==================================================================
 * Page des régimes (/regimes/)
 * ================================================================== */
.rgx-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2vw, 22px); margin: 0; padding: 0; list-style: none; }
@media (max-width: 959px) { .rgx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 559px) { .rgx-grid { grid-template-columns: minmax(0, 1fr); } }
.rgx-grid li { margin: 0; padding: 0; }
.rg .rgx-card {
  display: flex; flex-direction: column; height: 100%; overflow: hidden; border-radius: var(--ds-radius-lg);
  background: var(--ds-surface); border: 1px solid var(--ds-border); color: var(--ds-text); text-decoration: none;
  transition: transform 0.3s var(--ds-ease), box-shadow 0.3s var(--ds-ease);
}
.rg .rgx-card:hover { transform: translateY(-4px); box-shadow: var(--ds-shadow-lg); }
.rg .rgx-card:focus-visible { outline: 3px solid var(--rg-ink); outline-offset: 3px; }
.rgx-card__img { position: relative; display: block; flex: none; aspect-ratio: 16 / 10; background: var(--rg-soft); border-radius: var(--ds-radius-lg) var(--ds-radius-lg) 0 0; }
.rgx-card__img img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.rgx-card__icon {
  position: absolute; z-index: 1; left: 18px; bottom: -24px; display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px;
  border-radius: 17px; background: var(--ds-surface); color: var(--rg-ink); font-size: 1.7rem; box-shadow: var(--ds-shadow-md);
}
.rgx-card__body { display: flex; flex-direction: column; gap: 6px; flex: 1; padding: 36px 22px 22px; }
.rgx-card__name { margin: 0; font-family: var(--ds-font-display); font-size: 1.2rem; font-weight: 500; line-height: 1.25; color: var(--ds-text); }
.rgx-card__tagline { margin: 0; font-size: 0.92rem; font-weight: 600; color: var(--rg-ink); }
.rgx-card__text { margin: 0; color: var(--ds-text-2); font-size: 0.92rem; line-height: 1.55; }
.rgx-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 12px; font-size: 0.88rem; color: var(--ds-text-3); }
.rgx-card__foot .cb-icon { color: var(--rg-ink); font-size: 1.1rem; transition: transform 0.25s var(--ds-ease); }
.rg .rgx-card:hover .rgx-card__foot .cb-icon { transform: translateX(4px); }

/* Mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  .rg .rg-diet, .rg .rgx-card, .rgx-card__foot .cb-icon, .rg-filter, .rg-faq summary::after { transition: none; }
  .rg .rg-diet:hover, .rg .rgx-card:hover { transform: none; }
}
