/* Trường Thịnh — single post layout v3.5.1
   Loaded only on WordPress posts. No body-level overflow hiding. */

.tt-article-page {
    --tta-primary: var(--tt-primary, var(--primary-color, var(--fs-color-primary, #d71920)));
    --tta-primary-soft: color-mix(in srgb, var(--tta-primary) 8%, #fff);
    --tta-navy: #071a3d;
    --tta-text: #15233b;
    --tta-muted: #667085;
    --tta-border: #e6eaf0;
    --tta-surface: #fff;
    --tta-surface-alt: #f7f9fc;
    --tta-radius: 18px;
    --tta-shadow: 0 12px 34px rgba(15, 31, 61, .08);
    color: var(--tta-text);
    background: var(--tta-surface-alt);
    width: 100%;
    max-width: 100%;
}

.tt-article-page,
.tt-article-page * {
    box-sizing: border-box;
}

.tt-article-container {
    width: min(100% - 32px, 1240px);
    margin-inline: auto;
    min-width: 0;
}

/* Hero */
.tt-article-hero {
    position: relative;
    background:
        radial-gradient(circle at 85% 15%, color-mix(in srgb, var(--tta-primary) 14%, transparent), transparent 34%),
        linear-gradient(135deg, #f9fbff 0%, #fff 52%, #f7f9fc 100%);
    border-bottom: 1px solid var(--tta-border);
    overflow: clip;
}

.tt-article-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 18px 0 4px;
    color: #7a8495;
    font-size: 13px;
    line-height: 1.4;
    overflow: hidden;
    white-space: nowrap;
}

.tt-article-breadcrumb a {
    color: inherit;
    text-decoration: none;
    min-width: 0;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tt-article-breadcrumb a:hover { color: var(--tta-primary); }

.tt-article-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.04fr) minmax(360px, .96fr);
    align-items: center;
    gap: clamp(28px, 5vw, 70px);
    padding: clamp(34px, 5vw, 66px) 0 clamp(40px, 5vw, 70px);
    min-width: 0;
}

.tt-article-hero-grid--no-image {
    grid-template-columns: minmax(0, 850px);
    justify-content: center;
    text-align: center;
}

.tt-article-hero-copy,
.tt-article-hero-media { min-width: 0; }

.tt-article-category {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 12px;
    border-radius: 7px;
    background: var(--tta-primary);
    color: #fff !important;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    text-decoration: none;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--tta-primary) 22%, transparent);
}

.tt-article-hero h1 {
    margin: 15px 0 14px;
    color: var(--tta-navy);
    font-size: clamp(32px, 4.1vw, 54px);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -.035em;
    overflow-wrap: anywhere;
}

.tt-article-lead {
    max-width: 760px;
    margin: 0 0 22px;
    color: #58667d;
    font-size: clamp(15px, 1.25vw, 18px);
    line-height: 1.72;
    overflow-wrap: anywhere;
}

.tt-article-hero-grid--no-image .tt-article-lead { margin-inline: auto; }

.tt-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    color: #647087;
    font-size: 13px;
}

.tt-article-hero-grid--no-image .tt-article-meta { justify-content: center; }

.tt-article-meta__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.tt-article-meta__icon {
    color: var(--tta-primary);
    font-weight: 800;
}

.tt-article-hero-media {
    margin: 0;
    width: 100%;
    border: 1px solid rgba(7, 26, 61, .08);
    border-radius: 22px;
    padding: 8px;
    background: #fff;
    box-shadow: 0 22px 55px rgba(20, 42, 79, .13);
    transform: rotate(.35deg);
}

.tt-article-hero-image {
    display: block;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 15px;
}

/* Main article layout */
.tt-article-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 294px;
    gap: 28px;
    align-items: start;
    padding-top: 34px;
    padding-bottom: 50px;
}

.tt-article-card,
.tt-article-sidebar {
    min-width: 0;
    max-width: 100%;
}

.tt-article-card {
    background: var(--tta-surface);
    border: 1px solid var(--tta-border);
    border-radius: var(--tta-radius);
    box-shadow: var(--tta-shadow);
    padding: clamp(24px, 3.2vw, 44px);
}

.tt-article-sidebar {
    position: sticky;
    top: 90px;
}

.tt-article-toc-card {
    background: #fff;
    border: 1px solid var(--tta-border);
    border-radius: 15px;
    padding: 18px;
    box-shadow: 0 8px 24px rgba(15, 31, 61, .05);
    max-height: calc(100vh - 120px);
    overflow: auto;
    overscroll-behavior: contain;
}

.tt-article-toc-heading {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--tta-border);
    color: var(--tta-navy);
    font-weight: 800;
    font-size: 15px;
}

.tt-article-toc-heading__icon { color: var(--tta-primary); font-size: 19px; }

.tt-article-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: tt-toc;
}

.tt-article-toc-list li {
    margin: 0;
    padding: 0;
    min-width: 0;
}

.tt-article-toc-list a {
    position: relative;
    display: block;
    padding: 8px 8px 8px 13px;
    border-left: 2px solid transparent;
    border-radius: 0 7px 7px 0;
    color: #5f6b7c;
    font-size: 13px;
    line-height: 1.45;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.tt-article-toc-list a:hover,
.tt-article-toc-list a.is-active {
    color: var(--tta-primary);
    background: var(--tta-primary-soft, #fff4f4);
    border-left-color: var(--tta-primary);
}

.tt-article-toc-list .tt-toc-h3 a {
    padding-left: 25px;
    font-size: 12.5px;
}

.tt-article-toc-mobile { display: none; }

/* Content safety: the key overflow fixes */
.tt-article-body {
    min-width: 0;
    max-width: 100%;
    color: #344054;
    font-size: 16px;
    line-height: 1.82;
    overflow-wrap: anywhere;
    word-break: normal;
}

.tt-article-body > * {
    max-width: 100%;
}

.tt-article-body p,
.tt-article-body li,
.tt-article-body a,
.tt-article-body h1,
.tt-article-body h2,
.tt-article-body h3,
.tt-article-body h4,
.tt-article-body h5,
.tt-article-body h6 {
    overflow-wrap: anywhere;
}

.tt-article-body h2,
.tt-article-body h3,
.tt-article-body h4 {
    color: var(--tta-navy);
    scroll-margin-top: 105px;
    letter-spacing: -.015em;
}

.tt-article-body h2 {
    margin: 38px 0 16px;
    font-size: clamp(24px, 2.6vw, 32px);
    line-height: 1.25;
}

.tt-article-body h3 {
    margin: 29px 0 13px;
    font-size: clamp(20px, 2.1vw, 25px);
    line-height: 1.3;
}

.tt-article-body h4 {
    margin: 24px 0 12px;
    font-size: 19px;
    line-height: 1.35;
}

.tt-article-body img,
.tt-article-body video,
.tt-article-body svg,
.tt-article-body canvas {
    max-width: 100% !important;
    height: auto;
}

.tt-article-body img {
    border-radius: 12px;
}

.tt-article-body figure,
.tt-article-body .wp-caption,
.tt-article-body .wp-block-image,
.tt-article-body .wp-block-gallery,
.tt-article-body .gallery,
.tt-article-body .alignwide,
.tt-article-body .alignfull {
    width: auto !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.tt-article-body iframe,
.tt-article-body object,
.tt-article-body embed {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    border: 0;
}

.tt-article-body .wp-block-embed__wrapper,
.tt-article-body .video-fit,
.tt-article-body .fluid-width-video-wrapper,
.tt-article-body .responsive-embed,
.tt-article-body .embed-responsive {
    max-width: 100% !important;
    min-width: 0 !important;
}

.tt-article-body pre,
.tt-article-body code {
    max-width: 100%;
}

.tt-article-body pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    border-radius: 10px;
    background: #101828;
    color: #f2f4f7;
    white-space: pre;
}

.tt-article-body :not(pre) > code {
    white-space: normal;
    overflow-wrap: anywhere;
}

.tt-article-body > table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tt-article-body table {
    width: max-content;
    min-width: 100%;
    max-width: none;
    border-collapse: collapse;
    margin: 18px 0;
}

.tt-article-body .tt-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    margin: 20px 0;
    border: 1px solid var(--tta-border);
    border-radius: 10px;
}

.tt-article-body .tt-table-scroll table { margin: 0; }

.tt-article-body th,
.tt-article-body td {
    padding: 11px 13px;
    border: 1px solid #e7eaf0;
    vertical-align: top;
    font-size: 14px;
}

.tt-article-body th {
    background: #f8fafc;
    color: var(--tta-navy);
    font-weight: 750;
}

.tt-article-body blockquote {
    margin: 24px 0;
    padding: 18px 20px;
    border-left: 4px solid var(--tta-primary);
    border-radius: 0 10px 10px 0;
    background: var(--tta-primary-soft, #fff7f7);
    color: #4b5565;
}

.tt-article-body ul,
.tt-article-body ol {
    padding-left: 1.35em;
}

.tt-article-body .row,
.tt-article-body .row-collapse,
.tt-article-body .row-small,
.tt-article-body .row-large,
.tt-article-body .wp-block-columns,
.tt-article-body [class*="wp-block-columns"] {
    max-width: 100% !important;
    min-width: 0 !important;
}

.tt-article-body .col,
.tt-article-body .col-inner,
.tt-article-body .wp-block-column,
.tt-article-body [class*="column"] {
    min-width: 0 !important;
    max-width: 100%;
}

.tt-article-body .wp-block-columns {
    gap: 20px;
}

.tt-article-body .button,
.tt-article-body button,
.tt-article-body input[type="submit"] {
    max-width: 100%;
    white-space: normal;
}

/* Tags / author / navigation */
.tt-article-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 34px;
    padding-top: 24px;
    border-top: 1px solid var(--tta-border);
}

.tt-article-tags__label {
    margin-right: 2px;
    color: var(--tta-navy);
    font-weight: 800;
    font-size: 13px;
}

.tt-article-tags a {
    display: inline-flex;
    padding: 6px 11px;
    border: 1px solid var(--tta-border);
    border-radius: 999px;
    background: #fff;
    color: #667085;
    font-size: 12px;
    text-decoration: none;
}

.tt-article-tags a:hover {
    border-color: var(--tta-primary);
    color: var(--tta-primary);
    background: var(--tta-primary-soft, #fff7f7);
}

.tt-article-author {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    margin-top: 28px;
    padding: 22px;
    border: 1px solid var(--tta-border);
    border-radius: 14px;
    background: #f9fbfd;
}

.tt-article-author__avatar img {
    display: block;
    width: 72px;
    height: 72px;
    border-radius: 50%;
}

.tt-article-author__eyebrow {
    display: block;
    color: var(--tta-primary);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.tt-article-author h2 {
    margin: 3px 0 4px;
    color: var(--tta-navy);
    font-size: 18px;
    line-height: 1.25;
}

.tt-article-author p {
    margin: 0;
    color: #667085;
    font-size: 13.5px;
    line-height: 1.6;
}

.tt-article-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 26px;
}

.tt-article-nav__item { min-width: 0; }
.tt-article-nav__item:empty { display: none; }
.tt-article-nav__item--next { text-align: right; }

.tt-article-nav a {
    display: flex;
    flex-direction: column;
    gap: 5px;
    height: 100%;
    padding: 14px 16px;
    border: 1px solid var(--tta-border);
    border-radius: 11px;
    color: var(--tta-navy);
    text-decoration: none;
    min-width: 0;
}

.tt-article-nav a:hover {
    border-color: color-mix(in srgb, var(--tta-primary) 45%, var(--tta-border));
    background: var(--tta-primary-soft, #fff7f7);
}

.tt-article-nav__label {
    color: var(--tta-primary);
    font-size: 11px;
    font-weight: 750;
}

.tt-article-nav strong {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

/* Related posts reuse TT cards */
.tt-article-related {
    padding: 48px 0 60px;
    background: #fff;
    border-top: 1px solid var(--tta-border);
}

.tt-article-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.tt-article-section-kicker {
    color: var(--tta-primary);
    font-size: 11px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.tt-article-section-head h2 {
    margin: 5px 0 0;
    color: var(--tta-navy);
    font-size: clamp(24px, 2.6vw, 31px);
    line-height: 1.2;
}

.tt-article-section-link {
    color: var(--tta-primary);
    font-size: 13px;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
}

.tt-article-related-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    min-width: 0;
}

.tt-article-related-grid > * { min-width: 0; }

.tt-article-related-fallback {
    min-width: 0;
    border: 1px solid var(--tta-border);
    border-radius: 14px;
    overflow: hidden;
}

.tt-article-related-fallback img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.tt-article-related-fallback h3 {
    padding: 16px;
    margin: 0;
    font-size: 16px;
}

/* Tablet */
@media (max-width: 1080px) {
    .tt-article-hero-grid {
        grid-template-columns: minmax(0, 1fr) minmax(320px, .86fr);
        gap: 32px;
    }

    .tt-article-shell {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .tt-article-sidebar { display: none; }

    .tt-article-toc-mobile {
        display: block;
        margin: 0 0 26px;
        border: 1px solid var(--tta-border);
        border-radius: 12px;
        background: #f9fbfd;
        overflow: hidden;
    }

    .tt-article-toc-mobile summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 14px 16px;
        cursor: pointer;
        color: var(--tta-navy);
        font-size: 14px;
        font-weight: 800;
        list-style: none;
    }

    .tt-article-toc-mobile summary::-webkit-details-marker { display: none; }
    .tt-article-toc-mobile[open] .tt-article-toc-toggle { transform: rotate(45deg); }
    .tt-article-toc-toggle { color: var(--tta-primary); font-size: 21px; transition: transform .2s ease; }
    .tt-article-toc-mobile .tt-article-toc-list { padding: 0 12px 12px; }

    .tt-article-related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Mobile */
@media (max-width: 849px) {
    .tt-article-container { width: min(100% - 24px, 1240px); }

    .tt-article-breadcrumb {
        padding-top: 13px;
        font-size: 12px;
    }

    .tt-article-hero-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 22px;
        padding: 26px 0 34px;
    }

    .tt-article-hero-copy { order: 1; }
    .tt-article-hero-media {
        order: 2;
        padding: 5px;
        border-radius: 15px;
        transform: none;
        box-shadow: 0 14px 35px rgba(20, 42, 79, .11);
    }
    .tt-article-hero-image { border-radius: 10px; aspect-ratio: 16 / 10; }

    .tt-article-category {
        min-height: 27px;
        padding: 5px 10px;
        font-size: 10.5px;
    }

    .tt-article-hero h1 {
        margin-top: 11px;
        font-size: clamp(28px, 8vw, 39px);
        line-height: 1.12;
        letter-spacing: -.025em;
    }

    .tt-article-lead {
        margin-bottom: 17px;
        font-size: 15px;
        line-height: 1.65;
    }

    .tt-article-meta {
        gap: 8px 13px;
        font-size: 12px;
    }

    .tt-article-shell {
        width: 100%;
        padding: 14px 0 34px;
    }

    .tt-article-card {
        border-left: 0;
        border-right: 0;
        border-radius: 0;
        padding: 22px 12px 28px;
        box-shadow: none;
    }

    .tt-article-body {
        font-size: 15.5px;
        line-height: 1.78;
    }

    .tt-article-body h2 { margin-top: 31px; }
    .tt-article-body h3 { margin-top: 25px; }

    .tt-article-body .wp-block-columns {
        flex-wrap: wrap !important;
    }

    .tt-article-body .wp-block-column {
        flex-basis: 100% !important;
        width: 100% !important;
    }

    .tt-article-author {
        grid-template-columns: 54px minmax(0, 1fr);
        gap: 13px;
        padding: 16px;
    }

    .tt-article-author__avatar img {
        width: 54px;
        height: 54px;
    }

    .tt-article-nav {
        grid-template-columns: minmax(0, 1fr);
    }

    .tt-article-nav__item--next { text-align: left; }

    .tt-article-section-head {
        align-items: center;
    }

    .tt-article-related {
        padding: 36px 0 44px;
    }

    .tt-article-related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    /* Related cards stay 2 columns on phones, but use a denser mobile presentation. */
    .tt-article-related-grid .tt-card {
        min-width: 0;
        border-radius: 11px;
    }

    .tt-article-related-grid .tt-card__body {
        gap: 7px;
        padding: 10px;
    }

    .tt-article-related-grid .tt-card__title {
        min-height: 0;
        margin: 0;
        font-size: 14px !important;
        line-height: 1.32;
        -webkit-line-clamp: 2;
    }

    .tt-article-related-grid .tt-card__excerpt {
        display: none !important;
    }

    .tt-article-related-grid .tt-card__meta {
        gap: 5px;
        font-size: 11px !important;
    }

    .tt-article-related-grid .tt-card__category {
        max-width: calc(100% - 12px);
        padding: 2px 5px;
        font-size: 9px !important;
    }

    .tt-article-related-grid .tt-card__actions,
    .tt-article-related-grid .tt-card__btn {
        display: none !important;
    }
}

/* Very small phones */
@media (max-width: 420px) {
    .tt-article-container { width: min(100% - 20px, 1240px); }
    .tt-article-related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .tt-article-related-grid .tt-card__body { padding: 8px; }
    .tt-article-related-grid .tt-card__title { font-size: 13px !important; }
    .tt-article-card { padding-left: 10px; padding-right: 10px; }
    .tt-article-meta__item { max-width: 100%; }
    .tt-article-section-link { font-size: 12px; }
}

/* Graceful fallback for browsers without color-mix() */
@supports not (color: color-mix(in srgb, red 50%, white)) {
    .tt-article-page { --tta-primary-soft: #fff5f5; }
}
