/* The stay calendar in the glass card: a frosted glass card on a warm night, two soft lights behind it and a fine
   grain. Each month is a grid of buttons (number and price of the night); under them a layer of its own holds the
   brushstroke of light and the two caps of arrival and departure, moved by script.js. */
:root {
  --page: #0b0b0d;            /* the night behind */
  --light-a: #c9772f;         /* the warm light behind the glass */
  --light-b: #2f5f66;         /* the cool light on the other side */
  --glass: rgba(26, 24, 24, 0.52); /* the body of the glass card */
  --edge: rgba(255, 255, 255, 0.12); /* its edge */
  --ink: #f3eee7;             /* the numbers and words */
  --muted: #8f8880;           /* the small words and the prices */
  --accent: #f2c27b;          /* the light of the stay: champagne */
  --accent-deep: #d98b3a;     /* the warm end of the brushstroke */
  --cap-ink: #1a1410;         /* the number on the arrival and departure caps */
  --booked: #5a554f;          /* the nights already booked */
  --cell: clamp(27px, 7.6vh, 44px); /* the height of a day */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

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

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

/* the grain over everything */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  z-index: 5;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 2px;
}

p {
  margin: 0;
}

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

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 12px 16px;
  overflow: hidden;
  isolation: isolate;
}

/* the two lights behind the glass */
.glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(70vw, 70vh, 520px);
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(min(9vw, 9vh, 70px));
  z-index: -1;
}

.glow--a {
  margin: calc(min(70vw, 70vh, 520px) * -0.78) 0 0 calc(min(70vw, 70vh, 520px) * -0.86);
  background: radial-gradient(circle, var(--light-a), transparent 66%);
  opacity: 0.7;
}

.glow--b {
  margin: calc(min(70vw, 70vh, 520px) * -0.2) 0 0 calc(min(70vw, 70vh, 520px) * -0.1);
  background: radial-gradient(circle, var(--light-b), transparent 66%);
  opacity: 0.55;
}

/* the glass card */
.cal {
  --mx: 30%;
  --my: 0%;
  position: relative;
  width: min(100%, 372px);
  min-width: 0;
  padding: clamp(10px, 2.6vh, 18px) clamp(12px, 4vw, 18px) clamp(10px, 2.4vh, 16px);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015) 40%, rgba(255, 255, 255, 0)),
    var(--glass);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  backdrop-filter: blur(26px) saturate(150%);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 1px 1px rgba(0, 0, 0, 0.3),
    0 18px 40px -16px rgba(0, 0, 0, 0.7),
    0 50px 90px -40px rgba(0, 0, 0, 0.8);
  opacity: 0;
}

/* the light on the glass that follows the pointer */
.cal__shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(260px 180px at var(--mx) var(--my), rgba(255, 236, 205, 0.09), transparent 70%);
  -webkit-mask: linear-gradient(#000, #000);
}

.cal__shine::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(180px 120px at var(--mx) var(--my), rgba(255, 226, 180, 0.55), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

.cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cal__brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cal__name {
  font-size: 14px;
  font-weight: 620;
  font-variation-settings: 'wdth' 108;
  letter-spacing: 0.005em;
}

.cal__where {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal__rate {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  font-size: 11.5px;
  font-weight: 560;
  padding: 4px 9px 4px 7px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.cal__rate svg {
  width: 11px;
  height: 11px;
  fill: var(--accent);
}

.cal__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: clamp(8px, 2vh, 14px);
  height: 28px;
}

.cal__nav {
  position: relative;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: background-color 0.25s;
}

.cal__nav svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cal__nav.is-hot {
  background: rgba(255, 255, 255, 0.1);
}

@media (hover: hover) {
  .cal__nav:hover {
    background: rgba(255, 255, 255, 0.1);
  }
}

.cal__month {
  position: relative;
  flex: 1;
  height: 20px;
  overflow: hidden;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  font-variation-settings: 'wdth' 104;
}

.cal__month span {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  line-height: 20px;
}

.cal__month em {
  font-style: normal;
  color: var(--muted);
  font-weight: 480;
}

.cal__week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-top: clamp(4px, 1.4vh, 10px);
  height: 16px;
  font-size: 10px;
  font-weight: 560;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cal__week .we {
  color: color-mix(in srgb, var(--accent) 60%, var(--muted));
}

/* the window of the months: the grids slide inside it */
.cal__view {
  position: relative;
  height: calc(var(--cell) * 6);
  margin-top: 2px;
  overflow: hidden;
  -webkit-mask: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}

.month {
  position: absolute;
  inset: 0;
}

.month__grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: var(--cell);
}

/* the layer of the light, under the days */
.month__light {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.stroke {
  position: absolute;
  height: calc(var(--cell) * 0.78);
  margin-top: calc(var(--cell) * 0.11);
  border-radius: 999px;
  overflow: hidden;
  opacity: 0;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent-deep) 34%, transparent),
    color-mix(in srgb, var(--accent) 26%, transparent));
  box-shadow: inset 0 1px 0 rgba(255, 230, 190, 0.18), 0 0 18px -4px color-mix(in srgb, var(--accent-deep) 50%, transparent);
}

/* the bristles of the brush: hairlines along the stroke */
.stroke::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, rgba(255, 235, 200, 0.07) 0 1px, transparent 1px 3px);
  -webkit-mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

/* the light that runs along the stroke (its position is --sx, in pixels) */
.stroke::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--sx, -200px);
  width: 90px;
  margin-left: -45px;
  background: linear-gradient(90deg, transparent, rgba(255, 238, 205, var(--sa, 0)), transparent);
  filter: blur(4px);
}

.stroke.cut-l {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  -webkit-mask: linear-gradient(90deg, transparent, #000 18px);
  mask: linear-gradient(90deg, transparent, #000 18px);
}

.stroke.cut-r {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  -webkit-mask: linear-gradient(270deg, transparent, #000 18px);
  mask: linear-gradient(270deg, transparent, #000 18px);
}

.stroke.cut-l.cut-r {
  -webkit-mask: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 18px), transparent);
  mask: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 18px), transparent);
}

/* the caps of arrival and departure */
.cap {
  position: absolute;
  height: calc(var(--cell) * 0.9);
  margin-top: calc(var(--cell) * 0.05);
  border-radius: 12px;
  opacity: 0;
  background: linear-gradient(180deg, #fbe3bb, var(--accent) 55%, #e9ac5f);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 0 rgba(120, 70, 20, 0.35),
    0 6px 16px -6px color-mix(in srgb, var(--accent-deep) 80%, transparent),
    0 0 0 1px rgba(255, 220, 170, 0.25);
}

/* a day: number and price of the night */
.day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  border-radius: 12px;
  transition: color 0.25s;
}

.day__n {
  font-size: clamp(11.5px, 3.1vh, 14px);
  font-weight: 540;
  line-height: 1;
  transition: color 0.25s, font-weight 0.25s;
}

.day__p {
  font-size: clamp(8px, 2.1vh, 9.5px);
  font-weight: 480;
  line-height: 1;
  color: var(--muted);
  letter-spacing: 0.01em;
  transition: color 0.25s;
}

.day.is-high .day__p {
  color: color-mix(in srgb, var(--accent) 70%, var(--muted));
}

.day.is-out {
  pointer-events: none;
}

.day.is-out .day__n {
  color: rgba(255, 255, 255, 0.16);
}

.day.is-out .day__p {
  opacity: 0;
}

/* a night already booked: dim, with one thin line across */
.day.is-booked {
  cursor: default;
}

.day.is-booked .day__n {
  color: var(--booked);
}

.day.is-booked .day__p {
  opacity: 0;
}

.day.is-booked::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 1px;
  margin: -1px 0 0 -11px;
  background: var(--booked);
  transform: rotate(-32deg);
}

.day.is-booked.is-cap::after {
  display: none;
}

.book.is-hot .book__face {
  filter: brightness(1.07);
}

.day.is-in .day__n {
  color: #fff6ea;
}

.day.is-in .day__p {
  color: color-mix(in srgb, var(--accent) 85%, #fff);
}

.day.is-cap .day__n {
  color: var(--cap-ink);
  font-weight: 660;
}

.day.is-cap .day__p {
  color: color-mix(in srgb, var(--cap-ink) 70%, transparent);
}

.day.is-hot:not(.is-cap) {
  background: rgba(255, 255, 255, 0.06);
}

@media (hover: hover) {
  .day:not(.is-booked):not(.is-cap):hover {
    background: rgba(255, 255, 255, 0.06);
  }
}

/* the foot: nights, total and the button */
.cal__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(6px, 1.6vh, 12px);
  padding-top: clamp(8px, 1.8vh, 12px);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}

.sum {
  flex: 1;
  min-width: 0;
}

.sum__nights {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 15px;
  font-weight: 620;
  line-height: 20px;
  height: 20px;
  transition: opacity 0.3s;
}

.sum__word {
  font-weight: 520;
}

.sum__dates {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 0;
}

.sum__dates > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sum__clear {
  font-size: 11px;
  font-weight: 560;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  padding: 2px 6px;
  margin-left: -2px;
  border-radius: 6px;
  transition: opacity 0.3s, background-color 0.25s;
}

.is-picked .sum__clear {
  opacity: 0.75;
  pointer-events: auto;
}

.sum__clear.is-hot {
  background: rgba(255, 255, 255, 0.1);
}

@media (hover: hover) {
  .sum__clear:hover {
    background: rgba(255, 255, 255, 0.1);
  }
}

.is-empty .sum__nights,
.is-empty .tot__value {
  opacity: 0.38;
}

.tot {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: none;
}

.tot__label {
  font-size: 10px;
  font-weight: 560;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.tot__value {
  display: flex;
  align-items: baseline;
  font-size: 18px;
  font-weight: 640;
  font-variation-settings: 'wdth' 96;
  letter-spacing: -0.01em;
  line-height: 22px;
  height: 22px;
  transition: opacity 0.3s;
}

.tot__cur {
  font-size: 14px;
  margin-right: 1px;
  color: var(--accent);
}

/* the odometer: one window per digit over a column 0-9 and 0 again */
.odo {
  display: inline-flex;
  overflow: hidden;
  height: 1.25em;
  line-height: 1.25em;
  font-variant-numeric: proportional-nums;
}

.odo__d {
  position: relative;
  display: block;
  width: 0.62em;
  overflow: hidden;
  transition: width 0.3s;
}

.odo__d.is-lead {
  width: 0;
}

.odo__col {
  display: block;
  text-align: center;
}

.odo__col span {
  display: block;
}

.book {
  position: relative;
  flex: none;
  height: 36px;
  border-radius: 999px;
}

.book__face {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 15px;
  border-radius: inherit;
  font-size: 12.5px;
  font-weight: 620;
  font-variation-settings: 'wdth' 104;
  color: var(--cap-ink);
  background: linear-gradient(180deg, #fff4e2, #f0d3a6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(120, 70, 20, 0.25),
    0 8px 18px -8px color-mix(in srgb, var(--accent-deep) 90%, transparent);
  transition: filter 0.3s, opacity 0.3s;
}

.book:disabled {
  cursor: default;
}

.book:disabled .book__face {
  filter: saturate(0) brightness(0.55);
  opacity: 0.55;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.book__icon {
  width: 0;
  height: 14px;
  fill: none;
  stroke: var(--cap-ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: width 0.3s;
}

.is-done .book__icon {
  width: 14px;
}

.book__check {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

/* the drawn pointer */
.hand {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -5px;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

.hand path {
  fill: #fff;
  stroke: #1a1410;
  stroke-width: 1.3;
  stroke-linejoin: round;
}
