/* Reports, charts, collection health, reading engagement, visits and rooms. */

/* ---- charts (app/lib/charts.php) ---- */
.lib-chart { margin: 0 0 .5rem; }
.lib-chart__svg { display: block; width: 100%; height: auto; }
.lib-chart__svg--narrow { display: none; }
@media (max-width: 575.98px) { .lib-chart__svg--wide { display: none; } .lib-chart__svg--narrow { display: block; } }
.lib-chart__t { font: 600 11px/1 var(--lib-font, system-ui, sans-serif); fill: var(--lib-muted); }
.lib-chart__v { font: 700 11px/1 var(--lib-font, system-ui, sans-serif); fill: var(--lib-ink-2); }
.lib-chart__grid { stroke: var(--lib-line-2, var(--lib-line)); stroke-width: 1; }
.lib-chart__bar--1, .lib-chart__key--1 { fill: var(--lib-primary); background: var(--lib-primary); }
.lib-chart__bar--2, .lib-chart__key--2 { fill: var(--lib-warn); background: var(--lib-warn); }
.lib-chart__bar { transition: opacity .15s; }
.lib-chart__bar:hover { opacity: .8; }
.lib-chart__line { fill: none; stroke: var(--lib-primary); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.lib-chart__area { fill: var(--lib-primary); fill-opacity: .12; stroke: none; }
.lib-chart__dot { fill: var(--lib-surface); stroke: var(--lib-primary); stroke-width: 2; }
.lib-chart__cell { fill: var(--lib-primary); }
.lib-chart__legend { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; font-size: .8rem; font-weight: 600; color: var(--lib-ink-2); margin-bottom: .35rem; }
.lib-chart__legend span { display: inline-flex; align-items: center; gap: .35rem; }
.lib-chart__key { display: inline-block; width: .75rem; height: .75rem; border-radius: 3px; }
.lib-chart--heat .lib-chart__legend { justify-content: flex-end; margin: .3rem 0 0; }
.lib-chart__ramp { display: inline-block; width: 5rem; height: .6rem; border-radius: 3px; background: linear-gradient(90deg, rgba(var(--lib-primary-rgb), .1), var(--lib-primary)); }

/* a ranked list with bars behind it */
.lib-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; counter-reset: rank; }
.lib-rank li { position: relative; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem .75rem; border-radius: 12px; background: var(--lib-surface-2); overflow: hidden; min-height: 2.6rem; counter-increment: rank; }
.lib-rank__bar { position: absolute; inset: 0 auto 0 0; background: rgba(var(--lib-primary-rgb), .16); border-radius: 12px; }
.lib-rank__label { position: relative; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lib-rank__label::before { content: counter(rank) "."; display: inline-block; min-width: 1.6rem; color: var(--lib-muted); font-weight: 700; font-size: .85rem; }
.lib-rank__label a { color: var(--lib-ink); text-decoration: none; }
.lib-rank__label a:hover { text-decoration: underline; }
.lib-rank__n { position: relative; font-variant-numeric: tabular-nums; }

/* ---- the report page ---- */
.lib-repfilter { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.lib-repfilter label { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--lib-muted); display: block; margin-bottom: .2rem; }
.lib-repfilter .form-control, .lib-repfilter .form-select { min-width: 8.5rem; }
.lib-repfilter__dates { display: flex; gap: .6rem; flex-wrap: wrap; }
.lib-repfilter__dates[hidden] { display: none; }
.lib-reptiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.lib-reptile { background: var(--lib-surface); box-shadow: 0 0 0 1px var(--lib-line); border-radius: 16px; padding: .7rem .9rem; min-width: 0; }
.lib-reptile span { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--lib-muted); }
.lib-reptile strong { display: block; font-family: var(--lib-serif); font-size: 1.55rem; line-height: 1.15; overflow-wrap: anywhere; }
.lib-reptile small { color: var(--lib-muted); font-size: .8rem; }
.lib-repmeta { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; color: var(--lib-muted); font-size: .85rem; margin: .25rem 0 1rem; }
.lib-repnote { color: var(--lib-muted); font-size: .85rem; margin-top: .6rem; }
.lib-reptable { width: 100%; font-size: .92rem; }
.lib-reptable th { font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--lib-muted); white-space: nowrap; }
.lib-reptable td.num, .lib-reptable th.num { text-align: right; font-variant-numeric: tabular-nums; }
.lib-reptable td { vertical-align: top; }
.lib-reptable tfoot td { font-weight: 700; }
.lib-reptable--heat td, .lib-reptable--heat th { padding: .3rem .35rem; }
.lib-segmented { display: inline-flex; flex-wrap: wrap; gap: .2rem; padding: .2rem; background: var(--lib-surface-2); border: 1px solid var(--lib-line); border-radius: 14px; }
.lib-segmented a { padding: .4rem .8rem; border-radius: 10px; font-weight: 600; font-size: .88rem; color: var(--lib-ink-2); text-decoration: none; white-space: nowrap; }
.lib-segmented a.is-active { background: var(--lib-primary); color: var(--lib-on-primary); }
.lib-reportcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .75rem; }
.lib-reportcards .lib-link-card { height: 100%; }
.lib-reportcards .is-locked { opacity: .6; }
.lib-repgroup { margin: 1.5rem 0 .6rem; font-size: 1.15rem; }

/* ---- collection health ---- */
.lib-health { display: grid; grid-template-columns: minmax(12rem, 16rem) 1fr; gap: 1.25rem; align-items: center; }
@media (max-width: 767.98px) { .lib-health { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.lib-health__dial { width: 12rem; height: 12rem; position: relative; }
.lib-health__dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.lib-health__track { fill: none; stroke: var(--lib-line); stroke-width: 12; }
.lib-health__arc { fill: none; stroke: var(--lib-primary); stroke-width: 12; stroke-linecap: round; }
.lib-health__arc.is-warn { stroke: var(--lib-warn); }
.lib-health__arc.is-bad { stroke: var(--lib-danger); }
.lib-health__num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.lib-health__num strong { font-family: var(--lib-serif); font-size: 3rem; line-height: 1; }
.lib-health__num span { font-weight: 700; color: var(--lib-muted); font-size: .85rem; }
.lib-partlist { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; width: 100%; text-align: left; }
.lib-part { display: grid; gap: .2rem; }
.lib-part__head { display: flex; justify-content: space-between; gap: .6rem; font-weight: 700; }
.lib-part__bar { height: .55rem; border-radius: 99px; background: var(--lib-line-2, var(--lib-line)); overflow: hidden; }
.lib-part__bar i { display: block; height: 100%; background: var(--lib-primary); border-radius: 99px; }
.lib-part__bar i.is-warn { background: var(--lib-warn); }
.lib-part__bar i.is-bad { background: var(--lib-danger); }
.lib-part small { color: var(--lib-muted); }
.lib-todo { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.lib-todo li a { display: flex; gap: .7rem; align-items: center; padding: .7rem .9rem; border-radius: 14px; background: var(--lib-surface-2); color: var(--lib-ink); text-decoration: none; box-shadow: 0 0 0 1px var(--lib-line); }
.lib-todo li a:hover { box-shadow: 0 0 0 2px var(--lib-primary); }
.lib-todo .lib-pill { flex: none; }
.lib-todo svg { flex: none; color: var(--lib-muted); margin-left: auto; }

/* ---- weeding ---- */
.lib-weedbar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .7rem .9rem; margin-top: .8rem; background: var(--lib-surface); border-radius: 16px; box-shadow: 0 0 0 1px var(--lib-line), 0 -8px 24px var(--lib-shadow); }
.lib-why { display: flex; flex-wrap: wrap; gap: .25rem; }

/* ---- the yearly report ---- */
.lib-annual { max-width: 60rem; }
.lib-annual__head { margin-bottom: 1.2rem; }
.lib-annual__lines { margin: 0 0 1.2rem; padding-left: 1.1rem; display: grid; gap: .3rem; font-size: 1.02rem; }
.lib-annual section { margin-bottom: 1.25rem; break-inside: avoid; }
.lib-annual h2 { font-size: 1.3rem; margin-bottom: .6rem; }

@media print {
  .lib-chart__svg--narrow { display: none !important; }
  .lib-chart__svg--wide { display: block !important; }
  .lib-chart__bar--1, .lib-chart__key--1 { fill: #1d6b57 !important; background: #1d6b57 !important; }
  .lib-chart__bar--2, .lib-chart__key--2 { fill: #b9791a !important; background: #b9791a !important; }
  .lib-chart__line { stroke: #1d6b57 !important; } .lib-chart__area { fill: #1d6b57 !important; }
  .lib-chart__cell { fill: #1d6b57 !important; }
  .lib-chart__t, .lib-chart__v { fill: #333 !important; }
  .lib-chart__grid { stroke: #ccc !important; }
  .lib-card, .lib-reptile { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
  .lib-rank li { background: #f2f2f2 !important; } .lib-rank__bar { background: #cfe3dc !important; }
  .lib-repfilter, .lib-segmented, .lib-weedbar { display: none !important; }
  .lib-reptable { font-size: .8rem; }
  .lib-annual section { break-inside: avoid; }
}
