/* The calendar of calendar.js. A day's height, --day-h, comes from its mode. */

.cal {
  display: flex;
  flex-direction: column;
  touch-action: pan-y pinch-zoom;
  user-select: none;
}

/* The scrolling list has no swipe, so a pan goes any way. */
.cal.scrolls {
  touch-action: auto;
}

/* A disabled button gets no pointer events in some browsers, which would stop a swipe that starts
   or ends on one. */
.cal button:disabled {
  pointer-events: none;
}

.cal .mrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0 16px;
}

.cal .mbtn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.cal .mbtn:hover {
  color: var(--edge);
}

.cal .mbtn:disabled {
  color: var(--text);
  cursor: default;
}

.cal .mname {
  font-size: var(--size-mark);
  white-space: nowrap;
}

.cal .navs {
  display: flex;
  gap: 0;
}

.cal .nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--soft);
  cursor: pointer;
}

.cal .nav:hover {
  color: var(--edge);
}

.cal .nav:disabled {
  color: var(--closed);
  cursor: default;
}

/* A week number column of 29px and seven days of 41px, which fit a 390px phone. */
.cal .wdays, .cal .wk {
  display: grid;
  grid-template-columns: 29px repeat(7, 41px);
  gap: 6px;
}

.cal .wk {
  margin-top: 6px;
}

.cal-dager .wk, .cal-guest .wk, .cal-foresla .wk {
  margin-top: 8px;
}

.cal .wk.out {
  display: none;
}

/* Two names for each way, so that a turn the same way as the last starts the slide again. */
.cal .fromr0 {
  animation: cal-fromr0 .22s ease-out;
}

.cal .fromr1 {
  animation: cal-fromr1 .22s ease-out;
}

.cal .froml0 {
  animation: cal-froml0 .22s ease-out;
}

.cal .froml1 {
  animation: cal-froml1 .22s ease-out;
}

@keyframes cal-fromr0 {
  from { opacity: 0; transform: translateX(28px); }
}

@keyframes cal-fromr1 {
  from { opacity: 0; transform: translateX(28px); }
}

@keyframes cal-froml0 {
  from { opacity: 0; transform: translateX(-28px); }
}

@keyframes cal-froml1 {
  from { opacity: 0; transform: translateX(-28px); }
}

/* The week numbers and the weekday letters. */
.cal .wbtn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.cal .wbtn span {
  position: relative;
}

.cal .wbtn:hover, .cal .wbtn.whole {
  color: var(--text);
}

.cal .wbtn:disabled {
  color: var(--muted);
  cursor: default;
}

.cal .wbtn.whole .line {
  stroke: var(--soft);
}

.cal .wbtn:not(:disabled):hover .line {
  stroke: var(--edge);
  stroke-width: 1.8;
}

.cal .wd {
  height: 36px;
  padding-bottom: 6px;
  font-size: var(--size-label);
}

.cal .wno {
  height: var(--day-h);
  padding-right: 6px;
  font-size: var(--size-count);
}

.cal .wno:disabled {
  color: var(--closed);
}

/* A day: its sketched box, its fill when it is on, and its number. */
.cal .cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: var(--day-h);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.cal .cell.closed {
  color: var(--closed);
  cursor: default;
}

/* A day on offer while a guest suggests: nothing to tap, so a mouse adds no edge. */
.cal .cell.fixed {
  cursor: default;
}

.cal .cell.fixed:not(.bare):hover .line {
  stroke: var(--line);
}

.cal .cell:hover .line {
  stroke: var(--hover);
}

.cal .cell.bare .line {
  stroke: transparent;
}

.cal .cell.bare:not(.fixed):hover .line {
  stroke: var(--line);
}

.cal .cell.on, .cal .cell.on .tally {
  color: var(--ink);
}

.cal .cell.on .line, .cal .cell.no .line, .cal .cell.pre .line, .cal .cell.seen .line,
.cal .cell.on:hover .line, .cal .cell.no:hover .line, .cal .cell.pre:hover .line, .cal .cell.seen:hover .line {
  stroke: var(--edge);
  stroke-width: 1.8;
}

/* A filled box whose card is open, or under the mouse: the line in ink, as the dial's. */
.cal .cell.on.seen .line, .cal .cell.on.seen:hover .line {
  stroke: var(--ink);
  stroke-width: 2;
  opacity: .75;
}

/* A box just tapped shows no more than its look until the mouse goes to another. */
.cal .cell.quiet:not(.on):not(.no) .line, .cal .cell.quiet:not(.on):not(.no):hover .line {
  stroke: var(--line);
  stroke-width: 1.5;
}

.cal .cell.quiet.bare .line, .cal .cell.quiet.bare:hover .line {
  stroke: transparent;
}

/* Finn dag on the host's form and the guests' calendar: the number at the top and the tally under
   it. */
.cal-dager .cell {
  justify-content: space-between;
  padding: 11px 0;
}

/* The guests' calendar: the number at the top, and under it the guest's own check or cross in
   the vote view, or everyone's marks in the result view. */
.cal-guest .cell, .cal-foresla .cell {
  justify-content: flex-start;
  padding: 8px 0 0;
}

.cal-guest .own {
  position: absolute;
  left: calc(50% - 7px);
  top: 30px;
  overflow: visible;
}

.cal .mk {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cal .own .mk {
  stroke-width: 2.6;
}

.cal .tally .mk {
  stroke-width: 1.6;
}

.cal .cell.no .own {
  color: var(--edge);
}

/* The mark that a tap gives next, under a mouse, in place of the box's own. */
.cal .own.nxt {
  color: var(--muted);
}

.cal-dager .cell.bare, .cal-foresla .cell.bare {
  color: var(--muted);
}

.cal-dager .cell.bare:hover, .cal-foresla .cell.bare:hover {
  color: var(--text);
}

/* A number over each column of a box, one or a run of them. */
/* Over the guest's own mark, so that the host's red ring stays on top. */
.cal .nums {
  position: relative;
  z-index: 1;
  display: grid;
  grid-auto-columns: 41px;
  grid-auto-flow: column;
  gap: 6px;
  justify-items: center;
}

.cal .num {
  position: relative;
  display: inline-block;
  padding: 0 3px;
  font-size: var(--size-body);
  font-weight: 800;
  line-height: 1;
}

.cal .num.other {
  opacity: .45;
}

.cal .num .disc {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(calc(100% + 2px), var(--disc));
  height: var(--disc);
  transform: translate(-50%, -50%);
  overflow: visible;
  fill: currentColor;
}

/* A picked today has no ring: the pill's own edge is the ring's red. */
.cal .num.picked .disc path {
  stroke: var(--chosen);
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
}

.cal .num .dig {
  position: relative;
  color: var(--ink);
}

.cal .cell.on .num .dig {
  color: var(--fill);
}

/* The host's ring round a picked day's number. */
.cal .ring {
  position: absolute;
  left: -8px;
  top: -7px;
  width: calc(100% + 16px);
  height: calc(100% + 14px);
  overflow: visible;
  pointer-events: none;
}

.cal .tally {
  position: absolute;
  left: 50%;
  bottom: 7px;
  transform: translateX(-50%);
  display: block;
  overflow: visible;
  color: var(--text);
}

/* Centred in the room under the number and its ring or pill. */
.cal .tally.lone {
  top: calc(var(--day-h) - 13px);
  bottom: auto;
  transform: translate(-50%, -50%);
}

.cal .count {
  fill: currentColor;
  font-size: var(--size-count);
  font-weight: 800;
}

/* The line over the calendar takes the whole row, so that TwoLines measures the room that it has
   and not the text that it holds. */
.said {
  flex: 1;
  min-width: 0;
}

.cal .yearbtn {
  align-self: center;
  margin-left: auto;
  padding: 0;
  white-space: nowrap;
}

.cal .month + .month {
  margin-top: 24px;
}

.cal .mhead {
  margin-bottom: 16px;
}
