/* toc */

.toc-title {
	cursor: pointer;
    font-size: 18px;
	display :none;
}
.toc-title.active{
		display :flex;
		gap: 10px;
	align-items: center
}
.toc-title .icon{
 	transition: transform .3s ease-out;
}
.toc-title.open .icon{
	transform: rotate(90deg);
}
li.toc-list-item + li.toc-list-item{
	margin-top: 8px
}


.toc-link::before{
	content: none!important 
}
a.toc-link{
	color: var(--color-link)!important;
	font-weight: normal!important
}
.toc-list li::before{
		color: var(--color-link)!important;

}
a.toc-link:hover{
	text-decoration: underline
}

ol.toc-list  {
  counter-reset: section;                
  list-style-type: none;
}

.toc-list  li::before {
  counter-increment: section;           
  content: counters(section, ".") " "; 
}

.fixed-toc{
    position: fixed;
    left: 0;
    top: 50%!important;
    transform: translateY(-50%);
	z-index: 1000;
}

.fixed-toc button.btn.toc-toggle-btn {
	color: var(--color-primary);
    border: 1px solid;
    padding: 5px;
    width: 32px;
    height: 32px;
    line-height: 1;
    margin-left: 10px;
	background: white;
	opacity: 0.6
}
.fixed-toc button.btn.toc-toggle-btn:hover{
	opacity: 1

}
.fixed-toc .fixed-toc-content{
	width: 300px;
    background: #ffff;
    position: absolute;
    top: 0!important;
    z-index: 9999;
    padding: 15px;
    border: 1px solid;
    border-radius: 5px;
    font-size: 14px;
    max-height: 75vh;
    overflow-y: auto;
    transform: translateY(-50%) translateX(-100%);
	transition: transform .3s ease-out;
}
.fixed-toc.open .fixed-toc-content {
	    transform: translateY(-50%);
}

.toc-wrapper:has(.js-toc:empty){
	display: none
}  



.ega-cate-shortcode{
	background-color: #D4E0FE
}

/* ==========================================================================
   Images – luôn giữ ratio gốc và căn giữa
   ========================================================================== */
.article-wraper .prose img {
  display: block;
  width: 100% !important;           /* co vừa khung text */
  max-width: 100% !important;
  height: auto !important;          /* giữ ratio gốc */
  margin: 1.5rem auto !important;   /* trên/dưới 1.5rem, trái/phải auto để căn giữa */
  object-fit: contain !important;   /* không crop ảnh */
}

/* ==========================================================================
   Embeds (iframe, video, embed) – giữ aspect ratio chính xác
   ========================================================================== */

/* Base styling cho tất cả embed */
.article-wraper .prose iframe,
.article-wraper .prose video,
.article-wraper .prose embed {
  display: block;
  width: 100% !important;           
  max-width: 100% !important;
  margin: 1.5rem auto !important;   
  border: none !important;
  border-radius: 8px;
}

/* Default aspect ratio cho tất cả embed (16:9) */
.article-wraper .prose iframe,
.article-wraper .prose video,
.article-wraper .prose embed {
  aspect-ratio: 16 / 9 !important;
  height: auto !important;
}

/* YouTube videos - 16:9 */
.article-wraper .prose iframe[src*="youtube.com"],
.article-wraper .prose iframe[src*="youtu.be"] {
  aspect-ratio: 16 / 9 !important;
}

/* Vimeo videos - 16:9 */
.article-wraper .prose iframe[src*="vimeo.com"] {
  aspect-ratio: 16 / 9 !important;
}

/* TikTok - vertical 9:16 */
.article-wraper .prose iframe[src*="tiktok.com"] {
  aspect-ratio: 9 / 16 !important;
}

/* Instagram - square 1:1 */
.article-wraper .prose iframe[src*="instagram.com"] {
  aspect-ratio: 1 / 1 !important;
}

/* Google Maps - 4:3 */
.article-wraper .prose iframe[src*="google.com/maps"] {
  aspect-ratio: 4 / 3 !important;
}

/* Canva presentations/infographics - 4:3 */
.article-wraper .prose iframe[src*="canva.com"] {
  aspect-ratio: 4 / 3 !important;
}

/* Fallback cho browsers không hỗ trợ aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
  .article-wraper .prose iframe,
  .article-wraper .prose video,
  .article-wraper .prose embed {
    height: 0 !important;
    padding-bottom: 56.25% !important; /* 16:9 ratio */
    position: relative !important;
  }
  
  .article-wraper .prose iframe[src*="youtube.com"],
  .article-wraper .prose iframe[src*="youtu.be"],
  .article-wraper .prose iframe[src*="vimeo.com"] {
    padding-bottom: 56.25% !important; /* 16:9 */
  }
  
  .article-wraper .prose iframe[src*="tiktok.com"] {
    padding-bottom: 177.78% !important; /* 9:16 */
  }
  
  .article-wraper .prose iframe[src*="instagram.com"] {
    padding-bottom: 100% !important; /* 1:1 */
  }
  
  .article-wraper .prose iframe[src*="google.com/maps"],
  .article-wraper .prose iframe[src*="canva.com"] {
    padding-bottom: 75% !important; /* 4:3 */
  }
}

/* Desktop (>=768px): bleed full-width */
@media (min-width: 768px) {
  .article-wraper .prose iframe,
  .article-wraper .prose video,
  .article-wraper .prose embed {
    width: calc(100% + 2rem) !important;  /* +2 × 1rem padding */
    max-width: none !important;
    margin-left: -1rem !important;        /* bù padding trái */
    margin-right: -1rem !important;       /* bù padding phải */
    margin-top: 1.5rem !important;
    margin-bottom: 1.5rem !important;
  }
}

/* Responsive video wrapper cho fallback */
@supports not (aspect-ratio: 16 / 9) {
  .article-wraper .prose iframe,
  .article-wraper .prose video,
  .article-wraper .prose embed {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }
  
  /* Tạo wrapper container */
  .article-wraper .prose iframe::before,
  .article-wraper .prose video::before,
  .article-wraper .prose embed::before {
    content: "" !important;
    display: block !important;
    position: relative !important;
  }
}