:root {
  --paper: #f4f0e6;
  --ink: #161616;
  --blue: #2858d8;
  --acid: #dfff37;
  --orange: #ff5c35;
  --line: 2px solid var(--ink);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 12%, rgba(255, 92, 53, .13), transparent 23rem),
    radial-gradient(circle at 85% 42%, rgba(40, 88, 216, .12), transparent 25rem),
    var(--paper);
  font-family: "DM Mono", monospace;
  min-height: 100vh;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  opacity: .075;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0 60px;
}

.hero {
  position: relative;
  margin-bottom: 64px;
  animation: arrive .7s cubic-bezier(.2,.8,.2,1) both;
}

h1 {
  max-width: 950px;
  margin: 0;
  font-family: "Shrikhand", Georgia, serif;
  font-size: clamp(70px, 12.5vw, 170px);
  font-weight: 400;
  letter-spacing: -.055em;
  line-height: .82;
  text-shadow: 6px 6px 0 var(--acid);
}

h1 em {
  display: inline-block;
  color: var(--paper);
  -webkit-text-stroke: 3px var(--ink);
  transform: rotate(7deg) translateY(-.06em);
  text-shadow: 7px 7px 0 var(--blue);
}

.hero-subtitle {
  margin: 30px 0 0;
  font-size: clamp(15px, 1.8vw, 19px);
  font-weight: 500;
}

.calendars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.calendar {
  position: relative;
  border: var(--line);
  background: rgba(250,248,241,.82);
  box-shadow: 8px 8px 0 var(--ink);
  animation: arrive .7s cubic-bezier(.2,.8,.2,1) both;
}

.calendar:nth-child(2) { animation-delay: .1s; }

.calendar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 22px 24px 18px;
  border-bottom: var(--line);
  background: var(--ink);
  color: var(--paper);
}

.calendar:nth-child(2) .calendar-head { background: var(--blue); }

.month-name {
  font-family: "Shrikhand", Georgia, serif;
  font-size: clamp(31px, 4vw, 48px);
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: 1;
}

.year { font-size: 12px; letter-spacing: .14em; }

.weekdays,
.dates {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.weekdays {
  padding: 15px 14px 8px;
  font-size: 10px;
  font-weight: 500;
  text-align: center;
  text-transform: uppercase;
}

.dates { padding: 6px 14px 18px; }

.date-spacer,
.date-button { aspect-ratio: 1 / .92; }

.date-button {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font: 500 clamp(12px, 1.5vw, 16px)/1 "DM Mono", monospace;
  cursor: pointer;
  transition: transform .13s ease, color .13s ease;
}

.date-button::before {
  content: "";
  position: absolute;
  inset: 9%;
  z-index: -1;
  border: 2px solid transparent;
  border-radius: 47% 53% 48% 52%;
  transition: background .13s ease, border-color .13s ease, transform .13s ease;
}

.date-button:hover { transform: translateY(-2px) rotate(-2deg); }
.date-button:hover::before { border-color: var(--ink); }

.date-button[aria-pressed="true"] { color: var(--paper); }
.date-button[aria-pressed="true"]::before {
  background: var(--orange);
  border-color: var(--ink);
  transform: rotate(-7deg) scale(1.06);
  box-shadow: 2px 2px 0 var(--ink);
}

.calendar:nth-child(2) .date-button[aria-pressed="true"]::before { background: var(--blue); }

.date-button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.date-button.past {
  color: #aaa49a;
  cursor: not-allowed;
  text-decoration: line-through;
}

.date-button.past:hover { transform: none; }
.date-button.past:hover::before { border-color: transparent; }

.submit-zone {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px 28px;
  margin: 56px 0 30px;
  padding: 28px;
  border: var(--line);
  background: var(--acid);
  box-shadow: 8px 8px 0 var(--ink);
  animation: arrive .7s .2s cubic-bezier(.2,.8,.2,1) both;
}

.selection-copy { display: flex; flex-direction: column; gap: 5px; }
#selection-count { font-family: "Shrikhand", Georgia, serif; font-size: 29px; }
#selection-hint { font-size: 11px; color: #4c511c; }

#submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  min-height: 58px;
  padding: 0 18px 0 22px;
  border: var(--line);
  background: var(--ink);
  color: var(--paper);
  font: 500 13px/1 "DM Mono", monospace;
  box-shadow: 5px 5px 0 var(--blue);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

#submit-button:not(:disabled):hover { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--blue); }
#submit-button:disabled { opacity: .42; cursor: not-allowed; }
.arrow { font-size: 23px; }
.fine-print { grid-column: 1 / -1; margin: 0; font-size: 9px; opacity: .55; text-align: right; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px max(16px, calc((100vw - 1180px) / 2));
  border-top: var(--line);
  background: var(--ink);
  color: var(--paper);
  font-size: 10px;
  letter-spacing: .08em;
}

dialog {
  width: min(460px, calc(100% - 32px));
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

dialog::backdrop {
  background: rgba(22,22,22,.55);
  backdrop-filter: blur(3px);
  animation: fade .25s ease both;
}

.dialog-inner {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 40px 28px;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 0 12px 40px rgba(0,0,0,.22);
  text-align: center;
  animation: pop .2s ease-out both;
}

#joke-title {
  margin: 0;
  font-family: "DM Mono", monospace;
  font-size: clamp(19px, 4.5vw, 25px);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
}

.joke-copy { align-self: center; }

@keyframes arrive { from { opacity: 0; transform: translateY(24px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }

@media (max-width: 760px) {
  main { padding-top: 42px; }
  .hero { margin-bottom: 45px; }
  h1 { font-size: clamp(64px, 23vw, 118px); max-width: 500px; }
  .calendars { grid-template-columns: 1fr; gap: 24px; }
  .date-spacer, .date-button { aspect-ratio: 1 / .8; }
  .submit-zone { grid-template-columns: 1fr; margin-top: 40px; padding: 22px; }
  #submit-button { width: 100%; }
  .fine-print { text-align: left; }
  footer { flex-wrap: wrap; }
  footer span:last-child { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
