/*
 * Doctors area: /nasha-komanda/, doctor pages /nasha-komanda/{slug}/, the doctors_grid and team_carousel
 * blocks. Only additions to the CSS API of site.css (contract §8); mobile-first, breakpoints 640/960/1200.
 */

/* ---------- Doctor card (doctors_grid, team_carousel) ---------- */

/* Full cell height, so the actions (margin-top: auto) line up across a grid row. */
.doctor-card {
    --card-ratio: 295 / 370;
    height: 100%;
}

.doctor-card__media > img {
    object-position: top center;
}

/* Tighter than the 1.5rem of .card__body: the date chips and both buttons have to fit one row each. */
.doctor-card > .card__body {
    padding: var(--space-4);
}

@media (min-width: 640px) {
    .doctor-card > .card__body {
        padding: 1.25rem;
    }
}

.doctor-card__placeholder,
.doctor__placeholder {
    display: grid;
    place-items: center;
    height: 100%;
    font-size: 4rem;
}

.doctor-card__note {
    color: var(--c-brand-dark);
}

/* Above the stretched .card__link, like the buttons of .card__actions. */
.doctor-card__phone {
    position: relative;
    z-index: 2;
    color: var(--c-brand-dark);
    font-weight: 700;
    white-space: nowrap;
}

/* ---------- Online booking: nearest dates of the MIS (card and doctor page, 09 §7) ---------- */

.doctor-dates {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}

.doctor-dates__label {
    margin: 0;
    color: var(--c-ink-2);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.doctor-dates__list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.doctor-dates__chip {
    /* z-index: the chips of a card stay clickable over the stretched .card__link. */
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0.4rem 0.9rem;
    border: 1.5px solid var(--c-brand-tint);
    border-radius: var(--radius-pill);
    background: var(--c-brand-soft);
    color: var(--c-brand-dark);
    font: 700 0.8125rem/1.2 var(--font-display);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.doctor-dates__chip:hover {
    border-color: var(--c-brand);
    background: var(--c-brand);
    color: #fff;
}

/*
 * Three chips share one row of a card in equal cells, from the phone carousel (221px at 320) to four cards in a
 * row (224px at 1200). A cell too narrow for «Пн, 24 июн» breaks the chip after the weekday: the day and the month
 * are joined by a no-break space (dates.blade.php). The fourth and fifth chips (max_slots) start a second row.
 */
.doctor-card__dates {
    container: doctor-dates / inline-size;
}

.doctor-card__dates .doctor-dates__list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.375rem;
}

/* height: 100% — a chip broken in two lines does not leave its neighbours shorter. */
.doctor-card__dates .doctor-dates__chip {
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 2.25rem;
    padding: 0.3rem 0.25rem;
    font-size: 0.75rem;
    text-align: center;
    white-space: normal;
}

/* Same selector as above: a container query adds no specificity. */
@container doctor-dates (max-width: 14.5rem) {
    .doctor-card__dates .doctor-dates__chip {
        padding-inline: 0.125rem;
        font-size: 0.6875rem;
    }
}

/* ---------- Doctor page ---------- */

.doctor {
    display: grid;
    gap: var(--space-6);
    margin-top: var(--space-5);
}

.doctor__photo {
    width: 100%;
    max-width: 22rem;
    aspect-ratio: 295 / 370;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--c-bg-soft);
    box-shadow: var(--shadow);
}

.doctor__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.doctor__info {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    min-width: 0;
}

.doctor__info > * {
    margin: 0;
}

.doctor__position {
    color: var(--c-brand-dark);
    font: 700 1.0625rem/1.4 var(--font-display);
}

.doctor__hours {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    width: fit-content;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius);
    background: var(--c-bg-soft);
    color: var(--c-ink-strong);
}

.doctor__hours > .icon {
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    color: var(--c-brand-dark);
}

.doctor__bio {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.doctor__subtitle {
    margin: 0;
    font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
}

.doctor__booking {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

/* Date chips of the doctor page: one step bigger than on a card, closer to the booking button. */
.doctor-booking {
    gap: var(--space-3);
}

.doctor-booking .doctor-dates__chip {
    min-height: 2.75rem;
    padding-inline: 1.1rem;
    font-size: 0.875rem;
}

.doctor .notice__body {
    margin: 0;
}

@media (min-width: 640px) {
    .doctor {
        grid-template-columns: minmax(14rem, 22rem) minmax(0, 1fr);
        align-items: start;
    }
}

@media (min-width: 960px) {
    .doctor {
        gap: var(--space-8);
    }
}

/* ---------- Diplomas and certificates: whole scans, never cropped ---------- */

.doctor-docs__link {
    border: 1px solid var(--c-line);
    background: #fff;
}

.doctor-docs__img {
    display: block;
    width: 100%;
    height: auto;
}
