/*
 * T04 / T08 / T09 parity layer.
 *
 * The canonical mockups use Tailwind Play CDN, while the theme ships a purged
 * utility build. These selectors are deliberately rooted at the four editorial
 * template IDs so missing arbitrary utilities cannot change their structure.
 */
:is(#template-pulse-news, #template-news-index, #template-single-news, #template-single-guide) {
    width: 100%;
    min-height: 100vh;
    position: relative;
    border-bottom: 8px solid rgb(228 228 231);
    margin-bottom: 4rem;
    padding-block: 2rem;
}

html.dark :is(#template-pulse-news, #template-news-index, #template-single-news, #template-single-guide) {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

:is(#template-news-index, #template-single-news, #template-single-guide) > .max-w-\[1600px\],
#template-pulse-news > .max-w-\[1600px\] {
    width: 100%;
    max-width: 1600px;
    margin-inline: auto;
    padding-inline: 1rem;
}

:is(#template-news-index, #template-single-news, #template-single-guide) .rounded-\[2rem\],
#template-pulse-news .rounded-\[2rem\] {
    border-radius: 2rem;
}

:is(#template-pulse-news, #template-news-index, #template-single-news, #template-single-guide) .backdrop-blur-3xl {
    -webkit-backdrop-filter: blur(64px);
    backdrop-filter: blur(64px);
}

:is(#template-pulse-news, #template-news-index, #template-single-news, #template-single-guide) .bg-white\/80 {
    background-color: rgba(255, 255, 255, 0.8);
}

:is(#template-pulse-news, #template-news-index, #template-single-news, #template-single-guide) .bg-white\/60 {
    background-color: rgba(255, 255, 255, 0.6);
}

:is(#template-pulse-news, #template-news-index, #template-single-news, #template-single-guide) .border-zinc-200\/80 {
    border-color: rgba(228, 228, 231, 0.8);
}

:is(#template-pulse-news, #template-news-index, #template-single-news, #template-single-guide) .border-zinc-200\/50 {
    border-color: rgba(228, 228, 231, 0.5);
}

html.dark :is(#template-pulse-news, #template-news-index, #template-single-news, #template-single-guide) .dark\:bg-\[\#060c0a\]\/90 {
    background-color: rgba(6, 12, 10, 0.9);
}

html.dark :is(#template-pulse-news, #template-news-index, #template-single-news, #template-single-guide) .dark\:bg-\[\#0a1310\] {
    background-color: #0a1310;
}

html.dark :is(#template-pulse-news, #template-news-index, #template-single-news, #template-single-guide) .dark\:bg-black\/60 {
    background-color: rgba(0, 0, 0, 0.6);
}

.hq-editorial-media {
    aspect-ratio: 21 / 9;
}

.hq-editorial-media--placeholder {
    isolation: isolate;
    min-height: 12rem;
    color: #fff;
}

.hq-news-feature > a {
    display: grid;
}

.hq-news-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
}

.hq-pulse-card {
    border-color: rgba(228, 228, 231, 0.5);
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

#template-pulse-news .hq-pulse-deals-empty {
    min-height: 49rem;
    display: grid;
    align-content: center;
    gap: 2rem;
    padding: clamp(2rem, 5vw, 4rem);
}

#template-pulse-news .hq-pulse-deals-empty__signal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-align: left;
}

#template-pulse-news .hq-pulse-deals-empty__icon {
    display: inline-flex;
    width: 3.5rem;
    height: 3.5rem;
    flex: none;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: rgba(4, 120, 87, 0.1);
    color: #047857;
}

#template-pulse-news .hq-pulse-deals-empty__facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    width: min(52rem, 100%);
    margin-inline: auto;
}

#template-pulse-news .hq-pulse-deals-empty__facts > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.25rem;
    border: 1px solid rgba(228, 228, 231, 0.7);
    border-radius: 1rem;
    background: rgba(244, 244, 245, 0.72);
    padding: 1rem;
    color: #52525b;
    font-size: 0.75rem;
}

#template-pulse-news .hq-pulse-deals-empty__facts strong {
    color: #18181b;
    font-size: 0.8125rem;
}

.hq-guide-toc {
    border-color: rgba(228, 228, 231, 0.8);
    background: rgba(255, 255, 255, 0.8);
}

.hq-editorial-copy,
.hq-guide-content {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.hq-editorial-grid {
    align-items: start !important;
}

.hq-editorial-sidebar {
    align-self: start !important;
}

.hq-guide-hero {
    min-height: 0;
}

html.dark #template-single-guide .hq-guide-hero.bg-white\/80 {
    background-color: rgba(6, 12, 10, 0.95) !important;
}

.hq-guide-hero__copy {
    min-width: 0;
}

/* T04 is intentionally denser than the site-wide section rhythm. */
#template-pulse-news > .max-w-\[1600px\] > section[data-hq-section] {
    padding-block: 2rem !important;
}

#template-pulse-news > .max-w-\[1600px\] > section:first-child {
    padding-top: 2.5rem;
}

@media (min-width: 640px) {
    #template-pulse-news > .max-w-\[1600px\] > section:first-child {
        padding-top: 3.5rem;
    }
}

#template-pulse-news > .max-w-\[1600px\] > section:first-child > header {
    margin-bottom: 0;
}

#template-pulse-news [data-hq-section]::before {
    content: none !important;
}

.hq-editorial-copy > .prose,
.hq-guide-content > .prose {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    color: rgb(55 65 81);
    font-size: clamp(1.0625rem, 0.98rem + 0.35vw, 1.2rem);
    line-height: 1.8;
    max-width: 72ch;
    margin-inline: 0;
}

.hq-editorial-copy > .prose > p:first-of-type,
.hq-guide-content > .prose > p:first-of-type {
    margin-top: 0;
    color: rgb(17 24 39);
    font-size: clamp(1.1875rem, 1.08rem + 0.4vw, 1.35rem);
    font-weight: 500;
    line-height: 1.75;
}

.hq-editorial-copy > .prose h2,
.hq-guide-content > .prose h2,
.hq-guide-content > .prose section {
    scroll-margin-top: 6.5rem;
}

.hq-editorial-copy > .prose h2,
.hq-guide-content > .prose h2 {
    padding-top: 1.75rem;
    margin-top: 2rem;
    color: rgb(15 23 42);
    font-family: var(--hq-font-display, inherit);
    font-size: clamp(1.5rem, 1.25rem + 0.85vw, 2.125rem);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.025em;
    border-top: 1px solid rgba(228, 228, 231, 0.6);
}

.hq-editorial-copy > .prose h2:first-of-type,
.hq-guide-content > .prose h2:first-of-type {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.hq-editorial-copy > .prose h3,
.hq-guide-content > .prose h3 {
    scroll-margin-top: 6.5rem;
    color: rgb(30 41 59);
    font-family: var(--hq-font-display, inherit);
    font-size: clamp(1.2rem, 1.1rem + 0.4vw, 1.45rem);
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.015em;
    margin-top: 1.25rem;
}

.hq-editorial-copy > .prose blockquote,
.hq-guide-content > .prose blockquote {
    border-left: 4px solid var(--theme-500, #10b981);
    background: rgba(16, 185, 129, 0.04);
    border-radius: 0 1rem 1rem 0;
    margin-block: 2rem;
    padding: 1rem 1.25rem 1rem 1.5rem;
    color: rgb(31 41 55);
    font-size: 1.125rem;
    font-style: italic;
    line-height: 1.7;
}

.hq-editorial-copy > .prose ul,
.hq-guide-content > .prose ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hq-editorial-copy > .prose ol,
.hq-guide-content > .prose ol {
    list-style-type: decimal;
    padding-left: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hq-editorial-copy > .prose li::marker,
.hq-guide-content > .prose li::marker {
    color: #10b981;
    font-weight: 700;
}

.hq-editorial-copy > .prose a,
.hq-guide-content > .prose a {
    color: #059669;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: rgba(16, 185, 129, 0.35);
    font-weight: 600;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.hq-editorial-copy > .prose a:hover,
.hq-guide-content > .prose a:hover {
    color: #047857;
    text-decoration-color: #10b981;
}

/* Crop tall, full-page captures to the useful top viewport instead of leaving
 * hundreds of pixels of blank source-page canvas in long-form articles. */
.hq-editorial-copy > .prose figure.wp-block-image {
    max-height: min(36rem, 62vh);
    margin-block: 2rem;
    overflow: hidden;
    border: 1px solid rgb(228 228 231);
    border-radius: 1rem;
    background: rgb(244 244 245);
}

.hq-editorial-copy > .prose figure.wp-block-image > img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: min(36rem, 62vh);
    margin: 0;
    object-fit: cover;
    object-position: top;
}

.hq-editorial-copy > .prose :is(table, pre),
.hq-guide-content > .prose :is(table, pre) {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid rgb(228 228 231);
    border-radius: 0.75rem;
}

.hq-editorial-copy > .prose pre,
.hq-guide-content > .prose pre {
    white-space: pre;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.hq-editorial-copy > .prose pre.is-wrapped,
.hq-guide-content > .prose pre.is-wrapped {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.hq-editorial-table-scroll,
.hq-editorial-copy > .prose table,
.hq-guide-content > .prose table {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    display: block;
}

.hq-editorial-share {
    flex: none;
}

html.dark .hq-editorial-copy > .prose,
html.dark .hq-guide-content > .prose {
    color: rgb(209 213 219);
}

html.dark .hq-editorial-copy > .prose > p:first-of-type,
html.dark .hq-guide-content > .prose > p:first-of-type {
    color: #f9fafb;
}

html.dark .hq-editorial-copy > .prose h2,
html.dark .hq-guide-content > .prose h2 {
    color: #f8fafc;
    border-top-color: rgba(255, 255, 255, 0.08);
}

html.dark .hq-editorial-copy > .prose h3,
html.dark .hq-guide-content > .prose h3 {
    color: #f1f5f9;
}

html.dark .hq-editorial-copy > .prose blockquote,
html.dark .hq-guide-content > .prose blockquote {
    border-left-color: var(--theme-400, #34d399);
    background: rgba(16, 185, 129, 0.08);
    color: rgb(229 231 235);
}

html.dark .hq-editorial-copy > .prose a,
html.dark .hq-guide-content > .prose a {
    color: #34d399;
    text-decoration-color: rgba(52, 211, 153, 0.4);
}

html.dark .hq-editorial-copy > .prose a:hover,
html.dark .hq-guide-content > .prose a:hover {
    color: #6ee7b7;
    text-decoration-color: #6ee7b7;
}

html.dark .hq-editorial-copy > .prose :is(table, pre),
html.dark .hq-guide-content > .prose :is(table, pre) {
    border-color: rgba(255, 255, 255, 0.1);
}

html.dark .hq-pulse-card {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.6);
}

html.dark #template-pulse-news .hq-pulse-deals-empty__icon {
    background: rgba(16, 185, 129, 0.16);
    color: #6ee7b7;
}

html.dark #template-pulse-news .hq-pulse-deals-empty__facts > div {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #a1a1aa;
}

html.dark #template-pulse-news .hq-pulse-deals-empty__facts strong {
    color: #fafafa;
}

html.dark .hq-guide-toc {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(6, 12, 10, 0.9);
}

@media (min-width: 768px) {
    .hq-news-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    :is(#template-news-index, #template-single-news, #template-single-guide) > .max-w-\[1600px\],
    #template-pulse-news > .max-w-\[1600px\] {
        padding-inline: 2rem;
    }

    .hq-editorial-grid {
        display: grid;
        grid-template-columns: repeat(12, minmax(0, 1fr));
        gap: 3.5rem;
    }

    .hq-editorial-copy,
    .hq-guide-content {
        grid-column: span 8 / span 8;
        grid-row: 1;
    }

    .hq-editorial-sidebar {
        grid-column: span 4 / span 4;
        grid-row: 1;
    }

    #template-single-news .hq-editorial-copy { grid-column-start: 1; }
    #template-single-news .hq-editorial-sidebar { grid-column-start: 9; }

    .hq-editorial-sidebar > .sticky {
        position: sticky;
        top: 5rem;
    }

    .hq-news-feature > a {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    #main-content {
        padding-top: 6rem;
    }

    #template-pulse-news .hq-pulse-deals-empty {
        min-height: 68rem;
        align-content: center;
        padding-inline: 1.25rem;
    }

    #template-pulse-news .hq-pulse-deals-empty__signal {
        align-items: flex-start;
    }

    #template-pulse-news .hq-pulse-deals-empty__facts {
        grid-template-columns: minmax(0, 1fr);
    }

    .hq-editorial-media {
        aspect-ratio: 16 / 10;
    }

    .hq-editorial-grid {
        gap: 2rem;
    }

    .hq-editorial-sidebar > .sticky {
        position: static;
    }

    .hq-editorial-copy > .prose :is(img, iframe, video),
    .hq-guide-content > .prose :is(img, iframe, video) {
        max-width: 100%;
        height: auto;
    }

    :is(#template-pulse-news, #template-news-index, #template-single-news, #template-single-guide) {
        border-bottom-width: 0;
        margin-bottom: 0;
        padding-top: 1rem;
    }

    #template-pulse-news {
        padding-top: 2rem;
    }

    #template-single-news {
        padding-top: 2rem;
    }

    #main-content > #template-single-guide {
        padding-top: 2rem;
    }
}

/* Authored T09 numbered heading rows already own their section spacing.
 * Keep ordinary prose and the shared heading typography unchanged. */
#template-single-guide .hq-guide-content > .prose
> section.space-y-4.pt-6.border-t
> div.flex.items-center.gap-3:first-child
> span.flex.h-8.w-8.rounded-full.font-mono:first-child
+ h2.hq-h3:not(:where(.not-prose, .not-prose *)) {
    margin-block: 0;
    padding-top: 0;
}
