@font-face {
  font-family: Roboto;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/Roboto-Regular.ttf") format("truetype");
}

@font-face {
  font-family: Roboto;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/Roboto-Bold.ttf") format("truetype");
}

/* Hand copy of the app's light calm style and BibidirVisualMetrics. Flutter's
   blur radius of 3 is a CSS blur of 4.5. login.js sets the sun from the clock. */
:root {
  color-scheme: light;
  --background: #f8f9f9;
  --surface: #ffffff;
  --field: #ecf0f1;
  --text: #000000;
  --primary: #456b73;
  --on-primary: #ffffff;
  --line: rgba(31, 48, 52, 0.42);
  --error: #ff0000;
  --overlay: rgba(69, 107, 115, 0.16);
  --sun-x: 0;
  --sun-y: 1;
  --shadow-x: calc(var(--sun-x) * 2.2px);
  --shadow-y: calc(var(--sun-y) * 2.2px);
  --shadow: var(--shadow-x) var(--shadow-y) 4.5px -2px rgba(0, 0, 0, 0.5);
  --recess: inset var(--shadow-x) var(--shadow-y) 4.5px -1px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 72px 24px 8px;
  background: var(--background);
  color: var(--text);
  font: 16px/1.4 Roboto, system-ui, sans-serif;
}

.logo {
  flex: 1;
  width: 100%;
  max-width: 560px;
  min-height: 140px;
  display: grid;
  place-items: center;
  container-type: size;
}

#logo {
  width: min(92cqw, 92cqh, 420px);
  aspect-ratio: 1;
  overflow: hidden;
  pointer-events: none;
}

/* Not `main`: the gear renderer brings its own. */
.card {
  width: 100%;
  max-width: 440px;
  margin-top: 24px;
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

form {
  display: grid;
  gap: 8px;
}

form[hidden],
p[hidden],
div[hidden] {
  display: none;
}

.field {
  position: relative;
  display: block;
}

.field span {
  position: absolute;
  top: 50%;
  left: 8px;
  padding: 0 4px;
  translate: 0 -50%;
  letter-spacing: 0.5px;
  pointer-events: none;
  transition: top 0.15s, font-size 0.15s;
}

input:focus + span,
input:not(:placeholder-shown) + span,
input:-webkit-autofill + span {
  top: 0;
  font-size: 12px;
  background: var(--surface);
}

input:focus + span {
  color: var(--primary);
}

input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: var(--field);
  box-shadow: var(--recess);
  color: var(--text);
  caret-color: var(--primary);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
}

input:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  transition: background-color 86400s 0s;
}

.password {
  position: relative;
}

.password input {
  padding-right: 48px;
}

button {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background-color: var(--primary);
  box-shadow: var(--shadow);
  color: var(--on-primary);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background-image: linear-gradient(var(--overlay), var(--overlay));
}

button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

button[type="submit"] {
  margin-top: 8px;
  --overlay: rgba(255, 255, 255, 0.1);
}

button.secondary {
  background-color: var(--surface);
  color: var(--primary);
}

button.link {
  border-color: transparent;
  background-color: transparent;
  box-shadow: none;
  color: var(--primary);
}

button.reveal {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 40px;
  min-height: 40px;
  padding: 0;
  border: 0;
  background-color: transparent;
  box-shadow: none;
  color: var(--text);
  --eye: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z'/%3E%3C/svg%3E");
}

button.reveal.visible {
  --eye: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z'/%3E%3C/svg%3E");
}

button.reveal::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  margin: auto;
  background: currentColor;
  -webkit-mask: var(--eye) center / contain no-repeat;
  mask: var(--eye) center / contain no-repeat;
}

button[hidden] {
  display: none;
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
}

.language {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  padding: 0;
  overflow: hidden;
}

.language svg {
  display: block;
  width: 100%;
  height: 100%;
}

html[lang="de"] .flag-en,
html[lang="en"] .flag-de {
  display: none;
}

h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
}

form p {
  margin: 0 0 16px;
}

#message {
  margin: 8px 0 0;
  color: var(--primary);
}

#message.error {
  color: var(--error);
}

.database {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 600px) {
  body {
    padding-right: 16px;
    padding-left: 16px;
  }
}
