/* Drugestan Health Magazine v1.30.0
   Lower scientific cards normalization + visible references + mobile product rail affordance. */
:root{
  --d30-navy:#173553;
  --d30-teal:#168c89;
  --d30-blue:#3979c7;
  --d30-violet:#7042b8;
  --d30-orange:#d97822;
  --d30-line:#d5e1e9;
  --d30-card:#f7fafc;
}

/* ---------- DESKTOP: remove slivers / orphan columns ---------- */
@media (min-width:1180px){
  body[class*="single-dhms_"] .dhm-v22-refine .dhm-v16-modules{
    grid-auto-flow:row!important;
    align-items:start!important;
  }

  /* The two scientific follow-ups + references are a clean 3-card row. */
  body[class*="single-dhms_"] .dhm-v22-refine .dhm-v16-modules > .dhm-sync-text.dhm-heading-outside,
  body[class*="single-dhms_"] .dhm-v22-refine .dhm-v16-modules > #dhm-scientific-sources,
  body[class*="single-dhms_"] .dhm-v22-refine .dhm-v16-modules > .dhm-sync-sources{
    grid-column:span 4!important;
    order:40!important;
    display:flex!important;
    flex-direction:column!important;
    float:none!important;
    position:relative!important;
    inset:auto!important;
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    height:auto!important;
    margin:0!important;
    padding:0!important;
    transform:none!important;
    writing-mode:horizontal-tb!important;
    text-orientation:mixed!important;
    overflow:visible!important;
    box-sizing:border-box!important;
  }

  body[class*="single-dhms_"] .dhm-v22-refine .dhm-v16-modules > .dhm-sync-text.dhm-heading-outside > h2,
  body[class*="single-dhms_"] .dhm-v22-refine .dhm-v16-modules > #dhm-scientific-sources > h2,
  body[class*="single-dhms_"] .dhm-v22-refine .dhm-v16-modules > .dhm-sync-sources > h2{
    display:block!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    min-height:38px!important;
    margin:0 0 9px!important;
    padding:0!important;
    font-size:18px!important;
    line-height:1.45!important;
    font-weight:800!important;
    color:var(--d30-navy)!important;
    white-space:normal!important;
    overflow:visible!important;
    overflow-wrap:anywhere!important;
    word-break:normal!important;
    transform:none!important;
    writing-mode:horizontal-tb!important;
  }

  body[class*="single-dhms_"] .dhm-v22-refine .dhm-v16-modules > .dhm-sync-text.dhm-heading-outside > .dhm-section-card,
  body[class*="single-dhms_"] .dhm-v22-refine #dhm-scientific-sources > .dhm-section-card,
  body[class*="single-dhms_"] .dhm-v22-refine .dhm-sync-sources > .dhm-section-card{
    display:flex!important;
    flex-direction:column!important;
    flex:1 1 auto!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    min-height:190px!important;
    height:190px!important;
    max-height:190px!important;
    margin:0!important;
    padding:18px 20px!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
    background:#f7fafc!important;
    border:1px solid var(--d30-line)!important;
    border-right:4px solid var(--d30-teal)!important;
    border-radius:14px!important;
    color:#344b60!important;
    transform:none!important;
    writing-mode:horizontal-tb!important;
  }

  body[class*="single-dhms_"] .dhm-v22-refine #dhm-scientific-sources .dhm-toggle-body,
  body[class*="single-dhms_"] .dhm-v22-refine .dhm-sync-sources .dhm-toggle-body,
  body[class*="single-dhms_"] .dhm-v22-refine #dhm-scientific-sources .dhm-reference-list,
  body[class*="single-dhms_"] .dhm-v22-refine #dhm-scientific-sources .dhm-reference-item{
    display:block!important;
    position:static!important;
    float:none!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    margin:0!important;
    transform:none!important;
    writing-mode:horizontal-tb!important;
    text-orientation:mixed!important;
    white-space:normal!important;
    word-break:normal!important;
    overflow-wrap:anywhere!important;
  }

  body[class*="single-dhms_"] .dhm-v22-refine #dhm-scientific-sources .dhm-toggle-body.is-collapsed{
    max-height:112px!important;
    overflow:hidden!important;
  }
  body[class*="single-dhms_"] .dhm-v22-refine #dhm-scientific-sources .dhm-toggle-head{
    margin-top:auto!important;
    padding-top:8px!important;
    display:block!important;
  }
  body[class*="single-dhms_"] .dhm-v22-refine #dhm-scientific-sources .dhm-section-toggle-btn{
    display:inline-flex!important;
    align-items:center!important;
    min-height:30px!important;
    padding:5px 11px!important;
    border:1px solid #b9d8d5!important;
    border-radius:9px!important;
    background:#fff!important;
    color:#147875!important;
    font-size:12px!important;
    font-weight:700!important;
  }

  /* Never allow a bare scientific text block to become a vertical sliver. */
  body[class*="single-dhms_"] .dhm-v22-refine .dhm-v16-modules > .dhm-sync-text:not(.dhm-heading-outside){
    grid-column:1/-1!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    writing-mode:horizontal-tb!important;
    word-break:normal!important;
    overflow-wrap:anywhere!important;
  }
}

/* ---------- MOBILE PRODUCT RAIL: show that more items exist ---------- */
@media (max-width:899px){
  body[class*="single-dhms_"] .dhm-v22-refine #dhm-products{
    margin-bottom:34px!important;
  }
  body[class*="single-dhms_"] .dhm-v22-refine #dhm-products .dhm-sync-products-grid,
  body[class*="single-dhms_"] .dhm-v22-refine #dhm-products .dhm-related-products{
    gap:12px!important;
    padding:2px 12% 10px 0!important;
    scroll-padding-inline:12%!important;
    scrollbar-width:thin!important;
  }
  body[class*="single-dhms_"] .dhm-v22-refine #dhm-products .dhm-sync-product,
  body[class*="single-dhms_"] .dhm-v22-refine #dhm-products .dhm-related-product{
    flex:0 0 82%!important;
    width:82%!important;
    min-width:82%!important;
    max-width:82%!important;
    scroll-snap-align:start!important;
  }
  .dhm-product-rail-hint{
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:8px!important;
    margin:-2px 0 10px!important;
    padding:8px 12px!important;
    background:#f2f9f8!important;
    border:1px solid #d3e8e5!important;
    border-radius:11px!important;
    color:#276d6b!important;
    font-size:12px!important;
    line-height:1.5!important;
    font-weight:700!important;
  }
  .dhm-product-rail-hint .dhm-swipe-arrow{
    font-size:18px!important;
    line-height:1!important;
  }
  .dhm-product-dots{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:6px!important;
    margin:10px 0 0!important;
  }
  .dhm-product-dot{
    width:7px!important;
    height:7px!important;
    padding:0!important;
    border:0!important;
    border-radius:999px!important;
    background:#c4d3da!important;
    cursor:pointer!important;
    transition:width .18s ease,background .18s ease!important;
  }
  .dhm-product-dot.is-active{
    width:22px!important;
    background:var(--d30-teal)!important;
  }

  /* CTA should not cover the product rail/resources once user reaches products. */
  body.dhm-v30-products-in-view .dhm-v25-products-only.dhm-v19-mobile-actions{
    opacity:0!important;
    visibility:hidden!important;
    pointer-events:none!important;
    transform:translateY(120%)!important;
  }

  /* Scientific/reference cards stay horizontal and readable on mobile too. */
  body[class*="single-dhms_"] .dhm-v22-refine #dhm-scientific-sources,
  body[class*="single-dhms_"] .dhm-v22-refine #dhm-scientific-sources *{
    writing-mode:horizontal-tb!important;
    text-orientation:mixed!important;
    word-break:normal!important;
    overflow-wrap:anywhere!important;
  }
}
