/* ==========================================================================
   Wealth Building Financial — Knowledge centre — topic and article cards
   Loaded on the knowledge section and on the homepage, whose knowledge block
   renders the same .knowledge-card partial. The article page's own styles are
   in knowledge-article.css.
   ========================================================================== */

/* ==========================================================================
   Knowledge center
   ========================================================================== */

.knowledge-intro {
    max-width: 760px;
    margin: 0 auto 40px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 17px;
    line-height: 1.8;
}

/* Topic cards -------------------------------------------------------------- */

.knowledge-topics {
    margin-bottom: 50px;
}

/* Height comes from the stretched column, not from height: 100% — see the note
   on .knowledge-card below. */
.knowledge-topic-card {
    display: block;
    padding: 28px 22px;
    margin-bottom: 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.knowledge-topic-card:hover,
.knowledge-topic-card:focus {
    text-decoration: none;
    color: inherit;
    transform: translateY(-3px);
    border-color: var(--color-secondary);
    box-shadow: var(--shadow-md);
}

.knowledge-topic-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--color-secondary) 12%, white);
    color: var(--color-secondary-dark);
    font-size: 22px;
}

.knowledge-topic-card h3 {
    margin: 0 0 10px;
    font-size: 19px;
    font-weight: 700;
    color: var(--color-primary);
}

.knowledge-topic-card p {
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--color-text-muted);
}

.knowledge-topic-count {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-secondary-dark);
}

/* Article cards ------------------------------------------------------------ */

/* No height: 100% here. The column already stretches the card to the row's
   height (see the flex rule at the end of this file), and a 100% height would
   eat this bottom margin instead, leaving wrapped rows of cards touching. */
.knowledge-card {
    display: flex;
    flex-direction: column;
    padding: 26px;
    margin-bottom: 26px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.knowledge-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.knowledge-card-meta,
.knowledge-article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    margin-bottom: 12px;
    font-size: 12.5px;
    color: var(--color-muted-2);
}

.knowledge-card-topic {
    /* A chip is a link to the topic, so it needs a target rather than just a
       label. 32px keeps it a chip and clears the 24px minimum. */
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 3px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-secondary) 12%, white);
    color: var(--color-secondary-dark);
    font-weight: 600;
    text-decoration: none;
}

a.knowledge-card-topic:hover {
    text-decoration: none;
    background: color-mix(in srgb, var(--color-secondary) 20%, white);
}

.knowledge-card h3 {
    margin: 0 0 12px;
    font-size: 19px;
    line-height: 1.5;
    font-weight: 700;
}

.knowledge-card h3 a {
    color: var(--color-primary);
    text-decoration: none;
}

.knowledge-card h3 a:hover {
    color: var(--color-secondary-dark);
}

.knowledge-card p {
    flex: 1 1 auto;
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.75;
    color: var(--color-text-muted);
}

/* inline-flex rather than a bare inline link so the row can carry a height: at
   14px this was a 23px target, and on a card it is the primary action rather
   than a link inside a sentence, so the 44px minimum applies. */
.knowledge-card-link {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-secondary-dark);
    text-decoration: none;
}

.knowledge-card-link i {
    margin-left: 5px;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.knowledge-card-link:hover i {
    transform: translateX(3px);
}

.knowledge-empty {
    padding: 40px 0 20px;
    text-align: center;
    color: var(--color-muted-2);
}

/* Closing prompt ----------------------------------------------------------- */

.knowledge-cta {
    margin-top: 30px;
    padding: 42px 30px;
    text-align: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    color: #fff;
}

.knowledge-cta h3 {
    margin: 0 0 14px;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.knowledge-cta p {
    max-width: 620px;
    margin: 0 auto 24px;
    font-size: 16px;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.88);
}

.knowledge-cta .btn-template-main {
    background: #fff;
    color: var(--color-primary);
    border-color: #fff;
}

.knowledge-cta .btn-template-main:hover {
    color: var(--color-primary);
    background: #fff;
}

@media (max-width: 767px) {
    .knowledge-cta {
        padding: 32px 20px;
    }

    .knowledge-cta h3 {
        font-size: 20px;
    }
}

/* Equal-height cards in the knowledge grids (see the note in home.css). */
@media (min-width: 768px) {
    .knowledge-topics,
    .knowledge-list,
    .knowledge-related .row {
        display: flex;
        flex-wrap: wrap;
    }

    .knowledge-topics > [class*="col-"],
    .knowledge-list > [class*="col-"],
    .knowledge-related .row > [class*="col-"] {
        display: flex;
    }
}
