/* vtx-mobile-cover-20261116-v8.css
 *
 * Mobile article headers only (#page-header.post-bg, not the homepage
 * #page-header.full_page). Desktop / tablet (≥769px) header is unchanged.
 *
 * v3: full-bleed cover, no seam; ZERO blur when the intro is collapsed,
 *     blur(28px) only while details.vtx-reader-context is open (or the
 *     v18 class #page-header.vtx-intro-open).
 *
 * v4: keep the title / category / author / intro-summary group at the
 *     bottom of a 30rem header until the intro is expanded.
 *
 * v5: the collapsed header fills the first visible web viewport
 *     (100svh, 100vh fallback) instead of 30rem, so the article body
 *     does not peek in. Expanding the intro keeps flex-end: the intro
 *     body takes space at the bottom and pushes the title group up,
 *     flush with a small safe-area padding. If the open intro is taller
 *     than the viewport, the header grows and the page scrolls; text
 *     is not clipped. svh is used (not dvh) so Safari toolbar show/hide
 *     does not resize the header.
 *
 *     Also tightens the gap between this article's File_XX chapter
 *     banners and the following File_XX headings (all languages, all
 *     viewports). Scoped to p:has(> img[alt^="File_"]) + h2 so other
 *     posts' h2 / img margins are untouched.
 *
 * v7: stop reserving the intro row with a padding-bottom guess (v6
 *     used 1.25rem + 1rem + 1.85em + 4px, then swapped to 0.75rem
 *     when JS inserted the details, which does not match intro v4's
 *     mobile box: margin-top 0.7rem + 4px details padding + 2px
 *     summary padding + 13px×1.6 line). A real flex ::after row of
 *     that exact height is reserved from first paint on posts flagged
 *     html.vtx-will-have-intro; inserting details hides the slot in
 *     the same frame so the title does not move. Posts without an
 *     intro never get the slot. Also animates the summary: left bar
 *     first, then a clipped typewriter of the label only.
 *
 * v6: cancel the theme's mobile #page-header.post-bg { margin-bottom:
 *     -12px } that pulled the article card up into the first viewport
 *     (~12px white/card strip). Do not inflate 100svh. Also drop the
 *     mobile article .layout top padding so the rounded #post card
 *     begins just below the first screen. Tighten File_ banner→h2
 *     visual gap to ~10–12px by using 8px margin (html font-size is
 *     20px, so 0.75rem was 15px) and display:block on the banner to
 *     remove the inline-image baseline gap; h2 half-leading is ~4px.
 */

/* ── Cover fill + blur (same as v3/v4) ── */
@media screen and (max-width: 768px) {
  #page-header.post-bg:not(.full_page) {
    background-color: #141414 !important;
    background-image: none !important;
  }

  #page-header.post-bg:not(.full_page)::before {
    height: 100% !important;
    background: none !important;
    background-color: transparent !important;
    opacity: 1 !important;
    box-shadow: none !important;
    filter: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  #page-header.post-bg:not(.full_page) .coverdiv {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
    transform: none !important;
    filter: none !important;
    opacity: 1 !important;
    z-index: 1;
  }

  #page-header.post-bg:not(.full_page) .coverdiv.loaded {
    display: block !important;
    opacity: 1 !important;
    filter: none !important;
  }

  #page-header.post-bg:not(.full_page) #post-cover,
  #page-header.post-bg:not(.full_page) .coverdiv #post-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 100% !important;
    max-width: none;
    object-fit: cover !important;
    opacity: 1 !important;
    filter: none !important;
  }

  #page-header.post-bg:not(.full_page) #post-cover[data-vtx-ph]:not(.vtx-loaded):not(.vtx-err) {
    object-position: -99999px -99999px !important;
  }

  #page-header.post-bg:not(.full_page) #post-cover.vtx-loaded,
  #page-header.post-bg:not(.full_page) #post-cover.vtx-err,
  #page-header.post-bg:not(.full_page) #post-cover:not([data-vtx-ph]) {
    object-position: center top !important;
  }

  #page-header.post-bg:not(.full_page) .coverdiv::after {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    content: "" !important;
    pointer-events: none;
    box-shadow: none !important;
    filter: none !important;
    background: linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.05) 0%,
      rgba(0, 0, 0, 0.03) 42%,
      rgba(0, 0, 0, 0.14) 78%,
      rgba(0, 0, 0, 0.22) 100%
    ) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    -webkit-mask-image: linear-gradient(
      to bottom,
      transparent 0%,
      transparent 40%,
      #000 66%,
      #000 100%
    );
    mask-image: linear-gradient(
      to bottom,
      transparent 0%,
      transparent 40%,
      #000 66%,
      #000 100%
    );
    -webkit-transition: backdrop-filter 0.28s ease, -webkit-backdrop-filter 0.28s ease, background 0.28s ease;
    transition: backdrop-filter 0.28s ease, -webkit-backdrop-filter 0.28s ease, background 0.28s ease;
  }

  #page-header.post-bg:not(.full_page):has(details.vtx-reader-context[open]) .coverdiv::after,
  #page-header.post-bg:not(.full_page).vtx-intro-open .coverdiv::after {
    background: linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.10) 0%,
      rgba(0, 0, 0, 0.06) 38%,
      rgba(0, 0, 0, 0.28) 72%,
      rgba(0, 0, 0, 0.46) 100%
    ) !important;
    -webkit-backdrop-filter: blur(28px) saturate(1.15) !important;
    backdrop-filter: blur(28px) saturate(1.15) !important;
  }

  #page-header.post-bg:not(.full_page) #post-info {
    z-index: 10;
  }
}

/* ── Title block: fill first viewport, stay bottom-aligned ── */
@media screen and (max-width: 768px) {
  /*
   * Collapsed / first paint (no JS class required).
   * 100svh = visible webpage viewport (excludes browser chrome).
   * 100vh is the fallback for Safari < 15.4. Do not use 100dvh:
   * toolbar show/hide would resize the header.
   */
  #page-header.post-bg:not(.full_page),
  #page-header.post-bg:not(.full_page).vtx-has-intro {
    height: 100vh !important;
    height: 100svh !important;
    min-height: 100vh !important;
    min-height: 100svh !important;
    max-height: none;
    box-sizing: border-box !important;
    /* Theme sets margin-bottom: -12px on mobile, which pulls the
       article card up into the first viewport. */
    margin-bottom: 0 !important;
    overflow: hidden;
    /* Theme transitions height 0.5–0.6s; that would jank first paint
       if 30rem leaked, and on expand. Keep colour transitions only. */
    transition: background 0.5s ease, filter 0.28s ease !important;
  }

  #page-header.post-bg:not(.full_page) #post-info,
  #page-header.post-bg:not(.full_page).vtx-has-intro #post-info {
    position: absolute !important;
    top: 0 !important;
    right: 0;
    bottom: 0 !important;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    align-items: flex-start;
    /* Nav clearance only; flex-end keeps the group at the bottom. */
    padding-top: calc(4.5rem + env(safe-area-inset-top, 0px)) !important;
    /* Stable from first paint through intro insertion. The summary
       row is reserved by ::after, not by this padding. */
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px)) !important;
    padding-left: 6% !important;
    padding-right: 6% !important;
  }

  /*
   * Exact collapsed summary row, from intro v4 mobile:
   *   details { margin-top: 0.7rem; padding: 2px 0; box-sizing: border-box }
   *   summary { padding-bottom: 2px; font-size: 13px; line-height: 1.6 }
   * Height = 2px + 2px + 2px + 13px*1.6. Margin is separate, same as
   * the real details, so replacing this flex item with <details>
   * does not move the title/meta above it.
   */
  html.vtx-will-have-intro #page-header.post-bg:not(.full_page) #post-info::after {
    content: "";
    box-sizing: border-box;
    display: block;
    flex: 0 0 auto;
    align-self: stretch;
    width: 100%;
    margin: 0.7rem 0 0;
    height: calc(6px + 13px * 1.6);
    pointer-events: none;
    visibility: hidden;
  }

  html.vtx-will-have-intro #page-header.post-bg:not(.full_page):has(#post-info details.vtx-reader-context) #post-info::after,
  html.vtx-no-intro #page-header.post-bg:not(.full_page) #post-info::after {
    content: none;
    display: none;
    height: 0;
    margin: 0;
  }

  /*
   * Expanded: still flex-end, so the intro body is last and flush with
   * the bottom. min-height stays 100svh so a short intro does not
   * shrink the header or reveal the article body. height:auto lets a
   * long intro grow the header; #post-info is in-flow so it can
   * stretch the header instead of being clipped.
   */
  #page-header.post-bg:not(.full_page):has(details.vtx-reader-context[open]),
  #page-header.post-bg:not(.full_page).vtx-intro-open {
    height: auto !important;
    min-height: 100vh !important;
    min-height: 100svh !important;
    margin-bottom: 0 !important;
    overflow: hidden;
  }

  /* Rounded article card starts just below the first viewport.
     Theme .layout has padding-top: 1rem (20px) on mobile and
     .post .layout#content-inner is painted with --heo-main. */
  #body-wrap.post #content-inner.layout {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }

  #page-header.post-bg:not(.full_page):has(details.vtx-reader-context[open]) #post-info,
  #page-header.post-bg:not(.full_page).vtx-intro-open #post-info {
    position: relative !important;
    top: auto !important;
    right: auto;
    bottom: auto !important;
    left: auto;
    height: auto !important;
    min-height: 100vh !important;
    min-height: 100svh !important;
    justify-content: flex-end !important;
    padding-top: calc(4.5rem + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media screen and (max-width: 768px) and (prefers-reduced-transparency: reduce) {
  #page-header.post-bg:not(.full_page) .coverdiv::after,
  #page-header.post-bg:not(.full_page):has(details.vtx-reader-context[open]) .coverdiv::after,
  #page-header.post-bg:not(.full_page).vtx-intro-open .coverdiv::after {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

@media screen and (max-width: 768px) and (prefers-reduced-motion: reduce) {
  #page-header.post-bg:not(.full_page) .coverdiv::after,
  #page-header.post-bg:not(.full_page):has(details.vtx-reader-context[open]) .coverdiv::after,
  #page-header.post-bg:not(.full_page).vtx-intro-open .coverdiv::after {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    -webkit-transition: none;
    transition: none;
  }
}

/* ── Chapter banners in 《江汉的十字路口：幻之虾黄追踪事件》
 * (slug wuhan-zarigani-jiken; same File_XX structure in zh/en/ja).
 *
 * Cause: each banner sits in a <p> immediately followed by an <h2>.
 * There are no empty paragraphs or <hr>. Theme rules add the gap:
 *   #article-container img { margin-bottom: 0.5rem }
 *   #article-container p { margin-bottom: 0.8rem }
 *   #post h2 { margin-top: 1.5rem }
 *   #article-container.post-content h2 {
 *     border-top: 1px dashed var(--heo-theme-op);
 *     padding-top: 1.5rem;
 *   }
 * The dashed top border is the dotted divider in the screenshot.
 * .vtx-img-text captions are hidden in zh and do not create the gap.
 * Scope is the File_ alt + adjacent h2 only; no sitewide h2/img change.
 */
#article-container.post-content p:has(> img[alt^="File_"]) {
  margin-bottom: 0 !important;
}

#article-container.post-content p:has(> img[alt^="File_"]) > img {
  /* Inline style is display:inline-block; baseline gap sits under
     the banner and added several pixels on top of the h2 margin. */
  display: block !important;
  margin-bottom: 0 !important;
  vertical-align: bottom;
}

#article-container.post-content p:has(> img[alt^="File_"]) + h2,
#article-container.post-content p:has(> img[alt^="File_"]) + .vtx-img-transcript-host + h2 {
  /* html font-size is 20px, so 0.75rem was 15px. h2 is 1.3rem / 1.3
     line-height (~4px half-leading). 8px + leading ≈ 12px visual. */
  margin-top: 8px !important;
  padding-top: 0 !important;
  border-top: none !important;
}


/* ── Intro summary entrance (bar, then typewriter of the label) ──
 * Layout size is the final label at all times; only a clip-path
 * reveals the text. The native <details>/<summary> stays clickable,
 * focusable, and labelled throughout. The body is never typewritten.
 */
#post-info > details.vtx-reader-context.vtx-intro-enter,
#page-header #post-info details.vtx-reader-context.vtx-intro-enter {
  border-left-color: transparent !important;
}

#post-info > details.vtx-reader-context.vtx-intro-enter.vtx-intro-bar-in,
#page-header #post-info details.vtx-reader-context.vtx-intro-enter.vtx-intro-bar-in {
  border-left-color: rgba(255, 255, 255, 0.55) !important;
  transition: border-left-color 160ms ease !important;
}

#post-info > details.vtx-reader-context.vtx-intro-enter > summary::before,
#page-header #post-info details.vtx-reader-context.vtx-intro-enter > summary::before {
  opacity: 0;
}

#post-info > details.vtx-reader-context.vtx-intro-enter.vtx-intro-bar-in > summary::before,
#page-header #post-info details.vtx-reader-context.vtx-intro-enter.vtx-intro-bar-in > summary::before {
  opacity: 1;
  transition: opacity 160ms ease, transform 0.15s ease !important;
}

#post-info > details.vtx-reader-context .vtx-intro-label,
#page-header #post-info details.vtx-reader-context .vtx-intro-label {
  display: inline-block;
  max-width: 100%;
}

#post-info > details.vtx-reader-context .vtx-intro-label-text,
#page-header #post-info details.vtx-reader-context .vtx-intro-label-text {
  display: inline-block;
  max-width: 100%;
}

#post-info > details.vtx-reader-context.vtx-intro-enter .vtx-intro-label-text,
#page-header #post-info details.vtx-reader-context.vtx-intro-enter .vtx-intro-label-text {
  -webkit-clip-path: inset(0 100% 0 0);
  clip-path: inset(0 100% 0 0);
}

#post-info > details.vtx-reader-context.vtx-intro-enter.vtx-intro-typed .vtx-intro-label-text,
#page-header #post-info details.vtx-reader-context.vtx-intro-enter.vtx-intro-typed .vtx-intro-label-text {
  -webkit-clip-path: inset(0 0 0 0);
  clip-path: inset(0 0 0 0);
  -webkit-transition: -webkit-clip-path 550ms steps(var(--vtx-intro-steps, 12), end);
  transition: clip-path 550ms steps(var(--vtx-intro-steps, 12), end),
              -webkit-clip-path 550ms steps(var(--vtx-intro-steps, 12), end);
}

@media (prefers-reduced-motion: reduce) {
  #post-info > details.vtx-reader-context.vtx-intro-enter,
  #page-header #post-info details.vtx-reader-context.vtx-intro-enter,
  #post-info > details.vtx-reader-context.vtx-intro-enter.vtx-intro-bar-in,
  #page-header #post-info details.vtx-reader-context.vtx-intro-enter.vtx-intro-bar-in {
    border-left-color: rgba(255, 255, 255, 0.55) !important;
    transition: none !important;
  }
  #post-info > details.vtx-reader-context.vtx-intro-enter > summary::before,
  #post-info > details.vtx-reader-context.vtx-intro-enter.vtx-intro-bar-in > summary::before,
  #page-header #post-info details.vtx-reader-context.vtx-intro-enter > summary::before,
  #page-header #post-info details.vtx-reader-context.vtx-intro-enter.vtx-intro-bar-in > summary::before {
    opacity: 1;
    transition: none !important;
  }
  #post-info > details.vtx-reader-context.vtx-intro-enter .vtx-intro-label-text,
  #post-info > details.vtx-reader-context.vtx-intro-enter.vtx-intro-typed .vtx-intro-label-text,
  #page-header #post-info details.vtx-reader-context.vtx-intro-enter .vtx-intro-label-text,
  #page-header #post-info details.vtx-reader-context.vtx-intro-enter.vtx-intro-typed .vtx-intro-label-text {
    -webkit-clip-path: none;
    clip-path: none;
    -webkit-transition: none;
    transition: none;
  }
}

/* v8: replace the two nested inline-block baseline line boxes with a
   flex/block label chain. Before insertion ::after reserves 26.8px;
   the actual collapsed details must occupy that same border-box size.
   Open details keep their natural body height. Desktop is untouched. */
@media screen and (max-width: 768px) {
  #page-header.post-bg:not(.full_page) #post-info > details.vtx-reader-context:not([open]) {
    flex: 0 0 auto !important;
    height: calc(6px + 13px * 1.6) !important;
    min-height: calc(6px + 13px * 1.6) !important;
    max-height: calc(6px + 13px * 1.6) !important;
  }
  #page-header.post-bg:not(.full_page) #post-info > details.vtx-reader-context > summary {
    flex: 0 0 auto !important;
    height: calc(2px + 13px * 1.6) !important;
    min-height: calc(2px + 13px * 1.6) !important;
    max-height: calc(2px + 13px * 1.6) !important;
  }
  #page-header.post-bg:not(.full_page) #post-info > details.vtx-reader-context .vtx-intro-label,
  #page-header.post-bg:not(.full_page) #post-info > details.vtx-reader-context .vtx-intro-label-text {
    font-size: 13px !important;
    line-height: 1.6 !important;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: top !important;
  }
  #page-header.post-bg:not(.full_page) #post-info > details.vtx-reader-context .vtx-intro-label {
    display: flex !important;
    align-items: center;
    min-width: 0;
  }
  #page-header.post-bg:not(.full_page) #post-info > details.vtx-reader-context .vtx-intro-label-text {
    display: block !important;
  }
}
