/* Login page. Outside the SPA, so it cannot import src/styles: the colour tokens below are copies of
   src/styles/tokens.css (DESIGN.md 3.2) and tests/test_auth.py fails if they drift. Layout follows the SPA
   shell (DESIGN.md 5, 6.1, 6.3, 7). Fonts: the self-hosted Titillium files sit behind the wall, so this page
   uses the DESIGN.md 2.4 fallback stack unless Titillium Web is installed. */

:root {
  color-scheme: light;
  --gradient-rule: linear-gradient(90deg, #7AB51D 0%, #009DD9 100%);
  --shadow-1: 0 1px 2px rgb(0 48 111 / 0.08), 0 1px 1px rgb(0 48 111 / 0.04);
  --color-canvas: #F5F7FA;
  --color-surface: #FFFFFF;
  --color-border: #C2CCD9;
  --color-border-strong: #6B7D95;
  --color-text: #0E1D32;
  --color-text-2: #3A4B63;
  --color-text-muted: #52637B;
  --color-primary: #00306F;
  --color-primary-hover: #00265A;
  --color-on-primary: #FFFFFF;
  --color-focus: #0059A3;
  --color-danger-text: #9A1B12;
  --color-danger-bg: #FDECEA;
  --color-danger-border: #EFA59E;
  --font-sans: "Titillium Web", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --gutter: 1rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.40);
  --color-canvas: #0A1523;
  --color-surface: #0F1F33;
  --color-border: #2C4766;
  --color-border-strong: #6F8BAE;
  --color-text: #E8EEF5;
  --color-text-2: #BAC7D6;
  --color-text-muted: #93A6BC;
  --color-primary: #009DD9;
  --color-primary-hover: #2DB4E8;
  --color-on-primary: #00183A;
  --color-focus: #5CC0EE;
  --color-danger-text: #F4806A;
  --color-danger-bg: #3A1815;
  --color-danger-border: #8E3322;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.40);
    --color-canvas: #0A1523;
    --color-surface: #0F1F33;
    --color-border: #2C4766;
    --color-border-strong: #6F8BAE;
    --color-text: #E8EEF5;
    --color-text-2: #BAC7D6;
    --color-text-muted: #93A6BC;
    --color-primary: #009DD9;
    --color-primary-hover: #2DB4E8;
    --color-on-primary: #00183A;
    --color-focus: #5CC0EE;
    --color-danger-text: #F4806A;
    --color-danger-bg: #3A1815;
    --color-danger-border: #8E3322;
  }
}

@media (min-width: 48em) {
  :root {
    --gutter: 1.5rem;
  }
}

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

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  margin: 0;
  background: var(--color-canvas);
  color: var(--color-text);
  font: 400 1rem/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

h1,
p {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
}

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

[hidden] {
  display: none !important;
}

.container {
  width: min(100% - 2 * var(--gutter), 90rem);
  margin-inline: auto;
}

/* Header: 3 px gradient rule, a 56 px row with the U-AGREE wordmark (24 px high) and the product name. */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-1);
}

.site-header::before {
  content: "";
  display: block;
  height: 3px;
  background: var(--gradient-rule);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.5rem;
}

.logo {
  width: 127px;
  height: 24px;
}

.brand__divider {
  width: 1px;
  height: 1.5rem;
  background: var(--color-border-strong);
}

.brand__name {
  font: 600 1.25rem/1.5rem var(--font-sans);
}

/* The form: one centred card, 400 px wide. */
main {
  flex: 1 0 auto;
  padding-block: 2rem 3rem;
}

.card {
  max-width: 25rem;
  margin-inline: auto;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

@media (min-width: 48em) {
  main {
    padding-block: 4rem;
  }

  .card {
    padding: 2rem;
  }
}

h1 {
  text-wrap: balance;
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 2.25rem;
}

.intro {
  margin-top: 0.5rem;
  color: var(--color-text-2);
}

form {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

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

label {
  font: 600 0.875rem/1.25rem var(--font-sans);
}

input {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 4px;
  background: var(--color-surface);
  color: var(--color-text);
  font: 400 1rem/1.5 var(--font-sans); /* 16 px: no zoom on focus in mobile Safari */
}

input[aria-invalid="true"] {
  border-color: var(--color-danger-text);
}

.help {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.error {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-danger-border);
  border-left-width: 4px;
  border-radius: 4px;
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* Primary button, DESIGN.md 6.1: 40 px high, radius 4, label 14/20 600; full width in a narrow card. */
.btn-primary {
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font: 600 0.875rem/1.25rem var(--font-sans);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 120ms cubic-bezier(0.2, 0, 0, 1);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-primary[aria-busy="true"] {
  cursor: progress;
}

/* Footer: SESAR lockup left, statement, EU emblem right (DESIGN.md 2.3, 7), as the SPA's. */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.site-footer__inner {
  display: grid;
  grid-template-areas: "sesar" "eu" "text";
  justify-items: start;
  gap: 1.5rem;
  padding-block: 1.5rem;
}

.site-footer__sesar {
  grid-area: sesar;
  width: 7.5rem;
  height: auto;
}

.site-footer__eu {
  grid-area: eu;
  width: 11.25rem;
  height: auto;
  max-width: none;
}

.site-footer__text {
  grid-area: text;
  max-width: 70ch;
  color: var(--color-text-2);
  font-size: 0.8125rem;
  line-height: 1.25rem;
}

.site-footer__text p + p {
  margin-top: 0.5rem;
}

@media (min-width: 40em) {
  .site-footer__inner {
    grid-template-areas: "sesar eu" "text text";
    grid-template-columns: 1fr auto;
  }

  .site-footer__eu {
    justify-self: end;
    margin-right: -0.45rem;
  }
}

@media (min-width: 64em) {
  .site-footer__inner {
    grid-template-areas: "sesar text eu";
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 2rem;
  }
}

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