:root {
  --light: #eeeeee;
  --dark: #222222;
  --gray: #9a9a9a;
  --accent: #ff4444;
  
}

@media (prefers-color-scheme: light) {
  body {
    --background: var(--light);
    --color: var(--dark);
  }
}

@media (prefers-color-scheme: dark) {
  body {
    --background: var(--dark);
    --color: var(--light);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border-collapse: collapse;
}

html {
  color-scheme: dark light;
  font-size: 15px;
  font-family: system-ui;
  transition: background 0.15s, color 0.15s, fill 0.15s;
}

body:has(.theme input:not(:checked)) {
  color-scheme: light;
  --background: var(--light);
  --color: var(--dark);
}

body:has(.theme input:checked) {
  color-scheme: dark;
  --background: var(--dark);
  --color: var(--light);
}

body {
  background: var(--background);
  color: var(--color);
  font-size: 1rem;
  margin-bottom: 40px;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 16px 40px;
  text-align: right;
  background: var(--background);
}

.label {
  display: inline-flex;
  vertical-align: top;
  line-height: 20px;
}

svg {
  display: inline-block;
  height: 20px;
  fill: var(--color);
}

main {
  margin-top: 52px;
  padding: 40px 40px 0 40px;
}

.container {
  text-align: center;
}

h1, h2 {
  line-height: 1.8em;
}

.prev-next {
  padding: 0 20px;
  cursor: pointer;
}

#calendar {
  text-align: center;
  text-transform: capitalize;
  font-size: 1.8rem;
  font-weight: 200;
  letter-spacing: 4px;
}

#year {
  display: inline-block;
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 1px;
}

table {
  width: 280px;
  margin: 0 auto;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 40px;
  margin-top: 40px;
}

th, td {
  display: inline-block;
  height: 40px;
  line-height: 40px;
  text-align: center;
  white-space: nowrap;
  width: 40px;
}

td.inactive span {
  color: var(--gray);
  font-weight: 300;
}

th {
  color: var(--gray);
}

caption {
  font-size: 1.4rem;
  height: 56px;
  line-height: 56px;
  font-weight: 300;
  color: var(--accent);
}

td:not(.inactive) {
  border-radius: 16px;
  cursor: pointer;
}

td:not(.inactive) span {
  display: table;
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border-radius: 20px;
  background: transparent;
  color: var(--color);
  font-weight: 400;
  transition: background 0.01s, color 0.01s, font-weight 0.01s;
}

td:not(.inactive).today span {
  background-color: var(--accent);
  font-weight: 700;
}

@media (hover: hover) and (pointer: fine) {
  td:not(.inactive):not(.today):hover span {
    background-color: var(--color);
    color: var(--background);
    font-weight: 700;
  }
}

td:not(.inactive):not(.today).on span {
  background-color: var(--color);
  color: var(--background);
  font-weight: 700;
}

.switch {
  display: inline-block;
  height: 20px;
  line-height: 20px;
  vertical-align: middle;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: relative;
  display: inline-block;
  cursor: pointer;
  width: 32px;
  height: 20px;
  background-color: var(--gray);
  transition: .4s;
  border-radius: 100vw;
}

.slider:before {
  position: absolute;
  content: "";
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background-color: var(--background);
  transition: all 0.4s;
  border-radius: 50%;
}

input:checked + .slider:before {
  left: calc(100% - 2px);
  transform: translateX(-100%);
}

nav p {
  display: inline-block;
  text-transform: capitalize;
  margin-left: 10px;
}