/* Homepage article flip cards. Colors match assets/css/themes.css tokens. */

#dt_posts .hflip {
  position: relative;
  height: 240px;
  perspective: 1200px;
  cursor: pointer;
  border-radius: 16px;
}

#dt_posts .hflip:focus-visible {
  outline: 3px solid #e4572e;
  outline-offset: 4px;
}

#dt_posts .hflip-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.645, 0.045, 0.355, 1);
}

#dt_posts .hflip.is-flipped .hflip-inner {
  transform: rotateY(180deg);
}

#dt_posts .hflip-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 18px;
  border-radius: 16px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 10px 30px rgba(18, 24, 66, 0.12);
}

#dt_posts .hflip-front {
  background: linear-gradient(160deg, #121842 55%, #e4572e 150%);
  color: #ffffff;
}

#dt_posts .hflip-back {
  background: #ffffff;
  color: #666666;
  border: 1px solid #f2f2f2;
  transform: rotateY(180deg);
}

#dt_posts .hflip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  margin-bottom: 14px;
}

#dt_posts .hflip-tag {
  color: #e4572e;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#dt_posts .hflip-front .hflip-meta time {
  opacity: 0.85;
}

#dt_posts .hflip-title {
  margin: auto 0 0;
  font-family: "Red Hat Display", sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.3;
  color: #ffffff;
}

#dt_posts .hflip-title-back {
  margin: 0 0 10px;
  font-family: "Red Hat Display", sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.3;
  color: #121842;
}

#dt_posts .hflip-excerpt {
  margin: 0 0 auto;
  font-size: 15px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#dt_posts .hflip-read {
  align-self: flex-start;
  margin-top: 16px;
  padding: 12px 20px;
  border-radius: 999px;
  background: #e4572e;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.3s ease;
}

#dt_posts .hflip-read:hover,
#dt_posts .hflip-read:focus-visible {
  background: #121842;
  color: #ffffff;
  outline: none;
}

/* Mouse on a desktop flips on hover; touch flips on the first tap */
@media (hover: hover) and (pointer: fine) {
  #dt_posts .hflip:hover .hflip-inner {
    transform: rotateY(180deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  #dt_posts .hflip-inner {
    transition: none;
  }
}

/* Phones and small screens: show only the first 4 articles */
@media (max-width: 767px) {
  #dt_posts .dt-row.dt-g-4 > *:nth-child(n + 5) {
    display: none;
  }
}
