/* Supervision section (teaching page) */

.sup-page {
  --sp-text: #404040;
  --sp-text-strong: #222;
  --sp-muted: #6b6f76;
  --sp-axis: #898781;
  --sp-border: #e3e6ea;
  --sp-grid: #ecebe6;
  --sp-surface: #ffffff;
  --sp-subtle: #f6f7f9;
  --sp-accent: #0085a1;
  /* Levels (validated all-pairs CVD safe on white) */
  --sp-phd: #2a78d6;
  --sp-master: #eb6834;
  --sp-bachelor: #1baf7a;
  --sp-sans: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  margin-top: 0.5rem;
  color: var(--sp-text);
}

.sup-page .sup-needs-js { display: none; }
.sup-page.js-ready figure.sup-needs-js { display: block; }
.sup-page.js-ready .sup-filters.sup-needs-js { display: flex; }

.sup-page p.sup-intro { margin: 0 0 1.25rem; }

/* ---------- Keys ---------- */

.sup-dot {
  display: inline-block;
  flex: none;
  width: 9px;
  height: 9px;
  margin-right: 0.45rem;
  border-radius: 50%;
}
.sup-dot--phd { background: var(--sp-phd); }
.sup-dot--master { background: var(--sp-master); }
.sup-dot--bachelor { background: var(--sp-bachelor); }

.sup-key {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  margin-right: 0.4rem;
  border-radius: 50%;
  box-sizing: border-box;
}
.sup-key--done { background: var(--sp-muted); }
.sup-key--done.sup-key--phd { background: var(--sp-phd); }
.sup-key--done.sup-key--master { background: var(--sp-master); }
.sup-key--done.sup-key--bachelor { background: var(--sp-bachelor); }
.sup-key--ongoing { border: 2px solid var(--sp-muted); background: var(--sp-surface); }

/* ---------- Stat tiles ---------- */

.sup-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.sup-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--sp-border);
  border-radius: 10px;
  background: var(--sp-surface);
}

.sup-stat-value {
  font-family: var(--sp-sans);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--sp-text-strong);
}
.sup-stat--total .sup-stat-value { font-size: 2.1rem; }

.sup-stat-label {
  display: flex;
  align-items: center;
  font-family: var(--sp-sans);
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--sp-muted);
}

/* ---------- Timeline chart ---------- */

.sup-chart {
  position: relative;
  margin: 0 0 1.5rem;
  padding: 1.1rem 1.2rem 0.9rem;
  border: 1px solid var(--sp-border);
  border-radius: 10px;
  background: var(--sp-surface);
}

.sup-chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-bottom: 0.5rem;
}

.sup-chart-title {
  font-family: var(--sp-sans);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--sp-text-strong);
}

.sup-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--sp-sans);
  font-size: 0.8rem;
  color: var(--sp-muted);
}
.sup-legend li { display: flex; align-items: center; }

.sup-chart-plot { width: 100%; }
.sup-chart-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.sup-chart-plot text {
  font-family: var(--sp-sans);
  font-size: 11px;
  fill: var(--sp-axis);
  font-variant-numeric: tabular-nums;
}
.sup-chart-plot text.row-label { font-size: 12px; font-weight: 600; fill: var(--sp-text); }
.sup-chart-plot text.today-label { fill: var(--sp-muted); }
.sup-chart-plot .row-key--phd { fill: var(--sp-phd); }
.sup-chart-plot .row-key--master { fill: var(--sp-master); }
.sup-chart-plot .row-key--bachelor { fill: var(--sp-bachelor); }
.sup-chart-plot .row-line,
.sup-chart-plot .tick-line { stroke: var(--sp-grid); stroke-width: 1; shape-rendering: crispEdges; }
.sup-chart-plot .today-line { stroke: #c3c2b7; stroke-width: 1; shape-rendering: crispEdges; }

.sup-chart-plot .pt { cursor: pointer; outline: none; }
.sup-chart-plot .pt .hit { fill: transparent; }
.sup-chart-plot .pt .mark { stroke: var(--sp-surface); stroke-width: 2; transition: opacity 0.15s; }
.sup-chart-plot .pt--phd .mark { fill: var(--sp-phd); }
.sup-chart-plot .pt--master .mark { fill: var(--sp-master); }
.sup-chart-plot .pt--bachelor .mark { fill: var(--sp-bachelor); }
.sup-chart-plot .pt--ongoing .mark { fill: var(--sp-surface); stroke-width: 2.5; }
.sup-chart-plot .pt--ongoing.pt--phd .mark { stroke: var(--sp-phd); }
.sup-chart-plot .pt--ongoing.pt--master .mark { stroke: var(--sp-master); }
.sup-chart-plot .pt--ongoing.pt--bachelor .mark { stroke: var(--sp-bachelor); }
.sup-chart-plot .pt:focus-visible .hit { stroke: var(--sp-accent); stroke-width: 2; }

.sup-chart-plot.is-hovering .pt:not(.is-hover) .mark,
.sup-chart-plot .pt.is-dimmed .mark { opacity: 0.2; }

.sup-page p.sup-chart-hint {
  margin: 0.4rem 0 0;
  font-family: var(--sp-sans);
  font-size: 0.78rem;
  color: var(--sp-muted);
}

.sup-tooltip {
  position: absolute;
  z-index: 5;
  max-width: 18rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--sp-border);
  border-radius: 8px;
  background: var(--sp-surface);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  font-family: var(--sp-sans);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--sp-text);
  pointer-events: none;
}
.sup-tooltip[hidden] { display: none; }
.sup-tooltip .tt-names { font-weight: 700; color: var(--sp-text-strong); }
.sup-tooltip .tt-meta { margin-top: 0.1rem; color: var(--sp-muted); }
.sup-tooltip .tt-thesis { margin-top: 0.35rem; }

/* ---------- Filters ---------- */

.sup-filters {
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.sup-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--sp-border);
  border-radius: 999px;
  background: var(--sp-surface);
  font-family: var(--sp-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sp-text);
  cursor: pointer;
}
.sup-chip:hover { border-color: #c8ccd2; background: var(--sp-subtle); }
.sup-chip.is-active { border-color: var(--sp-text-strong); background: var(--sp-text-strong); color: #fff; }
.sup-chip.is-active .sup-key--ongoing { border-color: #fff; background: transparent; }
.sup-chip:focus-visible { outline: 2px solid var(--sp-accent); outline-offset: 2px; }
.sup-chip-count { margin-left: 0.35rem; font-weight: 400; color: var(--sp-muted); }
.sup-chip.is-active .sup-chip-count { color: rgba(255, 255, 255, 0.75); }

/* ---------- Thesis cards ---------- */

.sup-level[hidden] { display: none; }

.sup-page h4.sup-level-title {
  display: flex;
  align-items: center;
  margin: 1.5rem 0 0.75rem;
  font-size: 1.1rem;
  color: var(--sp-text-strong);
}

.sup-level-count {
  margin-left: 0.6rem;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--sp-muted);
}

.sup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
}

.sup-card {
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--sp-border);
  border-radius: 10px;
  background: var(--sp-surface);
  scroll-margin-top: 90px;
  transition: box-shadow 0.3s, border-color 0.3s;
}
.sup-card[hidden] { display: none; }
.sup-card.is-flash { border-color: var(--sp-accent); box-shadow: 0 0 0 3px rgba(0, 133, 161, 0.18); }

.sup-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  margin-bottom: 0.4rem;
  font-family: var(--sp-sans);
  font-size: 0.75rem;
}

.sup-badge {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  color: var(--sp-muted);
}
.sup-badge .sup-key { width: 9px; height: 9px; }
.sup-badge--ongoing { padding: 0.05rem 0.55rem 0.05rem 0.45rem; border-radius: 999px; background: #e8f3f6; color: #0b5566; }
.sup-badge--ongoing .sup-key--ongoing { border-color: #0b5566; background: transparent; }

.sup-inst { color: var(--sp-muted); }

.sup-page .sup-card p { margin: 0; }

.sup-page .sup-card p.sup-names {
  font-family: var(--sp-sans);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--sp-text-strong);
}

.sup-page .sup-card p.sup-thesis {
  margin-top: 0.35rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

.sup-page .sup-card p.sup-thesis-es {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  font-style: italic;
  line-height: 1.4;
  color: var(--sp-muted);
}

.sup-page .sup-card p.sup-desc {
  margin-top: 0.35rem;
  font-size: 0.92rem;
  line-height: 1.5;
}

.sup-pubs {
  margin: 0.6rem 0 0;
  padding: 0.55rem 0 0;
  border-top: 1px solid var(--sp-grid);
  list-style: none;
  font-size: 0.85rem;
  line-height: 1.4;
}
.sup-pubs li { position: relative; padding-left: 1.1rem; }
.sup-pubs li + li { margin-top: 0.35rem; }
.sup-pubs li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15rem;
  width: 0.65rem;
  height: 0.8rem;
  border: 1.5px solid var(--sp-axis);
  border-radius: 2px;
}
.sup-pub-venue { color: var(--sp-muted); font-style: italic; }

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  .sup-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sup-chart { padding: 0.9rem 0.8rem 0.75rem; }
  .sup-grid { grid-template-columns: 1fr; }
}
