/*
 * Single Knowledge Hub Resource
 * Template: single-kh-resource.php
 * Auto-enqueued by functions.php after css/theme.css.
 *
 * .breadcrumb, .card and .event-tag come from single-event.css and
 * event-card.css; related resource tiles use kh-card.css and the listing
 * header styles in knowledge-hub.css.
 */

/* --- Banner + breadcrumb ------------------------------------------------- */

.kh-banner {
    padding-block: var(--space-lg);
    color: var(--color-contrast);
    background-color: var(--color-primary);
}

/* --- Page shell ---------------------------------------------------------- */

.kh-resource {
    --section-pad: var(--space-2xl);
    background-color: var(--color-muted);
}

.kh-resource__layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
}

/* --- Intro: title + download card ---------------------------------------- */

.kh-resource__intro {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: var(--space-2xl);
    align-items: start;
}

.kh-resource__header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
    max-width: 40rem;
}

.kh-resource__topics {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2xs);
}

.kh-resource__topic {
    text-decoration: none;
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
}

.kh-resource__topic:hover {
    color: var(--color-contrast);
    background-color: var(--color-secondary);
}

.kh-resource__title {
    margin: 0;
    color: var(--color-primary);
}

.kh-resource__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-lg);
    margin: 0;
}

.kh-resource__meta-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-3xs);
}

.kh-resource__meta-label {
    font-size: var(--text--1);
    font-weight: var(--font-light);
}

.kh-resource__meta-value {
    margin: 0;
    color: var(--color-text);
}

.kh-resource__provider,
.kh-resource__contact {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s ease-in-out;
}

.kh-resource__provider:hover,
.kh-resource__contact:hover {
    color: var(--color-secondary);
    text-decoration: underline;
}

/* Long addresses wrap inside the meta row rather than pushing it wider. */
.kh-resource__contact {
    overflow-wrap: anywhere;
}

.kh-download {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.kh-download__row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.kh-download__icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
}

.kh-download__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kh-download__title {
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.kh-download__detail {
    font-size: var(--text--1);
    font-weight: var(--font-light);
}

.kh-download__button {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2xs);
    width: 100%;
}

/* --- Body ---------------------------------------------------------------- */

.kh-resource__body {
    padding-top: var(--space-xl);
    border-top: 2px solid var(--color-contrast);
}

.kh-resource__prose {
    max-width: 44rem;
    font-weight: var(--font-light);
    overflow-wrap: anywhere;
}

.kh-resource__prose > :first-child {
    margin-block-start: 0;
}

.kh-resource__prose > :last-child {
    margin-block-end: 0;
}

.kh-resource__prose h2,
.kh-resource__prose h3,
.kh-resource__prose h4 {
    margin-block: var(--space-lg) var(--space-sm);
}

.kh-resource__prose img {
    max-width: 100%;
    height: auto;
    border-radius: .5rem;
}

/* --- Related resources --------------------------------------------------- */

.kh-related {
    --section-pad: var(--space-2xl);
    padding-top: 0;
    background-color: var(--color-muted);
}

/* --- Responsive ---------------------------------------------------------- */

@media screen and (max-width: 1024px) {

    .kh-resource__intro {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .kh-resource__header {
        max-width: none;
    }

}
