/* Menu and drinks pages: category bar, item cards and allergen legend. */
.catalogue-page {
  /* Fixed header height; catalogue.js adds the sticky category bar's height. */
  --cat-offset: calc(70px + 8rem);
}
@media (prefers-reduced-motion: no-preference) {
  html:has(.catalogue-page) {
    scroll-behavior: smooth;
  }
}

/* Category bar: every category in one row; scrolls sideways when they do not fit. */
.cat-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  position: sticky;
  top: 70px;
  z-index: 1; /* above the skewed price tags */
  margin-top: 2rem;
  background-color: var(--body-dark-bg);
  box-shadow: var(--body-dark-bg) 0 0 10px;
}
.cat-nav__arrow {
  flex: 0 0 4.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.4rem;
  height: 4.4rem;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--body-dark-color-2nd);

  &:hover:not(:disabled) {
    color: var(--body-dark-color);
  }
  &:disabled {
    opacity: 0.3;
  }
  &:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
  }
  &[hidden] {
    display: none;
  }
}
.cat-nav__track {
  --fade-start: 0px;
  --fade-end: 0px;
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 0.8rem;
  padding-block: 1rem;
  overflow-x: auto;
  /* Let the script honour reduced motion instead of the global smooth rule. */
  scroll-behavior: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--body-dark-bg-3rd) transparent;
  /* Fade a side that has more categories behind it. */
  mask-image: linear-gradient(to right, transparent, #000 var(--fade-start), #000 calc(100% - var(--fade-end)), transparent);

  &.--more-start {
    --fade-start: 4rem;
  }
  &.--more-end {
    --fade-end: 4rem;
  }
}
.cat-nav__item {
  flex: 1 0 auto;
  min-width: 12rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.2rem 2rem;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.05rem;
  text-align: center;
  text-transform: uppercase;
  color: var(--body-dark-color-3rd);
  background-color: var(--body-dark-bg-2nd);
  scroll-snap-align: start;
  transition: background-color 0.3s ease, color 0.3s ease;

  &:hover {
    color: var(--body-dark-color);
    background-color: var(--body-dark-bg-3rd);
    filter: none;
  }
  &.active {
    color: var(--body-dark-bg);
    background-color: var(--body-dark-color);
  }
  &:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
  }
}
.cat-nav__part:not(:first-child) {
  font-weight: 400;
  opacity: 0.8;
}
@media (width < 640px) {
  /* Size to the label so long names do not wrap; the edge fade hints at the rest. */
  .cat-nav__item {
    flex: 0 0 auto;
    min-width: 10rem;
    padding-inline: 1.6rem;
    white-space: nowrap;
  }
}

/* Category sections */
.cat-section {
  scroll-margin-top: var(--cat-offset);
}
.cat-section + .cat-section {
  margin-top: 6rem;
}
.cat-section__heading {
  margin: 3rem 0 2rem;
  font-size: clamp(3rem, 5vw, 5rem);
  color: var(--body-dark-color-3rd);
}
.cat-section__date {
  display: inline-block;
  margin-inline-start: 0.8rem;
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--accent-color);
  white-space: nowrap;
}

/* Items */
.cat-items {
  display: grid;
  gap: 1rem;
}
@media (width > 1024px) {
  .cat-items {
    grid-template-columns: 1fr 1fr;
  }
}
.cat-item {
  padding: 2rem 3rem;
  background-color: #3d3f40;
  border-radius: 12px;
}
.cat-item__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.cat-item__name {
  margin: 0;
  line-height: 1.2;
}
.cat-item__new {
  display: inline-flex;
  padding: 0.1rem 0.6rem;
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.4;
  text-transform: none;
  vertical-align: middle;
  background-color: var(--accent-color-dark);
  border-radius: 5px;
}
.cat-item__numbers {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 0.4rem;
  min-inline-size: max-content;
}
.cat-item__price {
  margin: 0;
  padding: 0.25rem 1.5rem;
  line-height: 1.6;
  color: var(--body-dark-color-2nd);
  background-color: var(--accent-color-dark);
  border-radius: 4px;
  transform: skewX(348deg);

  span {
    display: inline-block;
    transform: skewX(12deg);
  }
}
.cat-item__allergens {
  margin: 0;
  line-height: 1.4;

  a {
    color: var(--body-dark-color-2nd);
  }
  abbr {
    text-decoration: none;
  }
}
.cat-item__description {
  margin: 0.4rem 0 0;
  line-height: 1.5;
  color: var(--body-dark-color);
}
/* A small code in its own column labels each language without drawing the eye. */
.cat-item__description[lang] {
  display: grid;
  grid-template-columns: 2.8rem 1fr;
  align-items: baseline;
}
.cat-item__language {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--body-dark-color-2nd);
}
@media (width < 640px) {
  .cat-item {
    padding: 1.6rem 2rem;
  }
  /* Give long names the full card width; price and allergens follow on one line. */
  .cat-item__header {
    flex-direction: column;
    gap: 1rem;
  }
  .cat-item__numbers {
    flex-direction: row;
    align-items: center;
    gap: 1.2rem;
  }
}

/* Allergen legend */
.cat-allergens {
  margin-top: 4rem;
  padding: 1.5rem 3rem;
  background-color: var(--body-dark-bg-2nd);
  scroll-margin-top: var(--cat-offset);

  summary {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    cursor: pointer;
  }
  abbr {
    text-decoration: none;
  }
}
.cat-allergens__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(26rem, 1fr));
  gap: 0.6rem 3rem;
  margin: 1.5rem 0 0.5rem;
  padding: 0;
  list-style: none;

  li {
    line-height: 1.4;
  }
}
.cat-allergens__number {
  display: inline-block;
  min-width: 2.4rem;
  font-weight: 600;
  color: var(--accent-color);
}
.cat-allergens__other {
  display: block;
  padding-left: 2.8rem;
  color: var(--body-dark-color-3rd);
}
