/* ==========================================================================
   The Edited Wild — booking.css
   Styles for the .story__booking section on single-story pages.
   Uses design tokens from main.css (:root custom properties).
   ========================================================================== */

/* --------------------------------------------------------------------------
   Section wrapper
   -------------------------------------------------------------------------- */
.story__booking {
  border-top: 1px solid var(--tew-rule);
  margin-top: clamp(3rem, 6vw, 5rem);
  padding-top: clamp(2.5rem, 5vw, 4rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
}

.story__booking-inner {
  max-width: var(--tew-read);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

/* --------------------------------------------------------------------------
   Heading + intro
   -------------------------------------------------------------------------- */
.story__booking-heading {
  font-family: var(--tew-serif);
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--tew-ink);
  margin-bottom: 0.75rem;
  text-wrap: balance;
}

.story__booking-intro {
  font-family: var(--tew-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--tew-muted);
  margin-bottom: 2rem;
}

/* --------------------------------------------------------------------------
   Server feedback messages (mirrors newsletter pattern)
   -------------------------------------------------------------------------- */
.tew-booking__msg {
  padding: 0.75rem 1rem;
  border-radius: 2px;
  font-family: var(--tew-sans);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.tew-booking__msg.is-success {
  background-color: rgba(75, 102, 70, 0.08);
  border-left: 3px solid var(--tew-sage);
  color: var(--tew-sage);
}

.tew-booking__msg.is-error {
  background-color: rgba(201, 101, 70, 0.08);
  border-left: 3px solid var(--tew-accent);
  color: var(--tew-accent-ink);
}

/* --------------------------------------------------------------------------
   Form layout
   -------------------------------------------------------------------------- */
.tew-booking-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

/* JS sets the `hidden` attribute on success (booking.js); the plain class
   selector above has higher specificity than the UA's [hidden] rule, so
   without this the form never actually disappears. */
.tew-booking-form[hidden] {
  display: none;
}

@media (min-width: 36rem) {
  .tew-booking-form {
    grid-template-columns: 1fr 1fr;
  }

  /* Full-width fields */
  .tew-booking-form__field--full {
    grid-column: 1 / -1;
  }
}

/* --------------------------------------------------------------------------
   Form field groups (label + input)
   -------------------------------------------------------------------------- */
.tew-booking-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.tew-booking-form__label {
  font-family: var(--tew-sans);
  font-size: var(--tew-eyebrow);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tew-muted);
}

.tew-booking-form__label .tew-required {
  color: var(--tew-accent-ink);
  margin-left: 0.2em;
}

/* --------------------------------------------------------------------------
   Inputs / textarea
   -------------------------------------------------------------------------- */
.tew-booking-form__input,
.tew-booking-form__textarea {
  font-family: var(--tew-sans);
  font-size: 1rem;
  color: var(--tew-ink);
  background-color: transparent;
  border: 1px solid var(--tew-rule);
  border-radius: 2px;
  padding: 0.65rem 0.85rem;
  width: 100%;
  transition: border-color 0.2s var(--tew-ease);
  appearance: none;
  -webkit-appearance: none;
}

.tew-booking-form__input:focus,
.tew-booking-form__textarea:focus {
  outline: none;
  border-color: var(--tew-ink);
}

.tew-booking-form__input:focus-visible,
.tew-booking-form__textarea:focus-visible {
  outline: 2px solid var(--tew-accent);
  outline-offset: 2px;
}

/* Date/time inputs — normalize native picker icon tint */
.tew-booking-form__input[type="date"]::-webkit-calendar-picker-indicator,
.tew-booking-form__input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 0.4;
  cursor: pointer;
}

.tew-booking-form__textarea {
  resize: vertical;
  min-height: 7rem;
  line-height: 1.55;
}

/* Invalid state (JS-applied) */
.tew-booking-form__input.is-invalid,
.tew-booking-form__textarea.is-invalid {
  border-color: var(--tew-accent);
}

/* --------------------------------------------------------------------------
   Honeypot — visually hidden, accessible
   -------------------------------------------------------------------------- */
.tew-hp-wrap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Submit button — matches editorial style (ghost → filled on hover)
   -------------------------------------------------------------------------- */
.tew-booking-form__submit {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--tew-sans);
  font-size: var(--tew-eyebrow);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tew-ink);
  background-color: transparent;
  border: 1px solid var(--tew-ink);
  border-radius: 999px;
  padding: 0.85rem 2rem;
  cursor: pointer;
  transition: background-color 0.22s var(--tew-ease), color 0.22s var(--tew-ease);
  align-self: end;
  width: 100%;
}

@media (min-width: 36rem) {
  .tew-booking-form__submit {
    width: auto;
    justify-self: start;
  }
}

.tew-booking-form__submit:hover {
  background-color: var(--tew-ink);
  color: var(--tew-bg);
}

.tew-booking-form__submit:focus-visible {
  outline: 2px solid var(--tew-accent);
  outline-offset: 2px;
}

.tew-booking-form__submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   In-flow opener — ghost button matching the submit style
   -------------------------------------------------------------------------- */
.tew-book-trigger {
  display: flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-inline: auto;
  margin-top: 0.25rem;
  margin-bottom: clamp(1rem, 2vw, 1.5rem);
  padding: 0.85rem 2rem;
  font-family: var(--tew-sans);
  font-size: var(--tew-eyebrow);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--tew-ink);
  background-color: transparent;
  border: 1px solid var(--tew-ink);
  border-radius: 999px;
  transition: background-color 0.22s var(--tew-ease), color 0.22s var(--tew-ease);
}

.tew-book-trigger:hover {
  background-color: var(--tew-ink);
  color: var(--tew-bg);
}

.tew-book-trigger:focus-visible {
  outline: 2px solid var(--tew-accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Close control — panel mode only
   -------------------------------------------------------------------------- */
.tew-book-close {
  display: none;
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--tew-ink);
  background-color: transparent;
  border: none;
  border-radius: 2px;
  cursor: pointer;
}

.tew-book-close:focus-visible {
  outline: 2px solid var(--tew-accent);
  outline-offset: 2px;
}

body.tew-has-panel .story__booking .tew-book-close {
  display: flex;
}

/* --------------------------------------------------------------------------
   Scrim — panel mode only; inert via [hidden] until JS activates it
   -------------------------------------------------------------------------- */
.tew-book-scrim {
  position: fixed;
  inset: 0;
  z-index: 290;
  background: rgba(34, 24, 18, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--tew-ease);
}

.tew-book-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Panel mode — .story__booking becomes an off-canvas slide-over
   -------------------------------------------------------------------------- */
body.tew-has-panel .story__booking {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 300;
  width: var(--tew-panel-w);
  max-width: 100%;
  height: 100dvh;
  margin-top: 0;
  padding-top: clamp(3rem, 6vw, 4rem);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--tew-panel-bg, var(--tew-bg));
  border-top: none;
  box-shadow: -20px 0 60px rgba(34, 24, 18, 0.28);
  transform: translateX(100%);
  /* No transition here — it's added via .tew-panel-ready (booking.js, after
     the first paint) so the *initial* application of tew-has-panel never
     animates. Without this split, if the browser restores scroll position
     on refresh near this section, the section visibly slides from its
     in-flow spot to off-canvas the instant JS adds the class — reading as
     an unrequested "open then close". */
}

body.tew-has-panel .story__booking.tew-panel-ready {
  transition: transform 0.32s var(--tew-ease);
}

body.tew-has-panel .story__booking.is-open {
  transform: translateX(0);
}

/* The booking form's 2-column grid keys off viewport width (min-width: 36rem),
   but inside the narrow slide-over that overflows. Force a single column and
   full-width fields in panel mode so everything fits the panel. */
body.tew-has-panel .story__booking .tew-booking-form {
  grid-template-columns: 1fr;
}

body.tew-has-panel .story__booking .tew-booking-form__field--full {
  grid-column: auto;
}

@media (prefers-reduced-motion: reduce) {
  .story__booking,
  .tew-book-scrim,
  body.tew-has-panel .story__booking.tew-panel-ready {
    transition: none;
  }
}
