/*
 * «Пам'ятаємо цього місяця» (page-memorial-month.php).
 */

section.mm {
  padding: 40px 0 50px;
  min-height: 70vh;
}

.mm-head {
  text-align: center;
  margin-bottom: 15px;
}

.mm-eyebrow {
  margin: 0;
  font-size: 13px;
  color: #7d7d7d;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mm-title {
  margin: 0;
  font-size: 34px;
  font-weight: 600;
  line-height: 1.2;
}

/* ---- Перемикач місяців ---- */

.mm-months {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0 0 25px;
}

.mm-months a {
  min-width: 46px;
  padding: 4px 8px;
  border-radius: 5px;
  background: #fff;
  color: #585d61;
  font-size: 14px;
  text-align: center;
  transition: background 0.3s ease, color 0.3s ease;
}

.mm-months a:hover {
  background: #e1eaee;
  color: #000;
}

.mm-months a.is-active {
  background: #ffcc01d4;
  color: #000;
  font-weight: 600;
}

/* ---- Колаж ---- */

.mm-poster {
  --cols: 3;
  --span: var(--span-3);
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  background: #000;
  overflow: hidden;
  container-type: inline-size;
}

@media (min-width: 768px) {
  .mm-poster {
    --cols: 4;
    --span: var(--span-4);
  }
}

@media (min-width: 992px) {
  .mm-poster {
    --cols: 5;
    --span: var(--span-5);
  }
}

.mm-card {
  position: relative;
  display: block;
  aspect-ratio: 222 / 256;
  overflow: hidden;
  background: #111;
  color: #fff;
}

.mm-card:visited,
.mm-card:hover,
.mm-card:focus {
  color: #fff;
}

.mm-card img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center top;
  filter: grayscale(1);
  transition: transform 0.6s ease, filter 0.6s ease;
}

.mm-card:hover img,
.mm-card:focus-visible img {
  transform: scale(1.04);
  filter: grayscale(1) brightness(1.08);
}

.mm-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 6px 7px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.55) 100%);
  color: rgba(255, 255, 255, 0.88);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

@media (min-width: 768px) {
  .mm-name {
    font-size: 13px;
  }
}

/* Роки життя й «назавжди N років» — з'являються над іменем при наведенні */
.mm-name {
  display: flex;
  flex-direction: column;
  transition: padding 0.4s ease, background 0.4s ease;
}

.mm-extra {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(6px);
  transition: grid-template-rows 0.4s ease, opacity 0.4s ease, transform 0.4s ease;
}

.mm-extra > * {
  min-height: 0;
  overflow: hidden;
}

.mm-extra__inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 5px;
}

.mm-years {
  font-size: 0.95em;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.95);
}

.mm-age {
  font-size: 0.85em;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.75);
}

.mm-card:hover .mm-name,
.mm-card:focus-visible .mm-name {
  padding-top: 40px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.75) 100%);
}

.mm-card:hover .mm-extra,
.mm-card:focus-visible .mm-extra {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .mm-name,
  .mm-extra {
    transition: none;
  }
}

.mm-candle {
  position: relative;
  grid-column: span var(--span);
  /* Висота однієї клітинки, навіть коли свічка займає окремий ряд. */
  min-height: calc(100cqw / var(--cols) * 256 / 222);
  background: #000 url("../img/candle.webp") right bottom / cover no-repeat;
}

.mm-caption {
  position: absolute;
  top: 12px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  line-height: 1.2;
}

.mm-caption__site {
  color: rgba(255, 255, 255, 0.35);
  font-size: 10px;
}

/* ---- Дії ---- */

.mm-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 20px 0 10px;
}

.mm-btn {
  padding: 7px 15px;
  border: 0;
  border-radius: 7px;
  background: #04a6ef;
  color: #fff;
  font-size: 14px;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.4s ease;
}

.mm-btn:hover,
.mm-btn:focus-visible {
  background: #006390;
  color: #fff;
}

.mm-btn--light {
  background: #fff;
  color: #31373a;
}

.mm-btn--light:hover,
.mm-btn--light:focus-visible {
  background: #e1eaee;
  color: #000;
}

.mm-btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.mm-share-links {
  display: inline-flex;
  gap: 10px;
  font-size: 13px;
}

.mm-share-links a {
  color: #617d8b;
  border-bottom: 1px dashed #8dacbb;
}

.mm-status {
  flex-basis: 100%;
  min-height: 1.2em;
  text-align: center;
  font-size: 12px;
  color: #10a610;
}

/* ---- Текст для посту ---- */

.mm-text-wrap {
  max-width: 760px;
  margin: 15px auto 0;
  padding: 20px 25px;
  background: #fff;
  border-radius: 10px;
}

.mm-text-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: #7d7d7d;
}

.mm-text {
  white-space: pre-line;
  font-size: 15px;
  line-height: 1.5;
}

.mm-empty {
  max-width: 760px;
  margin: 30px auto;
  padding: 25px;
  background: #fff;
  border-radius: 10px;
  text-align: center;
}

.mm-content {
  max-width: 760px;
  margin: 25px auto 0;
}

@media (max-width: 575.98px) {
  .mm-title {
    font-size: 26px;
  }

  .mm-poster {
    margin: 0 -12px;
  }

  .mm-caption {
    top: 8px;
    left: 8px;
    font-size: 10px;
  }

  .mm-caption__site {
    font-size: 8px;
  }
}
