/* Analytics. The engagement number is the page's one gradient moment.
   Charts are SVG drawn on the server (views/chart.go): x in percent of the
   width, y in pixels, so their text keeps its size at every width. Bars and
   lines take each platform's badge colour; the legend names them. */

/* ---------- summary: three tiles of equal height ---------- */
.an-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.an-tile { display: grid; grid-template-rows: auto auto 1fr; align-content: start; gap: var(--space-2); min-width: 0; padding: var(--space-4) var(--space-5); background: var(--paper-dim); border: 1px solid color-mix(in srgb, var(--ink) 7%, transparent); border-radius: var(--radius-card); }
.an-tile--grad { background: var(--grad-aqua); border-color: transparent; }
.an-tile__label { font-family: var(--mono); font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.06em; }
.an-tile__number { font-family: var(--display); font-size: clamp(2.25rem, 5vw, 3.25rem); font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.an-tile__number--words { font-size: var(--h2); align-self: end; min-height: 1em; }
.an-tile__note { font-size: var(--text-sm); color: var(--ink-soft); }
.an-tile--grad .an-tile__note { color: var(--ink); }
@media (max-width: 40rem) {
  .an-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .an-tile { padding: var(--space-4); }
  .an-tile--grad { grid-column: 1 / -1; }
}

/* ---------- sections ---------- */
.an-section { margin-bottom: var(--space-6); min-width: 0; }
.an-section__head { display: grid; gap: var(--space-1); margin-bottom: var(--space-3); }
.an-panel { display: grid; gap: var(--space-4); align-content: start; }
.an-pair { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: var(--space-5); }
@media (min-width: 64rem) {
  .an-pair--two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  /* Side by side, the two cards are one height, their content at the top. */
  .an-pair--two > .an-section { display: grid; grid-template-rows: auto 1fr; }
}
.an-none p { color: var(--ink-soft); }
.an-none strong { color: var(--ink); }
.an-none .btn { margin-top: var(--space-3); }
.an-inline { display: inline-flex; gap: 0.35rem; align-items: center; vertical-align: middle; }

/* ---------- legends ---------- */
.an-legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); font-size: var(--text-sm); }
.an-legend li { display: inline-flex; align-items: center; gap: var(--space-2); max-width: none; min-width: 0; }
/* One account per row, its numbers lined up in columns. */
.an-legend--lines { display: grid; grid-template-columns: auto auto minmax(0, max-content) auto auto; justify-content: start; gap: var(--space-2); }
.an-legend--lines li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; }
.an-legend__handle { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.an-legend__num { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.an-legend__change { color: var(--ink-soft); white-space: nowrap; }
.an-key { display: inline-block; flex-shrink: 0; width: 1.75rem; height: 0.75rem; overflow: visible; }
.an-key line { stroke-width: 2; stroke-linecap: round; }

/* ---------- charts ---------- */
.an-chart { margin: 0; container-type: inline-size; }
.an-chart__frame { display: grid; grid-template-columns: 3rem minmax(0, 1fr); padding-right: var(--space-4); }
.an-chart--line .an-chart__frame { padding-right: 3rem; }
.an-chart svg { overflow: visible; }
.an-chart__y, .an-chart__plot { height: 13.75rem; }
.an-chart text { font-family: var(--mono); font-size: 0.75rem; fill: var(--ink-soft); }
.an-grid { stroke: var(--rule); stroke-width: 1; shape-rendering: crispEdges; }
.an-grid--base { stroke: var(--rule-strong); }
.an-hit { fill: transparent; }
.an-bar:hover .an-hit { fill: var(--paper-deep); }
/* Bars stay thin on a wide chart: at most 1.75rem, centred in their slot. */
.an-seg { width: min(1.75rem, 64%); x: calc(50% - min(0.875rem, 32%)); }
.an-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.an-line-hit { fill: none; stroke: transparent; stroke-width: 12; vector-effect: non-scaling-stroke; }
.an-mark { stroke: var(--paper-dim); stroke-width: 2; paint-order: stroke; }
.an-chart .an-end { fill: var(--ink); font-weight: 500; }
.an-x--narrow { display: none; }
@container (max-width: 30rem) {
  .an-x--wide { display: none; }
  .an-x--narrow { display: inline; }
}

/* ---------- by platform ---------- */
.an-plats { list-style: none; padding: 0; display: grid; gap: var(--space-4); }
.an-plat { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name num" "bar bar" "meta meta"; gap: var(--space-1) var(--space-3); align-items: center; max-width: none; }
.an-plat__name { grid-area: name; display: flex; gap: var(--space-2); align-items: center; font-weight: 600; min-width: 0; }
.an-plat__num { grid-area: num; font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.an-plat__bar { grid-area: bar; width: 100%; height: 0.5rem; }
.an-track { fill: var(--rule); }
.an-plat__meta { grid-area: meta; font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-soft); }

/* ---------- accounts ---------- */
.an-accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: var(--space-4); }
.an-account { display: grid; gap: var(--space-3); align-content: start; }
.an-account__name { display: flex; gap: var(--space-2); align-items: center; font-size: var(--text-md); margin: 0; min-width: 0; }
.an-account__name .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-account__nums { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: var(--space-4); margin: 0; }
.an-account__nums dt { font-family: var(--mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); }
.an-account__nums dd { margin: 0; font-size: var(--text-lg); }
.an-spark { margin: 0; display: grid; gap: var(--space-1); }
.an-spark svg { width: 100%; height: 2.5rem; overflow: visible; }
.an-spark__base { stroke: var(--rule-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.an-spark__line { fill: none; stroke: var(--teal); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.an-spark figcaption { display: flex; justify-content: space-between; gap: var(--space-2); font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-soft); }
.an-spark__day { color: var(--ink-faint); }
.an-spark__change { color: var(--ink); font-weight: 500; }
.an-quiet { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; margin-top: var(--space-4); max-width: none; }

/* ---------- top posts and every post ---------- */
.an-top { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: var(--space-2) var(--space-3); }
.an-top__item { display: grid; grid-column: 1 / -1; grid-template-columns: 5ch auto minmax(0, 1fr); grid-template-columns: subgrid; align-items: center; max-width: none; }
.an-top__eng { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.an-top__item a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.an-top__where { display: inline-flex; align-items: center; gap: var(--space-2); }
.an-format { margin-left: var(--space-2); white-space: nowrap; }
.an-top__where .an-format { margin-left: 0; }
.an-narrow .an-format { margin-left: 0.35rem; margin-right: 0.35rem; }
.an-foot { margin-top: var(--space-3); }
.an-table .num { text-align: right; white-space: nowrap; }
.an-table td:nth-child(3) { min-width: 14rem; }
.an-table td:first-child { white-space: nowrap; }
/* The account's badge and handle stay on one line, as they do in every row. */
.an-table td.an-wide { white-space: nowrap; }
.an-table td.an-wide .pbadge { margin-right: 0.35rem; vertical-align: middle; }
.an-narrow { display: none; }
@media (max-width: 720px) {
  .an-wide { display: none; }
  .an-narrow { display: inline; margin-right: 0.35rem; }
  th .an-narrow { margin-right: 0; }
  .an-table td:nth-child(3) { min-width: 0; }
  .an-table td:first-child { white-space: normal; }
}
