/* Compact specialty discovery rail on the public home page. */
.specialties-compact-section {
    position: relative;
    z-index: 3;
    padding: 28px 0 34px;
    border-bottom: 1px solid #dbe8ed;
    background: linear-gradient(180deg, #f8fcfd 0%, #eef8fa 100%);
}

.specialties-compact-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.specialties-compact-title {
    margin: 0 0 5px;
    color: var(--home-ink, #102a43);
    font-size: clamp(23px, 2.1vw, 32px);
    line-height: 1.25;
}

.specialties-compact-subtitle {
    margin: 0;
    color: var(--home-muted, #627d98);
    font-size: 13px;
}

.specialties-all-button {
    min-height: 42px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 15px;
    border: 1px solid rgba(8, 127, 140, .3);
    border-radius: 12px;
    background: #fff;
    color: var(--home-primary, #087f8c);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.specialties-all-button:hover {
    transform: translateY(-1px);
    border-color: var(--home-primary, #087f8c);
    box-shadow: 0 9px 22px rgba(16, 42, 67, .08);
}

.specialties-grid-icon {
    width: 17px;
    height: 17px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
}

.specialties-grid-icon::before,
.specialties-grid-icon::after {
    content: "";
    border: 2px solid currentColor;
    border-radius: 3px;
    box-shadow: 7px 0 0 -2px #fff, 7px 0 0 0 currentColor;
}

.specialties-rail-shell {
    position: relative;
    padding-inline: 42px;
}

.specialties-rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 1fr);
    grid-template-rows: 1fr;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    overscroll-behavior-inline: contain;
    padding: 3px 2px 8px;
}

.specialties-rail::-webkit-scrollbar {
    display: none;
}

.specialty-compact-card {
    min-width: 0;
    min-height: 112px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 13px 10px;
    border: 1px solid #dce9ed;
    border-radius: 16px;
    background: #fff;
    color: inherit;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 7px 20px rgba(16, 42, 67, .055);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.specialty-compact-card:hover {
    transform: translateY(-3px);
    border-color: rgba(8, 127, 140, .38);
    box-shadow: 0 14px 28px rgba(16, 42, 67, .1);
}

.specialty-compact-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--specialty-soft, #e9f8fa);
    color: var(--specialty-color, #087f8c);
    font-size: 21px;
    line-height: 1;
}

.specialty-compact-name {
    width: 100%;
    overflow: hidden;
    color: var(--home-ink, #102a43);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.specialty-compact-count {
    color: var(--home-muted, #627d98);
    font-size: 11px;
}

.specialties-rail-arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    transform: translateY(-50%);
    border: 1px solid #d2e4e9;
    border-radius: 50%;
    background: rgba(255, 255, 255, .96);
    color: var(--home-primary, #087f8c);
    font: inherit;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 7px 18px rgba(16, 42, 67, .1);
}

.specialties-rail-arrow[data-direction="next"] { right: 0; }
.specialties-rail-arrow[data-direction="previous"] { left: 0; }
.specialties-rail-arrow:disabled { opacity: .35; cursor: default; }

.specialties-swipe-cue {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 6px;
}

.specialties-swipe-cue span {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #bdd8df;
}

.specialties-swipe-cue span:first-child {
    width: 18px;
    background: var(--home-primary, #087f8c);
}

/* Searchable all-specialties modal */
.all-specialties-modal[hidden] { display: none; }

.all-specialties-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 22px;
}

.all-specialties-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 32, 49, .62);
    backdrop-filter: blur(3px);
}

.all-specialties-dialog {
    position: relative;
    width: min(860px, 100%);
    max-height: min(760px, calc(100vh - 44px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .6);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 30px 90px rgba(5, 32, 49, .28);
}

.all-specialties-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 19px 21px;
    border-bottom: 1px solid #e4eef1;
}

.all-specialties-header h2 {
    margin: 0 0 3px;
    color: var(--home-ink, #102a43);
    font-size: 21px;
}

.all-specialties-header p {
    margin: 0;
    color: var(--home-muted, #627d98);
    font-size: 12px;
}

.all-specialties-close {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 11px;
    background: #edf6f8;
    color: var(--home-primary-dark, #05606a);
    font: inherit;
    font-size: 21px;
    cursor: pointer;
}

.all-specialties-search-wrap {
    position: relative;
    padding: 15px 20px 9px;
}

.all-specialties-search-wrap::before {
    content: "⌕";
    position: absolute;
    top: 25px;
    right: 34px;
    color: #6f8797;
    font-size: 20px;
    pointer-events: none;
}

.all-specialties-search {
    width: 100%;
    height: 46px;
    padding: 0 45px 0 14px;
    border: 1px solid #cfdee3;
    border-radius: 12px;
    background: #f8fbfc;
    color: var(--home-ink, #102a43);
    font: inherit;
    outline: 0;
}

.all-specialties-search:focus {
    border-color: var(--home-primary, #087f8c);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(8, 127, 140, .1);
}

.all-specialties-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    overflow-y: auto;
    padding: 10px 20px 22px;
}

.all-specialty-link {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px;
    border: 1px solid #e0eaee;
    border-radius: 12px;
    color: var(--home-ink, #102a43);
    text-decoration: none;
    transition: border-color .16s ease, background .16s ease;
}

.all-specialty-link:hover {
    border-color: rgba(8, 127, 140, .35);
    background: #f2fafb;
}

.all-specialty-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #e9f8fa;
    font-size: 17px;
}

.all-specialty-copy {
    min-width: 0;
    flex: 1;
}

.all-specialty-name {
    display: block;
    overflow: hidden;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.all-specialty-count {
    display: block;
    margin-top: 3px;
    color: var(--home-muted, #627d98);
    font-size: 10px;
}

.all-specialties-empty {
    display: none;
    padding: 36px 20px;
    color: var(--home-muted, #627d98);
    text-align: center;
}

body.specialties-modal-open { overflow: hidden; }

@media (min-width: 1200px) {
    .specialties-rail {
        grid-auto-columns: calc((100% - 60px) / 6);
    }
}

@media (max-width: 800px) {
    .specialties-compact-section { padding: 22px 0 25px; }

    .specialties-compact-head {
        align-items: flex-start;
        margin-bottom: 13px;
    }

    .specialties-compact-title { font-size: 22px; }
    .specialties-compact-subtitle { font-size: 12px; }
    .specialties-compact-head > .specialties-all-button { display: none; }

    .specialties-rail-shell { padding-inline: 0; }
    .specialties-rail-arrow { display: none; }
    .specialties-rail {
        grid-auto-columns: minmax(132px, 43%);
        margin-inline: -2px;
        padding-bottom: 6px;
    }

    .specialty-compact-card {
        min-height: 105px;
        padding: 11px 8px;
    }

    .specialty-compact-icon { width: 38px; height: 38px; font-size: 19px; }
    .specialty-compact-name { font-size: 12px; }
    .specialties-swipe-cue { display: flex; }

    .specialties-mobile-all {
        width: 100%;
        display: inline-flex !important;
        margin-top: 13px;
    }

    .all-specialties-modal { align-items: end; padding: 0; }
    .all-specialties-dialog {
        width: 100%;
        max-height: 88vh;
        border-radius: 20px 20px 0 0;
    }

    .all-specialties-dialog::before {
        content: "";
        width: 42px;
        height: 4px;
        flex: 0 0 auto;
        align-self: center;
        margin-top: 9px;
        border-radius: 99px;
        background: #cbdde2;
    }

    .all-specialties-header { padding: 13px 16px 12px; }
    .all-specialties-header h2 { font-size: 18px; }
    .all-specialties-search-wrap { padding: 11px 15px 7px; }
    .all-specialties-search-wrap::before { top: 20px; right: 28px; }
    .all-specialties-grid { grid-template-columns: 1fr 1fr; padding: 8px 15px 18px; }
}

@media (max-width: 440px) {
    .specialties-rail { grid-auto-columns: 45%; }
    .all-specialties-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .specialties-rail { scroll-behavior: auto; }
}
