@font-face {
  font-family: "Audiowide";
  src: url("./fonts/audiowide-v22-latin-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  margin: 0;
  font-family: Arial, sans-serif;
  font-size: 130%;
  color: whitesmoke;
  background-image: url("./img/background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.sparkle-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.sparkle {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--sparkle-size, 4px);
  height: var(--sparkle-size, 4px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(190, 230, 255, 0.35), transparent 70%);
  opacity: 0;
  transform: translate3d(50vw, 50vh, 0) scale(1);
  transition:
    transform var(--sparkle-move-duration, 2500ms) ease-in-out,
    opacity 350ms ease-in-out;
  will-change: transform, opacity;
}

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

.page-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1920px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  padding: 1rem clamp(1rem, 4vw, 3rem);
}

.site-header {
  justify-content: space-between;
  gap: 0.7rem;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3.05rem);
}

.site-header h1,
.login-form h2 {
  font-family: "Audiowide", Arial, sans-serif;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.site-footer {
  justify-content: center;
  gap: 1.5rem;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.logout-button {
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.logout-button:focus-visible,
.site-footer a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.quote-wrapper {
  display: grid;
  place-items: center;
  min-height: 0;
  height: 100%;
  padding: clamp(1rem, 4vw, 2rem);
  overflow: hidden;
}

.quote-text {
  width: min(100%, 1290px);
  height: min(65vh, 620px);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  align-content: center;
  flex-wrap: wrap;
  gap: 0.25em;
  font-family: "Audiowide", Arial, sans-serif;
  font-weight: 400;
  color: #f8f5ee;
  -webkit-text-stroke: clamp(1px, 0.15vw, 2px) #0a0f1f;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  padding: clamp(0.5rem, 4vw, 1rem);
  font-size: clamp(1.4rem, 5.5vw, 5rem);
  line-height: 1.15;
  text-align: center;
  overflow-wrap: break-word;
  overflow: hidden;
  transition: opacity 0.8s ease;
}

.quote-signature {
  white-space: nowrap;
}

.quote-text.is-shaking {
  animation: shake 0.12s infinite;
}

.quote-text.is-fading-out {
  animation: quote-shrink-out 0.8s ease-in forwards;
}

.quote-text.is-fading-in {
  animation: quote-grow-in 0.8s ease-out forwards;
}

@keyframes shake {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }

  25% {
    transform: translate(1px, -1px) rotate(-0.3deg);
  }

  50% {
    transform: translate(-1px, 1px) rotate(0.3deg);
  }

  75% {
    transform: translate(1px, 1px) rotate(-0.2deg);
  }

  100% {
    transform: translate(0, 0) rotate(0deg);
  }
}

@keyframes quote-shrink-out {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }

  15% {
    transform: translate(2px, -2px) rotate(-0.5deg) scale(0.9);
  }

  30% {
    opacity: 0.85;
    transform: translate(-2px, 2px) rotate(0.5deg) scale(0.78);
  }

  45% {
    transform: translate(2px, 1px) rotate(-0.4deg) scale(0.66);
  }

  60% {
    opacity: 0.55;
    transform: translate(-1px, -2px) rotate(0.4deg) scale(0.55);
  }

  75% {
    transform: translate(1px, 2px) rotate(-0.3deg) scale(0.48);
  }

  100% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg) scale(0.4);
  }
}

@keyframes quote-grow-in {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg) scale(0.4);
  }

  15% {
    transform: translate(-2px, 2px) rotate(0.5deg) scale(0.5);
  }

  30% {
    opacity: 0.45;
    transform: translate(2px, -2px) rotate(-0.5deg) scale(0.62);
  }

  45% {
    transform: translate(-2px, -1px) rotate(0.4deg) scale(0.78);
  }

  60% {
    opacity: 0.8;
    transform: translate(1px, 2px) rotate(-0.4deg) scale(0.92);
  }

  75% {
    transform: translate(-1px, -2px) rotate(0.3deg) scale(1.04);
  }

  100% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
}

.login-wrapper {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-form {
  width: min(100%, 360px);
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
}

.login-form h2 {
  margin: 0;
  text-align: center;
  font-size: clamp(1.7rem, 3.2vw, 2.2rem);
}

.form-field {
  display: grid;
  gap: 0.4rem;
}

.form-field input {
  width: 100%;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  color: white;
  background: transparent;
}

.form-field input:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.login-button {
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.login-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.form-error {
  margin: 0;
  text-align: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.quote-action-button {
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.quote-action-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.quote-action-button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.quote-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.65);
}

.quote-modal[hidden] {
  display: none;
}

.quote-modal-content {
  width: min(100%, 560px);
  display: grid;
  gap: 3rem;
  padding: 1.5rem;
  border: 1px solid currentColor;
  border-radius: 1.5rem;
  color: whitesmoke;
  background: rgba(10, 15, 31, 0.92);
}

.quote-modal-content h2 {
  margin: 0;
  font-family: "Audiowide", Arial, sans-serif;
  font-weight: 400;
  text-align: center;
}

#quote-form {
  display: grid;
  gap: 1rem;
}

#quote-input {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  border: 1px solid currentColor;
  border-radius: 1rem;
  padding: 1rem;
  color: inherit;
  background: transparent;
  font: inherit;
}

#quote-input:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.character-counter {
  margin: 0;
  text-align: right;
}

.quote-preview {
  margin: 0;
  padding: 1rem;
  border: 1px solid currentColor;
  border-radius: 1rem;
  overflow-wrap: break-word;
  text-align: center;
}

.modal-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.modal-status {
  min-height: 1.4em;
  margin: 0;
  text-align: center;
}

.modal-status.is-error {
  color: #ff2828;
}

.quote-action-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.legal-wrapper {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: clamp(1rem, 4vw, 2rem);
}

.legal-card {
  width: min(100%, 820px);
  max-height: 75vh;
  overflow-y: auto;
  padding: clamp(1rem, 4vw, 2rem);
  border: 1px solid currentColor;
  border-radius: 1.5rem;
  color: whitesmoke;
  background: rgba(10, 15, 31, 0.88);
}

.legal-card h2 {
  margin-top: 0;
  font-family: "Audiowide", Arial, sans-serif;
  font-weight: 400;
  text-align: center;
}

.legal-card p {
  line-height: 1.6;
}

.legal-card a {
  color: inherit;
}

.legal-card a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

@media (max-width: 615px) {
  body {
    font-size: 115%;
  }

  .quote-text {
    width: 100%;
    height: min(72vh, 620px);
    font-size: clamp(1rem, 8vw, 3rem);
    line-height: 1.2;
    padding: 0.5rem;
    transform-origin: center;
    -webkit-text-stroke: 1px #0a0f1f;
  }

  .site-header {
    flex-direction: column;
  }

  .quote-wrapper {
    padding: 1rem;
  }

  .site-footer {
    flex-direction: column;
    gap: 0.5rem;
  }

  .login-form {
    padding: 1rem;
  }

  .header-actions {
    flex-direction: column;
  }

  .quote-modal-content {
    padding: 1rem;
  }

  .legal-card {
    max-height: 70vh;
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
    opacity: 0.18;
  }
}
