/* ============================================
   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;
    
    /* (no smooth-animation tokens — content.css is animation-free by owner decision) */

    /* 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
     ============================================ */
  
  :is(.dcms-article-content, .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 */
  :is(.dcms-article-content, .dcms-article__content)::after {
    content: "";
    display: block;
    clear: both;
  }
  
  /* ============================================
     END: BASE CONTAINER STYLES
     ============================================ */
  
  /* ============================================
     TYPOGRAPHY - PARAGRAPHS & TEXT ELEMENTS
     ============================================ */
  
  :is(.dcms-article-content, .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; /* 18px — long-form reading standard (Medium/Substack ~18-21px) */
    line-height: 1.7; /* comfortable long-form leading for 18px */
    color: inherit;
  }

  :is(.dcms-article-content, .dcms-article__content) li {
    font-size: 1.125rem;
    line-height: 1.7;
    margin: 0.5rem 0;
    color: inherit;
  }
  
  :is(.dcms-article-content, .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;
  }

  :is(.dcms-article-content, .dcms-article__content) a:hover {
    text-decoration: none;
    box-shadow: inset 0 -0.5em 0 0 rgba(208, 1, 28, 0.12);
  }
  
  :is(.dcms-article-content, .dcms-article__content) strong,
  :is(.dcms-article-content, .dcms-article__content) b {
    font-weight: 700;
    color: inherit;
  }
  
  :is(.dcms-article-content, .dcms-article__content) em,
  :is(.dcms-article-content, .dcms-article__content) i:not([class*="fa-"]):not(.fa):not(.fas):not(.far):not(.fab):not(.fa-solid):not(.fa-regular):not(.fa-brands) {
    font-style: italic;
    color: inherit;
  }
  /* R31 feedback v2 2026-06-21 — Font Awesome icons use <i> tag; exclude
     from inheriting article italic rule. FA classes start with fa-* or are
     fa/fas/far/fab/fa-solid/etc. */
  :is(.dcms-article-content, .dcms-article__content) i.fa,
  :is(.dcms-article-content, .dcms-article__content) i.fas,
  :is(.dcms-article-content, .dcms-article__content) i.far,
  :is(.dcms-article-content, .dcms-article__content) i.fab,
  :is(.dcms-article-content, .dcms-article__content) i.fa-solid,
  :is(.dcms-article-content, .dcms-article__content) i.fa-regular,
  :is(.dcms-article-content, .dcms-article__content) i.fa-brands,
  :is(.dcms-article-content, .dcms-article__content) i[class*="fa-"] {
    font-style: normal;
  }
  
  :is(.dcms-article-content, .dcms-article__content) u {
    text-decoration: underline;
    color: inherit;
  }
  
  :is(.dcms-article-content, .dcms-article__content) code,
  :is(.dcms-article-content, .dcms-article__content) pre {
    color: inherit;
  }
  
  /* ============================================
     END: TYPOGRAPHY - PARAGRAPHS & TEXT ELEMENTS
     ============================================ */
  
  /* ============================================
     TYPOGRAPHY - HEADINGS
     ============================================ */
  
  /* Heading scale (editorial long-form; body p = 18px). h1 is NEVER used in article BODY — the page template
     owns the single h1 (article title); the editor only offers h2–h5. h1 is kept ONLY so imported/legacy content
     renders with a clear top level. Levels decelerate: big gap at h2, tightening down; h5/h6 sit at/below body
     size and are differentiated by weight + UPPERCASE (eyebrow), not size alone. */
  :is(.dcms-article-content, .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: 2.25rem; /* 36px — import-only; stays above the h2 body heading */
    font-weight: 700;
    line-height: 1.25;
    color: inherit;
  }

  :is(.dcms-article-content, .dcms-article__content) h2 {
    max-width: var(--w-text); /* 640px - tự định nghĩa width, không phụ thuộc wrapper */
    margin: 2rem auto 1.75rem;
    font-size: 2rem; /* 32px — top section heading in body */
    font-weight: 700;
    line-height: 1.3;
    color: inherit;
  }

  :is(.dcms-article-content, .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; /* 24px */
    font-weight: 700;
    line-height: 1.3;
    color: inherit;
  }

  :is(.dcms-article-content, .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; /* 20px */
    font-weight: 600;
    line-height: 1.3;
    color: inherit;
  }

  :is(.dcms-article-content, .dcms-article__content) h5 {
    max-width: var(--w-text); /* 640px - tự định nghĩa width, không phụ thuộc wrapper */
    margin: 1rem auto 0.5rem;
    font-size: 1rem; /* 16px — near body size → differentiate by weight + caps */
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: inherit;
  }

  :is(.dcms-article-content, .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: 0.875rem; /* 14px — smallest eyebrow label */
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: inherit;
  }
  
  /* ============================================
     END: TYPOGRAPHY - HEADINGS
     ============================================ */

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

  :is(.dcms-article-content, .dcms-article__content) .text-center  { text-align: center; }
  :is(.dcms-article-content, .dcms-article__content) .text-right   { text-align: right; }
  :is(.dcms-article-content, .dcms-article__content) .text-justify { text-align: justify; }

  /* ============================================
     END: TEXT ALIGNMENT CLASSES
     ============================================ */
  
  /* ============================================
     TYPOGRAPHY - LISTS
     ============================================ */
  
  :is(.dcms-article-content, .dcms-article__content) ul,
  :is(.dcms-article-content, .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;
  }
  
  :is(.dcms-article-content, .dcms-article__content) ul {
    list-style-type: disc;
  }
  
  :is(.dcms-article-content, .dcms-article__content) ol {
    list-style-type: decimal;
  }
  
  /* ============================================
     END: TYPOGRAPHY - LISTS
     ============================================ */
  
  /* ============================================
     TYPOGRAPHY - BLOCKQUOTE (Native)
     ============================================ */
  
  :is(.dcms-article-content, .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
     ============================================ */
  
  :is(.dcms-article-content, .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
     ============================================ */
  
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object {
    margin: 1.5rem 0;
    display: block;
  }

  /* Alignment is INSTANT — no smooth transition (owner decision: content.css carries no
     smooth animation). Objects jump straight to their aligned box, so the floating toolbars can
     re-anchor to the final position without a follow tracker. (No reduce-motion override needed:
     nothing animates.) */

  /* 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. */
  :is(.dcms-article-content, .dcms-article__content) .dcms-object:not([class*="align-float"]) {
    clear: both;
  }
  
  /* Image wrapper - transparent wrapper for front site (no behavior needed) */
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object .dcms-image-wrapper {
    display: block;
  }
  
  /* Single image wrapper - full width */
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object:not(.dcms-image-grid) .dcms-image-wrapper {
    width: 100%;
  }
  
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object .dcms-image-wrapper img,
  :is(.dcms-article-content, .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 */
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object:not([class*="align-"]) {
    max-width: var(--w-text);
    margin-inline: auto;
  }
  
  /* Align Center - 640px */
  :is(.dcms-article-content, .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) */
  :is(.dcms-article-content, .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) */
  :is(.dcms-article-content, .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) */
  :is(.dcms-article-content, .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) */
  :is(.dcms-article-content, .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 */
  :is(.dcms-article-content, .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 */
  :is(.dcms-article-content, .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) {
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.align-float-wide-left,
    :is(.dcms-article-content, .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);
    }
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.align-float-wide-left {
      margin-left: 0;
      margin-right: var(--gutter);
    }
    :is(.dcms-article-content, .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) {
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.align-float-wide-left,
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.align-float-wide-right,
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.align-float-left,
    :is(.dcms-article-content, .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
     ============================================ */
  
  :is(.dcms-article-content, .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 a truly-empty figcaption on the FRONTSITE. Structural `:empty` (not an editor-only `.empty` class,
     which is no longer saved) — placeholders are editor view-state; the editor force-shows its empty caption
     via the .dcms-editor__placeholder class. */
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object figcaption:empty {
    display: none;
  }
  
  /* Figcaption border bottom decoration - centered underline */
  :is(.dcms-article-content, .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 the underline decoration for a truly-empty figcaption (frontsite; :empty, see above) */
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object figcaption:empty::after {
    display: none;
  }
  
  /* Limit figcaption input area to 960px max when align-full using padding */
  :is(.dcms-article-content, .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 */
:is(.dcms-article-content, .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 */
:is(.dcms-article-content, .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) */
:is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-image-grid > .grid-row,
:is(.dcms-article-content, .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() */
:is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-image-grid > .grid-row > .dcms-image-wrapper,
:is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-image-grid > .grid-row > .image-grid-item-wrapper,
:is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-image-grid > .grid-content > .grid-row > .dcms-image-wrapper,
:is(.dcms-article-content, .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 */
:is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-image-grid > .grid-row > .dcms-image-wrapper img,
:is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-image-grid > .grid-row > .image-grid-item-wrapper img,
:is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-image-grid > .grid-row > img,
:is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-image-grid > .grid-content > .grid-row > .dcms-image-wrapper img,
:is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-image-grid > .grid-content > .grid-row > .image-grid-item-wrapper img,
:is(.dcms-article-content, .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) */
  :is(.dcms-article-content, .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 */
  :is(.dcms-article-content, .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 */
  :is(.dcms-article-content, .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) */
  :is(.dcms-article-content, .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) */
  :is(.dcms-article-content, .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) {
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-image-grid > .grid-row {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 0.5rem;
    }
    
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-image-grid > .grid-row > img {
      width: 100% !important;
      height: auto !important;
    }
    
    /* Legacy support: flat structure */
    :is(.dcms-article-content, .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 */
  :is(.dcms-article-content, .dcms-article__content) .dcms-video .dcms-aspect {
    width: 100%;
    position: relative;
    background-color: #000;
  }
  
  :is(.dcms-article-content, .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 */
:is(.dcms-article-content, .dcms-article__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) */
  :is(.dcms-article-content, .dcms-article__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) */
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.photostory-item.photostory-right {
    flex-direction: row-reverse !important;
  }
  
  /* Photostory: Image area (75% = 3 phần) - for single image */
  :is(.dcms-article-content, .dcms-article__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 */
  :is(.dcms-article-content, .dcms-article__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 */
  :is(.dcms-article-content, .dcms-article__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 */
  :is(.dcms-article-content, .dcms-article__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) */
  :is(.dcms-article-content, .dcms-article__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 */
  :is(.dcms-article-content, .dcms-article__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) */
  :is(.dcms-article-content, .dcms-article__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 */
  :is(.dcms-article-content, .dcms-article__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 */
  :is(.dcms-article-content, .dcms-article__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) */
  :is(.dcms-article-content, .dcms-article__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 */
:is(.dcms-article-content, .dcms-article__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) */
  :is(.dcms-article-content, .dcms-article__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
     ============================================ */
  
  /* Callout (was "infoBox") — DUAL-TARGET the legacy .dcms-info-box AND the new canonical .dcms-callout on the
     same color axis, so un-edited old articles AND new callout markup both render (task #51 slice A). */
  :is(.dcms-article-content, .dcms-article__content) .dcms-info-box,
  :is(.dcms-article-content, .dcms-article__content) .dcms-callout {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border: 2px solid;
    /* Default color scheme: Yellow */
    background-color: #f8f6f0;
    border-color: #e7e2d4;
    color: #695f42;
  }

  /* Callout COLOR axis — `data-color-scheme` (the dcms2-legacy attribute, DUAL-TARGETING .dcms-info-box +
     .dcms-callout so old + new markup both render). yellow = the DEFAULT (no attr). 5 presets + custom; each
     TEXT meets WCAG AA (≥4.5:1) on its bg; the 2px border is a subtle decorative edge (the dcms2 look). No
     legacy rule is ever deleted. */
  :is(.dcms-article-content, .dcms-article__content) .dcms-info-box[data-color-scheme="yellow"],
  :is(.dcms-article-content, .dcms-article__content) .dcms-info-box:not([data-color-scheme]),
  :is(.dcms-article-content, .dcms-article__content) .dcms-callout[data-color-scheme="yellow"],
  :is(.dcms-article-content, .dcms-article__content) .dcms-callout:not([data-color-scheme]) {
    background-color: #f8f6f0;
    border-color: #e7e2d4;
    color: #695f42 !important; /* Override emagazine text color */
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-info-box[data-color-scheme="gray"],
  :is(.dcms-article-content, .dcms-article__content) .dcms-callout[data-color-scheme="gray"] {
    background-color: #f2f2f2;
    border-color: #ccc;
    color: #333 !important; /* Override emagazine text color */
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-info-box[data-color-scheme="blue"],
  :is(.dcms-article-content, .dcms-article__content) .dcms-callout[data-color-scheme="blue"] {
    background-color: #d9dfed;
    border-color: #839bd2;
    color: #333 !important; /* Override emagazine text color */
  }

  /* new presets (green/red) — .dcms-callout only; TEXT ≥4.5:1 on its bg */
  :is(.dcms-article-content, .dcms-article__content) .dcms-callout[data-color-scheme="green"] {
    background-color: #e6f4ea;
    border-color: #6cbf84;
    color: #1b5e34 !important;
  }
  :is(.dcms-article-content, .dcms-article__content) .dcms-callout[data-color-scheme="red"] {
    background-color: #fdeaea;
    border-color: #e08585;
    color: #8a1c1c !important;
  }

  /* CUSTOM color — reads the toDOM-derived, validated-hex CSS vars (no user string ever reaches this rule). */
  :is(.dcms-article-content, .dcms-article__content) .dcms-callout[data-color-scheme="custom"] {
    background-color: var(--cl-bg);
    border-color: var(--cl-border);
    color: var(--cl-text) !important;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-info-box .info-box-content,
  :is(.dcms-article-content, .dcms-article__content) .dcms-callout .callout-content {
    margin: 0;
    min-height: 2rem;
    position: relative;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-info-box .info-box-content p,
  :is(.dcms-article-content, .dcms-article__content) .dcms-callout .callout-content p {
    margin: 0.5rem 0;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-info-box .info-box-content p:first-child,
  :is(.dcms-article-content, .dcms-article__content) .dcms-callout .callout-content p:first-child {
    margin-top: 0;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-info-box .info-box-content p:last-child,
  :is(.dcms-article-content, .dcms-article__content) .dcms-callout .callout-content p:last-child {
    margin-bottom: 0;
  }

  /* Callout placeholder is EDITOR-owned (dcms-editor.css + placeholderPlugin); content.css renders none. */

  /* Default (no align class) - Center, 640px */
  :is(.dcms-article-content, .dcms-article__content) .dcms-info-box:not([class*="align-"]),
  :is(.dcms-article-content, .dcms-article__content) .dcms-callout:not([class*="align-"]) {
    max-width: var(--w-text);
    margin-inline: auto;
  }

  /* Align Center - 640px (same as default) */
  :is(.dcms-article-content, .dcms-article__content) .dcms-info-box.align-center,
  :is(.dcms-article-content, .dcms-article__content) .dcms-callout.align-center {
    max-width: var(--w-text);
    margin-inline: auto;
  }

  /* NOTE: callout only supports align-center (640px) */
  /* No align-wide or align-full for infobox */
  
  /* ============================================
     END: INFO BOX STYLES
     ============================================ */
  
  /* ============================================
     BLOCKQUOTE OBJECT STYLES
     ============================================ */
  
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 3px solid #ddd;
    background-color: #f9f9f9;
    color: inherit;
  }
  
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote .blockquote-content {
    margin: 0;
    min-height: 2rem;
    position: relative;
    font-style: italic;
  }
  
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote .blockquote-content p {
    margin: 0.5rem 0;
  }
  
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote .blockquote-content p:first-child {
    margin-top: 0;
  }
  
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote .blockquote-content p:last-child {
    margin-bottom: 0;
  }
  
  /* Blockquote placeholder is EDITOR-owned (dcms-editor.css + placeholderPlugin); content.css renders none. */

  /* Default (no align class) - Center, 640px */
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote:not([class*="align-"]) {
    max-width: var(--w-text);
    margin-inline: auto;
  }
  
  /* Align Center - 640px (same as default) */
  :is(.dcms-article-content, .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 */
  
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote {
    color: #333 !important; /* Blockquote uses default text color, not emagazine color */
  }
  
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote * {
    color: inherit !important; /* Children inherit from blockquote parent (#333) */
  }

  /* ── Blockquote STYLE variants (bq-*; `plain` = default = NO class = the rules above). Each is a STRUCTURALLY
        different kind of quote (distinguishable even in grayscale — the difference is layout, not hue): an
        editorial rail, a gutter glyph, a labelled panel, corner crop-marks. SQUARE corners (owner). None reuse
        pullQuote's pq-* vocabulary (thick tinted left-bar / top+bottom rules / symmetric big marks / solid
        fill). Text stays #333 (AA on the light surfaces). Sources: GitHub-Primer, Tailwind Typography, Ontario
        DS, Red Hat DS, WordPress Quote (codex-think-about consensus). ── */

  /* Văn học — a warm PAPER card: cream background with a faint grain "scratch" texture (a self-contained SVG
     noise data-URI — no external / webfont request), Georgia serif italic, centered, a centered opening mark.
     The warm paper surface makes it unmistakably different from the plain default (gray + left bar) and the
     neutral-gray siblings. NOTE: Georgia is a SYSTEM font (already present on nearly all devices) — referenced
     in the stack, NOT loaded from Google Fonts or any webfont; `serif` is the fallback where it's absent. */
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.bq-verse {
    border: none;
    background-color: #fbf6e9;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)' opacity='0.05'/%3E%3C/svg%3E");
    padding: 2.5rem 2rem 1.5rem;
    text-align: center;
    position: relative;
  }
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.bq-verse::before {
    content: "\201C";
    position: absolute;
    left: 50%;
    top: 0.35rem;
    transform: translateX(-50%);
    font: 700 2.75rem/1 Georgia, "Times New Roman", serif;
    color: #c4a86a;
    pointer-events: none;
  }
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.bq-verse .blockquote-content {
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    line-height: 1.9;
  }

  /* Ngoặc lề — the quote identity is a LARGE single opening glyph in a left gutter; the text hangs in its own
     column. No border box. Distinct from pullQuote quote-marks (one asymmetric gutter mark, not big symmetric
     marks around the text). */
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.bq-gutter {
    border-left: none;
    background-color: #f8f9fa;
    padding: 1rem 1.25rem 1rem 3.75rem;
    position: relative;
  }
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.bq-gutter::before {
    content: "\201C";
    position: absolute;
    left: 0.85rem;
    top: 0.35rem;
    font: 700 3.5rem/1 Georgia, "Times New Roman", serif;
    color: #9aa0ab;
    pointer-events: none;
  }
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.bq-gutter .blockquote-content { font-style: normal; }

  /* Phiếu trích dẫn — a document/citation PANEL: a full square 1px frame with a bold dark accent bar across the
     TOP. The top bar changes the layout grammar (a labelled panel), unlike a plain card. */
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.bq-panel {
    border: 1px solid #d7dae0;
    border-top: 3px solid #334155;
    background-color: #ffffff;
    padding: 1.25rem 1.5rem;
  }
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.bq-panel .blockquote-content { font-style: normal; }

  /* Khung góc — editorial CROP-MARK framing: an L-shaped corner at the top-left and the bottom-right (no
     continuous border). A distinct "framed excerpt" grammar. */
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.bq-corner {
    border: none;
    background-color: #f8f9fa;
    padding: 1.5rem;
    position: relative;
  }
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.bq-corner::before,
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.bq-corner::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: #6b7280;
    border-style: solid;
    pointer-events: none;
  }
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.bq-corner::before { top: 7px; left: 7px; border-width: 2px 0 0 2px; }
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.bq-corner::after { bottom: 7px; right: 7px; border-width: 0 2px 2px 0; }
  :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.bq-corner .blockquote-content { font-style: normal; }
  
  /* ============================================
     END: BLOCKQUOTE OBJECT STYLES
     ============================================ */

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

  :is(.dcms-article-content, .dcms-article__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;
  }

  :is(.dcms-article-content, .dcms-article__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;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote .pull-quote-content p {
    margin: 0.5rem 0;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote .pull-quote-content p:first-child {
    margin-top: 0;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote .pull-quote-content p:last-child {
    margin-bottom: 0;
  }

  /* Pull-quote placeholder is EDITOR-owned (dcms-editor.css + placeholderPlugin); content.css renders none. */

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

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

  :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote * {
    color: inherit !important;
  }

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

  :is(.dcms-article-content, .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);
  }

  :is(.dcms-article-content, .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;
  }

  :is(.dcms-article-content, .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;
  }

  :is(.dcms-article-content, .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;
  }

  :is(.dcms-article-content, .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;
  }

  :is(.dcms-article-content, .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 */
  :is(.dcms-article-content, .dcms-article__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 */
  :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote.pq-quote-marks {
    border-top: none;
    border-bottom: none;
    padding: 2rem 2rem 1.5rem;
    position: relative;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote.pq-quote-marks::before,
  :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote.pq-quote-marks::after {
    font-size: 4rem;
    line-height: 1;
    color: #d1d5db;
    position: absolute;
    font-family: Georgia, serif;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote.pq-quote-marks::before {
    content: '\201C'; /* opening “ — top-left */
    top: 0;
    left: 0.5rem;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote.pq-quote-marks::after {
    content: '\201D'; /* closing ” — bottom-right */
    bottom: -0.75rem;
    right: 0.5rem;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote.pq-quote-marks .pull-quote-content {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  /* Highlight variant */
  :is(.dcms-article-content, .dcms-article__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;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote.pq-highlight * {
    color: inherit !important;
  }

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

  :is(.dcms-article-content, .dcms-article__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
     ============================================ */

  :is(.dcms-article-content, .dcms-article__content) .dcms-code-block {
    margin: 1.5rem 0;
    border-radius: 0;                /* dcms2 5-bug B3: bro asked for no round corner */
    overflow: hidden;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-code-block pre.code-block-content {
    margin: 0;
    padding: 1rem 1.25rem;
    background-color: #0f172a;       /* slate-900 — WCAG-AAA contrast with slate-200 fg */
    color: #e2e8f0;                  /* slate-200 */
    font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-wrap: anywhere;         /* dcms2 5-bug B3: break long unbreakable tokens on wrap */
    white-space: pre-wrap;           /* dcms2 5-bug B3: wrap text (was: pre) */
    tab-size: 4;
    min-height: 3rem;
    position: relative;
  }

  :is(.dcms-article-content, .dcms-article__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;
  }

  /* Batch 6 mirror — GitHub Dark hljs token palette scoped inside `.dcms-code-block`. Ported
     verbatim from sibling `content.css`. Editor + frontsite MUST use the same version+theme+subset
     for WYSIWYG parity (see docs/frontsite-handoff/HANDOFF.md). */
  .dcms-code-block .hljs-doctag,
  .dcms-code-block .hljs-keyword,
  .dcms-code-block .hljs-meta .hljs-keyword,
  .dcms-code-block .hljs-template-tag,
  .dcms-code-block .hljs-template-variable,
  .dcms-code-block .hljs-type,
  .dcms-code-block .hljs-variable.language_ { color: #ff7b72; }
  .dcms-code-block .hljs-title,
  .dcms-code-block .hljs-title.class_,
  .dcms-code-block .hljs-title.class_.inherited__,
  .dcms-code-block .hljs-title.function_ { color: #d2a8ff; }
  .dcms-code-block .hljs-attr,
  .dcms-code-block .hljs-attribute,
  .dcms-code-block .hljs-literal,
  .dcms-code-block .hljs-meta,
  .dcms-code-block .hljs-number,
  .dcms-code-block .hljs-operator,
  .dcms-code-block .hljs-variable,
  .dcms-code-block .hljs-selector-attr,
  .dcms-code-block .hljs-selector-class,
  .dcms-code-block .hljs-selector-id { color: #79c0ff; }
  .dcms-code-block .hljs-regexp,
  .dcms-code-block .hljs-string,
  .dcms-code-block .hljs-meta .hljs-string { color: #a5d6ff; }
  .dcms-code-block .hljs-built_in,
  .dcms-code-block .hljs-symbol { color: #ffa657; }
  .dcms-code-block .hljs-comment,
  .dcms-code-block .hljs-code,
  .dcms-code-block .hljs-formula { color: #8b949e; }
  .dcms-code-block .hljs-name,
  .dcms-code-block .hljs-quote,
  .dcms-code-block .hljs-selector-tag,
  .dcms-code-block .hljs-selector-pseudo { color: #7ee787; }
  .dcms-code-block .hljs-subst { color: #e2e8f0; }
  .dcms-code-block .hljs-section { color: #1f6feb; font-weight: bold; }
  .dcms-code-block .hljs-bullet { color: #f2cc60; }
  .dcms-code-block .hljs-emphasis { color: #e2e8f0; font-style: italic; }
  .dcms-code-block .hljs-strong { color: #e2e8f0; font-weight: bold; }
  .dcms-code-block .hljs-addition { color: #aff5b4; background-color: #033a16; }
  .dcms-code-block .hljs-deletion { color: #ffdcd7; background-color: #67060c; }

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

  :is(.dcms-article-content, .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);
  }

  :is(.dcms-article-content, .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
     ============================================ */

  :is(.dcms-article-content, .dcms-article__content) .dcms-table {
    margin: 1.5rem 0;
    overflow-x: auto;
  }

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

  /* NOTE: content.css is the SINGLE source for the ARTICLE table look. The vendored dcms2 `dcms.css` ships two
     GENERIC, un-scoped `!important` baselines — `table td{border-bottom:1px solid rgba(0,0,0,.04)!important}` and
     `table thead th{background:#00000005!important;border-bottom:…!important}` — meant for dcms2's OWN dashboard
     tables; because they're generic they leak onto the editor's `.dcms-table` and (being !important) override our
     non-important border on the bottom side only → a mismatched hairline. We do NOT edit the vendored file. Instead
     these `.dcms-table` rules carry `!important` on `border`/`background` so content.css WINS for ARTICLE tables
     ONLY (`.dcms-article-content .dcms-table` is higher-specificity + !important beats the
     generic `table td`); every other table on the page keeps the vendored baseline untouched. */
  :is(.dcms-article-content, .dcms-article__content) .dcms-table th {
    padding: 0.625rem 0.75rem;
    border: 1px solid #d1d5db !important;
    background-color: #f3f4f6 !important;
    font-weight: 600;
    text-align: left;
    min-width: 80px;
  }

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

  :is(.dcms-article-content, .dcms-article__content) .dcms-table tr:hover td {
    background-color: #f9fafb;
  }

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

  :is(.dcms-article-content, .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);
  }

  :is(.dcms-article-content, .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 */
  :is(.dcms-article-content, .dcms-article__content) .dcms-table {
    color: #333 !important;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-table * {
    color: inherit !important;
  }

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

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

  :is(.dcms-article-content, .dcms-article__content) .dcms-embed {
    margin: 1.5rem 0;
  }

  :is(.dcms-article-content, .dcms-article__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;
  }

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

  /* V3 embed frame (#68) — the canonical structure our schema emits.
     2026-07-21 embed audit (Issue 2/3): split into --aspect (CSS aspect-ratio, YouTube/Vimeo/etc) vs
     --intrinsic (definite dimensions via inline style, TikTok fixed 605×800 per Task 74-fu, others 480 tall). NodeView
     sets --aspect | --intrinsic modifier + inline style attributes from provider.frame contract.
     Legacy .dcms-aspect kept as backward-compat alias for old rendered .dcms-embed .dcms-aspect nodes.
     Bare .dcms-embed-frame (no modifier) retained as backward-compat for PHP V3SanitizerService.php:898
     server-sanitized output — will be refactored + fallback removed via Task 73 follow-up. */
  /* Server-sanitized fallback: bare .dcms-embed-frame from PHP sanitizer (no --aspect/--intrinsic
     modifier). Modifier rules below override this via same-specificity cascade + more specific
     class selectors. Do NOT delete without also refactoring V3SanitizerService::renderEmbedFrame(). */
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-embed-frame {
    width: 100%;
    height: 480px; /* definite height so the child iframe's height:100% resolves */
    position: relative;
    overflow: hidden;
    background-color: #fff; /* Task 81: was #000 → cross-origin iframe transparent bg leaked black (Facebook root cause) */
  }
  /* 2026-07-21 embed audit followup (codex-think-about-20260721-001 CONSENSUS high) — hybrid
     padding-bottom + aspect-ratio pattern matching WordPress Gutenberg standard. Bro reported
     YouTube fixed height on wide/full: root cause was `iframe { height: 100% }` fragile when
     parent height derived indirectly from `aspect-ratio` (percentage height needs DEFINITE
     parent height per CSS spec; aspect-ratio-computed height often treated as auto by browsers →
     iframe falls to default 300×150). WordPress solves this via padding-bottom trick + iframe
     position:absolute. Now: fallback padding-bottom 56.25% (all our aspect providers are 16:9),
     iframe absolute inset:0 — works everywhere; @supports upgrade to aspect-ratio for modern
     browsers. Provider-driven ratio via CSS var (future-proof for non-16:9 aspect providers). */
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-embed-frame--aspect,
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-aspect {
    width: 100%;
    position: relative;
    overflow: hidden;
    background-color: #fff; /* Task 81 (was #000) — universal iframe bg fix */
    height: 0;
    padding-bottom: var(--dcms-embed-aspect-padding, 56.25%); /* 56.25% = H/W*100 for aspect 16/9; provider can override via inline CSS var (Task 74 comment fix) */
  }
  @supports (aspect-ratio: 16 / 9) {
    :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-embed-frame--aspect,
    :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-aspect {
      height: auto;
      padding-bottom: 0;
      aspect-ratio: var(--dcms-embed-aspect-ratio, 16 / 9);
    }
  }
  /* 2026-07-21 Task 74 legacy hotfix (codex-think-about-20260721-004 CONSENSUS +
     codex-plan-review-20260721-004 APPROVE). Existing DB posts saved before
     V3SanitizerService frame-contract migration have `<div class="dcms-aspect"
     style="aspect-ratio: 9/16">` for TikTok — inline aspect-ratio wins over CSS var
     so Task 72's --dcms-embed-aspect-ratio default couldn't rescue them. `!important`
     on aspect-ratio/padding forces the override; attribute selector matches both
     `9/16` and `9 / 16` style-string variants. Narrower/safer than :has() (attribute
     selectors have universal browser support). Remove after `dcms:embed:resanitize`
     runs on all 3 sites — see Task 76 follow-up.
     2026-07-21 Task 74-fu (codex-think-about-005 CONSENSUS): height 738 → 800 to
     accommodate videos with multi-line captions + hashtags + music info + attribution
     (was overflowing → internal scrollbar). Must stay in sync with JS + PHP provider
     configs (embed-providers.js + EmbedProviderResolver.php TikTok frame.height). */
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-aspect[style*="9/16"],
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-aspect[style*="9 / 16"] {
    aspect-ratio: auto !important;
    padding-bottom: 0 !important;
    height: 800px;
    max-width: min(605px, 100%);
    min-width: min(325px, 100%);
    margin-inline: auto;
  }
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-embed-frame--intrinsic {
    width: 100%;
    /* Definite height comes from inline style attr set by NodeView from provider.frame.height (480 default,
       800 TikTok per Task 74-fu, etc). No CSS height fallback — provider contract owns it. */
    position: relative;
    overflow: hidden;
    background-color: #fff; /* Task 81 (was #000) — universal iframe bg fix */
    /* 2026-07-21 Task 74-fu-3 (bro report): TikTok has inline `max-width: min(605px, 100%)` from
       provider.frame.maxWidth. Without `margin-inline: auto`, when parent figure is wider than 605
       the wrapper sticks to LEFT (off-center video inside centered figure). Legacy .dcms-aspect
       hotfix at line 1637 already has margin-inline:auto — new markup was missing it. Safe for all
       intrinsic providers (no-maxWidth ones fill 100% so margin auto is no-op). */
    margin-inline: auto;
  }
  /* iframe MUST be absolute-positioned inside --aspect containers so the padding-bottom fallback
     works (padding creates the box; iframe fills it via inset:0). For --intrinsic containers with
     definite height, iframe absolute + inset:0 still works and unifies behavior across both kinds.
     Bare .dcms-embed-frame (PHP-sanitized) also included so server-side markup gets consistent
     iframe styling. */
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-embed-frame--aspect iframe,
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-embed-frame--intrinsic iframe,
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-embed-frame iframe,
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-aspect iframe {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
  }
  /* A node whose stored src no longer resolves (provider table changed) → an iframe-less placeholder. */
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-embed-invalid {
    padding: 2rem 1rem;
    text-align: center;
    color: #9ca3af;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    font-size: 0.9rem;
  }


  /* Embed Alignment — Task 81 universal (align-* semantics parallel image/video) */
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed:not([class*="align-"]),
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed.align-center {
    max-width: var(--w-text);
    margin-inline: auto;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-embed.align-wide {
    width: var(--w-wide);
    max-width: calc(100vw - 32px); /* Task 81: viewport-safe mobile fallback for wide breakout */
    margin-left: calc((var(--w-text) - var(--w-wide)) / 2);
    margin-right: calc((var(--w-text) - var(--w-wide)) / 2);
  }

  /* Task 81 — `align-full` DEPRECATED for embeds (empty area with fixed provider widths).
     Sanitizer migrates align-full → align-wide on save (see V3SanitizerService::clampEmbedAlign).
     This rule preserves legacy behavior for un-resaved DB rows until they get edited. */
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed.align-full {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }

  /* Task 81 — float align variants for embeds. Narrower widths than center to allow text wrap.
     codex-impl-review-013 R2 ISSUE-3: existing `figure.dcms-object.align-float-*` rules (image/video)
     use clamp() width; embed floats need DIFFERENT fixed widths (400/500 vs image's clamp math).
     Selector uses `figure.dcms-object.dcms-embed` compound (specificity 0,3,1 — beats the image rule
     `figure.dcms-object.align-float-*` which is 0,2,1). Also overrides max-width to prevent clamp
     max-width from winning. */
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-embed.align-float-left,
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-embed.align-float-right {
    width: min(400px, 100%);
    max-width: min(400px, 100%);
    margin-inline: 0;
  }
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-embed.align-float-left {
    float: left;
    margin-right: var(--gutter, 16px);
    margin-left: 0;
  }
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-embed.align-float-right {
    float: right;
    margin-left: var(--gutter, 16px);
    margin-right: 0;
  }
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-embed.align-float-wide-left,
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-embed.align-float-wide-right {
    width: min(500px, 100%);
    max-width: min(500px, 100%);
    margin-inline: 0;
  }
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-embed.align-float-wide-left {
    float: left;
    margin-right: var(--gutter, 16px);
    margin-left: 0;
  }
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-embed.align-float-wide-right {
    float: right;
    margin-left: var(--gutter, 16px);
    margin-right: 0;
  }

  /* Task 81 — mobile safety: embed floats collapse to no-float + full-width center.
     codex-impl-review-013 R1 ISSUE-3: existing responsive blocks (~lines 1922, 2031, 2099) already
     handle wide/full via !important 100vw. Task 81 removed the wide-collapse rule here to avoid
     specificity war. Float-collapse is NEW behavior (no existing rules), needs !important to beat
     later float definitions if any. Placed here in the embed block for locality; if later rules
     ever override, move this block to end-of-file. */
  @media (max-width: 640px) {
    :is(.dcms-article-content, .dcms-article__content) .dcms-embed.align-float-left,
    :is(.dcms-article-content, .dcms-article__content) .dcms-embed.align-float-right,
    :is(.dcms-article-content, .dcms-article__content) .dcms-embed.align-float-wide-left,
    :is(.dcms-article-content, .dcms-article__content) .dcms-embed.align-float-wide-right {
      float: none !important;
      width: 100% !important;
      max-width: 100% !important; /* codex-impl-review-013 R3 ISSUE-4: reset desktop max-width cap on mobile */
      margin-inline: auto !important;
    }
  }

  /* Task 81 — `.dcms-embed-frame--fixed` for non-measurable providers (FB/Spotify/SC/Genially/
     Google-forms/sheets/passthrough dataviz). Width comes from outer figure's align class
     (see .dcms-embed.align-* rules below); frame just fills 100% + aspect-ratio from provider
     via inline --dcms-embed-fixed-ratio var. White bg kills cross-origin dark bleed.
     Selectors match existing rules' specificity (0,3,1). Task 81 pre-commit A added this rule
     with 4/3 default — main commit here reaffirms + documents finalized behavior. */
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-embed-frame--fixed {
    width: 100%;
    height: auto; /* Task 81 codex-impl-review-013 R1 ISSUE-1: override legacy .dcms-embed-frame height:480 fallback so aspect-ratio drives layout */
    background: #fff;
    aspect-ratio: var(--dcms-embed-fixed-ratio, 4 / 3);
    min-height: 200px;
    overflow: hidden;
    position: relative;
  }
  :is(.dcms-article-content, .dcms-article__content) .dcms-embed .dcms-embed-frame--fixed iframe {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
  }

  /* ============================================
     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 */
    :is(.dcms-article-content, .dcms-article__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 */
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.photostory-item.photostory-left,
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.photostory-item.photostory-right {
      flex-direction: column !important;
    }
    
    /* Photostory - Image wrapper full width */
    :is(.dcms-article-content, .dcms-article__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 */
    :is(.dcms-article-content, .dcms-article__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) */
  :is(.dcms-article-content, .dcms-article__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 */
  :is(.dcms-article-content, .dcms-article__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 */
  :is(.dcms-article-content, .dcms-article__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 */
  :is(.dcms-article-content, .dcms-article__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) */
  :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.photostory-item.dcms-image-grid > .grid-row,
  :is(.dcms-article-content, .dcms-article__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) */
  :is(.dcms-article-content, .dcms-article__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 */
  :is(.dcms-article-content, .dcms-article__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 */
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.align-wide,
    :is(.dcms-article-content, .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 */
    :is(.dcms-article-content, .dcms-article__content) .dcms-embed.align-wide,
    :is(.dcms-article-content, .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 */
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-image-grid.align-wide,
    :is(.dcms-article-content, .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 */
    :is(.dcms-article-content, .dcms-article__content) p,
    :is(.dcms-article-content, .dcms-article__content) h1,
    :is(.dcms-article-content, .dcms-article__content) h2,
    :is(.dcms-article-content, .dcms-article__content) h3,
    :is(.dcms-article-content, .dcms-article__content) h4,
    :is(.dcms-article-content, .dcms-article__content) h5,
    :is(.dcms-article-content, .dcms-article__content) h6,
    :is(.dcms-article-content, .dcms-article__content) ul,
    :is(.dcms-article-content, .dcms-article__content) ol,
    :is(.dcms-article-content, .dcms-article__content) blockquote,
    :is(.dcms-article-content, .dcms-article__content) hr {
      max-width: 100%;
    }
    
    /* Reset callout, blockquote, and other block objects to full width */
    :is(.dcms-article-content, .dcms-article__content) .dcms-info-box:not([class*="align-"]),
    :is(.dcms-article-content, .dcms-article__content) .dcms-info-box.align-center,
    :is(.dcms-article-content, .dcms-article__content) .dcms-callout:not([class*="align-"]),
    :is(.dcms-article-content, .dcms-article__content) .dcms-callout.align-center,
    :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote:not([class*="align-"]),
    :is(.dcms-article-content, .dcms-article__content) .dcms-blockquote.align-center,
    :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote:not([class*="align-"]),
    :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote.align-center,
    :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote.align-wide,
    :is(.dcms-article-content, .dcms-article__content) .dcms-pull-quote.align-full,
    :is(.dcms-article-content, .dcms-article__content) .dcms-code-block:not([class*="align-"]),
    :is(.dcms-article-content, .dcms-article__content) .dcms-code-block.align-center,
    :is(.dcms-article-content, .dcms-article__content) .dcms-table:not([class*="align-"]),
    :is(.dcms-article-content, .dcms-article__content) .dcms-table.align-center,
    :is(.dcms-article-content, .dcms-article__content) .dcms-embed:not([class*="align-"]),
    :is(.dcms-article-content, .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 */
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.align-wide,
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.align-full,
    :is(.dcms-article-content, .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 */
    :is(.dcms-article-content, .dcms-article__content) .dcms-code-block.align-wide,
    :is(.dcms-article-content, .dcms-article__content) .dcms-code-block.align-full,
    :is(.dcms-article-content, .dcms-article__content) .dcms-table.align-wide,
    :is(.dcms-article-content, .dcms-article__content) .dcms-table.align-full,
    :is(.dcms-article-content, .dcms-article__content) .dcms-embed.align-wide,
    :is(.dcms-article-content, .dcms-article__content) .dcms-embed.align-full {
      max-width: 100%;
      width: 100%;
      margin-left: 0;
      margin-right: 0;
    }


    /* ============================================
       END: RESPONSIVE: FIGURE ALIGNMENT
       ============================================ */
    
    /* ============================================
       RESPONSIVE: IMAGE GRID
       ============================================ */
    
    /* Image grid - reset to full width on tablet/mobile */
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.dcms-image-grid.align-wide,
    :is(.dcms-article-content, .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 */
    :is(.dcms-article-content, .dcms-article__content) h1 {
      font-size: 1.75rem;
    }
    
    :is(.dcms-article-content, .dcms-article__content) h2 {
      font-size: 1.5rem;
    }
    
    :is(.dcms-article-content, .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) {
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.align-center,
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.align-wide,
    :is(.dcms-article-content, .dcms-article__content) figure.dcms-object.align-full,
    :is(.dcms-article-content, .dcms-article__content) .dcms-embed.align-center,
    :is(.dcms-article-content, .dcms-article__content) .dcms-embed.align-wide,
    :is(.dcms-article-content, .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) */
:is(.dcms-article-content, .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 */
:is(.dcms-article-content, .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;
}
.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 --- */
:is(.dcms-article-content, .dcms-article__content) .dcms-toc.align-float-left {
    float: left;
    margin: 0.25rem var(--gutter) 1rem 0;
}
:is(.dcms-article-content, .dcms-article__content) .dcms-toc.align-float-right {
    float: right;
    margin: 0.25rem 0 1rem var(--gutter);
}
:is(.dcms-article-content, .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;
}
:is(.dcms-article-content, .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) {
    :is(.dcms-article-content, .dcms-article__content) .dcms-toc.align-float-wide-left {
        margin-left: 0;
        margin-right: var(--gutter);
    }
    :is(.dcms-article-content, .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) {
    :is(.dcms-article-content, .dcms-article__content) .dcms-toc.align-float-wide-left,
    :is(.dcms-article-content, .dcms-article__content) .dcms-toc.align-float-wide-right,
    :is(.dcms-article-content, .dcms-article__content) .dcms-toc.align-float-left,
    :is(.dcms-article-content, .dcms-article__content) .dcms-toc.align-float-right {
        float: none;
        max-width: 100%;
        margin: 1rem 0;
    }
}

/* (no smooth scroll — content.css is animation-free by owner decision; anchor jumps are instant) */

/* ============================================
   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 --- */
:is(.dcms-article-content, .dcms-article__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. --- */
:is(.dcms-article-content, .dcms-article__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);
  text-decoration: none;
  color: inherit;
}

:is(.dcms-article-content, .dcms-article__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);
}

:is(.dcms-article-content, .dcms-article__content) a.dcms-article-ref-card {
  cursor: pointer;
}

/* --- Thumbnail: block, 3:2 — the only in-flow child, defines card height --- */
:is(.dcms-article-content, .dcms-article__content) .dcms-article-ref-thumb {
  display: block;
  width: 160px;
  height: auto; /* R38 defense — keep aspect-ratio authoritative even if a height attr / declaration sneaks in */
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: center;
  background: #f3f4f6;
}

/* --- Content: absolute, pinned beside thumb, clips to card height --- */
:is(.dcms-article-content, .dcms-article__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 --- */
:is(.dcms-article-content, .dcms-article__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 --- */
:is(.dcms-article-content, .dcms-article__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) --- */
:is(.dcms-article-content, .dcms-article__content) .dcms-article-ref-excerpt {
  display: none;
}

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

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

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

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

:is(.dcms-article-content, .dcms-article__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 */
:is(.dcms-article-content, .dcms-article__content) .dcms-article-ref[class*="align-float"] .dcms-article-ref-label {
  display: none;
}

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

/* --- Compact --- */
:is(.dcms-article-content, .dcms-article__content) .dcms-article-ref.ref-compact .dcms-article-ref-thumb {
  width: 130px;
}

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

:is(.dcms-article-content, .dcms-article__content) .dcms-article-ref.ref-compact .dcms-article-ref-label {
  font-size: 10px;
}

:is(.dcms-article-content, .dcms-article__content) .dcms-article-ref.ref-compact .dcms-article-ref-title {
  font-size: 13px;
}

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

:is(.dcms-article-content, .dcms-article__content) .dcms-article-ref.ref-vertical .dcms-article-ref-content {
  position: static;
  padding: 14px 16px;
}

:is(.dcms-article-content, .dcms-article__content) .dcms-article-ref.ref-vertical .dcms-article-ref-title {
  -webkit-line-clamp: 3;
}

/* Vertical: show excerpt */
:is(.dcms-article-content, .dcms-article__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 --- */
:is(.dcms-article-content, .dcms-article__content) .dcms-article-ref.ref-minimal .dcms-article-ref-card {
  background: #f9fafb;
  border: none;
  border-left: 4px solid #3b82f6;
  box-shadow: none;
}

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

:is(.dcms-article-content, .dcms-article__content) .dcms-article-ref.ref-minimal .dcms-article-ref-thumb {
  display: none;
}

:is(.dcms-article-content, .dcms-article__content) .dcms-article-ref.ref-minimal .dcms-article-ref-content {
  position: static;
  padding: 10px 14px;
}

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

  :is(.dcms-article-content, .dcms-article__content) .dcms-article-ref-content {
    left: 120px;
  }

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

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

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

  :is(.dcms-article-content, .dcms-article__content) .dcms-article-ref.ref-vertical .dcms-article-ref-thumb {
    width: 100%;
  }

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

  :is(.dcms-article-content, .dcms-article__content) .dcms-article-ref.ref-compact .dcms-article-ref-thumb {
    width: 100px;
  }

  :is(.dcms-article-content, .dcms-article__content) .dcms-article-ref.ref-compact .dcms-article-ref-content {
    left: 100px;
  }
}

/* --- Responsive: small mobile — reset float --- */
@media (max-width: 480px) {
  :is(.dcms-article-content, .dcms-article__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
   ============================================ */

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

:is(.dcms-article-content, .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;
}

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

:is(.dcms-article-content, .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;
}

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

:is(.dcms-article-content, .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;
}

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

:is(.dcms-article-content, .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;
}

:is(.dcms-article-content, .dcms-article__content) .dcms-footer-link .article-related-content {
  flex: 1;
  min-width: 0;
}

:is(.dcms-article-content, .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;
}

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

:is(.dcms-article-content, .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
   ============================================ */

/* ============================================
   R31 — Files upload (data-file-id viewer)
   Commit #12 — base styles cho file embed token.
   Viewer JS (commit #11, deferred) sẽ render PDF iframe / DOCX preview /
   XLSX card inline. CSS định nghĩa align tokens + container styles.
   ============================================ */
:is(.dcms-article-content, .dcms-article__content) .dcms-file {
  display: block;
  margin: 24px auto;
  padding: 16px;
  border: 1px solid #e5e7eb;
  /* v5 fix #6: removed border-radius per user "ko có round corner" */
  background: #f9fafb;
  max-width: 100%;
  overflow: hidden;
}

/* v5 Item #5: migrate from data-align attr → class selectors. V2 editor
   align mutation writes class (`.align-center/.align-wide/.align-full` per
   floating-toolbar.js _setAlign) — file CSS previously used [data-align]
   attr which never matched class-based mutations. Backwards-compat: keep
   data-align selectors as fallback for any pre-v5 saved content (no migration
   needed since data-align was the ONLY mechanism before — no class+attr
   coexistence in past bodies). */
/* Align: none (default — centered) */
:is(.dcms-article-content, .dcms-article__content) .dcms-file.align-center,
:is(.dcms-article-content, .dcms-article__content) .dcms-file[data-align="none"],
:is(.dcms-article-content, .dcms-article__content) .dcms-file:not([class*="align-"]):not([data-align]) {
  margin-left: auto;
  margin-right: auto;
  max-width: 680px;
}

/* Align: wide — extends beyond article column */
:is(.dcms-article-content, .dcms-article__content) .dcms-file.align-wide,
:is(.dcms-article-content, .dcms-article__content) .dcms-file[data-align="wide"] {
  margin-left: -40px;
  margin-right: -40px;
  max-width: calc(100% + 80px);
}

/* Align: full — edge-to-edge viewport (PRESERVED for non-file fallback though
   v5 predicate B6 excludes file from objectAlignFull token; legacy bodies
   may have this) */
:is(.dcms-article-content, .dcms-article__content) .dcms-file.align-full,
:is(.dcms-article-content, .dcms-article__content) .dcms-file[data-align="full"] {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  max-width: 100vw;
}

/* File card metadata (always visible) */
:is(.dcms-article-content, .dcms-article__content) .dcms-file__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

/* R31 v4 (codex plan-review v4 APPROVE): inline SVG icons — no Font Awesome
   dep on frontsite. Frontsite layout doesn't load FA; editor admin layout does.
   CSS overrides FA glyph rendering (font-size:0 + color:transparent) AND adds
   SVG background-image — both editor + frontsite render SAME pixel icon.
   SVG paths from Font Awesome 6 Free (CC BY 4.0 license-compatible). */
:is(.dcms-article-content, .dcms-article__content) .dcms-file__icon {
  display: inline-block;
  width: 32px;
  height: 40px;
  flex-shrink: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  /* Hide FA glyph (if FA loaded) — SVG background takes precedence. */
  font-size: 0;
  color: transparent;
}

:is(.dcms-article-content, .dcms-article__content) .dcms-file__icon--pdf {
  /* v5 fix #1: viewBox 0 0 512 512 (was 0 0 384 512 — clipped "F" letter trong "PDF" text at x=384+). FA6 fa-file-pdf actual canvas is 512×512 vì có text PDF thò ra ngoài file shape. */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="%23dc2626"><path d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 144-208 0c-35.3 0-64 28.7-64 64l0 144-48 0c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128zM176 352l32 0c30.9 0 56 25.1 56 56s-25.1 56-56 56l-16 0 0 32c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-48 0-80c0-8.8 7.2-16 16-16zm32 80c13.3 0 24-10.7 24-24s-10.7-24-24-24l-16 0 0 48 16 0zm96-80l32 0c26.5 0 48 21.5 48 48l0 64c0 26.5-21.5 48-48 48l-32 0c-8.8 0-16-7.2-16-16l0-128c0-8.8 7.2-16 16-16zm32 128c8.8 0 16-7.2 16-16l0-64c0-8.8-7.2-16-16-16l-16 0 0 96 16 0zm80-112c0-8.8 7.2-16 16-16l48 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0 0 32 32 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0 0 48c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-64 0-64z"/></svg>');
}

:is(.dcms-article-content, .dcms-article__content) .dcms-file__icon--docx {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="%232563eb"><path d="M64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-288-128 0c-17.7 0-32-14.3-32-32L224 0 64 0zM256 0l0 128 128 0L256 0zM111 257.1l26.8 89.2 31.6-90.3c3.4-9.6 12.5-16.1 22.7-16.1s19.3 6.4 22.7 16.1l31.6 90.3L273.3 257c2.5-8.5 11.4-13.3 19.9-10.8s13.3 11.4 10.8 19.9l-48 160c-2.1 6.9-8.4 11.7-15.6 11.9s-13.8-4.3-16.1-11.1L192 328.9l-32.3 98c-2.2 6.8-8.6 11.3-15.8 11.1s-13.5-4.9-15.6-11.9l-48-160c-2.5-8.5 2.3-17.4 10.8-19.9s17.4 2.3 19.9 10.8z"/></svg>');
}

:is(.dcms-article-content, .dcms-article__content) .dcms-file__icon--xlsx {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="%2316a34a"><path d="M64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-288-128 0c-17.7 0-32-14.3-32-32L224 0 64 0zM256 0l0 128 128 0L256 0zM155.7 250.2L192 302.1l36.3-51.9c7.6-10.9 22.6-13.5 33.4-5.9s13.5 22.6 5.9 33.4L221.3 344l46.4 66.2c7.6 10.9 5 25.8-5.9 33.4s-25.8 5-33.4-5.9L192 385.8l-36.3 51.9c-7.6 10.9-22.6 13.5-33.4 5.9s-13.5-22.6-5.9-33.4L162.7 344l-46.4-66.2c-7.6-10.9-5-25.8 5.9-33.4s25.8-5 33.4 5.9z"/></svg>');
}

/* Generic file fallback (when extension unknown / not in PDF/DOCX/XLSX set). */
:is(.dcms-article-content, .dcms-article__content) .dcms-file__icon:not(.dcms-file__icon--pdf):not(.dcms-file__icon--docx):not(.dcms-file__icon--xlsx) {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="%236b7280"><path d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 288c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128z"/></svg>');
}

:is(.dcms-article-content, .dcms-article__content) .dcms-file__info {
  flex: 1;
  min-width: 0;
}

:is(.dcms-article-content, .dcms-article__content) .dcms-file__title {
  font-weight: 600;
  color: #111827;
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:is(.dcms-article-content, .dcms-article__content) .dcms-file__size {
  color: #6b7280;
  font-size: 12px;
}

:is(.dcms-article-content, .dcms-article__content) .dcms-file__download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  /* v5 fix #2: DCMS primary black (gray-900) — was blue-600 #2563eb. content.css shared frontsite, hardcode color (no Tailwind class names allowed). */
  background: #111827;
  color: #ffffff !important;
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}

:is(.dcms-article-content, .dcms-article__content) .dcms-file__download:hover {
  background: #1f2937; /* gray-800 */
}

:is(.dcms-article-content, .dcms-article__content) .dcms-file__download:active {
  background: #374151; /* gray-700 */
}

/* R31 v4: download arrow inside .dcms-file__download anchor — SVG icon
   replaces FA fa-download glyph for frontsite (no FA dep). */
:is(.dcms-article-content, .dcms-article__content) .dcms-file__download i {
  display: inline-block;
  width: 14px;
  height: 14px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  /* fa-download solid path, fill white to inherit button color. */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="%23ffffff"><path d="M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 242.7-73.4-73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L288 274.7 288 32zM64 352c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-101.5 0-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352 64 352zm368 56a24 24 0 1 1 0 48 24 24 0 1 1 0-48z"/></svg>');
  font-size: 0;
  color: transparent;
  vertical-align: middle;
}

/* R31 #11 — Preview toggle button (added by FileViewer behavior) */
:is(.dcms-article-content, .dcms-article__content) .dcms-file__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #374151;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 8px;
}

:is(.dcms-article-content, .dcms-article__content) .dcms-file__toggle:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

:is(.dcms-article-content, .dcms-article__content) .dcms-file__loading,
:is(.dcms-article-content, .dcms-article__content) .dcms-file__preview-error {
  text-align: center;
  padding: 24px;
  color: #6b7280;
  font-size: 13px;
}

:is(.dcms-article-content, .dcms-article__content) .dcms-file__preview-error {
  color: #dc2626;
}

/* PDF inline preview (viewer renders iframe).
   v5 fix #4: A4 aspect ratio thay fixed pixel height. Default portrait;
   landscape variant via wrapper class. Iframe fills wrapper 100%. */
:is(.dcms-article-content, .dcms-article__content) .dcms-file__preview-pdf {
  margin-top: 12px;
  border: 1px solid #d1d5db;
  /* v5 fix #6: removed border-radius */
  background: #ffffff;
  /* A4 portrait aspect ratio: 210mm × 297mm = 1 / 1.4142 */
  aspect-ratio: 1 / 1.4142;
  width: 100%;
  max-height: 90vh; /* defense vs huge iframe nếu container không bound width */
  overflow: hidden;
}

:is(.dcms-article-content, .dcms-article__content) .dcms-file__preview-pdf--landscape {
  /* A4 landscape: 297mm × 210mm = 1.4142 / 1 */
  aspect-ratio: 1.4142 / 1;
}

:is(.dcms-article-content, .dcms-article__content) .dcms-file__preview-pdf iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* DOCX inline preview (docx-preview library, lazy-loaded) */
:is(.dcms-article-content, .dcms-article__content) .dcms-file__preview-docx {
  margin-top: 12px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  /* v5 fix #6: removed border-radius */
  max-height: 800px;
  overflow-y: auto;
}

/* Mobile responsive — align wide/full degrade to normal.
   v5 #5: support both class + data-align selectors (post-v5 class-based + legacy attr). */
@media (max-width: 768px) {
  :is(.dcms-article-content, .dcms-article__content) .dcms-file.align-wide,
  :is(.dcms-article-content, .dcms-article__content) .dcms-file.align-full,
  :is(.dcms-article-content, .dcms-article__content) .dcms-file[data-align="wide"],
  :is(.dcms-article-content, .dcms-article__content) .dcms-file[data-align="full"] {
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
    /* v5 fix #6: removed border-radius */
  }
  /* v5 fix #4: aspect-ratio takes over from fixed height; mobile cap via max-height.
     Iframe inherits 100% of wrapper which aspect-ratio sizes appropriately. */
  :is(.dcms-article-content, .dcms-article__content) .dcms-file__preview-pdf {
    max-height: 75vh;
  }
}

