/* ===== Events (DM) ===== */

/* post typography: headings in Gunplay */
.dm-post__title,
.dm-post__content h1,
.dm-post__content h2,
.dm-post__content h3,
.dm-post__content h4{
  font-family: "Gunplay", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #1a3365;
}

/* optional: spacing */
.dm-post__content h2{ margin: 22px 0 10px; font-size: 28px; line-height: 1.15; }
.dm-post__content h3{ margin: 18px 0 8px;  font-size: 22px; line-height: 1.2;  }
.dm-post__content h4{ margin: 14px 0 6px;  font-size: 18px; line-height: 1.25; }


/* font */
@font-face{
  font-family: "Gunplay";
  src: url("/wp-content/uploads/design-motion/fonts/17770.TTF") format("truetype");
  font-display: swap;
}

.dm-main.dm-events{
  display: block;            /* перебили глобальный flex у .dm-main */
  max-width: 1920px;
  margin: 0 auto;
  width: 100%;
  padding-top: 24px;
}

.dm-events__wrap{
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* header */
.dm-events__title{
  margin: 0 0 14px;
  text-align: center;
  font-family: "Gunplay", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
  font-size: clamp(28px, 2.6vw, 44px);
  line-height: 1.05;
  color: #1a3365;
}

/* filter */
.dm-events__filter{
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin: 0 0 26px;
  font-family: "Gunplay", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  letter-spacing: 0.02em;
}

.dm-events__filter a{
  text-decoration: none;
  font-weight: 400;
  color: #1a3365;
  border-bottom: 2px solid transparent;
  padding: 6px 3px;
  transform-origin: center bottom;
  transition: transform .15s ease, color .15s ease, border-color .15s ease;
}

.dm-events__filter a:hover{
  transform: scale(1.03);
  color: #14213d;
}

.dm-events__filter a.active{
  border-bottom-color: #1a3365;
}

/* grid */
.dm-events__grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
}

@media (max-width: 1100px){
  .dm-events__grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px){
  .dm-events__grid{ grid-template-columns: 1fr; }
}

/* card */
.dm-card{
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(26,51,101,.06);
}

.dm-card__link{
  display: block;
  color: inherit;
  text-decoration: none;
}

.dm-card__image img{
  width: 100%;
  height: auto;
  display: block;
}

.dm-card__body{
  padding: 16px 16px 18px;
}

.dm-card__meta{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.dm-card__date{
  font-size: 13px;
  opacity: .75;
  white-space: nowrap;
}

.dm-card__author{
  font-size: 13px;
  opacity: .75;
  white-space: nowrap;
}

.dm-card__author b{
  font-weight: 700;
  opacity: .9;
}

.dm-card__title{
  margin: 8px 0 8px;
  font-family: "Gunplay", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
  font-size: 20px;
  line-height: 1.15;
  color: #14213d;
}

.dm-card__excerpt{
  font-size: 14px;
  line-height: 1.55;
  opacity: .9;
}


.dm-card{
  display: flex;
  flex-direction: column;
  min-height: 260px;
}

/* cards: fixed preview height */
.dm-card__image{
  height: 220px;           /* подбери: 180/200/220 */
  overflow: hidden;
  background: #f2f4f8;
}

.dm-card__image img{
  width: 100%;
  height: 100%;
  object-fit: cover;       /* не тянет, а обрезает */
  object-position: center;
  display: block;
}

/* placeholder без картинки */
.dm-card__image--ph{
  background:
    linear-gradient(135deg, rgba(26,51,101,.10), rgba(26,51,101,.03)),
    repeating-linear-gradient(45deg, rgba(26,51,101,.10) 0 10px, rgba(26,51,101,.06) 10px 20px);
}

/* empty */
.dm-events__empty{
  text-align: center;
  margin: 22px 0 0;
  opacity: .75;
}

/* pagination */
.dm-events__pagination{
  text-align: center;
  margin: 26px 0 0;
}

.dm-events__pagination .page-numbers{
  display: inline-block;
  padding: 6px 10px;
  text-decoration: none;
}

/* ===== Critical: override your global "static footer" only for /events/ ===== */
/* ===== force fixed footer on events + single post ===== */
body.dm.dm-events-page footer.dm-footer{
  position: fixed !important;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
}

body.dm.dm-events-page #main.dm-main{
  padding-bottom: 140px !important;
}
@media (max-width: 1400px){
  body.dm.dm-events-page #main.dm-main{ padding-bottom: 110px !important; }
}
@media (max-width: 1024px){
  body.dm.dm-events-page #main.dm-main{ padding-bottom: 96px !important; }
}


/* single post */
.dm-post__meta{
  display: flex;
  justify-content: center;
  gap: 14px;
  font-size: 14px;
  opacity: .75;
  margin: -4px 0 18px;
}

.dm-post__meta b{ font-weight: 700; opacity: .9; }

/* single: ограничиваем превью и центрируем */
.dm-post__thumb{
  max-width: 980px;      /* подбери: 860/980/1100 */
  margin: 0 auto 18px;
}

.dm-post__thumb img{
  width: 40% !important;
  max-width: 40% !important;
  height: auto !important;
  display: block;
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(26,51,101,.06);
  object-fit: cover;
}

/* single: запрет на 100vw/выход за контейнер */
body.dm.dm-events-page .dm-events__wrap{
  max-width: 1200px !important;
  margin: 0 auto !important;
  padding: 0 20px !important;
}

body.dm.dm-events-page .dm-post{
  max-width: 1200px !important;
  margin: 0 auto !important;
}

.dm-post__content{
  font-size: 16px;
  line-height: 1.7;
  color: #14213d;
}

@media (max-width: 700px){
  .dm-post__title{
    margin: 0 0 14px;
    font-size: 32px;
    line-height: 1.08;
    letter-spacing: 0.01em;
    overflow-wrap: normal;
    word-break: normal;
  }

  .dm-post__meta{
    justify-content: flex-start;
    flex-wrap: wrap;
    margin: 0 0 16px;
  }

  .dm-post__thumb{
    margin-bottom: 18px;
  }

  .dm-post__thumb img{
    width: 100% !important;
    max-width: 100% !important;
  }

  .dm-post__content{
    font-size: 15px;
    line-height: 1.65;
  }

  .dm-post__content h2{
    font-size: 24px;
  }
}

/* ===== back button ===== */
.dm-events__back{
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000000;

  height: 64px;
  min-width: 180px;
  padding: 0 24px;

  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;

  font-size: 24px;
  line-height: 1;
  text-decoration: none;
}

@media (max-width: 1023px){
  .dm-events__back{
    top: auto;
    right: auto;

    left: 14px;
    bottom: calc(30px + env(safe-area-inset-bottom));

    height: 69px;
    min-width: 180px;
    padding: 14px 20px;

    border-radius: 16px !important;
    border-width: 2px;

    font-size: 22px;
    line-height: 1;
  }
}

@media (max-width: 1023px) and (orientation: landscape){
  .dm-events__back{
    left: auto;
    right: calc(env(safe-area-inset-right) + 6px);
    bottom: calc(env(safe-area-inset-bottom) + 44px);

    width: 96px;
    height: 32px;
    min-width: 96px;

    padding: 6px 10px;

    font-size: 12px;
    border-radius: 10px !important;
  }
}
