/* ── the booking sheet (js/book-sheet.js) ─────────────────
   Opens from any "Book a chair" without leaving the page. The seal's green room, the paper card from the
   booking section, and the appointment written out as a counter docket that gets stamped at the end. */

html.bsheet-open, html.bsheet-open body { overflow: hidden; }

.bsheet {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent; color: var(--text);
  overflow: hidden; overscroll-behavior: contain;
}
.bsheet::backdrop { background: transparent; }
.bsheet:not([open]) { display: none; }

.bsheet__scrim {
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 0% 50%, rgba(5, 10, 9, .45), rgba(5, 10, 9, .78));
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  cursor: pointer;
}

.bsheet__panel {
  position: absolute; inset: 0 0 0 auto; width: min(1180px, 94vw);
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  background: var(--green);
  box-shadow: -40px 0 80px -30px rgba(0, 0, 0, .7), inset 1px 0 0 rgba(198, 167, 102, .35);
}

/* head: seal, title, the three steps, close; a brass rule that fills as the booking comes together */
.bsheet__head {
  position: relative;
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 14px clamp(16px, 2vw, 28px);
  padding: clamp(16px, 2vw, 24px) clamp(20px, 3vw, 44px);
  border-bottom: 1px solid var(--line);
}
.bsheet__seal { width: 44px; height: 44px; }
.bsheet__title { font: 400 clamp(1.5rem, 2.2vw, 2rem)/1 var(--serif); letter-spacing: -.02em; white-space: nowrap; }
.bsheet__title em { font-style: normal; color: var(--brass); }
.bsheet__stepper { justify-self: center; }
.bsheet__close {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  color: var(--text); box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow .25s ease, color .25s ease, rotate .45s var(--ease-out), scale .16s var(--ease-out);
}
.bsheet__close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.bsheet__close:active { scale: .94; }
.bsheet__close:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .bsheet__close:hover { color: var(--brass-hi); box-shadow: inset 0 0 0 1px var(--brass); rotate: 90deg; } }
.bsheet__rule { position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; overflow: hidden; }
.bsheet__rule u { display: block; height: 100%; background: var(--brass); transform: scaleX(0); transform-origin: 0 50%; transition: transform .7s var(--ease-out); }

/* body: the paper card on the left, the docket on the right; only the body scrolls */
.bsheet__body { overflow-y: auto; overscroll-behavior: contain; padding: clamp(18px, 2.4vw, 36px) clamp(20px, 3vw, 44px) clamp(24px, 3vw, 44px); scrollbar-width: thin; scrollbar-color: var(--brass-lo) transparent; }
.bsheet .book__panel { grid-template-columns: minmax(0, 1fr) clamp(270px, 25vw, 330px); }
.bsheet .book__main { min-height: 100%; }
.bsheet .bstep__title { font-size: clamp(1.5rem, 2.2vw, 2.125rem); }
.bsheet .choices__cat { grid-column: 1 / -1; margin-top: 14px; font: 500 .75rem/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--walnut); }
.bsheet .choices__cat:first-child { margin-top: 0; }

/* the nav stays at hand however long the list is */
.bsheet .book__nav {
  position: sticky; bottom: calc(-1 * clamp(22px, 3vw, 44px)); z-index: 2;
  margin-inline: calc(-1 * clamp(22px, 3vw, 44px)); margin-bottom: calc(-1 * clamp(22px, 3vw, 44px));
  padding: 18px clamp(22px, 3vw, 44px) clamp(18px, 2.4vw, 28px);
  background: var(--card); border-radius: 0 0 clamp(14px, 1.6vw, 22px) clamp(14px, 1.6vw, 22px);
}
.bsheet__mini { display: none; }
.bsheet__after { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-top: 6px; }
.bsheet .bstep--done .btn { min-height: 52px; }
.bsheet .bstep--done:focus { outline: none; }

/* the docket: the counter's slip, written out line by line, stamped when the chair is booked */
.bsheet__docket {
  position: sticky; top: 0; overflow: hidden;
  background: #f3ecdc; border-radius: 6px;
  --perf: 6px; --perf-step: 18px;
  padding-top: calc(var(--perf) * 2 + 24px); padding-bottom: calc(var(--perf) * 2 + 24px);
  -webkit-mask:
    radial-gradient(circle var(--perf) at 50% 0, #0000 97%, #000) top / var(--perf-step) 51% repeat-x,
    radial-gradient(circle var(--perf) at 50% 100%, #0000 97%, #000) bottom / var(--perf-step) 51% repeat-x;
          mask:
    radial-gradient(circle var(--perf) at 50% 0, #0000 97%, #000) top / var(--perf-step) 51% repeat-x,
    radial-gradient(circle var(--perf) at 50% 100%, #0000 97%, #000) bottom / var(--perf-step) 51% repeat-x;
}
.bsheet__docket-head { text-align: center; padding-bottom: 18px; margin-bottom: 4px; border-bottom: 3px double rgba(15, 23, 22, .55); }
.bsheet__docket .docket__addr { justify-content: center; }
.bsheet__docket .summary__list { display: block; }
.bsheet__docket .summary__list > div { border-top: 0; padding: 12px 0; align-items: baseline; }
.bsheet__docket .summary__list > div + div { border-top: 1px dotted rgba(15, 23, 22, .3); }
.bsheet__docket .summary__list dt { color: var(--card-muted); font-size: .875rem; }
.bsheet__docket .summary__list dd { color: var(--card-muted); font-size: .9375rem; }
.bsheet__docket .summary__list dd.is-set { color: var(--ink); }
.bsheet__docket .summary__total { border-top: 1.5px solid rgba(15, 23, 22, .55); }
.bsheet__docket .summary__total span { color: var(--card-muted); }
.bsheet__docket .summary__total b { color: var(--walnut); }
.bsheet__stamp {
  position: absolute; right: 34%; bottom: 30px; width: 96px; height: auto; pointer-events: none;
  mix-blend-mode: multiply;
  filter: brightness(0) saturate(100%) invert(26%) sepia(39%) saturate(1050%) hue-rotate(347deg) brightness(.9);
  opacity: 0; rotate: -14deg; scale: 1.5;
  transition: opacity .2s ease, scale .45s cubic-bezier(.2, 1.4, .4, 1);
}
.bsheet__stamp.is-on { opacity: .62; scale: 1; transition-delay: .35s; }

/* tablets and phones: one column, the sheet rises from the bottom, the docket becomes one line in the nav */
@media (max-width: 899px) {
  .bsheet__panel { inset: max(10px, env(safe-area-inset-top)) 0 0 0; width: auto; border-radius: 18px 18px 0 0; box-shadow: 0 -30px 60px -20px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(198, 167, 102, .35); }
  .bsheet__head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .bsheet__seal { width: 36px; height: 36px; }
  .bsheet__stepper { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .bsheet .book__panel { grid-template-columns: minmax(0, 1fr); }
  .bsheet__docket { display: none; }
  .bsheet__body { padding: 14px 12px 0; display: flex; flex-direction: column; }
  .bsheet .book__panel { flex: 1 0 auto; align-items: stretch; }
  .bsheet .book__main { border-radius: 14px 14px 0 0; padding-bottom: 0; }
  .bsheet .book__nav { bottom: 0; margin-bottom: 0; border-radius: 0; flex-wrap: wrap; row-gap: 10px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .bsheet__mini { display: block; flex: 1 0 100%; font: 500 .8125rem/1.3 var(--sans); color: var(--card-muted); font-variant-numeric: tabular-nums; }
  .bsheet__mini:empty { display: none; }
}
/* phones on their side: little height, so the head goes back to one row and the summary sits inside the nav row */
@media (max-width: 899px) and (max-height: 540px) and (min-width: 560px) {
  .bsheet__panel { inset: 0; border-radius: 0; }
  .bsheet__head { grid-template-columns: auto auto minmax(0, 1fr) auto; padding-block: 8px; padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right)); }
  .bsheet__seal { width: 30px; height: 30px; }
  .bsheet__title { font-size: 1.375rem; }
  .bsheet__stepper { grid-column: auto; grid-row: auto; justify-self: center; }
  .bsheet__close { width: 40px; height: 40px; }
  .bsheet__body { padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  .bsheet .bstep__title { margin-bottom: 14px; }
  .bsheet .book__nav { flex-wrap: nowrap; margin-top: 16px; padding-top: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .bsheet .book__nav [data-back] { order: 0; }
  .bsheet__mini { order: 1; flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bsheet .book__nav [data-next] { order: 2; flex: none; margin-left: 0; min-height: 48px; }
}

@media (max-width: 599px) {
  .bsheet__stepper .stepper__btn { min-height: 36px; }
  .bsheet .book__nav .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .bsheet__rule u, .bsheet__stamp, .bsheet__close { transition-duration: .01ms !important; }
}
