:root {
  --dark: hsl(220, 13%, 15%);
  --light: hsl(0, 0%, 96%);

  --overlay: hsl(210, 20%, 20%);

  --buttonNew: hsl(355deg 20% 45%);
  --buttonNewHover: hsl(355deg 20% 50%);
  --highlight: hsl(355deg 22% 58%);

  --success: hsl(140, 60%, 45%);
  --fail: hsl(355, 70%, 50%);

  --brand: hsl(355, 29%, 24%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  border: 0;
  padding: 0;
}

body {
  min-height: 100svh;

  margin: 0;
  padding: 0;

  font-family: Libre Baskerville, serif;
  font-weight: 400;
  /* font-size: 1.375rem; */
  font-size: 1rem;
  font-style: normal;
  line-height: 1.5;
  text-align: center;

  background: radial-gradient(var(--brand), hsl(355, 29%, 14%));
  color: var(--light);
}

.flow > * + * {
  margin-block-start: 1em;
}

/*

GAME LAYOUT

*/

.layout {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
}

nav {
  text-align: right;
  padding: 1rem;
  display: flex;
  justify-content: end;
}

main {
  display: grid;
  place-content: center;

  padding: 0.5rem;
}

footer {
  padding: 1rem;
}

#intro {
  max-width: 40rem;
  margin-inline: auto;
  padding: 1rem;
}

#game {
  display: none;
}

#feedback {
  display: none;
}

#message {
  max-height: 60vh;
  overflow: auto;
}

#go-to-next {
  display: none;
  text-align: right;
}

#metadata {
  display: none;
}

#impressum {
  display: none;
}

#button-reset {
  display: none;
}

#final-score {
  max-width: 40rem;
  margin-inline: auto;
  padding: 1rem;
  display: none;
}

#final-score-best {
  max-width: 40rem;
  margin-inline: auto;
  padding: 1rem;
  display: none;
}

.popup {
  position: absolute;
  z-index: 20;
  right: 1rem;
  bottom: 1rem;
  align-self: center;

  width: min(100vw - 2rem, 40rem);

  border-radius: 0.5rem;
  padding: 2rem;

  font-weight: 400;
  line-height: 1.5;

  background-color: var(--overlay);
  background-color: var(--brand);
  color: var(--light);

  box-shadow: 0 0 1rem hsl(0deg 0% 0% / 10%);
}

.modal {
  margin: auto;
  /* max-width: 80vw;
  max-height: 80vh; */
  background-color: var(--brand);
  border-radius: 0.5rem;
  color: #fff;
}

.modal-content {
  max-width: 100%;
  max-height: 100%;
  /* padding: 1rem; */
}

.modal-content img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.modal::backdrop {
  background-color: rgba(0, 0, 0, 0.875);
}

.p2 {
  padding: 2rem;
}

/*


TYPOGRAPHY

*/

a {
  color: inherit;
}

a:hover {
  text-decoration: none;
}

.link {
  text-decoration: underline;
  background-color: transparent;
  color: inherit;
  cursor: pointer;
}

.link:hover {
  text-decoration: none;
}

button {
  font: inherit;
}

.button {
  border-radius: 50vw;
  padding: 1rem 2rem;

  font-weight: 400;
  font-size: 1rem;
  font-family: sans-serif;

  background-color: var(--buttonNew);
  color: var(--light);

  letter-spacing: 0.2ch;
  /* text-transform: uppercase; */

  cursor: pointer;

  box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.1);

  transform: translateY(0);
  transition: all 200ms ease;
}

.button:hover {
  transform: translateY(-2px); /* subtle lift */
  box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.3);
  background-color: var(--buttonNewHover); /* slightly brighter yellow */
  /* transform: scale(1.1); */
  /* box-shadow: 0 0 1.5rem #191919; */
}

.button:active {
  transform: translateY(0px);
}

.button-secondary {
  background-color: hsl(0, 0%, 40%);
  color: #fff;
}

.button-secondary:hover {
  background-color: hsl(0, 0%, 50%);
}

.popup .button {
  margin-top: 1.5rem;
}

.highlight {
  color: var(--highlight);
}

.heading-1 {
  font-weight: 700;
  font-size: clamp(1.75rem, 1.0277rem + 3.0817vw, 3rem);
  line-height: 1.1;
  text-transform: uppercase;
}

.heading-2 {
  font-size: clamp(1.25rem, 0.9611rem + 1.2327vw, 1.75rem);
  line-height: 1.1;
  text-transform: uppercase;
  font-weight: 700;
}

.paragraph {
  font-weight: 400;
  /* font-size: 1.25rem; */
  text-align: left;
}

.heading-3 {
  font-size: 1.375rem;
  font-weight: 700;
}

.meta-heading {
  font-size: 1.375rem;
}

.meta-body {
  margin-block: 0.25rem;

  line-height: 1.7;
}

.meta-footer {
  opacity: 0.75;
}

.text-left {
  text-align: left;
}

/*

IMAGE GRID

*/

.image-grid {
  max-width: 100rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem 0.5rem;
  margin-inline: auto;
  margin-block-start: 2rem;
}

@media (min-width: 60rem) {
  .image-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
  }
}

.question-button {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.question-image {
  display: block;
  max-width: 100%;
  max-height: min-content;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 0.5rem;
  opacity: 1;
  transition: opacity 0.15s, transform 0.3s;
}

.action-buttons {
  /* position: absolute; */
  bottom: 1rem;
  left: 1rem;
  /* top: 0.5rem; */
  /* right: 0.5rem; */
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  /* align-items: end; */
  gap: 0.125rem;
}

.action-button,
.pick-button {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.75rem;
  line-height: 1.25rem;
  letter-spacing: 0.2ch;
  cursor: pointer;
  border-radius: 0.5rem;
  background-color: hsl(217, 12%, 13%, 0.3);
  color: #fff;
  border: 0;
  padding: 0.5rem;
  transition: opacity 200ms;
}

.action-button img,
.pick-button img {
  font-size: 1.25rem;
  width: 1em;
  height: 1em;
  pointer-events: none;
}

.pick-button {
  flex-grow: 1;
}

.pick-button[data-state] {
  opacity: 1;
}

@media (hover: hover) {
  .action-buttons {
    gap: 0.25rem;
  }

  .action-button,
  .pick-button {
    padding: 0.75rem;
  }

  .action-button img,
  .pick-button img {
    font-size: 1.5rem;
  }

  /* .action-button {
    opacity: 0;
  }

  .pick-button {
    opacity: 0;
  } */

  /* .question-button:hover .action-button {
    opacity: 1;
  }

  .question-button:hover .pick-button {
    opacity: 1;
  } */

  .pick-button {
    /* position: absolute; */
    /* z-index: 1; */
    /* bottom: 0.5rem; */
    /* left: 50%; */
    /* transform: translateX(-50%); */
    flex-wrap: nowrap;
    width: auto;
  }
}

.image-grid[data-disable-click] {
  pointer-events: none;
}

.question-button:hover .question-image {
  transform: scale(1.05);
}

[data-state] ~ .question-image {
  opacity: 0.25;
  transform: scale(1.05);
}

.question-button[data-state] {
  pointer-events: none;
}

.question-button[data-state]::before {
  position: absolute;
  place-content: center;
  inset: 0;
  font-size: 10rem;
}

[data-state='success']::before {
  content: '\2714';
  color: var(--success);
}

[data-state='fail']::before {
  content: '\2716';
  color: var(--fail);
}
