/* 540 frame. Seven 70 px columns from x 25; weekday row at y 112; week rows of 76 px from y 136. */
.mn {
  --board: #0b4636;
  --board-ink: #0a3f31; /* the board showing through the foil block */
  --tone: #2c7a63; /* tone-on-tone ink for the days of other months */
  /* One sheet of silver foil across the whole board: every stamped shape shows its own piece of the same reflection. */
  --foil:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='8'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 -.18'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E"),
    linear-gradient(112deg, #a2a9ae 0%, #e3e7e9 9%, #fcfdfd 17%, #bfc5c9 27%, #9ba2a8 36%, #d9dee0 46%, #f8f9f9 55%, #b0b6bb 64%, #d6dbdd 73%, #fdfdfd 82%, #a9afb4 91%, #cdd2d5 100%);
  position: relative;
  width: 540px;
  height: 540px;
  overflow: hidden;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .6 -.22'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E"),
    radial-gradient(140% 120% at 30% 10%, #0e5240 0%, #0b4636 55%, #093c2e 100%);
  color: #d6dadd;
  font-family: "Fraunces Variable", serif;
  user-select: none;
}

.mn * { box-sizing: border-box; }

.mn-foil {
  background: var(--foil);
  background-attachment: fixed;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---- heading ---- */
.mn-head { position: absolute; left: 25px; top: 16px; width: 490px; height: 92px; }

.mn-title { margin: 0; font: inherit; }

.mn-month {
  position: absolute;
  left: -3px;
  top: -8px;
  font-size: 92px;
  line-height: 100px;
  font-weight: 400;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
  letter-spacing: -0.035em;
}

/* the die's bite: a dark lip above each letter and a lit one below, under the foil */
.mn-press { color: transparent; text-shadow: 0 -0.8px 0.4px #02150fb3, 0 0.8px 0.3px #ffffff29; }

.mn-year {
  position: absolute;
  right: 0;
  top: 54px;
  font-family: "Fragment Mono", monospace;
  font-size: 15px;
  line-height: 18px;
  letter-spacing: 0.14em;
  margin-right: -0.14em;
}

.mn-arrow {
  position: absolute;
  top: 10px;
  width: 34px;
  height: 30px;
  padding: 0;
  border: 0;
  font-family: "Fragment Mono", monospace;
  font-size: 28px;
  line-height: 30px;
  text-align: right;
  outline: none;
  cursor: pointer;
}

.mn-arrow[data-slot="calendar-previous"] { right: 40px; }
.mn-arrow[data-slot="calendar-next"] { right: -2px; }
.mn-arrow:focus-visible { text-decoration: underline; text-decoration-color: #d6dadd; text-underline-offset: 4px; }

/* ---- grid ---- */
.mn-grid {
  position: absolute;
  left: 25px;
  top: 112px;
  width: 490px;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
}

.mn-grid th,
.mn-grid td { padding: 0; }

.mn-wd {
  height: 24px;
  padding: 0 0 0 5px !important;
  font-family: "Fragment Mono", monospace;
  font-size: 12.5px;
  line-height: 14px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
  vertical-align: top;
}

/* stamped rules: one under the weekday row, one under every week */
.mn-cal::before {
  content: "";
  position: absolute;
  left: 25px;
  top: 135.5px;
  width: 490px;
  height: 381px;
  background: repeating-linear-gradient(180deg, #c5cacd 0 1px, transparent 1px 76px);
  opacity: 0.6;
}

.mn-day {
  position: relative;
  width: 70px;
  height: 76px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  outline: none; /* keyboard focus is the foil block: the selection follows it */
  cursor: pointer;
}

.mn-face { position: absolute; inset: 0; display: block; }

.mn-num {
  position: absolute;
  left: 5px;
  top: 6px;
  font-size: 23px;
  line-height: 24px;
  font-weight: 500;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 40;
  letter-spacing: -0.02em;
}

.mn-cap {
  position: absolute;
  left: 5px;
  bottom: 4px;
  font-family: "Fragment Mono", monospace;
  font-size: 12.5px;
  line-height: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mn-moon { position: absolute; left: 31px; top: 20px; width: 36px; height: 36px; }
.mn-moon i { position: absolute; inset: 0; display: block; }

.mn-rim,
.mn-lit { -webkit-background-clip: border-box; background-clip: border-box; }

/* the whole disc as a hairline ring, so the dark part is there too */
.mn-rim { border-radius: 50%; mask-image: radial-gradient(circle at 50% 50%, transparent 0 16.9px, #000 17.5px); }

/* today: a stamped frame round the day */
.mn-face[data-today]::after {
  content: "";
  position: absolute;
  inset: 1.5px 1px 1px;
  padding: 1.5px;
  background: var(--foil);
  background-attachment: fixed;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

/* days of the months either side: printed, not stamped */
.mn-grid .mn-day[data-outside] .mn-foil { background: var(--tone); -webkit-background-clip: text; background-clip: text; }
.mn-grid .mn-day[data-outside] .mn-rim,
.mn-grid .mn-day[data-outside] .mn-lit { -webkit-background-clip: border-box; background-clip: border-box; }

/* ---- the selected day: solid foil, whatever is under it knocked out ---- */
.mn-block {
  position: absolute;
  left: 25px;
  top: 136px;
  width: 490px;
  height: calc(var(--rows) * 76px);
  display: grid;
  grid-template-columns: repeat(7, 70px);
  grid-auto-rows: 76px;
  background: var(--foil);
  background-attachment: fixed;
  /* --x and --y are the window's offset in the grid, set by the glide */
  clip-path: inset(calc(var(--y) + 0.5px) calc(420px - var(--x)) calc((var(--rows) - 1) * 76px - var(--y) + 0.5px) var(--x));
  pointer-events: none;
}

.mn-block[data-off] { visibility: hidden; }
.mn-block .mn-day { display: block; }
.mn-block .mn-foil { background: var(--board-ink); -webkit-background-clip: text; background-clip: text; }
.mn-block .mn-rim,
.mn-block .mn-lit { -webkit-background-clip: border-box; background-clip: border-box; }
.mn-block .mn-face[data-today]::after { background: var(--board-ink); }
