/* Layout: encabezado + tabla resumen, luego una ficha por diplomado (S1 | S2 lado a lado, se apilan en móvil). */
:root {
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --fg: #17202E;
  --muted: #566277;
  --line: #D8DEE7;
  --accent: #20406E;
  --accent-soft: #E3EAF4;
  --warn: #7F5200;
  --warn-bg: #FBF0D9;
  --loose: #7A2E3A;
  --loose-bg: #F7E6E9;
  --display: "Newsreader", Georgia, "Times New Roman", serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1623; --surface: #172131; --fg: #E6EAF1; --muted: #9AA6BA; --line: #2A3548;
    --accent: #8FB1E6; --accent-soft: #1E2D47; --warn: #E6B65C; --warn-bg: #2E2512;
    --loose: #E8A2AE; --loose-bg: #33202A; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1623; --surface: #172131; --fg: #E6EAF1; --muted: #9AA6BA; --line: #2A3548;
  --accent: #8FB1E6; --accent-soft: #1E2D47; --warn: #E6B65C; --warn-bg: #2E2512;
  --loose: #E8A2AE; --loose-bg: #33202A; color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 15px; line-height: 1.55;
  padding-block: 40px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
main { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; text-wrap: balance; margin: 0; line-height: 1.15; }
p { margin: 0; }
a { color: var(--accent); }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.eyebrow { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
header { display: flex; flex-direction: column; gap: 10px; }
header h1 { font-size: clamp(30px, 5vw, 44px); }
header p { max-width: 65ch; color: var(--muted); }

.summary { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; }
.summary table { width: 100%; border-collapse: collapse; min-width: 640px; font-variant-numeric: tabular-nums; }
.summary th, .summary td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.summary th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.summary tr:last-child td { border-bottom: 0; }
.summary td.num, .summary th.num { text-align: right; }
.summary td:first-child a { font-weight: 600; text-decoration: none; }
.summary td:first-child a:hover { text-decoration: underline; }

.ficha {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 28px; display: flex; flex-direction: column; gap: 22px; scroll-margin-top: 16px;
}
.ficha-head { display: flex; flex-direction: column; gap: 8px; }
.ficha-head h2 { font-size: clamp(24px, 3.6vw, 32px); color: var(--accent); }
.tag { display: inline-flex; width: fit-content; font-size: 12px; font-weight: 500; letter-spacing: .04em; padding: 2px 9px; border-radius: 3px; background: var(--accent-soft); color: var(--accent); }
.tag.loose { background: var(--loose-bg); color: var(--loose); }
.lede { max-width: 65ch; }
.audience { max-width: 65ch; color: var(--muted); }
.audience b { color: var(--fg); font-weight: 600; }

.stats { display: flex; flex-wrap: wrap; gap: 8px 28px; padding-block: 14px; border-block: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.stat { display: flex; flex-direction: column; }
.stat b { font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }

.sems { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.sem { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.sem h3 { font-family: var(--body); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.sem h3 span { font-variant-numeric: tabular-nums; font-weight: 500; }
.course { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.course .name { font-weight: 500; min-width: 0; }
.course .cr { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; text-align: right; white-space: nowrap; }
.course .meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.code { font-family: var(--mono); font-size: 12px; }
.chip { padding: 0 7px; border-radius: 3px; border: 1px solid var(--line); font-size: 11.5px; }
.chip.loose { border-color: transparent; background: var(--loose-bg); color: var(--loose); font-weight: 500; }

.notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.note { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.note h3 { font-family: var(--body); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.note ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.note.waive { background: var(--warn-bg); color: var(--warn); border-radius: 4px; padding: 14px 16px; }
.note.waive h3 { color: var(--warn); }
.note.waive ul { color: var(--fg); }
.note.waive .none { color: var(--fg); font-size: 14px; }
.tbd { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 13px; color: var(--muted); padding-top: 14px; border-top: 1px dashed var(--line); }
.tbd span b { color: var(--fg); font-weight: 500; }

footer { color: var(--muted); font-size: 13px; max-width: 70ch; }

@media (max-width: 680px) {
  .ficha { padding: 20px 16px; }
  .sems, .notes { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  body { background: #fff; color: #000; padding-block: 0; }
  .summary { display: none; }
  .ficha { break-after: page; border: 0; padding: 0; }
}

/* ===== Sitio (navegación y portada) ===== */
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); color: var(--fg);
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 4px; }

.sitebar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 980px; margin: 0 auto 20px; padding: 0 0 14px;
  border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted);
  flex-wrap: wrap;
}
.sitebar a { color: var(--accent); text-decoration: none; font-weight: 500; }
.sitebar a:hover { text-decoration: underline; }
.sitebar .brand { letter-spacing: .04em; text-transform: uppercase; font-size: 11.5px; }

.tools { display: flex; gap: 16px; align-items: center; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 22px; display: flex; flex-direction: column; gap: 12px;
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card h2 { font-size: 21px; line-height: 1.2; }
.card h2 a { color: var(--accent); text-decoration: none; }
.card h2 a:hover { text-decoration: underline; }
.card .lede { font-size: 14px; color: var(--muted); }
.card .stats { border-block: 0; padding-block: 0; gap: 4px 20px; margin-top: auto; }
.card .stat b { font-size: 20px; }
.card .stat span { font-size: 10.5px; }
.card .go { font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; }
.card .go::after { content: " →"; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 22px; }
.section-head .hint { font-size: 13px; color: var(--muted); }
.sitebar--home .brand { display: none; }
.sitebar--home { justify-content: flex-end; }

.pager {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 12px;
  max-width: 980px; margin: 28px auto 0;
}
.pager a, .pager span {
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
  padding: 14px 18px; text-decoration: none; color: var(--fg); font-size: 13px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: 68px;
}
.pager a:hover { border-color: var(--accent); }
.pager .dir { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.pager .name { font-weight: 500; }
.pager span { opacity: .45; }
.pager .next { text-align: right; align-items: flex-end; }
.pager .mid { min-width: 180px; align-items: center; justify-content: center; text-align: center; }
.pager .mid .dir { color: var(--accent); }

.sitefoot {
  max-width: 980px; margin: 36px auto 0; padding-top: 16px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px; display: flex; gap: 8px 20px; flex-wrap: wrap;
}
.sitefoot a { color: var(--accent); }

body.is-ficha main { max-width: 980px; }
body.is-ficha .ficha { margin: 0 auto; }

@media (max-width: 560px) {
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; align-items: flex-start; }
  .pager .mid { min-width: 0; }
  .stats { gap: 8px 14px; }
  .stat b { font-size: 22px; }
  .stat span { font-size: 10px; letter-spacing: .02em; }
  .sitebar .tools { width: 100%; justify-content: space-between; }
}

@media print {
  .sitebar, .tools, .pager, .sitefoot, .cards, .section-head, .skip { display: none !important; }
  main { max-width: none !important; }
}
