/* Home page (templates/home_page.html).
   Moved verbatim from the template's inline <style> block. */
/* === Home Page Scoped Styles === */

.last-read-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--clr-accent, var(--clr-gold));
  background: rgba(var(--clr-accent-rgb, var(--clr-gold-rgb)), 0.1);
  border: 1px solid rgba(var(--clr-border-rgb, var(--clr-gold-rgb)), 0.45);
  border-radius: 4px;
  padding: 2px 6px;
  pointer-events: none;
  text-transform: uppercase;
}
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  padding: 10px;
}

/* Card Container */
.post-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  background: var(--aw-blue, var(--clr-surface));
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  color: white;
  position: relative;
  height: 320px; /* consistent card height */
  overflow: hidden;
  transition: transform 0.25s ease;
}

.post-card:hover {
  transform: translateY(-4px);
}

/* Beat .content a:hover specificity from style.css */
.content .post-card:hover {
  background: var(--aw-blue, var(--clr-surface));
  color: white;
  transform: translateY(-4px);
  box-shadow: 0 0 0 2px var(--clr-accent, var(--clr-gold)), 0 8px 20px rgba(0,0,0,0.5);
}

/* === Fixed Thumbnail Area === */
.thumb-box {
  flex: 1; /* take available vertical space */
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 150px; /* fixed height for all thumbnails/logos */
  margin-bottom: 12px;
}

.thumb-box img {
  max-width: 70%;
  max-height: 70%;
  object-fit: contain;
  border-radius: 6px;
}

/* === Title always stays at bottom === */
.post-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

/* === Views counter === */
.post-views-fixed {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* === Likes counter (Bottom Left, same size as view count) === */
.post-likes-fixed {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-size: 0.8rem;
  color: var(--clr-accent, var(--clr-gold));
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--clr-border, var(--clr-gold));
  border-radius: 6px;
  padding: 2px 6px;
  line-height: 1;
  min-width: 36px;
  justify-content: center;
  transition: all 0.25s ease;
}

.post-likes-fixed i {
  color: var(--clr-accent, var(--clr-gold));
  font-size: 0.85rem;
  transition: color 0.25s ease;
}

/* On hover (card turns yellow) → make like counter blue */
.post-card:hover .post-likes-fixed {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--clr-navy);
  color: var(--clr-on-accent, var(--clr-navy));
}

.post-card:hover .post-likes-fixed i {
  color: var(--clr-on-accent, var(--clr-navy));
}

@media (max-width: 900px) {
  .post-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 10px;
  }

  /* Mirror the related-card pattern: flex-start + margin-top:auto on title,
     both stat badges absolutely anchored to the same bottom value */
  .post-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 230px;
    padding-bottom: 48px; /* stats occupy ~28px from bottom; 48px gives 20px clearance */
  }
  .thumb-box {
    height: 120px;
    margin-bottom: 8px;
    flex-shrink: 0;
  }
  .post-card h3 {
    font-size: 0.72rem;
    margin: 0;
    margin-top: auto; /* push title to bottom of available space, above the stat zone */
  }
  .post-likes-fixed {
    position: absolute;
    bottom: 10px;
    left: 10px;
  }
  .post-card .post-views-fixed {
    position: absolute;
    bottom: 10px;
    right: 10px;
  }
}

/* "Latest" marker on the newest posts (top-left; "Last read" uses top-right) */
.latest-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--clr-on-accent, var(--clr-navy));
  background: var(--clr-accent, var(--clr-gold));
  border-radius: 4px;
  padding: 2px 6px;
  pointer-events: none;
}

/* Thumbnails are square; style.css's .post-thumbnail stretched them to full
   width on a black background (the black bars). Show them square instead. */
.post-card .post-thumbnail {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: transparent;
}
@media (max-width: 900px) {
  /* keep the original phone thumbnail size */
  .post-card .post-thumbnail { height: 70%; }
  /* long titles used to overflow the fixed 230px card into the view badge;
     let the card grow instead (cards in a row stay equal height via the grid) */
  /* .content prefix: style.css's `.content a { padding: 10px 13px }` outranks
     .post-card, which had silently cancelled the 48px clearance above */
  .content .post-card { height: auto; min-height: 230px; padding-bottom: 48px; }
}
