:root {
  --paper: #a9b4ae;
  --ink: #050505;
  --line: rgba(245, 247, 242, 0.31);
  --wash: rgba(255, 255, 255, 0.055);
  --edge: clamp(0.45rem, 1.25vw, 1.25rem);
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
}

button {
  color: inherit;
  font: inherit;
}

.calendar {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: var(--paper);
  transition:
    background-color 240ms ease,
    color 240ms ease;
}

.calendar[data-inverted="true"] {
  --paper: #080909;
  --ink: #aeb9b3;
  --line: rgba(210, 221, 215, 0.15);
  --wash: rgba(202, 214, 207, 0.035);
  color-scheme: dark;
}

.paper {
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.32;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 2px,
      rgba(255, 255, 255, 0.025) 3px,
      transparent 4px
    ),
    radial-gradient(circle at 16% 24%, rgba(255, 255, 255, 0.11), transparent 34%),
    radial-gradient(circle at 82% 73%, rgba(0, 0, 0, 0.08), transparent 38%);
  mix-blend-mode: soft-light;
}

.masthead {
  position: relative;
  z-index: 3;
  min-height: clamp(17rem, 56vh, 46rem);
  pointer-events: none;
}

.edition {
  position: absolute;
  top: var(--edge);
  right: var(--edge);
  margin: 0;
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  writing-mode: vertical-rl;
}

.month-title {
  position: absolute;
  top: clamp(1.8rem, 5.5vh, 4.5rem);
  left: -0.055em;
  margin: 0;
  max-width: 96vw;
  font-family: "Arial Black", Arial, Helvetica, sans-serif;
  font-size: clamp(8rem, 27vw, 30rem);
  font-weight: 950;
  line-height: 0.68;
  letter-spacing: -0.155em;
  text-transform: lowercase;
  white-space: nowrap;
  transform-origin: left top;
  transition: opacity 160ms ease;
}

.ink-switch {
  position: absolute;
  top: clamp(1rem, 3.2vh, 2.1rem);
  left: clamp(8.4rem, 42vw, 39rem);
  width: clamp(2rem, 4.5vw, 4.4rem);
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--ink);
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.ink-switch span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--ink);
  transform: scale(1);
  transform-origin: center;
  transition: transform 180ms ease;
}

.ink-switch:hover span,
.ink-switch:focus-visible span {
  transform: scale(0.7);
}

.month-nav {
  position: absolute;
  top: var(--edge);
  left: var(--edge);
  display: flex;
  gap: 0.2rem;
  pointer-events: auto;
}

.month-nav button {
  width: 2.65rem;
  height: 2.65rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--ink) 45%, transparent);
  border-radius: 50%;
  background: transparent;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
  transition:
    color 140ms ease,
    background-color 140ms ease;
}

.month-nav button:hover,
.month-nav button:focus-visible {
  color: var(--paper);
  background: var(--ink);
}

.calendar-grid {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-column {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 clamp(0.22rem, 0.9vw, 0.9rem) clamp(1.65rem, 4vh, 3.5rem);
  border-left: 1px solid var(--line);
  transition: background-color 140ms ease;
}

.calendar-column:last-child {
  border-right: 1px solid var(--line);
}

.calendar-column:hover,
.calendar-column:focus-within {
  background: var(--wash);
}

.weekday {
  margin: 0 0 clamp(0.45rem, 1.5vh, 1rem);
  font-size: clamp(0.55rem, 0.65vw, 0.75rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  opacity: 0.55;
  text-transform: uppercase;
}

.date-list {
  display: grid;
  gap: 0.04rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.date-button {
  display: inline-grid;
  width: 100%;
  min-height: clamp(2.1rem, 4.2vh, 3.65rem);
  place-items: center start;
  padding: 0 0.16em;
  border: 0;
  background: transparent;
  font-size: clamp(1.35rem, 2.35vw, 2.9rem);
  font-weight: 900;
  line-height: 1;
  text-align: left;
  cursor: pointer;
}

.date-button::after {
  position: absolute;
  right: 0;
  width: 0;
  height: 1px;
  background: var(--ink);
  content: "";
  transition: width 180ms ease;
}

.date-button:hover::after,
.date-button:focus-visible::after {
  width: 42%;
}

.date-button[aria-pressed="true"] {
  width: fit-content;
  min-width: 1.35em;
  color: var(--paper);
  background: var(--ink);
}

.date-button:focus-visible,
.ink-switch:focus-visible,
.month-nav button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.selection {
  position: absolute;
  right: 0.22rem;
  bottom: clamp(1rem, 3vh, 2.3rem);
  z-index: 4;
  display: flex;
  gap: 0.9rem;
  margin: 0;
  font-size: clamp(0.48rem, 0.55vw, 0.65rem);
  font-weight: 900;
  letter-spacing: 0.09em;
  line-height: 1;
  pointer-events: none;
  text-transform: uppercase;
  writing-mode: vertical-rl;
}

.instructions {
  position: absolute;
  right: var(--edge);
  top: 50%;
  z-index: 4;
  display: flex;
  gap: 1.2rem;
  margin: 0;
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  opacity: 0.68;
  pointer-events: none;
  text-transform: uppercase;
  writing-mode: vertical-rl;
}

@media (max-width: 640px) {
  .masthead {
    min-height: 46vh;
  }

  .month-title {
    top: clamp(5.2rem, 15vh, 7.5rem);
    font-size: clamp(6.3rem, 28.5vw, 11rem);
  }

  .ink-switch {
    top: clamp(4.25rem, 12.5vh, 6rem);
    left: 42vw;
    width: clamp(1.8rem, 8vw, 2.55rem);
  }

  .calendar-column {
    padding-right: 0.18rem;
    padding-bottom: clamp(2.3rem, 6vh, 4rem);
    padding-left: 0.28rem;
  }

  .weekday {
    font-size: 0.49rem;
  }

  .date-button {
    min-height: clamp(2.35rem, 5.8vh, 3.1rem);
    font-size: clamp(1.15rem, 5.2vw, 1.55rem);
  }

  .instructions {
    display: none;
  }

  .selection {
    right: 0.12rem;
    bottom: 0.65rem;
  }
}

@media (max-height: 610px) and (orientation: landscape) {
  .masthead {
    min-height: 55vh;
  }

  .month-title {
    top: 3.5rem;
    font-size: 22vw;
  }

  .date-button {
    min-height: 1.7rem;
    font-size: clamp(1rem, 2.3vw, 1.6rem);
  }

  .weekday {
    margin-bottom: 0.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
