/* ============================================================
   BARAEM GRADEFLOW — DRILL-DOWN

   The page a chart click opens. It has to answer "what exactly am I looking at?"
   before it answers anything else, so the context block and the breadcrumbs sit
   above the figures and stay put while the numbers change.

   Same system as everything else: deep green, slate neutrals, hairline rules,
   generous whitespace, state colour only where it means something.
   ============================================================ */

.dd-page { padding-block-end: var(--s-8); }

/* ------------------------------------------------------------
   HEAD + BREADCRUMBS
   ------------------------------------------------------------ */
.dd-head { margin-block-end: var(--s-5); }

.dd-crumbs {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: var(--s-1) var(--s-2);
  margin-block: var(--s-3) var(--s-4);
  font-size: var(--t-13);
}
.dd-crumb {
  border: 0; background: none; padding: 2px 4px; margin: 0;
  font: inherit; color: var(--accent-700);
  border-radius: var(--r-xs);
  cursor: pointer;
}
.dd-crumb:hover { background: var(--accent-50); text-decoration: underline; text-underline-offset: 3px; }
.dd-crumb.is-current {
  color: var(--text); font-weight: 650; cursor: default;
  background: none; text-decoration: none;
}
.dd-sep { color: var(--text-mute); opacity: .55; }

/* ------------------------------------------------------------
   CONTEXT — the active filter set, stated plainly
   ------------------------------------------------------------ */
.dd-context {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.dd-ctx {
  background: var(--surface);
  padding: var(--s-3) var(--s-4);
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
}
.dd-ctx-k {
  font-size: var(--t-10); font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint);
}
.dd-ctx-v {
  font-size: var(--t-14); font-weight: 650; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* privacy mode says so in the context block, not only in the corner */
.dd-ctx-anon { background: var(--accent-50); }
.dd-ctx-anon .dd-ctx-v { color: var(--accent-700); font-size: var(--t-13); }

/* ------------------------------------------------------------
   FIGURES
   ------------------------------------------------------------ */
.dd-page .kpis { margin-block: var(--s-5) var(--s-5); }

.dd-h3 {
  margin: 0 0 var(--s-3);
  font-size: var(--t-11); font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint);
}

.dd-cols {
  display: grid; gap: var(--s-5);
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  align-items: start;
}
.dd-side { display: grid; gap: var(--s-5); }
.ac-body-pad { margin-block-start: var(--s-5); }

/* ------------------------------------------------------------
   IDENTITY BLOCK — a pupil or an assessment, named
   ------------------------------------------------------------ */
.dd-ident {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--accent);
  border-radius: var(--r-lg);
  margin-block-end: var(--s-5);
}
.dd-ident-m {
  width: 42px; height: 42px; flex: 0 0 42px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-100); color: var(--accent-700);
  font-size: var(--t-18); font-weight: 700;
}
.dd-ident-m-a { border-radius: var(--r-md); background: var(--surface-2); }
.dd-ident-n {
  margin: 0 0 2px;
  font-size: var(--t-19); font-weight: 700; color: var(--text);
}
.dd-ident-s {
  margin: 0;
  font-size: var(--t-12); color: var(--text-faint);
  line-height: var(--lh-body);
}

/* ------------------------------------------------------------
   DISTRIBUTION — the school's own A+..E bands
   ------------------------------------------------------------ */
.dd-dist { }
.dd-dist-r {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 40px;
  align-items: center; gap: var(--s-3);
  padding-block: 3px;
}
.dd-dist-b {
  font-size: var(--t-12); font-weight: 700; color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.dd-dist-t {
  height: 8px; border-radius: var(--r-pill);
  background: var(--surface-sunk); overflow: hidden;
}
.dd-dist-t > i {
  display: block; height: 100%; border-radius: inherit;
  background: var(--accent);
  transition: width var(--t-slow) var(--ease-out);
}
/* the band colour, matching the chart palette, applied to the bar only */
.dd-dist-r .dd-band-Ap .dd-dist-t > i { background: var(--ch-a1, var(--accent)); }
.dd-dist-r .dd-band-A  .dd-dist-t > i { background: var(--ch-a2, var(--accent)); }
.dd-dist-r .dd-band-B  .dd-dist-t > i { background: var(--ch-a3, var(--accent)); }
.dd-dist-r .dd-band-C  .dd-dist-t > i { background: var(--ch-a4, var(--accent)); }
.dd-dist-r .dd-band-D  .dd-dist-t > i { background: var(--warn-600); }
.dd-dist-r .dd-band-E  .dd-dist-t > i { background: var(--bad-600); }
.dd-dist-n {
  font-size: var(--t-12); color: var(--text-soft); text-align: end;
}

/* ------------------------------------------------------------
   LINKS
   ------------------------------------------------------------ */
.dd-links { display: grid; gap: var(--s-1); }
.dd-link {
  display: flex; align-items: baseline; gap: var(--s-2);
  width: 100%; text-align: start;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  background: var(--surface);
  font: inherit; cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.dd-link:hover { border-color: var(--accent-500); background: var(--accent-50); }
.dd-link-t { font-size: var(--t-13); font-weight: 600; color: var(--text); }
.dd-link-s { font-size: var(--t-11); color: var(--text-mute); margin-inline-start: auto; }

/* ------------------------------------------------------------
   TABLE ROWS THAT OPEN SOMETHING
   ------------------------------------------------------------ */
.scroller tbody tr.dd-row { cursor: pointer; }
.scroller tbody tr.dd-row:hover td { background: var(--accent-50); }
.scroller tbody tr.dd-row:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.dd-go {
  font-size: var(--t-11); font-weight: 650;
  color: var(--accent-700); white-space: nowrap;
}
.dd-row:hover .dd-go { text-decoration: underline; text-underline-offset: 2px; }

/* ------------------------------------------------------------
   INTERACTIVE CHART TARGETS
   A pointer, a faint lift on hover, and a visible focus ring. Nothing more —
   a chart that pulses or animates on hover reads as decoration.
   ------------------------------------------------------------ */
.ch-hit { cursor: pointer; }
.ch-hit:hover,
.ch-hit.is-hover { filter: brightness(1.12); }
.ch-hit.is-focus,
.ch-hit:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
svg [data-pick] { transition: filter var(--t-fast) var(--ease); }
svg [data-pick]:hover { filter: brightness(1.14); }
svg [data-pick]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the one-line prompt that says a chart opens something */
.an-hint {
  margin-inline-start: auto;
  font-size: var(--t-11);
  color: var(--text-faint);
  white-space: nowrap;
  padding-inline-start: var(--s-3);
  position: relative;
}
.an-hint::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  margin-inline-end: 6px;
  vertical-align: middle;
}

/* ------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------ */
@media (max-width: 1100px) {
  .dd-cols { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .dd-crumbs { font-size: var(--t-12); }
  .dd-ctx { padding: var(--s-2) var(--s-3); }
  .dd-ctx-v { font-size: var(--t-13); }
  .dd-ident { padding: var(--s-3) var(--s-4); gap: var(--s-3); }
  .dd-ident-m { width: 36px; height: 36px; flex: 0 0 36px; font-size: var(--t-15); }
  .dd-ident-n { font-size: var(--t-16); }
  .dd-link-s { display: none; }
  .an-hint { display: none; }
}

@media print {
  .dd-crumbs .dd-crumb:not(.is-current) { color: var(--text); }
  .scroller tbody tr.dd-row { cursor: default; }
  .dd-go { display: none; }
}