:root {
  color-scheme: light dark;
  --surface: rgb(255 255 255 / 85%);
  --input: #fff;
  --text: #222;
  --muted: #6b6b6b;
  --border: #949494;
  --primary: #00679e;
  --primary-text: #fff;
  --hover: rgb(0 0 0 / 5%);
  --shadow: 0 0 10px rgb(0 0 0 / 30%);
  font: 15px system-ui, -apple-system, "Segoe UI", Roboto, Oxygen-Sans, Cantarell, Ubuntu, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: #fff;
  background: #00679e url("assets/background-light.webp") center / cover fixed no-repeat;
  font-size: .875rem;
  line-height: 21px;
  text-align: center;
}

.wrapper {
  flex: none;
  width: 100%;
  max-width: 700px;
  margin: 10vh auto auto;
  padding-inline: 12px;
}

.header { height: 130px; }

.logo {
  display: block;
  width: 175px;
  height: 130px;
  margin-inline: auto;
  object-fit: contain;
}

.login-box {
  width: 320px;
  max-width: 100%;
  margin-inline: auto;
  padding: 12px;
  color: var(--text);
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

h1 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
}

.login-message {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, #e9322d 55%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, #e9322d 12%, var(--input));
  color: var(--text);
  font-size: 14px;
  line-height: 21px;
  text-align: left;
  overflow-wrap: anywhere;
}

.field input[aria-invalid="true"]:not(:focus) {
  box-shadow: 0 0 0 1px #e9322d;
}

.field {
  position: relative;
  height: 51.5px;
  margin-inline: 2px;
  text-align: left;
}

.field input {
  position: absolute;
  inset-inline: 0;
  bottom: 2px;
  width: 100%;
  height: 34px;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  outline: 0;
  background: var(--input);
  color: var(--text);
  box-shadow: 0 -1px 0 var(--border), 0 0 0 1px color-mix(in srgb, var(--border) 35%, transparent);
  font: inherit;
  font-size: 15px;
  cursor: text;
}

.field input:focus {
  box-shadow: 0 0 0 2px var(--text), 0 0 0 4px var(--input);
}

.field label {
  position: absolute;
  top: 20px;
  left: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  color: var(--muted);
  font-size: 15px;
  line-height: 21px;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  transition: top .12s, font-size .12s;
}

.field input:focus + label,
.field input:not(:placeholder-shown) + label {
  top: 3.75px;
  left: 4px;
  padding-inline: 4px;
  border-radius: 4px 4px 0 0;
  background: var(--input);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 19.5px;
}

.field-password input { padding-inline-end: 32px; }

button { font-family: inherit; }

.password-toggle {
  position: absolute;
  right: 0;
  bottom: 6px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  margin-top: 7.5px;
  padding-inline: 7px;
  font-size: 15px;
  text-align: left;
}

.checkbox {
  display: grid;
  flex: none;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--primary);
  color: var(--primary-text);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 15px;
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 34px;
  padding: 1px 8px 0;
  border: 0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  line-height: normal;
  cursor: pointer;
}

.button-primary {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 12%);
}

.button-primary:hover { filter: brightness(1.08); }

.button-tertiary { background: transparent; color: var(--text); }

.button-tertiary:hover,
.password-toggle:hover { background: var(--hover); }

button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.footer {
  flex: none;
  max-width: calc(100% - 24px);
  margin: 24px 12px 15px;
  padding: 4px 12px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.footer p { margin: 0; }
.footer strong { font-weight: 600; }

.privacy-link {
  display: block;
  margin-inline: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 11.8px;
  font-weight: 600;
  line-height: 21.8px;
  cursor: pointer;
}

.privacy-link:hover { text-decoration: underline; }

@media (prefers-color-scheme: dark) {
  :root {
    --surface: rgb(23 23 23 / 85%);
    --input: #171717;
    --text: #ebebeb;
    --muted: #a8a8a8;
    --border: #7d7d7d;
    --primary: #0091f2;
    --primary-text: #000;
    --hover: rgb(255 255 255 / 7%);
    --shadow: 0 0 10px #000;
  }
  body { background-image: url("assets/background-dark.webp"); }
}

@media (max-width: 1024px) {
  .wrapper { margin-top: 0; }
}

@media (max-width: 360px) {
  .wrapper { padding-inline: 8px; }
  .login-box { padding-inline: 10px; }
  .field input:focus + label { font-size: 12px; }
  .footer { font-size: 12px; }
}

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

/* Accessible native checkbox with the original Nextcloud-like appearance. */
.remember-row { position: relative; cursor: pointer; }
.remember-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.remember-input:not(:checked) + .checkbox {
  background: var(--input);
  color: var(--text);
}
.remember-input:not(:checked) + .checkbox svg { visibility: hidden; }
.remember-input:focus-visible + .checkbox {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
