/* IMI by Imogen Evans - custom styles that sit alongside Tailwind */

html {
  scroll-behavior: smooth;
}

section[id],
main[id] {
  scroll-margin-top: 5rem;
}

::selection {
  background: #c8e63c;
  color: #141414;
}

/* Visible focus for keyboard users */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #d6246e;
  outline-offset: 3px;
  border-radius: 6px;
}

.on-dark a:focus-visible,
.on-dark button:focus-visible {
  outline-color: #c8e63c;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: #141414;
  color: #faf7f2;
  font-weight: 700;
  border-radius: 9999px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
}

/* Running ticker */
.ticker {
  display: flex;
  width: max-content;
  animation: ticker 32s linear infinite;
}

@keyframes ticker {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* Dialogs */
dialog {
  width: min(42rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 0;
  border-radius: 1.5rem;
  background: #faf7f2;
  color: #141414;
}

dialog::backdrop {
  background: rgba(20, 20, 20, 0.72);
  backdrop-filter: blur(4px);
}

dialog[open] {
  animation: dialog-in 0.2s ease-out;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.legal h3 {
  font-family: "Syne", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  margin-top: 1.5rem;
  margin-bottom: 0.4rem;
}

.legal p,
.legal li {
  line-height: 1.65;
}

.legal p + p {
  margin-top: 0.6rem;
}

.legal ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin-top: 0.4rem;
}

.legal a {
  color: #a81a55;
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.modal-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .ticker {
    animation: none;
  }
}
