/*
 * Zone `cita`: the booking pages, where a boutique and a date are chosen.
 *
 * Rules only that family of pages needs. Every page of it links this file
 * last of all, after `site.css`, so a rule written here answers for a rule of
 * the whole site at the same specificity; no other page links it at all.
 *
 * As with the finder, there is little of it: the flow is now the markup of the
 * templates of the origin and the calendar is the markup of the widget the
 * origin opens, so the three theme stylesheets — the one of that very widget
 * first of all — dress nearly everything. What is left is the handful of
 * places where this delivery parts ways with the origin.
 */

/* --------------------------------------------------------------- hiding */

/*
 * A step that is not the one being shown, a field the form never shows, the
 * message of a rule nothing has broken. The theme hands several of these a
 * `display` of their own, so the attribute that says «hidden» has to be the
 * last word.
 */
#appointment [hidden] {
  display: none !important;
}

/* ------------------------------------------------------------ the steps */

/*
 * Every step of the bar can be pressed. The origin leaves the ones of its grey
 * placeholder inert — and the copy used to deliver only that placeholder, so
 * the whole bar was inert — but the real bar of the origin navigates.
 */
#appointment .opc-progress-bar-item > span[role="button"] {
  cursor: pointer;
  pointer-events: auto;
}

/*
 * On a wide screen the theme dresses the step and its title and leaves the
 * element between them inline, so it collapses to no height of its own: the
 * only thing that can be pressed is the word. Given the step to fill, the
 * whole step is the target — which is what a step of a bar is for, and what a
 * finger needs. On a narrow screen the theme lays that element out itself.
 */
@media only screen and (min-width: 768px) {
  #appointment .opc-progress-bar-item > span[role="button"] {
    display: block;
    height: 100%;
  }
}

/* ------------------------------------------------------------ the dates */

/*
 * The floating calendar of the wedding date hangs off the field rather than
 * off the end of the document, so it is positioned against the field.
 */
.field[name$=".wedding_date"] .control {
  position: relative;
}

/*
 * The general appointment layout can hide a read-only input after moving its
 * field between grid rows. This is the actual control used to open the
 * calendar, so it must retain the same visible box as every other field.
 */
#appointment input#datepicker.wedding-date-calendar {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100% !important;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #7d7370;
  background: #fff;
  box-sizing: border-box;
  cursor: pointer;
}

/*
 * How far down it opens is measured against the field itself, by the script,
 * and written onto the element: laid out after whatever follows the field, it
 * would slide down the moment the message of an empty required field appeared
 * under it — with a press meant for the month list already on its way.
 */
#ui-datepicker-div {
  position: absolute;
  z-index: 20;
  left: 0;
}

/*
 * The two lists the month and the year open. The theme styles the panel of the
 * widget it ships; this is the same panel laid out as a plain list, because
 * nothing here slides it.
 */
.ui-datepicker-month-panel ul,
.ui-datepicker-year-panel ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0 0;
  padding: 0;
  max-height: 180px;
  overflow-y: auto;
  list-style: none;
}

.ui-datepicker-month-panel button,
.ui-datepicker-year-panel button {
  padding: 4px 10px;
  border: 1px solid #dadde1;
  border-radius: 4px;
  background: none;
  font-size: 13px;
  cursor: pointer;
}

.ui-datepicker-month-panel button:hover,
.ui-datepicker-year-panel button:hover {
  border-color: #7d7370;
}

/* ------------------------------------------------------------ the hours */

/* The selectable time slots and their confirmation action. */
#location .location__hours__content ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#location .location__hours__content .location__hours__item {
  margin: 0;
  min-width: 0;
}

#location .location__hours__content .appointment-time {
  width: 100%;
  min-height: 42px;
}

#location .location__hours__content .appointment-submit-item,
#location .location__hours__content .location__hours__item.form-feedback {
  grid-column: 1 / -1;
}

#location .location__hours__content .appointment-submit-item {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

#location .location__hours__content .appointment-submit {
  min-width: 180px;
}

@media only screen and (max-width: 479px) {
  #location .location__hours__content ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

#location .location__hours__content .form-feedback {
  display: block;
  margin: 0;
  list-style: none;
}
