/* The visit calendar of a made-up clinic, alone on white. Every element GSAP moves (the day pills, the ticks, the
   slots, the accordion, the flyer, the button) has no transform in the CSS: the CSS only styles its children. */
:root {
  --page: #ffffff;          /* the page */
  --card: #ffffff;          /* the card */
  --line: #e6e8ec;          /* the thin lines and borders */
  --ink: #12171c;           /* the main words */
  --muted: #7d858f;         /* the small words */
  --soft: #f4f6f7;          /* the resting pills and slots */
  --accent: #0e7a70;        /* the chosen day, the chosen time, the awake button */
  --accent-soft: #e3f3f0;   /* the tint behind a hovered slot */
  --full: #b7bcc3;          /* a fully booked day */
  --tick: #d9dde2;          /* an empty availability tick */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
}

/* ---- the card ---- */
.card {
  position: relative;
  width: min(372px, calc(100vw - 28px));
  padding: clamp(13px, 3.4vh, 20px) clamp(13px, 4vw, 20px) clamp(12px, 3vh, 18px);
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 1) inset,
    0 1px 2px rgba(18, 23, 28, 0.04),
    0 6px 14px -6px rgba(18, 23, 28, 0.08),
    0 26px 48px -22px rgba(14, 122, 112, 0.18);
}
.card__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(120% 60% at 50% -10%, rgba(14, 122, 112, 0.07), transparent 60%);
}

/* ---- the doctor ---- */
.doc { position: relative; display: flex; align-items: center; gap: 11px; }
.doc__face {
  position: relative;
  flex: none;
  width: clamp(36px, 9.6vh, 42px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #e9f6f3, #cfe9e4);
  box-shadow: 0 0 0 1px rgba(14, 122, 112, 0.18) inset, 0 4px 10px -4px rgba(14, 122, 112, 0.35);
}
.doc__ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid rgba(14, 122, 112, 0.22);
}
.doc__ini { font-size: 13px; font-weight: 650; font-stretch: 112%; letter-spacing: 0.02em; color: var(--accent); }
.doc__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.doc__name { font-size: 15px; font-weight: 620; letter-spacing: -0.01em; white-space: nowrap; }
.doc__role { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc__mark {
  margin-left: auto;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: linear-gradient(#fff, #f6f8f8);
}
.doc__mark svg { width: 14px; height: 14px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; }

/* ---- the week ---- */
.week {
  display: flex;
  gap: clamp(3px, 1.2vw, 6px);
  margin-top: clamp(12px, 3.6vh, 18px);
  padding-top: clamp(11px, 3.2vh, 16px);
  border-top: 1px solid var(--line);
}
.day {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
}
.day__pill {
  position: relative;
  height: clamp(44px, 12vh, 52px);
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: var(--soft);
  box-shadow: 0 0 0 1px rgba(18, 23, 28, 0.05) inset;
  overflow: hidden;
}
.day__on {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(170deg, #149083, var(--accent) 55%, #0a645c);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.28) inset, 0 -1px 0 rgba(0, 0, 0, 0.12) inset;
  opacity: 0;
}
.day__wd, .day__n { position: relative; line-height: 1; white-space: nowrap; }
.day__wd { font-size: 10px; font-weight: 520; color: var(--muted); letter-spacing: 0.02em; }
.day__n { font-size: 15px; font-weight: 620; font-stretch: 92%; }
.day.is-on .day__wd { color: rgba(255, 255, 255, 0.78); }
.day.is-on .day__n { color: #fff; }
.day.is-full .day__pill { background: #f7f8f9; }
.day.is-full .day__wd, .day.is-full .day__n { color: var(--full); }
.day__strike {
  position: absolute;
  left: 26%;
  right: 26%;
  top: 50%;
  height: 1px;
  background: var(--full);
  transform: rotate(-28deg);
  display: none;
}
.day.is-full .day__strike { display: block; }
.ticks { display: flex; justify-content: center; gap: 2px; height: 3px; }
.ticks i { width: clamp(4px, 1.3vw, 6px); height: 2px; border-radius: 2px; background: var(--tick); }
.ticks i.is-free { background: var(--accent); }
.day.is-full .ticks i { background: transparent; box-shadow: 0 0 0 0.5px var(--full) inset; }

@media (hover: hover) {
  .day:not(.is-on):not(.is-full) .day__pill:hover { background: #eceff1; }
  .slot:not(.is-taken):not(.is-on):hover .slot__face { border-color: rgba(14, 122, 112, 0.45); background: var(--accent-soft); color: var(--accent); }
  .confirm:not(:disabled):hover .confirm__word { font-stretch: 112%; }
}

/* ---- the time grid (the accordion) ---- */
.slots { overflow: hidden; height: 0; }
.slots__in { padding-top: clamp(10px, 3vh, 14px); }
.slots__head { display: flex; align-items: baseline; justify-content: space-between; font-size: 12px; margin-bottom: 8px; }
.slots__day { font-weight: 600; letter-spacing: -0.005em; }
.slots__free { color: var(--muted); }
.slots__free.is-full { color: #9aa1a9; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.slot { height: clamp(30px, 8.4vh, 34px); }
.slot__face {
  height: 100%;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 560;
  border: 1px solid var(--line);
  background: #fff;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}
.slot.is-taken { cursor: default; }
.slot.is-taken .slot__face { color: #c0c5cb; text-decoration: line-through; text-decoration-color: rgba(18, 23, 28, 0.25); background: #fafbfb; border-style: dashed; }
.slot.is-on .slot__face {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(170deg, #149083, var(--accent) 55%, #0a645c);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.28) inset, 0 6px 14px -6px rgba(14, 122, 112, 0.6);
}

/* the copy of the chosen time that flies to the summary */
.flyer {
  position: fixed;
  left: 0;
  top: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 560;
  color: #fff;
  pointer-events: none;
  visibility: hidden;
  z-index: 5;
}

/* ---- the summary and the button ---- */
.foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(12px, 3.4vh, 16px);
  padding-top: clamp(11px, 3vh, 14px);
  border-top: 1px solid var(--line);
}
.sum { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sum__label { font-size: 10.5px; color: var(--muted); letter-spacing: 0.02em; }
.sum__line { position: relative; height: 17px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.flyer__bg {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(170deg, #149083, var(--accent) 55%, #0a645c);
  box-shadow: 0 10px 22px -8px rgba(14, 122, 112, 0.55);
}
.flyer__t { position: relative; }
.sum__empty, .sum__full { position: absolute; left: 0; top: 0; }
.sum__empty { color: #a7adb4; font-weight: 500; }
.sum__full { visibility: hidden; }
.sum__full i { font-style: normal; color: var(--muted); font-weight: 500; }
.sum__time { display: inline-block; color: var(--accent); }

.confirm {
  position: relative;
  flex: none;
  height: 40px;
  padding: 0 14px 0 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  background: #eef0f2;
  color: #a4aab1;
  font-size: 13px;
  font-weight: 600;
  cursor: default;
}
.confirm:not(:disabled) { cursor: pointer; }
.confirm__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(170deg, #1b2229, var(--ink) 60%, #080b0e);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.16) inset;
  opacity: 0;
}
.confirm__glint {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 34%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.32), transparent);
  opacity: 0;
}
.confirm__word { position: relative; white-space: nowrap; transition: font-stretch 0.3s; }
.confirm__ic path[data-tick] { stroke: #7fe0d2; }
.confirm__ic { position: relative; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- the drawn pointer of the autopilot ---- */
.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -4px;
  fill: #12171c;
  stroke: #fff;
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  pointer-events: none;
  visibility: hidden;
  z-index: 9;
}

/* the states the drawn pointer lights, the same as the hover */
.day.is-hot:not(.is-on):not(.is-full) .day__pill { background: #eceff1; }
.slot.is-hot:not(.is-taken):not(.is-on) .slot__face { border-color: rgba(14, 122, 112, 0.45); background: var(--accent-soft); color: var(--accent); }

/* a narrow phone: the summary and the button share the row without touching */
@media (max-width: 380px) {
  .foot { gap: 8px; }
  .sum__line { font-size: 12px; }
  .confirm { height: 38px; padding: 0 11px 0 13px; font-size: 12px; gap: 5px; }
  .confirm__ic { width: 13px; height: 13px; }
}

/* reduced motion: the drawn pointer does not travel, the states change on their own with fades */
@media (prefers-reduced-motion: reduce) {
  .ghost { display: none; }
}
