/* pages/feedback — star rating card that flips to the written-feedback card. */

.feedback {
  position: relative;
  min-height: 100vh;
  background-color: var(--primary-400);
}

.feedback__backdrop {
  opacity: 0.025;
}

.feedback__panel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  width: min(90%, 1200px);
  min-height: 60%;
  height: max-content;
  margin: auto;
  overflow: hidden;
  background-color: var(--feedback-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.feedback__photo {
  display: none;
  flex: 0 0 30%;
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.feedback__cards {
  flex: 1 1 60%;
  padding: var(--space-8);
  color: var(--black);
  text-align: center;
}

.feedback__logo {
  width: 100%;
  max-width: 4rem;
  margin: 0 auto var(--space-4);
}

.feedback__prompt {
  font-size: clamp(1rem, 4vw, 1.75rem);
}

.feedback__question {
  max-width: 25ch;
  margin-inline: auto;
  font-size: clamp(1.25rem, 6vw, 2.5rem);
  color: var(--primary-400);
}

.feedback__form {
  display: grid;
  justify-items: start;
  gap: var(--space-4);
  text-align: left;
}

.feedback__label {
  max-width: 45ch;
  font-size: clamp(1rem, 4vw, 1.5rem);
}

.feedback__textarea {
  width: 100%;
  max-width: 85ch;
  min-height: 12ch;
  resize: none;
  background-color: var(--scrim-light);
}

/* ----- card stack: cards share one grid cell, only the active one shows ----- */
.card-stack {
  isolation: isolate;
  display: grid;
  grid-template: 1fr / 1fr;
}

.card-stack__card {
  grid-area: 1 / 1 / -1 / -1;
  max-width: max-content;
  min-height: max-content;
  margin: auto;
  opacity: 0;
  visibility: hidden;
  z-index: 0;
  scale: 0.4;
  transition: scale 500ms cubic-bezier(0.2, 1.4, 0.8, 1);
}

.card-stack[data-active="1"] [data-card="1"],
.card-stack[data-active="2"] [data-card="2"] {
  opacity: 1;
  visibility: visible;
  z-index: 1;
  scale: 1;
}

/* ----- star rating ----- */
.star-rating {
  display: flex;
  justify-content: center;
  gap: var(--space-1);
  padding-block: var(--space-4);
  filter: drop-shadow(1px 1px 2px var(--text-shadow));
}

.star-rating__star {
  aspect-ratio: 1;
  width: 10vw;
  min-width: 50px;
  max-width: 100px;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  background-image: linear-gradient(var(--star), var(--star-shade));
  transition: scale 500ms ease, rotate 500ms ease;
}

/* A hovered star lights itself and every star before it. */
.star-rating:has(.star-rating__star:hover) .star-rating__star:not(.star-rating__star:hover ~ .star-rating__star),
.star-rating__star:focus-visible {
  background-image: linear-gradient(var(--star-lit), var(--star-lit-shade));
  rotate: 4deg;
}

.star-rating__star:hover {
  scale: 1.2;
}

@media (min-width: 48em) {
  .feedback__photo {
    display: block;
  }
}
