/* cybersecurityguide.org program lists (CSG Lists plugin). Scoped to .csgl-* so it never touches the theme. */

:where(.csgl, .csgl-tray, .csgl-dialog) {
  /* Matched to the live eleven40 Pro theme: links #237cf4, navigation #0c094d, row stripes #dedede.
     The accent is a deeper shade of the link blue so small text keeps 4.5:1 contrast. */
  --csgl-accent: #1662d4;
  --csgl-accent-soft: #e9f1fe;
  --csgl-navy: #0c094d;
  --csgl-ink: #000;
  --csgl-muted: #5b6672;
  --csgl-line: #dde2e8;
  --csgl-surface: #fff;
  --csgl-soft: #f4f6f9;
  --csgl-good: #1f7a4d;
  --csgl-ok: #946300;
  --csgl-weak: #b3412e;
  --csgl-radius: 8px;
  color: var(--csgl-ink);
}

.csgl { margin: 40px 0; container: csgl / inline-size; }

/* Undo eleven40 Pro's global table, list and button styles inside the plugin's markup. */
.entry-content .csgl ol, .entry-content .csgl ul, .csgl-dialog ul { margin: 0; padding: 0; }
.entry-content .csgl ol > li, .entry-content .csgl ul > li { list-style: none; }
.entry-content .csgl .csgl-highlights { margin: 0 0 0 20px; }
.entry-content .csgl .csgl-highlights > li { list-style: disc; }
.csgl table, .csgl-dialog table { line-height: 1.45; margin-bottom: 0; }
.csgl tbody, .csgl-dialog tbody { border-bottom: 0; }
.csgl th, .csgl-dialog th { text-transform: none; }
.csgl td, .csgl-dialog td { border-top: 0; }
.csgl button, .csgl-tray button, .csgl-dialog button { font-family: inherit; letter-spacing: normal; text-transform: none; }
.csgl input, .csgl select { box-shadow: none; font-family: inherit; }
.csgl .csgl-sort:hover, .csgl .csgl-sort:focus { background: none; color: inherit; }
.csgl .csgl-more-btn:hover, .csgl .csgl-more-btn:focus { background: var(--csgl-accent-soft); color: var(--csgl-accent); }
.csgl-tray .csgl-tray__go:hover, .csgl-tray .csgl-tray__go:focus { background: #fff; color: var(--csgl-ink); }
.csgl-tray .csgl-tray__go:disabled { background: #fff; color: var(--csgl-ink); opacity: 0.45; }
.csgl-tray .csgl-tray__clear:hover, .csgl-tray .csgl-tray__clear:focus { background: transparent; color: #fff; }
.csgl-dialog .csgl-dialog__close:hover, .csgl-dialog .csgl-dialog__close:focus { background: none; color: var(--csgl-ink); }
.csgl [hidden], .csgl-tray[hidden] { display: none !important; }
.csgl h2 { margin: 0 0 16px; }
.csgl-summary, .csgl-method { color: var(--csgl-muted); font-size: 0.92em; }
.csgl-method a, .csgl a { color: var(--csgl-accent); }
.csgl .screen-reader-text, .csgl-dialog .screen-reader-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Key figures */
.csgl-insights { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0 0 12px; }
.csgl-stat { background: var(--csgl-soft); border-radius: var(--csgl-radius); padding: 14px 16px; }
.csgl-stat__value { display: block; font-size: 1.6em; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.csgl-stat__label { display: block; font-size: 0.82em; color: var(--csgl-muted); line-height: 1.3; margin-top: 4px; }

/* Controls */
.csgl-controls {
  display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end;
  background: var(--csgl-soft); border-radius: var(--csgl-radius); padding: 14px 16px; margin: 20px 0 16px;
}
.csgl-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8em; color: var(--csgl-muted); font-weight: 600; }
.csgl-field { min-width: 0; }
.csgl-field--grow { flex: 1 1 220px; }
.csgl-field input, .csgl-field select {
  font: inherit; font-size: 15px; font-weight: 400; color: var(--csgl-ink); background: var(--csgl-surface);
  border: 1px solid var(--csgl-line); border-radius: 6px; padding: 8px 10px; min-height: 40px; box-sizing: border-box;
  width: 100%; max-width: 100%;
}
.csgl-field input:focus-visible, .csgl-field select:focus-visible { outline: 2px solid var(--csgl-accent); outline-offset: 1px; }
.csgl-chips label:has(input:focus-visible) { outline: 2px solid var(--csgl-accent); outline-offset: 2px; }
.csgl-chips { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; flex-basis: 100%; }
.csgl-chips label {
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer;
  background: var(--csgl-surface); border: 1px solid var(--csgl-line); border-radius: 999px; padding: 6px 12px;
}
.csgl-chips label:has(input:checked) { background: var(--csgl-accent-soft); border-color: var(--csgl-accent); color: var(--csgl-accent); font-weight: 600; }
.csgl-chips label:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.csgl-chips input { margin: 0; accent-color: var(--csgl-accent); }
.csgl-count { flex-basis: 100%; margin: 0; font-size: 14px; color: var(--csgl-muted); }
.csgl-count b { color: var(--csgl-ink); }

/* Ranked cards */
.csgl-ranked { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.csgl-card { border: 1px solid var(--csgl-line); border-radius: var(--csgl-radius); background: var(--csgl-surface); margin: 0; padding: 0; }
.csgl-card article { padding: 18px 20px; }
.csgl-card:target { box-shadow: 0 0 0 3px var(--csgl-accent); }
.csgl-card__head { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; }
.csgl-rank {
  width: 44px; height: 44px; border-radius: 50%; background: var(--csgl-navy); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums;
}
.csgl-rank--ad { background: var(--csgl-muted); font-size: 13px; }
.csgl-card__title h3 { margin: 0; font-size: 1.2em; line-height: 1.25; }
.csgl-card__meta { margin: 2px 0 0; font-size: 0.85em; color: var(--csgl-muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.csgl-move { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--csgl-soft); color: var(--csgl-muted); }
.csgl-move--up { color: var(--csgl-good); background: #e6f4ec; }
.csgl-move--down { color: var(--csgl-weak); background: #fbeae6; }
.csgl-move--new { color: var(--csgl-accent); background: var(--csgl-accent-soft); }
.csgl-card__program { margin: 10px 0 12px; font-weight: 600; }

.csgl-facts { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; margin: 0; border: 1px solid var(--csgl-line); border-radius: 6px; overflow: hidden; }
.csgl-facts--5 { grid-template-columns: repeat(5, 1fr); }
.csgl-facts--4 { grid-template-columns: repeat(4, 1fr); }
.csgl-facts div { padding: 8px 10px; border-right: 1px solid var(--csgl-line); }
.csgl-facts div:last-child { border-right: 0; }
.csgl-facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--csgl-muted); margin: 0; }
.csgl-facts dd { margin: 2px 0 0; font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.csgl-facts abbr, .csgl-table abbr { font-size: 0.75em; font-weight: 400; color: var(--csgl-muted); text-decoration: underline dotted; }
.csgl-residency { display: block; font-size: 11px; font-weight: 400; color: var(--csgl-muted); }
.csgl-table .csgl-total abbr { display: block; font-size: 11px; color: var(--csgl-muted); text-decoration: none; border: 0; cursor: help; }

.csgl-more { margin-top: 12px; }
.csgl-more summary { cursor: pointer; color: var(--csgl-accent); font-size: 0.9em; font-weight: 600; }
.csgl-more h4 { font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.04em; color: var(--csgl-muted); margin: 16px 0 6px; }
.csgl-factors { list-style: none; margin: 0; padding: 0; }
.csgl-factor[title] { cursor: help; }
.csgl-factor { display: grid; grid-template-columns: 200px 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--csgl-soft); font-size: 0.9em; margin: 0; }
.csgl-factor__name small { color: var(--csgl-muted); }
.csgl-factor__value { display: flex; align-items: center; gap: 8px; }
.csgl-factor__value::before { content: ""; width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--csgl-line); }
.csgl-factor--good .csgl-factor__value::before { background: var(--csgl-good); }
.csgl-factor--ok .csgl-factor__value::before { background: var(--csgl-ok); }
.csgl-factor--weak .csgl-factor__value::before { background: var(--csgl-weak); }
.csgl-history { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.csgl-history li { background: var(--csgl-soft); border-radius: 6px; padding: 4px 10px; font-size: 0.85em; margin: 0; }
.csgl-history li span { color: var(--csgl-muted); }
.csgl-history li.is-current { background: var(--csgl-accent-soft); }
.csgl-payback { font-size: 0.92em; margin: 0; }

.csgl-cta {
  display: inline-block; margin-top: 14px; padding: 8px 14px; border-radius: 6px; font-weight: 600; font-size: 0.92em;
  border: 1px solid var(--csgl-accent); color: var(--csgl-accent); text-decoration: none;
}
.csgl-cta:hover { background: var(--csgl-accent); color: #fff; }
.csgl-paid { margin: 8px 0 0; font-size: 12px; color: var(--csgl-muted); }
.csgl-tag {
  display: inline-block; margin: 3px 6px 3px 0; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--csgl-soft); color: var(--csgl-muted); text-decoration: none; white-space: nowrap;
}
.csgl-tag--rank { background: var(--csgl-accent-soft); color: var(--csgl-accent); }
.csgl-tag--rank:hover { text-decoration: underline; }
.csgl-ranked .csgl-empty { list-style: none; text-align: center; color: var(--csgl-muted); padding: 28px; border: 1px dashed var(--csgl-line); border-radius: var(--csgl-radius); }
.csgl-compare-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--csgl-muted); cursor: pointer; white-space: nowrap; }
.csgl-compare-toggle input { accent-color: var(--csgl-accent); margin: 0; width: 16px; height: 16px; }

.csgl-price-note { display: block; font-size: 12px; font-weight: 400; color: var(--csgl-muted); line-height: 1.35; margin-top: 2px; }
.csgl-table .csgl-price-cell { white-space: normal; }
@container csgl (max-width: 520px) { .csgl-table .csgl-price-cell { grid-column: span 2; } }

/* Previous editions of a ranking */
.csgl-past { margin: 24px 0 0; }
.csgl-past__title { font-weight: 700; margin: 0 0 8px; }
.csgl-past__year { border: 1px solid var(--csgl-line); border-radius: var(--csgl-radius); margin: 0 0 8px; }
.csgl-past__year summary { cursor: pointer; padding: 10px 14px; font-weight: 600; }
.csgl-past__year summary span { color: var(--csgl-muted); font-weight: 400; }
.entry-content .csgl .csgl-past__year ol { margin: 0; padding: 0 14px 12px 40px; columns: 2; column-gap: 32px; font-size: 0.92em; }
.entry-content .csgl .csgl-past__year ol > li { list-style: decimal; margin: 0 0 4px; break-inside: avoid; }
.csgl-past__now { font-size: 0.85em; color: var(--csgl-accent); white-space: nowrap; }
@container csgl (max-width: 520px) { .entry-content .csgl .csgl-past__year ol { columns: 1; } }

/* Sponsored placements, kept apart from the directory */
.csgl-ads { border: 1px solid var(--csgl-line); border-radius: var(--csgl-radius); padding: 10px 16px; margin: 16px 0; background: #fffdf5; }
.csgl-ads ul { list-style: none; margin: 0; padding: 0; }
.csgl-ads li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0; padding: 6px 0; }
.csgl-ads .csgl-cta { margin: 0 0 0 auto; padding: 6px 12px; }
.csgl-ad__label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; background: var(--csgl-muted); color: #fff; border-radius: 4px; padding: 1px 6px; }
.csgl-ad__text { font-size: 0.95em; }
.csgl-ads .csgl-paid { margin: 4px 0 0; }

/* Full listing table */
.csgl-table-wrap { border: 1px solid var(--csgl-line); border-radius: var(--csgl-radius); overflow: clip; }
.csgl-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0; }
.csgl-table th, .csgl-table td { padding: 10px 8px; text-align: left; vertical-align: top; border: 0; border-bottom: 1px solid var(--csgl-line); }
.csgl-table thead th { background: var(--csgl-soft); font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--csgl-muted); position: sticky; top: 0; z-index: 1; }
.csgl-table tbody tr:nth-child(even) { background: #eff2f6; }
.csgl-table tbody tr:hover { background: #e6ecf3; }
.csgl-table tbody tr:target { background: var(--csgl-accent-soft); }
.csgl-table tbody th { font-weight: 400; }
.csgl-table .csgl-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.csgl-school { display: block; font-weight: 600; }
.csgl-school a { text-decoration: none; }
.csgl-school a:hover { text-decoration: underline; }
.csgl-sub { display: block; color: var(--csgl-muted); font-size: 0.9em; }
.csgl-sort {
  all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; text-transform: inherit; letter-spacing: inherit;
}
.csgl-sort::after { content: "↕"; opacity: 0.4; margin-left: 3px; }
th[aria-sort="ascending"] .csgl-sort::after { content: "↑"; opacity: 1; }
th[aria-sort="descending"] .csgl-sort::after { content: "↓"; opacity: 1; }
.csgl-sort:focus-visible { outline: 2px solid var(--csgl-accent); }
.csgl-col-compare { width: 1%; text-align: center !important; }
.csgl-table { table-layout: fixed; }
.csgl-table thead .csgl-sort { display: inline; }
.csgl-table thead th { white-space: nowrap; }
/* Full listing: school, per credit, total, credits, format, CAE, compare */
.csgl-table thead th:nth-child(1) { width: 33%; }
.csgl-table thead th:nth-child(2) { width: 14%; }
.csgl-table thead th:nth-child(3) { width: 13%; }
.csgl-table thead th:nth-child(4) { width: 11%; }
.csgl-table thead th:nth-child(5) { width: 15%; }
.csgl-table thead th:nth-child(6) { width: 7%; }
.csgl-table thead th:nth-child(7) { width: 7%; }
/* Explorer: school, level and format, per credit, total, credits, CAE, compare */
[data-csgl="explorer"] .csgl-table thead th:nth-child(1) { width: 31%; }
[data-csgl="explorer"] .csgl-table thead th:nth-child(2) { width: 17%; }
[data-csgl="explorer"] .csgl-table thead th:nth-child(3) { width: 14%; }
[data-csgl="explorer"] .csgl-table thead th:nth-child(4) { width: 14%; }
[data-csgl="explorer"] .csgl-table thead th:nth-child(5) { width: 10%; }
[data-csgl="explorer"] .csgl-table thead th:nth-child(6) { width: 7%; }
[data-csgl="explorer"] .csgl-table thead th:nth-child(7) { width: 7%; }
[data-csgl="explorer"] .csgl-table thead th:nth-child(2) { white-space: normal; }
.csgl-type { display: block; }
.csgl-table .csgl-compare-toggle span {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.csgl-more-btn {
  display: block; margin: 16px auto 0; font: inherit; font-weight: 600; padding: 10px 20px; border-radius: 6px; cursor: pointer;
  background: var(--csgl-surface); color: var(--csgl-accent); border: 1px solid var(--csgl-accent);
}
.csgl-empty td { text-align: center; color: var(--csgl-muted); padding: 28px; }

/* Compare tray and dialog */
.csgl-tray {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px); box-sizing: border-box;
  background: var(--csgl-ink); color: #fff; border-radius: 999px; padding: 8px 8px 8px 20px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  font-size: 14px;
}
.csgl-tray__names { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.csgl-tray button { font: inherit; font-weight: 600; border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer; flex: none; }
.csgl-tray__go { background: #fff; color: var(--csgl-ink); }
.csgl-tray__go:disabled { opacity: 0.45; cursor: not-allowed; }
.csgl-tray__clear { background: transparent; color: #c9d1da; }

.csgl-dialog { border: 0; border-radius: 12px; padding: 0; width: min(1000px, calc(100% - 32px)); max-height: calc(100% - 48px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.csgl-dialog::backdrop { background: rgba(20, 25, 32, 0.55); }
.csgl-dialog__head { display: flex; gap: 16px; align-items: flex-end; padding: 18px 20px; border-bottom: 1px solid var(--csgl-line); position: sticky; top: 0; background: #fff; }
.csgl-dialog__head h2 { margin: 0 auto 6px 0; font-size: 1.25em; }
.csgl-dialog__close { font-size: 28px; line-height: 1; border: 0; background: none; cursor: pointer; color: var(--csgl-muted); padding: 4px 8px; align-self: flex-start; }
.csgl-dialog__body { overflow-x: auto; padding: 4px 20px 20px; }
.csgl-compare { border-collapse: collapse; width: 100%; font-size: 14px; }
.csgl-compare th, .csgl-compare td { padding: 9px 10px; border-bottom: 1px solid var(--csgl-line); text-align: left; vertical-align: top; min-width: 150px; }
.csgl-compare tbody th { color: var(--csgl-muted); font-weight: 600; min-width: 120px; }
.csgl-compare thead th { font-size: 15px; }
.csgl-compare a { color: var(--csgl-accent); }
.csgl-compare .is-best { color: var(--csgl-good); font-weight: 700; }

/* Narrow content columns (the theme's article column is about 580px on desktop): two-up figures and facts */
@container csgl (max-width: 640px) {
  .csgl-insights { grid-template-columns: repeat(2, 1fr); }
  .csgl-stat__value { font-size: 1.35em; }
  .csgl-field { flex: 1 1 calc(50% - 7px); }
  .csgl-field--grow { flex-basis: 100%; }
  .csgl-card article { padding: 14px; }
  .csgl-facts, .csgl-facts--5, .csgl-facts--4 { grid-template-columns: repeat(2, 1fr); }
  .csgl-facts div { border-right: 1px solid var(--csgl-line); border-bottom: 1px solid var(--csgl-line); }
  .csgl-facts div:nth-child(2n) { border-right: 0; }
  /* Only the last row loses its bottom border; an odd last fact spans the full width. */
  .csgl-facts div:last-child, .csgl-facts div:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
  .csgl-facts div:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: 0; }
  .csgl-factor { grid-template-columns: 1fr; gap: 2px; }
}

/* Phone-width columns: table rows become cards */
@container csgl (max-width: 520px) {
  .csgl-card__head { grid-template-columns: auto 1fr; }
  .csgl-card__head .csgl-compare-toggle { grid-column: 2; }
  .csgl-table-wrap { border: 0; overflow: visible; }
  .csgl-table thead { display: none; }
  .csgl-table, .csgl-table tbody { display: block; }
  .csgl-table tbody tr {
    display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--csgl-line); border-radius: var(--csgl-radius);
    margin-bottom: 10px; background: var(--csgl-surface) !important; position: relative;
  }
  .csgl-table tbody th { grid-column: 1 / -1; padding-right: 100px; }
  .csgl-table th, .csgl-table td { border-bottom: 0; padding: 8px 12px; }
  .csgl-table td::before { content: attr(data-label); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--csgl-muted); }
  .csgl-table .csgl-num { text-align: left; }
  .csgl-table td.csgl-col-compare { position: absolute; top: 4px; right: 4px; width: auto; }
  .csgl-table td.csgl-col-compare::before { content: none; }
  .csgl-table .csgl-compare-toggle span { position: static; width: auto; height: auto; clip: auto; }
}

/* Phones: the compare tray and dialog sit outside the column, so they follow the window */
@media (max-width: 720px) {
  .csgl-tray { border-radius: 12px; left: 16px; right: 16px; transform: none; max-width: none; }
  .csgl-dialog__head { flex-wrap: wrap; padding: 14px 16px; }
  .csgl-dialog { width: calc(100% - 16px); max-height: calc(100% - 16px); }
  .csgl-dialog__body { padding: 0 0 12px; }
  .csgl-compare { font-size: 13px; }
  .csgl-compare th, .csgl-compare td { min-width: 118px; padding: 8px; }
  .csgl-compare tbody th, .csgl-compare thead th:first-child {
    position: sticky; left: 0; z-index: 1; background: #fff; min-width: 84px; max-width: 84px; box-shadow: 1px 0 0 var(--csgl-line);
  }
}
