/* HealthLine.gr Article Component System v1.0
 * Permanent geometry and reusable article components.
 * Canonical article reading rail: 780px.
 */

.hl-single-post-page {
  --hl-article-rail: 780px;
  --hl-component-blue-bg: #eef6ff;
  --hl-component-red-bg: #fff1f4;
  --hl-component-border: #dce6ef;
  --hl-component-red: #d61747;
  --hl-component-blue: #1b80f3;
  --hl-component-navy: #0b2948;
  --hl-component-ink: #28394c;
}

/* --------------------------------------------------------------------------
   Geometry foundation
   -------------------------------------------------------------------------- */

/* Padding and borders must always remain inside an article element's width. */
.hl-single-post-page .hl-article-content,
.hl-single-post-page .hl-article-content *,
.hl-single-post-page .hl-article-content *::before,
.hl-single-post-page .hl-article-content *::after {
  box-sizing: border-box;
}

/*
 * Every box-like article component occupies the same 780px reading rail.
 * This overrides legacy Gutenberg alignwide/alignfull and inline width geometry
 * only for box-like components. It does not alter ordinary media or prose.
 */
.hl-single-post-page .hl-article-content > :is(
  .hl-article-component,
  .hl-content-box,
  .hl-callout,
  .hl-youtube-box,
  .hl-article-video-module,
  .hl-bibliography,
  details.hl-bibliography-details,
  .hl-action-box,
  .hl-newsletter-box,
  .hl-instagram-box,
  .hl-auto-toc,
  blockquote,
  .wp-block-quote,
  .wp-block-group.has-background,
  .wp-block-columns.has-background,
  .wp-block-media-text.has-background
) {
  width: 100% !important;
  max-width: var(--hl-article-rail) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-inline: auto !important;
  left: auto !important;
  right: auto !important;
  transform: none !important;
  float: none !important;
  clear: both;
}

/* A nested painted block keeps its natural parent width but never exceeds it. */
.hl-single-post-page .hl-article-content :is(
  .wp-block-group.has-background,
  .wp-block-columns.has-background,
  .wp-block-column.has-background,
  .wp-block-media-text.has-background
) {
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   Editorial media rail
   -------------------------------------------------------------------------- */

/*
 * Historical Gutenberg image/media blocks may carry alignwide or alignfull.
 * During migration, ordinary in-post editorial visuals use the same canonical
 * 780px reading rail as prose and components. Theme-owned featured/hero media
 * lives outside .hl-article-content and is intentionally unaffected.
 */
.hl-single-post-page .hl-article-content > :is(
  figure,
  .wp-block-image,
  .wp-block-gallery,
  .wp-block-video,
  .wp-block-embed,
  .wp-block-audio,
  .wp-block-cover
) {
  width: 100% !important;
  max-width: var(--hl-article-rail) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-inline: auto !important;
  left: auto !important;
  right: auto !important;
  transform: none !important;
  float: none !important;
}

/* Keep the actual media inside the normalized wrapper without distortion. */
.hl-single-post-page .hl-article-content > :is(
  figure,
  .wp-block-image,
  .wp-block-gallery,
  .wp-block-video,
  .wp-block-embed,
  .wp-block-cover
) :is(img, video, iframe) {
  max-width: 100% !important;
  height: auto;
}

.hl-single-post-page .hl-article-content > .wp-block-image > :is(img, a),
.hl-single-post-page .hl-article-content > figure.wp-block-image > :is(img, a) {
  max-width: 100% !important;
}

.hl-single-post-page .hl-article-content > .wp-block-image > a > img,
.hl-single-post-page .hl-article-content > figure.wp-block-image > a > img {
  display: block;
  max-width: 100% !important;
  height: auto !important;
}


/* --------------------------------------------------------------------------
   Theme-owned lead stack: new TOC -> native YouTube
   -------------------------------------------------------------------------- */

.hl-single-post-page .hl-article-content > .hl-article-lead-modules {
  width: 100% !important;
  max-width: var(--hl-article-rail) !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
}

.hl-single-post-page .hl-article-lead-modules > .hl-auto-toc,
.hl-single-post-page .hl-article-lead-modules > .hl-article-video-module {
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box !important;
}

.hl-single-post-page .hl-article-lead-modules > .hl-auto-toc {
  margin-top: clamp(1.6rem, 3vw, 2.2rem) !important;
  margin-bottom: 1.15rem !important;
}

.hl-single-post-page .hl-article-lead-modules > .hl-article-video-module {
  margin-top: 0 !important;
  margin-bottom: clamp(3.2rem, 6vw, 4.7rem) !important;
}

/* Retained for any previously rendered migration markup. New builds no longer
   rewrite legacy Gutenberg boxes into this class. */
.hl-single-post-page .hl-article-content > blockquote.hl-migrated-callout {
  width: 100% !important;
  max-width: var(--hl-article-rail) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* --------------------------------------------------------------------------
   Standard callout
   -------------------------------------------------------------------------- */

.hl-single-post-page .hl-article-content :is(.hl-content-box, .hl-callout) {
  margin-top: 1.9rem;
  margin-bottom: 1.9rem;
  padding: 1.5rem 1.65rem;
  border: 0;
  border-left: 5px solid var(--hl-component-red);
  border-radius: 12px;
  background: var(--hl-component-blue-bg);
  color: #333333;
  font-size: 1rem;
  line-height: 1.65;
}

.hl-single-post-page .hl-article-content :is(
  .hl-callout--warning,
  .hl-content-box--warning
) {
  background: var(--hl-component-red-bg);
}

.hl-single-post-page .hl-article-content :is(.hl-callout__title, .box-title) {
  margin: 0 0 .75rem;
  color: #222222;
  font-size: 1.2rem;
  font-weight: 750;
  line-height: 1.3;
}

.hl-single-post-page .hl-article-content :is(.hl-content-box, .hl-callout) p {
  margin-top: 0;
  margin-bottom: .85rem;
}

.hl-single-post-page .hl-article-content :is(.hl-content-box, .hl-callout) p:last-child {
  margin-bottom: 0;
}

.hl-single-post-page .hl-article-content :is(.hl-content-box, .hl-callout) strong {
  color: #222222;
  font-weight: 700;
}

.hl-single-post-page .hl-article-content :is(.hl-content-box, .hl-callout) :is(sup, .citation) {
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   YouTube component
   -------------------------------------------------------------------------- */

/* The native theme module is the locked YouTube article component. Geometry
   is owned here. Existing visual/card rules remain in blog-post-v0227.css. */
.hl-single-post-page .hl-article-content > .hl-article-video-module,
.hl-single-post-page .hl-article-content > .hl-youtube-box {
  box-sizing: border-box !important;
}

.hl-single-post-page .hl-article-content > .hl-youtube-box {
  margin-top: 2rem !important;
  margin-bottom: 3rem !important;
  padding: 1.5rem 1.65rem;
  border: 1px solid var(--hl-component-border);
  border-left: 5px solid var(--hl-component-red);
  border-radius: 12px;
  background: var(--hl-component-blue-bg);
}

/* --------------------------------------------------------------------------
   Locked bibliography
   -------------------------------------------------------------------------- */

.hl-single-post-page .hl-article-content > :is(
  details.hl-bibliography,
  details.hl-bibliography-details
) {
  margin-top: 2.3rem !important;
  margin-bottom: 2rem !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid var(--hl-component-border) !important;
  border-left: 5px solid var(--hl-component-red) !important;
  border-radius: 12px !important;
  background: #f7fbff !important;
  box-shadow: none !important;
}

.hl-single-post-page .hl-article-content > :is(
  details.hl-bibliography,
  details.hl-bibliography-details
) > summary {
  position: relative;
  margin: 0 !important;
  padding: 1.15rem 3.25rem 1.15rem 1.4rem !important;
  list-style: none;
  background: var(--hl-component-blue-bg) !important;
  color: #222222 !important;
  font-size: 1.15rem;
  font-weight: 750;
  line-height: 1.35;
  cursor: pointer;
}

.hl-single-post-page .hl-article-content > :is(
  details.hl-bibliography,
  details.hl-bibliography-details
) > summary::-webkit-details-marker {
  display: none;
}

.hl-single-post-page .hl-article-content > :is(
  details.hl-bibliography,
  details.hl-bibliography-details
) > summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 1.4rem;
  color: var(--hl-component-red);
  font-size: 1.45rem;
  font-weight: 650;
  line-height: 1;
  transform: translateY(-50%);
}

.hl-single-post-page .hl-article-content > :is(
  details.hl-bibliography,
  details.hl-bibliography-details
)[open] > summary::after {
  content: "−";
}

/* Standard bibliography wrapper used in future posts. */
.hl-single-post-page .hl-article-content .hl-bibliography__content {
  margin: 0 !important;
  padding: 1.35rem 1.55rem 1.5rem;
  color: #444444;
  font-size: .93rem;
  line-height: 1.62;
}

.hl-single-post-page .hl-article-content .hl-bibliography__content ol {
  margin: 0;
  padding-left: 1.35rem;
}

.hl-single-post-page .hl-article-content .hl-bibliography__content li {
  margin: 0 0 1rem;
  padding-left: .2rem;
}

.hl-single-post-page .hl-article-content .hl-bibliography__content li:last-child {
  margin-bottom: 0;
}

.hl-single-post-page .hl-article-content .hl-bibliography__title {
  font-weight: 650;
}

.hl-single-post-page .hl-article-content .hl-bibliography__source {
  font-style: italic;
}

.hl-single-post-page .hl-article-content .hl-bibliography__content a {
  color: var(--hl-component-red) !important;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Legacy bibliography markup may not yet have the content wrapper. Keep its
   direct children aligned and comfortably padded without changing source text. */
.hl-single-post-page .hl-article-content > details.hl-bibliography-details > :is(ol, ul, p, div):not(summary) {
  margin-left: 1.55rem !important;
  margin-right: 1.55rem !important;
}

.hl-single-post-page .hl-article-content > details.hl-bibliography-details > :is(ol, ul):last-child,
.hl-single-post-page .hl-article-content > details.hl-bibliography-details > p:last-child,
.hl-single-post-page .hl-article-content > details.hl-bibliography-details > div:last-child {
  margin-bottom: 1.5rem !important;
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 560px) {
  .hl-single-post-page .hl-article-content :is(.hl-content-box, .hl-callout, .hl-youtube-box) {
    padding: 1.25rem;
  }

  .hl-single-post-page .hl-article-content > :is(
    details.hl-bibliography,
    details.hl-bibliography-details
  ) > summary {
    padding: 1rem 2.8rem 1rem 1.15rem !important;
    font-size: 1.05rem;
  }

  .hl-single-post-page .hl-article-content > :is(
    details.hl-bibliography,
    details.hl-bibliography-details
  ) > summary::after {
    right: 1.1rem;
  }

  .hl-single-post-page .hl-article-content .hl-bibliography__content {
    padding: 1.15rem;
    font-size: .9rem;
  }
}
