/* slackey-latin-400-normal */
@font-face {
  font-family: "Slackey";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("../assets/fonts/slackey/latin-400-normal.woff2") format("woff2"), url("../assets/fonts/slackey/latin-400-normal.woff") format("woff");
}
:root {
  color-scheme: light;
  --color-bg: #ffffff;
  --color-surface: #f3f4f6;
  --color-text: #1f2937;
  --color-muted: #4b5563;
  --color-border: #6b7280;
  --color-primary: #1d4ed8;
  --color-primary-text: #ffffff;
  --color-error: #b91c1c;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --color-bg: #111827;
    --color-surface: #1f2937;
    --color-text: #f9fafb;
    --color-muted: #d1d5db;
    --color-border: #9ca3af;
    --color-primary: #93c5fd;
    --color-primary-text: #111827;
    --color-error: #fca5a5;
  }
}
body.theme-light {
  color-scheme: light;
  --color-bg: #ffffff;
  --color-surface: #f3f4f6;
  --color-text: #1f2937;
  --color-muted: #4b5563;
  --color-border: #6b7280;
  --color-primary: #1d4ed8;
  --color-primary-text: #ffffff;
  --color-error: #b91c1c;
}

body.theme-dark {
  color-scheme: dark;
  --color-bg: #111827;
  --color-surface: #1f2937;
  --color-text: #f9fafb;
  --color-muted: #d1d5db;
  --color-border: #9ca3af;
  --color-primary: #93c5fd;
  --color-primary-text: #111827;
  --color-error: #fca5a5;
}

html {
  font-size: 62.5%;
}

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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding-top: 2rem;
  padding-bottom: 2rem;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-size: 2rem;
  line-height: 1.5;
  font-family: "Slackey", sans-serif;
  transition: background-color 0.2s ease, color 0.2s ease;
}

header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 8rem;
  margin: 0 auto;
  text-align: center;
}
header h1 {
  margin: 0 auto;
  min-height: 5.5rem;
  text-align: center;
  font-size: 2.4rem;
  font-weight: bold;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 4px;
  white-space: nowrap;
}

main {
  flex: 1;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  text-align: center;
  color: var(--color-text);
}

footer {
  width: 100%;
  color: var(--color-muted);
  text-align: center;
}
footer span {
  display: block;
}

button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: min(100%, 35rem);
  min-height: 4.8rem;
  border: 3px solid var(--color-border);
  border-radius: 1.2rem;
  background-color: var(--color-primary);
  color: var(--color-primary-text);
  font: inherit;
  font-size: 1.4rem;
  font-weight: bold;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

.theme-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

@keyframes joke-dialogue-paragraph-in {
  from {
    opacity: 0;
    transform: translateY(0.8rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.joke-section {
  flex: 1;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}
.joke-section .joke-output {
  display: grid;
  grid-template-columns: 4.8rem minmax(0, 1fr);
  column-gap: 1.6rem;
  row-gap: 1.6rem;
  align-items: start;
  width: min(100%, 60ch);
  margin-inline: auto;
  padding: clamp(1.6rem, 4vw, 3.2rem);
  text-align: left;
  font-size: 2.2rem;
  line-height: 1.45;
}
.joke-section .joke-button {
  width: 4.8rem;
  height: 4.8rem;
  min-height: 4.8rem;
  padding: 0;
  aspect-ratio: 1;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}
.joke-section .joke-button-icon {
  display: block;
  width: 2.8rem;
  height: 2.8rem;
  background-color: currentColor;
  mask: url("../assets/icons/refresh.svg") center/contain no-repeat;
  -webkit-mask: url("../assets/icons/refresh.svg") center/contain no-repeat;
}
.joke-section .joke-dialogue {
  display: none;
}
.joke-section .joke-dialogue.show {
  display: contents;
}
.joke-section .joke-dialogue.is-status .joke-dialogue-reveal,
.joke-section .joke-dialogue.is-status .joke-dialogue-punchline {
  display: none;
}
.joke-section .joke-dialogue.is-status .joke-dialogue-premise {
  color: var(--color-muted);
}
.joke-section .joke-dialogue.is-status.is-error .joke-dialogue-premise {
  color: var(--color-error);
}
.joke-section .joke-dialogue p {
  margin: 0;
  cursor: default;
  animation: joke-dialogue-paragraph-in 420ms ease-out both;
}
.joke-section .joke-dialogue-premise {
  grid-column: 2;
  grid-row: 1;
  animation-delay: 0ms;
}
.joke-section .joke-dialogue-premise,
.joke-section .joke-dialogue-punchline {
  width: 100%;
  text-align: left;
}
.joke-section .joke-dialogue-punchline {
  grid-column: 2;
  grid-row: 3;
  filter: blur(0.55em);
  transition: filter 250ms ease-out;
  animation-delay: 320ms;
}
.joke-section .joke-dialogue-punchline.is-revealed {
  filter: none;
}
.joke-section .joke-dialogue-reveal {
  width: 4.8rem;
  height: 4.8rem;
  min-height: 4.8rem;
  padding: 0;
  border-width: 2px;
  aspect-ratio: 1;
  grid-column: 1;
  grid-row: 3;
  justify-self: start;
}
.joke-section .joke-dialogue-reveal[aria-expanded=true] .joke-dialogue-reveal-icon {
  mask: url("../assets/icons/text-show-on.svg") center/contain no-repeat;
  -webkit-mask: url("../assets/icons/text-show-on.svg") center/contain no-repeat;
}
.joke-section .joke-dialogue-reveal-icon {
  width: 2.4rem;
  height: 2.4rem;
  background-color: currentColor;
  mask: url("../assets/icons/text-show-off.svg") center/contain no-repeat;
  -webkit-mask: url("../assets/icons/text-show-off.svg") center/contain no-repeat;
}

@media (prefers-reduced-motion: reduce) {
  .joke-section .joke-dialogue p {
    animation: none;
  }
  .joke-section .joke-dialogue-punchline {
    transition: none;
  }
}
@media (min-width: 640px) {
  body {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }
  header h1 {
    font-size: 2.8rem;
  }
  main {
    gap: 2rem;
  }
  footer span {
    display: inline;
  }
  .joke-section {
    gap: 2rem;
  }
}
@media (min-width: 768px) {
  body {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
  header h1 {
    font-size: 3rem;
  }
  main {
    gap: 2rem;
  }
  .joke-section {
    gap: 2rem;
  }
  .joke-section .joke-dialogue {
    font-size: 2.4rem;
  }
}
@media (min-width: 1024px) {
  body {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }
  .joke-section {
    max-width: 1024px;
    margin-right: auto;
    margin-left: auto;
  }
}
@media (min-width: 1280px) {
  body {
    padding-top: 5rem;
    padding-bottom: 5rem;
  }
  .joke-section {
    max-width: 1200px;
    gap: 2rem;
  }
}
@media (min-width: 1536px) {
  body {
    padding-top: 6rem;
    padding-bottom: 6rem;
  }
  .joke-section {
    max-width: 1440px;
    gap: 2rem;
  }
  .joke-section .joke-dialogue {
    font-size: 2.8rem;
  }
}
