/* NSOPW Secured Search - site styles layered over USWDS 3. */

:root {
    --site-navy: #162e51;
    --site-gold: #ffbe2e;
    --site-stripe: #eef4fa;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main {
    flex: 1 0 auto;
    padding-bottom: 3rem;
}

.site-header {
    border-bottom: 4px solid var(--site-navy);
}

.site-header .usa-logo__text a {
    color: var(--site-navy);
}

.site-page-heading {
    font-size: 2rem;
    margin: 1.5rem 0 1rem;
}

.site-hero {
    padding-top: 2rem;
}

.site-hero__heading {
    color: var(--site-navy);
    font-size: 2.5rem;
    margin: 0 0 1.5rem;
}

.site-panel {
    background: #f9f9f9;
    border: 1px solid #dfe1e2;
    border-radius: 0.25rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* The two search forms sit side by side and may use the full column width. */
.site-form-wide.usa-form {
    max-width: none;
}

.site-scope-detail {
    margin-left: 2.5rem;
    margin-bottom: 1rem;
}

.site-scope-detail[hidden] {
    display: none;
}

/* Results */
.site-results-heading {
    margin-bottom: 0.25rem;
}

.site-results-actions a + a {
    margin-left: 1.5rem;
}

.site-jurisdiction-list li {
    margin-bottom: 0.25rem;
}

.site-table-controls {
    margin-bottom: 0.5rem;
}

.site-table-controls .usa-select {
    width: 5.5rem;
    height: 2.5rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.site-results-table {
    width: 100%;
}

.site-results-table thead th {
    background: var(--site-navy);
    color: #fff;
    vertical-align: middle;
}

/* USWDS makes only a 2rem icon at the right of a sortable header clickable. Stretch its sort button over the whole header
   cell so clicking the column name sorts too. The leading "html" and the :is() outrank USWDS's own sorted and unsorted
   button rules, which would otherwise shrink the button back to the icon. */
html .usa-table thead th[data-sortable]:is(:not([aria-sort]), [aria-sort]) .usa-table__header__button {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    inset: 0;
    width: 100%;
    height: 100%;
    padding-right: 0.25rem;
    transform: none;
}

/* USWDS colors the visible arrow #1b1b1b and turns a sorted header light blue, both with selectors stronger than a plain
   class; on the navy header that hides the arrows and the white column name. Keep the header dark and the arrows white. */
.usa-table.site-results-table thead th[data-sortable][aria-sort] {
    background: #1a4480;
    color: #fff;
}

.usa-table.site-results-table th[data-sortable]:not([aria-sort]) .usa-table__header__button .usa-icon > g.unsorted,
.usa-table.site-results-table th[data-sortable][aria-sort=ascending] .usa-table__header__button .usa-icon > g.ascending,
.usa-table.site-results-table th[data-sortable][aria-sort=descending] .usa-table__header__button .usa-icon > g.descending {
    fill: #fff;
}

.site-results-table.usa-table--striped tbody tr:nth-child(even) td {
    background: var(--site-stripe);
}

.site-results-table tbody td {
    vertical-align: middle;
}

.site-results-table tbody tr[hidden] {
    display: none;
}

.site-offender a {
    display: inline-block;
    margin-bottom: 0.5rem;
}

.site-thumbnail {
    display: block;
    max-width: 200px;
    max-height: 200px;
    height: auto;
    border: 1px solid #dfe1e2;
}

.site-address + .site-address {
    margin-top: 0.75rem;
}

.site-pagination-arrow {
    background: var(--site-gold);
    color: #1b1b1b;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: 0.25rem;
}

.site-pagination-arrow:hover {
    background: #e5a000;
    color: #1b1b1b;
}

.site-accuracy {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-weight: 700;
    color: #fff;
    background: #d83933;
}

.site-accuracy--high {
    background: #00a91c;
}

.site-accuracy--medium {
    background: #ffbe2e;
    color: #1b1b1b;
}

.site-map {
    width: 100%;
    height: 420px;
    margin-top: 1rem;
    border: 1px solid #dfe1e2;
}

/* Report tables: the page uses the widescreen container and cells may wrap, so the scrollable wrapper only kicks in on narrow screens. */
.site-report-table td {
    white-space: normal;
    vertical-align: top;
}

.site-report-table td,
.site-report-table th {
    min-width: 6rem;
}

/* Data lists used on detail pages */
.site-details dt {
    font-weight: 700;
    margin-top: 0.75rem;
}

.site-details dd {
    margin-left: 0;
}

.site-actions .usa-button,
.site-actions form {
    display: inline-block;
    margin: 0 0.5rem 0.5rem 0;
}

.site-inactive {
    color: #71767a;
}

.site-badge {
    display: inline-block;
    border-radius: 0.25rem;
    padding: 0 0.375rem;
    font-size: 0.8rem;
    color: #fff;
    background: #d83933;
}

.site-badge--info {
    background: #0050d8;
}

/* Dashboard usage: stat tiles and charts drawn in HTML and CSS (no chart library). The accent passes 3:1 on white; the gray
   remainder does not, so split charts always carry a legend and a data table. */
:root {
    --chart-accent: #2a78d6;
    --chart-rest: #c3c2b7;
    --chart-grid: #e1e0d9;
    --chart-baseline: #a9aeb1;
    --chart-ink: #1b1b1b;
    --chart-ink-secondary: #565c65;
}

.site-section-heading {
    color: var(--site-navy);
    font-size: 1.5rem;
    margin: 0 0 0.25rem;
}

/* Two tiles per row below desktop; on desktop the page sets --tiles-per-row so the tiles split into two even rows. */
.site-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    list-style: none;
    margin: 1rem 0 2.5rem;
    padding: 0;
}

.site-stat {
    box-sizing: border-box;
    height: 100%;
    background: #fff;
    border: 1px solid #dfe1e2;
    border-radius: 0.25rem;
    padding: 1rem;
}

.site-stat > * {
    margin: 0;
}

.site-stat__label {
    color: var(--chart-ink-secondary);
    font-size: 0.95rem;
}

.site-stat__value {
    color: var(--chart-ink);
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.2;
    margin-top: 0.25rem;
}

.site-stat__detail {
    color: var(--chart-ink-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.site-chart {
    margin: 0 0 2.5rem;
}

.site-chart figcaption {
    margin-bottom: 0.75rem;
}

.site-chart__title {
    font-size: 1.15rem;
    margin: 0;
}

.site-chart__subtitle,
.site-chart__empty {
    color: var(--chart-ink-secondary);
    font-size: 0.95rem;
    margin: 0.125rem 0 0;
}

.site-chart__legend {
    display: flex;
    gap: 1.25rem;
    color: var(--chart-ink-secondary);
    font-size: 0.9rem;
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
}

.site-chart__legend li {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.site-chart__key {
    width: 0.75rem;
    height: 0.75rem;
    background: var(--chart-accent);
    border-radius: 2px;
}

.site-chart__key--rest {
    background: var(--chart-rest);
}

/* The gutter holds the value-axis labels; the plot and the date axis both start after it so their columns line up. */
.site-chart__frame {
    --gutter: 2.75rem;
}

.site-chart__plot {
    position: relative;
    height: 13rem;
    margin-left: var(--gutter);
    border-bottom: 1px solid var(--chart-baseline);
}

.site-chart__gridline {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid var(--chart-grid);
}

.site-chart__tick {
    position: absolute;
    right: calc(100% + 0.5rem);
    transform: translateY(-50%);
    color: var(--chart-ink-secondary);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.site-chart__columns,
.site-chart__axis {
    display: grid;
    grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
    list-style: none;
    padding: 0;
}

.site-chart__columns {
    position: absolute;
    inset: 0;
    margin: 0;
}

/* The whole slot is the hover target, so a short column is as easy to point at as a tall one. */
.site-chart__slot {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.site-chart__slot:hover {
    background: rgba(27, 27, 27, 0.05);
}

.site-chart__column {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: min(24px, 70%);
    border-radius: 4px 4px 0 0;
    overflow: hidden;
}

.site-chart__segment {
    flex-basis: 0;
    background: var(--chart-accent);
}

.site-chart__segment--rest {
    background: var(--chart-rest);
}

.site-chart__tip {
    display: none;
    position: absolute;
    z-index: 2;
    bottom: calc(100% + 0.375rem);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #dfe1e2;
    border-radius: 0.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    color: var(--chart-ink);
    font-size: 0.85rem;
    line-height: 1.4;
    padding: 0.375rem 0.625rem;
    pointer-events: none;
    white-space: nowrap;
}

.site-chart__slot--start .site-chart__tip {
    left: 0;
    transform: none;
}

.site-chart__slot--end .site-chart__tip {
    left: auto;
    right: 0;
    transform: none;
}

.site-chart__slot:hover .site-chart__tip {
    display: block;
}

.site-chart__axis {
    color: var(--chart-ink-secondary);
    font-size: 0.8rem;
    margin: 0.375rem 0 0 var(--gutter);
}

/* A label wider than its slot spills evenly into the empty slots on either side. */
.site-chart__axis li {
    display: flex;
    justify-content: center;
    white-space: nowrap;
}

.site-chart__data {
    font-size: 0.95rem;
    margin-top: 0.75rem;
}

.site-chart__data summary {
    color: #005ea2;
    cursor: pointer;
}

.site-bars {
    display: grid;
    gap: 0.625rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-bars__row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    align-items: center;
    gap: 0.75rem;
}

.site-bars__name {
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.site-bars__track {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

/* The longest bar leaves room for its value at the tip. */
.site-bars__bar {
    flex: 0 0 auto;
    width: calc((100% - 4rem) * var(--share));
    height: 1.25rem;
    background: var(--chart-accent);
    border-radius: 0 4px 4px 0;
}

.site-bars__value {
    color: var(--chart-ink);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

@media (min-width: 64em) {
    .site-stats {
        grid-template-columns: repeat(var(--tiles-per-row, 4), minmax(0, 1fr));
    }
}

@media (max-width: 39.99em) {
    .site-chart__label--minor {
        visibility: hidden;
    }

    .site-bars__row {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.25rem;
    }
}

/* Print */
.site-print {
    font-size: 11pt;
}

@media print {
    .site-header,
    .site-footer,
    .site-results-actions,
    .site-table-controls,
    .usa-pagination,
    .usa-accordion,
    .site-map,
    .usa-skipnav {
        display: none !important;
    }

    .site-results-table tbody tr[hidden] {
        display: table-row !important;
    }

    .site-results-table,
    .site-results-table td,
    .site-results-table th {
        border: 1pt solid #000;
        border-collapse: collapse;
    }

    .site-results-table thead th {
        background: #fff !important;
        color: #000 !important;
    }

    .site-results-table tr,
    .site-results-table img {
        page-break-inside: avoid;
    }

    a[href]::after {
        content: "";
    }
}

.site-badge--success {
    background: #00a91c;
}
