/**
 * 3-Post Hero Layout — Frontend Styles
 *
 * All classes use the `tphl-` prefix to ensure complete isolation:
 * - No conflict with theme/plugin CSS
 * - No dependency on WordPress's runtime per-block layout CSS
 * - Plugin renders identically regardless of active theme
 *
 * Extracted and adapted from the source theme's hero section CSS,
 * with every selector renamed to the `tphl-` namespace.
 *
 * @package ThreePostHeroLayout
 */

/* ==========================================================================
   Box-sizing reset (scoped to plugin)
   ========================================================================== */

.tphl-container,
.tphl-container *,
.tphl-container *::before,
.tphl-container *::after {
  box-sizing: border-box;
}

/* ==========================================================================
   Container
   ========================================================================== */

.tphl-container {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  margin-top: 0 !important;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   Track (holds hero + side widget side-by-side on desktop)
   ========================================================================== */

.tphl-track {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  width: 100%;
}

/* ==========================================================================
   Hero Card (large left card)
   ========================================================================== */

.tphl-hero {
  flex: 0 0 58%;
  width: 58%;
  min-width: 0;
  position: relative;
  overflow: hidden;
  border-radius: 0;
}

.tphl-hero-image-link {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  position: relative;
  z-index: 1;
}

.tphl-hero-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 500px;
  object-fit: cover;
  object-position: center;
  filter: brightness(0.5);
}

/* Hero overlay (text positioned over the image) */
.tphl-hero-overlay {
  position: absolute;
  bottom: 80px;
  left: 40px;
  width: 520px;
  max-width: calc(100% - 80px);
  z-index: 2;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.tphl-hero-overlay > * {
  pointer-events: auto;
}

.tphl-hero-title {
  margin: 16px 0 0;
  font-size: 34px;
  line-height: 40px;
  font-weight: 600;
  color: #ffffff;
}

.tphl-hero-title a {
  color: #ffffff;
  text-decoration: none;
}

/* ==========================================================================
   Side Widget (right column, 2 cards stacked)
   ========================================================================== */

.tphl-side {
  flex: 1 1 0;
  min-width: 0;
  align-self: stretch;
  display: flex;
  width: auto;
}

.tphl-side-list {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  width: 100%;
  gap: 0;
}

.tphl-side-card {
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  position: relative;
  overflow: hidden;
  border-radius: 0;
  margin: 0;
  background: #000;
}

.tphl-side-media {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
  margin: 0 !important;
  padding: 0 !important;
}

.tphl-side-thumb {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  text-decoration: none;
  margin: 0 !important;
  padding: 0 !important;
}

/* Strong rules to override lazy-load plugins and HTML width/height attributes. */
.tphl-side-image,
.tphl-side-card .tphl-side-image,
.tphl-side-card img.tphl-side-image {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  filter: brightness(0.5);
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0;
}

/* Side card body (text overlay) */
.tphl-side-body {
  position: absolute;
  bottom: 80px;
  left: 40px;
  width: 520px;
  max-width: calc(100% - 80px);
  z-index: 2;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.tphl-side-body > * {
  pointer-events: auto;
}

.tphl-side-title {
  margin: 16px 0 0;
  font-size: 34px;
  line-height: 40px;
  font-weight: 600;
  color: #ffffff;
  order: 2;
}

.tphl-side-title a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: 2;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Category Badge (used on hero AND side cards)
   ========================================================================== */

.tphl-category,
.tphl-side-category {
  background-color: #3BD55A;
  width: fit-content;
  padding: 6px 14px;
  border-radius: 22px;
  font-size: 16px;
  color: #242429;
  display: flex;
  align-items: center;
  text-transform: capitalize;
}

.tphl-category a {
  color: #242429 !important;
  text-decoration: none;
}

.tphl-side-category {
  color: #ffffff;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: 1;
  text-overflow: ellipsis;
}

.tphl-side-category a {
  text-decoration: none;
  color: #242429 !important;
  font-weight: 400;
  font-size: 16px;
  text-transform: none;
}

/* ==========================================================================
   Meta Row (hero: author + date)
   ========================================================================== */

.tphl-meta-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0;
  margin-top: 16px;
  align-items: center;
}

.tphl-author {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 500;
}

/* Separator dot between author and date on hero */
.tphl-author::after {
  content: "\a0\b7\a0";
  opacity: 1;
  color: #ffffff;
  font-size: 20px;
}

.tphl-date {
  color: #ffffff;
  position: relative;
  padding-left: 30px;
}

.tphl-date a,
.tphl-date time {
  color: #ffffff;
  text-decoration: none;
  font-size: 16px;
}

/* Calendar icon before the date */
.tphl-date::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' d='M5 22q-.825 0-1.412-.587T3 20V6q0-.825.588-1.412T5 4h1V2h2v2h8V2h2v2h1q.825 0 1.413.588T21 6v14q0 .825-.587 1.413T19 22zm0-2h14V10H5zM5 8h14V6H5zm0 0V6zm7 6q-.425 0-.712-.288T11 13t.288-.712T12 12t.713.288T13 13t-.288.713T12 14m-4.712-.288Q7 13.426 7 13t.288-.712T8 12t.713.288T9 13t-.288.713T8 14t-.712-.288M16 14q-.425 0-.712-.288T15 13t.288-.712T16 12t.713.288T17 13t-.288.713T16 14m-4 4q-.425 0-.712-.288T11 17t.288-.712T12 16t.713.288T13 17t-.288.713T12 18m-4.712-.288Q7 17.426 7 17t.288-.712T8 16t.713.288T9 17t-.288.713T8 18t-.712-.288M16 18q-.425 0-.712-.288T15 17t.288-.712T16 16t.713.288T17 17t-.288.713T16 18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   Meta Row (side cards: author + date)
   ========================================================================== */

.tphl-side-meta {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin-top: 16px;
  order: 1;
  color: #ffffff;
}

.tphl-side-author {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 500;
}

.tphl-side-author a {
  color: #ffffff;
  text-decoration: none;
}

/* Separator dot between author and date on side cards (matches hero approach) */
.tphl-side-author::after {
  content: "\a0\b7\a0";
  opacity: 1;
  color: #ffffff;
  font-size: 20px;
}

.tphl-side-date {
  color: #ffffff;
  position: relative;
  padding-left: 30px;
}

.tphl-side-date a,
.tphl-side-date time {
  color: #ffffff;
  text-decoration: none;
  font-size: 16px;
}

/* Calendar icon before the date on side cards */
.tphl-side-date::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' d='M5 22q-.825 0-1.412-.587T3 20V6q0-.825.588-1.412T5 4h1V2h2v2h8V2h2v2h1q.825 0 1.413.588T21 6v14q0 .825-.587 1.413T19 22zm0-2h14V10H5zM5 8h14V6H5zm0 0V6zm7 6q-.425 0-.712-.288T11 13t.288-.712T12 12t.713.288T13 13t-.288.713T12 14m-4.712-.288Q7 13.426 7 13t.288-.712T8 12t.713.288T9 13t-.288.713T8 14t-.712-.288M16 14q-.425 0-.712-.288T15 13t.288-.712T16 12t.713.288T17 13t-.288.713T16 14m-4 4q-.425 0-.712-.288T11 17t.288-.712T12 16t.713.288T13 17t-.288.713T12 18m-4.712-.288Q7 17.426 7 17t.288-.712T8 16t.713.288T9 17t-.288.713T8 18t-.712-.288M16 18q-.425 0-.712-.288T15 17t.288-.712T16 16t.713.288T17 17t-.288.713T16 18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   Hover animation — direct port of source theme's behavior
   ==========================================================================

   Source theme rules (renamed to tphl-*):

   1. ALWAYS-VISIBLE elements that translate on hover only:
      .tphl-category, .tphl-side-category
      Default: translateY(45px)
      Hover:   translateY(6px)

   2. HIDDEN-BY-DEFAULT elements that fade in AND translate on hover:
      .tphl-author (hero author)
      .tphl-date (hero date)
      .tphl-side-meta (side card meta: author + date together)
      Default: opacity: 0, translateY(45px)
      Hover:   opacity: 1, translateY(6px)

   3. STATIC elements (no animation):
      .tphl-hero-title
      .tphl-side-title

   All transitions: 0.3s ease-in-out
   Desktop only (≥787px). Mobile: all elements always visible, no transforms.
   ========================================================================== */

@media (min-width: 787px) {
  /* Default state: categories pushed down but visible (opacity stays default). */
  .tphl-hero .tphl-category,
  .tphl-side-card .tphl-side-category {
    transform: translateY(45px);
    transition: all 0.3s ease-in-out;
    letter-spacing: normal;
    position: relative;
  }

  /* Default state: author + date hidden AND pushed down. */
  .tphl-hero .tphl-author,
  .tphl-hero .tphl-date,
  .tphl-side-card .tphl-side-meta {
    opacity: 0;
    position: relative;
  }

  .tphl-hero .tphl-author,
  .tphl-hero .tphl-date,
  .tphl-side-card .tphl-side-meta {
    transform: translateY(45px);
    transition: all 0.3s ease-in-out;
    letter-spacing: normal;
  }

  /* Hover: all five elements slide up to translateY(6px). */
  .tphl-hero:hover .tphl-category,
  .tphl-hero:hover .tphl-author,
  .tphl-hero:hover .tphl-date,
  .tphl-side-card:hover .tphl-side-category,
  .tphl-side-card:hover .tphl-side-meta {
    transform: translateY(6px);
  }

  /* Hover: the subset that was opacity-hidden fades in. */
  .tphl-hero:hover .tphl-author,
  .tphl-hero:hover .tphl-date,
  .tphl-side-card:hover .tphl-side-meta {
    opacity: 1;
  }
}

/* ==========================================================================
   Line-clamp utilities (plugin-scoped)
   ========================================================================== */

.tphl-clamp-1 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: 1;
  text-overflow: ellipsis;
}

.tphl-clamp-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: 2;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Empty state (no posts selected/found)
   ========================================================================== */

.tphl-empty {
  padding: 40px 20px;
  text-align: center;
  border: 1px dashed #d0d0d0;
  border-radius: 12px;
  background: #fafafa;
  color: #757575;
  font-size: 14px;
}

/* ==========================================================================
   Desktop (≥1024px) — match the original theme's full-viewport-height hero
   ========================================================================== */

@media (min-width: 1024px) {
  .tphl-container {
    min-height: calc(100dvh - 80px);
  }

  .tphl-track {
    height: calc(100dvh - 80px);
  }

  .tphl-hero,
  .tphl-side {
    height: 100%;
  }

  .tphl-hero-image {
    min-height: 0;
    height: 100%;
  }

  .tphl-side-card {
    height: 50%;
  }
}

/* ==========================================================================
   Mobile (≤786px) — horizontal scroll carousel
   ========================================================================== */

@media (max-width: 786px) {
  .tphl-container {
    padding: 16px;
  }

  .tphl-track {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: stretch;
    height: auto;
  }

  .tphl-hero,
  .tphl-side-card {
    border-radius: 20px;
    overflow: hidden;
    min-width: 320px;
    width: 320px;
    height: 400px;
    flex: 0 0 auto;
  }

  .tphl-hero-image,
  .tphl-side-image {
    min-height: 0;
    height: 400px;
    border-radius: 20px;
  }

  .tphl-side {
    flex: 0 0 auto;
    height: 400px;
    width: auto;
  }

  .tphl-side-list {
    flex-direction: row;
    gap: 10px;
    height: 400px;
    width: auto;
  }

  .tphl-hero-overlay,
  .tphl-side-body {
    bottom: 20px;
    left: 20px;
    width: 280px;
    max-width: calc(100% - 40px);
  }

  .tphl-hero-title,
  .tphl-side-title {
    margin-top: 13px;
    font-size: 24px;
    line-height: 28px;
  }

  .tphl-category,
  .tphl-side-category {
    left: 20px;
    font-size: 16px;
    padding: 6px 14px;
  }

  .tphl-author,
  .tphl-date a,
  .tphl-date time,
  .tphl-side-author,
  .tphl-side-date a,
  .tphl-side-date time {
    font-size: 14px;
  }

  .tphl-date::before,
  .tphl-side-date::after {
    width: 16px;
    height: 16px;
  }
}

/* ==========================================================================
   Accessibility — reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .tphl-hero-image,
  .tphl-side-image {
    transition: none;
  }
}
