/* Cards that open over the page (booking form, booking and event details).
   dialog.js shows them as modals; without JS the server renders them `open` and they read as a card in the flow. */
dialog.sheet {
  width: min(36rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-float);
  overflow: auto;
}
dialog.sheet:not(:modal) {
  position: static;
  width: auto;
  max-width: 48rem;
  margin: 0 0 var(--space-6);
  border: 1px solid var(--line);
  box-shadow: none;
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, .45); }

.sheet-head { display: flex; align-items: flex-start; gap: var(--space-4); padding: var(--space-6) var(--space-6) 0; }
.sheet-head h2 { margin: 0; flex: 1; font-size: var(--text-xl); }
/* The title takes the initial focus (screen readers announce it); it needs no ring. */
.sheet-head h2:focus, .sheet-head h2:focus-visible { outline: none; box-shadow: none; }
.sheet-body { padding: var(--space-4) var(--space-6) var(--space-6); }
.sheet-body > :last-child { margin-bottom: 0; }
.sheet-close { flex: none; width: 2.5rem; padding: 0; font-size: var(--text-lg); line-height: 1; }
/* The colour strip says which calendar an event comes from (admin panel). */
.sheet[style*="--cal"] .sheet-head { border-top: 6px solid var(--cal); margin-top: 0; padding-top: calc(var(--space-6) - 6px); }

/* The chosen time, marked with the lemon highlighter: the one thing that is selected. */
.when { display: inline; padding: 0 .15em; white-space: nowrap; background: linear-gradient(transparent 55%, var(--lemon) 55%); }
.facts { margin: 0 0 var(--space-4); color: var(--muted); }
.facts strong { color: var(--ink); }
.sheet-section { margin: 0 0 var(--space-2); font-size: var(--text-md); }
/* Label/value pairs (the company's booking in the admin panel). */
.data { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-4); margin: 0 0 var(--space-4); }
.data dt { color: var(--muted); font-size: var(--text-sm); padding-top: .1em; }
.data dd { margin: 0; overflow-wrap: anywhere; }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 var(--space-4); }
.fields .wide { grid-column: 1 / -1; }
.fields input, .fields textarea, .fields select { max-width: none; }
.sheet .choice { margin-top: var(--space-4); }
.sheet .choice p { margin-bottom: var(--space-2); font-size: var(--text-sm); font-weight: 600; }
.sheet .choice form { display: flex; flex-wrap: wrap; gap: var(--space-2); }

@media (prefers-reduced-motion: no-preference) {
  dialog.sheet:modal[open] { animation: sheet-in var(--duration) var(--ease-out); }
  dialog.sheet:modal[open]::backdrop { animation: fade-in var(--duration) ease-out; }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(1rem) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }

/* Phones: a sheet that rises from the bottom edge. */
@media (max-width: 40rem) {
  dialog.sheet:modal {
    width: 100vw;
    max-width: 100vw;
    margin: auto 0 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92dvh;
  }
  .sheet-head { padding: var(--space-4) var(--space-4) 0; }
  .sheet-body { padding: var(--space-4); }
}
