.ztk-top-info {
    --ztk-top-color: var(--theme-color, #425aef);
    --ztk-top-color-deep: #3448bd;
    --ztk-top-text: #172033;
    --ztk-top-title: var(--ztk-top-text);
    --ztk-top-custom-text: var(--ztk-top-text);
    --ztk-top-custom-title: var(--ztk-top-title);
    --ztk-top-muted: rgba(23, 32, 51, .72);
    --ztk-top-surface-a: #f9fbff;
    --ztk-top-surface-b: #e9efff;
    --ztk-top-chip-bg: rgba(255, 255, 255, .66);
    --ztk-top-chip-border: rgba(50, 68, 120, .14);
    --ztk-top-chip-hover: rgba(255, 255, 255, .9);
    --ztk-top-toggle-bg: rgba(255, 255, 255, .7);
    --ztk-top-wave-color: var(--body-bg-color, #f5f7fb);
    --ztk-top-shadow: 0 24px 70px -42px rgba(39, 60, 135, .52);
    --ztk-top-gutter: clamp(20px, 4vw, 48px);
    position: relative;
    isolation: isolate;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    min-height: max(360px, var(--ztk-top-height-desktop, 50vh));
    margin: 0 0 48px;
    padding: clamp(52px, 7vw, 92px) 0 clamp(76px, 9vw, 116px);
    border-radius: 12px;
    box-sizing: border-box;
    color: var(--ztk-top-text);
    border: 1px solid var(--ztk-top-chip-border);
    background-color: var(--ztk-top-surface-a);
    background-image:
        radial-gradient(circle at 82% 12%, rgba(96, 122, 255, .22), transparent 30%),
        radial-gradient(circle at 14% 112%, rgba(62, 205, 181, .16), transparent 36%),
        linear-gradient(125deg, var(--ztk-top-surface-a), var(--ztk-top-surface-b));
    box-shadow: var(--ztk-top-shadow);
    transition: color .28s ease, background-color .28s ease, border-color .28s ease, box-shadow .28s ease;
}

/* Split and no-image layouts intentionally use the neutral surface palette.
 * Keep their text tokens independent from the white custom colors intended
 * for image-backed Heroes, with explicit light/dark contrast fallbacks. */
.ztk-top-info.ztk-style-split,
.ztk-top-info.ztk-style-none {
    --ztk-top-text: #172033;
    --ztk-top-title: #172033;
    --ztk-top-muted: rgba(23, 32, 51, .72);
}

/* V5-style controls are expressed as safe custom properties from PHP. */
.ztk-top-info.ztk-style-background {
    --ztk-top-text: var(--ztk-top-custom-text);
    --ztk-top-title: var(--ztk-top-custom-title);
    --ztk-top-muted: rgba(255, 255, 255, .76);
    --ztk-top-chip-bg: rgba(255, 255, 255, .13);
    --ztk-top-chip-border: rgba(255, 255, 255, .19);
    --ztk-top-chip-hover: rgba(255, 255, 255, .23);
    --ztk-top-toggle-bg: rgba(20, 32, 98, .24);
    background-color: var(--ztk-top-color);
    background-image: linear-gradient(120deg, var(--ztk-top-color), var(--ztk-top-color-deep));
}

.ztk-top-info.ztk-style-background .ztk-top-info__inner {
    display: block;
}

.ztk-top-info.ztk-style-background .ztk-top-info__content {
    max-width: 1120px;
    margin-right: auto;
    margin-left: auto;
}

.ztk-top-info__cover {
    position: absolute;
    z-index: 0;
    inset: 0;
    background-position: center;
    background-size: cover;
    filter: saturate(1.08) blur(1px);
    opacity: .42;
    transform: scale(1.04);
}

.ztk-top-info.ztk-style-background .ztk-top-info__overlay {
    z-index: 1;
    background: linear-gradient(90deg, rgba(15, 35, 130, .62), rgba(15, 35, 130, .18));
}

.ztk-top-info.ztk-style-background.ztk-has-cover {
    background-image: linear-gradient(120deg, var(--ztk-top-color), var(--ztk-top-color-deep));
}

.ztk-top-info.ztk-style-none .ztk-top-info__inner {
    display: block;
    max-width: 980px;
}

.ztk-top-info.ztk-style-none .ztk-top-info__content {
    max-width: 980px;
    margin-right: auto;
    margin-left: auto;
}

.ztk-top-info__breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-bottom: 16px;
    color: var(--ztk-top-muted);
    font-size: 13px;
}

.ztk-top-info__breadcrumb a,
.ztk-top-info__breadcrumb span {
    color: inherit !important;
}

.ztk-top-info__breadcrumb-separator {
    opacity: .6;
}

body.dark-theme .ztk-top-info,
html.dark-theme .ztk-top-info,
[data-theme="dark"] .ztk-top-info {
    --ztk-top-text: #f4f7ff;
    --ztk-top-muted: rgba(232, 238, 255, .72);
    --ztk-top-surface-a: #0e1426;
    --ztk-top-surface-b: #202748;
    --ztk-top-chip-bg: rgba(255, 255, 255, .08);
    --ztk-top-chip-border: rgba(220, 228, 255, .14);
    --ztk-top-chip-hover: rgba(255, 255, 255, .14);
    --ztk-top-toggle-bg: rgba(5, 9, 22, .34);
    --ztk-top-wave-color: var(--body-bg-color, #17191d);
    --ztk-top-shadow: 0 28px 80px -42px rgba(0, 0, 0, .78);
    background-image:
        radial-gradient(circle at 82% 12%, rgba(105, 122, 255, .27), transparent 31%),
        radial-gradient(circle at 14% 112%, rgba(40, 185, 166, .13), transparent 38%),
        linear-gradient(125deg, var(--ztk-top-surface-a), var(--ztk-top-surface-b));
}

body.dark-theme .ztk-top-info.ztk-style-split,
body.dark-theme .ztk-top-info.ztk-style-none,
html.dark-theme .ztk-top-info.ztk-style-split,
html.dark-theme .ztk-top-info.ztk-style-none,
[data-theme="dark"] .ztk-top-info.ztk-style-split,
[data-theme="dark"] .ztk-top-info.ztk-style-none {
    --ztk-top-text: #f4f7ff;
    --ztk-top-title: #f4f7ff;
    --ztk-top-muted: rgba(232, 238, 255, .72);
}

body.dark-theme .ztk-top-info.ztk-style-background,
html.dark-theme .ztk-top-info.ztk-style-background,
[data-theme="dark"] .ztk-top-info.ztk-style-background {
    background-color: var(--ztk-top-color);
    background-image: linear-gradient(120deg, var(--ztk-top-color), var(--ztk-top-color-deep));
}

/*
 * `zib_single_before` is inside Zibll's offset content column. JavaScript
 * measures that real offset for left/right/no-sidebar layouts and supplies a
 * scrollbar-safe viewport width. Until then the block remains column-bound,
 * which is a safe no-overflow fallback when scripts are unavailable.
 */
.ztk-top-info.ztk-top-info--full-bleed {
    width: var(--ztk-top-viewport-width);
    max-width: none;
    margin-left: var(--ztk-top-viewport-offset);
    border-radius: 0;
}

/* Once JavaScript promotes the Hero ahead of `.content-wrap`, it owns a full
 * row of the main container. This prevents the native sidebar from starting
 * alongside (and therefore on top of) the viewport-wide Hero. */
main.container > .ztk-top-info--above-columns {
    display: block;
    clear: both;
    float: none;
    width: 100%;
}

/* The promoted block first needs a normal in-container width so it reserves a
 * complete row above Zibll's floated columns. Once JavaScript has measured the
 * viewport, this more-specific rule must win over that fallback width. */
main.container > .ztk-top-info--above-columns.ztk-top-info--full-bleed {
    width: var(--ztk-top-viewport-width);
    max-width: none;
    margin-left: var(--ztk-top-viewport-offset);
    border-radius: 0;
}

/* Zibll's columns use floats. The promoted Hero remains in normal flow, then
 * its original column row is explicitly cleared below it. */
main.container > .ztk-top-info--above-columns + .ztk-top-info-columns {
    clear: both;
}

/* The Hero replaces Zibll's native cover/title and duplicate post stats. Keep
 * the author row (including follow/private-message controls) and all content,
 * payment and footer action areas owned by the theme. */
body.ztk-top-info-page .single-head-cover,
body.ztk-top-info-page article.article > .article-header .article-title,
body.ztk-top-info-page article.article > .article-header .single-metabox,
body.ztk-top-info-page article.article > .article-header .line-form-line {
    display: none !important;
}

/* Do not remove Zibll's breadcrumb unless the plugin renders its replacement. */
body.ztk-top-info-page.ztk-top-info-has-breadcrumb main.container .content-wrap > .content-layout > .breadcrumb {
    display: none !important;
}

.ztk-top-info.ztk-has-cover {
    color: var(--ztk-top-text);
    border-color: var(--ztk-top-chip-border);
    background-color: var(--ztk-top-surface-a);
    background-image:
        radial-gradient(circle at 82% 12%, rgba(96, 122, 255, .22), transparent 30%),
        radial-gradient(circle at 14% 112%, rgba(62, 205, 181, .16), transparent 36%),
        linear-gradient(125deg, var(--ztk-top-surface-a), var(--ztk-top-surface-b));
    box-shadow: var(--ztk-top-shadow);
}

@supports (color: color-mix(in srgb, #000 50%, #fff)) {
    .ztk-top-info {
        --ztk-top-color-deep: color-mix(in srgb, var(--ztk-top-color) 76%, #000 24%);
        background-image:
            radial-gradient(circle at 82% 12%, color-mix(in srgb, var(--ztk-top-color) 24%, transparent), transparent 30%),
            radial-gradient(circle at 14% 112%, rgba(62, 205, 181, .16), transparent 36%),
            linear-gradient(
                125deg,
                color-mix(in srgb, var(--ztk-top-surface-a) 94%, var(--ztk-top-color) 6%),
                color-mix(in srgb, var(--ztk-top-surface-b) 88%, var(--ztk-top-color) 12%)
            );
    }

    .ztk-top-info.ztk-style-background,
    .ztk-top-info.ztk-style-background.ztk-has-cover {
        background-image: linear-gradient(
            120deg,
            color-mix(in srgb, var(--ztk-top-color) 92%, #000 8%),
            color-mix(in srgb, var(--ztk-top-color) 68%, #fff 32%)
        );
    }

}

.ztk-top-info__overlay {
    position: absolute;
    z-index: 0;
    inset: 0;
    background:
        linear-gradient(rgba(84, 103, 170, .055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(84, 103, 170, .055) 1px, transparent 1px);
    background-size: 38px 38px;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 42%, #000);
    mask-image: linear-gradient(90deg, transparent, #000 42%, #000);
    pointer-events: none;
}

.ztk-top-info__overlay::before,
.ztk-top-info__overlay::after {
    position: absolute;
    content: '';
    border-radius: 50%;
    pointer-events: none;
}

.ztk-top-info__overlay::before {
    top: -105px;
    right: clamp(3%, 8vw, 11%);
    width: 240px;
    height: 240px;
    border: 1px solid var(--ztk-top-chip-border);
    box-shadow:
        0 0 0 34px rgba(105, 125, 255, .045),
        0 0 0 72px rgba(105, 125, 255, .025);
}

.ztk-top-info__overlay::after {
    right: 24%;
    bottom: 26px;
    width: 7px;
    height: 7px;
    background: var(--ztk-top-color);
    box-shadow:
        54px -44px 0 rgba(89, 112, 245, .34),
        118px 18px 0 rgba(64, 194, 173, .34),
        -38px -70px 0 rgba(89, 112, 245, .22);
}

.ztk-top-info__inner {
    position: relative;
    z-index: 2;
    width: calc(100% - var(--ztk-top-gutter) - var(--ztk-top-gutter));
    max-width: 1120px;
    margin-right: auto;
    margin-left: auto;
    box-sizing: border-box;
}

.ztk-top-info__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 34%);
    align-items: center;
    gap: clamp(28px, 5vw, 72px);
}

.ztk-top-info__content {
    min-width: 0;
}

.ztk-top-info__visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 190px;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--ztk-top-chip-border);
    border-radius: 18px;
    background: rgba(255, 255, 255, .16);
    box-shadow: 0 24px 54px -30px rgba(5, 15, 48, .82), inset 0 1px 0 rgba(255, 255, 255, .28);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    backdrop-filter: blur(12px) saturate(120%);
    transform: translateY(2px) rotate(1deg);
    transition: transform .35s ease, box-shadow .35s ease;
}

.ztk-top-info__visual::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, .2), transparent 42%, rgba(4, 12, 35, .24));
    content: '';
    pointer-events: none;
}

.ztk-top-info__visual img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 190px;
    object-fit: cover;
    opacity: .92;
}

.ztk-top-info__visual-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 92px;
    height: 92px;
    border: 1px solid var(--ztk-top-chip-border);
    border-radius: 22px;
    color: var(--ztk-top-muted);
    background: var(--ztk-top-chip-bg);
}

.ztk-top-info__visual-placeholder svg {
    width: 52px;
    height: 52px;
    fill: currentColor;
}

@media (hover: hover) {
    .ztk-top-info__visual:hover {
        box-shadow: 0 30px 62px -30px rgba(5, 15, 48, .9), inset 0 1px 0 rgba(255, 255, 255, .34);
        transform: translateY(-4px) rotate(0deg);
    }
}

.ztk-position-center .ztk-top-info__inner {
    text-align: center;
}

.ztk-position-right .ztk-top-info__inner {
    text-align: right;
}

.ztk-top-info__terms,
.ztk-top-info__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
}

.ztk-position-center .ztk-top-info__terms,
.ztk-position-center .ztk-top-info__meta {
    justify-content: center;
}

.ztk-position-right .ztk-top-info__terms,
.ztk-position-right .ztk-top-info__meta {
    justify-content: flex-end;
}

.ztk-top-info__term,
.ztk-top-info__tag,
.ztk-top-info__series,
.ztk-top-info__meta > span,
.ztk-top-info__meta > span > a {
    color: inherit !important;
}

.ztk-top-info__term,
.ztk-top-info__tag,
.ztk-top-info__series,
.ztk-top-info__meta > span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 11px;
    border: 1px solid var(--ztk-top-chip-border);
    border-radius: var(--ztk-top-tag-radius, 999px);
    color: var(--ztk-top-muted) !important;
    background: var(--ztk-top-chip-bg);
    line-height: 1.2;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
    -webkit-backdrop-filter: blur(12px) saturate(125%);
    backdrop-filter: blur(12px) saturate(125%);
    transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .2s ease;
}

.ztk-top-info__term {
    border-radius: var(--ztk-top-term-radius, 999px);
    color: var(--ztk-top-text) !important;
    font-weight: 700;
}

@media (hover: hover) {
    .ztk-top-info__term:hover,
    .ztk-top-info__tag:hover,
    .ztk-top-info__meta > span:hover {
        color: var(--ztk-top-text) !important;
        border-color: rgba(92, 111, 220, .28);
        background: var(--ztk-top-chip-hover);
        transform: translateY(-2px);
    }
}

.ztk-top-info__title {
    max-width: 1000px;
    margin: 24px 0 22px;
    color: var(--ztk-top-title, inherit) !important;
    font-size: clamp(30px, 4.6vw, 58px);
    font-weight: 850;
    line-height: 1.16;
    letter-spacing: -.035em;
    overflow-wrap: anywhere;
    text-wrap: balance;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .34);
}

body.dark-theme .ztk-top-info__title,
html.dark-theme .ztk-top-info__title,
[data-theme="dark"] .ztk-top-info__title {
    text-shadow: 0 3px 28px rgba(0, 0, 0, .34);
}

.ztk-position-center .ztk-top-info__title {
    margin-inline: auto;
}

.ztk-position-right .ztk-top-info__title {
    margin-left: auto;
}

.ztk-top-info__sidebar-toggle {
    margin-top: 18px;
    min-height: 38px;
    padding: 8px 15px;
    border: 1px solid var(--ztk-top-chip-border);
    border-radius: 999px;
    color: inherit;
    background: var(--ztk-top-toggle-bg);
    box-shadow: 0 8px 24px -18px rgba(22, 34, 80, .8);
    cursor: pointer;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transition: transform .2s ease, background-color .2s ease, border-color .2s ease;
}

@media (hover: hover) {
    .ztk-top-info__sidebar-toggle:hover {
        border-color: rgba(92, 111, 220, .34);
        background: var(--ztk-top-chip-hover);
        transform: translateY(-2px);
    }
}

.ztk-top-info__sidebar-toggle:focus-visible {
    outline: 3px solid var(--ztk-top-color);
    outline-offset: 3px;
}

.ztk-top-info__debug {
    position: absolute;
    z-index: 5;
    top: 14px;
    right: 14px;
    width: min(280px, calc(100% - 28px));
    padding: 8px 11px;
    border: 1px solid var(--ztk-top-chip-border);
    border-radius: 9px;
    color: var(--ztk-top-text);
    background: var(--ztk-top-chip-bg);
    font-size: 12px;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.ztk-top-info__debug summary {
    cursor: pointer;
    font-weight: 700;
}

.ztk-top-info__debug dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 9px;
    margin: 8px 0 0;
}

.ztk-top-info__debug dt,
.ztk-top-info__debug dd {
    margin: 0;
}

.ztk-top-info__debug .ztk-debug-url {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ztk-top-info__wave {
    position: absolute;
    z-index: 1;
    right: -2%;
    bottom: -1px;
    left: -2%;
    height: 36px;
    background: var(--ztk-top-wave-color);
    clip-path: polygon(0 60%, 8% 46%, 16% 62%, 25% 35%, 34% 55%, 44% 30%, 54% 58%, 64% 38%, 74% 61%, 84% 40%, 93% 56%, 100% 42%, 100% 100%, 0 100%);
}

.ztk-top-info-sidebar-hidden {
    display: none !important;
}

/* Let the article card gently overlap the Hero, matching the modern profile
 * header pattern while keeping the Hero itself full-bleed. */
body.ztk-top-info-page .ztk-top-info:not(.ztk-top-info--above-columns) + article.article,
body.ztk-top-info-page main.container > .ztk-top-info--above-columns + * .content-wrap article.article,
body.ztk-top-info-page main.container > .ztk-top-info--above-columns + .content-wrap article.article {
    position: relative;
    z-index: 3;
    margin-top: -58px;
    border-radius: 16px;
    box-shadow: 0 18px 52px -34px rgba(28, 42, 91, .72);
}

body.dark-theme.ztk-top-info-page .ztk-top-info:not(.ztk-top-info--above-columns) + article.article,
html.dark-theme.ztk-top-info-page .ztk-top-info:not(.ztk-top-info--above-columns) + article.article,
[data-theme="dark"].ztk-top-info-page .ztk-top-info:not(.ztk-top-info--above-columns) + article.article,
body.dark-theme.ztk-top-info-page main.container > .ztk-top-info--above-columns + * .content-wrap article.article,
html.dark-theme.ztk-top-info-page main.container > .ztk-top-info--above-columns + * .content-wrap article.article,
[data-theme="dark"].ztk-top-info-page main.container > .ztk-top-info--above-columns + * .content-wrap article.article,
body.dark-theme.ztk-top-info-page main.container > .ztk-top-info--above-columns + .content-wrap article.article,
html.dark-theme.ztk-top-info-page main.container > .ztk-top-info--above-columns + .content-wrap article.article,
[data-theme="dark"].ztk-top-info-page main.container > .ztk-top-info--above-columns + .content-wrap article.article {
    box-shadow: 0 24px 62px -34px rgba(0, 0, 0, .92);
}

body.ztk-sidebar-collapsed main.container .content-wrap > .content-layout {
    width: 100% !important;
    max-width: 100% !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
}

@media (max-width: 767px) {
    .ztk-top-info {
        --ztk-top-gutter: 16px;
        min-height: max(280px, var(--ztk-top-height-mobile, 50vh));
        margin-bottom: 32px;
        padding: 34px 0 66px;
    }

    body.ztk-top-info-page .ztk-top-info:not(.ztk-top-info--above-columns) + article.article,
    body.ztk-top-info-page main.container > .ztk-top-info--above-columns + * .content-wrap article.article,
    body.ztk-top-info-page main.container > .ztk-top-info--above-columns + .content-wrap article.article {
        margin-top: -38px;
        border-radius: 13px;
    }

    .ztk-top-info__inner {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .ztk-top-info__visual {
        order: -1;
        width: min(100%, 360px);
        min-height: 138px;
        margin: 0 auto;
        transform: none;
    }

    .ztk-top-info__visual img {
        min-height: 138px;
    }

    .ztk-top-info__content {
        text-align: left;
    }

    .ztk-top-info__meta {
        font-size: 12px;
    }

    .ztk-position-right .ztk-top-info__inner {
        text-align: left;
    }

    .ztk-position-right .ztk-top-info__title {
        margin-left: 0;
    }

    .ztk-position-right .ztk-top-info__terms,
    .ztk-position-right .ztk-top-info__meta {
        justify-content: flex-start;
    }

    .ztk-position-center .ztk-top-info__inner {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .ztk-top-info {
        min-height: max(320px, var(--ztk-top-height-tablet, 42vh));
    }
}

@media (prefers-reduced-motion: reduce) {
    .ztk-top-info *,
    .ztk-top-info *::before,
    .ztk-top-info *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}
