/*
 * CookinBreak — ce qui est propre aux pages catégories (/cuisine/categories/<slug>, /patisserie/categories/<slug>…) :
 * recette signature, guide pratique, encart Breaky AI, en-tête des catégories voisines.
 * Le reste (bandeau, rubriques, conseils, filtres, FAQ, tuiles, couleurs .rg--<tone>) vient de static/css/pages/regime.css.
 * Balisage : app/views/category/page.php. Préfixe : ct-.
 * 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.
 */

/* ---------- Avertissement (pages avec alcool : loi Évin) ---------- */
.ct-notice {
  display: flex; align-items: flex-start; gap: 10px; max-width: 60ch; margin: 0 0 24px; padding: 12px 16px;
  border-radius: var(--ds-radius-sm); background: var(--ds-surface); border: 1px solid var(--rg-deco);
  color: var(--ds-text-2); font-size: 0.88rem; line-height: 1.55;
}
.ct-notice .cb-icon { flex: none; margin-top: 3px; color: var(--rg-ink); }
.ct-notice strong { color: var(--ds-text); }

/* ---------- Page famille : tuiles des catégories ---------- */
.ct-kids__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1099px) { .ct-kids__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 959px) { .ct-kids__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 479px) { .ct-kids__grid { gap: 12px; } .ct-kids__grid .rgx-card__body { padding: 32px 14px 14px; } .ct-kids__grid .rgx-card__name { font-size: 1rem; } .ct-kids__grid .rgx-card__tagline { display: none; } }

/* ---------- Rubriques : lien « Voir les N recettes », carrousel sur téléphone et tablette ---------- */
.ct-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 24px; }
.ct a.ct-head__more {
  display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 4px 0;
  font-weight: 600; font-size: 0.95rem; color: var(--rg-ink); text-decoration: none; white-space: nowrap;
}
.ct a.ct-head__more .cb-icon { transition: transform 0.25s var(--ds-ease); }
.ct a.ct-head__more:hover .cb-icon { transform: translateX(3px); }
.ct a.ct-head__more:focus-visible { outline: 2px solid var(--rg-ink); outline-offset: 3px; border-radius: 6px; }
@media (max-width: 959px) {
  .ct .ct-rail {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 44%; gap: 14px;
    margin: 0 calc(var(--rg-gutter) * -1); padding: 4px var(--rg-gutter) 10px; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-padding: 0 var(--rg-gutter); scrollbar-width: none;
  }
  .ct .ct-rail::-webkit-scrollbar { display: none; }
  .ct .ct-rail > .ds-recipe { scroll-snap-align: start; }
}
@media (max-width: 599px) {
  .ct .ct-rail { grid-auto-columns: 78%; }
  .ct .ct-rail > .ds-recipe { aspect-ratio: 4 / 5; }
}

/* ---------- Recette signature ---------- */
.ct-sig {
  display: grid; grid-template-columns: minmax(0, 1fr); overflow: hidden;
  margin-top: clamp(52px, 7vw, 88px); border-radius: var(--ds-radius-lg);
  background: var(--rg-hero); border: 1px solid var(--rg-deco);
}
@media (min-width: 900px) { .ct-sig { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); } }
.ct .ct-sig__media { position: relative; display: block; min-height: 260px; aspect-ratio: 4 / 3; background: var(--rg-soft); }
@media (min-width: 900px) { .ct .ct-sig__media { aspect-ratio: auto; min-height: 400px; } }
.ct-sig__media img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ds-ease); }
.ct-sig:hover .ct-sig__media img { transform: scale(1.03); }
.ct-sig__body { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: clamp(24px, 4vw, 52px); }
.ct-sig__kicker {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 7px 13px; border-radius: var(--ds-radius-badge);
  background: var(--ds-surface); color: var(--rg-ink); font-size: 0.85rem; font-weight: 600; box-shadow: var(--ds-shadow-sm);
}
.ct-sig__title {
  margin: 0 0 14px; font-family: var(--ds-font-display); font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.3rem); font-weight: 600;
  line-height: 1.12; letter-spacing: -0.015em; color: var(--ds-text); text-wrap: balance;
}
.ct .ct-sig__title a { font-family: inherit; text-decoration: none; }
.ct .ct-sig__title a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.ct-sig__text { margin: 0 0 18px; max-width: 52ch; color: var(--ds-text-2); line-height: 1.7; }
.ct-sig__meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 24px; padding: 0; list-style: none; font-size: 0.9rem; font-weight: 600; color: var(--ds-text); }
.ct-sig__meta li { display: inline-flex; align-items: center; gap: 7px; }
.ct-sig__meta .cb-icon { color: var(--rg-ink); font-size: 1.1em; }
.ct-sig__btn { gap: 8px; }
@media (max-width: 479px) { .ct-sig__btn { width: 100%; justify-content: center; } }

/* ---------- Guide pratique (quantités, cuissons…) ---------- */
.ct-guide__box { overflow: hidden; border-radius: var(--ds-radius-lg); background: var(--ds-surface); border: 1px solid var(--ds-border); }
.ct-guide__table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.ct-guide__table thead th {
  padding: 16px 22px; background: var(--rg-soft); color: var(--rg-ink); text-align: left;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.ct-guide__table tbody tr + tr > * { border-top: 1px solid var(--ds-border); }
.ct-guide__table tbody th, .ct-guide__table td { padding: 15px 22px; text-align: left; vertical-align: top; line-height: 1.5; }
.ct-guide__table tbody th { font-weight: 600; color: var(--ds-text); }
.ct-guide__value { white-space: nowrap; font-weight: 700; color: var(--rg-ink); }
.ct-guide__note { color: var(--ds-text-2); }
.ct-guide__foot {
  display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 16px 22px;
  border-top: 1px solid var(--ds-border); background: var(--ds-surface-2); color: var(--ds-text-2); font-size: 0.92rem; line-height: 1.6;
}
.ct-guide__foot .cb-icon { flex: none; margin-top: 3px; color: var(--rg-ink); }
/* Sur téléphone, chaque ligne devient une petite fiche : libellé, puis valeur et précision */
@media (max-width: 639px) {
  .ct-guide__table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ct-guide__table, .ct-guide__table tbody, .ct-guide__table tr { display: block; }
  .ct-guide__table tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 14px 18px; }
  .ct-guide__table tbody tr + tr { border-top: 1px solid var(--ds-border); }
  .ct-guide__table tbody tr + tr > * { border-top: 0; }
  .ct-guide__table tbody th, .ct-guide__table td { display: block; padding: 0; }
  .ct-guide__table tbody th { grid-column: 1 / -1; }
  .ct-guide__note { font-size: 0.88rem; }
  .ct-guide__foot { padding: 14px 18px; }
}

/* ---------- Breaky AI ---------- */
.ct-ai {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px 26px; align-items: center;
  margin-top: clamp(52px, 7vw, 88px); padding: clamp(24px, 3.4vw, 36px); border-radius: var(--ds-radius-lg);
  background: #2b211c; color: #fff; /* brun chaud, le même dans les deux thèmes */
}
.dark-mode .ct-ai { background: #2f2520; border: 1px solid rgba(255, 255, 255, 0.08); }
.ct-ai::before { /* halo de la couleur de la page */
  content: ""; position: absolute; z-index: -1; right: -80px; top: -120px; width: 340px; height: 340px; border-radius: 50%;
  background: var(--rg-ink); opacity: 0.35; filter: blur(60px); pointer-events: none;
}
.ct-ai__icon {
  display: inline-flex; align-items: center; justify-content: center; width: 60px; height: 60px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 2rem;
}
.ct-ai__title { margin: 0 0 6px; font-family: var(--ds-font-display); font-size: 1.2rem; font-weight: 500; line-height: 1.3; color: inherit; }
.ct-ai__text { margin: 0 0 12px; max-width: 64ch; font-size: 0.95rem; line-height: 1.6; opacity: 0.82; }
.ct-ai__prompt { display: inline-flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 0.9rem; font-style: italic; opacity: 0.92; }
.ct-ai__prompt .cb-icon { flex: none; margin-top: 3px; font-style: normal; }
.ct-ai__btn { gap: 8px; white-space: nowrap; }
@media (max-width: 799px) {
  .ct-ai { grid-template-columns: auto minmax(0, 1fr); }
  .ct-ai__btn { grid-column: 1 / -1; justify-content: center; }
}
@media (max-width: 479px) { .ct-ai__icon { width: 48px; height: 48px; font-size: 1.6rem; border-radius: 16px; } }

/* ---------- Catégories voisines ---------- */
.ct-others__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 20px; }
.ct a.ct-others__all { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--rg-ink); text-decoration: none; }
.ct a.ct-others__all:hover { text-decoration: underline; }
.ct-cats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1099px) { .ct-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 599px) { .ct-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (prefers-reduced-motion: reduce) {
  .ct-sig__media img { transition: none; }
  .ct-sig:hover .ct-sig__media img { transform: none; }
}
