/* ==========================================================================
   Booking: shared styles for <booking-bar> and <booking-calendar>.

   Both elements render into the light DOM so the site tokens in site.css
   apply directly. Loaded once; used by every page that books anything.
   ========================================================================== */

booking-bar, booking-calendar { display: block; }

/* Three fields and a button do not need the whole page, so the bar is capped and
   centred rather than stretched across the hero. */
/* width:100% matters: the hero lays these out in a column flex, where an auto
   inline margin cancels the stretch and drops the bar to its content width. */
booking-bar { width: 100%; max-width: 64rem; margin-inline: auto; }

/* --------------------------------------------------------------------------
   The search bar
   -------------------------------------------------------------------------- */

.bkg-bar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--paper-warm);
  color: var(--ink);
  border: 1px solid var(--ink-20);
  box-shadow: var(--shadow-lift);
}
@media (min-width: 560px) { .bkg-bar { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) {
  .bkg-bar { grid-template-columns: 1.3fr 1.3fr auto auto; }
  .bkg-bar--dates-only { grid-template-columns: 1fr 1fr auto; }
}
/* With no third field the button would be left in half a row. */
@media (min-width: 560px) and (max-width: 999.98px) {
  .bkg-bar--dates-only .bkg-submit { grid-column: 1 / -1; }
}

.bkg-field {
  display: flex; flex-direction: column; gap: .375rem;
  text-align: left;
  padding: 1.125rem 1.625rem;
  background: none; border: 0;
  border-bottom: 1px solid var(--ink-15);
  cursor: pointer;
}
@media (min-width: 1000px) {
  .bkg-field { border-bottom: 0; border-right: 1px solid var(--ink-15); }
  .bkg-field:nth-last-of-type(1) { border-right: 0; }
}
/* Something to read, not something to press, so it borrows nothing from the date
   fields beside it: no serif value, no capitals, one quiet line. */
.bkg-field--fact {
  flex-direction: row; align-items: center; justify-content: center; gap: .3em;
  padding: .75rem 1.25rem;
  cursor: default;
  color: var(--muted);
  font: 500 .8125rem var(--font-body);
  white-space: nowrap;
}
.bkg-field--fact .bkg-field__label,
.bkg-field--fact .bkg-field__value {
  font: inherit; color: inherit; letter-spacing: 0; text-transform: none;
}
.bkg-field__label {
  font: 700 .625rem var(--font-body);
  letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.bkg-field__value {
  font: 400 1.0625rem var(--font-display);
  color: var(--ink);
}

.bkg-bar .bkg-submit {
  padding: 1.125rem 2.25rem;
  border: 0; cursor: pointer;
  background: var(--bark); color: var(--paper);
  font: 700 .72rem var(--font-body);
  letter-spacing: .14em; text-transform: uppercase;
  transition: background-color .2s ease;
}
.bkg-bar .bkg-submit:hover { background: var(--bark-dark); }

/* --------------------------------------------------------------------------
   The picker overlay root

   The popover used to be a child of .bkg-bar, which put it inside .hero__body
   -- and .hero__body has position + z-index, so it is a stacking context.
   Everything inside one paints as a single unit at that context's level, so
   .bkg-popover's z-index only ever sorted it against its siblings in the hero
   body; against .site-header (z-index 40) it lost every time, at any number.
   position:fixed would not have helped either: it escapes the scroll, not the
   context. Only moving the node does, so booking.js renders the popover into
   this root instead, hung off <body> where no stacking context encloses it.

   Zero-sized and unpainted: a coordinate origin, nothing more. Each bar owns
   an anchor inside it -- a mirror of its search form's padding box, in
   document coordinates -- so the anchored popover hangs off one exactly as it
   used to hang off the form, with its own rules below unchanged.

   45 puts it over .site-header (40) and under .sticky-nav (50). Over the
   header is the point. Under the sticky bar is deliberate: that bar only
   unhides once the hero has scrolled past, and if the two ever do meet the
   navigation has to win. The overlay presentation is a modal, though, and a
   modal that something can paint over is not one -- so it takes 60 for
   exactly as long as it is open.
   -------------------------------------------------------------------------- */

.bkg-overlay {
  position: absolute; top: 0; left: 0;
  width: 0; height: 0;
  z-index: 45;
}
.bkg-overlay.is-modal { z-index: 60; }
/* The mirror box is never a click target -- only what it carries. Without this
   it would be an invisible plate over the search bar and every field under it
   would stop responding. */
.bkg-overlay__anchor { position: absolute; pointer-events: none; }
/* In overlay mode the anchor stops being a mirror of the search form and
   becomes the frame that centres the panel and holds it off the edges. The
   padding is the visible margin of backdrop on every side: without it the
   panel bleeds to the edges, which is the other half of looking like a page.
   The scrim is position:fixed, so it is out of flow and not a flex item. */
.bkg-overlay.is-modal .bkg-overlay__anchor {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .75rem;
}
.bkg-overlay .bkg-popover,
.bkg-overlay .bkg-scrim { pointer-events: auto; }

/* The pop-over calendar hung off the search bar. */
.bkg-popover {
  position: absolute; z-index: 30;
  left: 0; right: 0;
  bottom: calc(100% + .75rem);
  background: var(--paper-warm); color: var(--ink);
  border: 1px solid var(--ink-20);
  box-shadow: var(--shadow-pop);
  padding: 1.5rem 1.25rem 1.25rem;
}
@media (min-width: 760px) {
  .bkg-popover { right: auto; width: 680px; padding: 1.5rem 1.75rem 1.25rem; }
}
/* Always above the bar -- never flipped underneath as the page scrolls, which
   moved the calendar to the other side of the fields mid-interaction.

   The popover is a FRAME, not a scroll box. It used to be the scroll box, and
   that is what put Done below the fold of its own overflow: the calendar is
   ~505px of content and a 640px-tall laptop leaves ~412px above the bar, so
   the range summary and the Done button fell out of sight with no indication
   they were there. Pinning the head and the foot to the frame and scrolling
   only the day grid means the month arrows and Done are on screen at every
   height the popover can ever be given -- anchored or overlaid.

   Where the popover is taller than its contents, which is every roomy desktop
   window, this lays out identically to the block flow it replaces. */
.bkg-popover { display: flex; flex-direction: column; overflow: hidden; }
/* An author `display` beats the UA's `[hidden] { display: none }` whatever the
   specificity, so the closed popover has to be put back to sleep explicitly. */
.bkg-popover[hidden], .bkg-scrim[hidden] { display: none; }

.bkg-popover > .bkg-cal {
  display: flex; flex-direction: column;
  flex: 1 1 auto; min-height: 0;
}
.bkg-popover .bkg-cal__head,
.bkg-popover .bkg-cal__foot,
.bkg-popover .bkg-status { flex: none; }
.bkg-popover .bkg-cal__months {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  /* booking.js measures the grid and compacts it until the dates fit (see
     BookingBar._fit()), so this is the last resort rather than the usual
     state -- but a last resort that looks like a finished panel is how the
     end of a month went missing in the first place. Overlay scrollbars are
     0px wide, so there was no scrollbar, no half-row peeking over the edge
     and no fade: the grid simply ended, and December read as a 27-day month.

     The two `local` layers are the paper the grid sits on and travel WITH the
     content; the two `scroll` layers are shadows pinned to the box. At the
     top of the scroll the paper covers the shadow, and it slides off as the
     visitor scrolls -- so a shadow appears exactly on the edge that has more
     dates behind it, and on neither edge when there is nothing to reach. The
     paper is --paper-warm written out: a transparent stop has to be the same
     colour with zero alpha or WebKit fades it through grey. */
  background:
    linear-gradient(var(--paper-warm) 30%, rgba(251, 248, 242, 0)) top / 100% 1.25rem no-repeat local,
    linear-gradient(rgba(251, 248, 242, 0), var(--paper-warm) 70%) bottom / 100% 1.25rem no-repeat local,
    radial-gradient(farthest-side at 50% 0, rgba(42, 35, 29, .22), rgba(42, 35, 29, 0)) top / 100% .5rem no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, rgba(42, 35, 29, .22), rgba(42, 35, 29, 0)) bottom / 100% .5rem no-repeat scroll;
  /* And where the engine will draw a real scrollbar, let it: on a desktop
     with classic scrollbars this is the plainest statement there is. */
  scrollbar-width: thin;
  scrollbar-color: var(--ink-20) transparent;
}

/* --------------------------------------------------------------------------
   The overlay presentation

   On a phone the anchored popover has nowhere to go: there is no useful room
   above the search bar, and what there is belongs to the site header. So below
   the popover breakpoint -- and on any viewport too short to hang a usable
   calendar above the bar -- the same popover is presented as a modal overlay
   instead. booking.js decides and sets data-mode; these rules are the whole of
   the difference, so there is one popover and one calendar, not two.

   Inset from all four edges, with its own corners and its own shadow, over a
   dimmed but still-legible page. That is the owner's distinction: full-SIZE,
   not full-PAGE. A panel bled to the edges reads as a new screen, which is
   exactly what this must not do.
   -------------------------------------------------------------------------- */

.bkg-scrim {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(42, 35, 29, .55);
  animation: bkg-scrim-in .2s ease-out;
}
.bkg-popover[data-mode='sheet'] {
  /* Laid out by the frame below, not pinned to the viewport itself.
     A box with both top and bottom set and height:auto has its height solved
     to fill the gap, and its auto margins forced to zero (CSS 2.1 10.6.4), so
     a panel pinned on four sides can never shrink-wrap however the margins are
     written -- it was 908px tall on a 430x932 phone with 464px of empty cream
     under the last date row. That reads as page layout, and a panel filling
     the window is exactly what makes an overlay feel like a new page rather
     than a thing on top of one. As a centred flex item it is sized by the
     calendar instead. */
  position: relative;
  top: auto; right: auto; bottom: auto; left: auto;
  width: 100%;
  max-width: 34rem;
  height: auto;
  max-height: 100%;
  margin: 0;
  border-radius: 6px;
  box-shadow: 0 24px 60px rgba(42, 35, 29, .45),
              0 2px 6px rgba(42, 35, 29, .2);
  padding: 3.25rem 1.125rem 1.125rem;
  animation: bkg-sheet-in .2s ease-out;
}
/* A landscape phone is ~340px tall in total, and a six-week month grid at the
   normal 36px row is 228px of that before a single piece of chrome. At the
   comfortable sizes the grid simply did not fit and the last fortnight of the
   month was laid out below the bottom of the screen -- inside the picker's own
   overflow, so it could be scrolled to, but a date you cannot see is a date
   you do not know is there.

   So where the calendar does not fit it is drawn compactly instead of
   scrolled: rows of 27px (still over the 24px WCAG target minimum, and the
   cells are ~38px wide), a smaller month heading, and chrome trimmed
   everywhere it can be. Six full weeks then fit on a 340px screen with room to
   spare, and the day grid never becomes a scroll box at all. The X moves
   alongside the month arrows rather than above them, which is where the 44px
   of padding went.

   This was `@media (max-height: 460px)`, and a viewport height is the wrong
   question to ask. 460 was the height a landscape phone happened to need, not
   the height the calendar stops needing it at: at 461px the compact rules
   switched off while the full-size grid still did not fit, so growing the
   window by ONE pixel put ten of the month's thirty dates past the bottom of
   the scroll box, and every height from 461 to about 523 hid the end of the
   month -- at 390 wide, at 412, at 760 and at 1024 alike. The same guess
   failed from the other direction too. Nothing here is sized in px except the
   day rows, so a browser default font above 16px -- Chrome's "Large" is 20 and
   "Very large" is 24, and Android's text scaling does the same -- grows the
   whole calendar while the window stays where it is. At 320x568 with a 24px
   default, a height the query calls roomy, not one date of the month was on
   screen.

   So the class is set from a measurement instead: booking.js asks whether the
   last date of the month actually lands inside the scroll box, and steps down
   until it does. See BookingBar._fit(). Nothing keys off viewport height any
   more, which is why there is no media query left in this block. */
.bkg-overlay.is-compact .bkg-popover[data-mode='sheet'] {
  padding: .5rem .75rem .5rem;
}
/* Landscape is tight, but the panel still keeps a visible margin of backdrop
   on every side. At .25rem it measured 855x352 in an 863x360 window -- bled to
   all four edges, the one thing the brief names as making an overlay read as a
   page. */
.bkg-overlay.is-compact.is-modal .bkg-overlay__anchor { padding: .5rem; }
.bkg-overlay.is-compact .bkg-popover[data-mode='sheet'] .bkg-cal__head {
  margin-bottom: .375rem;
  padding-right: 2.75rem;      /* clears the X, which shares the row */
}
.bkg-overlay.is-compact .bkg-popover[data-mode='sheet'] .bkg-cal__nav {
  font-size: 1.125rem;
  min-width: 32px; min-height: 28px;   /* still over the 24px SC 2.5.8 floor */
}
.bkg-overlay.is-compact .bkg-popover[data-mode='sheet'] .bkg-cal__months { gap: 1rem; }
.bkg-overlay.is-compact .bkg-popover[data-mode='sheet'] .bkg-cal__title {
  font-size: .9375rem; margin-bottom: .25rem;
}
.bkg-overlay.is-compact .bkg-popover[data-mode='sheet'] .bkg-cal__dow { padding: 0; }
.bkg-overlay.is-compact .bkg-popover[data-mode='sheet'] .bkg-day {
  height: 27px; font-size: .8125rem;
}
.bkg-overlay.is-compact .bkg-popover[data-mode='sheet'] .bkg-cal__foot {
  margin-top: .5rem; padding-top: .375rem;
}
.bkg-overlay.is-compact .bkg-popover[data-mode='sheet'] .bkg-status { margin-top: .25rem; }
.bkg-overlay.is-compact .bkg-popover[data-mode='sheet'] .bkg-popover__close {
  top: .125rem; right: .125rem; width: 40px; height: 40px;
}

/* The second step down, and the only one written in px.

   Every length above is in rem, which is the right unit for a calendar that
   should honour whatever text size the visitor has set -- right up to the
   point where honouring it means they cannot see March. By the time this tier
   is reached the panel has already been measured twice and is still too tall
   for the window at the visitor's own size, so the chrome stops scaling and
   the dates get the room instead. Rows are 24px, the SC 2.5.8 floor, and the
   labels around them are set in px so a 24px root font cannot spend the
   window on a heading. Below this there is nothing left to give and the grid
   scrolls -- visibly, which is what the shadows on .bkg-cal__months are for. */
.bkg-overlay.is-dense.is-modal .bkg-overlay__anchor { padding: 4px; }
.bkg-overlay.is-dense .bkg-popover[data-mode='sheet'] { padding: 6px 10px; }
.bkg-overlay.is-dense .bkg-popover[data-mode='sheet'] .bkg-cal__head {
  margin-bottom: 4px;
  padding-right: 38px;
}
.bkg-overlay.is-dense .bkg-popover[data-mode='sheet'] .bkg-cal__hint { font-size: 10px; }
.bkg-overlay.is-dense .bkg-popover[data-mode='sheet'] .bkg-cal__nav {
  font-size: 17px;
  min-width: 28px; min-height: 26px;
}
.bkg-overlay.is-dense .bkg-popover[data-mode='sheet'] .bkg-cal__months { gap: 10px; }
.bkg-overlay.is-dense .bkg-popover[data-mode='sheet'] .bkg-cal__title {
  font-size: 15px; margin-bottom: 2px;
}
.bkg-overlay.is-dense .bkg-popover[data-mode='sheet'] .bkg-cal__dow {
  font-size: 10px; padding: 0;
}
.bkg-overlay.is-dense .bkg-popover[data-mode='sheet'] .bkg-day {
  height: 24px; font-size: 13px;
}
.bkg-overlay.is-dense .bkg-popover[data-mode='sheet'] .bkg-cal__foot {
  margin-top: 4px; padding-top: 4px; gap: 6px 10px;
}
.bkg-overlay.is-dense .bkg-popover[data-mode='sheet'] .bkg-cal__range { font-size: 13px; }
.bkg-overlay.is-dense .bkg-popover[data-mode='sheet'] .bkg-cal__foot .btn {
  font-size: 11px; padding: 9px 16px;
}
.bkg-overlay.is-dense .bkg-popover[data-mode='sheet'] .bkg-status {
  font-size: 11px; margin-top: 2px;
}
.bkg-overlay.is-dense .bkg-popover[data-mode='sheet'] .bkg-popover__close {
  width: 34px; height: 34px; font-size: 20px;
}

/* The X. 44px, in the corner, positioned against the frame rather than the
   scroll box, so it is on screen whatever the calendar underneath is doing. */
.bkg-popover__close {
  position: absolute; top: .375rem; right: .375rem;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--ink); cursor: pointer;
  font: 400 1.625rem/1 var(--font-display);
}
.bkg-popover__close:hover { background: var(--ink-15); }
/* Anchored, there is no overlay to close and the field itself is the toggle. */
.bkg-popover[data-mode='anchored'] .bkg-popover__close { display: none; }

/* A rise over the page, not a slide across it: sliding is the grammar of
   navigation, and this is explicitly not a new page. */
@keyframes bkg-sheet-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes bkg-scrim-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .bkg-popover[data-mode='sheet'], .bkg-scrim { animation: none; }
  /* Zero, not nearly zero.

     site.css answers reduced motion with `transition-duration: .01ms
     !important` on everything, which is a hair rather than nothing -- and a
     hair is enough to break this panel. A property with a transition on it,
     however short, still lays out at its OLD value for the frame in which it
     changes. booking.js sets the compact class and measures the day grid in
     the same tick (BookingBar._fit()), so under reduced motion it was
     measuring the panel it had just replaced: a 490px panel in a 490px window,
     because the frame's 12px of padding had not landed yet. It concluded the
     dates fitted and left the end of the month in the overflow -- for exactly
     the visitors most likely to have asked for less motion in the first place.

     Nothing is lost: .01ms and 0s are the same thing to look at, and the whole
     point of the rule in site.css is that these should not animate at all. */
  .bkg-overlay, .bkg-overlay * { transition-duration: 0s !important; }
}

/* --------------------------------------------------------------------------
   The full-width availability panel
   -------------------------------------------------------------------------- */

.bkg-panel { display: grid; gap: var(--stack); align-items: start; }
@media (min-width: 1000px) {
  .bkg-panel { grid-template-columns: minmax(280px, 380px) 1fr; gap: clamp(2rem, 4vw, 4rem); }
}
.bkg-panel__aside { display: flex; flex-direction: column; align-items: flex-start; gap: 1.25rem; }
.bkg-panel__summary {
  font: 400 var(--step-h3) var(--font-display);
  line-height: 1.3;
  /* Two lines held open whether they are used or not, because this <p> is the
     live preview -- BookingCalendar.sync rewrites it from store.summary() on
     every hover and every focus of a day cell -- and unlike .bkg-cal__range it
     sits ABOVE the grid in the stacked layout, so its height IS the grid's
     position on the page.

     What that cost. At 390px the aside offers the line 347px. "Thu 10 Dec ->
     Tue 15 Dec · 5 nights" fits in one; "Thu 10 Dec -> Mon 14 Dec · 4 nights"
     does not, and wraps to two. So sliding a finger from one date to the next
     grew the aside by one 26.43px line box, pushed the grid down under the
     finger, and the mouseover that then landed -- now on a different day --
     shrank it back. Measured on the iPhone 14 profile with the clock at 1
     October 2026: pointerdown on 7 December, pointerup on 14 December, and
     WebKit issues NO click at all when a press starts and ends on different
     elements. The visitor taps a date and nothing happens. Nothing scrolls
     while this goes on -- pageYOffset is constant throughout -- which is why
     it never looked like a layout bug; the page moves, not the view. It is
     also why "tapping the 15th instead works" was the only clue.

     Measured at every width from 280px to 1440px, the longest line this can
     ever hold ("Wed 30 Sept -> Wed 30 Sept · 28 nights · £12,345") still needs
     only two, so two is the whole range and the height is now constant through
     a pick. 2.6em is 2 x the line-height above, so it tracks the --step-h3
     clamp() at every viewport by construction rather than by a media query
     pinned to today's font metrics and today's month names.

     min-height rather than height, so a third line would still render rather
     than clip -- it would bring the jog back, which is what booking.spec.js's
     "the grid does not move under the finger while a date is being picked"
     is there to catch. Same bug and same cure as .bkg-status at the foot of
     this file, which holds its own line open for the same reason. */
  min-height: 2.6em;
}
/* 20px, in px, for the same reason the dense tier above is written in px: by
   the time a visitor is at a 24px browser font on a 280px screen, chrome that
   keeps scaling is chrome taken off the dates.

   The measurement. The panel calendar needs 209px at that size -- seven day
   cells the numerals actually fit in, 29px each, plus the 2px gaps -- and it
   is not negotiable without making dates unreadable. At 1.25rem the board's
   own inset was 30px a side, so the board asked for 271px inside a 220px
   column, .bkg-panel stretched its single track to 271 to hold it, and the
   aside stretched with it: the heading, the legend and the note all reported
   271px wide in a 280px window, which is why the failure looked like an aside
   bug. It was never the aside; its own minimum is 148px. 1.25rem is 20px at
   the default root size, so this changes nothing on a 16px browser. */
.bkg-panel__board {
  background: var(--paper-warm);
  border: 1px solid var(--ink-15);
  padding: 20px;
}
.section--ink .bkg-panel__board { border-color: transparent; }
@media (min-width: 560px) { .bkg-panel__board { padding: 1.5rem; } }

/* --------------------------------------------------------------------------
   Calendar internals, shared by the popover and the panel
   -------------------------------------------------------------------------- */

.bkg-cal__head {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: .5rem;
  margin-bottom: 1rem;
}
.bkg-cal__hint {
  font: 600 .69rem var(--font-body);
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); text-align: center;
}
/* Paging the month is the only way to reach a date more than a few weeks out,
   and on a phone these three glyphs were 18.2 x 27 CSS px -- under the 24px
   WCAG 2.2 SC 2.5.8 minimum in width on every viewport, and in both dimensions
   in landscape. The spacing exception was unavailable too: the centres of the
   back arrow and "back to this month" were 19.9px apart, so their 24px circles
   intersected. The glyph stays the size it was; the button around it grows. */
.bkg-cal__nav {
  border: 0; background: none; cursor: pointer;
  padding: 0 .375rem; line-height: 1;
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  vertical-align: middle;
  font: 400 1.375rem var(--font-display); color: var(--ink);
}
.bkg-cal__nav:disabled { opacity: .25; cursor: default; pointer-events: none; }

.bkg-cal__months { display: grid; gap: 2rem; }
@media (min-width: 640px) { .bkg-cal__months { grid-template-columns: 1fr 1fr; } }

.bkg-cal__title {
  font: 400 1.125rem var(--font-display);
  text-align: center; margin-bottom: .75rem;
}
.bkg-cal__grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; text-align: center;
}
.bkg-cal__dow {
  font: 700 .594rem var(--font-body);
  letter-spacing: .1em; color: var(--muted); padding: .25rem 0;
}

.bkg-day {
  border: 0; padding: 0; cursor: pointer;
  height: 36px;
  font: 400 .875rem var(--font-display);
  background: transparent; color: var(--ink);
}
.bkg-panel .bkg-day { height: 44px; font-size: 1rem; }
.bkg-day--pad { visibility: hidden; }
.bkg-day:disabled { color: var(--muted-light); cursor: default; }

/* A day already taken. */
.bkg-day--booked {
  background: repeating-linear-gradient(135deg,
    transparent 0 3px, var(--ink-15) 3px 4px);
  text-decoration: line-through;
}
/* Past the end of the booking window: nobody has it, so no hatching. A solid
   tint says "not yet" where the hatching says "gone". */
.bkg-day--unreleased {
  background: var(--ink-15);
  text-decoration: none;
}
/* Changeover days are half-free: someone arrives in the afternoon, or leaves
   in the morning. The diagonal shows which half of the day is available. */
.bkg-day--changeover-in {
  background: linear-gradient(to bottom right, transparent 50%, var(--ink-15) 50%);
  text-decoration: none;
}
.bkg-day--changeover-out {
  background: linear-gradient(to bottom right, var(--ink-15) 50%, transparent 50%);
  text-decoration: none;
}
/* Two ways a date can be unpickable, and they do not mean the same thing.

   A night in the middle of a short run is sold -- someone books straight past
   it -- it is simply never an end of a stay. Greyed, and nothing more.

   A night no stay can reach at all is different, and gets the dotted rule. It
   is deliberately not the booked hatch: these nights ARE free, and a guest
   already staying either side of one may well want them, so painting them as
   taken would tell that guest their booking cannot be changed when it can. The
   rule paints no background, which leaves the changeover diagonals to carry on
   saying which half of a day has gone.

   Both beat .bkg-day:disabled on source order. */
.bkg-day--interior, .bkg-day--interior:disabled { color: var(--muted-light); }

.bkg-day--short, .bkg-day--short:disabled {
  color: var(--muted-light);
  text-decoration: underline dotted var(--muted-light);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* One rule decides every number's weight: .bkg-day is ink, .bkg-day:disabled is
   grey, and nothing else sets a colour. A date reads as pickable exactly when
   it is pickable -- at rest, and equally in the middle of a pick, where the
   offered set narrows to whatever completes the pair.

   The chosen stay is the one exception. Its inner nights are not endpoints, so
   they are disabled, but they belong to the stay and have to read as part of
   it rather than as something ruled out. */
.bkg-day--in-range { background: var(--sand); }
.bkg-day--in-range, .bkg-day--in-range:disabled { color: var(--ink); }
.bkg-day--edge {
  background: var(--bark); color: var(--paper); text-decoration: none;
}
/* A departure onto a changeover day is disabled -- you cannot start a stay
   there -- but it is still one end of the chosen stay, so it keeps the stay's
   own colour rather than the greyed-out one it would inherit from :disabled. */
.bkg-day--edge:disabled { color: var(--paper); }

/* Windows High Contrast, which an older audience uses disproportionately.

   Forced colours replaces every background-COLOUR with Canvas and drops every
   background-IMAGE, and the whole of this calendar's vocabulary is one or the
   other. So the chosen stay (bark), the nights inside it (sand) and an
   ordinary free date all painted black on white, pixel for pixel: a visitor
   could not see which dates they had picked, how long the stay was, or which
   half of a changeover day had gone. Booked nights survive on their own --
   GrayText and the line-through are not colours the mode takes away.

   forced-color-adjust: none is what buys the paint back, so these rules are
   written in system colours rather than the site tokens: whatever the visitor
   has chosen their Highlight to be, the stay is drawn in it. The whole stay is
   one filled band, ends included -- it is one thing, and that is the first
   question to answer -- and the two ends are then ringed in HighlightText,
   which is the one colour guaranteed to contrast with the Highlight it is
   drawn on. An outline rather than a border: .bkg-day has no box-sizing of its
   own, so a border would change the row height and with it the fit. Source
   order matches the rules above, so an edge still beats a changeover day it
   lands on. */
@media (forced-colors: active) {
  /* Both selectors each time: .bkg-day:disabled is more specific, and would put
     the muted colour back with forced-color-adjust switched off. */
  .bkg-day--booked, .bkg-day--booked:disabled {
    forced-color-adjust: none;
    background: repeating-linear-gradient(135deg, Canvas 0 3px, GrayText 3px 4px);
    color: CanvasText;
  }
  .bkg-day--unreleased, .bkg-day--unreleased:disabled {
    forced-color-adjust: none;
    background: Canvas; color: GrayText;
    outline: 1px dashed GrayText; outline-offset: -3px;
  }
  /* The first one is still a departure. Not when chosen: that is the edge below. */
  .bkg-day--unreleased:not(:disabled):not(.bkg-day--edge) { color: CanvasText; }
  .bkg-day--changeover-in {
    forced-color-adjust: none;
    background: linear-gradient(to bottom right, Canvas 50%, GrayText 50%);
    color: CanvasText;
  }
  .bkg-day--changeover-out {
    forced-color-adjust: none;
    background: linear-gradient(to bottom right, GrayText 50%, Canvas 50%);
    color: CanvasText;
  }
  .bkg-day--in-range, .bkg-day--in-range:disabled {
    forced-color-adjust: none;
    background: Highlight; color: HighlightText;
  }
  .bkg-day--edge, .bkg-day--edge:disabled {
    forced-color-adjust: none;
    background: Highlight; color: HighlightText; text-decoration: none;
    outline: 2px solid HighlightText; outline-offset: -3px;
  }
  /* The legend is the key to all of that, so it has to survive the same way. */
  .bkg-legend i {
    forced-color-adjust: none;
    background: Canvas; border-color: CanvasText;
  }
  .bkg-legend i.is-stay { background: Highlight; border-color: Highlight; }
  .bkg-legend i.is-booked {
    background: repeating-linear-gradient(135deg, Canvas 0 3px, GrayText 3px 4px);
  }
  .bkg-legend i.is-interior { opacity: .55; }
  .bkg-legend i.is-changeover-in {
    background: linear-gradient(to bottom right, Canvas 50%, GrayText 50%);
  }
  .bkg-legend i.is-changeover-out {
    background: linear-gradient(to bottom right, GrayText 50%, Canvas 50%);
  }
}

.bkg-cal__foot {
  display: flex; flex-wrap: wrap; gap: .75rem 1rem;
  justify-content: space-between; align-items: center;
  margin-top: 1.125rem; padding-top: .875rem;
  border-top: 1px solid var(--ink-15);
}
.bkg-cal__range { font: 400 .9375rem var(--font-display); }

/* Legend ------------------------------------------------------------------ */

.bkg-legend {
  display: flex; flex-wrap: wrap; gap: .5rem 1.125rem;
  padding: 0; margin: 0; list-style: none;
  font: 500 .72rem var(--font-body); color: var(--muted);
}
.on-dark .bkg-legend { color: var(--paper-90); }
.bkg-legend li { display: flex; align-items: center; gap: .5rem; }
.bkg-legend i {
  width: 16px; height: 16px; flex: none;
  border: 1px solid var(--ink-20);
  background: var(--paper-warm);
}
.on-dark .bkg-legend i { border-color: rgba(244, 239, 230, .35); }
.bkg-legend i.is-stay   { background: var(--bark); border-color: var(--bark); }
.bkg-legend i.is-booked { background: repeating-linear-gradient(135deg, var(--paper-warm) 0 3px, var(--ink-15) 3px 4px); }
.bkg-legend i.is-short {
  background-color: var(--paper-warm);
  background-image: radial-gradient(var(--muted-light) .75px, transparent .75px);
  background-size: 3px 2px; background-repeat: repeat-x;
  background-position: center bottom 4px;
}
.bkg-legend i.is-interior { background: var(--paper-warm); opacity: .55; }
.bkg-legend i.is-changeover-in { background: linear-gradient(to bottom right, var(--paper-warm) 50%, var(--ink-15) 50%); }
.bkg-legend i.is-changeover-out { background: linear-gradient(to bottom right, var(--ink-15) 50%, var(--paper-warm) 50%); }

/* The line under the legend that points short gaps at the contact page. */
.bkg-note {
  font: 500 .75rem var(--font-body);
  color: var(--muted); margin-top: .625rem;
}
.on-dark .bkg-note { color: var(--paper-55); }
.bkg-note a { text-decoration: underline; text-underline-offset: 2px; }

/* Status line: availability loading / unavailable. */
.bkg-status {
  font: 500 .75rem var(--font-body);
  color: var(--muted); margin-top: .75rem;
}
.on-dark .bkg-status { color: var(--paper-55); }
/* The calendar panel stays pale on a dark section, so its own text does too. */
.on-dark .bkg-panel__board { color: var(--ink); }
.on-dark .bkg-panel__board .bkg-status { color: var(--muted); }
.bkg-status a { text-decoration: underline; text-underline-offset: 2px; }

/* --------------------------------------------------------------------------
   The all-house board, in the picker above the bar
   -------------------------------------------------------------------------- */

/* Hung above the bar like the month grid, and as wide as the bar, so it reads as
   the same control opening up. The board brings its own padding. */
.bkg-popover--board { padding: 0; }
@media (min-width: 760px) {
  .bkg-popover--board { right: 0; width: auto; }
}
.bkg-popover--board[data-mode='sheet'] { max-width: 60rem; padding: 0; }
/* The month grid has Done. This has no such button, so the X stays on show. */
.bkg-popover--board[data-mode='anchored'] .bkg-popover__close { display: flex; }
/* On a phone the board is taller than the sheet, so it scrolls inside it. */
.bkg-popover--board > .bkg-board {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 1.25rem 1.5rem;
}
/* Short screens, where this is what keeps it above the bar. See _apply(). */
.bkg-popover--board.is-tight .bkg-legend,
.bkg-popover--board.is-tight .bkg-note { display: none; }
.bkg-popover--board.is-tight > .bkg-board { padding-block: .75rem; }

.bkg-board__head {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: .5rem;
  margin-bottom: 1rem; padding-right: 2.25rem;
}
.bkg-board__back { display: flex; align-items: center; gap: .25rem; }
/* In words, because a double arrow is easy to miss and this is the way home. */
.bkg-board__today {
  padding: .375rem .625rem;
  background: none; color: var(--ink); cursor: pointer;
  border: 1px solid var(--ink-20);
  font: 700 .625rem var(--font-body);
  letter-spacing: .12em; text-transform: uppercase;
}
.bkg-board__today:hover { background: var(--sand); }
.bkg-board__today:disabled {
  background: none; color: var(--muted-light); cursor: default;
  border-color: var(--ink-15);
}
.bkg-board__months {
  display: flex; flex-wrap: wrap;
  align-items: baseline; justify-content: center; gap: .5rem;
}
.bkg-board__month {
  border: 0; background: none; cursor: pointer; padding: 0;
  font: 400 1.125rem var(--font-display); color: var(--ink);
}
.bkg-board__spill { font: 400 1.125rem var(--font-display); color: var(--muted); }

/* Wider than a phone, so the strip scrolls sideways under a pinned name
   column rather than squeezing the days down to nothing. */
.bkg-board__scroll {
  overflow-x: auto; overscroll-behavior-x: contain;
  /* The bar sat across the bottom row of days. The month control, the arrows
     and a wheel or trackpad all still move the strip without it. */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.bkg-board__scroll::-webkit-scrollbar { width: 0; height: 0; }
.bkg-board__grid {
  --bkg-name: 132px;
  --bkg-cell: 27px;
  position: relative;
  display: grid;
  grid-template-columns: var(--bkg-name) repeat(var(--bkg-cols, 31), var(--bkg-cell));
  width: max-content; min-width: 100%;
  row-gap: 6px; column-gap: 0;
  align-items: stretch;
}
@media (min-width: 900px) {
  .bkg-board__grid { --bkg-name: 176px; --bkg-cell: 30px; }
}

.bkg-board__corner, .bkg-board__house {
  position: sticky; left: 0; z-index: 2;
  display: flex; align-items: center;
  padding-right: .75rem;
  background: var(--paper-warm);
  border-right: 1px solid var(--ink-15);
}
.bkg-board__inner { display: flex; flex-direction: column; gap: .125rem; }
.bkg-board__corner {
  font: 700 .594rem var(--font-body);
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  align-items: flex-end; padding-bottom: .5rem;
}
.bkg-board__name {
  font: 400 .9375rem var(--font-display); line-height: 1.2;
}
/* The house this page is about, and the three it could be swapped for: twice the
   height against half, as the owners asked. The free dates of the smaller rows are
   subdued so the eye goes to this house first, but stay well clear of the paler
   colour that means a date is gone. A stay chosen on one keeps its full strength. */
.bkg-board__cell.is-current {
  height: 60px;
  /* Capped in px: the columns are, so a large browser font would run the dates
     into each other. */
  font-size: 1.125rem; font-size: min(1.125rem, 18px);
}
.bkg-board__cell.is-other { height: 30px; font-size: .75rem; }
.bkg-board__cell.is-other:not(:disabled):not(.bkg-day--edge):not(.bkg-day--in-range) {
  color: var(--muted);
}
.bkg-board__house.is-current .bkg-board__name { font-size: 1.25rem; }
.bkg-board__house.is-other .bkg-board__name { font-size: .8125rem; color: var(--muted); }
.bkg-board__house.is-other .bkg-board__sleeps { font-size: .5rem; }
/* The site fades every link on hover, and this one is pinned over the strip: its
   background is what hides the days scrolling behind it, so it stays solid and
   only the name fades. */
a.bkg-board__house:hover { opacity: 1; }
a.bkg-board__house:hover .bkg-board__name { opacity: .75; }
a.bkg-board__house .bkg-board__name {
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-thickness: 1px; text-decoration-color: var(--ink-20);
}
.bkg-board__sleeps {
  font: 600 .594rem var(--font-body);
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}

.bkg-board__dow {
  font: 700 .594rem var(--font-body);
  letter-spacing: .04em; color: var(--muted);
  text-align: center; padding: .25rem 0 .5rem;
}

/* Cells sit flush so a run of booked nights reads as one band, with the
   changeover diagonals cutting its ends -- the same language as the calendar. */
.bkg-board__cell {
  height: 34px; width: 100%;
  font: 400 .8125rem var(--font-display);
}
.bkg-board__cell.bkg-day--booked { text-decoration: none; }
.bkg-board__cell:not(:disabled):hover { background-color: var(--sand); }
.bkg-board__cell.bkg-day--edge:hover { background-color: var(--bark); }
/* The turn of the month, marked where the numbers restart. */
.bkg-board__dow.is-month-start,
.bkg-board__cell.is-month-start { box-shadow: inset 1px 0 0 var(--ink-20); }

/* The message across every house past the end of the booking window. Absolute,
   so it takes no cell from the grid. Under the pinned names, which sit at 2. */
.bkg-board__closed {
  position: absolute; z-index: 1;
  top: 0; bottom: 0;
  left: calc(var(--bkg-name) + var(--bkg-cell) * var(--bkg-closed-from, 0));
  width: calc(var(--bkg-cell) * var(--bkg-closed-span, 1));
  display: flex; align-items: center;
  background: var(--paper-warm);
  box-shadow: inset 1px 0 0 var(--ink-20);
}
.bkg-board__closed[hidden] { display: none; }
/* Sticky at both ends, so it stays in the visible part of the run wherever the
   strip is scrolled. It first comes into view with only a few columns showing,
   and a line longer than those would be cut off at the edge of the strip. */
.bkg-board__closed-text {
  position: sticky; left: calc(var(--bkg-name) + .75rem); right: .75rem;
  max-width: 14rem; padding: 0 .75rem;
  font: 400 1rem/1.4 var(--font-display); color: var(--ink);
}
.bkg-board__closed-text a { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 719px) {
  .bkg-board__grid {
    --bkg-name: 0px;
    --bkg-cell: 32px;
    grid-template-columns: repeat(var(--bkg-cols, 31), var(--bkg-cell));
    row-gap: 0;
  }
  .bkg-board__corner { display: none; }
  .bkg-board__house {
    grid-column: 1 / -1;
    position: static;
    border-right: 0;
    padding: .875rem 0 .25rem;
    /* This row is the full width of the strip, so only the name itself is a link:
       a near miss on a date would otherwise leave the page. */
    pointer-events: none;
  }
  .bkg-board__house .bkg-board__inner { pointer-events: auto; }
  .bkg-board__house.is-other { padding-top: .375rem; }

  .bkg-board__inner {
    position: sticky; left: 0;
    flex-direction: row; align-items: baseline; gap: .5rem;
    width: max-content; padding-right: .75rem;
    background: var(--paper-warm);
    z-index: 2;
  }
  /* The names sit between the rows here, right across the message, so the text
     has to come up over them. No z-index on the band, or it would hold the text
     underneath with it. */
  .bkg-board__closed { z-index: auto; }
  .bkg-board__closed-text {
    z-index: 3;
    max-width: 14rem;
    max-width: min(14rem, calc(100vw - 5.5rem));
    padding: .5rem .625rem;
    background: var(--paper-warm);
    box-shadow: 0 0 0 1px var(--ink-20);
    font-size: .9375rem;
  }
  /* Two arrows, the month, Today and the X do not fit on one line of a phone, and
     the Next arrow is what gets pushed under the X. Today takes a line of its own. */
  .bkg-board__back { display: contents; }
  .bkg-board__today { grid-row: 2; grid-column: 2; justify-self: center; }
  /* Keep the month line and its arrows on one row, whatever the strip is showing.
     The second month in the label is what used to push the Next arrow under the X,
     where a tap closed the board and lost the pick. */
  .bkg-board__head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .bkg-board__months { flex-wrap: nowrap; white-space: nowrap; min-width: 0; }
  .bkg-board__month { font-size: .875rem; max-width: 100%; }
  .bkg-board__spill { display: none; }
  .bkg-board__head { padding-right: 2.5rem; gap: .25rem; }
}

/* The smallest phones: the month name needs what the arrows can spare, and the
   Next arrow must stay clear of the X. Still taller than a finger needs. */
@media (max-width: 359.98px) {
  .bkg-board__head .bkg-cal__nav { width: 32px; min-width: 32px; }
}

/* This line comes and goes constantly -- every month paged to and every span
   the board scrolls in fetches again -- so hold its height open everywhere it
   appears. Losing a line walks the popover (which grows upward from the bar) up
   and down under the cursor. */
.bkg-status { line-height: 1.4; min-height: 1.4em; }

.bkg-board__foot {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .875rem 1.25rem;
  margin-top: 1.125rem; padding-top: .875rem;
  border-top: 1px solid var(--ink-15);
}
.bkg-board__foot .bkg-legend { order: -1; flex: 1 0 100%; }
.bkg-board__foot .bkg-note { order: -1; flex: 1 0 100%; margin-top: 0; }
.bkg-board__summary { font: 400 1rem var(--font-display); flex: 1 1 14rem; }

/* Without JS the elements render nothing useful, so offer a direct link. */
.bkg-nojs {
  display: block; padding: 1.25rem;
  background: var(--paper-warm); border: 1px solid var(--ink-20);
  font: 500 .875rem var(--font-body);
  /* The colour is not decoration. Both fallbacks set a background and, until
     now, no colour -- so on the home hero and any .on-dark section the text
     inherited the cream it was sitting on and measured 1.08:1. That is the one
     link a visitor gets when booking.js is dead, and it was invisible exactly
     where it was the only one on the page. */
  color: var(--ink);
}

/* booking.js never arrived: an ad-blocker filter list, a corporate proxy, a CDN
   404, a truncated response, one syntax error on an engine that chokes on the
   file. The <noscript> above does not cover that and never could -- scripting
   is ON, it just failed, so <noscript> content stays inert markup. Measured
   with booking.js blocked, the page offered zero links to the booking
   provider: an empty cream band where the picker should be, and no route to a
   booking at all on any of the five pages that book anything.

   So build_pages.py writes a real, parsed child inside every <booking-bar> and
   <booking-calendar> (booking_fallback()), and this hides it unless the
   element is still undefined. :not(:defined) is the precise condition, because
   customElements.define at the foot of booking.js (booking.js:2679) is the
   last thing that file does -- if it did not arrive, or the engine has no
   custom elements at all, the element never leaves :not(:defined) and the link
   stands.

   Nothing has to remove it: both connectedCallbacks clear their light DOM
   (booking.js:1367, booking.js:1945), so an upgraded element drops the node
   and a double link is impossible.

   On a normal load this never paints. booking.js is deferred, but the
   elements are defined before the reveal rule reaches a frame: measured with
   an animationstart probe on the reveal selector, booking-bar is defined at
   ~40ms and the probe never fires at all. Delay booking.js by 400ms and the
   three fallbacks on a property page are revealed at 40ms and stay up until
   430ms -- which is the whole point, not a regression. A slow script should
   leave a way to book, not a gap.

   The declarations sit on the reveal selector rather than on .bkg-fallback, so
   there is no same-specificity ordering question with the display:none above.
   The look is borrowed from .bkg-nojs so the two failure modes present
   identically. */
.bkg-fallback { display: none; }
booking-bar:not(:defined) .bkg-fallback,
booking-calendar:not(:defined) .bkg-fallback {
  display: block; padding: 1.25rem;
  background: var(--paper-warm); border: 1px solid var(--ink-20);
  font: 500 .875rem var(--font-body);
  color: var(--ink);   /* see .bkg-nojs above: without this it is cream on cream */
}
