/* Block "Наші майстри" on the home page (home.php).
   Two views, switched in admin (Майстри → Налаштування): .masters--list and .masters--grid */

.masters {
  background: #0F0F0F;
  color: #FFFFFF;
}
.masters .container {
  padding-top: 100px;
  /* +100px: the phone of the next block (.tell-screen .image, margin-top: -200px) overlaps this block on desktop */
  padding-bottom: 200px;
  position: relative;
}
.masters .container:after {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: url(../img/bg3.png);
  background-size: cover;
  opacity: 0.4;
}
.masters .content {
  position: relative;
  z-index: 2;
}
.masters .heading {
  text-align: center;
}
.masters__wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
  margin-top: 56px;
}
.masters__item {
  display: flex;
  background: #161616;
  border: 1px solid #464242;
}
.masters__photo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #0F0F0F;
}
.masters__photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.masters__photo img.masters__logo {
  width: 50%;
  height: auto;
  object-fit: contain;
  opacity: 0.5;
}
.masters__info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-grow: 1;
  padding: 24px;
}
.masters__name {
  margin-bottom: 6px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
}
.masters__spec {
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}
.masters__text {
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.5;
  color: #D9D9D9;
}
.masters .masters__styles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  list-style: none;
}
.masters__styles li {
  padding: 4px 10px;
  font-size: 13px;
  line-height: 1.4;
  border: 1px solid #763E25;
}
.masters__btn {
  margin-top: auto;
}

/* list: photo on the left, two columns */
.masters--list .masters__item {
  width: calc(50% - 16px);
}
.masters--list .masters__photo {
  width: 38%;
  max-width: 220px;
  min-height: 280px;
}

/* grid: photo on top, three in a row */
.masters--grid .masters__item {
  flex-direction: column;
  width: calc((100% - 64px) / 3);
}
.masters--grid .masters__photo {
  width: 100%;
  aspect-ratio: 3 / 4;
}

@media (max-width: 992px) {
  .masters .container {
    padding-top: 64px;
    padding-bottom: 64px;
  }
  .masters__wrap {
    margin-top: 40px;
  }
  .masters--list .masters__item {
    width: 100%;
  }
  .masters--grid .masters__item {
    width: calc(50% - 16px);
  }
}

@media (max-width: 768px) {
  .masters__wrap {
    gap: 16px;
  }
  .masters__name {
    font-size: 20px;
  }

  /* list on phone: small photo next to name, the rest below full width */
  .masters--list .masters__item {
    display: grid;
    grid-template-columns: 112px 1fr;
    grid-template-rows: auto 1fr;
    column-gap: 16px;
    padding: 16px;
  }
  .masters--list .masters__info {
    display: contents;
  }
  .masters--list .masters__photo {
    grid-row: 1 / span 2;
    width: 112px;
    min-height: 0;
    aspect-ratio: 3 / 4;
  }
  .masters--list .masters__name,
  .masters--list .masters__spec {
    grid-column: 2;
  }
  .masters--list .masters__text,
  .masters--list .masters__styles,
  .masters--list .masters__btn {
    grid-column: 1 / -1;
  }
  .masters--list .masters__text {
    margin-top: 16px;
  }
  .masters--list .masters__btn {
    width: 100%;
    margin-top: 0;
  }

  /* grid on phone: swipe sideways, the next card peeks from the edge */
  .masters--grid .masters__wrap {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 15px;
    margin-left: -15px;
    margin-right: -15px;
    padding: 0 15px 8px;
    scrollbar-width: none;
  }
  .masters--grid .masters__wrap::-webkit-scrollbar {
    display: none;
  }
  .masters--grid .masters__item {
    flex: 0 0 82%;
    width: auto;
    scroll-snap-align: start;
  }
  .masters--grid .masters__btn {
    width: 100%;
  }
}
