/* The booking calendar: two months (one on a phone) to choose an arrival and a departure. The stay is a band that
   fills up day after day, the booked nights are struck through, and below the nights and the total count up. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #111111;           /* text, and the arrival and departure */
  --muted: #8b8b92;
  --line: rgba(17, 17, 17, 0.09);
  --band: #efece4;          /* the stay */
  --hint: #f5f3ee;          /* the stay while it is only being pointed at */
  --cell: 48px;             /* a day */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Figtree Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

/* ---------------------------------------------------------------- the picker */
.picker {
  position: relative;
  padding: 24px 28px 20px;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line), 0 40px 80px -44px rgba(17, 17, 17, 0.28);
}

.picker__head {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.picker__nav {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.picker__nav svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.picker__nav:disabled {
  opacity: 0.25;
  cursor: default;
}

@media (hover: hover) and (pointer: fine) {
  .picker__nav:not(:disabled):hover,
  .picker__clear:hover {
    background: #f2f1ee;
  }
}

.picker__nav:focus-visible,
.picker__clear:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* the months: the new page lies on top of the old one while they slide */
.picker__months {
  overflow: hidden;
}

/* the row of months: during a change of month it holds one more and moves by one */
.picker__page {
  display: flex;
  gap: 40px;
  width: max-content;
}

.month__title {
  margin: 8px 0 16px;
  font-size: 16px;
  font-weight: 680;
  text-align: center;
}

.month__week,
.month__days {
  display: grid;
  grid-template-columns: repeat(7, var(--cell));
}

.month__week span {
  padding-bottom: 8px;
  font-size: 11.5px;
  font-weight: 640;
  text-align: center;
  color: var(--muted);
}

/* ---------------------------------------------------------------- a day */
.day {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  height: 54px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.day--blank {
  pointer-events: none;
}

/* the band of the stay: a day inside is all band, the arrival has it from its middle, the departure up to its middle */
.day__band {
  position: absolute;
  left: 0;
  right: 0;
  top: 6px;
  bottom: 6px;
  z-index: -2;
  background: var(--band);
  opacity: 0;
  transform-origin: 0 50%;
  transition: opacity 0.25s ease, background-color 0.25s ease;
}

.day.is-in .day__band,
.day.is-from .day__band,
.day.is-to .day__band {
  opacity: 1;
}

.day.is-from .day__band {
  left: 50%;
}

.day.is-to .day__band {
  right: 50%;
}

.picker.is-hinting .day__band {
  background: var(--hint);
}

/* an arrival at the end of a week (or of the month) has nothing to join on its right, and a departure at the start of
   one nothing on its left: their half band would only peek out from behind the disc */
.day.is-from[data-col='6'] .day__band,
.day.is-from[data-edge~='last'] .day__band,
.day.is-to[data-col='0'] .day__band,
.day.is-to[data-edge~='first'] .day__band {
  opacity: 0;
}

/* the band is round where a week, or the month, begins or ends */
.day[data-col='0'] .day__band,
.day[data-edge~='first'] .day__band {
  border-top-left-radius: 999px;
  border-bottom-left-radius: 999px;
}

.day[data-col='6'] .day__band,
.day[data-edge~='last'] .day__band {
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
}

/* the arrival and the departure: a black disc */
.day__disc {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -1;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0;
}

.day.is-start .day__disc,
.day.is-end .day__disc {
  opacity: 1;
}

.day.is-start,
.day.is-end {
  color: #fff;
}

/* under the pointer, a ring */
.day::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--ink);
  opacity: 0;
  transform: scale(0.82);
  transition: opacity 0.18s ease, transform 0.3s cubic-bezier(0.34, 1.6, 0.5, 1);
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .day:not([aria-disabled='true']):not(.is-start):not(.is-end):hover::after {
    opacity: 1;
    transform: none;
  }
}

.day:focus-visible {
  outline: none;
}

.day:focus-visible::after {
  opacity: 1;
  transform: none;
  box-shadow: inset 0 0 0 2px var(--ink), 0 0 0 2px #fff, 0 0 0 4px var(--ink);
}

.day__num {
  font-size: 14.5px;
  font-weight: 620;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.day__price {
  font-size: 10px;
  font-weight: 560;
  line-height: 1;
  color: var(--muted);
  transition: color 0.2s ease;
}

.day.is-start .day__price,
.day.is-end .day__price {
  color: rgba(255, 255, 255, 0.7);
}

/* past days and booked nights can't be chosen; a booked night is struck through */
.day[aria-disabled='true'] {
  color: #c2c2c7;
  cursor: default;
}

.day[aria-disabled='true'] .day__price {
  visibility: hidden;
}

.day.is-booked .day__num {
  position: relative;
}

.day.is-booked .day__num::after {
  content: '';
  position: absolute;
  left: -5px;
  right: -5px;
  top: 50%;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  transform: rotate(-32deg);
}

/* ---------------------------------------------------------------- the line below */
.picker__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.picker__sum {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  min-height: 1.4em;
  margin: 0;
  font-size: 14.5px;
  color: var(--muted);
}

.picker__sum b {
  font-weight: 680;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.picker__clear {
  flex: none;
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.picker__clear:disabled {
  opacity: 0.3;
  cursor: default;
}

@media (max-width: 759px) {
  :root {
    --cell: min(48px, calc((100vw - 32px - 36px) / 7));
  }

  .picker {
    padding: 22px 18px 16px;
  }

  .picker__head {
    top: 16px;
    left: 10px;
    right: 10px;
  }
}
