/* ============================================================
   book.css
   ────────────────────────────────────────────────────────────
   Page styles for book.html.

   The booking form is the largest discrete component on the
   site. It needs to feel:
     – Calm (not anxiety-inducing)
     – Tile-native (consistent with the rest of the bento system)
     – Touch-friendly (radio-as-tile pickers, large chips)
     – Honest (clear about what happens next)

   Sections:
     1. Page hero
     2. Form fieldsets
     3. Counter picker (radio-as-tile)
     4. Date / time / party row
     5. Dietary chips
     6. "What happens next" sidebar
     7. Mobile collapse
   ============================================================ */

/* ── 1. Page hero ──────────────────────────────────────────── */
.book-hero {
  grid-auto-rows: clamp(160px, 16vw, 220px);
  margin-bottom: var(--s-7);
}
.book-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 1.6rem + 4.4vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--paper-bone);
}
.book-title__italic {
  font-style: italic;
  color: rgba(246,240,225,0.7);
  display: inline-block;
  margin-left: -0.02em;
}
.book-lede {
  font-family: var(--font-ui);
  font-size: clamp(0.96rem, 0.88rem + 0.5vw, 1.12rem);
  color: rgba(246,240,225,0.78);
  max-width: 44ch;
  line-height: 1.5;
}
.book-lede__link {
  color: var(--matcha-300);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur-1) var(--ease-out);
}
.book-lede__link:hover { color: var(--paper-bone); }

/* ── 2. Book grid (form + sidebar) ─────────────────────────── */
.book-grid {
  margin-bottom: var(--s-7);
  /* Tall rows so the form has room to breathe without collapsing
     into a thin strip. */
  grid-auto-rows: clamp(120px, 11vw, 180px);
}

/* The sidebar is its own mini-stack so its three tiles can each
   size to their content. We position it as a grid item, then
   re-flow children as a vertical flex column. */
.book-sidebar {
  grid-column: span min(var(--c, 4), var(--c-max, 12));
  grid-row: span var(--r);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.book-sidebar > .tile { flex: 1; }

/* ── 3. Form structure ─────────────────────────────────────── */
.book-form {
  margin-top: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

/* Step indicator strip — three numbered pills above the form.
   Decorative (the form is a single page) but it sets expectations. */
.book-steps {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin: 0 0 var(--s-3);
  list-style: none;
  padding: 0;
}
.book-steps li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--paper-edge);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-500);
  background: var(--paper-bone);
}
.book-steps li.is-active {
  border-color: var(--matcha-500);
  color: var(--matcha-700);
  background: var(--matcha-100);
}
.book-steps__no {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--ink-900);
  color: var(--paper-bone);
  padding: 1px 6px;
  border-radius: 4px;
  font-feature-settings: "tnum";
}
.book-steps li.is-active .book-steps__no {
  background: var(--matcha-700);
}

/* Fieldset blocks — each step is a real fieldset for semantics
   (better with screen readers + form validation libraries). */
.book-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.book-fieldset__legend {
  font-family: var(--font-ui);
  font-size: var(--t-eyebrow);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--matcha-700);
  font-weight: 500;
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--paper-edge);
  width: 100%;
  margin-bottom: var(--s-2);
}

/* ── 4. Form fields ────────────────────────────────────────── */
.book-form__row { display: grid; gap: var(--s-4); }
.book-form__row--2 { grid-template-columns: 1fr 1fr; }
.book-form__row--3 { grid-template-columns: 1.2fr 1fr 0.7fr; }

.book-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.book-field__label {
  font-family: var(--font-ui);
  font-size: var(--t-micro);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 500;
}
.book-field__hint {
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-300);
  font-weight: 400;
  margin-left: 4px;
}

.book-form input[type="text"],
.book-form input[type="email"],
.book-form input[type="tel"],
.book-form input[type="date"],
.book-form select,
.book-form textarea {
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--ink-900);
  background: var(--paper-bone);
  border: 1px solid var(--paper-edge);
  border-radius: var(--r-md);
  padding: 12px 16px;
  outline: none;
  transition: border-color var(--dur-1) var(--ease-out),
              box-shadow var(--dur-1) var(--ease-out);
  min-height: 48px;
}
.book-form input:hover,
.book-form select:hover,
.book-form textarea:hover { border-color: var(--ink-300); }
.book-form input:focus,
.book-form select:focus,
.book-form textarea:focus {
  border-color: var(--matcha-500);
  box-shadow: 0 0 0 4px rgba(107,142,35,0.14);
}
.book-form textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.5;
}

/* Native select arrow swap — strip platform chrome, add our own */
.book-form select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%231A1813' d='M6 8 0 1.5 1.5 0 6 4.5 10.5 0 12 1.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px;
  padding-right: 40px;
}

/* ── 5. Counter picker (radio-as-tile) ─────────────────────── */
.counter-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s-2);
}
.counter-option {
  position: relative;
  cursor: pointer;
  display: block;
}
.counter-option input {
  /* Visually hidden but reachable by keyboard / SR */
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.counter-option__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px;
  border: 1.5px solid var(--paper-edge);
  border-radius: var(--r-md);
  background: var(--paper-bone);
  transition: border-color var(--dur-1) var(--ease-out),
              background var(--dur-1) var(--ease-out),
              transform var(--dur-2) var(--ease-spring),
              box-shadow var(--dur-2) var(--ease-out);
}
.counter-option:hover .counter-option__body {
  border-color: var(--ink-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-rest);
}
.counter-option input:focus-visible + .counter-option__body {
  outline: 2px solid var(--matcha-500);
  outline-offset: 2px;
}
.counter-option input:checked + .counter-option__body {
  border-color: var(--matcha-500);
  background: var(--matcha-100);
  box-shadow: 0 0 0 3px rgba(107,142,35,0.14);
}
.counter-option__name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink-900);
  line-height: 1;
}
.counter-option__pc {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-500);
  letter-spacing: 0.04em;
}
.counter-option input:checked + .counter-option__body .counter-option__pc {
  color: var(--matcha-700);
}

/* ── 6. Dietary chips (multi-check) ────────────────────────── */
.diet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.diet-chip {
  position: relative;
  cursor: pointer;
}
.diet-chip input {
  /* Hidden — the label provides the visible state. */
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.diet-chip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--paper-edge);
  border-radius: var(--r-pill);
  background: var(--paper-bone);
  font-family: var(--font-ui);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink-700);
  transition: background var(--dur-1) var(--ease-out),
              color var(--dur-1) var(--ease-out),
              border-color var(--dur-1) var(--ease-out);
}
.diet-chip span::before {
  /* Subtle plus mark; flips to check on selection. */
  content: "+";
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1;
  color: var(--ink-300);
  width: 12px;
  text-align: center;
}
.diet-chip:hover span { border-color: var(--ink-300); background: var(--paper-cream); }
.diet-chip input:focus-visible + span {
  outline: 2px solid var(--matcha-500);
  outline-offset: 2px;
}
.diet-chip input:checked + span {
  background: var(--matcha-500);
  color: var(--paper-bone);
  border-color: var(--matcha-500);
}
.diet-chip input:checked + span::before {
  content: "✓";
  color: var(--paper-bone);
}

/* ── 7. Checkbox row (the "send me updates" line) ──────────── */
.book-checkbox {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  font-size: 0.92rem;
  color: var(--ink-700);
  line-height: 1.5;
  cursor: pointer;
  padding: var(--s-3) 0;
}
.book-checkbox input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--matcha-500);
  cursor: pointer;
}

/* ── 8. Submit row ─────────────────────────────────────────── */
.book-form__actions {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid var(--paper-edge);
  flex-wrap: wrap;
}
.book-form__small {
  font-size: 0.86rem;
  color: var(--ink-500);
  max-width: 38ch;
  line-height: 1.5;
}
.book-form__small a {
  color: var(--matcha-700);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ── 9. Sidebar — "what happens next" list ─────────────────── */
.next-steps {
  list-style: none;
  padding: 0;
  margin: var(--s-3) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.next-steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-3);
  align-items: start;
}
.next-steps__no {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--matcha-100);
  color: var(--matcha-700);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  font-feature-settings: "tnum";
}
.next-steps__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--ink-900);
  margin-bottom: 2px;
  line-height: 1.1;
}
.next-steps__desc {
  font-family: var(--font-ui);
  font-size: 0.88rem;
  color: var(--ink-700);
  line-height: 1.5;
  margin: 0;
}

/* ── 10. Slot grid (live availability from booking engine) ── */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: var(--s-2);
  min-height: 64px;
  padding: var(--s-3);
  border: 1px dashed var(--paper-edge);
  border-radius: var(--r-md);
  background:
    repeating-linear-gradient(45deg,
      transparent 0 8px,
      rgba(26,24,19,0.015) 8px 9px);
  transition: background var(--dur-1) var(--ease-out);
}
.slot-grid[data-state="ready"] {
  background: var(--paper-cream);
  border-style: solid;
  border-color: var(--paper-edge);
}
.slot-grid[data-state="loading"],
.slot-grid[data-state="empty"],
.slot-grid[data-state="error"] {
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot-grid__state {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  color: var(--ink-500);
  padding: var(--s-3) var(--s-2);
}
.slot-grid[data-state="error"] .slot-grid__state { color: var(--akami-700, #8B2818); }
.slot-grid__spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--paper-edge);
  border-top-color: var(--matcha-500);
  animation: slot-spin 0.8s linear infinite;
}
@keyframes slot-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .slot-grid__spinner { animation: none; border-top-color: var(--matcha-500); }
}

.slot-chip {
  appearance: none;
  border: 1.5px solid var(--paper-edge);
  border-radius: var(--r-pill);
  background: var(--paper-bone);
  padding: 10px 6px;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-feature-settings: "tnum";
  color: var(--ink-900);
  cursor: pointer;
  transition: transform var(--dur-2) var(--ease-spring),
              background var(--dur-1) var(--ease-out),
              border-color var(--dur-1) var(--ease-out),
              color var(--dur-1) var(--ease-out),
              box-shadow var(--dur-2) var(--ease-out);
  min-height: 40px;
  text-align: center;
}
.slot-chip:hover {
  border-color: var(--ink-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-rest);
}
.slot-chip:focus-visible {
  outline: 2px solid var(--matcha-500);
  outline-offset: 2px;
}
.slot-chip.is-selected {
  background: var(--matcha-500);
  border-color: var(--matcha-500);
  color: var(--paper-bone);
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(107,142,35,0.18), var(--shadow-rest);
}

/* ── 11. Live summary tile (above submit) ─────────────────── */
.book-summary {
  border: 1px solid var(--paper-edge);
  border-radius: var(--r-lg);
  background: var(--paper-cream);
  padding: var(--s-4) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  transition: border-color var(--dur-1) var(--ease-out),
              background var(--dur-1) var(--ease-out);
}
.book-summary[data-state="ready"] {
  border-color: var(--matcha-500);
  background: var(--matcha-100);
}
.book-summary__eyebrow {
  font-family: var(--font-ui);
  font-size: var(--t-micro);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--matcha-700);
  font-weight: 500;
}
.book-summary[data-state="draft"] .book-summary__eyebrow {
  color: var(--ink-500);
}
.book-summary__rows {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
  margin: 0;
}
.book-summary__row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.book-summary__row dt {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  font-weight: 500;
}
.book-summary__row dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink-900);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

/* ── 12. Error banner ─────────────────────────────────────── */
.book-form__error {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: rgba(195, 47, 27, 0.08);
  border: 1px solid rgba(195, 47, 27, 0.32);
  color: #7E2114;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  line-height: 1.5;
}

/* ── 13. Submit busy state + tz line ──────────────────────── */
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.btn[data-busy="true"] {
  opacity: 0.75;
  cursor: progress;
}
.book-tz-line {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--ink-300);
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}
.book-tz { color: var(--ink-500); }

/* ── 14. Confirmation state ───────────────────────────────── */
.book-confirm {
  padding: var(--s-5) var(--s-4);
  border-top: 1px solid var(--paper-edge);
  margin-top: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  text-align: left;
  animation: confirm-rise 460ms var(--ease-out);
}
@keyframes confirm-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .book-confirm { animation: none; }
}
.book-confirm__stamp {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--matcha-500);
  color: var(--paper-bone);
  box-shadow: 0 0 0 6px var(--matcha-100);
  margin-bottom: var(--s-2);
}
.book-confirm__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.4rem);
  line-height: 1.05;
  color: var(--ink-900);
  margin: 0;
}
.book-confirm__when {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.15rem, 0.95rem + 0.7vw, 1.4rem);
  color: var(--matcha-700);
  margin: 0;
}
.book-confirm__sub {
  font-family: var(--font-ui);
  font-size: 0.96rem;
  color: var(--ink-700);
  line-height: 1.55;
  margin: 0;
  max-width: 56ch;
}
.book-confirm__actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-top: var(--s-3);
}

/* ── 15. Mobile collapse ──────────────────────────────────── */
@media (max-width: 720px) {
  .book-form__row--2 { grid-template-columns: 1fr; }
  .book-form__row--3 { grid-template-columns: 1fr; }
  .counter-picker { grid-template-columns: 1fr 1fr; }
  .book-hero { grid-auto-rows: minmax(160px, auto); }
  .book-sidebar { grid-row: auto; }
  .book-summary__rows { grid-template-columns: 1fr 1fr; }
  .slot-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
}
