/* ============================================================================
   CORPORATE HUB — capability styles (brand-agnostic)
   ============================================================================
   Component classes for the hub screens (Areas/Hub). Everything reads the design-system
   tokens (-rgb triplets), so a brand skin re-themes the hub by overriding triplets and the
   two hub-private tokens below — never by editing this file. Loaded unconditionally by any
   shell that renders the hub (the default portal shell via the view, the Investec shell directly).

   TOKEN RULE: override -rgb triplets only (see tailwind.input.css / DESIGN_SYSTEM.md).
   ============================================================================ */

:root {
    /* Hub-private tokens. A skin overrides these (the Investec skin swaps the serif for Caslon). */
    --hub-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --hub-ink-rgb: 15 23 42;            /* dark panels, pills, CTA bar — a skin may darken to its nav colour */
    --hub-up-rgb: 46 125 50;            /* positive delta / bullish */
    --hub-down-rgb: 198 40 40;          /* negative delta / bearish */
    --hub-mixed-rgb: 180 83 9;          /* mixed read */
    --hub-radius: 12px;
}

/* ---- page scaffold ------------------------------------------------------------------- */
.hub-page { max-width: 1344px; margin: 0 auto; padding: 40px 48px 64px; }
.hub-page--narrow { max-width: 880px; }
@media (max-width: 768px) { .hub-page { padding: 24px 20px 48px; } }

.hub-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 32px; margin-bottom: 32px; }
.hub-greeting {
    font-family: var(--hub-serif);
    font-weight: 400;
    font-size: clamp(2rem, 4vw, 3.25rem);
    line-height: 1.08;
    letter-spacing: -0.01em;
    color: rgb(var(--text-primary-rgb));
    margin: 0 0 12px;
}
.hub-sub { font-size: 1rem; color: rgb(var(--text-secondary-rgb)); margin: 0; max-width: 60ch; }
.hub-page-head { margin-bottom: 28px; }
.hub-page-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.hub-page-title { font-size: 2rem; font-weight: 600; letter-spacing: -0.01em; color: rgb(var(--text-primary-rgb)); margin: 0 0 8px; }
.hub-eyebrow, .hub-metric-label, .hub-filter-title, .hub-banner-eyebrow {
    display: block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
}
.hub-eyebrow, .hub-metric-label, .hub-filter-title { color: rgb(var(--text-secondary-rgb)); }
.hub-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.hub-section-title { font-size: 1.375rem; font-weight: 600; letter-spacing: -0.01em; color: rgb(var(--text-primary-rgb)); margin: 0; }
.hub-link { font-size: 0.875rem; font-weight: 500; color: rgb(var(--text-primary-rgb)); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgb(var(--border-default-rgb)); }
.hub-link:hover { text-decoration-color: currentColor; }
.hub-meta { font-size: 0.75rem; color: rgb(var(--text-tertiary-rgb)); }
.hub-mt { margin-top: 32px; }
.hub-mt-sm { margin-top: 12px; }
.hub-mb { margin-bottom: 28px; }
.hub-empty { color: rgb(var(--text-tertiary-rgb)); font-size: 0.9375rem; padding: 24px 0; }
.hub-error { border: 1px solid rgb(var(--hub-down-rgb) / 0.4); background: rgb(var(--hub-down-rgb) / 0.06); color: rgb(var(--text-primary-rgb)); border-radius: var(--hub-radius); padding: 16px 20px; margin-bottom: 24px; }
.hub-crumbs { display: flex; gap: 10px; font-size: 0.8125rem; color: rgb(var(--text-tertiary-rgb)); margin-bottom: 20px; }

/* ---- layout grids -------------------------------------------------------------------- */
.hub-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; margin-bottom: 40px; }
.hub-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 32px; align-items: start; }
.hub-insights { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 32px; align-items: start; }
.hub-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.hub-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.hub-stack { display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 1280px) { .hub-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .hub-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hub-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .hub-split, .hub-insights, .hub-grid-2, .hub-grid-3 { grid-template-columns: minmax(0, 1fr); } .hub-hero { flex-direction: column; } }
@media (max-width: 640px) { .hub-metrics { grid-template-columns: minmax(0, 1fr); } }

/* ---- cards ---------------------------------------------------------------------------- */
.hub-card {
    display: block;
    background: rgb(var(--surface-primary-rgb));
    border: 1px solid rgb(var(--border-default-rgb));
    border-radius: var(--hub-radius);
    padding: 24px;
    color: inherit;
    text-decoration: none;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.03);
}
.hub-card--clickable { transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease; }
.hub-card--clickable:hover { box-shadow: 0 6px 20px -8px rgb(0 0 0 / 0.18); border-color: rgb(var(--text-tertiary-rgb)); transform: translateY(-1px); }
.hub-note-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.hub-note-title { font-size: 1.125rem; font-weight: 600; line-height: 1.35; letter-spacing: -0.005em; color: rgb(var(--text-primary-rgb)); margin: 0 0 8px; }
.hub-note-body { font-size: 0.9375rem; line-height: 1.55; color: rgb(var(--text-secondary-rgb)); margin: 0; }
.hub-note-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgb(var(--border-subtle-rgb, var(--border-default-rgb))); }
.hub-note-covers { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.hub-deskview-compiled { margin-top: 12px; font-style: italic; }
.hub-clamp-2, .hub-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.hub-clamp-2 { -webkit-line-clamp: 2; }
.hub-clamp-3 { -webkit-line-clamp: 3; }

/* ---- pills + chips -------------------------------------------------------------------- */
.hub-tag-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hub-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 4px;
    font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.2;
    background: rgb(var(--hub-ink-rgb)); color: rgb(var(--text-inverse-rgb));
}
.hub-pill--soft { background: rgb(var(--surface-tertiary-rgb)); color: rgb(var(--text-secondary-rgb)); }
.hub-pill--bullish { background: rgb(var(--hub-up-rgb) / 0.12); color: rgb(var(--hub-up-rgb)); }
.hub-pill--bearish { background: rgb(var(--hub-down-rgb) / 0.12); color: rgb(var(--hub-down-rgb)); }
.hub-pill--mixed { background: rgb(var(--hub-mixed-rgb) / 0.12); color: rgb(var(--hub-mixed-rgb)); }
.hub-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 500; text-decoration: none;
    background: rgb(var(--surface-tertiary-rgb)); color: rgb(var(--text-secondary-rgb));
    border: 1px solid transparent;
}
.hub-chip:hover { border-color: rgb(var(--text-tertiary-rgb)); color: rgb(var(--text-primary-rgb)); }
.hub-chip--filter { padding: 6px 12px; font-size: 0.8125rem; background: rgb(var(--surface-primary-rgb)); border-color: rgb(var(--border-default-rgb)); }
.hub-chip--filter.active { background: rgb(var(--hub-ink-rgb)); color: rgb(var(--text-inverse-rgb)); border-color: rgb(var(--hub-ink-rgb)); }
.hub-chip--filter.active .hub-filter-count { color: rgb(var(--text-inverse-rgb) / 0.7); }
.hub-filter-count { font-variant-numeric: tabular-nums; color: rgb(var(--text-tertiary-rgb)); font-size: 0.75rem; }

/* ---- metrics -------------------------------------------------------------------------- */
.hub-metric { display: flex; flex-direction: column; gap: 12px; min-height: 124px; }
.hub-metric-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hub-metric-value { font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1; color: rgb(var(--text-primary-rgb)); font-variant-numeric: tabular-nums; }
.hub-metric-value--text { font-size: 1.5rem; }
.hub-metric--price .hub-metric-value { font-size: 1.75rem; }
.hub-delta.flat { color: rgb(var(--text-tertiary-rgb)); }
.hub-delta { font-size: 0.8125rem; font-weight: 600; }
.hub-delta.up { color: rgb(var(--hub-up-rgb)); }
.hub-delta.down { color: rgb(var(--hub-down-rgb)); }
.hub-mix-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: rgb(var(--surface-tertiary-rgb)); }
.hub-mix-up { background: rgb(var(--hub-up-rgb)); }
.hub-mix-flat { background: rgb(var(--text-tertiary-rgb) / 0.55); }
.hub-mix-down { background: rgb(var(--hub-down-rgb)); }
.hub-trend { width: 100%; height: 56px; display: block; }
.hub-trend-axis { stroke: rgb(var(--border-default-rgb)); stroke-width: 1; }
.hub-trend-up { fill: rgb(var(--hub-up-rgb)); }
.hub-trend-down { fill: rgb(var(--hub-down-rgb)); }
.hub-trend-flat { fill: rgb(var(--border-default-rgb)); }

/* ---- mentions panel ------------------------------------------------------------------- */
.hub-mention-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.hub-mention-row { padding: 14px 0; border-top: 1px solid rgb(var(--border-subtle-rgb, var(--border-default-rgb))); }
.hub-mention-row:first-child { border-top: 0; padding-top: 0; }
.hub-mention-row .hub-note-head { margin-bottom: 8px; }
.hub-mention-text { font-size: 0.9375rem; line-height: 1.5; color: rgb(var(--text-primary-rgb)); margin: 0; }

/* ---- filters (insights) --------------------------------------------------------------- */
.hub-filters { position: sticky; top: 104px; padding: 20px 20px 8px; }
.hub-filter-heading { font-size: 1.125rem; font-weight: 600; margin: 0; color: rgb(var(--text-primary-rgb)); }
.hub-filter-title { margin: 20px 0 8px; }
.hub-filter-list { list-style: none; margin: 0 0 8px; padding: 0; }
.hub-filter-link {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 6px 10px; margin: 0 -10px; border-radius: 6px;
    font-size: 0.875rem; color: rgb(var(--text-secondary-rgb)); text-decoration: none;
}
.hub-filter-link:hover { background: rgb(var(--surface-secondary-rgb)); color: rgb(var(--text-primary-rgb)); }
.hub-filter-link.active { color: rgb(var(--text-primary-rgb)); font-weight: 600; }
.hub-filter-link.active::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: rgb(var(--hub-ink-rgb)); margin-right: 8px; flex: none; }
.hub-filter-link:not(.active)::before { content: ""; width: 10px; height: 10px; border-radius: 2px; border: 1px solid rgb(var(--border-default-rgb)); margin-right: 8px; flex: none; }
.hub-filter-link span:first-of-type { flex: 1; }
.hub-pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 32px; }

/* ---- banner + CTA (dark panels) ------------------------------------------------------- */
.hub-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 32px;
    background: rgb(var(--hub-ink-rgb)); color: rgb(var(--text-inverse-rgb));
    border-radius: var(--hub-radius); padding: 32px 36px; margin-bottom: 28px; text-decoration: none;
}
.hub-banner-eyebrow { color: rgb(var(--brand-accent-rgb)); margin-bottom: 12px; }
.hub-banner-eyebrow::before { content: "●"; font-size: 0.5rem; vertical-align: middle; margin-right: 8px; }
.hub-banner-title { font-size: 1.625rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; margin: 0 0 12px; color: inherit; }
.hub-banner-text { font-size: 0.9375rem; line-height: 1.55; color: rgb(var(--text-inverse-rgb) / 0.72); margin: 0; }
.hub-banner-meta { font-size: 0.75rem; color: rgb(var(--text-inverse-rgb) / 0.55); margin: 12px 0 0; font-style: italic; }
.hub-cta {
    display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
    background: rgb(var(--hub-ink-rgb)); color: rgb(var(--text-inverse-rgb));
    border-radius: var(--hub-radius); padding: 24px 32px; margin-top: 40px;
}
.hub-cta-text { font-size: 1.0625rem; margin: 0; color: rgb(var(--brand-accent-rgb)); }
.hub-cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 768px) { .hub-banner { flex-direction: column; align-items: flex-start; } }

/* ---- buttons -------------------------------------------------------------------------- */
.hub-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
    font-size: 0.875rem; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
    background: rgb(var(--hub-ink-rgb)); color: rgb(var(--text-inverse-rgb));
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.hub-btn:hover { filter: brightness(1.15); }
.hub-btn--ghost { background: transparent; color: inherit; border-color: rgb(var(--text-inverse-rgb) / 0.35); }
.hub-cta .hub-btn--ghost:hover, .hub-banner .hub-btn--ghost:hover { border-color: rgb(var(--text-inverse-rgb)); }
.hub-page > .hub-pager .hub-btn--ghost, .hub-pager .hub-btn--ghost { color: rgb(var(--text-primary-rgb)); border-color: rgb(var(--border-default-rgb)); }
.hub-btn--light { background: rgb(var(--surface-primary-rgb)); color: rgb(var(--hub-ink-rgb)); }
.hub-btn--accent { background: rgb(var(--brand-accent-rgb)); color: rgb(var(--hub-ink-rgb)); }
.hub-btn:focus-visible { outline: 2px solid rgb(var(--focus-rgb)); outline-offset: 2px; }

/* ---- documents table ------------------------------------------------------------------ */
.hub-table-wrap { padding: 0; overflow-x: auto; }
.hub-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.hub-table th { text-align: left; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: rgb(var(--text-tertiary-rgb)); background: rgb(var(--surface-secondary-rgb)); padding: 12px 20px; border-bottom: 1px solid rgb(var(--border-default-rgb)); }
.hub-table td { padding: 14px 20px; border-bottom: 1px solid rgb(var(--border-subtle-rgb, var(--border-default-rgb))); color: rgb(var(--text-secondary-rgb)); vertical-align: top; }
.hub-table tbody tr:last-child td { border-bottom: 0; }
.hub-table tbody tr:hover td { background: rgb(var(--surface-secondary-rgb)); }
.hub-table-primary { color: rgb(var(--text-primary-rgb)); font-weight: 500; max-width: 46ch; }
.hub-table-action { text-align: right; white-space: nowrap; }

/* ---- AI chassis (HAX) ----------------------------------------------------------------- */
/* The design-system trust chassis for AI-generated content, scoped into the hub. The hub is
   served by shells that load hub.css but NOT lct-design-system.css (the Investec Corporate
   Hub shell is the live example), so a hub view carrying .lct-ai-* would otherwise render the
   "AI" badge and its provenance line as unstyled inline text — the HAX-required declared
   provenance would be in the markup but invisible. Values mirror the AI SURFACES block in
   lct-design-system.css so the two shells look identical; keep them in step.

   Only the left edge is taken from .lct-ai-block: on the hub the block is also a .hub-card,
   which already owns the surface, border, radius and padding. */
.lct-ai-block { border-left: 3px solid var(--info); }

.lct-ai-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

.lct-ai-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 8px; border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--info) 12%, transparent);
    color: var(--info);
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.lct-ai-badge::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%;
    background: var(--info);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 25%, transparent);
}

.lct-ai-meta { font-size: 12px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }

/* ---- reader (desk view) --------------------------------------------------------------- */
.hub-reader { padding: 36px 40px; }
/* The reader's provenance line is a full sentence, not a timestamp, so it wraps: anchor the
   badge to its first line rather than centring it on the whole block. */
.hub-reader .lct-ai-header { align-items: flex-start; margin-bottom: 20px; }
.hub-reader h1, .hub-reader h2, .hub-reader h3 { font-family: var(--hub-serif); font-weight: 600; letter-spacing: -0.005em; }
.hub-reader h1 { display: none; } /* the page header already carries the title */
.hub-reader h2 { font-size: 1.375rem; margin: 28px 0 12px; }
.hub-reader h3 { font-size: 1.125rem; margin: 20px 0 8px; }
.hub-reader p, .hub-reader li { line-height: 1.65; color: rgb(var(--text-primary-rgb)); }
.hub-reader blockquote { border-left: 3px solid rgb(var(--brand-accent-rgb)); padding: 8px 16px; margin: 16px 0; background: rgb(var(--surface-secondary-rgb)); border-radius: 0 8px 8px 0; }
.hub-pre { white-space: pre-wrap; font: inherit; }
/* Reader body spacing. The brand shells load hub.css, not lct-design-system.css, so the reader
   cannot lean on .lct-doc-prose for block rhythm — without these, every statement in a desk note
   runs into the next. */
.hub-reader p { margin: 0 0 12px; }
.hub-reader ul, .hub-reader ol { margin: 0 0 12px; padding-left: 22px; }
.hub-reader li { margin: 0 0 4px; }
.hub-reader > :first-child { margin-top: 0; }
.hub-reader > :last-child { margin-bottom: 0; }
/* List markers. The rhythm rules above restored the indent but not the marker, and preflight's
   `list-style: none` is never undone on a brand shell — so a desk note's supporting points read as
   unmarked indented lines, and an ordered list loses the numbers a reader needs to cite a step.
   Nested levels take a different marker so depth stays legible. */
.hub-reader ul { list-style-type: disc; }
.hub-reader ul ul { list-style-type: circle; }
.hub-reader ol { list-style-type: decimal; }
/* Grounding links. Same gap as the rhythm above: .lct-doc-prose a ships in lct-design-system.css,
   so on a brand shell Tailwind preflight's `color: inherit; text-decoration: inherit` leaves a
   citation indistinguishable from body text and the route to the working goes invisible. Mirrors
   .hub-link's treatment — but underlined in --text-tertiary-rgb, because --border-default-rgb is
   1.24:1 on the white card and inline the underline is the only affordance. Type is inherited, so
   a citation sits in the prose ramp rather than .hub-link's 0.875rem/500. */
.hub-reader a { color: rgb(var(--text-primary-rgb)); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgb(var(--text-tertiary-rgb)); }
.hub-reader a:hover { text-decoration-color: currentColor; }
/* A source document the browser renders natively (PDF) is framed at a readable height instead. */
.hub-doc-frame { width: 100%; height: min(80vh, 900px); border: 0; border-radius: 8px; display: block; }
@media (max-width: 640px) { .hub-reader { padding: 24px 20px; } }

/* ---- Ask: floating trigger + drawer --------------------------------------------------- */
.hub-fab {
    position: fixed; right: 28px; bottom: 28px; z-index: 35;
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 18px 14px 16px; border-radius: 999px; border: 1px solid rgb(var(--brand-accent-rgb) / 0.45);
    background: rgb(var(--hub-ink-rgb)); color: rgb(var(--text-inverse-rgb));
    font-size: 0.875rem; font-weight: 600; cursor: pointer;
    box-shadow: 0 10px 30px -10px rgb(var(--hub-ink-rgb) / 0.6), 0 0 0 6px rgb(var(--brand-accent-rgb) / 0.12);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.hub-fab:hover { transform: translateY(-1px); box-shadow: 0 14px 34px -10px rgb(var(--hub-ink-rgb) / 0.65), 0 0 0 8px rgb(var(--brand-accent-rgb) / 0.16); }
.hub-fab:focus-visible { outline: 2px solid rgb(var(--focus-rgb)); outline-offset: 3px; }
.hub-fab-icon { width: 22px; height: 22px; color: rgb(var(--brand-accent-rgb)); }
.hub-ask-drawer { position: fixed; top: 0; right: 0; height: 100%; z-index: 50; display: flex; }
.hub-ask-drawer > * { height: 100%; }
@media (max-width: 640px) { .hub-fab-label { display: none; } .hub-fab { padding: 14px; } }
