/* Background figures, step 1c: the chart standard (app/charts.py,
   app/templates/charts/_chart.html). Design: docs/design/achtergrondcijfers-kolom.html
   (the column) and achtergrondcijfers-uitgeklapt.html (the chart page).
   Loaded from step 1e on.

   The time axis runs left to right in every language, also in a right to left
   page: the positions inside the chart are physical, everything else logical. */

.gu-chart {
  container-type: inline-size;
  inline-size: 100%;
  --gu-chart-start: 48px;
  --gu-chart-end: 160px; /* room for "Nederland 125 mln. t" */
  --gu-chart-label: 12px;
  --gu-chart-line: 16px;
}
.gu-chart--small {
  --gu-chart-start: 28px;
  --gu-chart-end: 2px;
  --gu-chart-label: 11px;
  --gu-chart-line: 14px;
}

.gu-chart__figure {
  position: relative;
  margin: 0;
  inline-size: 100%;
  block-size: 340px;
  direction: ltr; /* the time axis runs left to right in every language */
  font-family: var(--gu-font-sans, 'Inter', system-ui, sans-serif);
  font-size: var(--gu-chart-label);
  line-height: var(--gu-chart-line);
  color: #525c69;
  font-variant-numeric: tabular-nums;
}
.gu-chart--small .gu-chart__figure { block-size: 136px; }

.gu-chart__ylabels {
  position: absolute;
  inset-block: 0;
  left: 0; /* physical on purpose: time axis runs left to right in every language */
  inline-size: calc(var(--gu-chart-start) - 6px);
}
.gu-chart__ylabel {
  position: absolute;
  left: 0; /* physical on purpose: time axis runs left to right in every language */
  inline-size: 100%;
  text-align: right; /* physical on purpose: time axis runs left to right in every language */
  white-space: nowrap;
}

.gu-chart__plot {
  position: absolute;
  inset-block: 0;
  left: var(--gu-chart-start); /* physical on purpose: time axis runs left to right in every language */
  right: var(--gu-chart-end); /* physical on purpose: time axis runs left to right in every language */
}
.gu-chart__svg {
  position: absolute;
  inset: 0;
  display: block;
  inline-size: 100%;
  block-size: 100%;
  overflow: visible;
}

.gu-chart__xlabel {
  position: absolute;
  top: 318px;
  white-space: nowrap;
  transform: translateX(-50%);
}
.gu-chart--small .gu-chart__xlabel { top: 120px; }
.gu-chart__xlabel--start { transform: none; }
.gu-chart__xlabel--end { transform: translateX(-100%); }

.gu-chart__endlabel {
  position: absolute;
  left: calc(100% + 12px); /* physical on purpose: time axis runs left to right in every language */
  display: flex;
  gap: 4px;
  max-inline-size: calc(var(--gu-chart-end) - 14px);
  font-weight: 600;
  white-space: nowrap;
  color: var(--c);
}
/* A long name is cut short; the value always shows (the legend has the full name). */
.gu-chart__endname {
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gu-chart__endvalue { flex: none; }

/* Narrow: no end labels, a narrow gutter at the end; the legend shows the
   last value. */
@container (max-width: 559px) {
  .gu-chart--large .gu-chart__plot { right: 10px; } /* physical on purpose: time axis runs left to right in every language */
  .gu-chart__endlabels { display: none; }
}
@supports not (container-type: inline-size) {
  @media (max-width: 600px) {
    .gu-chart--large .gu-chart__plot { right: 10px; } /* physical on purpose: time axis runs left to right in every language */
    .gu-chart__endlabels { display: none; }
  }
}

/* The legend: in the column two columns with the last value; on the chart
   page buttons that switch a series on and off (aria-pressed). */
.gu-chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
}
.gu-chart-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #3a434e;
}
.gu-chart-legend__value {
  margin-inline-start: auto;
  font-weight: 600;
  color: #141b22;
  font-variant-numeric: tabular-nums;
}
.gu-chart-swatch {
  flex: none;
  inline-size: 10px;
  block-size: 3px;
  border-radius: 2px;
  background: var(--c);
}
.gu-chart-swatch--average {
  inline-size: 12px;
  block-size: 0;
  background: none;
  border-block-start: 2px dashed var(--c);
}

.gu-chart-toggles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.gu-chart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-block-size: 36px;
  padding: 0 12px;
  border: 1px solid #c5dcf4;
  border-radius: 999px;
  background: #fff;
  color: #3a434e;
  font: 500 13px/1 var(--gu-font-sans, 'Inter', system-ui, sans-serif);
  cursor: pointer;
}
.gu-chart-toggle .gu-chart-swatch { inline-size: 14px; }
.gu-chart-toggle .gu-chart-swatch--average { inline-size: 16px; }
.gu-chart-toggle__value { font-weight: 600; color: #141b22; font-variant-numeric: tabular-nums; }
.gu-chart-toggle[aria-pressed="false"] {
  background: #f5f7f9;
  border: 1px dashed #d3dae2;
  color: #6c7683;
  text-decoration: line-through;
}

/* The table: the accessible alternative to the chart. */
.gu-chart-table {
  overflow-x: auto;
  border: 1px solid #e4e9ef;
  border-radius: 8px;
}
.gu-chart-table table {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.gu-chart-table caption {
  text-align: start;
  padding: 10px 14px;
  font-size: 12px;
  color: #6c7683;
}
.gu-chart-table thead tr { background: #f5f7f9; }
.gu-chart-table th,
.gu-chart-table td { padding: 8px 14px; }
.gu-chart-table thead th {
  font-weight: 600;
  color: #3a434e;
  text-align: end;
}
.gu-chart-table thead th:first-child,
.gu-chart-table tbody th { text-align: start; }
.gu-chart-table tbody th { font-weight: 500; }
.gu-chart-table tbody tr { border-block-start: 1px solid #eef1f5; }
.gu-chart-table td {
  text-align: end;
  font-variant-numeric: tabular-nums;
}

/* Step 1e: the chart card in the facts column (docs/design/achtergrondcijfers-kolom.html). */
.gu-fact__topline--chart .gu-fact__badges { margin-inline-start: auto; }
.gu-fact__topline--chart .gu-fact__dir--neutraal { background: #ececee; color: #4b4f58; }

/* "AI selection": a real button; the explanation on hover, focus and tap
   (static/js/cockpit.js toggles .is-open; Escape closes). */
.gu-aisel { position: relative; display: inline-flex; }
.gu-aisel__btn {
  display: inline-flex;
  padding: 2px 10px;
  border: 1px solid #c5dcf4;
  border-radius: 999px;
  background: #eaf2fb;
  color: #1b5e9a;
  font: 600 12px/1.4 var(--gu-font-sans, 'Inter', system-ui, sans-serif);
  cursor: help;
}
.gu-aisel__tip {
  position: absolute;
  z-index: 20;
  inset-inline-start: 0;
  top: calc(100% + 6px);
  display: none;
  inline-size: 240px;
  max-inline-size: calc(100vw - 64px);
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 8px;
  background: #141b22;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  text-align: start;
}
.gu-aisel:hover .gu-aisel__tip,
.gu-aisel:focus-within .gu-aisel__tip,
.gu-aisel.is-open .gu-aisel__tip { display: block; }
.gu-aisel.is-closed .gu-aisel__tip { display: none; }

.gu-chartcard { display: flex; flex-direction: column; gap: 8px; }
.gu-chartcard .gu-fact__title { margin: 0; }
.gu-chartcard__sub { margin: 0; font-size: 12px; color: #6c7683; }
.gu-chartcard__src { margin: 2px 0 0; font-size: 12px; color: #6c7683; line-height: 1.45; }
/* Two columns as in the design when they fit (names whole); else one. */
.gu-chartcard .gu-chart-legend { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.gu-chartcard .gu-chart-legend__name { min-inline-size: 0; overflow-wrap: anywhere; }
.gu-fact__topline--chart { inline-size: 100%; }
.gu-chartcard__src a { color: #1b74b8; text-decoration: none; }
.gu-chartcard__src a:hover,
.gu-chartcard__src a:focus-visible { text-decoration: underline; }
.gu-chartcard__more {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-block-size: 32px;
  font-size: 13px;
  font-weight: 500;
  color: #1b74b8;
  text-decoration: none;
}
.gu-chartcard__more:hover,
.gu-chartcard__more:focus-visible { text-decoration: underline; }

/* Step 1f: the chart page (docs/design/achtergrondcijfers-uitgeklapt.html). */
.gu-chartpage {
  box-sizing: border-box;
  max-inline-size: 1280px;
  margin-inline: auto;
  padding: 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.gu-chartpage__crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: #6c7683; }
.gu-chartpage__crumbs a { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: #1b74b8; text-decoration: none; }
.gu-chartpage__grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.gu-chartpage__main,
.gu-chartpage__card {
  background: #fff;
  border: 1px solid #e4e9ef;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 25, 35, .04), 0 6px 20px rgba(15, 25, 35, .05);
}
.gu-chartpage__main { padding: 24px; display: flex; flex-direction: column; gap: 16px; min-inline-size: 0; }
.gu-chartpage__head { display: flex; flex-direction: column; gap: 4px; }
.gu-chartpage__title { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.gu-chartpage__sub { margin: 0; font-size: 14px; color: #6c7683; }
.gu-chartpage__block { display: flex; flex-direction: column; gap: 16px; }
.gu-chartpage__controls { display: flex; flex-direction: column; gap: 12px; }
.gu-chartpage__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gu-chartseg { display: inline-flex; gap: 2px; padding: 3px; background: #eef1f5; border: 1px solid #e4e9ef; border-radius: 9px; }
.gu-chartseg button {
  min-block-size: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #525c69;
  font: 500 13px/1 var(--gu-font-sans, 'Inter', system-ui, sans-serif);
  cursor: pointer;
}
.gu-chartseg button[aria-pressed="true"] { background: #fff; color: #1b74b8; box-shadow: 0 1px 2px rgba(15, 25, 35, .08); }
.gu-chartpage__empty { margin: 0; padding: 40px 16px; text-align: center; color: #6c7683; font-size: 14px; background: #f5f7f9; border-radius: 8px; }
.gu-chartpage__foot { margin: 0; font-size: 12px; color: #6c7683; line-height: 1.5; }
.gu-chartpage__foot a,
.gu-chartpage__facts a,
.gu-chartpage__linked a { color: #1b74b8; text-decoration: none; }
.gu-chartpage__foot a:hover,
.gu-chartpage__facts a:hover,
.gu-chartpage__linked a:hover { text-decoration: underline; }
.gu-chartpage__aside { display: flex; flex-direction: column; gap: 16px; min-inline-size: 0; }
.gu-chartpage__card { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.gu-chartpage__cardtitle { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #1b74b8; }
.gu-chartpage__facts { margin: 0; display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px 12px; font-size: 13px; line-height: 1.45; }
.gu-chartpage__facts dt { color: #6c7683; }
.gu-chartpage__facts dd { margin: 0; overflow-wrap: anywhere; }
.gu-chartpage__why { margin: 0; font-size: 14px; line-height: 1.55; color: #3a434e; }
.gu-chartpage__linked { display: flex; flex-direction: column; gap: 6px; padding-block-start: 8px; border-block-start: 1px solid #eef1f5; }
.gu-chartpage__linkedtitle { margin: 0; font-size: 12px; font-weight: 600; color: #3a434e; }
.gu-chartpage__linked ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 1.45; }
.gu-chartpage__linked a { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gu-chartpage__meta { margin: 0; font-size: 12px; color: #6c7683; }
.gu-chartpage__actions { display: flex; flex-direction: column; gap: 12px; }
.gu-chartpage__link { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.gu-chartpage__link label { font-weight: 500; }
.gu-chartpage__select { max-inline-size: 100%; min-block-size: 40px; padding-block: 6px; padding-inline-start: 10px; border: 1px solid #d3dae2; border-radius: 8px; font: inherit; background-color: #fff; }
.gu-chartpage__link .gu-btn { align-self: flex-start; }
.gu-chartpage__row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .gu-chartpage { padding: 16px; }
  .gu-chartpage__grid { grid-template-columns: minmax(0, 1fr); }
  .gu-chartpage__main { padding: 16px; }
  .gu-chartpage__title { font-size: 21px; }
}
/* A wide table scrolls inside its frame instead of widening the page. */
.gu-chartpage__block,
.gu-chartpage__controls { min-inline-size: 0; }
.gu-chartpage__block .gu-chart-table { max-inline-size: 100%; }
/* .gu-fact (kit.css) aligns its children at the start; the chart page needs
   them to fill the card, or a wide table would widen it. */
.gu-chartpage__main { align-items: stretch; }
/* The flag sits at the end of the top line: its form opens towards the start. */
.gu-fact__topline--chart .gu-report--fact { inset-inline-start: auto; inset-inline-end: 0; }
.gu-chartpage__dd { margin: 0; }
.gu-chartpage__facts .gu-mt__note { margin: 2px 0 0; font-size: 12px; }

/* Step 3c (Eurostat): a flag of the source after a value in the table, and
   the notes on the flags under "About these figures" (the wrapper keeps the
   dt and dd in the grid of the list). */
.gu-chart-flag { font-size: 12px; line-height: 0; margin-inline-start: 1px; color: #6c7683; font-weight: 600; }
.gu-chartpage__notes { display: contents; }
.gu-chartpage__flags { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.gu-chartpage__flags li { display: grid; grid-template-columns: 2.2em minmax(0, 1fr); align-items: baseline; }
.gu-chartpage__flags .gu-chart-flag { font-size: 12px; line-height: inherit; vertical-align: baseline; }
.gu-chartpage__flags .gu-mt { min-width: 0; }
