/* ASBA Directory — front-end styles
 * Scoped under .asba-directory to avoid bleeding into the active theme.
 */

.asba-directory {
    --asba-text: #222;
    --asba-muted: #666;
    --asba-link: #1a73e8;
    --asba-link-hover: #0f4fa8;
    --asba-card-bg: #ececec;
    --asba-card-border: #d4d4d4;
    --asba-input-bg: #fff;
    --asba-input-border: #cfcfcf;
    --asba-letter: #1a73e8;
    --asba-letter-disabled: #c2c2c2;
    --asba-radius: 6px;

    max-width: 1100px;
    margin: 0 auto;
    color: var(--asba-text);
    font-family: inherit;
    line-height: 1.5;
}

.asba-directory__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.asba-directory__heading {
    font-size: clamp(1.6rem, 2.4vw, 2.25rem);
    font-weight: 400;
    color: #3a3a3a;
    margin: 0 0 1.5rem;
    line-height: 1.2;
    padding: 0 1rem;
}

.asba-directory__controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin: 0 0 1rem;
    padding: 0 1rem;
    min-height: 0;
}

.asba-directory__search {
    flex: 1 1 280px;
    max-width: 360px;
    position: relative;
    margin: 0 0 0 auto;
    display: flex;
    align-items: center;
    min-height: 0;
}

.asba-directory__search-input {
    flex: 1 1 auto;
    min-width: 0;
}

.asba-directory__search-input {
    width: 100%;
    padding: 0.55rem 0.85rem;
    background: var(--asba-input-bg);
    border: 1px solid var(--asba-input-border);
    border-radius: var(--asba-radius);
    font-size: 0.95rem;
    color: var(--asba-text);
    line-height: 1.3;
    box-shadow: 0 1px 1px rgba(0,0,0,0.03);
    padding-right: 2.2rem;
}

.asba-directory__search-icon {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    pointer-events: none;
}

.asba-directory__letters {
    text-align: right;
    padding: 0.25rem 1rem 1rem;
    font-size: 0.95rem;
    letter-spacing: 0.06em;
}

.asba-directory__letter {
    display: inline-block;
    color: var(--asba-letter);
    text-decoration: none;
    padding: 0.15rem 0.3rem;
    font-weight: 500;
}

.asba-directory__letter:hover:not(.is-disabled) {
    text-decoration: underline;
}

.asba-directory__letter.is-active {
    color: var(--asba-text);
    text-decoration: underline;
}

.asba-directory__letter.is-disabled {
    color: var(--asba-letter-disabled);
    pointer-events: none;
    cursor: default;
}

.asba-directory__status {
    min-height: 1.25rem;
    padding: 0 1rem 0.5rem;
    color: var(--asba-muted);
    font-size: 0.9rem;
}

.asba-directory__results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.asba-directory__results[aria-busy="true"] {
    opacity: 0.6;
}

/* Card */
.asba-card {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.25rem;
    align-items: stretch;
    background: var(--asba-card-bg);
    border: 1px solid var(--asba-card-border);
    border-radius: var(--asba-radius);
    padding: 1rem;
    position: relative;
}

.asba-card__photo-wrap {
    background: #fff;
    border: 1px solid #d8d8d8;
    border-radius: 4px;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.asba-card__photo {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

.asba-card__photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b5b5b5;
    font-size: 3rem;
    font-weight: 300;
    background: #f6f6f6;
}

.asba-card__body {
    text-align: right;
    padding: 0.25rem 0.25rem 0.25rem 0;
    font-size: 0.95rem;
}

.asba-card__name {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
    color: #1a1a1a;
}

.asba-card__name-link {
    color: inherit;
    text-decoration: none;
}

.asba-card__name-link:hover {
    color: var(--asba-link);
    text-decoration: underline;
}

.asba-card__photo-link {
    display: block;
    width: 100%;
    height: 100%;
}

.asba-card__title {
    color: var(--asba-text);
    margin-bottom: 0.1rem;
}

.asba-card__org {
    color: var(--asba-text);
    margin-bottom: 0.4rem;
}

.asba-card__section-label {
    font-weight: 700;
    margin-top: 0.4rem;
}

.asba-card__line {
    color: var(--asba-text);
    line-height: 1.4;
}

.asba-card__contact {
    margin-top: 0.5rem;
}

.asba-card__contact-row {
    line-height: 1.6;
}

.asba-card__contact-label {
    font-weight: 700;
}

.asba-card a {
    color: var(--asba-link);
    text-decoration: none;
    word-break: break-word;
}

.asba-card a:hover {
    text-decoration: underline;
    color: var(--asba-link-hover);
}

/* Pagination */
.asba-directory__pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 1.5rem;
    padding: 0 1rem;
}

.asba-directory__page-btn {
    min-width: 2.25rem;
    padding: 0.4rem 0.7rem;
    background: #fff;
    border: 1px solid var(--asba-input-border);
    border-radius: var(--asba-radius);
    color: var(--asba-link);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    line-height: 1.2;
}

.asba-directory__page-btn:hover:not(:disabled):not(.is-current) {
    background: #f3f7fd;
    border-color: var(--asba-link);
}

.asba-directory__page-btn.is-current {
    background: var(--asba-link);
    border-color: var(--asba-link);
    color: #fff;
    cursor: default;
}

.asba-directory__page-btn:disabled {
    color: #bbb;
    cursor: not-allowed;
}

.asba-directory__page-ellipsis {
    padding: 0.4rem 0.3rem;
    color: var(--asba-muted);
}

/* Empty state */
.asba-directory__empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--asba-muted);
    background: #fafafa;
    border: 1px dashed #ddd;
    border-radius: var(--asba-radius);
}

/* Responsive */
@media (max-width: 720px) {
    .asba-card {
        grid-template-columns: 1fr;
    }
    .asba-card__photo-wrap {
        max-width: 220px;
        margin: 0 auto;
    }
    .asba-card__body {
        text-align: center;
    }
    .asba-directory__controls {
        display: block;
        padding: 0 1rem;
        margin-bottom: 1rem;
    }
    .asba-directory__search {
        max-width: none;
        margin: 0;
        width: 100%;
    }
    .asba-directory__letters {
        text-align: center;
    }
}

/* ============================================================
 * Detail page
 * Rendered inside the active theme's .entry-content (or
 * equivalent), so we don't need our own page padding or max-width.
 * ========================================================= */

.asba-detail {
    --asba-text: #222;
    --asba-muted: #666;
    --asba-link: #1a73e8;
    --asba-link-hover: #0f4fa8;
    --asba-border: #e2e2e2;
    --asba-radius: 6px;

    color: var(--asba-text);
    font-family: inherit;
    line-height: 1.55;

    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
    box-sizing: border-box;
}

.asba-detail *,
.asba-detail *::before,
.asba-detail *::after {
    box-sizing: border-box;
}

/* When the theme renders the page title outside our content wrapper, it
 * can end up flush-left in a full-width container. Constrain ONLY the
 * page title and main content containers — NOT site-wide containers like
 * .ast-container (which also wraps the header). Scoped to detail pages
 * only via the body class set by the plugin. */
.asba-directory-detail .site-content .ast-container,
.asba-directory-detail .site-main,
.asba-directory-detail .ast-article-single,
.asba-directory-detail .entry-header,
.asba-directory-detail .entry-content,
.asba-directory-detail .entry-title,
.asba-directory-detail .page-title {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

/* If the theme prints its title and our content doubles up, the body's
 * own H1 should not duplicate. We don't render one — but we also defend
 * against any theme that injects an extra. */
.asba-directory-detail .asba-detail h1.entry-title {
    display: none;
}

.asba-detail__backnav {
    margin: 0 0 0.75rem;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1.25rem;
}

.asba-directory-detail .asba-detail__backnav {
    margin-top: 1rem;
}

.asba-detail__back-link {
    display: inline-block;
    color: var(--asba-link);
    text-decoration: none;
    font-size: 0.95rem;
}

.asba-detail__back-link:hover {
    text-decoration: underline;
}

.asba-detail__hero,
.asba-detail__grid,
.asba-detail__col,
.asba-detail__col--side {
    /* Old classes — kept to no-op in case of cached HTML during transition. */
}

.asba-detail__top {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 2rem;
    align-items: flex-start;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--asba-border);
    margin-bottom: 1.5rem;
}

.asba-detail__top-info {
    min-width: 0;
}

.asba-detail__title,
.asba-detail__org,
.asba-detail__dept {
    margin: 0 0 0.2rem;
    color: var(--asba-text);
}

.asba-detail__title {
    font-size: 1.05rem;
    color: var(--asba-muted);
}

.asba-detail__org {
    font-size: 1.15rem;
    font-weight: 600;
}

.asba-detail__dept {
    font-size: 0.95rem;
    color: var(--asba-muted);
}

.asba-detail__photo-wrap {
    width: 220px;
    max-width: 100%;
    background: #fff;
    border: 1px solid var(--asba-border);
    border-radius: var(--asba-radius);
    padding: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    justify-self: end;
}

.asba-detail__photo {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 3px;
}

.asba-detail__section-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 1.25rem 0 0.5rem;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.asba-detail__top-info > :first-child {
    margin-top: 0;
}

.asba-detail__address {
    font-style: normal;
    line-height: 1.6;
    color: var(--asba-text);
    margin-top: 0.75rem;
}

.asba-detail__address div {
    margin-bottom: 0.1rem;
}

.asba-detail__contact {
    list-style: none;
    margin: 0;
    padding: 0;
}

.asba-detail__contact li {
    padding: 0.25rem 0;
    line-height: 1.5;
    border-bottom: 1px solid #f1f1f1;
}

.asba-detail__contact li:last-child {
    border-bottom: none;
}

.asba-detail__contact strong {
    color: var(--asba-text);
}

.asba-detail__contact a {
    color: var(--asba-link);
    text-decoration: none;
    word-break: break-word;
}

.asba-detail__contact a:hover {
    text-decoration: underline;
    color: var(--asba-link-hover);
}

.asba-detail__bottom {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    align-items: flex-start;
}

.asba-detail__bottom-col {
    min-width: 0;
}

.asba-detail__bottom-col > .asba-detail__section-title:first-child {
    margin-top: 0;
}

.asba-detail__bio {
    color: var(--asba-text);
}

.asba-detail__bio p {
    margin: 0 0 1rem;
}

.asba-detail__map {
    border: 1px solid var(--asba-border);
    border-radius: var(--asba-radius);
    overflow: hidden;
    background: #f6f6f6;
}

.asba-detail__map iframe {
    display: block;
    width: 100%;
}

.asba-detail__map-link {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
}

.asba-detail__map-link a {
    color: var(--asba-link);
    text-decoration: none;
}

.asba-detail__map-link a:hover {
    text-decoration: underline;
}

/* If only one column has content in the bottom row, let it fill. */
.asba-detail__bottom > .asba-detail__bottom-col:only-child {
    grid-column: 1 / -1;
}

@media (max-width: 860px) {
    .asba-detail__bottom {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .asba-detail__top {
        grid-template-columns: 1fr;
    }
    .asba-detail__photo-wrap {
        width: 180px;
        justify-self: start;
    }
}
