/* The statistics' charts and figures (templates/blog/_stats.twig), in the
   management and on a blog's public page. They take the colours of where they
   are: the blog's own (--blog-*) or the management's (--bm-*). */
.st-chart, .st-figs, .st-list {
  --st-main: var(--blog-strong, var(--bm-blue, #3f63ad));
  --st-soft: color-mix(in srgb, var(--st-main) 28%, var(--blog-card, #fff));
  --st-track: color-mix(in srgb, var(--blog-muted, var(--bm-muted, #5b6472)) 16%, var(--blog-card, #fff));
  --st-line: var(--blog-line, var(--bm-line, #e3e7ee));
  --st-muted: var(--blog-muted, var(--bm-muted, #5b6472));
}
.st-chart { margin: 0 0 18px; min-width: 0; }
.st-chart:last-child { margin-bottom: 0; }
.st-chart__title { font: 700 20px/1.3 var(--blog-title-font, Georgia, serif); margin: 0 0 6px; }
h3.st-sub { font: 700 18px/1.3 var(--blog-title-font, Georgia, serif); margin: 20px 0 6px; }
.st-empty { color: var(--st-muted); }

/* The legend: a small square in each colour. */
.st-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 10px; color: var(--st-muted); font-size: 15px; }
.st-key { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; }
.st-legend .st-key:not(:first-child) { margin-left: 8px; }
.st-key--pv { background: var(--st-soft); }
.st-key--v { background: var(--st-main); }

/* Columns: one per day, month or hour; they shrink with the screen, never scroll. */
.st-cols { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; align-items: end;
  height: 180px; padding-top: 22px; border-bottom: 2px solid var(--st-line);
  background: linear-gradient(var(--st-line), var(--st-line)) 0 22px / 100% 1px no-repeat; }
.st-cols__max { position: absolute; top: 0; left: 0; font-size: 13px; color: var(--st-muted); line-height: 20px; }
.st-col { position: relative; height: 100%; min-width: 0; }
.st-col:hover { background: color-mix(in srgb, var(--st-main) 8%, transparent); }
.st-col span { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 3px 3px 0 0; }
.st-col__pv { background: var(--st-soft); }
.st-col__v { background: var(--st-main); left: 18%; right: 18%; }
.st-ticks { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; font-size: 13px; color: var(--st-muted); line-height: 1.3; margin-top: 4px; }
.st-ticks span { white-space: nowrap; overflow: visible; text-align: left; }
.st-ticks span:empty { visibility: hidden; }
/* The last label ("vandaag", "23u") grows to the left, so it never sticks out of the card. */
.st-ticks span:last-child { direction: rtl; }

/* The numbers under a chart, for whoever wants them exactly (or cannot see the chart). */
.st-numbers { margin-top: 10px; }
.st-numbers summary { cursor: pointer; color: var(--blog-link, var(--bm-blue, #3f63ad)); padding: 6px 0; }
.st-numbers table { width: 100%; border-collapse: collapse; font-size: 15px; margin-top: 6px; }
.st-numbers th, .st-numbers td { padding: 5px 6px; border-bottom: 1px solid var(--st-line); text-align: right; font-variant-numeric: tabular-nums; }
.st-numbers th[scope="row"], .st-numbers thead th:first-child { text-align: left; font-weight: 400; }
.st-numbers tfoot th, .st-numbers tfoot td { font-weight: 700; border-bottom: 0; }

/* Bars: a label, a number and a bar under them. */
.st-bars { list-style: none; margin: 0; padding: 0; }
.st-bars li { margin: 0 0 12px; }
.st-bars__label { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.st-bars__label span:last-child { font-variant-numeric: tabular-nums; }
.st-bars__label small { color: var(--st-muted); }
.st-bars__bar { height: 12px; background: var(--st-track); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.st-bars__bar span { display: block; height: 100%; min-width: 2px; background: var(--st-main); border-radius: 999px; }

/* The figures for today, yesterday, this week and this month. */
.st-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; }
.st-fig { border: 1px solid var(--st-line); border-radius: 12px; padding: 12px 14px; background: var(--blog-card, #fff); }
.st-fig b { display: block; font: 700 28px/1.1 var(--blog-title-font, Georgia, serif); }
.st-fig span { display: block; font-size: 15px; }
.st-fig small { display: block; color: var(--st-muted); font-size: 14px; }

/* A list of figures: what on the left, the number on the right; under each other on a phone. */
.st-list { margin: 0; }
.st-list > div { display: flex; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--st-line); }
.st-list > div:last-child { border-bottom: 0; }
.st-list dt small { color: var(--st-muted); }
.st-list dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* On a blog whose layout sets its posts in a grid (album), the statistics take the whole width. */
.st-page { grid-column: 1 / -1; min-width: 0; }

/* The management's choice of period, and its note. */
.st-period { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 14px; }
.st-period a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--bm-line, #e3e7ee); background: #fff; text-decoration: none; color: inherit; }
.st-period a[aria-current="page"] { border-color: var(--bm-blue, #3f63ad); box-shadow: inset 0 0 0 1px var(--bm-blue, #3f63ad); font-weight: 600; }
.st-note ul { margin: 0 0 10px; padding-left: 22px; }

@media (max-width: 900px) {
  .st-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .st-fig { padding: 10px 12px; }
  .st-fig b { font-size: 24px; }
}
@media (max-width: 480px) {
  .st-cols { height: 150px; gap: 1px; }
  .st-ticks { gap: 1px; font-size: 12px; }
  /* Thirteen month names do not fit side by side: every other one, this month included. */
  .st-ticks--maand span:nth-child(even) { visibility: hidden; }
  .st-list dd { text-align: left; }
}

/* The old counter's figures, folded away under the renewed ones. */
.st-old summary { cursor: pointer; }
.st-old summary h2 { display: inline; font-size: 20px; }

/* The charts drawn by stats.js: a line or columns over time, a pie beside its list. Without the script the plain
   columns stay and the boxes for the charts take no room. */
.st-draw { display: none; }
.st-js .st-draw { display: block; position: relative; height: 240px; margin: 0 0 6px; }
.st-js .st-plain { display: none; }
.st-js .st-draw--pie { height: auto; max-width: 240px; width: 100%; margin: 0 auto; }
.st-share--pie { display: grid; gap: 16px 28px; align-items: start; }
.st-more > summary { cursor: pointer; color: var(--blog-link, var(--bm-blue, #3f63ad)); padding: 6px 0 10px; }
@media (min-width: 700px) { .st-js .st-share--pie { grid-template-columns: 240px minmax(0, 1fr); } }
/* The list is the pie's legend: a dot in each part's colour (stats.js sets it). */
.st-dot { display: none; }
.st-js .st-share--pie .st-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; vertical-align: -1px; background: var(--st-track); }
.st-hint { color: var(--st-muted, #5b6472); font-size: 15px; }

/* The row of views on the public page (the management has its own, .bm-tabs). */
.st-tabs:not(.bm-tabs) { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.st-tabs:not(.bm-tabs) a { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--blog-line, #e3e7ee); background: var(--blog-card, #fff); color: var(--blog-ink, inherit); text-decoration: none; font-weight: 600; }
.st-tabs:not(.bm-tabs) a[aria-current="page"] { background: var(--blog-strong, #3f63ad); border-color: var(--blog-strong, #3f63ad); color: var(--blog-accent-ink, #fff); }
.st-page .st-period a { background: var(--blog-card, #fff); }

/* The management's downloads: one button, the four kinds under it. */
.st-export { position: relative; }
.st-export > summary { list-style: none; cursor: pointer; }
.st-export > summary::-webkit-details-marker { display: none; }
.st-export ul { position: absolute; right: 0; z-index: 5; margin: 6px 0 0; padding: 8px 0; list-style: none; min-width: 300px; background: #fff; border: 1px solid var(--bm-line, #e3e7ee); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
.st-export li a { display: block; padding: 9px 16px; color: inherit; text-decoration: none; }
.st-export li a:hover { background: #f2f5fa; }
