/**
 * Tutorials ([tutorials]): a featured video with the product pages' click-to-
 * play treatment, then a grid of thumbnails with the listing's caption style
 * and the shop's text filters.
 */

.mm-tutorials {
  --mm-ink: var(--wp--preset--color--mm-hero, #3a3e35);
  --mm-label: #a5a096;
  --mm-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z'/%3E%3C/svg%3E");
  width: 100%;
}

/* --- Featured ------------------------------------------------------- */
.mm-tut-featured { margin-bottom: clamp(48px, 7vh, 84px); }
.mm-tutorials--featured .mm-tut-featured { margin-bottom: 0; }           /* on its own: the page sets the spacing */
.mm-tut-featured__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--wp--preset--color--mm-ink, #26251d);
}
.mm-tut-featured__poster,
.mm-tut-featured__player,
.mm-tut-featured__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.mm-tut-featured__poster { object-fit: cover; }
.mm-tut-featured__player { z-index: 2; }
.mm-tut-featured__cover {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}
.mm-tut-featured__play {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
}
.mm-tut-featured__play::after {
  content: "";
  width: 0;
  height: 0;
  margin-left: 5px;
  border-left: 16px solid var(--mm-ink);
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
}
.mm-tut-featured.is-started .mm-tut-featured__cover,
.mm-tut-featured.is-started .mm-tut-featured__poster { opacity: 0; visibility: hidden; pointer-events: none; }
/* Caption under the frame, like the tiles */
.mm-tut-featured__under { padding-top: 16px; }
.mm-tut-featured__row { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; }
.mm-tut-featured__title { margin: 0; font-size: clamp(20px, 1.8vw, 26px); font-weight: 300; line-height: 1.2; color: var(--mm-ink); }

/* In a column (a Spectra container that ends with the featured video) it sits
   at the bottom, level with whatever is beside it. */
.wp-block-spectra-container:has(> .mm-tutorials--featured:last-child) {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* --- Head: heading + filters ---------------------------------------- */
.mm-tutorials__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 40px;
  flex-wrap: wrap;
  margin-bottom: clamp(24px, 4vh, 32px);
}
.mm-tutorials__heading { margin: 0; font-size: 48px; font-weight: 200; line-height: 1.05; letter-spacing: -0.005em; color: var(--mm-ink); }
.mm-tutorials__filters { display: flex; gap: 22px; flex-wrap: wrap; padding-bottom: 10px; }
.mm-tutorials__filter {
  padding: 0 0 5px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: none;
  font-family: var(--mm-font);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--mm-label);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.mm-tutorials__filter:hover,
.mm-tutorials__filter:focus-visible { color: var(--mm-ink); }
.mm-tutorials__filter.is-active { color: var(--mm-ink); border-bottom-color: var(--mm-ink); }

/* --- Grid ----------------------------------------------------------- */
.mm-tutorials__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(28px, 4vh, 44px) 18px;
}
.mm-tut { position: relative; }
.mm-tut[hidden] { display: none; }
.mm-tut__media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--wp--preset--color--mm-greige, #eae9e5);
  cursor: pointer;
}
.mm-tut__img {
  position: absolute;
  inset: 0;
  background: center / cover no-repeat;
  transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.mm-tut:hover .mm-tut__img,
.mm-tut:focus-within .mm-tut__img { transform: scale(1.045); }
.mm-tut__media iframe { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; border: 0; }
.mm-tut.is-playing .mm-tut__media { cursor: default; }
.mm-tut.is-playing .mm-tut__img,
.mm-tut.is-playing .mm-tut__duration { visibility: hidden; }
.mm-tut__duration {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 8px;
  background: rgba(38, 37, 29, 0.78);
  color: #fff;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}
.mm-tut__title { margin: 14px 0 6px; font-size: 16px; font-weight: 400; line-height: 1.3; }
/* Template tutorials: the thumbnail already says what it is - title for screen readers only */
.mm-tut--template .mm-tut__title { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mm-tut--template .mm-tut__meta { margin-top: 12px; }
.mm-tut__title-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--mm-ink);
  text-align: left;
  cursor: pointer;
  transition: color 0.2s ease;
}
.mm-tut__title-btn:hover,
.mm-tut__title-btn:focus-visible { color: var(--wp--preset--color--mm-clay, #bc8c78); }
.mm-tut__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.mm-tut__cat { color: var(--mm-label); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-tut__template {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--wp--preset--color--mm-clay, #bc8c78);
  text-decoration: none !important;
}
.mm-tut__arrow { width: 11px; height: 11px; background: currentColor; -webkit-mask: var(--mm-arrow) center / contain no-repeat; mask: var(--mm-arrow) center / contain no-repeat; transition: transform 0.3s ease; }
.mm-tut__template:hover .mm-tut__arrow { transform: translateX(4px); }

/* --- Tablet / phone ------------------------------------------------- */
@media (max-width: 1023px) { .mm-tutorials__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599px) {
  .mm-tutorials__grid { grid-template-columns: 1fr; }
  .mm-tutorials__heading { font-size: clamp(32px, 9vw, 40px); }
  .mm-tut-featured__title { font-size: 20px; }
}
