/* Apercu — self-hosted from /public/fonts */
@font-face {
  font-family: "Apercu";
  src: url("/fonts/Apercu-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Apercu";
  src: url("/fonts/Apercu-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Apercu";
  src: url("/fonts/Apercu-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@keyframes scale-up {
  from {
    scale: 0.5;
    rotate: 45deg;
  }
}

@keyframes slide-down {
  from {
    translate: 0 -5rem;
  }

  to {
    translate: 0 0;
  }
}

@view-transition {
  navigation: auto;
}

/*
 * Apply Apercu site-wide. Unlayered styles win over erikt/ui's
 * `:root { font-family: system-ui }` reset, so this needs no !important.
 */
:root {
  --white: white;
  --red: #cc0000;
  --red-light: #ffaaaa;
  --blue: blue;
  --blue-light: rgb(191, 191, 255);
  --grey: #202020;

  --page-width: 400px;

  font-family: Apercu, system-ui, sans-serif;

  --ui-primary: var(--red);

  background: var(--ui-background-color);
  color: var(--ui-primary);
}

.sr-only {
  visibility: hidden;
  position: absolute;
  pointer-events: none;
}

body {
  min-height: 100svh;

  > main {
    min-height: inherit;
    padding-bottom: calc(2rem + 30px);
  }
}

.main-menu {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  translate: -50%;
}

.container {
  padding-inline: 1rem;
  margin-inline: auto;
  max-width: var(--page-width);
}

.frontpage {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: inherit;

  header {
    padding-top: 2rem;

    a {
      display: block;
      translate: 0 -5rem;
      animation: slide-down 1.6s 0.2s var(--ease-heavy) forwards;
    }
  }

  .logo {
    margin-inline: auto;
    width: min(66%, var(--page-width) / 0.66);
    height: auto;
    align-self: center;
    translate: 0 -15vh;

    animation: scale-up 1.6s var(--ease-heavy);
  }
}

.about-page {
  margin-top: 2rem;

  p {
    font-size: 1.4rem;
    line-height: 1.4;
  }
}

/* Login and signup (src/pages/login.ts, src/pages/signup.ts) */
.auth-page {
  display: grid;
  place-items: center;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 26rem;
  padding: 1.5rem;

  hgroup {
    margin-bottom: 1.5rem;

    h1 {
      font-size: 1.125rem;
      font-weight: 700;
      margin: 0;
    }

    p {
      margin: 0.375rem 0 0;
      color: var(--ui-neutral-500);
    }
  }

  form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }

  /* No "*" after required labels */
  .field > span::after {
    content: none;
  }

  button {
    width: 100%;
  }

  button[type="submit"] {
    margin-top: 0.25rem;
  }

  /* The Google button sits closer to the submit button */
  button + button {
    margin-top: -0.5rem;
  }

  #error {
    margin: 0;
    color: var(--ui-destructive);

    &:empty {
      display: none;
    }
  }

  .auth-card-footer {
    margin: 1.25rem 0 0;
    text-align: center;
    color: var(--ui-neutral-500);

    a {
      color: inherit;
      text-decoration: underline;
      text-underline-offset: 0.25em;
    }
  }
}

/* Homepage (src/pages/index.ts) */
.home {
  display: flex;
  flex-direction: column;

  #output {
    text-align: left;

    &:empty {
      display: none;
    }
  }
}
