/* The campsite calendar: a month of pitches on a meadow seen from above. The arrival rolls a tent onto its pitch,
   the departure pitches it over the nights, and the night falls on the nights of the stay with its stars. */
:root {
  --page: #ffffff;          /* the page */
  --paper: #f6f1e5;         /* the card */
  --ink: #23301f;           /* text */
  --muted: #8b8572;
  --line: rgba(35, 48, 31, 0.1);
  --grass: #5a8a45;         /* the meadow */
  --grass-deep: #4b7839;
  --path: #d9c9a0;          /* the tracks between the rows of pitches */
  --lawn: #7eae5b;          /* a pitch, mown in stripes */
  --lawn-2: #74a453;
  --dry: #c8bf8e;           /* a pitch whose day is gone */
  --plaque: #ecdcb7;        /* the wooden plaque with the number */
  --plaque-ink: #3c2f1d;
  --tent: #ee7a3c;          /* the tent: its sunny side, and the side in shade */
  --tent-shade: #c9551f;
  --seam: #8f3812;          /* the hoops */
  --glow: #ffcf73;          /* the tent at night, lit from inside */
  --glow-shade: #ec8a30;
  --night: #172447;         /* the nights of the stay */
  --night-2: #26386b;
  --star: #fff4cf;
  --rope: #f7efd9;          /* the guy ropes */
  --peg: #5b4630;
  --cell: 58px;             /* a pitch */
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Bricolage Grotesque 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 card */
.camp {
  --gap-x: 5px;
  --gap-y: 12px;
  --pad: 10px;
  position: relative;
  padding: 18px 20px 16px;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--line), 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 44px 80px -46px rgba(35, 48, 31, 0.45);
}

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

.camp__month {
  margin: 0;
  font-size: 19px;
  font-weight: 720;
  font-variation-settings: 'wdth' 92;
  letter-spacing: -0.01em;
  text-align: center;
}

.camp__nav {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.7, 0.5, 1);
}

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

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

.camp__nav:not(:disabled):active {
  transform: scale(0.88);
}

@media (hover: hover) and (pointer: fine) {
  .camp__nav:not(:disabled):hover,
  .camp__clear:not(:disabled):hover {
    background: rgba(35, 48, 31, 0.07);
  }
}

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

.camp__week {
  display: grid;
  grid-template-columns: repeat(7, var(--cell));
  column-gap: var(--gap-x);
  padding: 0 var(--pad) 8px;
}

.camp__week span {
  font-size: 11.5px;
  font-weight: 650;
  text-align: center;
  color: var(--muted);
}

/* ---------------------------------------------------------------- the meadow */
.camp__meadow {
  position: relative;
  padding: var(--pad);
  border-radius: 20px;
  background: var(--grass);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), inset 0 10px 24px -14px rgba(0, 0, 0, 0.35);
}

.camp__grass {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* the pitches, the trees and the tents: the tents lie on the pitches, under their plaques */
.camp__grid {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(7, var(--cell));
  grid-auto-rows: calc(var(--cell) * 0.94);
  column-gap: var(--gap-x);
  row-gap: var(--gap-y);
}

.camp__tents {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

/* ---------------------------------------------------------------- a pitch */
.pitch {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  color: var(--plaque-ink);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.pitch__lawn,
.pitch__night {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 9px;
}

.pitch__lawn {
  background: repeating-linear-gradient(90deg, var(--lawn) 0 7px, var(--lawn-2) 7px 14px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 -2px 0 rgba(0, 0, 0, 0.08);
  transition: background 0.3s ease;
}

.pitch__night {
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, var(--night-2), var(--night));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  opacity: 0;
}

.pitch__star {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  fill: var(--star);
  transform: scale(0);
}

/* the wooden plaque with the number, in the top left corner: always above the tents */
.pitch__plaque {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 3;
  min-width: 19px;
  padding: 2px 4px 2px;
  border-radius: 5px;
  background: var(--plaque);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18), inset 0 -1px 0 rgba(0, 0, 0, 0.08);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.pitch[aria-current='date'] .pitch__plaque {
  background: var(--plaque-ink);
  color: var(--plaque);
}

/* someone else's tent, on a pitch already booked */
.pitch__other {
  position: absolute;
  left: 50%;
  bottom: 8%;
  z-index: 1;
  width: 84%;
  aspect-ratio: 100 / 80;
  transform: translateX(-50%);
  overflow: visible;
}

/* under the pointer, a ring; along the stay that would come out, a dashed line marks the pitches */
.pitch::after {
  content: '';
  position: absolute;
  inset: -3px;
  z-index: 3;
  border-radius: 12px;
  box-shadow: 0 0 0 2px var(--rope);
  opacity: 0;
  transform: scale(0.9);
  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) {
  .pitch:not([aria-disabled='true']):hover::after {
    opacity: 1;
    transform: none;
  }
}

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

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

.pitch.is-hint .pitch__lawn {
  box-shadow: inset 0 0 0 1.5px rgba(255, 250, 230, 0.85), inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

/* gone days are dry grass, and they and the booked pitches can't be chosen */
.pitch[aria-disabled='true'] {
  cursor: default;
}

.pitch.is-past .pitch__lawn {
  background: repeating-linear-gradient(90deg, var(--dry) 0 7px, color-mix(in srgb, var(--dry) 90%, #000) 7px 14px);
  opacity: 0.55;
}

.pitch.is-past .pitch__plaque {
  opacity: 0.5;
}

.pitch.is-booked .pitch__plaque span {
  position: relative;
}

.pitch.is-booked .pitch__plaque span::after {
  content: '';
  position: absolute;
  left: -3px;
  right: -3px;
  top: 52%;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  transform: rotate(-30deg);
}

/* a day outside the month: only grass, and a tree */
.blank {
  position: relative;
  pointer-events: none;
}

.blank svg {
  position: absolute;
  inset: -8%;
  width: 116%;
  height: 116%;
  overflow: visible;
}

/* ---------------------------------------------------------------- the line below */
.camp__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.camp__sum {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 14px;
  min-height: 2.6em;
  align-content: center;
  margin: 0;
  font-size: 14.5px;
  color: var(--muted);
}

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

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

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

@media (max-width: 559px) {
  .camp {
    --gap-x: 3px;
    --gap-y: 9px;
    --pad: 7px;
    --cell: min(58px, calc((100vw - 32px - 24px - 14px - 18px) / 7));
    padding: 14px 12px 12px;
    border-radius: 24px;
  }

  .camp__meadow {
    border-radius: 16px;
  }

  .pitch__plaque {
    top: 3px;
    left: 3px;
    min-width: 17px;
    padding: 1px 3px;
    font-size: 10px;
  }

  .camp__sum {
    font-size: 13.5px;
  }
}
