/* v1.2.7 — one vertical scroll area in the post popup only.
   Loaded AFTER forms-v125: avoid touching standalone posts or Discover. */
.hp-post-overlay {
  overscroll-behavior: contain;
}
.hp-post-overlay .hp-post-close {
  top: 16px;
  right: auto;
  left: 16px;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}
.hp-post-overlay .hp-post-close:focus-visible {
  outline: 3px solid #c8e1d8;
  outline-offset: 3px;
}

.hp-post-overlay--post {
  display: block;
  height: calc(100dvh - 28px);
  max-height: calc(100dvh - 28px);
  overflow: hidden;
}
.hp-post-overlay--post > .hp-post-scroll {
  width: 100%;
  height: 100%;
  max-height: none;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
.hp-post-overlay--post .post-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 !important;
  gap: 0 !important;
  align-items: stretch;
  overflow: hidden;
}
.hp-post-overlay--post .post-media-column {
  position: relative;
  top: auto;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 0;
  overscroll-behavior: none;
}
.hp-post-overlay--post .post-media-column > .media-gallery,
.hp-post-overlay--post .post-media-column .media-gallery__track,
.hp-post-overlay--post .post-media-column .media-gallery__slide {
  min-height: 0;
  height: 100%;
  max-height: 100%;
}
.hp-post-overlay--post .post-media-column .media-gallery__slide {
  aspect-ratio: auto;
}
.hp-post-overlay--post .post-media-column :is(.hp-detail-media, .media-gallery__video, .media-gallery__open) {
  height: 100%;
  max-height: 100%;
}
.hp-post-overlay--post .post-media-column :is(img, video, .media-image) {
  max-height: 100%;
  object-fit: contain;
}
/* This is a horizontal carousel, not a vertical scroll container. */
.hp-post-overlay--post .post-media-column .media-gallery__track {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-y: none;
  touch-action: pan-x pinch-zoom;
}
.hp-post-overlay--post .post-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: 0;
  background: #fff;
}
.hp-post-overlay--post .post-panel__fixed {
  flex: 0 1 auto;
  min-height: 0;
  max-height: calc(100% - 136px);
  padding: 26px clamp(18px, 2.2vw, 30px) 10px;
  overflow: hidden;
  border-bottom: 1px solid var(--ui-line, #d8e4df);
}
.hp-post-overlay--post .post-panel__fixed .post-author-header {
  min-height: 56px;
  /* Leave space for the left corner close button in the media column. */
}
.hp-post-overlay--post .post-panel__fixed .post-copy {
  padding: 15px 0 10px;
}
.hp-post-overlay--post .post-panel__fixed .post-copy h1 {
  margin-bottom: 8px;
  font-size: clamp(25px, 2.7vw, 39px);
  line-height: 1.14;
}
.hp-post-overlay--post .post-panel__fixed .post-copy p {
  margin: 0 0 10px;
  line-height: 1.52;
}
.hp-post-overlay--post .post-panel__fixed .content-actions {
  margin: 12px 0 0;
  padding: 7px 0 0;
  border-bottom: 0;
}
.hp-post-overlay--post .post-panel__fixed .content-actions button {
  min-height: 45px;
}
/* The only vertical scrolling surface in the popup. */
.hp-post-overlay--post .post-panel > .post-panel__comments {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 16px clamp(18px, 2.2vw, 30px) 22px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-top: 0;
  scroll-padding-block: 10px 20px;
}
.hp-post-overlay--post .post-panel__comments::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.hp-post-overlay--post .post-panel__comments > h2 { margin-top: 0; }
.hp-post-overlay--post .post-panel__comments:focus { outline: none; }
.hp-post-overlay--post .post-panel__comments:focus-visible {
  outline: 2px solid var(--ui-primary, #276b60);
  outline-offset: -3px;
}
.hp-post-overlay--post .post-panel__comments .comments-section__dock {
  bottom: 0;
  padding-bottom: 4px;
  background: #fff;
}
/* Short displays: keep author, title, and actions visible without
   making the media pane or outer popup independently scrollable. */
@media (max-height: 720px) and (min-width: 701px) {
  .hp-post-overlay--post .post-panel__fixed { padding-top: 14px; padding-bottom: 5px; }
  .hp-post-overlay--post .post-panel__fixed .post-author-header { min-height: 40px; }
  .hp-post-overlay--post .post-panel__fixed .avatar--lg { width: 40px; height: 40px; }
  .hp-post-overlay--post .post-panel__fixed .post-copy { padding: 8px 0 5px; }
  .hp-post-overlay--post .post-panel__fixed .post-copy h1 { font-size: clamp(22px, 2.3vw, 30px); }
  .hp-post-overlay--post .post-panel__fixed .post-copy p { font-size: 13px; }
  .hp-post-overlay--post .post-panel__fixed .content-actions { margin-top: 5px; }
}
/* On a phone image, author/title and comments fit one viewport:
   image uses a fixed, non-scrollable stage and comments get the remainder. */
@media (max-width: 700px) {
  .hp-post-overlay--post {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .hp-post-overlay--post .post-detail {
    display: flex !important;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }
  .hp-post-overlay--post .post-media-column {
    flex: 0 0 clamp(165px, 29dvh, 260px);
    height: clamp(165px, 29dvh, 260px);
    min-height: 0;
    max-height: none;
  }
  .hp-post-overlay--post .post-panel {
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    overflow: hidden !important;
    padding: 0 !important;
  }
  .hp-post-overlay--post .post-panel__fixed {
    flex: 0 1 auto;
    max-height: calc(100% - 110px);
    padding: 9px 16px 6px;
  }
  .hp-post-overlay--post .post-panel__fixed .post-author-header { min-height: 36px; }
  .hp-post-overlay--post .post-panel__fixed .avatar--lg { width: 35px; height: 35px; }
  .hp-post-overlay--post .post-panel__fixed .post-author-header strong { font-size: 13px; }
  .hp-post-overlay--post .post-panel__fixed .post-author-header small { font-size: 11px; }
  .hp-post-overlay--post .post-panel__fixed .post-copy { padding: 6px 0 4px; }
  .hp-post-overlay--post .post-panel__fixed .post-copy h1 { margin-bottom: 4px; font-size: clamp(19px, 5vw, 25px); }
  .hp-post-overlay--post .post-panel__fixed .post-copy p { margin-bottom: 3px; font-size: 12px; line-height: 1.35; }
  .hp-post-overlay--post .post-panel__fixed .post-tags { font-size: 11px; }
  .hp-post-overlay--post .post-panel__fixed .content-actions { margin-top: 4px; padding-top: 3px; }
  .hp-post-overlay--post .post-panel__fixed .content-actions button { min-height: 34px; font-size: 9px; }
  .hp-post-overlay--post .post-panel__fixed .content-actions svg { width: 17px; height: 17px; }
  .hp-post-overlay--post .post-panel__comments { padding: 12px 16px 18px; }
  .hp-post-overlay--post .hp-post-close { top: 12px; left: 12px; width: 38px; height: 38px; }
}
