/* Booking flow — serif, ink, restrained. Inherits --bg, --ink, --muted, --faint, --rule, --serif from index.html. */

.book-flow {
  font-family: var(--serif);
  color: var(--ink);
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

/* ── Steps (animated height + cross-fade) ────────────────── */
.book-steps {
  position: relative;
  overflow: hidden;
  transition: height 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.book-step {
  opacity: 0;
  transform: translateX(24px);
  transition:
    opacity 200ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.book-step[data-active="true"] {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.book-step[data-exit="true"] {
  opacity: 0;
  transform: translateX(-24px);
  transition:
    opacity 160ms cubic-bezier(0.4, 0, 1, 1),
    transform 160ms cubic-bezier(0.4, 0, 1, 1);
}

/* Absolute positioning so height animation works cleanly when measuring next step. */
.book-step--absolute {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

/* ── Headings ───────────────────────────────────────────── */
.book-h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.25rem;
  color: var(--ink);
}

.book-h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.005em;
  margin: 0 0 0.25rem;
}

.book-sub {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 1.75rem;
  line-height: 1.5;
}

/* ── Duration toggle (calendar step) ────────────────────── */
.book-duration {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  margin: -0.5rem 0 1.5rem;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: 9999px;
  background: var(--bg);
}
.book-duration-btn {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  border-radius: 9999px;
  transition: background 120ms ease-out, color 120ms ease-out;
  -webkit-appearance: none;
  appearance: none;
  letter-spacing: 0;
}
.book-duration-btn:hover {
  color: var(--ink);
}
.book-duration-btn[data-active="true"] {
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
}
.book-duration-btn:focus-visible {
  outline: 2px dashed var(--ink);
  outline-offset: 2px;
}

/* ── Back link ──────────────────────────────────────────── */
.book-back {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 6px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--rule);
  margin-bottom: 1rem;
  font-style: italic;
}
.book-back:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}
.book-back:focus-visible {
  outline: none;
  color: var(--ink);
  text-decoration-color: var(--ink);
  text-decoration-thickness: 2px;
}

/* ── Calendar ───────────────────────────────────────────── */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 1rem;
}

.cal-month {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  margin: 0;
  letter-spacing: -0.005em;
}

.cal-nav {
  display: flex;
  gap: 4px;
}

.cal-nav-btn {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease-out, color 120ms ease-out;
}
.cal-nav-btn:not(:disabled):hover {
  background: var(--rule);
}
.cal-nav-btn:focus-visible {
  outline: none;
  background: var(--rule);
  box-shadow: inset 0 -2px 0 var(--ink);
}
.cal-nav-btn:disabled {
  color: var(--faint);
  cursor: default;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-dayname {
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: center;
  padding: 6px 0 10px;
  font-weight: 400;
}

.cal-cell {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 48px;
  min-height: 40px;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 140ms ease-out, color 140ms ease-out;
}

.cal-cell[data-disabled="true"] {
  color: var(--faint);
  cursor: default;
  pointer-events: none;
}

/* Month availability still in flight: every cell is disabled, so pulse them
   instead of letting the grid read as a month with nothing open. A warm cache
   renders greyouts straight away and never enters this state. */
.cal-grid[data-loading="true"] .cal-cell:not([data-empty="true"]) {
  animation: cal-pulse 1400ms ease-in-out infinite;
}

@keyframes cal-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  .cal-grid[data-loading="true"] .cal-cell:not([data-empty="true"]) {
    animation: none;
  }
}

.cal-cell[data-empty="true"] {
  pointer-events: none;
}

.cal-cell:not([data-disabled="true"]):hover {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.cal-cell[data-selected="true"],
.cal-cell[data-selected="true"]:hover {
  background: var(--ink);
  color: var(--bg);
}

.cal-cell[data-today="true"]::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
}

.cal-cell[data-today="true"][data-selected="true"]::after {
  background: var(--bg);
}

.cal-cell:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
}

/* ── Time slots ─────────────────────────────────────────── */
.slots-meta {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 1rem;
  font-style: italic;
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.slot-cell {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--rule);
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-bottom-color 120ms ease-out, background 120ms ease-out, color 120ms ease-out;
}

.slot-cell[data-disabled="true"] {
  color: var(--faint);
  cursor: default;
  pointer-events: none;
}

.slot-cell:not([data-disabled="true"]):hover {
  border-bottom-color: var(--ink);
}

.slot-cell:not([data-disabled="true"]):hover .slot-arrow {
  transform: translateX(2px);
  color: var(--ink);
}

.slot-cell[data-selected="true"] {
  background: var(--ink);
  color: var(--bg);
  border-bottom-color: transparent;
}

.slot-cell[data-selected="true"] .slot-arrow {
  color: var(--bg);
}

.slot-cell:focus-visible {
  outline: none;
  border-bottom-color: var(--ink);
  border-bottom-width: 2px;
}

.slot-time {
  font-weight: 400;
}

.slot-arrow {
  color: var(--faint);
  font-family: var(--serif);
  font-size: 15px;
  transition: transform 120ms ease-out, color 120ms ease-out;
}

/* Skeleton slots */
.slot-skeleton {
  height: 48px;
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid var(--rule);
  background: transparent;
}

.slot-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--faint) 50%,
    transparent 100%
  );
  opacity: 0.25;
  transform: translateX(-100%);
  animation: slot-shimmer 1400ms ease-in-out infinite;
}

@keyframes slot-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.slots-slow {
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  margin-top: 0.75rem;
  text-align: center;
  opacity: 0;
  transition: opacity 300ms ease-out;
}
.slots-slow[data-visible="true"] {
  opacity: 1;
}

.slots-empty {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: var(--muted);
  text-align: center;
  padding: 2rem 1rem;
}

.slots-tz {
  font-family: var(--serif);
  font-size: 12px;
  color: var(--muted);
  margin: 1rem 0 0;
  text-align: center;
  font-style: italic;
}

/* ── Form ───────────────────────────────────────────────── */
.book-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.book-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.book-label {
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}

.book-label-req::after {
  content: " \00b7";
  color: var(--faint);
}

.book-input,
.book-textarea {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 8px 0;
  min-height: 44px;
  width: 100%;
  transition: border-bottom-color 120ms ease-out, border-bottom-width 120ms ease-out;
  border-radius: 0;
}

.book-textarea {
  min-height: 44px;
  resize: vertical;
  line-height: 1.5;
  padding-top: 10px;
}

.book-input:focus,
.book-textarea:focus {
  outline: none;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 7px; /* compensate for added border */
}

.book-input::placeholder,
.book-textarea::placeholder {
  color: var(--faint);
  font-style: italic;
}

.book-error {
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  color: #9A3A2E;
  margin: 0.35rem 0 0;
}
html.dark .book-error { color: #E5A89A; }

.book-submit {
  display: block;
  width: 100%;
  height: 56px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
  border: 0;
  border-radius: 9999px;
  cursor: pointer;
  transition: transform 180ms ease-out, box-shadow 180ms ease-out, opacity 180ms ease-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  margin-top: 0.75rem;
}
.book-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.22);
}
.book-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink);
}
.book-submit:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* ── Summary line (above form) ──────────────────────────── */
.book-summary {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  line-height: 1.5;
  margin: 0 0 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.book-summary em {
  color: var(--muted);
  font-style: italic;
}
.book-summary-edit {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  margin-left: 0.5rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
  font-style: italic;
}
.book-summary-edit:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

/* ── Confirmation ───────────────────────────────────────── */
.book-confirm {
  text-align: left;
}

.book-confirm-h {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
}

.book-confirm-line {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  margin: 0 0 0.75rem;
  color: var(--ink);
}

.book-confirm-micro {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  line-height: 1.5;
  margin: 0 0 2rem;
  color: var(--muted);
}

.book-confirm-actions {
  display: flex;
  gap: 0.5rem 1.25rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 1.25rem;
}
.book-confirm-actions::before {
  content: "";
  display: none;
}

.book-action {
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 15px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 35%, transparent);
  border-radius: 0;
  cursor: pointer;
  text-align: left;
  padding-bottom: 2px;
  transition: border-color 140ms ease-out, color 140ms ease-out;
}
.book-action:hover {
  border-bottom-color: var(--ink);
}
.book-action:focus-visible {
  outline: none;
  border-bottom-color: var(--ink);
  color: var(--ink);
}
.book-action[data-copied="true"] {
  color: color-mix(in srgb, var(--ink) 55%, transparent);
  border-bottom-color: color-mix(in srgb, var(--ink) 55%, transparent);
}
.book-action-sep {
  color: color-mix(in srgb, var(--ink) 30%, transparent);
  font-family: var(--serif);
  user-select: none;
}

.book-confirm-after {
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  margin: 1.5rem 0 0;
}
.book-confirm-after a {
  color: var(--muted);
  text-decoration-color: var(--rule);
}
.book-confirm-after a:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

/* ── Global error (network) ─────────────────────────────── */
.book-network-error {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: var(--muted);
  margin: 1.5rem 0 0;
  text-align: center;
}
.book-retry {
  background: none;
  border: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--ink);
  padding: 0;
}
.book-retry:hover {
  text-decoration-thickness: 2px;
}

/* ── Thanks state (after /book confirmation) ────────────── */
.book-thanks {
  text-align: center;
  padding: 2rem 0;
  opacity: 0;
  transition: opacity 900ms ease-out;
}
.book-thanks[data-visible="true"] {
  opacity: 1;
}
.book-thanks-h {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 1rem;
}
.book-thanks-p {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--muted);
  font-style: italic;
  margin: 0;
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .slots-grid {
    grid-template-columns: 1fr;
  }
  .book-h1 { font-size: 28px; }
  .book-confirm-h { font-size: 28px; }
  .book-confirm-line { font-size: 17px; }
  .cal-cell { font-size: 14px; }
  .book-confirm-actions {
    flex-direction: column;
  }
  .book-action {
    width: 100%;
  }
}

/* ── Respect reduced motion ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .book-steps,
  .book-step,
  .slot-skeleton::after,
  .book-thanks {
    transition: none;
    animation: none;
  }
  .book-step {
    transform: none;
  }
}
