/* ============================================
   DCMS Article Content CSS
   WYSIWYG Styles - Dùng chung cho Editor và Site
   ============================================ */

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */
   :root {
    /* Layout variables */
    --w-text: 640px;
    --w-wide: 960px;
    --w-wider: 1280px;
    --gap: 24px;
    --gutter: 16px; /* Khoảng cách text ↔ ảnh khi float */
    
    /* Color palette */
    --primary-50: #f8f9fa;
    --primary-100: #f1f3f4;
    --primary-200: #e8eaed;
    --primary-300: #dadce0;
    --primary-400: #bdc1c6;
    --primary-500: #9aa0a6;
    --primary-600: #202124;
    --primary-700: #1a1a1a;
    --primary-800: #141414;
    --primary-900: #0f0f0f;
    
    --secondary-50: #fef2f2;
    --secondary-100: #fee2e2;
    --secondary-200: #fecaca;
    --secondary-300: #fca5a5;
    --secondary-400: #f87171;
    --secondary-500: #ef4444;
    --secondary-600: #d0011c;
    --secondary-700: #b91c1c;
    --secondary-800: #991b1b;
    --secondary-900: #7f1d1d;
    
    --success-50: #f0fdf4;
    --success-100: #dcfce7;
    --success-200: #bbf7d0;
    --success-300: #86efac;
    --success-400: #4ade80;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --success-700: #15803d;
    --success-800: #166534;
    --success-900: #14532d;
    
    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-200: #fde68a;
    --warning-300: #fcd34d;
    --warning-400: #fbbf24;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning-700: #b45309;
    --warning-800: #92400e;
    --warning-900: #78350f;
    
    --danger-50: #fef2f2;
    --danger-100: #fee2e2;
    --danger-200: #fecaca;
    --danger-300: #fca5a5;
    --danger-400: #f87171;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --danger-700: #b91c1c;
    --danger-800: #991b1b;
    --danger-900: #7f1d1d;
    
    --info-50: #eff6ff;
    --info-100: #dbeafe;
    --info-200: #bfdbfe;
    --info-300: #93c5fd;
    --info-400: #60a5fa;
    --info-500: #3b82f6;
    --info-600: #2563eb;
    --info-700: #1d4ed8;
    --info-800: #1e40af;
    --info-900: #1e3a8a;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --border-color: #e5e5e5;
    
    /* Content colors */
    --figcaption-color: #6b7280;
    
    /* Typography scale */
    --text-xs: .75rem;
    --text-sm: .875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;
    --text-6xl: 3.75rem;
    --text-7xl: 4.5rem;
    --text-8xl: 6rem;
    --text-9xl: 8rem;
    
    /* Spacing scale */
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 20px;
    --space-lg: 30px;
    --space-xl: 40px;
    --space-2xl: 60px;
    
    /* Transitions */
    --transition-fast: .2s ease;
    --transition-normal: .3s ease;
    
    /* NOTE: eMagazine CSS variables are NOT defined here */
    /* They are set inline on editor wrappers via JavaScript in dcms-editor-ui.js */
    /* This ensures content.css is clean and only for site display */
  }
  /* ============================================
     END: CSS CUSTOM PROPERTIES
     ============================================ */
  
  /* ============================================
     BASE CONTAINER STYLES
     ============================================ */
  
  .dcms-article-content {
    /* max-width = 640px: Reference container for float-wide calculations */
    /* align-wide/full use negative margins to "break out" of this container */
    max-width: var(--w-text); /* 640px */
    margin-inline: auto;
    line-height: 1.7;
    color: #333; /* Default color - eMagazine colors applied inline in editor via JS */
    background-color: transparent; /* Default - eMagazine colors applied inline in editor via JS */
    /* Enable container queries for float-wide calculations */
    container-type: inline-size;
  }
  
  /* Clear float ở cuối bài để tránh tràn */
  .dcms-article-content::after {
    content: "";
    display: block;
    clear: both;
  }
  
  /* ============================================
     END: BASE CONTAINER STYLES
     ============================================ */
  
  /* ============================================
     TYPOGRAPHY - PARAGRAPHS & TEXT ELEMENTS
     ============================================ */
  
  .dcms-article-content p {
    max-width: var(--w-text); /* 640px - tự định nghĩa width, không phụ thuộc wrapper */
    margin: 0 auto 1rem;
    font-size: 1.125rem;
    line-height: 1.8; /* Comfortable reading line height */
    color: inherit;
  }
  
  .dcms-article-content li {
    font-size: 1.125rem;
    line-height: 1.75;
    margin: 0.5rem 0;
    color: inherit;
  }
  
  .dcms-article-content a {
    color: var(--t-accent, #d0011c);
    text-decoration: none;
    /* Break long URLs at word boundaries (/, -, .) before breaking mid-word */
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
    transition: box-shadow 0.2s ease;
  }

  .dcms-article-content a:hover {
    text-decoration: none;
    box-shadow: inset 0 -0.5em 0 0 rgba(208, 1, 28, 0.12);
  }
  
  .dcms-article-content strong,
  .dcms-article-content b {
    font-weight: 700;
    color: inherit;
  }
  
  .dcms-article-content em,
  .dcms-article-content i {
    font-style: italic;
    color: inherit;
  }
  
  .dcms-article-content u {
    text-decoration: underline;
    color: inherit;
  }
  
  .dcms-article-content code,
  .dcms-article-content pre {
    color: inherit;
  }
  
  /* ============================================
     END: TYPOGRAPHY - PARAGRAPHS & TEXT ELEMENTS
     ============================================ */
  
  /* ============================================
     TYPOGRAPHY - HEADINGS
     ============================================ */
  
  .dcms-article-content h1 {
    max-width: var(--w-text); /* 640px - tự định nghĩa width, không phụ thuộc wrapper */
    margin: 2rem auto 1rem;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    color: inherit;
  }
  
  .dcms-article-content h2 {
    max-width: var(--w-text); /* 640px - tự định nghĩa width, không phụ thuộc wrapper */
    margin: 1.5rem auto 0.75rem;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    color: inherit;
    position: relative;
    padding-bottom: 1.75rem; /* Space for decorator */
  }
  
  /* H2 decorator - accent bar, follows text alignment */
  .dcms-article-content h2::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 72px;
    height: 10px;
    background-color: var(--secondary-600);
    display: block;
  }
  .dcms-article-content h2.text-center::after {
    left: 50%;
    transform: translateX(-50%);
  }
  .dcms-article-content h2.text-right::after {
    left: auto;
    right: 0;
  }
  
  .dcms-article-content h3 {
    max-width: var(--w-text); /* 640px - tự định nghĩa width, không phụ thuộc wrapper */
    margin: 1.5rem auto 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    color: inherit;
  }
  
  .dcms-article-content h4 {
    max-width: var(--w-text); /* 640px - tự định nghĩa width, không phụ thuộc wrapper */
    margin: 1.25rem auto 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    color: inherit;
  }
  
  .dcms-article-content h5,
  .dcms-article-content h6 {
    max-width: var(--w-text); /* 640px - tự định nghĩa width, không phụ thuộc wrapper */
    margin: 1rem auto 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.3;
    color: inherit;
  }
  
  /* ============================================
     END: TYPOGRAPHY - HEADINGS
     ============================================ */

  /* ============================================
     TEXT ALIGNMENT CLASSES
     Left is default (no class needed).
     ============================================ */

  .dcms-article-content .text-center  { text-align: center; }
  .dcms-article-content .text-right   { text-align: right; }
  .dcms-article-content .text-justify { text-align: justify; }

  /* ============================================
     END: TEXT ALIGNMENT CLASSES
     ============================================ */
  
  /* ============================================
     TYPOGRAPHY - LISTS
     ============================================ */
  
  .dcms-article-content ul,
  .dcms-article-content ol {
    max-width: var(--w-text); /* 640px - tự định nghĩa width, không phụ thuộc wrapper */
    margin: 0 auto 1rem;
    padding-left: 1.5rem;
  }
  
  .dcms-article-content ul {
    list-style-type: disc;
  }
  
  .dcms-article-content ol {
    list-style-type: decimal;
  }
  
  /* ============================================
     END: TYPOGRAPHY - LISTS
     ============================================ */
  
  /* ============================================
     TYPOGRAPHY - BLOCKQUOTE (Native)
     ============================================ */
  
  .dcms-article-content blockquote {
    max-width: var(--w-text); /* 640px - tự định nghĩa width, không phụ thuộc wrapper */
    margin: 1.5rem auto;
    padding: 1rem 1.5rem;
    border-left: 3px solid #ddd;
    background-color: #f9f9f9;
    font-style: italic;
    color: inherit;
  }
  
  /* ============================================
     END: TYPOGRAPHY - BLOCKQUOTE (Native)
     ============================================ */
  
  /* ============================================
     TYPOGRAPHY - HORIZONTAL RULE
     ============================================ */
  
  .dcms-article-content hr {
    max-width: var(--w-text); /* 640px - tự định nghĩa width, không phụ thuộc wrapper */
    margin: 2rem auto;
    border: none;
    border-top: 1px solid #ddd;
    height: 1px;
  }
  
  /* ============================================
     END: TYPOGRAPHY - HORIZONTAL RULE
     ============================================ */
  
  /* ============================================
     DROP CAP (sau thẻ H2/H3)
     ============================================ */
  
  /* Base rule – chỉ áp cho p ngay sau h2/h3 khi có .has-dropcap */
  .has-dropcap :is(h2, h3) + p::first-letter {
    font-weight: 600;
  }
  
  /* Modern browsers – ưu tiên initial-letter */
  @supports (initial-letter: 2) or (-webkit-initial-letter: 2) {
    .has-dropcap :is(h2, h3) + p::first-letter {
      initial-letter: 2;
      -webkit-initial-letter: 2;
      margin-right: 0.6rem;
      font-size: inherit;     /* dùng font-size của đoạn */
      line-height: inherit;   /* giữ baseline ổn định */
      float: none;
    }
  }
  
  /* Fallback cho Chrome chưa fully support initial-letter */
  @supports not (initial-letter: 2) {
    .has-dropcap :is(h2, h3) + p::first-letter {
      float: left;
      font-size: calc(1em * 2 * 1.05); /* ~2 dòng */
      line-height: 1;
      margin-right: 0.6rem;
    }
  }
  
  /* Responsive: Tắt dropcap trên mobile */
  @media (max-width: 767.98px) {
    .has-dropcap :is(h2, h3) + p::first-letter {
      initial-letter: normal !important;
      -webkit-initial-letter: initial !important;
      float: none !important;
      font-size: inherit !important;
      line-height: inherit !important;
      margin-right: 0 !important;
      font-weight: inherit !important;
    }
  }
  
  /* ============================================
     END: DROP CAP
     ============================================ */
  
  /* ============================================
     FIGURE/IMAGE STYLES - Base
     ============================================ */
  
  .dcms-article-content figure.dcms-object {
    margin: 1.5rem 0;
    display: block;
  }

  /* Smooth alignment transitions for all dcms-object blocks */
  .dcms-article-content .dcms-object {
    transition: max-width 0.3s ease, width 0.3s ease, margin-left 0.3s ease, margin-right 0.3s ease;
  }

  /* Non-floated dcms-objects clear preceding floats to prevent overlap.
     Without this, a centered figure wraps around a floated pull-quote,
     making both visually overlap and impossible to select independently. */
  .dcms-article-content .dcms-object:not([class*="align-float"]) {
    clear: both;
  }
  
  /* Image wrapper - transparent wrapper for front site (no behavior needed) */
  .dcms-article-content figure.dcms-object .dcms-image-wrapper {
    display: block;
  }
  
  /* Single image wrapper - full width */
  .dcms-article-content figure.dcms-object:not(.dcms-image-grid) .dcms-image-wrapper {
    width: 100%;
  }
  
  .dcms-article-content figure.dcms-object .dcms-image-wrapper img,
  .dcms-article-content figure.dcms-object img {
    width: 100%;
    height: auto;
    display: block;
  }
  
  /* ============================================
     END: FIGURE/IMAGE STYLES - Base
     ============================================ */
  
  /* ============================================
     FIGURE/IMAGE STYLES - Alignment
     ============================================ */
  
  /* Default (no align class) - Center, 640px */
  .dcms-article-content figure.dcms-object:not([class*="align-"]) {
    max-width: var(--w-text);
    margin-inline: auto;
  }
  
  /* Align Center - 640px */
  .dcms-article-content figure.dcms-object.align-center {
    float: none;
    max-width: var(--w-text);
    margin-inline: auto;
  }
  
  /* Wide Width - 960px (break out of 640px container using negative margins) */
  .dcms-article-content figure.dcms-object.align-wide {
    float: none;
    width: var(--w-wide); /* 960px */
    max-width: var(--w-wide);
    /* Negative margin to break out: (640px - 960px) / 2 = -160px each side */
    margin-left: calc((var(--w-text) - var(--w-wide)) / 2);
    margin-right: calc((var(--w-text) - var(--w-wide)) / 2);
  }
  
  /* Full Width - 100vw (break out to full viewport) */
  .dcms-article-content figure.dcms-object.align-full {
    float: none;
    width: 100vw;
    max-width: 100vw;
    /* Break out from 640px container to full viewport */
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }
  
  /* Float Left - Float trong cột text (không tràn) */
  .dcms-article-content figure.dcms-object.align-float-left {
    float: left;
    width: clamp(240px, 45%, calc(var(--w-text) * 0.5));
    margin: 0.25rem var(--gutter) 1rem 0;
    max-width: calc(var(--w-text) * 0.5);
  }
  
  /* Float Right - Float trong cột text (không tràn) */
  .dcms-article-content figure.dcms-object.align-float-right {
    float: right;
    width: clamp(240px, 45%, calc(var(--w-text) * 0.5));
    margin: 0.25rem 0 1rem var(--gutter);
    max-width: calc(var(--w-text) * 0.5);
  }
  
  /* Float Wide Left - Float left nhưng width = 480px (320px + 160px), tràn ra ngoài bên trái, text wrap bên phải */
  .dcms-article-content figure.dcms-object.align-float-wide-left {
    float: left;
    width: calc(var(--w-text) * 0.5 + (var(--w-wide) - var(--w-text)) * 0.5); /* 320px + 160px = 480px */
    max-width: calc(var(--w-text) * 0.5 + (var(--w-wide) - var(--w-text)) * 0.5);
    /* Tràn ra ngoài bên trái: margin-left âm để đẩy ảnh ra ngoài container 640px */
    margin-left: calc(-1 * ((var(--w-wide) - var(--w-text)) / 2)); /* -160px */
    margin-right: var(--gutter);
    margin-top: 0.25rem;
    margin-bottom: 1rem;
  }
  
  /* Float Wide Right - Float right nhưng width = 480px (320px + 160px), tràn ra ngoài bên phải, text wrap bên trái */
  .dcms-article-content figure.dcms-object.align-float-wide-right {
    float: right;
    width: calc(var(--w-text) * 0.5 + (var(--w-wide) - var(--w-text)) * 0.5); /* 320px + 160px = 480px */
    max-width: calc(var(--w-text) * 0.5 + (var(--w-wide) - var(--w-text)) * 0.5);
    /* Tràn ra ngoài bên phải: margin-right âm để đẩy ảnh ra ngoài container 640px */
    margin-right: calc(-1 * ((var(--w-wide) - var(--w-text)) / 2)); /* -160px */
    margin-left: var(--gutter);
    margin-top: 0.25rem;
    margin-bottom: 1rem;
  }

  /* Responsive: Float Wide → Float thường khi <=960px */
  @media (max-width: 960px) {
    .dcms-article-content figure.dcms-object.align-float-wide-left,
    .dcms-article-content figure.dcms-object.align-float-wide-right {
      width: clamp(240px, 45%, calc(var(--w-text) * 0.5));
      max-width: calc(var(--w-text) * 0.5);
    }
    .dcms-article-content figure.dcms-object.align-float-wide-left {
      margin-left: 0;
      margin-right: var(--gutter);
    }
    .dcms-article-content figure.dcms-object.align-float-wide-right {
      margin-right: 0;
      margin-left: var(--gutter);
    }
  }

  /* Responsive: Tất cả float stack dọc khi <=640px */
  @media (max-width: 640px) {
    .dcms-article-content figure.dcms-object.align-float-wide-left,
    .dcms-article-content figure.dcms-object.align-float-wide-right,
    .dcms-article-content figure.dcms-object.align-float-left,
    .dcms-article-content figure.dcms-object.align-float-right {
      float: none;
      width: 100%;
      max-width: 100%;
      margin-left: 0;
      margin-right: 0;
      margin-bottom: 1rem;
    }
  }

  /* ============================================
     END: FIGURE/IMAGE STYLES - Alignment
     ============================================ */
  
  /* ============================================
     FIGURE/IMAGE STYLES - Figcaption
     ============================================ */
  
  .dcms-article-content figure.dcms-object figcaption {
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--figcaption-color);
    text-align: center;
    line-height: 1.5;
    min-height: 2.5rem;
    position: relative;
  }
  
  /* Hide empty figcaption on site/preview */
  .dcms-article-content figure.dcms-object figcaption.empty {
    display: none;
  }
  
  /* Figcaption border bottom decoration - centered underline */
  .dcms-article-content figure.dcms-object figcaption::after {
    content: "";
    display: block;
    width: 320px;
    max-width: 80%;
    height: 1px;
    background-color: #d0d0d0;
    margin: 0.75rem auto 0;
  }
  
  /* Hide decoration for empty figcaption */
  .dcms-article-content figure.dcms-object figcaption.empty::after {
    display: none;
  }
  
  /* Limit figcaption input area to 960px max when align-full using padding */
  .dcms-article-content figure.dcms-object.align-full figcaption {
    padding-left: max(1rem, calc((100% - 960px) / 2));
    padding-right: max(1rem, calc((100% - 960px) / 2));
  }
  
  /* ============================================
     END: FIGURE/IMAGE STYLES - Figcaption
     ============================================ */
  
  /* ============================================
     IMAGE GRID STYLES (Masonry Layout)
     ============================================ */
  
/* Image Grid Container - Row-based masonry layout with grid-row structure */
.dcms-article-content figure.dcms-object.dcms-image-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1.5rem 0;
  max-width: var(--w-text);
  margin-inline: auto;
  align-items: flex-start;
  width: 100%;
}

/* Grid Content Wrapper - contains all grid-rows, enables easier photostory layout */
.dcms-article-content figure.dcms-object.dcms-image-grid > .grid-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

/* Grid Row - Each row contains images in flexbox */
/* Support both old structure (figure > .grid-row) and new structure (figure > .grid-content > .grid-row) */
.dcms-article-content figure.dcms-object.dcms-image-grid > .grid-row,
.dcms-article-content figure.dcms-object.dcms-image-grid > .grid-content > .grid-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: flex-start;
  width: 100%;
}

/* Grid row wrappers - dimensions set by JS with calc() */
.dcms-article-content figure.dcms-object.dcms-image-grid > .grid-row > .dcms-image-wrapper,
.dcms-article-content figure.dcms-object.dcms-image-grid > .grid-row > .image-grid-item-wrapper,
.dcms-article-content figure.dcms-object.dcms-image-grid > .grid-content > .grid-row > .dcms-image-wrapper,
.dcms-article-content figure.dcms-object.dcms-image-grid > .grid-content > .grid-row > .image-grid-item-wrapper {
  flex-grow: 0;
  flex-shrink: 0;
  /* width set inline by JS using calc() for responsive layout */
}

/* Grid images - 100% of wrapper width */
.dcms-article-content figure.dcms-object.dcms-image-grid > .grid-row > .dcms-image-wrapper img,
.dcms-article-content figure.dcms-object.dcms-image-grid > .grid-row > .image-grid-item-wrapper img,
.dcms-article-content figure.dcms-object.dcms-image-grid > .grid-row > img,
.dcms-article-content figure.dcms-object.dcms-image-grid > .grid-content > .grid-row > .dcms-image-wrapper img,
.dcms-article-content figure.dcms-object.dcms-image-grid > .grid-content > .grid-row > .image-grid-item-wrapper img,
.dcms-article-content figure.dcms-object.dcms-image-grid > .grid-content > .grid-row > img {
  display: block;
  object-fit: cover;
  width: 100%; /* 100% of wrapper width */
  height: auto;
  max-width: 100%;
}
  
  /* Legacy support: Grid images without grid-row (flat structure) */
  .dcms-article-content figure.dcms-object.dcms-image-grid > img {
    display: block;
    object-fit: cover;
    height: auto;
    max-width: 100%;
  }
  
  /* Grid figcaption - common caption for entire grid */
  .dcms-article-content figure.dcms-object.dcms-image-grid > figcaption {
    width: 100%; /* Force full width */
    flex-basis: 100%; /* Take full row in flexbox */
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--figcaption-color);
    text-align: center;
    line-height: 1.5;
    min-height: 2.5rem;
    position: relative;
  }
  
  /* Image grid figcaption - limit input area to 960px max when align-full */
  .dcms-article-content figure.dcms-object.dcms-image-grid.align-full > figcaption {
    padding-left: max(1rem, calc((100% - 960px) / 2));
    padding-right: max(1rem, calc((100% - 960px) / 2));
  }
  
  /* Wide Width - 960px (break out of 640px container) */
  .dcms-article-content figure.dcms-object.dcms-image-grid.align-wide {
    width: var(--w-wide); /* 960px */
    max-width: var(--w-wide);
    /* Negative margin to break out */
    margin-left: calc((var(--w-text) - var(--w-wide)) / 2);
    margin-right: calc((var(--w-text) - var(--w-wide)) / 2);
  }
  
  /* Full Width - 100vw (break out to full viewport) */
  .dcms-article-content figure.dcms-object.dcms-image-grid.align-full {
    width: 100vw;
    max-width: 100vw;
    /* Break out from 640px container to full viewport */
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }
  
  /* Responsive: On mobile, reset to simple grid */
  @media (max-width: 640px) {
    .dcms-article-content figure.dcms-object.dcms-image-grid > .grid-row {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 0.5rem;
    }
    
    .dcms-article-content figure.dcms-object.dcms-image-grid > .grid-row > img {
      width: 100% !important;
      height: auto !important;
    }
    
    /* Legacy support: flat structure */
    .dcms-article-content figure.dcms-object.dcms-image-grid > img {
      width: 100% !important;
      height: auto !important;
    }
  }
  
  /* ============================================
     END: IMAGE GRID STYLES
     ============================================ */
  
  /* ============================================
     VIDEO STYLES
     ============================================ */
  
  /* Aspect ratio wrapper for video - prevents layout shift */
  .dcms-article-content .dcms-video .dcms-aspect {
    width: 100%;
    position: relative;
    background-color: #000;
  }
  
  .dcms-article-content .dcms-video .dcms-aspect video {
    width: 100%;
    height: 100%;
    display: block;
    background-color: #000;
  }
  
  /* Video inherits figure alignment styles (align-center, align-wide, align-full) */
  /* No additional alignment needed as figure.dcms-object handles it */
  
  /* ============================================
     END: VIDEO STYLES
     ============================================ */
  
  /* ============================================
     PHOTOSTORY LAYOUT (Type 7)
     ============================================ */
  
/* Photostory: 2-column layout (ảnh + caption side-by-side) */
/* Tỷ lệ 3:1 - Ảnh chiếm 75%, Caption chiếm 25% */
/* Preferred width: 1280px, co giãn theo viewport */
/* max-width: calc(100vw - 2rem) giữ khoảng cách 1rem mỗi bên với viền */
.dcms-article-content figure.dcms-object.photostory-item,
.dcms-editor-content figure.dcms-object.photostory-item {
  display: flex !important;
  width: var(--w-wider) !important; /* 1280px */
  max-width: calc(100vw - 2rem) !important; /* Co giãn theo viewport, padding 1rem mỗi bên */
  margin-left: calc((var(--w-text) - min(var(--w-wider), calc(100vw - 2rem))) / 2) !important;
  margin-right: calc((var(--w-text) - min(var(--w-wider), calc(100vw - 2rem))) / 2) !important;
  gap: 0.5rem !important; /* Gap giữa image/grid-content và figcaption */
  align-items: flex-start !important;
  float: none !important; /* Override any float from previous alignment */
}
  
  /* Photostory Left: Ảnh bên trái (960px), Caption bên phải (320px) */
  .dcms-article-content figure.dcms-object.photostory-item.photostory-left,
  .dcms-editor-content figure.dcms-object.photostory-item.photostory-left {
    flex-direction: row !important;
  }
  
  /* Photostory Right: Caption bên trái (320px), Ảnh bên phải (960px) */
  .dcms-article-content figure.dcms-object.photostory-item.photostory-right,
  .dcms-editor-content figure.dcms-object.photostory-item.photostory-right {
    flex-direction: row-reverse !important;
  }
  
  /* Photostory: Image area (75% = 3 phần) - for single image */
  .dcms-article-content figure.dcms-object.photostory-item:not(.dcms-image-grid) .dcms-image-wrapper,
  .dcms-editor-content figure.dcms-object.photostory-item:not(.dcms-image-grid) .dcms-image-wrapper {
    flex: 3 1 0 !important; /* Tỷ lệ 3:1 với figcaption */
    min-width: 0 !important; /* Cho phép shrink */
  }
  
/* ============================================
   PHOTOSTORY IMAGE GRID - Desktop (min-width: 1025px)
   Dùng wrapper .grid-content cho flexbox layout đơn giản
   ============================================ */
@media (min-width: 1025px) {
  /* Figure photostory: flexbox row layout - 1280px */
  .dcms-article-content figure.dcms-object.photostory-item.dcms-image-grid,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-image-grid {
    display: flex !important;
    flex-direction: row !important;   /* Horizontal layout: grid-content + figcaption */
    flex-wrap: nowrap !important;
    width: var(--w-wider) !important;  /* 1280px */
    max-width: calc(100vw - 2rem) !important; /* Co giãn theo viewport, padding 1rem mỗi bên */
    margin-left: calc((var(--w-text) - min(var(--w-wider), calc(100vw - 2rem))) / 2) !important;
    margin-right: calc((var(--w-text) - min(var(--w-wider), calc(100vw - 2rem))) / 2) !important;
    /* gap: inherit từ image-grid base (0.5rem) - không override */
    align-items: flex-start !important;
  }

  /* Photostory-left: ảnh bên trái (mặc định), caption bên phải */
  .dcms-article-content figure.dcms-object.photostory-item.dcms-image-grid.photostory-left,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-image-grid.photostory-left {
    flex-direction: row !important;
  }

  /* Photostory-right: caption bên trái, ảnh bên phải */
  .dcms-article-content figure.dcms-object.photostory-item.dcms-image-grid.photostory-right,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-image-grid.photostory-right {
    flex-direction: row-reverse !important;
  }

  /* Grid Content Wrapper: chứa tất cả grid-rows, chiếm 75% (3 phần) */
  .dcms-article-content figure.dcms-object.photostory-item.dcms-image-grid > .grid-content,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-image-grid > .grid-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;           /* Gap giữa các grid-row */
    flex: 3 1 0 !important;           /* Tỷ lệ 3:1 với figcaption */
    min-width: 0 !important;          /* Cho phép shrink */
  }

  /* Grid-row trong photostory (có wrapper): full width của .grid-content */
  .dcms-article-content figure.dcms-object.photostory-item.dcms-image-grid > .grid-content > .grid-row,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-image-grid > .grid-content > .grid-row {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Fallback: Grid-row trực tiếp (cấu trúc cũ không có wrapper) */
  .dcms-article-content figure.dcms-object.photostory-item.dcms-image-grid > .grid-row,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-image-grid > .grid-row {
    flex: 3 1 0 !important; /* Tỷ lệ 3:1 với figcaption */
    min-width: 0 !important;
  }

  /* Figcaption cho photostory image-grid: 25% (1 phần), flexbox item */
  .dcms-article-content figure.dcms-object.photostory-item.dcms-image-grid > figcaption,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-image-grid > figcaption {
    flex: 1 1 0 !important;           /* Tỷ lệ 1:3 với grid-content */
    min-width: 0 !important;          /* Cho phép shrink */
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 1rem !important;       /* Chỉ padding left/right, bỏ top/bottom */
    font-size: 1rem !important;
    line-height: 1.880rem !important;
    color: #000 !important;           /* Black như bình thường */
    text-align: left !important;
    align-self: flex-start !important;
  }

  /* Decorator: left-aligned */
  .dcms-article-content figure.dcms-object.photostory-item.dcms-image-grid > figcaption::after,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-image-grid > figcaption::after {
    width: 240px !important;
    max-width: 75% !important;
    margin-left: 0 !important;
    margin-right: auto !important;
  }
}
  
  /* Photostory: Video area (75% = 3 phần) */
  .dcms-article-content figure.dcms-object.photostory-item.dcms-video .dcms-aspect,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-video .dcms-aspect {
    flex: 3 1 0 !important; /* Tỷ lệ 3:1 với figcaption */
    min-width: 0 !important; /* Cho phép shrink */
  }
  
/* Photostory: Caption area (25% = 1 phần) - chỉ cho single image/video, không áp dụng cho image-grid */
.dcms-article-content figure.dcms-object.photostory-item:not(.dcms-image-grid) > figcaption,
.dcms-editor-content figure.dcms-object.photostory-item:not(.dcms-image-grid) > figcaption {
  flex: 1 1 0 !important; /* Tỷ lệ 1:3 với image */
  min-width: 0 !important; /* Cho phép shrink */
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding: 0 1rem !important; /* Chỉ padding left/right, bỏ top/bottom */
  font-size: 1rem !important;
  line-height: 1.880rem !important;
  color: #000 !important; /* Black như bình thường */
  align-self: flex-start !important;
  text-align: left !important;
}
  
  /* Photostory: Figcaption decorator - left-aligned (chỉ cho single image/video) */
  .dcms-article-content figure.dcms-object.photostory-item:not(.dcms-image-grid) > figcaption::after,
  .dcms-editor-content figure.dcms-object.photostory-item:not(.dcms-image-grid) > figcaption::after {
    width: 240px !important;
    max-width: 75% !important;
    margin-left: 0 !important;
    margin-right: auto !important;
  }
  
  /* ============================================
     END: PHOTOSTORY LAYOUT
     ============================================ */
  
  /* ============================================
     INFO BOX STYLES
     ============================================ */
  
  .dcms-article-content .dcms-info-box {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border: 2px solid;
    /* Default color scheme: Yellow */
    background-color: #f8f6f0;
    border-color: #e7e2d4;
    color: #695f42;
  }
  
  /* InfoBox Color Schemes */
  .dcms-article-content .dcms-info-box[data-color-scheme="yellow"],
  .dcms-article-content .dcms-info-box:not([data-color-scheme]) {
    background-color: #f8f6f0;
    border-color: #e7e2d4;
    color: #695f42 !important; /* Override emagazine text color */
  }
  
  .dcms-article-content .dcms-info-box[data-color-scheme="gray"] {
    background-color: #f2f2f2;
    border-color: #ccc;
    color: #333 !important; /* Override emagazine text color */
  }
  
  .dcms-article-content .dcms-info-box[data-color-scheme="blue"] {
    background-color: #d9dfed;
    border-color: #839bd2;
    color: #333 !important; /* Override emagazine text color */
  }
  
  .dcms-article-content .dcms-info-box .info-box-content {
    margin: 0;
    min-height: 2rem;
    position: relative;
  }
  
  .dcms-article-content .dcms-info-box .info-box-content p {
    margin: 0.5rem 0;
  }
  
  .dcms-article-content .dcms-info-box .info-box-content p:first-child {
    margin-top: 0;
  }
  
  .dcms-article-content .dcms-info-box .info-box-content p:last-child {
    margin-bottom: 0;
  }
  
  /* InfoBox Content Placeholder */
  .dcms-article-content .dcms-info-box .info-box-content[placeholder].empty p:first-child:before {
    content: attr(placeholder);
    color: #999;
    font-style: italic;
    pointer-events: none;
    position: absolute;
    left: 0;
    top: 0;
  }
  
  .dcms-article-content .dcms-info-box .info-box-content[placeholder].empty p:first-child {
    position: relative;
    min-height: 1.5rem;
  }
  
  /* Default (no align class) - Center, 640px */
  .dcms-article-content .dcms-info-box:not([class*="align-"]) {
    max-width: var(--w-text);
    margin-inline: auto;
  }
  
  /* Align Center - 640px (same as default) */
  .dcms-article-content .dcms-info-box.align-center {
    max-width: var(--w-text);
    margin-inline: auto;
  }
  
  /* NOTE: InfoBox only supports align-center (640px) */
  /* No align-wide or align-full for infobox */
  
  /* ============================================
     END: INFO BOX STYLES
     ============================================ */
  
  /* ============================================
     BLOCKQUOTE OBJECT STYLES
     ============================================ */
  
  .dcms-article-content .dcms-blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 3px solid #ddd;
    background-color: #f9f9f9;
    color: inherit;
  }
  
  .dcms-article-content .dcms-blockquote .blockquote-content {
    margin: 0;
    min-height: 2rem;
    position: relative;
    font-style: italic;
  }
  
  .dcms-article-content .dcms-blockquote .blockquote-content p {
    margin: 0.5rem 0;
  }
  
  .dcms-article-content .dcms-blockquote .blockquote-content p:first-child {
    margin-top: 0;
  }
  
  .dcms-article-content .dcms-blockquote .blockquote-content p:last-child {
    margin-bottom: 0;
  }
  
  /* Blockquote Content Placeholder */
  .dcms-article-content .dcms-blockquote .blockquote-content[placeholder].empty p:first-child:before {
    content: attr(placeholder);
    color: #999;
    font-style: italic;
    pointer-events: none;
    position: absolute;
    left: 0;
    top: 0;
  }
  
  .dcms-article-content .dcms-blockquote .blockquote-content[placeholder].empty p:first-child {
    position: relative;
    min-height: 1.5rem;
  }
  
  /* Default (no align class) - Center, 640px */
  .dcms-article-content .dcms-blockquote:not([class*="align-"]) {
    max-width: var(--w-text);
    margin-inline: auto;
  }
  
  /* Align Center - 640px (same as default) */
  .dcms-article-content .dcms-blockquote.align-center {
    max-width: var(--w-text);
    margin-inline: auto;
  }
  
  /* NOTE: Blockquote only supports align-center (640px) */
  /* No align-wide or align-full for blockquote */
  
  .dcms-article-content .dcms-blockquote {
    color: #333 !important; /* Blockquote uses default text color, not emagazine color */
  }
  
  .dcms-article-content .dcms-blockquote * {
    color: inherit !important; /* Children inherit from blockquote parent (#333) */
  }
  
  /* ============================================
     END: BLOCKQUOTE OBJECT STYLES
     ============================================ */

  /* ============================================
     PULL QUOTE STYLES
     ============================================ */

  .dcms-article-content .dcms-pull-quote,
  .dcms-editor-content .dcms-pull-quote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    border-top: 3px solid #333;
    border-bottom: 3px solid #333;
    text-align: center;
    color: #333;
  }

  .dcms-article-content .dcms-pull-quote .pull-quote-content,
  .dcms-editor-content .dcms-pull-quote .pull-quote-content {
    margin: 0;
    min-height: 2rem;
    position: relative;
    font-size: 1.25rem;
    font-weight: 500;
    font-style: italic;
    line-height: 1.6;
  }

  .dcms-article-content .dcms-pull-quote .pull-quote-content p,
  .dcms-editor-content .dcms-pull-quote .pull-quote-content p {
    margin: 0.5rem 0;
  }

  .dcms-article-content .dcms-pull-quote .pull-quote-content p:first-child,
  .dcms-editor-content .dcms-pull-quote .pull-quote-content p:first-child {
    margin-top: 0;
  }

  .dcms-article-content .dcms-pull-quote .pull-quote-content p:last-child,
  .dcms-editor-content .dcms-pull-quote .pull-quote-content p:last-child {
    margin-bottom: 0;
  }

  /* Pull Quote Placeholder */
  .dcms-article-content .dcms-pull-quote .pull-quote-content[data-placeholder].empty p:first-child:before,
  .dcms-editor-content .dcms-pull-quote .pull-quote-content[data-placeholder].empty p:first-child:before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
    font-weight: 400;
    font-size: 1rem;
    position: absolute;
    pointer-events: none;
    top: 0;
  }

  .dcms-article-content .dcms-pull-quote .pull-quote-content[data-placeholder].empty p:first-child,
  .dcms-editor-content .dcms-pull-quote .pull-quote-content[data-placeholder].empty p:first-child {
    position: relative;
    min-height: 1.5rem;
  }

  /* Pull Quote Alignment */
  .dcms-article-content .dcms-pull-quote:not([class*="align-"]),
  .dcms-article-content .dcms-pull-quote.align-center {
    max-width: var(--w-text);
    margin-inline: auto;
  }

  /* Exclude pull quote from eMagazine text color */
  .dcms-article-content .dcms-pull-quote {
    color: #333 !important;
  }

  .dcms-article-content .dcms-pull-quote * {
    color: inherit !important;
  }

  /* --- Pull Quote: Alignment Support --- */

  .dcms-article-content .dcms-pull-quote.align-wide {
    width: var(--w-wide);
    max-width: var(--w-wide);
    margin-left: calc((var(--w-text) - var(--w-wide)) / 2);
    margin-right: calc((var(--w-text) - var(--w-wide)) / 2);
  }

  .dcms-article-content .dcms-pull-quote.align-full {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .dcms-article-content .dcms-pull-quote.align-float-left {
    float: left;
    width: clamp(240px, 45%, calc(var(--w-text) * 0.5));
    max-width: calc(var(--w-text) * 0.5);
    margin: 0.25rem var(--gutter) 1rem 0;
    text-align: left;
  }

  .dcms-article-content .dcms-pull-quote.align-float-right {
    float: right;
    width: clamp(240px, 45%, calc(var(--w-text) * 0.5));
    max-width: calc(var(--w-text) * 0.5);
    margin: 0.25rem 0 1rem var(--gutter);
    text-align: left;
  }

  .dcms-article-content .dcms-pull-quote.align-float-wide-left {
    float: left;
    width: calc(var(--w-text) * 0.5 + (var(--w-wide) - var(--w-text)) * 0.5);
    max-width: calc(var(--w-text) * 0.5 + (var(--w-wide) - var(--w-text)) * 0.5);
    margin-left: calc(-1 * ((var(--w-wide) - var(--w-text)) / 2));
    margin-right: var(--gutter);
    margin-top: 0.25rem;
    margin-bottom: 1rem;
    text-align: left;
  }

  .dcms-article-content .dcms-pull-quote.align-float-wide-right {
    float: right;
    width: calc(var(--w-text) * 0.5 + (var(--w-wide) - var(--w-text)) * 0.5);
    max-width: calc(var(--w-text) * 0.5 + (var(--w-wide) - var(--w-text)) * 0.5);
    margin-right: calc(-1 * ((var(--w-wide) - var(--w-text)) / 2));
    margin-left: var(--gutter);
    margin-top: 0.25rem;
    margin-bottom: 1rem;
    text-align: left;
  }

  /* --- Pull Quote: Design Variants --- */

  /* pq-classic = default (border-top + border-bottom), no extra class needed */

  /* Left Border variant */
  .dcms-article-content .dcms-pull-quote.pq-left-border,
  .dcms-editor-content .dcms-pull-quote.pq-left-border {
    border-top: none;
    border-bottom: none;
    border-left: 4px solid #333;
    text-align: left;
    padding: 1rem 1.5rem;
    background: #f9fafb;
  }

  /* Quote Marks variant */
  .dcms-article-content .dcms-pull-quote.pq-quote-marks,
  .dcms-editor-content .dcms-pull-quote.pq-quote-marks {
    border-top: none;
    border-bottom: none;
    padding: 2rem 2rem 1.5rem;
    position: relative;
  }

  .dcms-article-content .dcms-pull-quote.pq-quote-marks::before,
  .dcms-editor-content .dcms-pull-quote.pq-quote-marks::before {
    content: '\201C';
    font-size: 4rem;
    line-height: 1;
    color: #d1d5db;
    position: absolute;
    top: 0;
    left: 0.5rem;
    font-family: Georgia, serif;
  }

  .dcms-article-content .dcms-pull-quote.pq-quote-marks .pull-quote-content,
  .dcms-editor-content .dcms-pull-quote.pq-quote-marks .pull-quote-content {
    padding-left: 1.5rem;
  }

  /* Highlight variant */
  .dcms-article-content .dcms-pull-quote.pq-highlight,
  .dcms-editor-content .dcms-pull-quote.pq-highlight {
    border-top: none;
    border-bottom: none;
    background: #fef3c7;
    border-radius: 0.5rem;
    padding: 1.5rem 2rem;
    color: #92400e !important;
  }

  .dcms-article-content .dcms-pull-quote.pq-highlight * {
    color: inherit !important;
  }

  /* Minimal variant */
  .dcms-article-content .dcms-pull-quote.pq-minimal,
  .dcms-editor-content .dcms-pull-quote.pq-minimal {
    border-top: none;
    border-bottom: none;
    padding: 1rem 0;
  }

  .dcms-article-content .dcms-pull-quote.pq-minimal .pull-quote-content,
  .dcms-editor-content .dcms-pull-quote.pq-minimal .pull-quote-content {
    font-size: 1.5rem;
    font-weight: 600;
    font-style: normal;
    line-height: 1.4;
  }

  /* ============================================
     END: PULL QUOTE STYLES
     ============================================ */

  /* ============================================
     CODE BLOCK STYLES
     ============================================ */

  .dcms-article-content .dcms-code-block,
  .dcms-editor-content .dcms-code-block {
    margin: 1.5rem 0;
    border-radius: 6px;
    overflow: hidden;
  }

  .dcms-article-content .dcms-code-block pre.code-block-content,
  .dcms-editor-content .dcms-code-block pre.code-block-content {
    margin: 0;
    padding: 1rem 1.25rem;
    background-color: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
    tab-size: 4;
    min-height: 3rem;
    position: relative;
  }

  .dcms-article-content .dcms-code-block pre.code-block-content code,
  .dcms-editor-content .dcms-code-block pre.code-block-content code {
    font-family: inherit;
    font-size: inherit;
    background: none;
    padding: 0;
    border: none;
    color: inherit;
    display: block;
    min-height: 1.4em;
  }

  /* Code Block Placeholder */
  .dcms-editor-content .dcms-code-block pre.code-block-content[data-placeholder] code:empty:before {
    content: attr(data-placeholder);
    color: #666;
    font-style: italic;
    pointer-events: none;
  }

  /* Code Block Alignment */
  .dcms-article-content .dcms-code-block:not([class*="align-"]),
  .dcms-article-content .dcms-code-block.align-center {
    max-width: var(--w-text);
    margin-inline: auto;
  }

  .dcms-article-content .dcms-code-block.align-wide {
    width: var(--w-wide);
    max-width: var(--w-wide);
    margin-left: calc((var(--w-text) - var(--w-wide)) / 2);
    margin-right: calc((var(--w-text) - var(--w-wide)) / 2);
  }

  .dcms-article-content .dcms-code-block.align-full {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }

  /* ============================================
     END: CODE BLOCK STYLES
     ============================================ */

  /* ============================================
     TABLE STYLES
     ============================================ */

  .dcms-article-content .dcms-table,
  .dcms-editor-content .dcms-table {
    margin: 1.5rem 0;
    overflow-x: auto;
  }

  .dcms-article-content .dcms-table table,
  .dcms-editor-content .dcms-table table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #d1d5db;
    font-size: 0.9375rem;
  }

  .dcms-article-content .dcms-table th,
  .dcms-editor-content .dcms-table th {
    padding: 0.625rem 0.75rem;
    border: 1px solid #d1d5db;
    background-color: #f3f4f6;
    font-weight: 600;
    text-align: left;
    min-width: 80px;
  }

  .dcms-article-content .dcms-table td,
  .dcms-editor-content .dcms-table td {
    padding: 0.625rem 0.75rem;
    border: 1px solid #d1d5db;
    min-width: 80px;
    vertical-align: top;
  }

  .dcms-article-content .dcms-table tr:hover td,
  .dcms-editor-content .dcms-table tr:hover td {
    background-color: #f9fafb;
  }

  /* Table Alignment */
  .dcms-article-content .dcms-table:not([class*="align-"]),
  .dcms-article-content .dcms-table.align-center {
    max-width: var(--w-text);
    margin-inline: auto;
  }

  .dcms-article-content .dcms-table.align-wide {
    width: var(--w-wide);
    max-width: var(--w-wide);
    margin-left: calc((var(--w-text) - var(--w-wide)) / 2);
    margin-right: calc((var(--w-text) - var(--w-wide)) / 2);
  }

  .dcms-article-content .dcms-table.align-full {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }

  /* Exclude table from eMagazine text color */
  .dcms-article-content .dcms-table {
    color: #333 !important;
  }

  .dcms-article-content .dcms-table * {
    color: inherit !important;
  }

  /* ============================================
     END: TABLE STYLES
     ============================================ */

  /* ============================================
     EMBED URL STYLES
     ============================================ */

  .dcms-article-content .dcms-embed,
  .dcms-editor-content .dcms-embed {
    margin: 1.5rem 0;
  }

  .dcms-article-content .dcms-embed .embed-responsive,
  .dcms-editor-content .dcms-embed .embed-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 0;
    background-color: #000;
  }

  .dcms-article-content .dcms-embed .embed-responsive iframe,
  .dcms-editor-content .dcms-embed .embed-responsive iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
  }


  /* Embed Alignment */
  .dcms-article-content .dcms-embed:not([class*="align-"]),
  .dcms-article-content .dcms-embed.align-center {
    max-width: var(--w-text);
    margin-inline: auto;
  }

  .dcms-article-content .dcms-embed.align-wide {
    width: var(--w-wide);
    max-width: var(--w-wide);
    margin-left: calc((var(--w-text) - var(--w-wide)) / 2);
    margin-right: calc((var(--w-text) - var(--w-wide)) / 2);
  }

  .dcms-article-content .dcms-embed.align-full {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }

  /* ============================================
     END: EMBED URL STYLES
     ============================================ */

  /* ============================================
     RESPONSIVE STYLES - PHOTOSTORY (1024px and below)
     Stack vertically when viewport < 1024px
     ============================================ */
  
  @media (max-width: 1024px) {
    /* ============================================
       RESPONSIVE 1024px: PHOTOSTORY LAYOUT
       ============================================ */
    
    /* Photostory - Stack vertically when viewport < 1280px */
    .dcms-article-content figure.dcms-object.photostory-item,
    .dcms-editor-content figure.dcms-object.photostory-item {
      display: flex !important;
      flex-direction: column !important;
      width: 100% !important;
      max-width: 100% !important;
      margin-left: 0 !important;
      margin-right: 0 !important;
      gap: 0 !important;
    }
    
    /* Override photostory-left and photostory-right to force vertical stack */
    .dcms-article-content figure.dcms-object.photostory-item.photostory-left,
    .dcms-article-content figure.dcms-object.photostory-item.photostory-right,
    .dcms-editor-content figure.dcms-object.photostory-item.photostory-left,
    .dcms-editor-content figure.dcms-object.photostory-item.photostory-right {
      flex-direction: column !important;
    }
    
    /* Photostory - Image wrapper full width */
    .dcms-article-content figure.dcms-object.photostory-item:not(.dcms-image-grid) .dcms-image-wrapper,
    .dcms-editor-content figure.dcms-object.photostory-item:not(.dcms-image-grid) .dcms-image-wrapper {
      flex: 1 1 100% !important;
      max-width: 100% !important;
      width: 100% !important;
    }
    
    /* Photostory - Video full width */
    .dcms-article-content figure.dcms-object.photostory-item.dcms-video .dcms-aspect,
    .dcms-editor-content figure.dcms-object.photostory-item.dcms-video .dcms-aspect {
      flex: 1 1 100% !important;
      max-width: 100% !important;
      width: 100% !important;
    }
    
  /* Photostory Single Image - Caption below, full width (specificity cao hơn desktop rule) */
  .dcms-article-content figure.dcms-object.photostory-item:not(.dcms-image-grid) > figcaption,
  .dcms-editor-content figure.dcms-object.photostory-item:not(.dcms-image-grid) > figcaption {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 1.5rem 0 !important; /* Padding top/bottom 1.5rem, bỏ left/right */
    font-size: 1rem !important;
    line-height: 1.880rem !important;
    color: #000 !important;
    text-align: left !important;
    align-self: auto !important;
  }
  
  /* Photostory - Caption decorator left-aligned khi responsive */
  .dcms-article-content figure.dcms-object.photostory-item:not(.dcms-image-grid) > figcaption::after,
  .dcms-editor-content figure.dcms-object.photostory-item:not(.dcms-image-grid) > figcaption::after {
    margin-left: 0 !important;
    margin-right: auto !important;
  }
    
  /* Photostory Image Grid - Reset to vertical stack */
  .dcms-article-content figure.dcms-object.photostory-item.dcms-image-grid,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-image-grid {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
  }

  /* Photostory Image Grid - Grid Content Wrapper full width */
  .dcms-article-content figure.dcms-object.photostory-item.dcms-image-grid > .grid-content,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-image-grid > .grid-content {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Photostory Image Grid - Grid rows full width (cả 2 cấu trúc: có wrapper và không có wrapper) */
  .dcms-article-content figure.dcms-object.photostory-item.dcms-image-grid > .grid-row,
  .dcms-article-content figure.dcms-object.photostory-item.dcms-image-grid > .grid-content > .grid-row,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-image-grid > .grid-row,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-image-grid > .grid-content > .grid-row {
    grid-column: auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Photostory Image Grid - Caption below all images (giống single image) */
  .dcms-article-content figure.dcms-object.photostory-item.dcms-image-grid > figcaption,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-image-grid > figcaption {
    grid-column: auto !important;
    grid-row: auto !important;
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 1.5rem 0 !important; /* Padding top/bottom 1.5rem, bỏ left/right */
    font-size: 1rem !important;
    line-height: 1.880rem !important;
    color: #000 !important;
    text-align: left !important;
  }

  /* Photostory Image Grid - Caption decorator left-aligned khi responsive */
  .dcms-article-content figure.dcms-object.photostory-item.dcms-image-grid > figcaption::after,
  .dcms-editor-content figure.dcms-object.photostory-item.dcms-image-grid > figcaption::after {
    margin-left: 0 !important;
    margin-right: auto !important;
  }
    
    /* ============================================
       END: RESPONSIVE 1024px: PHOTOSTORY LAYOUT
       ============================================ */
  }
  
  /* ============================================
     END: RESPONSIVE STYLES - PHOTOSTORY (1024px)
     ============================================ */
  
  /* ============================================
     RESPONSIVE STYLES (Tablet - 960px and below)
     ============================================ */
  
  @media (max-width: 960px) {
    /* ============================================
       RESPONSIVE 960px: FIGURE ALIGNMENT
       ============================================ */
    
    /* Wide/Full Width - Break out to full viewport width when < 960px */
    .dcms-article-content figure.dcms-object.align-wide,
    .dcms-article-content figure.dcms-object.align-full {
      width: 100vw !important;
      max-width: 100vw !important;
      /* Break out from 640px container to full viewport */
      margin-left: calc(50% - 50vw) !important;
      margin-right: calc(50% - 50vw) !important;
    }
    
    /* Embed Wide/Full - Break out to full viewport width when < 960px */
    .dcms-article-content .dcms-embed.align-wide,
    .dcms-article-content .dcms-embed.align-full {
      width: 100vw !important;
      max-width: 100vw !important;
      margin-left: calc(50% - 50vw) !important;
      margin-right: calc(50% - 50vw) !important;
    }

    /* ============================================
       END: RESPONSIVE 960px: FIGURE ALIGNMENT
       ============================================ */

    /* ============================================
       RESPONSIVE 960px: IMAGE GRID
       ============================================ */
    
    /* Image Grid Wide/Full - Break out to full viewport width */
    .dcms-article-content figure.dcms-object.dcms-image-grid.align-wide,
    .dcms-article-content figure.dcms-object.dcms-image-grid.align-full {
      width: 100vw !important;
      max-width: 100vw !important;
      /* Break out from 640px container to full viewport */
      margin-left: calc(50% - 50vw) !important;
      margin-right: calc(50% - 50vw) !important;
    }
    
    /* ============================================
       END: RESPONSIVE 960px: IMAGE GRID
       ============================================ */
  }
  
  /* ============================================
     END: RESPONSIVE STYLES (Tablet - 960px)
     ============================================ */
  
  /* ============================================
     RESPONSIVE STYLES (Mobile - 768px and below)
     ============================================ */
  
  @media (max-width: 768px) {
    /* ============================================
       RESPONSIVE: CONTAINER
       ============================================ */
    
    /* ============================================
       RESPONSIVE: TEXT ELEMENTS WIDTH
       ============================================ */
    
    /* Reset all text elements to full width for mobile readability */
    .dcms-article-content p,
    .dcms-article-content h1,
    .dcms-article-content h2,
    .dcms-article-content h3,
    .dcms-article-content h4,
    .dcms-article-content h5,
    .dcms-article-content h6,
    .dcms-article-content ul,
    .dcms-article-content ol,
    .dcms-article-content blockquote,
    .dcms-article-content hr {
      max-width: 100%;
    }
    
    /* Reset info box, blockquote, and other block objects to full width */
    .dcms-article-content .dcms-info-box:not([class*="align-"]),
    .dcms-article-content .dcms-info-box.align-center,
    .dcms-article-content .dcms-blockquote:not([class*="align-"]),
    .dcms-article-content .dcms-blockquote.align-center,
    .dcms-article-content .dcms-pull-quote:not([class*="align-"]),
    .dcms-article-content .dcms-pull-quote.align-center,
    .dcms-article-content .dcms-pull-quote.align-wide,
    .dcms-article-content .dcms-pull-quote.align-full,
    .dcms-article-content .dcms-code-block:not([class*="align-"]),
    .dcms-article-content .dcms-code-block.align-center,
    .dcms-article-content .dcms-table:not([class*="align-"]),
    .dcms-article-content .dcms-table.align-center,
    .dcms-article-content .dcms-embed:not([class*="align-"]),
    .dcms-article-content .dcms-embed.align-center {
      max-width: 100%;
    }
    
    /* ============================================
       END: RESPONSIVE: TEXT ELEMENTS WIDTH
       ============================================ */
    
    /* ============================================
       RESPONSIVE: FIGURE ALIGNMENT
       ============================================ */
    
    /* Figure alignment - reset all alignments on mobile */
    .dcms-article-content figure.dcms-object.align-wide,
    .dcms-article-content figure.dcms-object.align-full,
    .dcms-article-content figure.dcms-object.align-center {
      max-width: 100%;
      width: 100%;
      margin-left: 0;
      margin-right: 0;
    }
    
    /* Float Wide responsive rules moved to after desktop rules (near line 534) —
       Vite/lightningCSS drops them when placed in nested @media blocks */

    /* Block objects alignment - reset wide/full on mobile */
    .dcms-article-content .dcms-code-block.align-wide,
    .dcms-article-content .dcms-code-block.align-full,
    .dcms-article-content .dcms-table.align-wide,
    .dcms-article-content .dcms-table.align-full,
    .dcms-article-content .dcms-embed.align-wide,
    .dcms-article-content .dcms-embed.align-full {
      max-width: 100%;
      width: 100%;
      margin-left: 0;
      margin-right: 0;
    }

    /* Disable alignment transition on mobile (avoid layout shift) */
    .dcms-article-content .dcms-object {
      transition: none;
    }

    /* ============================================
       END: RESPONSIVE: FIGURE ALIGNMENT
       ============================================ */
    
    /* ============================================
       RESPONSIVE: IMAGE GRID
       ============================================ */
    
    /* Image grid - reset to full width on tablet/mobile */
    .dcms-article-content figure.dcms-object.dcms-image-grid.align-wide,
    .dcms-article-content figure.dcms-object.dcms-image-grid.align-full {
      max-width: 100%;
      width: 100%;
      margin-left: 0;
      margin-right: 0;
    }
    
    /* ============================================
       END: RESPONSIVE: IMAGE GRID
       ============================================ */
    
    /* NOTE: Photostory responsive is handled at 1024px breakpoint above */
    
    /* ============================================
       RESPONSIVE: TYPOGRAPHY
       ============================================ */
    
    /* Typography - reduce heading sizes */
    .dcms-article-content h1 {
      font-size: 1.75rem;
    }
    
    .dcms-article-content h2 {
      font-size: 1.5rem;
    }
    
    .dcms-article-content h3 {
      font-size: 1.25rem;
    }
    
    /* ============================================
       END: RESPONSIVE: TYPOGRAPHY
       ============================================ */
  }
  
  /* ============================================
     END: RESPONSIVE STYLES
     ============================================ */

  /* ============================================
     RESPONSIVE STYLES (640px)
     Tất cả figure (none, center, wide, full) → full width
     ============================================ */

  @media (max-width: 640px) {
    .dcms-article-content figure.dcms-object.align-center,
    .dcms-article-content figure.dcms-object.align-wide,
    .dcms-article-content figure.dcms-object.align-full,
    .dcms-article-content .dcms-embed.align-center,
    .dcms-article-content .dcms-embed.align-wide,
    .dcms-article-content .dcms-embed.align-full {
      width: 100vw !important;
      max-width: 100vw !important;
      margin-left: calc(50% - 50vw) !important;
      margin-right: calc(50% - 50vw) !important;
    }

    /* Float responsive rules moved to after desktop rules (near line 534) */
  }

/* ============================================
   TABLE OF CONTENTS (TOC)
   Shared between editor and frontend
   ============================================ */

/* Base TOC — block centered at text width (align-center / align-none) */
.dcms-article-content .dcms-toc {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0;
    padding: 20px 24px;
    font-size: 0.875rem;
    line-height: 1.7;
    max-width: var(--w-text, 640px);
    margin: 1.5rem auto;
}

/* Float variants — compact 280px */
.dcms-article-content .dcms-toc[class*="align-float"] {
    max-width: 280px;
    margin-left: 0;
    margin-right: 0;
    padding: 16px 18px;
}

/* --- TOC Header --- */
.dcms-toc .toc-header {
    font-weight: 700;
    font-size: 0.9375rem;
    color: #1f2937;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

/* --- TOC List — numbered with CSS counters --- */
.dcms-toc .toc-nav { margin: 0; }

.dcms-toc .toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: toc-h2;
}

/* H2 items — numbered: 1. 2. 3. */
.dcms-toc .toc-item.toc-level-2 {
    counter-increment: toc-h2;
    counter-reset: toc-h3;
    margin: 0;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
}
.dcms-toc .toc-item.toc-level-2:last-child {
    border-bottom: none;
}
.dcms-toc .toc-item.toc-level-2 > a::before {
    content: counter(toc-h2) ". ";
    font-weight: 600;
    color: #6b7280;
}

/* H3 items — sub-numbered: 1.1  1.2 */
.dcms-toc .toc-item.toc-level-3 {
    counter-increment: toc-h3;
    counter-reset: toc-h4;
    padding: 3px 0 3px 20px;
    margin: 0;
    border-bottom: none;
}
.dcms-toc .toc-item.toc-level-3 > a::before {
    content: counter(toc-h2) "." counter(toc-h3) "  ";
    color: #9ca3af;
    font-size: 0.8125rem;
}

/* H4 items — deeper indent with dash */
.dcms-toc .toc-item.toc-level-4 {
    counter-increment: toc-h4;
    padding: 2px 0 2px 40px;
    margin: 0;
    border-bottom: none;
}
.dcms-toc .toc-item.toc-level-4 > a::before {
    content: "– ";
    color: #d1d5db;
}

/* --- TOC Links --- */
.dcms-toc .toc-item a {
    color: #374151;
    text-decoration: none;
    transition: color 0.15s;
}
.dcms-toc .toc-item a:hover {
    color: var(--secondary-600, #d0011c);
}
.dcms-toc .toc-level-2 a {
    font-weight: 500;
}
.dcms-toc .toc-level-3 a {
    font-size: 0.8125rem;
    color: #4b5563;
}
.dcms-toc .toc-level-4 a {
    font-size: 0.75rem;
    color: #6b7280;
}
.dcms-toc .toc-empty {
    color: #9ca3af;
    font-style: italic;
    margin: 0;
}

/* --- TOC Style Variants --- */

/* Bordered: left accent border, subtle background */
.dcms-toc.toc-bordered {
    background: #f8fafc;
    border: none;
    border-left: 4px solid var(--secondary-600, #d0011c);
}
.dcms-toc.toc-bordered .toc-header {
    color: var(--secondary-600, #d0011c);
    border-bottom-color: #e2e8f0;
}

/* Clean: no background, minimal */
.dcms-toc.toc-clean {
    background: transparent;
    border: none;
    padding-left: 0;
    padding-right: 0;
}
.dcms-toc.toc-clean .toc-header {
    border-bottom: 2px solid #e5e7eb;
}
.dcms-toc.toc-clean .toc-item.toc-level-2 {
    border-bottom-color: #f3f4f6;
}

/* Shadow: white card with shadow */
.dcms-toc.toc-shadow {
    background: #ffffff;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 14px rgba(0, 0, 0, 0.04);
}
.dcms-toc.toc-shadow .toc-header {
    border-bottom-color: #f3f4f6;
}

/* Accent: accent color header bar on top */
.dcms-toc.toc-accent {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-top: 3px solid var(--secondary-600, #d0011c);
}
.dcms-toc.toc-accent .toc-header {
    color: var(--secondary-600, #d0011c);
}

/* --- TOC Float Alignments --- */
.dcms-article-content .dcms-toc.align-float-left {
    float: left;
    margin: 0.25rem var(--gutter) 1rem 0;
}
.dcms-article-content .dcms-toc.align-float-right {
    float: right;
    margin: 0.25rem 0 1rem var(--gutter);
}
.dcms-article-content .dcms-toc.align-float-wide-left {
    float: left;
    margin-left: calc((var(--w-wide) - var(--w-text)) / -2);
    margin-right: var(--gutter);
    margin-top: 0.25rem;
    margin-bottom: 1rem;
}
.dcms-article-content .dcms-toc.align-float-wide-right {
    float: right;
    margin-right: calc((var(--w-wide) - var(--w-text)) / -2);
    margin-left: var(--gutter);
    margin-top: 0.25rem;
    margin-bottom: 1rem;
}

/* TOC: Responsive - float-wide thu về float thường khi <= 960px */
@media (max-width: 960px) {
    .dcms-article-content .dcms-toc.align-float-wide-left {
        margin-left: 0;
        margin-right: var(--gutter);
    }
    .dcms-article-content .dcms-toc.align-float-wide-right {
        margin-right: 0;
        margin-left: var(--gutter);
    }
}

/* TOC: Responsive - tất cả float stack dọc khi <= 640px */
@media (max-width: 640px) {
    .dcms-article-content .dcms-toc.align-float-wide-left,
    .dcms-article-content .dcms-toc.align-float-wide-right,
    .dcms-article-content .dcms-toc.align-float-left,
    .dcms-article-content .dcms-toc.align-float-right {
        float: none;
        max-width: 100%;
        margin: 1rem 0;
    }
}

/* Frontend: smooth scroll for anchor links */
html { scroll-behavior: smooth; }

/* ============================================
   END: TABLE OF CONTENTS (TOC)
   ============================================ */

/* ============================================
   ARTICLE REFERENCE BLOCK (Type 2 Inline)
   Card height is locked to the thumb's 3:2 aspect ratio.
   Content is absolutely positioned and clips to that height.
   ============================================ */

/* --- Base wrapper --- */
.dcms-article-content .dcms-article-ref,
.dcms-editor-content .dcms-article-ref {
  margin: 1.5rem auto;
  max-width: var(--w-text, 640px);
}

/* --- Card container: block + relative. Only the thumb is in flow,
   so the card height = thumb height. Content is absolute. --- */
.dcms-article-content .dcms-article-ref-card,
.dcms-editor-content .dcms-article-ref-card {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 0;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
}

.dcms-article-content .dcms-article-ref-card:hover,
.dcms-editor-content .dcms-article-ref-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 6px 20px rgba(0, 0, 0, 0.06);
}

.dcms-article-content a.dcms-article-ref-card {
  cursor: pointer;
}

/* --- Thumbnail: block, 3:2 — the only in-flow child, defines card height --- */
.dcms-article-content .dcms-article-ref-thumb,
.dcms-editor-content .dcms-article-ref-thumb {
  display: block;
  width: 160px;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: center;
  background: #f3f4f6;
}

/* --- Content: absolute, pinned beside thumb, clips to card height --- */
.dcms-article-content .dcms-article-ref-content,
.dcms-editor-content .dcms-article-ref-content {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 160px;
  right: 0;
  overflow: hidden;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
}

/* --- Label --- */
.dcms-article-content .dcms-article-ref-label,
.dcms-editor-content .dcms-article-ref-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  flex-shrink: 0;
}

/* --- Title: word-boundary truncation --- */
.dcms-article-content .dcms-article-ref-title,
.dcms-editor-content .dcms-article-ref-title {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: normal;
  overflow-wrap: break-word;
}

/* --- Excerpt: hidden by default (shown only in vertical) --- */
.dcms-article-content .dcms-article-ref-excerpt,
.dcms-editor-content .dcms-article-ref-excerpt {
  display: none;
}

/* ---- Alignment: Float Left/Right ---- */
.dcms-article-content .dcms-article-ref.align-float-left,
.dcms-editor-content .dcms-article-ref.align-float-left {
  float: left;
  width: clamp(280px, 50%, 360px);
  margin: 0.25rem var(--gutter, 16px) 1rem 0;
}

.dcms-article-content .dcms-article-ref.align-float-right,
.dcms-editor-content .dcms-article-ref.align-float-right {
  float: right;
  width: clamp(280px, 50%, 360px);
  margin: 0.25rem 0 1rem var(--gutter, 16px);
}

.dcms-article-content .dcms-article-ref[class*="align-float"] .dcms-article-ref-thumb,
.dcms-editor-content .dcms-article-ref[class*="align-float"] .dcms-article-ref-thumb {
  width: 100px;
}

.dcms-article-content .dcms-article-ref[class*="align-float"] .dcms-article-ref-content,
.dcms-editor-content .dcms-article-ref[class*="align-float"] .dcms-article-ref-content {
  left: 100px;
  padding: 10px 12px;
}

.dcms-article-content .dcms-article-ref[class*="align-float"] .dcms-article-ref-title,
.dcms-editor-content .dcms-article-ref[class*="align-float"] .dcms-article-ref-title {
  font-size: 14px;
}

/* Float: hide "Đọc thêm" label — saves space in narrow cards */
.dcms-article-content .dcms-article-ref[class*="align-float"] .dcms-article-ref-label,
.dcms-editor-content .dcms-article-ref[class*="align-float"] .dcms-article-ref-label {
  display: none;
}

/* ---- Style Variants ---- */

/* --- Compact --- */
.dcms-article-content .dcms-article-ref.ref-compact .dcms-article-ref-thumb,
.dcms-editor-content .dcms-article-ref.ref-compact .dcms-article-ref-thumb {
  width: 130px;
}

.dcms-article-content .dcms-article-ref.ref-compact .dcms-article-ref-content,
.dcms-editor-content .dcms-article-ref.ref-compact .dcms-article-ref-content {
  left: 130px;
  padding: 8px 12px;
  gap: 2px;
}

.dcms-article-content .dcms-article-ref.ref-compact .dcms-article-ref-label,
.dcms-editor-content .dcms-article-ref.ref-compact .dcms-article-ref-label {
  font-size: 10px;
}

.dcms-article-content .dcms-article-ref.ref-compact .dcms-article-ref-title,
.dcms-editor-content .dcms-article-ref.ref-compact .dcms-article-ref-title {
  font-size: 13px;
}

/* --- Vertical: normal flow (image top, content below) --- */
.dcms-article-content .dcms-article-ref.ref-vertical .dcms-article-ref-thumb,
.dcms-editor-content .dcms-article-ref.ref-vertical .dcms-article-ref-thumb {
  width: 100%;
  aspect-ratio: 3 / 2;
}

.dcms-article-content .dcms-article-ref.ref-vertical .dcms-article-ref-content,
.dcms-editor-content .dcms-article-ref.ref-vertical .dcms-article-ref-content {
  position: static;
  padding: 14px 16px;
}

.dcms-article-content .dcms-article-ref.ref-vertical .dcms-article-ref-title,
.dcms-editor-content .dcms-article-ref.ref-vertical .dcms-article-ref-title {
  -webkit-line-clamp: 3;
}

/* Vertical: show excerpt */
.dcms-article-content .dcms-article-ref.ref-vertical .dcms-article-ref-excerpt,
.dcms-editor-content .dcms-article-ref.ref-vertical .dcms-article-ref-excerpt {
  display: -webkit-box;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
  margin: 0;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: normal;
  overflow-wrap: break-word;
}

/* --- Minimal: no image, left border, normal flow --- */
.dcms-article-content .dcms-article-ref.ref-minimal .dcms-article-ref-card,
.dcms-editor-content .dcms-article-ref.ref-minimal .dcms-article-ref-card {
  background: #f9fafb;
  border: none;
  border-left: 4px solid #3b82f6;
  box-shadow: none;
}

.dcms-article-content .dcms-article-ref.ref-minimal .dcms-article-ref-card:hover,
.dcms-editor-content .dcms-article-ref.ref-minimal .dcms-article-ref-card:hover {
  box-shadow: none;
  background: #f3f4f6;
}

.dcms-article-content .dcms-article-ref.ref-minimal .dcms-article-ref-thumb,
.dcms-editor-content .dcms-article-ref.ref-minimal .dcms-article-ref-thumb {
  display: none;
}

.dcms-article-content .dcms-article-ref.ref-minimal .dcms-article-ref-content,
.dcms-editor-content .dcms-article-ref.ref-minimal .dcms-article-ref-content {
  position: static;
  padding: 10px 14px;
}

/* --- Responsive: mobile --- */
@media (max-width: 768px) {
  .dcms-article-content .dcms-article-ref-thumb,
  .dcms-editor-content .dcms-article-ref-thumb {
    width: 120px;
  }

  .dcms-article-content .dcms-article-ref-content,
  .dcms-editor-content .dcms-article-ref-content {
    left: 120px;
  }

  .dcms-article-content .dcms-article-ref[class*="align-float"] .dcms-article-ref-thumb,
  .dcms-editor-content .dcms-article-ref[class*="align-float"] .dcms-article-ref-thumb {
    width: 120px;
  }

  .dcms-article-content .dcms-article-ref[class*="align-float"] .dcms-article-ref-content,
  .dcms-editor-content .dcms-article-ref[class*="align-float"] .dcms-article-ref-content {
    left: 120px;
    padding: 12px 16px;
  }

  .dcms-article-content .dcms-article-ref[class*="align-float"] .dcms-article-ref-title,
  .dcms-editor-content .dcms-article-ref[class*="align-float"] .dcms-article-ref-title {
    font-size: 15px;
  }

  .dcms-article-content .dcms-article-ref.ref-vertical .dcms-article-ref-thumb,
  .dcms-editor-content .dcms-article-ref.ref-vertical .dcms-article-ref-thumb {
    width: 100%;
  }

  /* Vertical: ẩn excerpt trên mobile */
  .dcms-article-content .dcms-article-ref.ref-vertical .dcms-article-ref-excerpt,
  .dcms-editor-content .dcms-article-ref.ref-vertical .dcms-article-ref-excerpt {
    display: none;
  }

  .dcms-article-content .dcms-article-ref.ref-compact .dcms-article-ref-thumb,
  .dcms-editor-content .dcms-article-ref.ref-compact .dcms-article-ref-thumb {
    width: 100px;
  }

  .dcms-article-content .dcms-article-ref.ref-compact .dcms-article-ref-content,
  .dcms-editor-content .dcms-article-ref.ref-compact .dcms-article-ref-content {
    left: 100px;
  }
}

/* --- Responsive: small mobile — reset float --- */
@media (max-width: 480px) {
  .dcms-article-content .dcms-article-ref[class*="align-float"],
  .dcms-editor-content .dcms-article-ref[class*="align-float"] {
    float: none;
    max-width: 100%;
    width: 100%;
    margin: 1rem 0;
  }
}

/* ============================================
   END: ARTICLE REFERENCE BLOCK
   ============================================ */

/* ============================================
   FALLBACK: Bài liên quan kiểu cũ (dcms-footer-link)
   Hỗ trợ bài cũ có related posts nhúng trong content
   ============================================ */

.dcms-article-content .dcms-object.dcms-footer-link {
  font-family: Inter, Roboto, Arial, sans-serif;
}

.dcms-article-content .dcms-footer-link {
  margin: 24px auto;
  max-width: 600px;
  box-sizing: border-box;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-decoration: none;
}

.dcms-article-content .dcms-footer-link .article-related {
  border: 1px solid #e5e5e5;
  padding: 16px;
  background: #fff;
}

.dcms-article-content .dcms-footer-link .title-head {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
  border-bottom: 1px solid #e5e5e5;
  padding-bottom: 8px;
}

.dcms-article-content .dcms-footer-link .article-related-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.dcms-article-content .dcms-footer-link .article-related-item a {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.dcms-article-content .dcms-footer-link .article-related-thumb {
  flex-shrink: 0;
  width: 120px;
  height: 80px;
  overflow: hidden;
  background: #f5f5f5;
  border-radius: 4px;
}

.dcms-article-content .dcms-footer-link .article-related-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 0;
  margin: 0;
  display: block;
}

.dcms-article-content .dcms-footer-link .article-related-content {
  flex: 1;
  min-width: 0;
}

.dcms-article-content .dcms-footer-link .article-related-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: #333;
}

.dcms-article-content .dcms-footer-link .article-related-title:hover {
  color: var(--primary-600);
}

.dcms-article-content .dcms-footer-link .article-related-sapo {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #666;
}

/* ============================================
   END: FALLBACK dcms-footer-link
   ============================================ */
