/*
TDN QA, Single Article, Performance, and Accessibility layer v3.3.3
Purpose: responsive stability, article page polish, trust cues, and safer focus/tap behavior.
This file is intentionally loaded last.
*/

:root {
    --tdn-qa-radius: 14px;
    --tdn-qa-hairline: color-mix(in srgb, var(--color-border, #e2e2e6) 86%, transparent);
    --tdn-qa-muted: var(--color-fg-muted, #5a5a5a);
    --tdn-qa-surface: var(--color-surface, #ffffff);
    --tdn-qa-soft: var(--color-bg-alt, #fafafa);
    --tdn-qa-shadow: 0 1px 2px rgba(12, 12, 12, .04), 0 18px 44px rgba(12, 12, 12, .055);
}

/* Global responsive safety */
.tdn-main,
.hp-hero,
.hp-hero__inner,
.hp-hero__lead,
.hp-hero__side,
.tdn-mag-container,
.tdn-single-wrap,
.tdn-article,
.tdn-sidebar,
.tdn-related,
.tdn-related-grid,
.tdn-footer-container {
    min-width: 0;
}

.tdn-card,
.hp-hero__lead,
.hp-hero__side-card,
.tdn-river-card,
.tdn-related-card,
.tdn-sidebar-post,
.tdn-footer-post {
    overflow-wrap: anywhere;
    word-break: normal;
}

/* Homepage mobile QA */
@media (max-width: 860px) {
    .hp-hero {
        display: block !important;
        overflow: visible !important;
    }

    .hp-hero__inner {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        min-height: 0 !important;
        gap: 16px !important;
        padding-block: 16px 20px !important;
    }

    .hp-hero__lead {
        order: 1 !important;
        width: 100% !important;
        flex: 0 0 auto !important;
        position: relative !important;
        inset: auto !important;
        z-index: 1 !important;
        margin: 0 !important;
    }

    .hp-hero__side {
        order: 2 !important;
        width: 100% !important;
        flex: 0 0 auto !important;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 14px !important;
        border: 0 !important;
        position: relative !important;
        inset: auto !important;
        z-index: 0 !important;
        transform: none !important;
    }

    .hp-hero__side--left {
        order: 2 !important;
    }

    .hp-hero__side--right {
        order: 3 !important;
    }

    .hp-hero__side-card {
        min-height: 0 !important;
        height: auto !important;
        flex: 0 0 auto !important;
        position: relative !important;
        inset: auto !important;
    }
}

@media (max-width: 600px) {
    .hp-hero__side {
        grid-template-columns: 1fr !important;
    }

    .hp-hero__side-card,
    .tdn-river-card,
    .tdn-related-card {
        border-radius: 12px !important;
    }
}

/* Single article page polish */
.single-post .tdn-single-wrap {
    max-width: min(1180px, calc(100vw - 32px));
    gap: clamp(28px, 5vw, 56px);
    padding-top: clamp(24px, 4vw, 44px);
}

.single-post .tdn-article {
    background: var(--tdn-qa-surface);
    border: 1px solid var(--tdn-qa-hairline);
    border-radius: var(--tdn-qa-radius);
    box-shadow: var(--tdn-qa-shadow);
    padding: clamp(20px, 4vw, 38px);
}

.single-post .tdn-article-header {
    margin-bottom: clamp(22px, 4vw, 34px);
}

.single-post .tdn-article-meta-top {
    gap: 10px;
    row-gap: 8px;
}

.single-post .tdn-article-title {
    max-width: 980px;
    font-size: clamp(2rem, 4.2vw, 3.35rem);
    line-height: 1.05;
    letter-spacing: -.035em;
    margin-bottom: clamp(16px, 3vw, 24px);
}

.single-post .tdn-article-byline-bar {
    background: color-mix(in srgb, var(--color-bg-alt, #fafafa) 78%, var(--color-surface, #fff));
    border: 1px solid var(--tdn-qa-hairline);
    border-radius: 999px;
    padding: 10px 12px 10px 16px;
}

.single-post .tdn-article-share-btns {
    gap: 8px;
}

.single-post .tdn-article-share-btn {
    min-height: 38px;
    border-radius: 999px;
}

.single-post .tdn-article-featured {
    margin: clamp(18px, 4vw, 34px) 0;
}

.single-post .tdn-article-featured-inner {
    border-radius: var(--tdn-qa-radius);
    overflow: hidden;
    border: 1px solid var(--tdn-qa-hairline);
    background: #111;
}

.single-post .tdn-article-caption {
    max-width: 900px;
    margin: 9px auto 0;
    color: var(--tdn-qa-muted);
    font-size: .82rem;
    line-height: 1.45;
    text-align: center;
}

.single-post .tdn-article-content {
    max-width: 760px;
    margin-inline: auto;
    font-size: clamp(1.05rem, .98rem + .28vw, 1.16rem);
    line-height: 1.82;
}

.single-post .tdn-article-content > p:first-of-type {
    font-size: clamp(1.1rem, 1.02rem + .32vw, 1.22rem);
    line-height: 1.78;
}

.single-post .tdn-article-content a {
    color: var(--tdn-red);
    text-decoration: underline;
    text-underline-offset: .18em;
    text-decoration-thickness: .08em;
}

.single-post .tdn-article-content img,
.single-post .tdn-article-content iframe,
.single-post .tdn-article-content video {
    border-radius: 12px;
}

.single-post .tdn-article-tags {
    max-width: 760px;
    margin-inline: auto;
    padding-top: 22px;
    border-top: 1px solid var(--tdn-qa-hairline);
}

.single-post .tdn-post-nav {
    max-width: 760px;
    margin-inline: auto;
    gap: 14px;
}

.single-post .tdn-post-nav-item {
    border: 1px solid var(--tdn-qa-hairline);
    border-radius: 12px;
    padding: 14px 16px;
    background: var(--tdn-qa-soft);
}

.single-post .tdn-sidebar-widget {
    border-radius: var(--tdn-qa-radius);
    border: 1px solid var(--tdn-qa-hairline);
    box-shadow: 0 1px 2px rgba(12, 12, 12, .035);
}

.single-post .tdn-related {
    margin-top: clamp(28px, 5vw, 58px);
}

.single-post .tdn-related-grid {
    gap: clamp(16px, 2.4vw, 24px);
}

.single-post .tdn-related-card {
    border: 1px solid var(--tdn-qa-hairline);
    border-radius: var(--tdn-qa-radius);
    background: var(--tdn-qa-surface);
    box-shadow: 0 1px 2px rgba(12, 12, 12, .035);
    padding-bottom: 14px;
}

.single-post .tdn-related-thumb,
.single-post .tdn-related-img {
    border-radius: var(--tdn-qa-radius) var(--tdn-qa-radius) 0 0;
}

/* Trust and footer polish */
.tdn-footer-bottom-inner {
    gap: 12px;
}

.tdn-footer-about {
    line-height: 1.65;
}

/* Accessibility and tap targets */
.tdn-skip-link:focus {
    position: fixed;
    top: calc(var(--header-height, 86px) + 8px);
    left: 16px;
    z-index: 100000;
    background: var(--tdn-red);
    color: #fff;
    padding: 10px 14px;
    border-radius: 999px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .24);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--tdn-red) 70%, #fff) !important;
    outline-offset: 3px !important;
}

.tdn-hdr-burger,
.tdn-search-toggle,
.tdn-theme-toggle,
.tdn-article-share-btn,
.tdn-footer-social-link,
.tdn-sidebar-cat-link,
.tdn-tag {
    min-width: 44px;
    min-height: 44px;
}

/* Article mobile refinement */
@media (max-width: 980px) {
    .single-post .tdn-single-wrap {
        display: block;
        max-width: min(860px, calc(100vw - 24px));
    }

    .single-post .tdn-sidebar {
        margin-top: 34px;
    }
}

@media (max-width: 720px) {
    .single-post .tdn-single-wrap {
        max-width: 100%;
        padding-inline: 14px;
        padding-top: 18px;
    }

    .single-post .tdn-article {
        border-radius: 12px;
        padding: 18px 16px 24px;
    }

    .single-post .tdn-article-title {
        font-size: clamp(1.9rem, 10vw, 2.65rem);
    }

    .single-post .tdn-article-byline-bar {
        border-radius: 12px;
        align-items: flex-start;
        flex-direction: column;
    }

    .single-post .tdn-article-share-btns {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .single-post .tdn-article-share-btn {
        justify-content: center;
    }

    .single-post .tdn-article-content {
        font-size: 1.06rem;
        line-height: 1.78;
    }

    .single-post .tdn-post-nav {
        display: grid;
        grid-template-columns: 1fr;
    }

    .single-post .tdn-related-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tdn-card,
    .hp-hero__lead,
    .hp-hero__side-card,
    .tdn-river-card,
    .tdn-article-share-btn,
    .tdn-related-card {
        transform: none !important;
    }
}


/* v3.3.4 mobile hero side-story alignment fix
   The side story thumbnails under the lead story should not inherit the
   desktop/publication-polish aspect-ratio behavior on phones. Force the hero
   into a clean single-column mobile stack with centered, full-width cards. */
@media (max-width: 860px) {
    .hp-hero,
    .hp-hero__inner {
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }

    .hp-hero__inner {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .hp-hero__center {
        order: 1 !important;
        width: 100% !important;
        max-width: none !important;
        margin-inline: 0 !important;
    }

    .hp-hero__side,
    .hp-hero__side--left,
    .hp-hero__side--right {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        align-self: stretch !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .hp-hero__side--left {
        order: 2 !important;
    }

    .hp-hero__side--right {
        order: 3 !important;
    }

    .hp-hero__side-card {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        display: grid !important;
        grid-template-columns: minmax(108px, 38%) minmax(0, 1fr) !important;
        align-items: stretch !important;
        overflow: hidden !important;
    }

    .hp-hero__side-img-wrap {
        width: 100% !important;
        height: auto !important;
        min-height: 118px !important;
        aspect-ratio: 4 / 3 !important;
        border-radius: 12px 0 0 12px !important;
    }

    .hp-hero__side-text {
        min-width: 0 !important;
        width: 100% !important;
        justify-content: center !important;
        padding: 13px 14px !important;
    }
}

@media (max-width: 540px) {
    .hp-hero__side-card {
        grid-template-columns: 1fr !important;
    }

    .hp-hero__side-img-wrap {
        min-height: 0 !important;
        aspect-ratio: 16 / 9 !important;
        border-radius: 12px 12px 0 0 !important;
    }

    .hp-hero__side-text {
        padding: 14px 15px 16px !important;
    }
}
