/* TDP additions: local sponsor slots + Creative Commons notice. Loaded after built/index.css. */

/* ---------- sponsor slots ---------- */
.tdp-sponsor {
    --tdp-sponsor-bg: #f6f7f8;
    --tdp-sponsor-border: #e3e5e8;
    --tdp-sponsor-muted: #6b7280;
    font-family: var(--font-family-body, system-ui, sans-serif);
    color: var(--color-title-primary, #111);
}
:root[data-theme='dark'] .tdp-sponsor {
    --tdp-sponsor-bg: #1c1f23;
    --tdp-sponsor-border: #2e3238;
    --tdp-sponsor-muted: #9aa1ab;
}
.tdp-sponsor__label {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--tdp-sponsor-muted);
}
.tdp-sponsor__item {
    --tdp-sponsor-accent: var(--accent-color, #55A4DB);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--tdp-sponsor-bg);
    border: 1px solid var(--tdp-sponsor-border);
    border-left: 4px solid var(--tdp-sponsor-accent);
    border-radius: var(--border-radius-block, 6px);
    color: inherit;
    text-decoration: none;
}
.tdp-sponsor__item[hidden] { display: none; }
.tdp-sponsor__item:hover .tdp-sponsor__cta { text-decoration: underline; }
.tdp-sponsor__logo {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 4px;
    background: #fff;
}
.tdp-sponsor__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tdp-sponsor__name { font-size: 17px; line-height: 1.25; }
.tdp-sponsor__tagline { font-size: 14px; line-height: 1.4; color: var(--tdp-sponsor-muted); }
.tdp-sponsor__cta { flex: 0 0 auto; font-size: 14px; font-weight: 600; color: var(--tdp-sponsor-accent); white-space: nowrap; }
.tdp-sponsor__note { margin: 6px 0 0; font-size: 12px; text-align: right; }
.tdp-sponsor__note a { color: var(--tdp-sponsor-muted); text-decoration: underline; }

/* homepage "Supported by" strip, sits under the hero */
.tdp-sponsor--banner {
    max-width: var(--container-width, 1320px);
    width: calc(100% - 40px);
    margin: 28px auto 8px;
}
.tdp-sponsor--banner .tdp-sponsor__label { text-align: center; }
.tdp-sponsor--banner .tdp-sponsor__item { justify-content: center; max-width: 760px; margin: 0 auto; }
.tdp-sponsor--banner .tdp-sponsor__note { max-width: 760px; margin-left: auto; margin-right: auto; }

/* in-article: inserted by tdp.js after paragraph N of the body */
.gh-post-page__content .tdp-sponsor--inline,
.tdp-sponsor--inline {
    max-width: 687px;
    width: 100%;
    box-sizing: border-box;
    margin: 36px auto;
    padding: 14px 0;
    border-top: 1px solid var(--tdp-sponsor-border);
    border-bottom: 1px solid var(--tdp-sponsor-border);
}
.tdp-sponsor--inline .tdp-sponsor__item { background: transparent; border-top: 0; border-right: 0; border-bottom: 0; border-radius: 0; }
.tdp-sponsor--inline[data-pending] { display: none; }

/* neutralise the theme's article-body rules (p padding, accent links) inside sponsor + license blocks */
.gh-post-page__content .tdp-sponsor p,
.gh-post-page__content .tdp-license p { max-width: none; padding-left: 0; padding-right: 0; }
.gh-post-page__content .tdp-sponsor a { max-width: none; margin: 0; }
.tdp-sponsor a.tdp-sponsor__item { color: inherit; text-decoration: none !important; }
.gh-post-page__content .tdp-sponsor .tdp-sponsor__note a { color: var(--tdp-sponsor-muted); text-decoration: underline; }
.gh-post-page__content .tdp-sponsor .tdp-sponsor__cta { color: var(--tdp-sponsor-accent); }

/* sidebar: stacked card under "latest news" on the sidebar template */
.tdp-sponsor--sidebar { margin-top: 32px; position: sticky; top: 24px; }
.tdp-sponsor--sidebar .tdp-sponsor__item { flex-direction: column; align-items: flex-start; text-align: left; padding: 18px; }
.tdp-sponsor--sidebar .tdp-sponsor__logo { width: 100%; height: 120px; }
@media (max-width: 1100px) {
    /* sidebar drops below the article here; the in-article slot already covers mobile */
    .tdp-sponsor--sidebar { display: none; }
}
@media (max-width: 600px) {
    .tdp-sponsor__item { padding: 12px 14px; gap: 12px; }
    .tdp-sponsor__logo { width: 44px; height: 44px; }
    .tdp-sponsor__cta { display: none; }
    .tdp-sponsor__name { font-size: 16px; }
    .tdp-sponsor__tagline { font-size: 14px; }
}

/* ---------- Creative Commons notice ---------- */
.tdp-license {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    max-width: 687px;
    width: 100%;
    box-sizing: border-box;
    margin: 40px auto 8px;
    padding: 20px 22px;
    border: 1px solid #e3e5e8;
    border-radius: var(--border-radius-block, 6px);
    background: #fbfbfa;
    font-family: var(--font-family-body, system-ui, sans-serif);
    font-size: 15px;
    line-height: 1.55;
    color: var(--color-text-primary, #222);
}
:root[data-theme='dark'] .tdp-license { background: #1c1f23; border-color: #2e3238; color: #d6d9de; }
.tdp-license p { margin: 0 0 8px; }
.tdp-license p:last-child { margin-bottom: 0; }
.tdp-license a { display: inline; margin: 0; max-width: none; color: inherit; text-decoration: underline; }
.tdp-license__title { font-weight: 700; font-size: 16px; }
.tdp-license a.tdp-license__badge {
    flex: 0 0 auto;
    display: flex;
    gap: 2px;
    text-decoration: none !important;
}
.tdp-license__badge span {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 2px solid currentColor;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: -.02em;
    text-transform: uppercase;
}
.tdp-license__credit span { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.tdp-license__credit code {
    display: block;
    margin-top: 4px;
    padding: 8px 10px;
    font-size: 13px;
    white-space: normal;
    word-break: break-word;
    background: rgba(0,0,0,.04);
    border-radius: 4px;
    user-select: all;
}
@media (max-width: 600px) {
    .tdp-license { flex-direction: column; gap: 12px; padding: 16px; font-size: 15px; }
}
/* the old hand-typed "(c) 2025 by X is licensed under CC BY-NC-ND 4.0" paragraph, hidden by tdp.js once the notice is shown */
.tdp-legacy-license { display: none; }

/* 1.1.9-tdp.2: on the default post template the notice sits outside .gh-container, so give it the same
   side gutters the theme gives .gh-post-page__author--content there (40px total <=1100px, 20px <=550px).
   The sidebar template (.gh-post-page--with-sidebar) is already inside .gh-container and is not affected. */
@media (max-width: 1100px) {
    .gh-post-page .tdp-license { width: calc(100% - 40px); }
}
@media (max-width: 550px) {
    .gh-post-page .tdp-license { width: calc(100% - 20px); }
}
