/* ================================================================
   PORTFOLIO POSTS SHORTCODE — portfolio-posts.css  v4.0
   Structural CSS dùng class .pps-wrapper
   CSS variables động inject qua wp_add_inline_style() trong PHP
   ================================================================ */

/* ----------------------------------------------------------------
   WRAPPER — nhận variables từ #pps-N { ... } do PHP inject
   ---------------------------------------------------------------- */
.pps-wrapper {
  /* Fallback values */
  --pps-accent: var(--e-global-color-primary);
  --pps-card-bg: #f0f4e4;
  --pps-text: #2d3520;
  --pps-muted: #28552775;
  --pps-radius: 18px;
  --pps-gap: 20px;
  --pps-thumb-w: 45%;

  box-sizing: border-box;
}

/* ================================================================
   GRID
   ================================================================ */
.pps-wrapper .pps-grid {
  display: grid;
  grid-template-columns: 42% 1fr;
  gap: var(--pps-gap);
}

/* ================================================================
   Style text
   ================================================================ */
.pps-wrapper .pps-hero-title,
.pps-wrapper .pps-hero-label,
.pps-wrapper .pps-card-title {
  font-family: var(--e-global-typography-primary-font-family);
  font-size: clamp(1.125rem, 1.8vw, 1.75rem);
  font-weight: 500;
  color: var(--e-global-color-primary);
  line-height: 1.25;
}

.pps-wrapper .pps-hero-label,
.pps-wrapper .pps-card-tags {
  font-family: var(--e-global-typography-secondary-font-family);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--pps-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pps-wrapper .pps-hero-title {
  margin: 0 0 5px;
}

.pps-wrapper .pps-card-title {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pps-wrapper .pps-card-excerpt,
.pps-wrapper .pps-hero-excerpt{
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: auto;
}

/* ================================================================
   CỘT 1 — HERO
   ================================================================ */
.pps-wrapper .pps-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: space-between;
}

.pps-wrapper .pps-hero-thumb {
  border-radius: var(--pps-radius);
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
}
.pps-wrapper .pps-hero-thumb a {
  display: block;
  width: 100%;
  height: 100%;
}
.pps-wrapper .pps-hero-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}
.pps-wrapper .pps-hero-thumb:hover img {
  transform: scale(1.04);
}

.pps-wrapper .pps-hero-info {
  padding: 0 4px;
}

.pps-wrapper .pps-hero-title a {
  text-decoration: none;
}
.pps-wrapper .pps-hero-title a:hover {
  color: var(--pps-accent);
}

/* ================================================================
   CỘT 2 — WRAPPER (chứa list + see more)
   ================================================================ */
.pps-wrapper .pps-col2-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ================================================================
   CỘT 2 — DANH SÁCH CARD
   ================================================================ */
.pps-wrapper .pps-list {
  display: flex;
  flex-direction: column;
  gap: var(--pps-gap);
  flex: 1;
}

/* ---- Single card ---- */
.pps-wrapper .pps-card {
  border: 2px solid var(--pps-accent);
  border-radius: var(--pps-radius);
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr var(--pps-thumb-w);
  gap: 8px;
  text-decoration: none;
  color: inherit;
  transition:
    box-shadow 0.25s,
    transform 0.25s;
}
.pps-wrapper .pps-card:hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.pps-wrapper .pps-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  justify-content: space-between;
}

.pps-wrapper .pps-card-thumb {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
}
.pps-wrapper .pps-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.pps-wrapper .pps-card:hover .pps-card-thumb img {
  transform: scale(1.07);
}

/* ================================================================
   SEE MORE — dưới cột 2, align right
   ================================================================ */
.pps-wrapper .pps-see-more-wrap {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
  grid-area: 2 / 2;
}
.pps-wrapper .pps-see-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pps-accent);
  text-decoration: none;
  padding: 7px 18px;
  border: 2px solid var(--pps-accent);
  border-radius: 20px;
  transition:
    background 0.2s,
    color 0.2s;
}
.pps-wrapper .pps-see-more:hover {
  background: var(--pps-accent);
  color: #fff;
}
.pps-wrapper .pps-see-more svg {
  flex-shrink: 0;
  transition: transform 0.2s;
}
.pps-wrapper .pps-see-more:hover svg {
  transform: translateX(3px);
}

/* ================================================================
   LAYOUT MODIFIERS
   ================================================================ */

/* ---- SOLO: 1 bài, hero full width ---- */
.pps-layout--solo .pps-grid {
  grid-template-columns: 1fr;
}
.pps-layout--solo .pps-hero-thumb {
  aspect-ratio: 16 / 6;
  max-height: 400px;
}
.pps-layout--solo .pps-col2-wrap {
  display: none;
}

/* ---- DUO: 2 bài (hero + 1 card) — chiều cao tự nhiên, thấp hơn ---- */
.pps-layout--duo .pps-grid {
  align-items: start; /* không stretch, giữ chiều cao tự nhiên */
}
.pps-layout--duo .pps-hero-thumb {
  aspect-ratio: 4 / 3;
  max-height: 280px; /* thấp hơn layout split */
}
.pps-layout--duo .pps-hero {
  height: auto;
}
.pps-layout--duo .pps-col2-wrap {
  height: auto;
}

/* ---- SPLIT: 3-4 bài — equal height 2 cột ---- */
.pps-layout--split .pps-grid {
  align-items: stretch;
}
.pps-layout--split .pps-hero {
  height: 100%;
}
.pps-layout--split .pps-hero-thumb {
  flex: 1;
}
.pps-layout--split .pps-col2-wrap {
  height: 100%;
}
.pps-layout--split .pps-list {
  justify-content: space-between;
}
.pps-layout--split .pps-card {
  flex: 1;
  min-height: 0;
}

/* ================================================================
   RESPONSIVE — TABLET ≤ 900px: cột 2 xuống dưới cột 1
   ================================================================ */
@media (max-width: 900px) {
  .pps-wrapper .pps-grid,
  .pps-layout--split .pps-grid {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .pps-layout--split .pps-hero {
    height: auto;
  }
  .pps-layout--split .pps-col2-wrap {
    height: auto;
  }
  .pps-layout--split .pps-hero-thumb {
    flex: none;
    aspect-ratio: 16 / 9;
    max-height: none;
  }
  .pps-layout--split .pps-list {
    justify-content: flex-start;
  }
  .pps-layout--split .pps-card {
    flex: none;
  }
  .pps-layout--duo .pps-hero-thumb {
    aspect-ratio: 16 / 9;
    max-height: none;
  }
  .pps-wrapper .pps-see-more-wrap {
    grid-area: 3/1;
  }
}

/* ================================================================
   RESPONSIVE — MOBILE ≤ 540px
   ================================================================ */
@media (max-width: 540px) {
  .pps-wrapper .pps-hero-thumb {
    aspect-ratio: 3 / 2 !important;
  }

  .pps-wrapper .pps-card {
    grid-template-columns: 1fr 38%;
    padding: 12px 14px;
  }
  .pps-wrapper .pps-card-excerpt {
    -webkit-line-clamp: 2;
  }
  .pps-wrapper .pps-card-thumb {
    aspect-ratio: 1 / 1;
  }
}
