/*
Theme Name: My Cuisine FSE
Theme URI: https://mycuisine.local
Author: Nicolas
Author URI: https://mycuisine.local
Description: WordPress Full Site Editing theme for the My Cuisine editorial recipe platform. Warm cream background, deep green brand system, orange accents, native recipe CPT and schema.org/Recipe support.
Version: 1.0.0
Requires at least: 6.4
Tested up to: 6.6
Requires PHP: 8.0
License: GPL v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: foodieland
Tags: full-site-editing, block-patterns, food-and-drink, blog, one-column, two-columns, custom-colors, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, wide-blocks, block-styles, editor-style, rtl-language-support
*/

/* --- ARTICLE STYLES --- */

body {
  background-color: #f9f9f9;
}

.toc-sticky {
  position: sticky;
  top: 128px; /* top-32 */
  font-size: 16px;
  background-color: #ffffff;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #dadada;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.02);
}

.toc-sticky h3 {
  font-family: var(--wp--preset--font-family--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}

.toc-sticky a {
  display: block;
  padding: 6px 0;
  color: #848484; /* text-on-surface-variant */
  transition: all .2s ease;
  text-decoration: none;
  font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
}

.toc-sticky a.is-active,
.toc-sticky a:hover {
  color: #000000;
  transform: translateX(4px); /* hover:translate-x-1 */
}

.wp-block-post-content {
  font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
  font-size: 18px;
  line-height: 1.6;
  color: #1b1b1b;
}

.wp-block-post-content h2 {
  font-family: var(--wp--preset--font-family--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 48px;
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.wp-block-post-content blockquote {
  border-left: 4px solid #000000;
  padding: 32px;
  margin: 48px 0;
  background-color: #f3f3f3; /* bg-surface-container-low */
  border-radius: 16px;
}

.wp-block-post-content blockquote p {
  font-family: var(--wp--preset--font-family--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 24px;
  font-weight: 700;
  font-style: italic;
  color: #1b1b1b;
  margin-bottom: 16px;
}

.wp-block-post-content blockquote footer {
  font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
  font-size: 14px;
  font-weight: 600;
  color: #4c4546; /* text-on-surface-variant */
}

/* Author Bio Card at the bottom */
.author-bio-card-wrapper {
  background-color: #eeeeee; /* bg-surface-container */
  padding: 48px 0;
  margin-top: 64px;
  border-top: 1px solid #dadada;
}

.author-bio-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  background: #ffffff;
  padding: 32px;
  border-radius: 16px; /* rounded-2xl */
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.02);
}

@media (min-width: 768px) {
  .author-bio-card {
    flex-direction: row;
    align-items: flex-start;
  }
}

.author-bio-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #f9f9f9;
}

.article-card {
  transition: transform .3s ease, box-shadow .3s ease;
  height: 100%;
}

.article-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.08);
}

/* Specific button style */
.wp-block-button__link, .btn-primary {
  background-color: #000000;
  color: #ffffff;
  border-radius: 999px;
  font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  transition: all .2s;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
}

.wp-block-button__link:hover, .btn-primary:hover {
  background-color: #4c4546;
}

/* ==============================================
   PORTIONS — boutons +/- et compteur
   ============================================== */

.portions-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portions-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #000;
  background: transparent;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portions-btn:hover:not(:disabled) {
  background: #000;
  color: #fff;
}

.portions-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.portions-count {
  font-weight: 700;
  font-size: 18px;
  min-width: 24px;
  text-align: center;
}

/* ==============================================
   BOUTONS D'ACTION (Favoris + Impression)
   ============================================== */

.recipe-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid #e0e0e0;
  background: #fff;
  font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
}

.btn-action:hover {
  border-color: #000;
  transform: translateY(-2px);
}

.btn-action:focus-visible {
  outline: 3px solid #000;
  outline-offset: 3px;
}

/* État actif des favoris */
.btn-favoris.is-favori {
  background: #fff0f0;
  border-color: #e74c3c;
  color: #e74c3c;
}

.btn-favoris-card {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(4px);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s;
}

.btn-favoris-card:hover {
  transform: scale(1.2);
}

/* ==============================================
   WIDGET NOTATION ÉTOILES
   ============================================== */

.rating-widget {
  margin-top: 48px;
  padding: 32px;
  border-radius: 16px;
  background: #f8fafb;
  border: 1px solid #e8e8e8;
}

.rating-widget__title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

.rating-stars {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.star-btn {
  font-size: 32px;
  background: none;
  border: none;
  cursor: pointer;
  color: #ddd;
  transition: color .15s, transform .1s;
  padding: 4px;
  line-height: 1;
}

.star-btn:hover,
.star-btn.is-active {
  color: #f5a623;
  transform: scale(1.15);
}

.star-btn:disabled {
  cursor: default;
  opacity: .6;
}

.star-btn:focus-visible {
  outline: 3px solid #f5a623;
  border-radius: 4px;
}

.rating-widget__summary {
  font-size: 15px;
  color: #555;
  margin: 0;
}

.rating-widget__confirmation {
  margin-top: 8px;
  font-weight: 600;
  color: #2ecc71;
}

/* ==============================================
   VIDÉO INTÉGRÉE — embed responsive
   ============================================== */

.recipe-video {
  margin-top: 48px;
}

.recipe-video__title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}

.recipe-video__wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: 16px;
}

.recipe-video__wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ==============================================
   FILTRES AJAX — catalogue de recettes
   ============================================== */

.recipe-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  padding: 20px 24px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
  margin-bottom: 32px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}

.filter-group--checkboxes {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #7A7A7A;
}

.filter-select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
  font-size: 14px;
  background: #f9f9f9;
  cursor: pointer;
  transition: border-color .15s;
}

.filter-select:focus {
  border-color: #000;
  outline: none;
}

.filter-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
}

.filter-check input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #000;
}

.btn-reset {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #666;
  transition: all .15s;
  align-self: flex-end;
}

.btn-reset:hover {
  border-color: #000;
  color: #000;
}

.results-count {
  font-size: 14px;
  color: #7A7A7A;
  margin-bottom: 24px;
  font-style: italic;
}

/* Skeleton loader */
.recipe-card--skeleton .skeleton-img,
.recipe-card--skeleton .skeleton-line {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}

.recipe-card--skeleton .skeleton-img {
  aspect-ratio: 4/3;
  width: 100%;
  margin-bottom: 12px;
}

.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-line--title { width: 70%; height: 20px; }
.skeleton-line--meta  { width: 50%; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Badges régimes alimentaires */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge--diet {
  background: #e8f5e9;
  color: #2e7d32;
}

/* ==============================================
   @MEDIA PRINT — impression de la fiche recette
   ============================================== */

@media print {
  /* Éléments à masquer */
  header,
  footer,
  .wp-block-template-part[data-slug="header"],
  .wp-block-template-part[data-slug="footer"],
  .wp-block-template-part[data-slug="newsletter-band"],
  nav,
  .recipe-sidebar,
  .recipe-actions,
  .btn-favoris,
  .btn-imprimer,
  .btn-action,
  .rating-widget,
  .wp-block-comments,
  .wp-block-query,  /* recettes similaires */
  .recipe-filters,
  .results-count,
  .sidebar-actions,
  .portions-btn,
  #btn-favoris,
  #btn-imprimer {
    display: none !important;
  }

  /* Mise en page impression */
  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
    line-height: 1.5;
  }

  main,
  .wp-block-group {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* La colonne principale prend toute la largeur */
  .wp-block-columns {
    display: block !important;
  }

  .wp-block-column {
    width: 100% !important;
    flex-basis: 100% !important;
    page-break-inside: avoid;
  }

  /* Image principale — taille raisonnable */
  .wp-block-post-featured-image img {
    max-height: 300px !important;
    object-fit: cover;
    width: 100%;
    border-radius: 0 !important;
    page-break-after: avoid;
  }

  /* Titre */
  h1 { font-size: 24pt !important; margin-bottom: 12pt; }
  h2 { font-size: 16pt !important; margin-top: 24pt; }
  h3 { font-size: 14pt !important; }

  /* Ingrédients : checkboxes visibles */
  .ingredient-list { list-style: none; padding: 0; }
  .ingredient-item { padding: 3pt 0; border-bottom: 1px solid #eee; }
  input[type="checkbox"] { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Étapes */
  .step-list { padding: 0; }
  .step-card { page-break-inside: avoid; margin-bottom: 12pt; }
  .step-card__img { max-width: 200px; }

  /* Nutrition */
  .nutrition-card { page-break-inside: avoid; }

  /* URL en pied de page imprimé */
  .print-footer-url {
    display: block !important;
    margin-top: 24pt;
    padding-top: 12pt;
    border-top: 1px solid #ccc;
    font-size: 9pt;
    color: #555;
    text-align: center;
  }

  /* Masquer les ombres, arrière-plans décoratifs */
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a[href]::after {
    content: none !important; /* Ne pas afficher les URLs des liens */
  }
}
