/* ============================================================================
   Caledapt — /book (self-service consultation booking)
   ----------------------------------------------------------------------------
   This page is built on the SAME primitives as every other route:

     - design-system.css supplies the tokens: the golden-ratio space scale
       (--space-0 .. --space-8, phi = 1.618), the type scale, the radii, the
       split tokens (--split-minor 382fr / --split-major 618fr), the surfaces
       and the field/button/card components.
     - The scenic stage is the same .scenic block every other route carries, so
       the Highlands backdrop runs continuously behind the page.
     - The header and footer are the shared partials, byte-identical to the rest
       of the site.

   NOTHING here invents a value. Every gap, pad and margin is a --space-N step
   off the phi scale, and the two-column split is the house 38.2 / 61.8.

   The old version of this page was built with inline styles, arbitrary hex
   colours and 22px/24px gaps, and it loaded none of the stylesheets that
   actually define the classes it used. The form rendered as UNSTYLED BROWSER
   DEFAULTS: inputs with a 2px inset grey border, a 1px/2px UA padding and no
   radius, because .contact-field and .input live in caledapt-v12.css and
   design-system.css and neither of those rules reached this page. That is the
   class of bug this file exists to make impossible to reintroduce.
   ========================================================================== */

/* ============================================================ page frame == */

.book-main {
  position: relative;
  z-index: 1;
  padding-block: var(--space-7) var(--space-8);
}

.book-main .shell {
  /* The .shell token already centres and pads. Nothing to override. */
}

/* The header is fixed, so the first content needs the header's own height
   cleared off the top. --space-7 (76px) matches the 76px header bar exactly,
   so the breadcrumb sits flush under it rather than under a guessed offset. */
.book-head {
  margin-bottom: var(--space-7);
  /* The breadcrumb's baseline box ends exactly where this block begins, so the
     eyebrow used to sit flush against it and the two uppercase lines read as one
     squashed pair. Measured: breadcrumb bottom 156, eyebrow top 156. */
  padding-top: 14px;
  display: grid;
  /* The same golden split as the page body, with the headline in the major
     track and the standfirst in the minor one. minmax(0, …) so the ratio is
     exact (a bare fr track floors at min-content). */
  grid-template-columns: minmax(0, var(--split-major)) minmax(0, var(--split-minor));
  gap: var(--space-7);
  align-items: end;
}

@media (max-width: 900px) {
  .book-head {
    grid-template-columns: 1fr;
    gap: var(--space-5);
    align-items: start;
  }
}

.book-head__main {
  min-width: 0;
}

.book-head__aside {
  min-width: 0;
  /* The standfirst sits on the baseline of the headline block (align-items:
     end on the grid), so its own box needs a bottom nudge so the two
     columns read as one row rather than a headline and a floating note. */
  padding-bottom: var(--space-2);
}

.book-head h1 {
  /* The HOMEPAGE display scale (--t-2xl, 104px cap) is for the homepage
     hero. Every inner route steps down to --t-xl (62px cap) -- see
     .content-page .hero h1 and .page-hero h1 in the legacy stack. Using the
     display scale here put a 104px headline on an inner page. */
  font-size: var(--t-xl);
  margin-block: var(--space-4) 0;
  text-wrap: balance;
}

.book-head__lede {
  color: var(--text-muted);
  max-width: 46ch;
  margin: 0;
}

/* ============================================================== the grid == */
/* The house golden-ratio split: 38.2 / 61.8, expressed in fr so the tracks
   divide the space LEFT after the gap. Percentage tracks resolve against the
   container and would overflow alongside a fixed gap (measured on the site
   before: 23px of overflow at 1024px).
   TWO things this has to get right, and both were measured wrong first:

   1. WHICH TRACK IS WHICH. The booking form is the primary content, so it
      takes the MAJOR track (61.8%) and the aside takes the minor one
      (38.2%). The form is the first child in the markup, so the major track
      is declared first.

   2. minmax(0, …). A bare `fr` track has an AUTOMATIC MINIMUM of min-content.
      A child wider than its share (the slot grid, a long email address) then
      pushes its track past its share and squeezes the other one. Measured
      before this fix: 351px / 507px = 40.9% / 59.1%, not the intended
      38.2 / 61.8, with no visible cause. `minmax(0, …)` removes the
      min-content floor so the ratio is exact. */
.book-grid {
  display: grid;
  grid-template-columns: minmax(0, var(--split-major)) minmax(0, var(--split-minor));
  gap: var(--space-7);
  align-items: start;
}

@media (max-width: 900px) {
  .book-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}

/* ============================================================ the panel == */

.book-panel {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-xl);
  padding: var(--space-7);
}

@media (max-width: 560px) {
  .book-panel { padding: var(--space-5); }
}

.book-panel__title {
  font-size: var(--t-lg);
  margin-bottom: var(--space-6);
}

/* ============================================================== the steps == */

.book-step + .book-step {
  margin-top: var(--space-7);
  padding-top: var(--space-6);
  border-top: 1px solid var(--line-soft);
}

.book-step__title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--t-md);
  margin-bottom: var(--space-5);
}

.book-step__num {
  display: inline-grid;
  place-items: center;
  width: var(--space-6);
  height: var(--space-6);
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(25, 232, 222, .08);
  color: var(--caledapt-cyan);
  font-family: var(--font-display);
  font-size: var(--t-sm);
  font-weight: 800;
  line-height: 1;
}

/* ========================================================== slot picker == */

.slot-picker {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  padding: var(--space-5);
}

.slot-picker__status {
  font-size: var(--t-sm);
  color: var(--text-dim);
  min-height: 1.4em;
}

.slot-picker__status[data-state="error"] { color: #FF9B8A; }
.slot-picker__status[data-state="ready"] { color: var(--text-muted); }

/* Two dropdowns instead of a wall of buttons. The old grid printed every slot
   for a fortnight, which pushed the form below the fold on a laptop and made
   the page feel like a timetable. Date first, then only that date's times. */
.slot-selects {
  display: grid;
  /* One per row. Side by side, the date label ("Monday 9 November — 4 times")
     was clipped by the column width, and a dropdown that hides part of its own
     value is worse than a taller form. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.slot-selects .field {
  min-width: 0;
}

/* An arrow needs room, and the longest option must never be cut. */
.slot-selects .select {
  width: 100%;
  padding-right: var(--space-7);
  text-overflow: ellipsis;
}

/* The confirmation line: what the two dropdowns currently add up to. */
.slot-picker__chosen {
  margin: var(--space-4) 0 0;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--caledapt-cyan);
}

/* Days are stacked as a vertical list with a hairline between them, so a day
   and its slots read as ONE group rather than a loose cloud of buttons. */
.slot-days {
  display: grid;
  gap: var(--space-4);
}

.slot-days:empty {
  display: none;
}

.slot-day {
  display: grid;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line-soft);
}

.slot-day:first-child {
  padding-top: 0;
  border-top: 0;
}

.slot-day__label {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* The weekday is the headline; the date is the qualifier. */
.slot-day__date {
  color: var(--text-primary);
  letter-spacing: .04em;
}

.slot-day__count {
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: .06em;
}

/* The slots of one day sit in an EVEN GRID, not a flex-wrap row. With
   flex-wrap the fourth button dropped onto a second line on its own, which
   read as a mistake. auto-fill with a minimum track keeps every day on the
   same columns, so a 2-slot day and a 4-slot day line up vertically. */
.slot-day__slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: var(--space-3);
}

@media (max-width: 560px) {
  .slot-day__slots {
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  }
}

/* One slot button.
   The old markup used inline styles with hard-coded hex and a 6px radius. The
   token version uses the house radius and the house surface ramp, and it
   carries the 44px touch target the site standardises on. */
.slot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 76px;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--surface-3);
  color: var(--text-primary);
  font-size: var(--t-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease),
              transform var(--dur-fast) var(--ease);
}

.slot-btn:hover {
  border-color: var(--line-strong);
  background: rgba(25, 232, 222, .07);
}

.slot-btn:focus-visible {
  outline: 2px solid var(--caledapt-cyan);
  outline-offset: 2px;
}

/* THE selected slot. Chosen with a class, not an inline background: the old
   code wrote b.style.background directly and could never be themed, restyled
   or reset from CSS. */
.slot-btn[aria-pressed="true"] {
  background: var(--caledapt-cyan);
  border-color: var(--caledapt-cyan);
  color: var(--text-on-cyan);
  font-weight: 700;
  box-shadow: var(--glow-cyan);
}

.slot-picker__note {
  margin-top: var(--space-4);
  font-size: var(--t-xs);
  color: var(--text-dim);
}

/* `hidden` must actually hide.
   The browser's own [hidden] rule is display:none, but it loses to ANY author
   display rule - and `.field` is display:grid. So `<div class="field" hidden>`
   still rendered, which is why the proposed-location box appeared for online
   bookings while `.hidden` reported true to any script that asked. */
[hidden] {
  display: none !important;
}

/* ============================================================ time list == */

/* A list, not a <select>. Native option rows are drawn by the browser, so a
   struck-through "taken" entry is impossible to style inside one. */
.time-list {
  display: grid;
  gap: var(--space-1);
}

.time-list__empty {
  margin: 0;
  padding: var(--space-3) 0;
  font-size: var(--t-sm);
  color: var(--text-dim);
}

.time-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font: inherit;
  font-size: var(--t-sm);
  color: inherit;
  text-align: left;
  background: var(--surface-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.time-opt:hover { border-color: var(--caledapt-cyan); }
.time-opt:focus-visible { outline: 2px solid var(--caledapt-cyan); outline-offset: 2px; }
.time-opt[aria-selected="true"] {
  border-color: var(--caledapt-cyan);
  box-shadow: var(--glow-cyan);
}

/* A slot that has been taken stays visible, crossed through in red, so the
   visitor can see it existed and has gone rather than watching it vanish. */
.time-opt.is-taken {
  color: #FF6B5A;
  border-color: rgba(255, 107, 90, .40);
  background: rgba(255, 107, 90, .06);
  cursor: not-allowed;
}
.time-opt.is-taken:hover { border-color: rgba(255, 107, 90, .40); }
.time-opt.is-taken .time-opt__t { text-decoration: line-through; }

.time-opt__t {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.time-opt__tag {
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #FF6B5A;
  opacity: .85;
}

.field__label {
  display: block;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

/* =============================================================== fields == */

/* The field grid is 1fr 1fr, so the two SHORT fields (consultation type and
   phone) sit side by side and the wide one (notes) spans. A second track with
   a hard px minimum cannot fit a narrow container, so the grid collapses
   cleanly at 700px rather than clipping. */
.book-fields {
  display: grid;
  /* One field per row. Two-up was tidier in theory but squeezed every input to
     half the panel, and long values (business names, emails) were cut off. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}

.field--wide {
  grid-column: 1 / -1;
}

/* The .field component from design-system.css already sets display:grid,
   gap: --space-2 and margin-bottom: --space-4. Inside the grid that margin
   would double the row gap, so the margin is removed and the grid gap owns
   the rhythm. */
.book-fields .field {
  margin-bottom: 0;
}

.field__hint {
  font-size: var(--t-xs);
  color: var(--text-dim);
  line-height: 1.5;
}

/* ================================================================ gate ==== */

.book-gate {
  margin-top: var(--space-5);
}

/* THE MOBILE OVERFLOW FIX.
   Measured on production at 320px and 375px: the booking panel was 360px
   wide inside a 320px viewport, so the right-hand 40px was CLIPPED by the
   body's `overflow-x: clip` -- and because that is clip and not scroll, the
   content was not merely scrollable, it was UNREACHABLE.

   The cause is the same one the site already fixed for /contact/,
   /impact/submit/ and /business/ (see site.css): the Turnstile widget is a
   300px-wide iframe, and every ancestor of it defaults to `min-width: auto`
   in a grid or flex context. The 300px therefore propagated all the way up
   to the panel, and the panel's own 29px padding on each side added 58px on
   top: 300 + 58 = 358px, which is the 360px measured.

   The fix is the same as the site's existing one: reset `min-width` to 0 on
   the chain, so the widget can shrink below its intrinsic width and the
   panel can follow the viewport. `max-width: 100%` stops the reverse case. */
.book-panel,
.book-panel > *,
.book-panel form,
.book-panel form > *,
.book-gate,
.book-gate > *,
.book-fields,
.book-fields > *,
.book-actions,
.book-actions > *,
.book-privacy,
.book-panel .cf-turnstile,
.book-panel .cf-turnstile > *,
.book-panel .cf-turnstile div,
.book-panel .field,
.book-panel .input,
.book-panel .select,
.book-panel .textarea {
  min-width: 0;
  max-width: 100%;
}

.book-gate__note {
  margin-top: var(--space-3);
  font-size: var(--t-xs);
  color: var(--text-dim);
}

.book-gate__note[data-state="ok"] { color: var(--caledapt-cyan); }
.book-gate__note[data-state="error"] { color: #FF9B8A; }

/* ============================================================== actions == */

.book-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.book-status {
  font-size: var(--t-sm);
  color: var(--text-muted);
  min-height: 1.4em;
}

.book-status[data-state="ok"] { color: var(--caledapt-cyan); }
.book-status[data-state="error"] { color: #FF9B8A; }

.book-privacy {
  margin-top: var(--space-4);
  font-size: var(--t-xs);
  color: var(--text-dim);
  line-height: 1.6;
}

.book-privacy a {
  color: var(--caledapt-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ================================================================ aside == */

.book-aside {
  display: grid;
  gap: var(--space-5);
  position: sticky;
  top: calc(76px + var(--space-5));
}

@media (max-width: 900px) {
  .book-aside { position: static; }
}

/* The shared footer markup ships a .footer__brand wrapper, but NO stylesheet
   in the whole site defines it -- it is used on all 69 pages and styled by
   nothing. It is the first grid child of .footer__grid, so it already lands
   in the wide 1.6fr track; what it was missing is the separation between the
   wordmark and the blurb below it. Defined here so this page's footer is not
   carrying a class that does nothing. */
.footer__brand .brand {
  margin-bottom: var(--space-4);
}

.book-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  padding: var(--space-5);
}

.book-card--quiet {
  background: transparent;
  border-style: dashed;
}

.book-card__title {
  font-size: var(--t-md);
  margin-bottom: var(--space-3);
}

.book-card__body {
  font-size: var(--t-sm);
  color: var(--text-muted);
  line-height: 1.65;
}

.book-card__body a {
  color: var(--caledapt-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.book-card__list {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
  font-size: var(--t-sm);
  color: var(--text-muted);
  line-height: 1.6;
}

.book-card__list li {
  position: relative;
  padding-left: var(--space-5);
}

.book-card__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: var(--space-2);
  height: var(--space-2);
  border-radius: 50%;
  background: var(--caledapt-cyan);
  opacity: .7;
}

/* ============================================================ utilities == */

/* The site uses .skip (design-system.css) for the skip link. contact/index.html
   carries a .skip-link that no stylesheet defines, so it renders as an
   ordinary link in the flow. This page uses the defined one. */
.skip:focus-visible {
  left: 0;
}

/* ======================================================== status pages === */
/* /book/verify and /book/cancel. A single narrow column, centred, so the
   message is the only thing on screen. The width is the house --max-narrow
   (880px) and the vertical rhythm is the phi scale. */
.book-status-page {
  max-width: var(--max-narrow);
  margin-inline: auto;
  padding-block: var(--space-7) var(--space-8);
}

.book-status-page h1 {
  margin-block: var(--space-4) var(--space-4);
}

.book-status-page .lede {
  color: var(--text-muted);
  max-width: 58ch;
}

.book-status-page .lede[data-state="ok"] { color: var(--caledapt-cyan); }
.book-status-page .lede[data-state="error"] { color: #FF9B8A; }

/* ---------------------------------------------------------------------------
   /book/approve/ — Bryan's in-person approval surface.
   A definition list is the honest markup for label/value pairs, but the UA
   default (dd indented 40px, dt/dd stacked with margins) looks nothing like the
   rest of the site.
   --------------------------------------------------------------------------- */
.appr-facts{
  display: grid;
  grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr);
  gap: .5rem 1.25rem;
  margin: 1.5rem 0 2rem;
  max-width: 46rem;
}
.appr-facts dt{
  color: var(--muted, #9aa4a0);
  font-size: .82rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding-top: .18rem;
}
.appr-facts dd{
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  color: inherit;
}
.appr-facts[hidden]{ display: none; }

@media (max-width: 520px){
  .appr-facts{ grid-template-columns: minmax(0, 1fr); gap: .15rem; }
  .appr-facts dt{ margin-top: .75rem; }
}
