/* ─────────────────────────────────────────────────────────────────────────
   Knowledge Hub — public article library.
   See docs/knowledge-hub-blueprint.md for the architecture.
   All colour tokens come from frontend/css/style.css (--brand-navy, etc).
   ───────────────────────────────────────────────────────────────────────── */

.kh-view { display: block; }
.kh-view[hidden] { display: none; }

.kh-hero {
    background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-dark) 100%);
    color: #fff;
    padding: 80px 0 50px;
}
.kh-hero-compact { padding: 60px 0 36px; }
.kh-hero h1 { color: #fff; font-size: 2.6rem; margin: 0 0 0.6rem; }
.kh-hero p {
    color: rgba(255,255,255,0.92);
    font-size: 1.05rem;
    max-width: 760px;
    margin: 0;
    line-height: 1.65;
}

.kh-breadcrumb {
    color: rgba(255,255,255,0.82);
    font-size: 0.92rem;
    margin: 0 0 0.5rem;
}
.kh-breadcrumb a { color: var(--brand-sky-light); text-decoration: none; }
.kh-breadcrumb a:hover { text-decoration: underline; }

.kh-container { max-width: 1100px; margin: 0 auto; padding: 30px 20px 60px; }

.kh-section { margin-bottom: 56px; }
.kh-section h2 {
    color: var(--brand-navy);
    font-size: 1.55rem;
    margin: 0 0 0.6rem;
}
.kh-section-sub { color: var(--surface-ink-muted); margin: 0 0 1.2rem; }

/* Chips for editorial-category navigation */
.kh-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.kh-chip {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    background: #fff;
    border: 1px solid var(--surface-line);
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--brand-navy);
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.kh-chip:hover, .kh-chip.is-active {
    background: var(--brand-navy);
    border-color: var(--brand-navy);
    color: #fff;
}

/* Programme grid (A / B / C / PRCN / ANO) */
.kh-programmes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
    gap: 14px;
}
/* SIX programme tiles now (GCI joined A/B/C/PRCN/ANO on 2026-08-15). At the
   1100px container, auto-fit at minmax(180px) resolves to FIVE columns, so the
   sixth tile orphaned alone on a second row. Six across would give ~166px per
   tile, and the instructor labels ("ANO Refresher Preparation") already wrap at
   that width. Explicit columns instead: 3x2 on desktop, 2x3 on tablet, stacked
   on mobile — every row full at every breakpoint. */
@media (min-width: 700px) {
    .kh-programmes { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px) {
    .kh-programmes { grid-template-columns: repeat(3, 1fr); }
}
/* GROUPED BY SILO (2026-09-29). The container is itself the grid, so when it holds <section>
   groups it must stop being one — otherwise each SECTION becomes a grid item and the three
   groups sit side by side as columns. The grid moves inward to .kh-programme-grid, which keeps
   the same column rules so a group of three still reads as the row it always was.
   No new colours: the heading is the existing navy. The palette belongs to another lane and a
   heading a reader can read beats a colour they must learn -- which is also why the heading is an
   i18n key the locales already translate, not a new English string (see PROGRAMME_SILOS). */
.kh-programmes.is-grouped { display: block; }
.kh-silo + .kh-silo { margin-top: 1.6rem; }
.kh-silo-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0 0 0.6rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--brand-navy, #002d62);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.kh-programme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
    gap: 14px;
}
@media (min-width: 700px) { .kh-programme-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .kh-programme-grid { grid-template-columns: repeat(3, 1fr); } }

.kh-programme-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
    border-left: 4px solid var(--brand-navy);
    text-decoration: none;
    color: var(--brand-navy);
    transition: transform .15s ease, box-shadow .15s ease;
}
.kh-programme-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.1); }
.kh-programme-tile.is-coming-soon { opacity: 0.78; border-left-color: var(--surface-ink-muted); }
.kh-programme-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 8px;
    border-radius: 8px;
    background: var(--brand-crimson);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
}
.kh-programme-tile.is-coming-soon .kh-programme-badge { background: var(--surface-ink-muted); }
.kh-programme-title { font-weight: 700; font-size: 1.05rem; }
.kh-programme-phase { font-size: 0.82rem; color: var(--surface-ink-muted); }

/* Featured shelf */
.kh-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 16px;
}
/* FOUR featured articles need an explicit 2x2. The container is 1100px wide
   (1060px inside padding), so auto-fit at minmax(280px) resolves to exactly
   THREE columns — which left the fourth card orphaned alone on a second row,
   reading as a layout bug rather than a deliberate four. Forcing four across
   would squeeze each card to ~247px, too narrow for these excerpts.
   The count-based class is set in knowledge-hub.js so the shelf stays correct
   if the featured count changes back to three. */
@media (min-width: 700px) {
    .kh-feature-grid.is-four { grid-template-columns: repeat(2, 1fr); }
}
.kh-feature-card {
    display: block;
    padding: 22px;
    background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-dark) 100%);
    border-radius: 12px;
    text-decoration: none;
    color: #fff;
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.kh-feature-card:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0,0,0,.18); }
.kh-feature-card .kh-feature-cat {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(255,255,255,.16);
    border-radius: 999px;
    font-size: 0.78rem;
    margin-bottom: 12px;
    letter-spacing: 0.3px;
}
.kh-feature-card h3 { color: #fff; font-size: 1.2rem; margin: 0 0 0.5rem; line-height: 1.3; }
.kh-feature-card p  { color: rgba(255,255,255,.86); font-size: 0.95rem; line-height: 1.55; margin: 0; }
.kh-feature-card .kh-meta { color: rgba(255,255,255,.7); font-size: 0.8rem; margin-top: 12px; }

/* Linear article list (Latest, Category page) */
.kh-card-list { display: flex; flex-direction: column; gap: 12px; }
.kh-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 20px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--surface-line-soft);
    text-decoration: none;
    color: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.kh-card:hover { border-color: var(--brand-navy); box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.kh-card-cat { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.4px; color: var(--brand-crimson); font-weight: 700; }
.kh-card h3 { color: var(--brand-navy); font-size: 1.1rem; margin: 0; line-height: 1.35; }
.kh-card p { color: #455263; margin: 0; line-height: 1.55; }
.kh-card .kh-meta { color: #68758a; font-size: 0.82rem; margin-top: 4px; }

/* Article body — minimal Markdown rendering */
.kh-meta-row { color: rgba(255,255,255,.85); font-size: 0.92rem; margin-top: 0.6rem; display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

/* Cap the article column to a comfortable reading measure (~66–70 chars).
   The 2026-07-08 UX review measured ~100+ chars/line at the old full 1100px
   width — fatiguing for long guides. The hero stays full-width; only the
   reading column (body + rating + prev/next) narrows. */
#kh-article .kh-container { max-width: 800px; }

.kh-article-body {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    padding: 36px;
    color: #1f2937;
    line-height: 1.75;
    font-size: 1.02rem;
}

/* In-article table of contents (jump-nav for long guides) */
.kh-toc {
    margin: 0 0 1.75rem;
    padding: 1rem 1.25rem;
    background: #f6f8fb;
    border: 1px solid var(--surface-line-soft);
    border-left: 4px solid var(--brand-crimson);
    border-radius: 8px;
}
.kh-toc-title {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--surface-ink-muted);
}
.kh-toc ul { list-style: none; margin: 0; padding: 0; }
.kh-toc li { margin: 0.28rem 0; }
.kh-toc li.kh-toc-h3 { padding-left: 1.1rem; }
.kh-toc a { color: var(--brand-navy); text-decoration: none; font-size: 0.95rem; }
.kh-toc a:hover { text-decoration: underline; color: var(--brand-crimson); }
/* Anchored headings sit clear of the sticky page chrome when jumped-to */
.kh-article-body h2[id], .kh-article-body h3[id] { scroll-margin-top: 90px; }
.kh-article-body h2 {
    color: var(--brand-navy);
    font-size: 1.55rem;
    margin: 1.8rem 0 0.75rem;
    padding-left: 14px;
    border-left: 4px solid var(--brand-crimson);
}
.kh-article-body h3 {
    color: var(--brand-navy);
    font-size: 1.2rem;
    margin: 1.4rem 0 0.5rem;
}
.kh-article-body h4 {
    color: var(--brand-crimson);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 0.85rem;
    margin: 1.2rem 0 0.35rem;
}
.kh-article-body p     { margin: 0.6rem 0; }
.kh-article-body ul    { padding-left: 1.6rem; margin: 0.6rem 0; }
.kh-article-body ol    { padding-left: 1.7rem; margin: 0.6rem 0; }
.kh-article-body li    { margin: 0.3rem 0; }
.kh-article-body blockquote {
    margin: 1rem 0;
    padding: 0.8rem 1.1rem;
    border-left: 4px solid var(--brand-sky-light);
    background: var(--surface-panel);
    color: #1f2937;
    border-radius: 0 6px 6px 0;
}
.kh-article-body code {
    background: rgba(166,25,46,0.08);
    color: var(--brand-crimson);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.92em;
}
.kh-article-body pre {
    background: #0b1726;
    color: var(--surface-line-soft);
    padding: 14px 16px;
    border-radius: 8px;
    overflow-x: auto;
    line-height: 1.55;
    font-size: 0.92rem;
}
.kh-article-body pre code { background: transparent; color: inherit; padding: 0; }
.kh-article-body a { color: var(--brand-navy); text-decoration: underline; }
.kh-article-body a:hover { color: var(--brand-crimson); }
.kh-article-body hr { border: 0; border-top: 1px solid var(--surface-line-soft); margin: 2rem 0; }
.kh-article-body strong { color: var(--brand-navy); }

/* Tables — mark-weightage tables are the main use, so the numeric columns
   right-align via the markdown "---:" syntax. The wrapper scrolls on its own
   rather than letting a 4-column table push the page sideways at 390px. */
.kh-table-wrap { overflow-x: auto; margin: 1.2rem 0; -webkit-overflow-scrolling: touch; }
.kh-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 30rem;
    font-size: 0.95rem;
}
.kh-table th, .kh-table td {
    border: 1px solid var(--surface-line-soft);
    padding: 0.5rem 0.7rem;
    text-align: left;
    vertical-align: top;
}
.kh-table thead th {
    background: var(--surface-panel);
    color: var(--brand-navy);
    font-weight: 700;
    white-space: nowrap;
}
.kh-table tbody tr:nth-child(even) { background: rgba(0, 45, 98, 0.03); }
.kh-table td strong { color: var(--brand-navy); }

/* Rating panel */
.kh-rating {
    margin: 32px 0 20px;
    padding: 22px 26px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.kh-rating h3 { color: var(--brand-navy); margin: 0 0 .35rem; font-size: 1.1rem; }
.kh-rating-summary { color: var(--surface-ink-muted); margin: 0 0 .8rem; font-size: 0.92rem; }
.kh-stars { display: inline-flex; gap: 4px; }
.kh-star {
    width: 36px; height: 36px;
    font-size: 1.6rem;
    line-height: 1;
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--surface-line);
    padding: 0;
    transition: color .12s ease, transform .12s ease;
}
.kh-star:hover, .kh-star.is-hovered, .kh-star.is-filled { color: #f5b13f; transform: scale(1.08); }
.kh-star:focus { outline: 2px solid var(--brand-navy); outline-offset: 2px; }

/* Prev / next */
.kh-prevnext {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 24px 0;
}
.kh-prevnext-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid var(--surface-line-soft);
    border-radius: 10px;
    text-decoration: none;
}
.kh-prevnext-link:hover { border-color: var(--brand-navy); }
.kh-prevnext-label { color: var(--brand-crimson); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.3px; }
.kh-prevnext-title { color: var(--brand-navy); font-weight: 600; }
.kh-prevnext-next { text-align: right; }

.kh-compliance {
    margin: 2rem 0 0;
    padding: 14px 18px;
    background: var(--surface-panel);
    border-left: 4px solid var(--brand-sky-light);
    border-radius: 0 6px 6px 0;
    color: #455263;
    font-size: 0.88rem;
    line-height: 1.65;
}

.kh-not-found { text-align: center; padding: 80px 20px; }
.kh-not-found h1 { color: var(--brand-navy); }
.kh-not-found p { color: var(--surface-ink-muted); }

.kh-skeleton { color: #68758a; font-style: italic; }

@media (max-width: 720px) {
    .kh-hero { padding: 60px 0 40px; }
    .kh-hero h1 { font-size: 2rem; }
    .kh-article-body { padding: 22px; font-size: 1rem; }
    .kh-prevnext { grid-template-columns: 1fr; }
    .kh-prevnext-next { text-align: left; }
}


/* ── Language strip (H-06 phase 2c) ────────────────────────────────────────
   Two states, both from tokens — no new hex. Neutral when we served the language
   that was asked for; the --notice-* caution tone when the text is machine-
   produced. Those tokens were introduced for exactly this disclosure on the
   tri-lingual pages, so the machine-translation warning looks the same wherever
   a reader meets it. */
.kh-lang-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    margin: 0 0 20px;
    padding: 11px 14px;
    border: 1px solid var(--surface-line);
    border-radius: 8px;
    background: var(--surface-line-soft);
    color: var(--brand-navy);
    font-size: 0.84rem;
    line-height: 1.45;
}

.kh-lang-strip[hidden] { display: none; }

.kh-lang-strip.is-machine {
    background: var(--notice-bg);
    border-color: var(--notice-line);
    color: var(--notice-ink);
}

/* Per-article language availability. Shown only when THIS article has another
   language, so it is absent on the English-only majority rather than sitting there
   as a second always-on control beside the navbar selector.
   No new colours: it inherits the strip's own ink and the link colour already used
   across the Hub, so it adds nothing for check:brand-visual to count. */
.kh-lang-avail {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
}

.kh-lang-avail-label {
    font-weight: 600;
    opacity: 0.85;
}

/* Underlined, because a row of language names that are links must not rely on colour
   alone to say so — the same reason the Hub underlines its in-article links. */
.kh-lang-avail a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.kh-lang-avail a:hover,
.kh-lang-avail a:focus-visible {
    text-decoration-thickness: 2px;
}




/* Track badge (AGV-D-026). Shown only when an article is NOT the default NCC track, so it
 * marks the exception rather than decorating every card — a badge on everything is a badge
 * on nothing, and it is the Agniveer ones a reader needs to pick out of a shared listing.
 *
 * Deliberately distinct from .kh-card-cat, which is the CATEGORY: these two sit next to each
 * other and must not read as the same kind of label. Category is crimson text; track is a
 * filled navy pill. */
.kh-card-track {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--brand-navy, #002d62);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    vertical-align: middle;
}

/* On the article header the breadcrumb sits on a dark hero, so the pill inverts to stay legible. */
.kh-breadcrumb .kh-card-track {
    background: #fff;
    color: var(--brand-navy, #002d62);
}
