/* Allergen chart as a data table (lib/allergen-table.php) */

.mp-allergen {
  border: 0;
  margin-bottom: 2rem;
}

.mp-allergen__table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  color: #605954;
  font-size: 16px;
  line-height: 20px;
}

.mp-allergen__table th,
.mp-allergen__table td {
  position: relative;
  vertical-align: middle;
  text-align: left;
  font-weight: 400;
}

/* Header row */
.mp-allergen__head {
  border-bottom: 8px solid #605954;
  padding: 0;
  vertical-align: bottom !important;
}

.mp-allergen__head--title,
.mp-allergen__head--ingredients {
  background-color: #605954;
  color: #fff;
  font-size: 20px;
  font-weight: 700 !important;
  letter-spacing: 2px;
  line-height: 22px;
  text-transform: uppercase;
  height: 115px;
}

.mp-allergen__head--title {
  width: 19.5%;
  padding: 0 15px 16px !important;
}

.mp-allergen__head--ingredients {
  width: 38.8%;
}

.mp-allergen__head--allergen {
  border-left: 1px solid #605954;
  padding: 0 0 8px !important;
  text-align: center !important;
}

.mp-allergen__head-text {
  display: inline-block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 12px;
  line-height: 15px;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

/* Body rows */
.mp-allergen__table tbody tr {
  border-bottom: 1px solid #605954;
}

.mp-allergen__item {
  padding: 12px 15px;
  font-weight: 700 !important;
}

.mp-allergen__ingredients {
  border-left: 1px solid #605954;
  padding: 12px 15px;
}

.mp-allergen__ingredients p:last-child {
  margin-bottom: 0;
}

.mp-allergen__cell {
  border-left: 1px solid #605954;
  height: 60px;
  padding: 0;
}

.mp-allergen__label {
  display: none;
}

.mp-allergen__cell .contains {
  display: block;
}

.mp-allergen .m-t-2 {
  font-size: 18px;
}

/* Keyboard focus on table cells */
.mp-allergen__table [tabindex="0"]:focus {
  outline: 3px solid #c4122f;
  outline-offset: -3px;
}

.mp-allergen__table [tabindex="0"]:focus:not(:focus-visible) {
  outline: none;
}

/* Desktop: no accordion */
@media (min-width: 768px) {
  .mp-allergen__panel.collapse {
    display: block !important;
    height: auto !important;
  }
}

/* Phones: one card per menu item, allergen boxes in a 4-column grid */
@media (max-width: 767px) {
  .mp-allergen__table,
  .mp-allergen__table tbody,
  .mp-allergen__table tr,
  .mp-allergen__table th,
  .mp-allergen__table td {
    display: block;
  }

  .mp-allergen__table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
  }

  .mp-allergen__table tbody tr {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 0;
    margin: 0 0 24px;
  }

  .mp-allergen__item {
    grid-column: 1 / -1;
    padding: 12px 0 8px;
    border-bottom: 1px solid #605954;
  }

  .mp-allergen__ingredients {
    grid-column: 1 / -1;
    border-left: 0;
    padding: 12px 0 16px;
    font-size: 18px;
    line-height: 24px;
  }

  .mp-allergen__cell {
    height: 96px;
    border: 1px solid #605954;
    margin: 0 -1px -1px 0;
    text-align: center !important;
  }

  .mp-allergen__label {
    display: block;
    padding: 10px 4px 0;
    font-size: 12px;
    line-height: 14px;
    text-transform: uppercase;
  }

  .mp-allergen__cell .contains {
    top: 62%;
  }
}
