/* The booking page (inc/booking-page.php, js/booking.js). Fields, submit and
   the white card come from styles.css's .contact-form. */
.booking {
    padding-top: calc(var(--header-h) + 2.5rem);
}

.booking-layout {
    display: grid;
    gap: 2.5rem;
    align-items: start;
}

@media (min-width: 900px) {
    .booking-layout {
        grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
        gap: 3rem;
    }
}

.booking-photo {
    width: 6rem;
    height: 6rem;
    border-radius: 50%;
    object-fit: cover;
}

.booking-intro h1 {
    margin: 1rem 0 .75rem;
}

.booking-note,
.booking-optional {
    color: var(--ink-3);
}

.booking-optional {
    font-weight: 400;
}

.booking-durations {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.25rem;
    margin: 0 0 1.5rem;
    padding: 0;
    border: 0;
}

.booking-durations legend,
.booking-duration {
    margin: 0 0 .5rem;
    font-weight: 600;
}

.booking-durations label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-weight: 400;
    cursor: pointer;
}

/* styles.css sizes every .contact-form input like a text field. */
.contact-form .booking-durations input[type="radio"] {
    display: inline-block;
    width: 1.1rem;
    height: 1.1rem;
    min-height: 0;
    padding: 0;
    margin: 0;
    accent-color: var(--blue);
}

/* The picker (js/booking.js): month grid, and the picked day's times beside
   it once the card is wide enough, under it otherwise. */
.booking-picker {
    container-type: inline-size;
}

.booking-picker-inner {
    display: grid;
    gap: 1.75rem;
}

@container (min-width: 36rem) {
    .booking-picker-inner {
        grid-template-columns: minmax(0, 1fr) 14rem;
        gap: 2rem;
    }

    /* The calendar alone sets the card's height: the day column takes none
       of its own (contain: size) and scrolls its times if they don't fit,
       so a day with many times doesn't make the card grow. */
    .booking-day {
        display: flex;
        flex-direction: column;
        contain: size;
        padding-left: 2rem;
        border-left: 1px solid var(--line);
    }

    /* The padding keeps the focus ring inside the scroll area. */
    .booking-times {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        align-content: start;
        margin: -4px;
        padding: 4px;
    }
}

.booking-month {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .75rem;
}

.booking-month h2,
.booking-day h3 {
    margin: 0;
    font-size: 1rem;
}

.booking-weekdays,
.booking-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .25rem;
    text-align: center;
}

/* Equal rows, so the empty sixth week is as tall as a full one. */
.booking-grid {
    grid-auto-rows: 1fr;
}

.booking-weekdays {
    margin-bottom: .25rem;
    color: var(--ink-3);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.booking-date {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    max-width: 2.75rem;
    aspect-ratio: 1;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--lavender);
    color: var(--blue);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}

button.booking-date:hover {
    background: #D5DEF3;
}

button.booking-date[aria-pressed="true"] {
    background: var(--blue);
    color: var(--white);
}

.booking-date--none {
    background: none;
    color: var(--ink-3);
    font-weight: 400;
    cursor: default;
}

/* Phones: each day a 44 px target (WCAG 2.5.5). Seven of them need about
   310 px, so the card gives up some padding and the grid its gaps; the
   button fills its cell and its circle stays inset (background-clip), so
   neighbouring days do not touch. */
@media (max-width: 479px) {
    .booking-app.contact-form {
        padding-inline: 1rem;
    }

    .booking-weekdays,
    .booking-grid {
        gap: 0;
    }

    .booking-date {
        max-width: none;
        padding: 3px;
        background-clip: content-box;
    }
}

/* Today, bookable or not: a dot under the number. */
.booking-date--today::after {
    content: "";
    position: absolute;
    bottom: 12%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
}

.booking-nav {
    display: inline-grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--lavender);
    color: var(--blue);
    font: inherit;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.booking-nav:hover {
    background: #D5DEF3;
}

.booking-nav:disabled {
    background: none;
    color: var(--ink-3);
    opacity: .5;
    cursor: default;
}

.booking-day h3 {
    margin-bottom: .75rem;
}

.booking-times {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(5.25rem, 1fr));
    gap: .5rem;
}

.booking-time,
.booking-change {
    min-height: 2.75rem;
    padding: .5rem 1rem;
    border: 1px solid rgba(25, 22, 51, .5); /* 3.4:1 on white, as the inputs */
    border-radius: var(--radius-pill);
    background: var(--white);
    color: var(--ink);
    font: inherit;
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease;
}

.booking-time:hover,
.booking-change:hover {
    border-color: var(--blue);
    background: var(--lavender);
}

.booking-time:focus-visible,
.booking-change:focus-visible,
.booking-date:focus-visible,
.booking-nav:focus-visible {
    outline: 3px solid var(--navy);
    outline-offset: 1px;
}

/* Times read as the picker's actions: blue outline and text. */
.booking-time {
    border-color: var(--blue);
    color: var(--blue);
    font-weight: 600;
}

.booking-change {
    min-height: 0;
    margin-left: .5rem;
    padding: .25rem .75rem;
    font-size: .9rem;
}

.booking-chosen {
    margin: 0 0 1.25rem;
}

.booking-message {
    margin: 0 0 1rem;
}

.booking-error {
    margin: 0 0 1rem;
    color: #8d3434;
}

.booking-done:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
}

/* The site's icon chip, larger and in the picker's blue. */
.booking-done-icon {
    width: 3rem;
    height: 3rem;
    margin: 0;
    --chip-bg: var(--lavender);
    --chip-fg: var(--blue);
}

.booking-done-icon svg {
    width: 1.5rem;
    height: 1.5rem;
    stroke-width: 2;
}

.booking-done:focus {
    outline: none;
}

/* js/booking.js hides parts with the hidden attribute; the display rules
   above would otherwise win over the browser's [hidden]. */
.booking-app [hidden] {
    display: none !important;
}
