/**
 * People Search styles.
 * Ported/adapted from the Drupal people-search-base.css.
 */

.people-search {
    padding: 20px 0;
}

.people-search__intro p {
    line-height: 1.6;
    margin: 0 0 1em 0;
}

.people-search__status {
    background: #fff8e1;
    border-left: 4px solid #f0ad4e;
    padding: 12px 16px;
    margin: 0 0 20px 0;
}

/* ---- Form ---- */
.people-search__form {
    max-width: 480px;
    margin: 20px 0;
}

.people-search__field {
    margin: 0 0 16px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.people-search__field label {
    font-weight: 600;
}

.people-search__field input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.people-search__help {
    font-size: 0.875em;
    color: #555;
    margin: 0 0 16px 0;
}

.people-search__actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.people-search__reset {
    background: #6c757d;
}

/* ---- Tables ---- */
/* Scroll wrapper: table sizes to its natural content width and the wrapper
   scrolls horizontally once that exceeds the available space — the same
   behavior as TablePress's "scroll" responsive mode. */
.people-search__table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 16px 0;
}

.people-search__table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

/* Cells wrap so the table fits the container instead of forcing the
   wrapper to scroll horizontally. */
.people-search__table th,
.people-search__table td {
    white-space: normal;
    word-break: break-word;
}

.people-search__table caption {
    text-align: left;
    font-weight: 600;
    padding: 8px 0;
}

.people-search__table th,
.people-search__table td {
    text-align: left;
    padding: 10px 12px;
    vertical-align: top;
}

/* Responsive per-cell labels (hidden on desktop, shown on mobile) */
.people-search__table .col-header {
    display: none;
    font-weight: 600;
    margin-right: 6px;
}

/* ---- Mobile accordion cards ---- */
.people-search__cards {
    display: none;
    margin: 16px 0;
}

.people-search__cards-head {
    display: flex;
    justify-content: space-between;
    background: #8fb0cb;
    color: #1f2d3d;
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 700;
}

.people-search__cards-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.people-search__card {
    border-bottom: 1px solid #dfe6ec;
    background: #fff;
}

.people-search__card:nth-child(even) {
    background: #eef5fb;
}

.people-search__card summary {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 10px 16px;
    cursor: pointer;
    list-style: none;
}

.people-search__card summary::-webkit-details-marker {
    display: none;
}

.people-search__card summary:focus-visible {
    outline: 2px solid #1f4e79;
    outline-offset: -2px;
}

.people-search__card-chevron {
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid #2b5f8e;
    transition: transform 0.2s;
}

.people-search__card details[open] .people-search__card-chevron {
    transform: rotate(90deg);
}

.people-search__card-name {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.people-search__card-status {
    font-size: 13px;
    color: #4a5a6a;
    white-space: nowrap;
}

.people-search__card-details {
    margin: 0;
    padding: 0 16px 14px 46px;
    font-size: 15px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 16px;
}

.people-search__card-details dt {
    color: #5a6b7c;
}

.people-search__card-details dd {
    margin: 0;
}

/* Sentence table, desktop-but-not-wide: natural column sizing, no mid-word
   breaks in headings, and a slightly smaller heading so six columns fit. The
   scroll wrapper catches anything that still doesn't. */
@media (min-width: 783px) {
    .people-search__sentences .people-search__table th {
        word-break: normal;
        overflow-wrap: normal;
        hyphens: none;
        font-size: 1rem;
    }
}

/* Sentence table column widths (wide screens): Case No. and Status get room so
   they stop wrapping; the two date columns are trimmed to pay for it. */
@media (min-width: 1200px) {
    .people-search__sentences .people-search__table {
        table-layout: fixed;
    }

    .people-search__sentences .people-search__table th:nth-child(1) { width: 22%; }
    .people-search__sentences .people-search__table th:nth-child(2) { width: 14%; }
    .people-search__sentences .people-search__table th:nth-child(3) { width: 14%; }
    .people-search__sentences .people-search__table th:nth-child(4) { width: 16%; }
    .people-search__sentences .people-search__table th:nth-child(5) { width: 16%; }
    .people-search__sentences .people-search__table th:nth-child(6) { width: 18%; }
}

@media (max-width: 782px) {
    /* Search results: cards replace the table on mobile. Scoped so the
       details-page sentence table stays visible. */
    .people-search--results .people-search__table-scroll {
        display: none;
    }

    .people-search__cards {
        display: block;
    }

    /* Sentence table: stack each case as a labeled block instead of
       squeezing six columns into a phone-width screen. */
    .people-search__sentences .people-search__table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .people-search__sentences .people-search__table,
    .people-search__sentences .people-search__table tbody,
    .people-search__sentences .people-search__table tr,
    .people-search__sentences .people-search__table td {
        display: block;
        width: 100%;
    }

    .people-search__sentences .people-search__table tr {
        border: 1px solid #ccd5df;
        margin-bottom: 16px;
    }

    .people-search__sentences .people-search__table td {
        padding: 8px 12px;
        border-bottom: 1px solid #e3e8ee;
    }

    .people-search__sentences .people-search__table td:last-child {
        border-bottom: none;
    }

    .people-search__sentences .people-search__table .col-header {
        display: block;
        margin: 0 0 2px;
        color: #5a6b7c;
        font-size: 0.85em;
    }
}

.people-search__footnote {
    font-size: 0.85em;
    color: #555;
    line-height: 1.5;
    margin: 12px 0;
}

.people-search__back {
    margin: 8px 0 16px 0;
}

/* ---- Detail boxes ---- */
.people-search__identity,
.people-search__location {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 16px 20px;
    margin: 0 0 20px 0;
}

.people-search__identity p,
.people-search__location p {
    margin: 0 0 8px 0;
}

.people-search__name {
    margin: 0 0 8px 0;
}

.people-search__note-row td,
.people-search__tip-row td {
    font-size: 0.875em;
}

/* ---- Pagination ---- */
.people-search__pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 16px 0;
}

.people-search__pagination a,
.people-search__pagination .is-current {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
}

.people-search__pagination .is-current {
    background: #0b5394;
    color: #fff;
    border-color: #0b5394;
}
