
/* Variables */
:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #6b6b6b;
  --line: #111111;
  --card: #f8f8f8;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  --accent: #c74224;
}

body {
  background: #fafafa;
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial,
    sans-serif;
}

/* Conteneur principal */
.recette {
  max-width: 980px;
  margin: 32px auto 64px;
  margin-top: 100px; /* avoid extra gap under fixed navbar */
  padding: 28px 28px 36px;
}

.recette h1 {
  margin: 6px 0 18px;
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  font-family: "Poppins", sans-serif;
}

/* Image de la recette */
.recette img {
  width: 100%;
  height: auto;
  max-height: 420px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  object-fit: cover;
}

.recette-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 12px;
  color: var(--muted);
}
.recette-author i.bx {
  font-size: 1.2rem;
}
.recette-author a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}
.recette-author a:hover {
  text-decoration: underline;
}

/* Titre de section */
.section-title {
  margin: 26px 0 14px;
  margin-top: 2rem;
  font-weight: 700;
  font-family: "Poppins", sans-serif;
}

.section-title::after {
  display: block;
  width: 250px;
  height: 4px;
  margin: 6px 0 0;
  background: var(--line);
  content: "";
}

/* Bloc informations */
.infos {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  align-items: center;
  margin-top: 18px;
}

.info-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.info-label strong {
  display: block;
  font-weight: 700;
}

.info-label span {
  color: var(--muted);
}

i.bx {
  font-size: 2rem;
}

/* Ingrédients */
.ingredients-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 10px;
}

.ingredient-card {
  padding: 10px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  text-align: center;
}

.ingredient-card img,
.ingredient-placeholder {
  width: 56px;
  height: 56px;
  margin: 0 auto 8px;
  background: #eaeaea;
  border-radius: 8px;
  object-fit: cover;
}

.ingredient-name {
  font-weight: 600;
  font-family: "Poppins", sans-serif;
}

.ingredient-qty {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* Ustensiles */
.ustensiles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 10px;
}

.ustensile-card {
  padding: 10px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  text-align: center;
}

.ustensile-card img,
.ustensile-placeholder {
  width: 56px;
  height: 56px;
  margin: 0 auto 8px;
  background: #eaeaea;
  border-radius: 8px;
  object-fit: cover;
}

.ustensile-name {
  font-weight: 600;
  font-family: "Poppins", sans-serif;
}

/* Listes en pilules */
.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 4px;
  padding: 0;
  list-style: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid #9aa3af;
  border-radius: 999px;
  font-size: 0.875rem;
}

.pill-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
}

/* Étapes */
.steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 12px;
}

.step {
  padding: 14px 16px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.step-title {
  margin-bottom: 8px;
  font-weight: 800;
  font-family: "Poppins", sans-serif;
}

.step-subtitle {
  margin-bottom: 6px;
  font-weight: 600;
  font-family: "Poppins", sans-serif;
}

.recette h2,
.recette h3,
.recette h4,
.recette h5,
.recette h6 {
  font-family: "Poppins", sans-serif;
}

.step-text {
  color: var(--muted);
}

/* Commentaires */
.comments {
  display: grid;
  gap: 18px;
  max-height: 360px;
  margin-top: 10px;
  overflow-y: auto;
  padding-right: 6px;
}

.comments::-webkit-scrollbar {
  width: 8px;
}

.comments::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
}

.comments::-webkit-scrollbar-track {
  background: transparent;
}

.comment {
  position: relative;
  display: grid;
  /* By default, use a single column (no avatar) */
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
  padding: 12px 14px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* If an avatar is present, switch to two columns */
.comment:has(.comment-avatar),
.comment.has-avatar {
  grid-template-columns: 56px 1fr;
}

.comment::before {
  display: none;
}

.comment-avatar {
  grid-row: 1 / span 2;
  grid-column: 1 / 2;
  display: block;
  width: 56px;
  height: 56px;
  border: 1px solid #9aa3af;
  border-radius: 50%;
  justify-self: center;
  object-fit: cover;
}

/* Ensure meta and body span the correct column depending on avatar presence */
.comment > .comment-meta,
.comment > .comment-body {
  grid-column: 1 / -1;
}

.comment:has(.comment-avatar) > .comment-meta,
.comment:has(.comment-avatar) > .comment-body,
.comment.has-avatar > .comment-meta,
.comment.has-avatar > .comment-body {
  grid-column: 2 / -1;
}

.comment-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.comment-meta strong {
  font-weight: 700;
}

.comment-meta span {
  color: var(--muted);
  font-size: 0.8125rem;
}

.comment-body {
  color: var(--text);
  line-height: 1.5;
}

.comment-form {
  margin-top: 28px;
  text-align: right;
}

.comment-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  text-align: left;
}

.comment-form textarea {
  display: block;
  width: 100%;
  min-height: 160px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
  border: 2px solid #9aa3af;
  border-radius: 12px;
  font: inherit;
  resize: vertical;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--line);
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.06);
}

.comment-form button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(232, 107, 74, 0.35);
}

.comment-form button:hover {
  background: #a8361c;
}

.comment-form button:active {
  background: #8f2a15;
  transform: translateY(1px);
}

/* Keyboard focus visibility */
.comment-form button:focus-visible {
  outline: 3px solid #111111;
  outline-offset: 3px;
}

@media (max-width: 760px) {
  .comments {
  max-height: 300px;
  }

  .comment {
  grid-template-columns: 1fr;
  }

  .comment::before,
  .comment-avatar {
  width: 48px;
  height: 48px;
  }

  /* Keep two columns on mobile only when avatar exists */
  .comment:has(.comment-avatar),
  .comment.has-avatar {
    grid-template-columns: 48px 1fr;
  }
}

/* Tablet adjustments */
@media (max-width: 900px) {
  .recette {
    padding: 20px 18px 28px;
  }
  .ingredients-grid,
  .ustensiles-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .infos {
    grid-template-columns: 1fr 1fr;
  }
}

/* Phone adjustments */
@media (max-width: 600px) {
  .recette {
    margin: 24px auto 48px;
    margin-top: 0; /* avoid extra gap under fixed navbar (mobile) */
    padding: 16px;
  }

  .recette h1 {
    font-size: 1.5rem;
  }

  .recette img {
    max-height: 280px;
  }

  .infos {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .ingredients-grid,
  .ustensiles-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .section-title {
    margin: 18px 0 10px;
  }

  .step {
    padding: 12px;
  }
}