/* The hut calendar: one card on white. Every day is a button with its number and, under it, a row of thin bunk lines
   (the free beds, up to eight). The lines of your group take the accent; a night without room for everyone goes out:
   the number fades, the lines go pale and a thin stroke crosses it. */
:root {
  --page: #ffffff;          /* the page */
  --card: #fdfcf9;          /* the card, a warm white */
  --ink: #1c211e;           /* the words */
  --muted: #7d8079;         /* the small words */
  --faint: #c9c5bb;         /* the free beds */
  --ghost-bed: #ebe7df;     /* the beds that are taken */
  --line: rgba(28, 33, 30, 0.08); /* hairlines and the card edge */
  --accent: #2f6b50;        /* pine green: your night, your group, the button */
  --accent-deep: #1f4c38;   /* the shadow side of the green */
  --strike: #b7b1a5;        /* the stroke over a night without room */
}

* { box-sizing: border-box; }

html { touch-action: manipulation; }

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

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

p { margin: 0; }

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

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

.stage {
  --cell: clamp(26px, 6.9vh, 46px);
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
}

/* ---------- the card ---------- */
.hut {
  position: relative;
  width: min(400px, calc(100vw - 24px));
  padding: clamp(12px, 3.1vh, 22px) clamp(13px, 4vw, 22px);
  border-radius: 22px;
  background:
    linear-gradient(180deg, #ffffff 0%, var(--card) 60%, #faf8f3 100%);
  box-shadow:
    inset 0 0 0 1px var(--line),
    inset 0 1px 0 #ffffff,
    0 1px 2px rgba(28, 33, 30, 0.05),
    0 8px 18px -8px rgba(28, 33, 30, 0.12),
    0 30px 60px -28px rgba(31, 76, 56, 0.22);
}

/* a whisper of grain, so the white is a material */
.hut::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.45  0 0 0 0.05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

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

.hut__name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.hut__peak {
  flex: none;
  width: 28px;
  height: 18px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.hut__peak .hut__snow {
  stroke: var(--accent);
  stroke-width: 2;
}

.hut__title {
  font-size: clamp(14px, 3.6vh, 16px);
  font-weight: 640;
  font-variation-settings: "wdth" 104;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.hut__sub {
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- the guests stepper ---------- */
.guests {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: #f2f0ea;
  box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 2px rgba(28, 33, 30, 0.06);
}

.guests__btn {
  display: grid;
  place-items: center;
  width: clamp(26px, 7vh, 30px);
  height: clamp(26px, 7vh, 30px);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(28, 33, 30, 0.1), 0 3px 8px -4px rgba(28, 33, 30, 0.2);
  transition: box-shadow 0.25s, opacity 0.25s;
}

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

.guests__btn:disabled {
  opacity: 0.4;
  cursor: default;
}

@media (hover: hover) {
  .guests__btn:not(:disabled):hover {
    box-shadow: 0 0 0 1px rgba(47, 107, 80, 0.35), 0 1px 2px rgba(28, 33, 30, 0.1), 0 4px 10px -4px rgba(47, 107, 80, 0.4);
  }
}

.guests__btn.is-hover {
  box-shadow: 0 0 0 1px rgba(47, 107, 80, 0.35), 0 1px 2px rgba(28, 33, 30, 0.1), 0 4px 10px -4px rgba(47, 107, 80, 0.4);
}

.guests__val {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
  line-height: 1;
}

.guests__n {
  position: relative;
  display: inline-flex;
  height: 17px;
  overflow: hidden;
  font-size: 15px;
  font-weight: 650;
}

.guests__n > span,
.roll > span {
  display: inline-block;
}

.guests__l {
  margin-top: 1px;
  font-size: 9.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* ---------- the month ---------- */
.cal { margin-top: clamp(8px, 2.6vh, 18px); }

.cal__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 28px;
}

.cal__month {
  position: relative;
  height: 20px;
  overflow: hidden;
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  font-variation-settings: "wdth" 100;
}

.cal__month > span {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
}

.cal__month b {
  font-weight: 450;
  color: var(--muted);
}

.cal__navs { display: flex; gap: 4px; }

.cal__nav {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: background-color 0.2s, opacity 0.2s;
}

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

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

@media (hover: hover) {
  .cal__nav:not(:disabled):hover { background: #f0eee8; }
}

.cal__nav.is-hover { background: #f0eee8; }

.cal__week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 520;
  color: var(--muted);
  text-align: center;
}

.cal__week span:nth-child(n + 6) { color: var(--accent); }

.cal__clip {
  position: relative;
  height: calc(var(--cell) * 6 + 10px);
  margin: 2px -6px 0;
  padding: 3px 6px;
  overflow: hidden;
}

.page {
  position: absolute;
  inset: 3px 6px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, var(--cell));
}

/* ---------- one day ---------- */
.d {
  position: relative;
  display: grid;
  place-items: center;
}

.d--blank {
  pointer-events: none;
  font-size: clamp(11px, 3.1vh, 13.5px);
  font-weight: 450;
  color: #dedad1;
}

.d--blank span { margin-top: calc(var(--cell) * -0.14); line-height: 1; font-size: clamp(10.5px, 2.9vh, 13.5px); }

.d__c {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--cell) * 0.08);
  padding-top: calc(var(--cell) * 0.04);
  width: calc(var(--cell) - 2px);
  height: calc(var(--cell) - 2px);
  border-radius: 50%;
}

/* the ring of hover, and the filled disc of your night: two layers, so the disc can land on its own */
.d__ring,
.d__disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.d__ring {
  box-shadow: inset 0 0 0 1px rgba(47, 107, 80, 0.34);
  opacity: 0;
  transition: opacity 0.2s;
}

@media (hover: hover) {
  .d:not(.is-out):not(.is-pick):hover .d__ring { opacity: 1; }
}

.d.is-hover:not(.is-out):not(.is-pick) .d__ring { opacity: 1; }

.d__disc {
  background:
    radial-gradient(120% 90% at 35% 18%, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, #367a5c, var(--accent) 55%, var(--accent-deep));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 2px rgba(0, 0, 0, 0.18),
    0 4px 10px -3px rgba(31, 76, 56, 0.55),
    0 1px 2px rgba(31, 76, 56, 0.3);
  opacity: 0;
  transform: scale(0.4);
}

.d__n {
  position: relative;
  line-height: 1;
  font-size: clamp(10.5px, 2.9vh, 13.5px);
  font-weight: 540;
  transition: color 0.3s var(--dl, 0s), opacity 0.3s var(--dl, 0s);
}

.d__beds {
  position: relative;
  display: flex;
  gap: clamp(1.2px, 0.4vh, 1.7px);
}

.d__beds i {
  display: block;
  width: 1.5px;
  height: clamp(3.6px, 1.1vh, 5.5px);
  border-radius: 1px;
  background: var(--ghost-bed);
  transition: background-color 0.32s var(--dl, 0s), transform 0.32s var(--dl, 0s);
  transform-origin: 50% 100%;
}

.d__beds i.free { background: var(--faint); }
.d__beds i.mine { background: var(--accent); transform: scaleY(1.25); }

/* the stroke: the parent holds the slant, the child is drawn by GSAP */
.d__x {
  position: absolute;
  left: 22%;
  right: 22%;
  top: 50%;
  height: 1px;
  transform: rotate(-38deg);
  pointer-events: none;
}

.d__x i {
  display: block;
  height: 100%;
  background: var(--strike);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.d.is-out .d__n { color: #b4b0a6; }
.d.is-out .d__beds i { background: var(--ghost-bed); transform: none; }
.d.is-out { cursor: not-allowed; }

.d.is-full .d__n { color: #c4c0b6; }

.d.is-pick .d__n { color: #ffffff; font-weight: 620; }
.d.is-pick .d__beds i { background: rgba(255, 255, 255, 0.35); }
.d.is-pick .d__beds i.mine { background: #ffffff; }

/* ---------- the footer: the night, the total, the button ---------- */
.foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(8px, 2.4vh, 16px);
  padding-top: clamp(8px, 2.4vh, 16px);
  border-top: 1px solid var(--line);
}

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

.foot__date,
.foot__sub,
.foot__total {
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.foot__date {
  height: 18px;
  font-size: 13.5px;
  font-weight: 620;
}

.foot__sub {
  height: 15px;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--muted);
}

.foot__sub.is-warn { color: #9a5a3a; }

.foot__total { transition: color 0.3s; }
.foot__total.is-zero { color: #c4c0b6; }

.foot__total {
  flex: none;
  min-width: 56px;
  text-align: right;
  height: 24px;
  font-size: 20px;
  font-weight: 660;
  font-variation-settings: "wdth" 96;
  letter-spacing: -0.01em;
}

.roll {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
}

.foot__total .roll { left: auto; right: 0; }

.reserve {
  position: relative;
  flex: none;
  height: clamp(36px, 9.4vh, 44px);
  padding: 0 16px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  background:
    radial-gradient(120% 120% at 30% 0%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, #367a5c, var(--accent) 50%, var(--accent-deep));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 1px rgba(0, 0, 0, 0.2),
    0 6px 14px -6px rgba(31, 76, 56, 0.6);
  transition: filter 0.3s, opacity 0.3s, box-shadow 0.3s;
}

.reserve:disabled {
  cursor: default;
  filter: saturate(0) brightness(1.7);
  opacity: 0.55;
  box-shadow: inset 0 0 0 1px var(--line);
}

@media (hover: hover) {
  .reserve:not(:disabled):hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 1px rgba(0, 0, 0, 0.2), 0 10px 20px -8px rgba(31, 76, 56, 0.7); }
}

.reserve.is-hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 1px rgba(0, 0, 0, 0.2), 0 10px 20px -8px rgba(31, 76, 56, 0.7); }

.reserve__in {
  display: inline-flex;
  align-items: center;
  gap: 0;
  overflow: hidden;
  height: 20px;
}

.reserve__tick {
  width: 0;
  height: 16px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reserve__txt {
  display: inline-block;
  white-space: nowrap;
}

/* ---------- the drawn pointer of the autopilot ---------- */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  margin: -3px 0 0 -4px;
  fill: var(--ink);
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
  z-index: 5;
}

@media (prefers-reduced-motion: reduce) {
  .d__n, .d__beds i { transition-delay: 0s; }
}
