/* Campsite pitch picker: the pitch map of Larchwood Camp, an invented campsite, alone on white. A white card with a
   layered shadow; a small drawn map with the meadow, the path, the lake and the wood just hinted; tent, camper and
   glamping pitches that lift on hover with a card, set up on a spring when chosen, and the booking bar below. */
:root {
  --page: #ffffff;          /* the page */
  --card: #ffffff;          /* the card */
  --ink: #17211a;           /* the words */
  --muted: #7c857d;         /* the small words */
  --line: #e4e8e1;          /* thin lines */
  --meadow: #f1f4ec;        /* the meadow */
  --pitch: #ffffff;         /* a free pitch */
  --pitch-edge: #d3d9cf;    /* the edge of a free pitch */
  --taken: #b9bfb6;         /* a booked pitch */
  --accent: #2f6b45;        /* the forest green: the chosen pitch, the ring and the button */
  --accent-soft: #e6f0e8;   /* the chosen pitch, filled */
  --button-ink: #ffffff;    /* the words on the lit button */
}

* {
  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;
}

button {
  font: inherit;
  color: inherit;
}

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

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the card */
.picker {
  position: relative;
  width: min(380px, calc(100vw - 24px), calc((100vh - 150px) * 1.6 + 32px));
  margin: 0;
  padding: clamp(12px, 3.4vh, 18px) clamp(12px, 4vw, 16px) clamp(12px, 3.2vh, 16px);
  border-radius: 24px;
  background: var(--card);
  box-shadow:
    0 0 0 1px rgba(23, 33, 26, 0.06),
    0 1px 1px rgba(23, 33, 26, 0.04),
    0 4px 8px -2px rgba(23, 33, 26, 0.05),
    0 18px 36px -14px rgba(23, 33, 26, 0.14),
    0 44px 70px -40px rgba(47, 107, 69, 0.32);
  opacity: 0;
  user-select: none;
  -webkit-user-select: none;
}

/* the 1px edge that catches the light at the top */
.picker::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(23, 33, 26, 0.05) 40%, rgba(23, 33, 26, 0.02));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.picker__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: clamp(8px, 2.4vh, 12px);
}

.picker__brand {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 3px;
  font-size: 10.5px;
  font-weight: 620;
  font-stretch: 112%;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.picker__pine {
  width: 12px;
  height: 12px;
  fill: var(--accent);
}

.picker__trunk {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-linecap: round;
}

.picker__title {
  margin: 0;
  font-size: clamp(15px, 4.4vh, 18px);
  font-weight: 640;
  font-stretch: 104%;
  letter-spacing: -0.015em;
  line-height: 1.1;
}

.picker__free {
  margin: 0 0 1px;
  font-size: 11px;
  font-weight: 520;
  color: var(--muted);
  white-space: nowrap;
}

.picker__free span:first-child {
  color: var(--ink);
  font-weight: 640;
}

/* ---------------------------------------------------------------- the map */
.map {
  position: relative;
  aspect-ratio: 320 / 200;
  width: 100%;
  border-radius: 16px;
  box-shadow: inset 0 1px 2px rgba(23, 33, 26, 0.04);
}

.map__ground {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.map__edge {
  fill: none;
  stroke: rgba(23, 33, 26, 0.07);
}

.map__grass path {
  stroke: #dfe6d7;
  stroke-width: 0.8;
  stroke-linecap: round;
  fill: none;
}

.map__lake {
  stroke: none;
}

.map__shore {
  fill: none;
  stroke: #c9dae0;
  stroke-width: 1;
}

.map__ripples path {
  fill: none;
  stroke: #c5d7de;
  stroke-width: 0.9;
  stroke-linecap: round;
}

.map__path {
  fill: none;
  stroke: #ebe6da;
  stroke-width: 9;
  stroke-linecap: round;
}

.map__path-line {
  fill: none;
  stroke: #d9d1bf;
  stroke-width: 0.9;
  stroke-dasharray: 2.4 3.2;
  stroke-linecap: round;
}

.map__wood circle {
  fill: #e4ebdd;
  stroke: #d4dfcb;
  stroke-width: 0.8;
}

.map__office rect {
  fill: #ffffff;
  stroke: #d3d9cf;
  stroke-width: 0.9;
}

.map__office path {
  fill: none;
  stroke: #c6cdc1;
  stroke-width: 0.9;
  stroke-linejoin: round;
}

.map__label {
  font-size: 6.6px;
  font-weight: 560;
  font-stretch: 112%;
  letter-spacing: 0.06em;
  fill: #9aa597;
  text-transform: uppercase;
}

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

/* ---------------------------------------------------------------- the pitches */
.pitch {
  position: absolute;
  display: block;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.pitch[aria-disabled='true'] {
  cursor: not-allowed;
}

/* the shadow on the grass, under the pitch that lifts */
.pitch__shadow {
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 2%;
  height: 34%;
  border-radius: 50%;
  background: rgba(23, 40, 28, 0.32);
  filter: blur(4px);
  opacity: 0;
  pointer-events: none;
}

.pitch__lift {
  position: absolute;
  inset: 0;
  display: block;
}

.pitch__lift svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.pitch__base {
  fill: var(--pitch);
  stroke: var(--pitch-edge);
  stroke-width: 0.9;
  transition: fill 0.3s ease, stroke 0.3s ease;
}

.pitch__ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  opacity: 0;
}

.pitch__icon path,
.pitch__icon rect,
.pitch__icon circle {
  fill: none;
  stroke: #8c958b;
  stroke-width: 1.15;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.25s ease, fill 0.25s ease;
}

.pitch__icon .fill {
  fill: #eef1eb;
}

.pitch__id {
  font-size: 5.8px;
  font-weight: 640;
  font-stretch: 108%;
  letter-spacing: 0.04em;
  fill: #8c958b;
  transition: fill 0.25s ease;
}

.pitch.is-on .pitch__base {
  fill: var(--accent-soft);
  stroke: rgba(47, 107, 69, 0.35);
}

.pitch.is-on .pitch__icon path,
.pitch.is-on .pitch__icon rect,
.pitch.is-on .pitch__icon circle {
  stroke: var(--accent);
}

.pitch.is-on .pitch__icon .fill {
  fill: #ffffff;
}

.pitch.is-on .pitch__id {
  fill: var(--accent);
}

.pitch.is-booked .pitch__base {
  fill: url(#hatch);
  stroke: #dadfd6;
  stroke-dasharray: 2 1.6;
}

.pitch.is-booked .pitch__icon {
  opacity: 0.45;
}

.pitch.is-booked .pitch__id {
  fill: #a8afa5;
}

.pitch__lock rect,
.pitch__lock path {
  fill: none;
  stroke: #9aa197;
  stroke-width: 0.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pitch__lock .badge {
  fill: #ffffff;
  stroke: #dfe3dc;
  stroke-width: 0.7;
}

/* focus you can see, from the keyboard */
.pitch:focus-visible .pitch__base {
  stroke: var(--accent);
  stroke-width: 1.3;
}

.pitch:focus-visible::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: var(--focus-radius, 7px);
  box-shadow: 0 0 0 2px rgba(47, 107, 69, 0.28);
  pointer-events: none;
}

/* ---------------------------------------------------------------- the card over a pitch */
.tip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  pointer-events: none;
  visibility: hidden;
}

.tip__card {
  position: relative;
  min-width: 132px;
  padding: 8px 10px 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 0 1px rgba(23, 33, 26, 0.07),
    0 2px 4px rgba(23, 33, 26, 0.05),
    0 12px 26px -10px rgba(23, 33, 26, 0.26);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
}

.tip__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.tip__top strong {
  font-weight: 660;
  font-size: 11.5px;
  letter-spacing: -0.005em;
}

.tip__type {
  font-size: 10px;
  font-weight: 560;
  font-stretch: 110%;
  color: var(--muted);
}

.tip__row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.tip__price b {
  color: var(--ink);
  font-weight: 640;
}

.tip.is-booked .tip__row {
  color: #9aa197;
}

.tip__tags {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.tip__tags:empty {
  display: none;
}

.tip__tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px 2px 4px;
  border-radius: 6px;
  background: #f1f5f0;
  color: #4b5a4e;
  font-size: 9.5px;
  font-weight: 580;
  font-stretch: 106%;
}

.tip__tag svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tip__nub {
  position: absolute;
  left: var(--nub, 50%);
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  background: inherit;
  transform: rotate(45deg);
  box-shadow: 1px 1px 0 rgba(23, 33, 26, 0.07);
  bottom: -4px;
}

.tip.is-below .tip__nub {
  bottom: auto;
  top: -4px;
  box-shadow: -1px -1px 0 rgba(23, 33, 26, 0.07);
}

/* ---------------------------------------------------------------- the booking bar */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: clamp(8px, 2.6vh, 14px);
  padding-top: clamp(8px, 2.6vh, 14px);
  border-top: 1px solid var(--line);
}

.bar__text {
  min-width: 0;
}

.bar__main {
  margin: 0;
  font-size: 12.5px;
  font-weight: 640;
  letter-spacing: -0.005em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  transition: color 0.3s ease;
}

.bar__main span {
  display: inline-block;
}

.bar.is-lit .bar__main {
  color: var(--ink);
}

.bar__sub {
  margin: 2px 0 0;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.reserve {
  position: relative;
  flex: none;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.reserve[aria-disabled='true'] {
  cursor: default;
}

.reserve__face {
  position: relative;
  display: grid;
  height: 100%;
  padding: 0 14px 0 16px;
  border-radius: inherit;
  overflow: hidden;
  background: #eff1ed;
  color: #a2a99f;
  font-size: 12.5px;
  font-weight: 620;
  font-stretch: 104%;
  box-shadow: inset 0 0 0 1px rgba(23, 33, 26, 0.04);
  transition: background-color 0.35s ease, color 0.35s ease, box-shadow 0.35s ease;
}

.reserve.is-lit .reserve__face {
  background: var(--accent);
  color: var(--button-ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 1px 2px rgba(23, 50, 32, 0.2),
    0 8px 18px -8px rgba(47, 107, 69, 0.7);
}

.reserve__label {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.reserve__label--wait,
.reserve__label--done {
  opacity: 0;
}

.reserve__arrow,
.reserve__check,
.reserve__spin {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reserve__check path {
  stroke-dasharray: 14;
  stroke-dashoffset: 14;
}

.reserve__sheen {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 34%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.32), transparent);
  opacity: 0;
  pointer-events: none;
}

.reserve:focus-visible .reserve__face {
  outline: 2px solid rgba(47, 107, 69, 0.35);
  outline-offset: 2px;
}

@media (hover: hover) {
  .reserve.is-lit:hover .reserve__face {
    background: #2a613f;
  }
  .reserve.is-lit:hover .reserve__arrow {
    transform: translateX(1.5px);
  }
}

.reserve__arrow {
  transition: transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);
}
