:root {
  --rows-per-rect: 10;
  --cols-per-rect: 26;

  --color-background: #fff;
  --color-dark-gray: #333;
  --color-black: #000;
  --color-white: #fff;
  --rect-gap: 8px;
  --week-gap: 5px;
  --week-size: 8px;
}

body {
  font-family: Inter, sans-serif;
  background-color: var(--color-background);
}

@page {
  size: a4 portrait;
}

@media print {
  .week-cell {
    -webkit-print-color-adjust: exact;
  }
}

.title {
  color: var(--color-dark-gray);
  font-size: 50px;
  font-weight: 700;
  margin: 60px 0;
  text-align: center;
}

#quote {
  margin: 60px auto;
  max-width: 700px;
  padding: 0 1rem;
  width: calc(100% - 2rem);
}

.calendar {
  /* https://github.com/afonsocrg/mementoMori/issues/1 */
  /* width: 0px; */ /* make it fit its content. TODO: calculate it dynamically */
  display: grid;
  grid-gap: 20px;
  grid-template-columns: repeat(10, auto);
  max-width: 760px;
  width: 100%;
}

/* https://github.com/afonsocrg/mementoMori/issues/1 - Added these lines to center the calendar in the middle of the screen but keep print layout as it is */
@media screen {
  .calendar {
    justify-content: center;
    margin: auto;
  }
}

.rect-container {
  display: grid;
  grid-gap: var(--week-gap);
  grid-template-columns: repeat(var(--cols-per-rect), auto);
}

.week-cell {
  align-items: center;
  border: 1px solid var(--color-dark-gray);
  display: inline-flex;
  height: var(--week-size);
  justify-content: center;
  width: var(--week-size);
}

.invisible {
  border: 1px solid var(--color-background);
}

.year-cell {
  display: grid;
  gap: var(--week-gap);
}

.month-cell {
  display: grid;
  grid-row-gap: var(--week-gap);
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.year-label {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px;
  text-align: center;
}

/* Tooltips */
[data-tooltip] {
  cursor: default;
  position: relative;
}

[data-tooltip]:hover::before {
  animation: fade-in 150ms ease;
  background-color: var(--color-black);
  border-radius: 4px;
  bottom: calc(100% + 10px);
  color: var(--color-white);
  content: attr(data-tooltip);
  display: block;
  font-size: 14px;
  left: 50%;
  max-width: 160px;
  min-width: 60px;
  padding: 10px 10px 14px;
  position: absolute;
  text-align: left;
  transform: translate(-50%);
  width: max-content;
  z-index: 1;
}

[data-tooltip]:hover::after {
  animation: fade-in 150ms ease;
  border: 1px solid var(--color-black);
  border-color: var(--color-black) transparent transparent;
  border-width: 4px 6px 0;
  bottom: calc(100% + 6px);
  content: "";
  display: block;
  height: 0;
  left: 50%;
  margin-left: -6px;
  position: absolute;
  width: 0;
  z-index: 1;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Mobile responsiveness */
@media (max-width: 740px) {
  .calendar {
    grid-template-columns: repeat(8, auto);
  }
}

@media (max-width: 650px) {
  .calendar {
    grid-template-columns: repeat(6, auto);
  }
}

@media (max-width: 500px) {
  .calendar {
    grid-template-columns: repeat(4, auto);
  }

  .title {
    font-size: 32px;
  }
}
