/* Users dashboard: sign-in page. Self-contained (served without a session). */

:root {
  --blue: #183381;
  --blue-hover: #12286a;
  --blue-active: #0d1f55;
  --blue-50: #eef1f9;
  --gold: #b68f4e;
  --gold-soft: #c9a96e;
  --gold-text: #7a5a22;
  --gold-50: #f8f1e4;
  --cream: #f8f6f2;
  --surface: #fff;
  --ink: #1b2035;
  --muted: #5b6074;
  --line: #e4dccd;
  /* input outlines: 3:1 against the card (WCAG 1.4.11) */
  --line-input: #958564;
  --line-input-hover: #6f6248;
  --danger: #b42318;
  --danger-50: #fdeeec;
  --focus: #2747a8;
  --radius: 12px;
  --radius-lg: 22px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
  --font-ar: "Segoe UI", "SF Arabic", "Geeza Pro", "Noto Sans Arabic", "Noto Sans Arabic UI", Tahoma, system-ui, sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(60rem 36rem at 12% -10%, rgb(24 51 129 / 0.07), transparent 70%),
    radial-gradient(48rem 32rem at 100% 110%, rgb(182 143 78 / 0.13), transparent 70%),
    url("/public/knit.svg");
  -webkit-font-smoothing: antialiased;
}

:lang(ar) body,
body:lang(ar) {
  font-family: var(--font-ar);
  line-height: 1.65;
}

/* ---------------------------------------------------------------- layout */

.login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2.5rem 1rem;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.brand-emblem {
  display: block;
  width: auto;
  height: 7.5rem;
  margin-block-end: 1rem;
}

.brand-name {
  margin: 0;
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--blue);
  overflow-wrap: anywhere;
}

.brand-subtitle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-text);
}

.brand-subtitle::before,
.brand-subtitle::after {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold));
}

.brand-subtitle::after {
  background: linear-gradient(to left, transparent, var(--gold));
}

:lang(ar) .brand-subtitle {
  font-size: 0.9375rem;
  letter-spacing: 0;
}

.card {
  position: relative;
  width: 100%;
  max-width: 26.5rem;
  padding: 2.25rem 2rem 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow:
    0 1px 2px rgb(27 32 53 / 0.05),
    0 28px 60px -24px rgb(24 51 129 / 0.28);
  overflow: hidden;
}

/* the woven gold trim along the top, as on a thobe's collar */
.card::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 8px;
  background: url("/public/trim.svg") repeat-x center / auto 8px;
  border-block-end: 1px solid var(--gold-50);
}

.card-title {
  margin: 0;
  font-size: 1.375rem;
  line-height: 1.3;
}

.card-lead {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---------------------------------------------------------------- form */

.form {
  display: grid;
  gap: 1.125rem;
  margin-block-start: 1.5rem;
}

.field {
  display: grid;
  gap: 0.375rem;
}

label {
  font-size: 0.875rem;
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 2.875rem;
  padding: 0.625rem 0.875rem;
  font: inherit;
  color: var(--ink);
  background: #fdfcfa;
  border: 1px solid var(--line-input);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}

[dir="rtl"] input[dir="ltr"] {
  text-align: right;
}

input:hover {
  border-color: var(--line-input-hover);
}

input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(39 71 168 / 0.22);
  background: var(--surface);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.875rem;
  margin-block-start: 0.375rem;
  padding: 0.625rem 1.25rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--blue);
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(13 31 85 / 0.3), inset 0 1px 0 rgb(255 255 255 / 0.12);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s;
}

.button:hover {
  background: var(--blue-hover);
}

.button:active {
  background: var(--blue-active);
  transform: translateY(1px);
}

.button:focus-visible,
.lang:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- messages */

.alert {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  margin-block-start: 1.25rem;
  padding: 0.75rem 0.875rem;
  color: #8a1c13;
  background: var(--danger-50);
  border: 1px solid #f4c7c1;
  border-radius: var(--radius);
  font-size: 0.9375rem;
}

.alert p {
  margin: 0;
}

.alert-icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin-block-start: 0.0625rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.lock {
  margin-block-start: 1.25rem;
  padding: 1.25rem 1.125rem 1.125rem;
  text-align: center;
  background:
    linear-gradient(to bottom, var(--gold-50), #fffdf9);
  border: 1px solid #e8d6b4;
  border-radius: 16px;
}

.lock-icon {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0.6rem;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  background: var(--blue);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgb(182 143 78 / 0.25);
}

.lock-title {
  margin: 0.625rem 0 0;
  font-weight: 700;
  color: var(--blue);
}

.lock-message {
  margin: 0.5rem 0 0;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: pre-line;
  unicode-bidi: plaintext;
  overflow-wrap: anywhere;
}

.lock-note {
  margin: 0.75rem 0 0;
  padding-block-start: 0.75rem;
  border-block-start: 1px dashed #e2cfa8;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------------------------------------------------------------- footer */

.foot {
  display: grid;
  justify-items: center;
  gap: 0.875rem;
  text-align: center;
}

.lang {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  background: rgb(255 255 255 / 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color 0.15s, background-color 0.15s;
}

.lang:hover {
  background: var(--surface);
  border-color: var(--gold-soft);
}

.lang:lang(ar) {
  font-family: var(--font-ar);
}

.lang:lang(en) {
  font-family: var(--font);
}

.lang svg {
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.tagline {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.wordmark {
  margin-inline-end: 0.375rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--blue);
}

/* ---------------------------------------------------------------- wide screens */

/* brand on the start side, a gold seam, the form on the end side */
@media (min-width: 64rem) {
  .login {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 1px minmax(0, 26.5rem);
    grid-template-areas:
      "brand seam card"
      "foot  seam card";
    align-content: center;
    align-items: center;
    column-gap: 4.5rem;
    row-gap: 2.25rem;
    max-width: 64rem;
    margin-inline: auto;
    padding-inline: 2rem;
  }

  .login::before {
    content: "";
    grid-area: seam;
    align-self: stretch;
    margin-block: 2rem;
    background: linear-gradient(to bottom, transparent, var(--gold-soft) 20%, var(--gold-soft) 80%, transparent);
  }

  .brand {
    grid-area: brand;
    align-self: end;
  }

  .card {
    grid-area: card;
  }

  .foot {
    grid-area: foot;
    align-self: start;
  }

  .brand-emblem {
    height: 14rem;
    margin-block-end: 1.5rem;
  }

  .brand-name {
    font-size: 2.5rem;
  }

  .brand-subtitle {
    font-size: 0.875rem;
  }

  :lang(ar) .brand-subtitle {
    font-size: 1.0625rem;
  }
}

/* ---------------------------------------------------------------- small screens */

@media (max-width: 30rem) {
  .login {
    justify-content: flex-start;
    gap: 1.25rem;
    padding-block: 2rem 1.5rem;
  }

  .brand-emblem {
    height: 5.75rem;
    margin-block-end: 0.75rem;
  }

  .brand-name {
    font-size: 1.625rem;
  }

  .card {
    padding: 2rem 1.25rem 1.5rem;
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
