/* =========================================================================
 * EIASM Course Module Table — Theme Layer (v1.11.0)
 *
 * Defines the public CSS-variable contract used by the CMT widget and
 * (per Block I) the Case Studies widget. Two themes ship in v1.11.0:
 *
 *   default — EIASM teal/ink palette. Variable values reproduce the
 *             colours hardcoded into widget-cmt-base/default/editorial/
 *             spotlight stylesheets prior to v1.11.0, so existing pages
 *             render byte-for-byte identically when no Theme control
 *             setting is chosen.
 *
 *   dpr     — DPr navy/gold palette, sourced from Dpr_Jana_blueprint.txt
 *             (rgb(13, 21, 40) hero, #C9A84C accent, Plus Jakarta Sans /
 *             Inter retained from default). Activated by setting
 *             data-eiasm-cmt-theme="dpr" on the widget root, which the
 *             CMT widget does in PHP from the Theme control.
 *
 * Loading: registered as `eiasm-cmt-theme` and declared as a style dep
 * of the CMT widget (see class-course-module-table-widget.php). It
 * depends on `eiasm-cmt-base` so the variables are always defined
 * before the variant CSS that may consume them.
 *
 * Cross-cutting note (§X-cut): Block I (Case Studies template refresh)
 * reuses these same `--cmt-*` names. New names introduced for case
 * studies should use a `--cs-*` prefix to avoid colliding here.
 *
 * Specificity: doubled `.eiasm-cmt-wrap.eiasm-cmt-wrap` matches the
 * existing token-block convention in widget-cmt-base.css. The DPr
 * override adds an attribute selector to the same doubled wrap, so
 * its specificity is one notch higher and source order is irrelevant.
 *
 * Backward-compatibility (D9): the legacy `secondary_header_color`
 * Default-variant control (teal | dark | lime) is unchanged; it only
 * affects elements that read `--eiasm-teal` / `--eiasm-ink` /
 * `--eiasm-lime` and is shadowed under DPr because DPr remaps the
 * accent via `--cmt-accent`. No deprecation copy — operators can
 * keep using either the existing accent option or the new theme.
 * ========================================================================= */

/* ── Default theme — base contract ─────────────────────────────────────── */
.eiasm-cmt-wrap.eiasm-cmt-wrap {
    /* Surfaces */
    --cmt-bg:                 #FFFFFF;
    --cmt-bg-alt:             #F8FAFC;

    /* Foreground */
    --cmt-fg:                 #0B1220;
    --cmt-fg-muted:           #475569;

    /* Accents (bucket headings, links, hover, focus) */
    --cmt-accent:             #1587A8;
    --cmt-accent-fg:          #FFFFFF;

    /* Structural */
    --cmt-border:             #E2E8F0;
    --cmt-radius-card:        12px;
    --cmt-radius-pill:        999px;

    /* Typography (parallel to existing --eiasm-font-*; kept so Block I
       can target a single token vocabulary) */
    --cmt-font-heading:       'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --cmt-font-body:          'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Shadows */
    --cmt-shadow-card:        0 1px 3px 0 rgba(0,0,0,0.10), 0 1px 2px -1px rgba(0,0,0,0.10);

    /* Bucket heading band (transparent on default — headings sit on the
       card surface; DPr theme paints a subtle gold tint behind them) */
    --cmt-bucket-heading-bg:  transparent;
    --cmt-bucket-heading-fg:  var(--cmt-fg);

    /* Credit pill colours (the small "X Credits" chip) */
    --cmt-credit-pill-bg:     rgba(21, 135, 168, 0.12);
    --cmt-credit-pill-fg:     #1587A8;
}

/* ── DPr override ──────────────────────────────────────────────────────── */
/*
 * DPr palette pulled from /dpr/ blueprint:
 *   - Hero background      rgb(13, 21, 40) → #0D1528
 *   - Accent gold          #C9A84C
 *   - Surface 2 (proxied)  #15203A — slight lift over the navy background
 *   - Card shadow          0 25px 50px -12px rgba(0,0,0,0.25)
 *
 * The override re-defines the public --cmt-* contract AND remaps the
 * legacy --eiasm-* tokens that widget-cmt-base/default/editorial/spotlight
 * already consume. This dual mapping is what lets v1.11.0 ship the DPr
 * theme without rewriting every variant stylesheet — the widget CSS
 * keeps reading --eiasm-* and gets DPr values automatically when the
 * data attribute is set.
 *
 * Once Block I lands and we have time to migrate every variant CSS
 * file to --cmt-*, the --eiasm-* remap can be dropped. Until then it
 * coexists; both sets of variables resolve to the DPr palette under
 * data-eiasm-cmt-theme="dpr".
 */
.eiasm-cmt-wrap.eiasm-cmt-wrap[data-eiasm-cmt-theme="dpr"] {
    /* Public contract */
    --cmt-bg:                 #0D1528;
    --cmt-bg-alt:             #15203A;
    --cmt-fg:                 #FFFFFF;
    --cmt-fg-muted:           rgba(255, 255, 255, 0.75);
    --cmt-accent:             #C9A84C;
    --cmt-accent-fg:          #0D1528;
    --cmt-border:             rgba(255, 255, 255, 0.08);
    --cmt-shadow-card:        0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --cmt-bucket-heading-bg:  rgba(201, 168, 76, 0.08);
    --cmt-bucket-heading-fg:  #C9A84C;
    --cmt-credit-pill-bg:     rgba(201, 168, 76, 0.16);
    --cmt-credit-pill-fg:     #C9A84C;

    /* Legacy --eiasm-* token remap so existing variant CSS picks up DPr
       colours without any rule changes. Each remap is a 1:1 mirror of
       the --cmt-* contract above where the existing CSS expects it. */
    --eiasm-bg:               var(--cmt-bg);
    --eiasm-bg-muted:         var(--cmt-bg-alt);
    --eiasm-ink:              var(--cmt-fg);
    --eiasm-slate:            var(--cmt-fg-muted);
    --eiasm-slate-soft:       rgba(255, 255, 255, 0.55);
    --eiasm-border:           var(--cmt-border);
    --eiasm-border-soft:      rgba(255, 255, 255, 0.05);
    --eiasm-teal:             var(--cmt-accent);
    --eiasm-teal-dark:        #B5933F;
    --eiasm-tealmist:         var(--cmt-bucket-heading-bg);
    /* Lime channel — DPr has no second decorative accent; alias to gold
       so the legacy `accent-lime` option degrades to the gold accent
       rather than emitting EIASM lime over a navy ground (D9). */
    --eiasm-lime:             var(--cmt-accent);
    --eiasm-limemist:         var(--cmt-bucket-heading-bg);
}

/* ── Bucket heading band paint (DPr-only visual lift) ──────────────────── */
/*
 * The default theme leaves --cmt-bucket-heading-bg transparent so the
 * existing card layout is unchanged. DPr tints the heading row to give
 * it a subtle gold halo against the navy card surface, matching the
 * "Cannot find your field?" treatment in the DPr blueprint. Selector
 * targets the heading wrapper used across all four shapes; non-DPr
 * widgets get the same selector but with a transparent background
 * (visually identical to v1.10.0).
 */
.eiasm-cmt-wrap.eiasm-cmt-wrap[data-eiasm-cmt-theme="dpr"] .eiasm-cmt-group__heading,
.eiasm-cmt-wrap.eiasm-cmt-wrap[data-eiasm-cmt-theme="dpr"] .eiasm-cmt-ed-section__heading,
.eiasm-cmt-wrap.eiasm-cmt-wrap[data-eiasm-cmt-theme="dpr"] .eiasm-cmt-sp-section__heading {
    color: var(--cmt-bucket-heading-fg) !important;
    background: var(--cmt-bucket-heading-bg);
    padding: 0.25em 0.5em;
    border-radius: var(--cmt-radius-card);
}

/* Card surface lift on DPr (matches blueprint backdrop-filter blur).
   Selector-doubled to land specificity above the variant CSS without
   reaching for !important. */
.eiasm-cmt-wrap.eiasm-cmt-wrap[data-eiasm-cmt-theme="dpr"] .eiasm-cmt-card {
    background: var(--cmt-bg) !important;
    color: var(--cmt-fg);
    border: 1px solid var(--cmt-border);
    box-shadow: var(--cmt-shadow-card);
}

/* ── Hide-type-pill toggle (v1.11.4) ──────────────────────────────────
 *
 * The widget control "Hide type pill on cards" sets data-hide-type-pill="1"
 * on the wrap. Three selectors cover the three variants' chip markup:
 *
 *   - Default: cards carry .eiasm-cmt-module--<type>; non-capstone cards
 *     have the chip-row child we hide entirely (avoids leaving an empty
 *     row taking vertical margin).
 *   - Editorial: chips are inline (no wrapper); we target the chip's own
 *     --standard variant directly.
 *   - Spotlight: cards carry .eiasm-cmt-sp-card--<type>; same chip-row
 *     hide-entire-row pattern as Default.
 *
 * :not() keeps capstone chips (THESIS / DISSERTATION) visible regardless
 * of the toggle, because they carry information that's NOT redundant
 * even on all-core programmes — a thesis-as-card module looks like a
 * regular module without that pill.
 *
 * Selector specificity matches the rest of cmt-theme.css (single-class
 * wrap with attribute selector, plus descendant). No !important needed
 * because we're hiding via display:none, which has no fall-through.
 */
.eiasm-cmt-wrap[data-hide-type-pill="1"] .eiasm-cmt-module:not(.eiasm-cmt-module--capstone) .eiasm-cmt-module__chip-row,
.eiasm-cmt-wrap[data-hide-type-pill="1"] .eiasm-cmt-sp-card:not(.eiasm-cmt-sp-card--capstone) .eiasm-cmt-sp-card__chip-row,
.eiasm-cmt-wrap[data-hide-type-pill="1"] .eiasm-cmt-ed-chip--standard {
    display: none;
}

/* ── Hide-capstone-chip toggle (v1.15.0 — woo-cleanup §9.2) ───────────
 *
 * The widget control "Hide thesis / dissertation chip" sets
 * data-hide-capstone-chip="1" on the wrap. Symmetric to the hide-type-pill
 * block above but the inverse target: here we hide the capstone chip and
 * leave the standard type pills alone. Covers all three variants on both
 * the inline module cards and the residual-credits row:
 *
 *   - Default:    capstone cards' chip-row (inline) + the residual
 *                 .eiasm-cmt-module__chip--capstone span.
 *   - Spotlight:  capstone cards' chip-row (inline; residual has no chip).
 *   - Editorial:  the inline-and-residual .eiasm-cmt-ed-chip--capstone span
 *                 (chips are inline in this variant, no row wrapper).
 *
 * display:none, no !important — same specificity contract as the rest of
 * this file.
 */
.eiasm-cmt-wrap[data-hide-capstone-chip="1"] .eiasm-cmt-module--capstone .eiasm-cmt-module__chip-row,
.eiasm-cmt-wrap[data-hide-capstone-chip="1"] .eiasm-cmt-sp-card--capstone .eiasm-cmt-sp-card__chip-row,
.eiasm-cmt-wrap[data-hide-capstone-chip="1"] .eiasm-cmt-ed-chip--capstone,
.eiasm-cmt-wrap[data-hide-capstone-chip="1"] .eiasm-cmt-residual .eiasm-cmt-module__chip--capstone {
    display: none;
}
