/*
  https://evoluteur.github.io/
  (c) 2026 Olivier Giulieri
  Recipe pages: facts chips, ingredients side card, checkable lists
 */

.recipe {
  h1 {
    padding-bottom: 0.4em;
  }
  h2 {
    font-size: 1.4rem;
    margin: 1.4em 0 0.5em;
  }
  img {
    max-width: 100%;
    height: auto;
  }
  .pixShadow > img,
  img.pixShadow {
    margin: 10px 0 20px;
  }
  li {
    margin: 0.35em 0;
  }
}

.recipe-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  margin: 0 0 30px;
  padding: 0;
  > li {
    margin: 0;
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
    background-color: color-mix(in srgb, currentColor 12%, transparent);
    font-size: 0.9em;
    > span:first-child {
      font-weight: 400;
      color: var(--primary-color);
      margin-right: 4px;
    }
  }
}

.recipe-cols {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.recipe-side {
  > div {
    padding: 5px 20px 15px;
  }
  h2:first-child {
    margin-top: 0.7em;
  }
  ul {
    margin: 0;
    padding-left: 22px;
  }
  .yield {
    margin: -0.4em 0 0.6em;
    font-size: 0.85em;
    opacity: 0.85;
  }
}
@media (min-width: 801px) and (min-height: 800px) {
  .recipe-side {
    position: sticky;
    top: 20px;
  }
}
.recipe-main > h2:first-of-type {
  margin-top: 0;
}
.recipe-main > h2:not(:first-of-type) {
  clear: both;
}

/* checkable ingredients and steps (see js/recipe.js) */
.checklist > li {
  cursor: pointer;
  border-radius: 6px;
  transition: opacity 0.2s;
  &:hover {
    background-color: color-mix(in srgb, currentColor 10%, transparent);
  }
  &:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
  }
  &.done {
    opacity: 0.5;
    text-decoration: line-through;
  }
}
ul.checklist {
  list-style: none;
  padding-left: 0 !important;
  > li {
    position: relative;
    padding-left: 28px;
    &::before {
      content: "";
      position: absolute;
      left: 2px;
      top: 0.3em;
      width: 14px;
      height: 14px;
      border: 2px solid currentColor;
      border-radius: 4px;
    }
    &.done::before {
      background-color: currentColor;
    }
  }
}
.checklist-hint {
  font-size: 0.8em;
  opacity: 0.85;
  margin: 0 0 0.6em;
}

@media only screen and (max-width: 800px) {
  .recipe-cols {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
}
@media print {
  .checklist-hint {
    display: none;
  }
  .recipe-cols {
    display: block;
  }
}

/* pictures float beside the steps on wide screens */
@media only screen and (min-width: 1101px) {
  .recipe-pix {
    float: right;
    margin: 0 0 10px 30px;
  }
}

.recipe-gallery {
  clear: both;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0 20px;
}

/* servings dropdown (built by js/recipe.js) */
select.recipe-yield {
  font: inherit;
  font-weight: 400;
  color: inherit;
  padding: 1px 4px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, currentColor 50%, transparent);
  background-color: color-mix(in srgb, currentColor 12%, transparent);
  cursor: pointer;
  > option {
    color: #1a1a1a;
    background-color: white;
  }
}
@media print {
  select.recipe-yield {
    appearance: none;
    border: 0;
    background: none;
    padding: 0;
  }
}
