@font-face {
  font-family: 'Abril Fatface';
  src: url('fonts/abril-fatface.woff2') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: 'Tenor Sans';
  src: url('fonts/tenor-sans.woff2') format('woff2');
  font-display: swap;
}

:root {
  --gruen: #E3FFC4;
  --indigo: #12019C;
  --hellblau: #BBDDFF;
}

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

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--gruen);
  color: var(--indigo);
  font-family: 'Tenor Sans', system-ui, sans-serif;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Bühne für die Aufklapp-Animation */
.stage {
  height: 100dvh;
  display: grid;
  place-items: center;
  perspective: 2000px;
}

/* Auf dem Handy füllt die Karte den Bildschirm, auf breiten Bildschirmen
   behält sie das Hochformat der echten Karte. */
.card {
  width: min(100vw, 100dvh * 1136 / 1600);
  height: 100dvh;
  background: var(--gruen);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  container-type: size; /* Größen unten in cqw/cqh = Anteil an der Karte */
  transform-origin: left center;
  backface-visibility: hidden;
  transition: transform 1.1s cubic-bezier(0.55, 0.05, 0.3, 1), box-shadow 1.1s ease;
}

.card__tree {
  height: 38cqh;
  width: auto;
  margin-bottom: 4cqh;
}

/* Steht an der Stelle von „save the date“ und sieht auch so aus */
.card__input {
  width: 100%;
  max-width: 14ch;
  font-family: 'Abril Fatface', Georgia, serif;
  font-size: min(12cqw, 7.5cqh);
  line-height: 1.1;
  text-align: center;
  color: var(--indigo);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0 0 4px;
  outline: none;
  caret-color: var(--indigo);
  transition: border-color 0.2s ease;
}

.card__input::placeholder {
  color: var(--indigo);
  opacity: 0.25;
}

.card__input:focus {
  border-bottom-color: var(--hellblau);
}

.card__submit {
  margin-top: 2cqh;
  font: inherit;
  font-size: max(13px, min(3.6cqw, 2.4cqh));
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--indigo);
  background: transparent;
  border: 1.5px solid var(--indigo);
  border-radius: 999px;
  padding: 8px 22px 7px;
  cursor: pointer;
}

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

.card__meta {
  margin: 4cqh 0 0;
  font-size: min(6.2cqw, 3.9cqh);
  line-height: 1.45;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
}

.card__error {
  min-height: 1.4em;
  margin: 2cqh 0 0;
  font-size: max(13px, min(3.8cqw, 2.4cqh));
  text-align: center;
}

/* Falsches Wort: kurz wackeln */
.card--wrong .card__input {
  animation: wackeln 0.45s ease;
}

@keyframes wackeln {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* Richtiges Wort: an der linken langen Kante aufklappen */
.card--open {
  transform: rotateY(-180deg);
  box-shadow: 30px 0 60px rgba(18, 1, 156, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }

  .card--wrong .card__input {
    animation: none;
  }
}
