/*
 * The booking window of the static site (Letter design).
 *
 * Ported from the WordPress theme: a centred panel up to 780px wide with the
 * month grid on the left and the times on the right, stacking to one column
 * under 640px. Tokens come from site.css (:root custom properties); fonts are
 * Newsreader (--serif) and Karla (--sans). Loaded after site.css.
 *
 * Contrast: small text uses --muted, --ink and --sienna (AA on cream, blush
 * and white). --muted-light is used only for inactive day numbers.
 */

html.ah-booking-open {
  overflow: hidden;
}

/* ------------------------------------------------------------------ *
 * The dialog and its panel
 * ------------------------------------------------------------------ */

.ah-modal {
  border: 0;
  padding: 0;
  margin: auto;
  background: transparent;
  width: 100%;
  max-width: min(780px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: visible;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 300;
  line-height: 1.5;
  text-align: left;
}

.ah-modal::backdrop {
  background: rgba(43, 34, 28, 0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.ah-modal *,
.ah-modal *::before,
.ah-modal *::after {
  box-sizing: border-box;
}

.ah-modal [hidden] {
  display: none !important;
}

.ah-modal__panel {
  background: var(--cream);
  border-radius: var(--r-card);
  box-shadow: 0 30px 80px rgba(43, 34, 28, 0.35);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ah-modal :focus-visible {
  outline: 3px solid var(--sienna);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ *
 * Header
 * ------------------------------------------------------------------ */

.ah-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px clamp(22px, 4vw, 34px) 22px;
  border-bottom: 1px solid var(--hairline);
}

.ah-booking-head__id {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.ah-booking-head__photo {
  width: 52px;
  height: 52px;
  flex: none;
  display: block;
  border-radius: var(--r-pill);
  object-fit: cover;
  object-position: 50% 24%;
}

.ah-modal__title {
  margin: 0 0 4px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(23px, 21px + 0.6vw, 26px);
  font-weight: 300;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.ah-modal__title em {
  font-style: italic;
  color: var(--sienna);
}

.ah-booking-head__meta {
  margin: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.ah-modal__close {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(43, 34, 28, 0.22);
  border-radius: var(--r-pill);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease), color var(--speed) var(--ease);
}

.ah-modal__close:hover {
  background: var(--peach);
  border-color: var(--apricot);
  color: var(--ink);
}

.ah-booking-ribbon {
  margin: 0;
  padding: 7px clamp(22px, 4vw, 34px);
  background: var(--peach);
  color: var(--badge-peach-text);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-align: center;
  text-transform: uppercase;
}

/* Visually hidden, read by screen readers. */
.ah-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ah-booking-live button {
  font-family: var(--sans);
}

/* ------------------------------------------------------------------ *
 * Step 1: calendar and times
 * ------------------------------------------------------------------ */

.ah-cal {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
}

.ah-cal__month {
  min-width: 0;
  padding: 26px 30px 30px;
  border-right: 1px solid var(--hairline);
}

.ah-cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.ah-cal__label {
  font-size: 20px;
  font-weight: 400;
  line-height: 1.2;
}

.ah-cal__nav {
  display: flex;
  gap: 6px;
}

.ah-cal__nav button {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(43, 34, 28, 0.22);
  border-radius: var(--r-pill);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease);
}

.ah-cal__nav button:hover:not([disabled]) {
  background: var(--blush);
  border-color: var(--apricot);
}

.ah-cal__nav button[disabled] {
  opacity: 0.35;
  cursor: default;
}

.ah-cal__dow,
.ah-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.ah-cal__dow {
  margin-bottom: 6px;
}

.ah-cal__dow span {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}

.ah-cal__grid {
  min-height: 214px;
  align-content: start;
  transition: opacity var(--speed) var(--ease);
}

.ah-cal__grid.is-loading {
  opacity: 0.45;
}

.ah-cal__day {
  aspect-ratio: 1 / 1;
  min-width: 0;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  color: var(--muted-light);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  cursor: default;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease), border-color var(--speed) var(--ease);
}

.ah-cal__day--empty {
  visibility: hidden;
}

.ah-cal__day--out {
  opacity: 0.7;
}

.ah-cal__day--open {
  background: var(--blush);
  border-color: var(--terracotta-line);
  color: var(--ink);
  cursor: pointer;
}

.ah-cal__day--open:hover {
  border-color: var(--sienna);
}

.ah-cal__day--selected,
.ah-cal__day--selected:hover {
  background: var(--sienna);
  border-color: var(--sienna);
  color: var(--cream);
}

/* Today: a ring in ink, so it reads on open and inactive days alike. */
.ah-cal__day--today {
  box-shadow: inset 0 0 0 1.5px var(--ink-soft);
}

.ah-cal__day--selected.ah-cal__day--today {
  box-shadow: inset 0 0 0 2px var(--cream);
}

.ah-cal__note {
  margin: 18px 0 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.55;
}

.ah-cal__slots {
  min-width: 0;
  padding: 26px 30px 30px;
  display: flex;
  flex-direction: column;
}

.ah-cal__slots-heading {
  margin-bottom: 14px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ah-cal__slot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 268px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 3px 3px 3px 0;
  margin: -3px 0;
}

.ah-slot {
  flex: none;
  margin: 0;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid rgba(43, 34, 28, 0.22);
  border-radius: var(--r-pill);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease), border-color var(--speed) var(--ease);
}

.ah-slot:hover {
  border-color: var(--sienna);
}

/* Before a day is picked the column keeps its shape with empty pills. They
   carry no times on purpose. */
.ah-slot--placeholder,
.ah-slot--placeholder:hover {
  height: 43px;
  background: transparent;
  border-color: var(--hairline);
  cursor: default;
}

.ah-slot--selected,
.ah-slot--selected:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
}

.ah-cal__message {
  margin: 14px 0 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
}

.ah-cal__message:empty {
  display: none;
}

.ah-cal__message--error {
  color: #a8442c;
}

/* "None of these times work for you? Tell me your times": always under the
   times. It becomes the main message when the month is empty or the calendar
   could not be loaded. */
.ah-cal__none {
  margin: 14px 0 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.6;
}

.ah-cal__none--main {
  margin-top: 0;
  color: var(--ink);
  font-size: 15px;
}

.ah-cal__none--error {
  color: #a8442c;
}

.ah-cal__none-link {
  color: var(--sienna);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.ah-cal__none-link:hover {
  color: var(--ink);
}

.ah-cal__foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(22px, 4vw, 34px) 28px;
  border-top: 1px solid var(--hairline);
}

.ah-cal__selection-label,
.ah-cal-details__eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ah-cal__selection,
.ah-cal-details__when {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.3;
}

.ah-cal__confirm {
  margin: 0;
  padding: 16px 30px;
  background: var(--sienna);
  border: 0;
  border-radius: var(--r-pill);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--speed) var(--ease), opacity var(--speed) var(--ease);
}

.ah-cal__confirm:hover:not([disabled]) {
  background: var(--ink);
}

.ah-cal__confirm[disabled] {
  opacity: 0.45;
  cursor: default;
}

.ah-cal__back {
  margin: 0;
  padding: 2px 0;
  background: none;
  border: 0;
  border-bottom: 1px solid rgba(43, 34, 28, 0.35);
  border-radius: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 15px;
  cursor: pointer;
}

.ah-cal__back:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ------------------------------------------------------------------ *
 * Step 2: details
 * ------------------------------------------------------------------ */

.ah-cal-details {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px clamp(22px, 4vw, 34px) 0;
}

.ah-cal-details__head {
  padding-bottom: 4px;
}

.ah-field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 14px;
}

.ah-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.ah-field__label {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
}

.ah-field input,
.ah-field textarea {
  width: 100%;
  margin: 0;
  padding: 13px 15px;
  background: var(--white);
  border: 1px solid rgba(43, 34, 28, 0.3);
  border-radius: var(--r-field);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px; /* 16px keeps iOS from zooming on focus */
  line-height: 1.45;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}

.ah-field textarea {
  min-height: 112px;
  line-height: 1.55;
  resize: vertical;
}

.ah-field input:focus,
.ah-field textarea:focus {
  border-color: var(--sienna);
  box-shadow: 0 0 0 3px rgba(160, 82, 45, 0.18);
  outline-offset: 0;
}

.ah-field--invalid input,
.ah-field--invalid textarea {
  border-color: #a8442c;
  box-shadow: 0 0 0 3px rgba(168, 68, 44, 0.14);
}

.ah-field__error {
  color: #a8442c;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
}

.ah-field__error:empty {
  display: none;
}

/* Honeypot: off-screen rather than display:none, so bots still fill it. */
.ah-form__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.ah-cal-details__payment {
  margin: 2px 0 0;
  padding: 12px 16px;
  background: var(--blush);
  border-radius: var(--r-field);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
}

.ah-cal__foot--details {
  margin: 8px calc(-1 * clamp(22px, 4vw, 34px)) 0;
}

/* ------------------------------------------------------------------ *
 * Step 3: done
 * ------------------------------------------------------------------ */

.ah-cal-done {
  padding: 6px clamp(22px, 4vw, 34px) clamp(30px, 4vw, 40px);
}

.ah-cal-done:focus {
  outline: none;
}

.ah-cal-done__title {
  margin: 18px 0 6px;
  font-size: clamp(21px, 18px + 0.7vw, 24px);
  font-weight: 300;
  line-height: 1.3;
}

.ah-cal-done__when {
  margin: 0 0 12px;
  color: var(--sienna);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
}

.ah-cal-done__body {
  margin: 0;
  padding: 22px 24px;
  background: var(--sage);
  border-radius: var(--r-inset);
  color: var(--sage-body);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}

/* ------------------------------------------------------------------ *
 * Step 0: what to book (two cards), and the chosen-type bar
 * ------------------------------------------------------------------ */

.ah-type {
  padding: 28px clamp(22px, 4vw, 34px) 30px;
}

.ah-type__title {
  margin: 0 0 18px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(21px, 18px + 0.7vw, 24px);
  font-weight: 300;
  line-height: 1.3;
}

.ah-type__cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.ah-type__card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 22px 24px 24px;
  background: var(--white);
  border: 1px solid rgba(43, 34, 28, 0.22);
  border-radius: var(--r-panel);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease);
}

.ah-type__card:hover {
  background: var(--blush);
  border-color: var(--sienna);
}

.ah-type__card.is-current {
  border-color: var(--sienna);
}

.ah-type__card-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.25;
}

.ah-type__card-line {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
}

/* The price is the anchor of the step: a big serif numeral and one short line. */
.ah-type__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  margin: 26px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--hairline);
}

.ah-type__price-amount {
  color: var(--sienna);
  font-family: var(--serif);
  font-size: 50px;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1;
}

.ah-type__price-text {
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
}

.ah-type__none {
  margin-top: 8px;
}

.ah-cal-done__needs {
  margin-top: 18px;
}

.ah-typebar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  padding: 12px clamp(22px, 4vw, 34px);
  border-bottom: 1px solid var(--hairline);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
}

.ah-typebar__label {
  color: var(--ink);
  font-weight: 600;
}

.ah-typebar__change {
  margin: 0;
  padding: 2px 0;
  background: none;
  border: 0;
  border-bottom: 1px solid rgba(43, 34, 28, 0.35);
  border-radius: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 14px;
  cursor: pointer;
}

.ah-typebar__change:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* The weekly hint under the month heading, and the second selection line. */
.ah-cal__weekly-note {
  margin: -6px 0 16px;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.55;
}

.ah-cal__selection-sub {
  margin: 3px 0 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
}

/* ------------------------------------------------------------------ *
 * Step 2, continued: optional Google sign-in for returning students
 * ------------------------------------------------------------------ */

.ah-signin {
  padding: 16px 18px 18px;
  background: var(--blush);
  border-radius: var(--r-field);
  font-family: var(--sans);
}

.ah-signin__title {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.ah-signin__button {
  min-height: 40px;
  max-width: 100%;
  overflow: hidden;
}

.ah-signin__hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.ah-signin__status {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.ah-signin__status:empty {
  display: none;
}

.ah-signin__status--error {
  margin-top: 8px;
  color: #a8442c;
  font-weight: 400;
}

.ah-signin.is-signed .ah-signin__status {
  margin: 0;
}

.ah-field__labelrow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.ah-field__change {
  margin: 0;
  padding: 2px 0;
  background: none;
  border: 0;
  border-bottom: 1px solid rgba(43, 34, 28, 0.35);
  border-radius: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
}

.ah-field__change:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.ah-field input[readonly] {
  background: var(--blush);
  color: var(--ink-soft);
}

/* ------------------------------------------------------------------ *
 * Narrow screens: one column
 * ------------------------------------------------------------------ */

@media (max-width: 640px) {
  .ah-modal__head {
    align-items: flex-start;
    gap: 12px;
    padding: 22px 20px 18px;
  }

  .ah-booking-head__id {
    gap: 12px;
  }

  .ah-booking-head__photo {
    width: 42px;
    height: 42px;
    margin-top: 2px;
  }

  .ah-modal__title {
    font-size: 21px;
  }

  .ah-booking-head__meta {
    font-size: 11px;
    letter-spacing: 0.08em;
  }

  .ah-booking-ribbon {
    padding-inline: 20px;
  }

  .ah-cal {
    grid-template-columns: minmax(0, 1fr);
  }

  .ah-cal__month {
    padding: 22px 16px 24px;
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
  }

  .ah-cal__slots {
    padding: 22px 20px 24px;
  }

  .ah-cal__slot-list {
    max-height: none;
  }

  .ah-cal__grid {
    min-height: 0;
  }

  .ah-cal__foot {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 20px 20px 24px;
  }

  .ah-cal__confirm {
    width: 100%;
  }

  .ah-cal__foot--details {
    margin-inline: -20px;
  }

  .ah-cal__foot--details .ah-cal__back {
    align-self: flex-start;
    order: 2;
  }

  .ah-cal-details {
    padding: 22px 20px 0;
  }

  .ah-cal-done {
    padding-inline: 20px;
  }
}

@media (max-width: 640px) {
  .ah-type {
    padding: 22px 20px 26px;
  }

  .ah-type__cards {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .ah-type__card {
    padding: 18px 20px 20px;
  }

  .ah-typebar {
    padding-inline: 20px;
  }

  .ah-type__price-amount {
    font-size: 46px;
  }

  .ah-signin {
    padding: 14px 14px 16px;
  }
}

/* ------------------------------------------------------------------ *
 * Reduced motion
 * ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .ah-modal *,
  .ah-modal *::before,
  .ah-modal *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
