/* Site layout: recipe list (column on wide screens, rows on narrow ones) and
   a recipe photo that leaves the start of the recipe visible. */

:root {
  --ricette-accent: #f2c94c;
  --ricette-line: #262931;
  --ricette-soft: #c9c6c0;
  --ricette-muted: #8f8c86;
}

/* The theme's drawer and page index are replaced by the lists below. */
.md-header__button[for="__drawer"] {
  display: none;
}
/* With the drawer gone, the logo is the way back home on every screen. */
.md-header__button.md-logo {
  display: inline-block;
}
.sito-home {
  color: inherit;
  text-decoration: none;
}

/* Recipe list. One <nav> of <details>, no JavaScript: a column on wide
   screens, two scrolling rows (categories, then the open category's recipes)
   on narrow ones. Without CSS it is a plain nested list. */
.ricette-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ricette-nav summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
}
.ricette-nav summary::-webkit-details-marker {
  display: none;
}
.ricette-nav a {
  display: block;
  border-radius: 8px;
  color: var(--ricette-soft);
  text-decoration: none;
}
.ricette-nav a:hover {
  color: var(--md-default-fg-color);
}
.ricette-nav a[aria-current="page"] {
  color: var(--ricette-accent);
  background: rgba(242, 201, 76, 0.12);
  font-weight: 600;
}
.ricette-nav summary:focus-visible,
.ricette-nav a:focus-visible {
  outline: 2px solid var(--ricette-accent);
  outline-offset: 2px;
}

/* Narrow screens: a button at the bottom, in reach of the thumb, opens the
   list as a sheet from the bottom (HTML popover, no JavaScript). Browsers
   without popover load javascripts/popover.js, which does the same and marks
   <html class="ricette-foglio">. With neither, the list comes after the recipe
   and a link at the top leads to it, so the recipe still comes first. */
.ricette-apri,
.ricette-vai {
  display: none;
}
@media screen and (max-width: 59.984em) {
  .ricette-apri {
    align-items: center;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    width: 100%;
    height: 56px;
    height: calc(56px + env(safe-area-inset-bottom));
    padding: 0 20px;
    padding: 0 20px env(safe-area-inset-bottom);
    border: 0;
    border-top: 1px solid #3a3d46;
    background: #1e2027;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.35);
    color: var(--md-default-fg-color);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
  }
  .ricette-apri > [aria-hidden] {
    margin-right: 10px;
    color: var(--ricette-accent);
    font-size: 20px;
  }
  .ricette-dove {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  @supports selector(:popover-open) {
    .ricette-apri {
      display: flex;
    }
    .md-footer-meta {
      padding-bottom: calc(56px + env(safe-area-inset-bottom));
    }
  }
  .ricette-foglio .ricette-apri {
    display: flex;
  }
  .ricette-foglio .md-footer-meta {
    padding-bottom: 56px;
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
  }

  /* Neither popover nor script: list after the recipe, link to it on top. */
  .ricette-nav[popover] {
    order: 1;
    border-top: 1px solid var(--ricette-line);
  }
  .ricette-vai {
    display: block;
    flex: 0 0 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 12px 16px 0;
    color: var(--ricette-soft);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
  }
  .ricette-vai > [aria-hidden] {
    color: var(--ricette-accent);
  }
  .ricette-vai:focus-visible {
    outline: 2px solid var(--ricette-accent);
    outline-offset: 2px;
  }
  @supports selector(:popover-open) {
    .ricette-vai {
      display: none;
    }
  }
  .ricette-foglio .ricette-vai,
  .ricette-foglio .ricette-nav[popover]:not(.ricette-aperta) {
    display: none;
  }
  /* The sheet opened by popover.js (same look as :popover-open below). */
  .ricette-foglio .ricette-nav.ricette-aperta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    max-height: 80vh;
    margin: 0;
    padding: 12px 16px 16px;
    border: 0;
    border-radius: 16px 16px 0 0;
    background: #16181d;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55);
    overflow-y: auto;
  }

  /* On the home page the list is in the page, above the content. */
  .md-main__inner {
    flex-wrap: wrap;
  }
  .ricette-nav {
    box-sizing: border-box;
    flex: 0 0 100%;
    width: 100%;
    padding: 8px 16px;
    color: inherit;
  }
  .ricette-nav:not([popover]) {
    border-bottom: 1px solid var(--ricette-line);
  }
  .ricette-nav:popover-open {
    inset: auto 0 0 0;
    max-width: none;
    max-height: 80vh;
    margin: 0;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 16px 16px 0 0;
    background: #16181d;
    overflow-y: auto;
  }
  .ricette-nav::backdrop {
    background: rgba(0, 0, 0, 0.55);
  }
  .ricette-nav summary {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 12px;
    font-size: 17px;
  }
  .ricette-nav summary > span {
    flex: 1;
  }
  .ricette-nav summary small {
    display: none;
  }
  .ricette-nav summary::after {
    content: "";
    width: 8px;
    height: 8px;
    margin-right: 4px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
  }
  .ricette-nav details[open] > summary {
    color: var(--ricette-accent);
  }
  .ricette-nav details[open] > summary::after {
    transform: rotate(45deg);
  }
  .ricette-nav details > ul {
    padding: 0 0 8px 12px;
  }
  .ricette-nav details > ul a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 16px;
  }
}

@media screen and (min-width: 60em) {
  .ricette-nav {
    display: block;
    inset: auto;
    margin: 0;
    border: 0;
    background: none;
    color: inherit;
    height: auto;
    flex-shrink: 0;
    align-self: flex-start;
    position: sticky;
    top: 2.4rem;
    width: 15rem;
    max-height: calc(100vh - 2.4rem);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 1.2rem 0.6rem 1.2rem 0.8rem;
  }
  /* Same look as the theme's own sidebar: no counts, regular weight. */
  .ricette-nav details > ul {
    padding: 0 0 0 0.6rem;
  }
  .ricette-nav li {
    margin-top: 4px;
  }
  .ricette-nav summary,
  .ricette-nav a {
    padding: 7px 10px;
    font-size: 0.7rem;
    font-weight: 400;
    line-height: 1.3;
    color: var(--md-default-fg-color--light);
  }
  .ricette-nav summary {
    display: flex;
    align-items: center;
  }
  .ricette-nav summary > span {
    flex: 1;
  }
  .ricette-nav summary small {
    display: none;
  }
  .ricette-nav summary::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-right: 4px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.25s;
  }
  .ricette-nav details[open] > summary::after {
    transform: rotate(45deg);
  }
  .ricette-nav summary:hover,
  .ricette-nav a:hover {
    color: var(--md-accent-fg-color);
  }
  .ricette-nav a[aria-current="page"] {
    font-weight: 500;
  }
}

/* Recipe photo: the first image under the title. */
.md-content article:has(#ingredienti) > h1 + p:has(> img:only-child) img {
  display: block;
  border-radius: 12px;
}
@media screen and (min-width: 60em) {
  .md-content article:has(#ingredienti) > h1 + p:has(> img:only-child) {
    float: right;
    width: min(42%, 460px);
    margin: 0 0 1em 2em;
  }
  .md-content article:has(#ingredienti) > h1 + p:has(> img:only-child) img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
  }
  .md-content article:has(#ingredienti) #preparazione {
    clear: both;
  }
}
@media screen and (max-width: 59.984em) {
  .md-content article:has(#ingredienti) > h1 + p:has(> img:only-child) img {
    width: 100%;
    height: min(40vh, 420px);
    object-fit: cover;
    object-position: center 55%;
  }
}

/* While a category slides closed (docs/javascripts/menu.js), its arrow and
   colour already show it closed. */
.ricette-nav summary::after {
  transition: transform 0.25s ease;
}
.ricette-nav details.ricette-chiude > summary {
  color: var(--md-default-fg-color--light);
}
.ricette-nav details.ricette-chiude > summary::after {
  transform: rotate(-45deg);
}
@media (prefers-reduced-motion: reduce) {
  .ricette-nav summary::after {
    transition: none;
  }
}

/* Per-photo crop on narrow screens, where the subject sits high. */
@media screen and (max-width: 59.984em) {
  .md-content
    article:has(#ingredienti)
    > h1
    + p:has(> img:only-child)
    img[src$="margarita.jpeg"] {
    object-position: center 5%;
  }
}

/* Home page, "Chi siamo": a small round portrait beside the text. */
.md-typeset img.chi-siamo {
  float: left;
  width: 112px;
  height: 112px;
  margin: 0.2em 1.2em 1.6em 0;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 3px var(--ricette-line);
}
.md-typeset p:has(> img.chi-siamo) ~ h2 {
  clear: both;
}
/* Home page photo: rounded like the recipe photos. */
.md-typeset img[src$="spritz-home.jpeg"] {
  display: block;
  border-radius: 12px;
}
