/* Faden v2 · direction C · screen 03 «Seguimiento del curso».
   Loads after tokens.css and styles.css; adds only the components the shared sheet lacks:
   course header, coverage bars, students by state (child silhouettes), sort and filter toggles, the course table
   (six columns, row expansion, card rows under 720 px) and the course academic block.
   Colours come only from tokens.css custom properties. */

/* Hidden icon sprite: <symbol>s reused through <use> inside each svg.fd-icon. */
.c03-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.c03-push { margin-left: auto; }

/* ---- Course header: H1, course facts, compact one-option course selector ---- */
.c03-course { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.c03-course__id { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.c03-course h1 { font: 600 var(--fd-text-h1) var(--fd-font); }
.c03-course__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font: var(--fd-text-meta) var(--fd-font); color: var(--fd-text-muted); }
.c03-course__meta li { display: inline-flex; align-items: center; gap: 6px; }
.c03-course__meta .fd-icon { color: var(--fd-icon); }
.c03-course__select { display: flex; align-items: center; gap: 8px; }
.c03-course__select label { font: 600 var(--fd-text-meta) var(--fd-font); color: var(--fd-text-muted); }
.c03-select {
  min-height: 36px; padding: 4px 8px;
  border: 1px solid var(--fd-border-control); border-radius: var(--fd-radius-control);
  background: var(--fd-surface); color: var(--fd-text); font: 600 var(--fd-text-table) var(--fd-font);
}

/* ---- Coverage: n/N printed as text, decorative bar (primary-600 fill, never red, never by value) ---- */
.c03-coverage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: var(--fd-card-pad); }
@container card (max-width: 519px) { .c03-coverage { grid-template-columns: minmax(0, 1fr); } }
.c03-coverage__item {
  display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 12px;
  border: 1px solid var(--fd-border-hairline); border-radius: var(--fd-radius-control);
}
.c03-coverage__label { display: flex; align-items: center; gap: 6px; font: 600 var(--fd-text-meta) var(--fd-font); color: var(--fd-text-muted); }
.c03-coverage__label .fd-icon { color: var(--fd-icon); }
.c03-coverage__value { font: 700 var(--fd-text-figure) var(--fd-font); color: var(--fd-figure); font-variant-numeric: tabular-nums; }
.c03-coverage__sub { font: var(--fd-text-meta) var(--fd-font); color: var(--fd-text-muted); }
.c03-bar { display: block; height: 8px; overflow: hidden; border-radius: var(--fd-radius-pill); background: var(--fd-border-hairline); }
.c03-bar__fill { display: block; width: var(--c03-fill, 0%); height: 100%; border-radius: inherit; background: var(--fd-primary-600); }

/* Situations figure: the count and its sentence on one line. */
.c03-sit-figure { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
/* «Cómo se cuentan»: the counting rule opens on demand in the card foot; the «no diagnóstica» rule stays in the head. */
.c03-how > summary {
  display: inline-flex; align-items: center; gap: 4px; min-height: 28px;
  font: 600 var(--fd-text-meta) var(--fd-font); color: var(--fd-link); list-style: none; cursor: pointer;
}
.c03-how > summary::-webkit-details-marker { display: none; }
.c03-how__chev { color: var(--fd-icon); }
.c03-how[open] .c03-how__chev { transform: rotate(180deg); }
.c03-how > p { margin-top: 4px; }

/* Second row: «Estudiantes por estado» starts on the same line as the academic state and keeps its own height. */
.c03-top { align-self: start; }

/* ---- Students by state (UI_SYSTEM VIS-3, owner 18-10-2026): one content-free child silhouette per student.
   Label and count are text; the silhouettes only repeat the count. One brand ramp from dark to light in
   priority order, red only for overdue, «al día» in the quiet gray: nothing new enters the palette. ---- */
.c03-kids { display: flex; flex-direction: column; gap: 12px; }
.c03-kids__row {
  --c03-kid: var(--fd-primary-600);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px;
}
.c03-kids__label { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font: var(--fd-text-table) var(--fd-font); }
.c03-kids__label .fd-icon { flex: none; color: var(--fd-icon); }
.c03-kids__count { font: 700 var(--fd-text-table) var(--fd-font); font-variant-numeric: tabular-nums; }
.c03-kids__people { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 3px; color: var(--c03-kid); }
.c03-kid { display: block; width: 18px; height: 24px; }
.c03-kids__row--vencido { --c03-kid: var(--fd-overdue-border); }
.c03-kids__row--vencido .c03-kids__label { color: var(--fd-overdue-text); font-weight: 600; }
.c03-kids__row--vencido .c03-kids__label .fd-icon { color: currentColor; }
.c03-kids__row--situacion { --c03-kid: var(--fd-primary-700); }
.c03-kids__row--sin-objetivo { --c03-kid: var(--fd-primary-500); }
.c03-kids__row--sin-entrevista { --c03-kid: var(--fd-primary-300); }
.c03-kids__row--al-dia { --c03-kid: var(--fd-gray-400); }

/* ---- State badges this screen adds (icon + text; vencido comes from styles.css) ---- */
.fd-badge-state[data-state="situacion"] {
  border-color: var(--fd-state-info-border); background: var(--fd-state-info-bg); color: var(--fd-state-info-fg);
}
.fd-badge-state[data-state="al-dia"] {
  border-color: var(--fd-state-success-border); background: var(--fd-state-success-bg); color: var(--fd-state-success-fg);
}

/* ---- Toolbar: «Ordenar» pressed toggles and «Filtrar» chips (aria-pressed), result count ---- */
.c03-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  padding: 10px var(--fd-card-pad); border-bottom: 1px solid var(--fd-border-hairline);
}
.c03-toolbar__group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.c03-toolbar__label { display: inline-flex; align-items: center; gap: 4px; font: 600 var(--fd-text-meta) var(--fd-font); color: var(--fd-text-muted); }
.c03-toolbar__label .fd-icon { color: var(--fd-icon); }
.c03-toggle {
  display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 2px 12px;
  border: 1px solid var(--fd-border-control); border-radius: var(--fd-radius-pill);
  background: var(--fd-surface); color: var(--fd-text); font: 600 var(--fd-text-meta) var(--fd-font); cursor: pointer;
}
.c03-toggle:hover { background: var(--fd-nav-hover-bg); }
.c03-toggle[aria-pressed="true"] { border-color: var(--fd-secondary); background: var(--fd-state-info-bg); color: var(--fd-state-info-fg); }
.c03-toggle__count { font-variant-numeric: tabular-nums; }
.c03-toolbar__count { margin-left: auto; font: var(--fd-text-meta) var(--fd-font); color: var(--fd-text-muted); }

/* ---- Course table: six fixed columns, no sticky header (F14), labelled scroller (F9) ---- */
.c03-table-wrap { container: c03table / inline-size; }
.c03-table { table-layout: fixed; min-width: 720px; }
.c03-col-estudiante  { width: 19%; }
.c03-col-estado      { width: 18%; }
.c03-col-requisitos  { width: 17%; }
.c03-col-entrevistas { width: 13%; }
.c03-col-situaciones { width: 13%; }
.c03-col-academico   { width: 20%; }

.c03-table .fd-badge-state { align-items: flex-start; white-space: normal; }
.c03-table .fd-badge-state .fd-icon { margin-top: 1px; }

.c03-who { display: flex; align-items: flex-start; gap: 8px; }
.c03-who a { padding-top: 3px; }
/* Rows without an expansion in the mockup keep the name in line with Victoria's (button width + gap). */
.c03-who > a:first-child { margin-left: calc(var(--fd-tile) + 8px); }
.c03-expand {
  display: inline-grid; place-items: center; flex: none; width: var(--fd-tile); height: var(--fd-tile); padding: 0;
  border: 1px solid var(--fd-border-control); border-radius: var(--fd-radius-control);
  background: var(--fd-surface); color: var(--fd-icon); cursor: pointer;
}
.c03-expand:hover { background: var(--fd-nav-hover-bg); }
.c03-expand[aria-expanded="true"] .fd-icon { transform: rotate(180deg); }

/* Overdue requirement cell (F22, compact per owner 18-10-2026): same size and surface as its neighbours;
   the bell, the word «Vencido» in the overdue red and the date carry the state. The badge in «Estado
   prioritario» already tints the row. */
.c03-overdue { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--fd-overdue-text); }

/* Academic cell: label and exported value; no colour, no ordering. */
.c03-acad { display: flex; flex-direction: column; gap: 2px; }
.c03-acad > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
.c03-acad dt { font: 400 var(--fd-text-table) var(--fd-font); color: var(--fd-text-muted); }
.c03-acad dd { font-variant-numeric: tabular-nums; }

/* Row expansion: the remaining VIS-3 columns for one student. */
.fd-table.c03-table tr:has(+ .c03-detail:not([hidden])) > * { border-bottom: 0; }
.fd-table.c03-table .c03-detail > td { padding: 4px var(--fd-card-pad) 14px 52px; background: var(--fd-surface-sunken); }
.c03-detail__title { margin-bottom: 6px; font: 600 var(--fd-text-table) var(--fd-font); color: var(--fd-text-muted); }
.c03-detail__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 16px; }
.c03-detail__grid dt { font: var(--fd-text-table) var(--fd-font); color: var(--fd-text-muted); }
.c03-detail__grid dd { font-weight: 600; font-variant-numeric: tabular-nums; }
.c03-detail__note { font-weight: 400; }
.c03-detail__link { display: inline-flex; align-items: center; margin-top: 10px; font: 600 var(--fd-text-table) var(--fd-font); }
.fd-table.c03-table tr[hidden] { display: none; }

/* Card rows when the table container is under 720 px: every cell keeps its column label. */
@container c03table (max-width: 719px) {
  .c03-table { min-width: 0; }
  .c03-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .c03-table, .c03-table tbody, .c03-table tr, .c03-table th, .c03-table td { display: block; width: auto; }
  .fd-table.c03-table tr { padding: 10px var(--fd-card-pad); border-bottom: 1px solid var(--fd-border-hairline); }
  .fd-table.c03-table tbody tr:last-child { border-bottom: 0; }
  .fd-table.c03-table tbody th, .fd-table.c03-table td { padding: 4px 0; border: 0; }
  .fd-table.c03-table tbody th { padding-bottom: 6px; }
  .fd-table.c03-table td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font: 600 var(--fd-text-floor) var(--fd-font); color: var(--fd-text-muted);
  }
  .fd-table.c03-table tr:has(+ .c03-detail:not([hidden])) { padding-bottom: 4px; border-bottom: 0; }
  .fd-table.c03-table tr.c03-detail { padding: 0; background: var(--fd-surface-sunken); }
  .fd-table.c03-table .c03-detail > td { padding: 10px var(--fd-card-pad) 14px; }
  .fd-table.c03-table tr[hidden] { display: none; }
}

/* ---- Course academic block: exported averages in export order, provenance once ---- */
.c03-acad-course { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 16px 24px; }
.c03-acad-course__table {
  flex: 1 1 420px; max-width: 560px; overflow: hidden;
  border: 1px solid var(--fd-border-hairline); border-radius: var(--fd-radius-control);
}
.c03-acad-course__notes { display: flex; flex-direction: column; gap: 8px; flex: 1 1 260px; min-width: 0; }
.c03-acad-course__rule { font-weight: 600; }
.c03-acad-course__notes .fd-empty-line { margin-top: 0; }
/* Sub-subjects (física, química, biología) sit indented under «Ciencias naturales»; the label stays verbatim. */
.fd-table .c03-acad-sub > th { padding-left: calc(var(--fd-card-pad) + 16px); font-weight: 400; }
.c03-acad-course .fd-na { color: var(--fd-text-muted); }

/* ---- Below 1024 px and under a coarse pointer: targets ≥ 44 px (F16, ADVERSARIAL_REVIEW §9.11) ---- */
@media (max-width: 1023px), (pointer: coarse) {
  .c03-toggle, .c03-select, .c03-how > summary { min-height: var(--fd-target); }
  .c03-expand { width: var(--fd-target); height: var(--fd-target); }
  .c03-who > a:first-child { margin-left: calc(var(--fd-target) + 8px); }
  .c03-who a, .c03-detail__link { display: inline-flex; align-items: center; min-height: var(--fd-target); padding-top: 0; }
}

/* ---- Motion: hover and focus only, behind the reduced-motion guard ---- */
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion='reduced']) .c03-toggle,
  :root:not([data-motion='reduced']) .c03-expand {
    transition: background-color var(--fd-motion-fast) var(--fd-ease), color var(--fd-motion-fast) var(--fd-ease),
      border-color var(--fd-motion-fast) var(--fd-ease);
  }
}

/* ---- Forced colours (F23): bars and toggles keep a visible edge; silhouettes follow the text colour ---- */
@media (forced-colors: active) {
  .c03-kids__people { color: CanvasText; }
  .c03-bar { border: 1px solid CanvasText; }
  .c03-bar__fill { forced-color-adjust: none; background: CanvasText; }
  .c03-toggle, .c03-expand, .c03-select { border-color: ButtonText; }
  .c03-toggle[aria-pressed="true"] { border: 2px solid Highlight; }
}

/* ---- Print: the table prints whole ---- */
@media print {
  .c03-toolbar, .c03-expand { display: none; }
  .c03-who > a:first-child { margin-left: 0; }
}
