:root {
  --bg: #f5ede0;
  --paper: #fffaf1;
  --edge: #e0d1bb;
  --ink: #2b231d;
  --muted: #6e6156;
  --accent: #b5531f;
  --accent-ink: #fffaf1;
  --accent-press: #99441a;
  --punch: #a4471a;
  --focus: #2b231d;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1915;
    --paper: #2a221d;
    --edge: #120e0b;
    --ink: #f1e6d6;
    --muted: #b3a493;
    --accent: #e08a54;
    --accent-ink: #1f1915;
    --accent-press: #c9743f;
    --punch: #f0a06d;
    --focus: #f1e6d6;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.4;
}

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 1rem 1rem 1.25rem;
}

/* Wordmark */

.masthead {
  display: flex;
  justify-content: center;
}

.wordmark {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.mug {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mug-steam {
  stroke: var(--accent);
}

/* Stage */

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  padding: 1.5rem 0;
  width: 100%;
}

.card {
  width: 100%;
  max-width: 40rem;
  min-height: 15rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.75rem 1.4rem;
  background: var(--paper);
  border: 1.5px solid var(--edge);
  border-radius: 14px;
  box-shadow: 5px 6px 0 var(--edge);
  text-align: center;
  overflow-wrap: break-word;
  word-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
}

.card[role="button"] {
  cursor: pointer;
}

.card[role="button"][aria-expanded="true"] {
  cursor: default;
}

.card:focus {
  outline: none;
}

.card:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.setup {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.hint {
  margin: 1.25rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.punchline {
  margin: 1.25rem 0 0;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--punch);
  text-wrap: balance;
}

.punchline:not([hidden]) {
  animation: reveal 280ms ease-out;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

[hidden] {
  display: none !important;
}

/* Controls */

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.next {
  min-height: 48px;
  min-width: 11rem;
  padding: 0.7rem 1.5rem;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--accent-press);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.next:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--accent-press);
}

.next:focus {
  outline: none;
}

.next:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 0.3em;
  font: inherit;
  font-weight: 700;
  text-align: center;
  border: 1px solid var(--muted);
  border-radius: 4px;
}

/* Keyboard tip only makes sense where there is likely a keyboard */
@media (hover: none) and (pointer: coarse) {
  .keys {
    display: none;
  }
}

/* Footer */

.footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer p {
  margin: 0;
}

.footer a {
  color: inherit;
  text-underline-offset: 2px;
}

.footer a:hover {
  color: var(--ink);
}

.footer a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Larger screens */

@media (min-width: 40em) {
  .page {
    padding: 1.5rem 2rem 1.75rem;
  }

  .card {
    min-height: 18rem;
    padding: 2.75rem 3rem;
    border-radius: 18px;
    box-shadow: 7px 8px 0 var(--edge);
  }

  .setup {
    font-size: 2.4rem;
  }

  .punchline {
    font-size: 1.6rem;
  }

  .wordmark {
    font-size: 1rem;
  }
}

@media (min-width: 64em) {
  .card {
    max-width: 46rem;
  }

  .setup {
    font-size: 2.75rem;
  }

  .punchline {
    font-size: 1.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .punchline:not([hidden]) {
    animation: none;
  }

  .next:active {
    transform: none;
  }
}
