/* Halfpix v1.2.18 — one popup design for Home posts and Discover details.
   Loaded after social-v1217.css. The Discover popup copies the post popup frame from
   post-modal-v127.css: same size, edge-to-edge media on the left, white panel on the right. */

/* Shared action bar: icon / label / count rows are fixed, so a button without a count
   (Copy link) lines up with the others. */
.content-actions button {
  display: grid;
  grid-template-rows: 22px 20px 16px;
  justify-items: center;
  align-content: center;
  gap: 2px;
  padding-inline: 0;
}
.content-actions button > :is(svg, .app-icon) {
  align-self: center;
}
.content-actions button > span {
  align-self: center;
  line-height: 20px;
  white-space: nowrap;
}
.content-actions button > strong {
  align-self: center;
  line-height: 16px;
}

/* Post technical / making details use Discover's fact grid (same markup). */
.post-facts.post-facts {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.post-facts > header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ui-primary, #276b60);
}
.post-facts > header h2 {
  margin: 0;
  color: var(--ui-ink, #22332e);
  font-family: var(--hp-font-sans, inherit);
  font-size: 15px;
  font-weight: 700;
}
.post-facts > header :is(svg, .app-icon) {
  width: 18px;
  height: 18px;
}
.post-facts .discover-detail__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--ui-line, #d8e4df);
  border-radius: 16px;
  background: var(--ui-line, #d8e4df);
}
.post-facts .discover-detail__facts > div {
  display: block;
  padding: 11px 14px;
  border: 0;
  border-radius: 0;
  background: #fff;
}
.post-facts .discover-detail__facts > div.is-wide {
  grid-column: 1 / -1;
}
.post-facts .discover-detail__facts > div:last-child:nth-child(odd):not(.is-wide) {
  grid-column: auto;
}
.post-facts .discover-detail__facts dt {
  color: var(--ui-faint, #7b8a84);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.post-facts .discover-detail__facts dd {
  margin: 3px 0 0;
  color: var(--ui-ink, #22332e);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
/* Discover: an odd last fact spans the row instead of leaving a grey hole. */
.discover-detail__facts > div:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

@media (max-width: 460px) {
  .content-actions button { font-size: 12px; }
}

/* ---- Discover popup frame (desktop) ---- */
.hp-post-overlay--discover {
  display: block;
  height: calc(100dvh - 28px);
  max-height: calc(100dvh - 28px);
  overflow: hidden;
}
.hp-post-overlay--discover > .hp-post-scroll {
  width: 100%;
  height: 100%;
  max-height: none;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
.hp-post-overlay--discover .discover-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(0, .78fr);
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  margin: 0;
  padding: 0;
  gap: 0;
  align-items: stretch;
  overflow: hidden;
}
.hp-post-overlay--discover .discover-detail__media {
  position: relative;
  top: auto;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #171a18;
}
.hp-post-overlay--discover .discover-detail__media :is(.media-gallery, .media-gallery__track, .media-gallery__slide) {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  border-radius: 0;
}
.hp-post-overlay--discover .discover-detail__media .media-gallery__slide {
  aspect-ratio: auto;
}
.hp-post-overlay--discover .discover-detail__media :is(.media-gallery__open, .media-gallery__video, .hp-detail-media) {
  height: 100%;
  max-height: 100%;
}
.hp-post-overlay--discover .discover-detail__media :is(img, video, .media-image) {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}
.hp-post-overlay--discover .discover-detail__media .media-gallery__track {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-y: none;
  touch-action: pan-x pinch-zoom;
}

/* The panel is the popup's only vertical scroll area, like the post popup's comments. */
.hp-post-overlay--discover .discover-detail__panel {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  margin: 0;
  padding: 26px clamp(18px, 2.2vw, 30px) 28px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  scrollbar-width: none;
}
.hp-post-overlay--discover .discover-detail__panel::-webkit-scrollbar {
  display: none;
}
.hp-post-overlay--discover .discover-detail__panel h1 {
  margin: 12px 0 8px;
  font-size: clamp(25px, 2.7vw, 39px);
  line-height: 1.14;
}
.hp-post-overlay--discover .discover-detail__panel > p {
  margin: 0 0 10px;
  line-height: 1.52;
}
/* Same action bar geometry as the post popup. */
.hp-post-overlay--discover .discover-detail__actions {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 12px 0 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--ui-line, #d8e4df);
}
.hp-post-overlay--discover .discover-detail__actions button {
  min-height: 45px;
}
/* Discover (page and popup): product buttons sit under Related products as a normal row,
   so the comment box is the only thing pinned to the bottom. Two bottom-sticky bars
   overlapped each other. */
.discover-detail .discover-related .sticky-commerce-actions {
  position: static;
  margin-top: 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.hp-post-overlay--discover .hp-comments .comments-section__dock {
  bottom: 0;
  padding: 10px 3px 12px;
  background: linear-gradient(to bottom, rgb(255 255 255 / 0), #fff 12px);
}
.hp-post-overlay--discover .discover-detail__panel {
  padding-bottom: 0;
}

/* Standalone Discover page also has five actions now. */
.discover-detail .discover-detail__actions {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

/* Short displays */
@media (max-height: 720px) and (min-width: 701px) {
  .hp-post-overlay--discover .discover-detail__panel { padding-top: 14px; }
  .hp-post-overlay--discover .discover-detail__panel h1 { font-size: clamp(22px, 2.3vw, 30px); }
  .hp-post-overlay--discover .discover-detail__panel > p { font-size: 13px; }
}

/* ---- Phone: full-screen popup, image on top, panel scrolls with it ---- */
@media (max-width: 700px) {
  .hp-post-overlay--discover {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
  .hp-post-overlay--discover > .hp-post-scroll {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .hp-post-overlay--discover .discover-detail {
    display: block;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .hp-post-overlay--discover .discover-detail__media {
    height: min(62dvh, 125vw);
  }
  .hp-post-overlay--discover .discover-detail__panel {
    height: auto;
    max-height: none;
    padding: 16px 16px 0;
    overflow: visible;
  }
  .hp-post-overlay--discover .discover-detail__panel h1 {
    font-size: clamp(22px, 6vw, 28px);
  }
  .hp-post-overlay--discover .discover-detail__actions button {
    min-height: 40px;
    font-size: 12px;
  }
  .hp-post-overlay :is(.post-panel__fixed .content-actions, .discover-detail__actions) button {
    grid-template-rows: 18px 15px 14px;
    gap: 1px;
  }
  .hp-post-overlay :is(.post-panel__fixed .content-actions, .discover-detail__actions) button > span {
    line-height: 15px;
  }
  .hp-post-overlay :is(.post-panel__fixed .content-actions, .discover-detail__actions) button > strong {
    line-height: 14px;
  }
  .hp-post-overlay--discover .hp-post-close {
    top: 12px;
    left: 12px;
    width: 38px;
    height: 38px;
  }
}
