/* The auction history pages (/history, TW #6259), scoped so they look right in the admin layout (Bootstrap,
   light) and the members' layout (bigger type, a narrow card, light or dark). Which chart size shows follows
   the width of the page's own column (a container query), not the window: the members' card is narrow even
   on a wide screen. Series colours: the dataviz skill's categorical slots 1-3, stepped for dark mode. */
.history {
  --h-fg: #1d1d1b; --h-muted: #6b6a66; --h-line: #e6e2d8; --h-surface: #ffffff; --h-accent: #0b5cad;
  --h-s1: #2a78d6; --h-s2: #eb6834; --h-s3: #1baf7a; --h-lapsed: #a3a29c;
  container: history / inline-size;
  max-width: 900px; color: var(--h-fg);
}
.member-page .history {
  --h-fg: var(--m-fg); --h-muted: var(--m-muted); --h-line: var(--m-line); --h-surface: var(--m-card); --h-accent: var(--m-accent);
}
@media (prefers-color-scheme: dark) {
  .member-page .history { --h-s1: #3987e5; --h-s2: #d95926; --h-s3: #199e70; --h-lapsed: #77766f; }
}

.history h1 { font-size: 1.75rem; margin: 0 0 0.5rem; }
.history h2 { font-size: 1.3rem; margin: 0 0 0.35rem; }
.history h3 { font-size: 1rem; margin: 1rem 0 0.25rem; color: var(--h-muted); font-weight: 600; }
.history p { margin: 0 0 0.6rem; }
.history a { color: var(--h-accent); }
.history__intro, .history__note, .history__notes { color: var(--h-muted); }
.history__notes { font-size: 0.9rem; padding-left: 1.2rem; margin: 0.5rem 0; }
.history__jump, .history__years, .history__pager { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; margin: 0.5rem 0 1rem; }
.history__pager { justify-content: space-between; }
.history__section { margin: 1.75rem 0; padding-top: 1.25rem; border-top: 1px solid var(--h-line); }
.history__back { margin-bottom: 0.25rem; }

/* The charts: one size shows at a time. */
.history-chart { display: block; width: 100%; height: auto; overflow: visible; }
.history-chart--narrow { display: none; }
@container history (max-width: 560px) {
  .history-chart--wide { display: none; }
  .history-chart--narrow { display: block; }
}
.history-chart text { font-family: inherit; }
.history-chart .h-muted { fill: var(--h-muted); }
.history-chart .h-label { fill: var(--h-fg); }
.history-chart .h-grid { stroke: var(--h-line); stroke-width: 1; }
.history-chart .h-axis { stroke: var(--h-muted); stroke-width: 1; }
.history-chart .h-goal { stroke: var(--h-fg); stroke-width: 1.5; stroke-dasharray: 6 4; }
.history-chart .h-divider { stroke: var(--h-muted); stroke-width: 1; stroke-dasharray: 2 3; }
.history-chart .h-hit { fill: transparent; }
.history-chart a:hover .h-hit, .history-chart g:hover > .h-hit { fill: var(--h-line); fill-opacity: 0.45; }
.history-chart a:focus-visible { outline: 2px solid var(--h-accent); }
.history-chart .h-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.history-chart .h-dot { stroke: var(--h-surface); stroke-width: 2; }
.history .h-s1 { fill: var(--h-s1); background: var(--h-s1); }
.history .h-s2 { fill: var(--h-s2); background: var(--h-s2); }
.history .h-s3 { fill: var(--h-s3); background: var(--h-s3); }
.history .h-lapsed { fill: var(--h-lapsed); background: var(--h-lapsed); }
.history-chart .h-s1-line { stroke: var(--h-s1); }
.history-chart .h-s2-line { stroke: var(--h-s2); }

.history-key { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.875rem; color: var(--h-fg); margin: 0.25rem 0; }
.history-key__item { display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; }
.history-key__swatch { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 2px; }
.history-key__goal { display: inline-block; width: 1.2rem; border-top: 2px dashed var(--h-fg); }

/* Tables: under the charts, and the year's names. */
.history table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 0.5rem; }
.history th, .history td { text-align: left; padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--h-line); vertical-align: top; }
.history th { color: var(--h-muted); font-weight: 600; }
.history td:not(:first-child), .history th:not(:first-child) { white-space: nowrap; }
.history .top-items td:nth-child(2), .history .sponsors td:first-child { white-space: normal; }
.history__scroll { overflow-x: auto; }
.history details > summary { cursor: pointer; color: var(--h-accent); margin-top: 0.5rem; }
.history details.givers ul { columns: 2 14rem; padding-left: 1.2rem; margin: 0.4rem 0 0.8rem; }

.history__stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.history__stats div { border: 1px solid var(--h-line); border-radius: 8px; padding: 0.5rem 0.75rem; }
.history__stats dt { font-size: 0.8rem; color: var(--h-muted); font-weight: 600; }
.history__stats dd { margin: 0; font-size: 1.25rem; font-weight: 700; }
