/* analytics.html — page layout only (the kit lives in nett.css). the reference "Analytics":
   centred period pills · totals card · three chart cards · funding split. */

.an > * + * { margin-top: 24px; }

/* Period pills, centred above the totals card */
.an-range { display: flex; justify-content: center; }
.an-range .nt-seg { align-self: center; }

/* Totals card: two faint light streaks, as on the reference */
.an-totals { position: relative; overflow: hidden; isolation: isolate; }
.an-totals::before,
.an-totals::after { content: ""; position: absolute; z-index: -1; height: 1px; pointer-events: none; }
.an-totals::before { top: 30px; left: 38%; width: 24%; background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0)); }
.an-totals::after { top: 100px; left: 17%; width: 52%; background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0)); }
@media (max-width: 767px) {
  .an-totals::before { top: 22px; left: 30%; width: 50%; }
  .an-totals::after { display: none; }
}
/* With the page art on the card, the art is the light: the streaks step aside. */
.an-totals.nt-totals--art::before,
.an-totals.nt-totals--art::after { display: none; }
/* Tablets (768–1023): the card is narrow and the second total's lines would reach the art's
   bright glass bars; the art keeps the right third and the figures end before it. */
@media (min-width: 768px) and (max-width: 1023px) { .an-totals.nt-totals--art { --nt-art-max: 34%; --nt-art-room: 36%; } }

/* Three chart cards: 3 across on wide screens, the third full width on tablets */
.an-charts { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) {
  .an-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-charts > :last-child { grid-column: 1 / -1; }
}
@media (min-width: 768px) and (max-width: 1099px) {
  /* The full-width third card reads sideways: figures left, chart right */
  .an-charts > :last-child { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); grid-template-rows: auto auto 1fr; column-gap: 32px; align-items: start; }
  .an-charts > :last-child > .an-bars { grid-column: 2; grid-row: 1 / span 3; margin: 0; --nt-bars-h: 120px; }
}
@media (min-width: 1100px) {
  .an-charts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .an-charts > :last-child { grid-column: auto; }
}
.an-charts .nt-chartcard__label { font-weight: var(--nt-w-regular); }
.an-bars { margin-top: auto; }
/* Until analytics.js draws it, a chart holds its box (plot + padding + axis), so the cards
   and the funding row below paint where they stay. */
.an-bars:empty { min-height: calc(var(--nt-bars-h, 160px) + 61.5px); margin-top: 24px; }
.an-charts .nt-chartcard__sub { margin-bottom: 24px; }
.an-bars[data-an-n="24"] .nt-bars__plot { gap: 4px; }
.an-bars[data-an-n="30"] .nt-bars__plot { gap: 3px; }
@media (max-width: 767px) { .an-bars[data-an-n="30"] .nt-bars__plot, .an-bars[data-an-n="24"] .nt-bars__plot { gap: 2px; } }

/* Funding sources: one full-width card under the charts */
.an-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.an-fund { grid-column: 1 / -1; }
.an-card { display: flex; flex-direction: column; min-width: 0; padding: 24px 28px 28px; border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 24px; background: var(--nt-surface); }
.an-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 24px; }
.an-card__title { font-size: var(--nt-fs-small); line-height: 1.3; color: var(--nt-text); }
.an-card__note { font-size: var(--nt-fs-micro); color: var(--nt-muted); white-space: nowrap; }

/* Funding rows: the reference "Top recipients" row (mark · name + thin bar · amount) */
.an-frows { display: flex; flex: 1 0 auto; flex-direction: column; justify-content: center; margin-top: 8px; }
.an-frow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 20px 0; }
.an-frow + .an-frow { border-top: 1px solid rgba(255, 255, 255, 0.05); }
.an-frow:last-child { padding-bottom: 4px; }
.an-frow__coin { --s: 40px; --nt-coin-ring: var(--nt-surface); }
.an-frow__main { min-width: 0; }
.an-frow__name { font-size: var(--nt-fs-small); line-height: 1.35; color: var(--nt-muted); }
.an-frow__name b { color: var(--nt-text-strong); font-weight: var(--nt-w-bold); }
.an-frow__end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.an-frow__amt { font-size: 16px; line-height: 1.25; font-weight: var(--nt-w-medium); color: var(--nt-text-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-frow__pct { font-size: var(--nt-fs-micro); color: var(--nt-muted); font-variant-numeric: tabular-nums; }

/* Thin share bar */
.an-meter { display: block; height: 4px; margin-top: 10px; overflow: hidden; border-radius: var(--nt-r-pill); background: rgba(255, 255, 255, 0.07); }
.an-meter > span { display: block; width: calc(var(--an-v, 0) * 100%); height: 100%; border-radius: inherit; background: rgba(255, 255, 255, 0.4); }

@media (max-width: 767px) {
  .an > * + * { margin-top: 16px; }
  .an-range + * { margin-top: 20px; }
  .an-card { padding: 20px; border-radius: var(--nt-r-card); }
  .an-charts .nt-chartcard__sub { margin-bottom: 0; }
  .an-bars { --nt-bars-h: 120px; }
  /* Funding row on phones: name across the card, amount + share under it, bar below */
  .an-frow { grid-template-areas: "coin name name" "coin amt pct" ". bar bar"; gap: 2px 12px; padding: 16px 0; }
  .an-frow__coin { --s: 32px; grid-area: coin; }
  .an-frow__main, .an-frow__end { display: contents; }
  .an-frow__name { grid-area: name; }
  .an-frow__name span { display: block; }
  .an-frow__amt { grid-area: amt; font-size: 15px; }
  .an-frow__pct { grid-area: pct; align-self: center; }
  .an-frow .an-meter { grid-area: bar; margin-top: 8px; }
}

/* Motion: bars rise and share bars slide when the period changes. Still under reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .an-bars .nt-bars__bar { transform-origin: 50% 100%; animation: an-grow 560ms var(--nt-ease-out) both; }
  .an-meter > span { transition: width 700ms var(--nt-ease-out); }
}
@keyframes an-grow { from { transform: scaleY(0.02); } to { transform: none; } }

/* ---- Real mode (analytics.js) ----------------------------------------------------------- */
/* "Demo data" chip, top right of the totals card (demo mode only; nett.data fills it). */
.an-demochip { position: absolute; top: 16px; right: 16px; z-index: 2; }
/* USDC on Solana is not live yet: its row keeps the name and bar, with "Soon" for the figures. */
.an-soon { align-self: flex-end; }
@media (max-width: 767px) { .an-soon { grid-area: amt; justify-self: start; } }
/* Figures unavailable (network upgrade): the Signal dot and a bold line in the sub-line. */
.an-dot { display: inline-block; margin-right: 8px; vertical-align: 1px; }
.nt-total__sub b { font-weight: var(--nt-w-bold); color: var(--nt-text-strong); }
