/* ===========================================================================
   BaerTec Branding für Forgejo – Rev2 (nur Darstellung)
   ---------------------------------------------------------------------------
   Markenwerte aus baertec-web-tokens.css (Quelle: canonical/design/
   document-design-tokens.json 2.1.0, ADR-0007). Hier wird NICHT neu
   gestaltet – Änderungen am Aussehen gehören in die Tokendatei.
   Harte Regeln: #6ba9ce nie als Text; weiße Schrift auf #55789a zulässig
   (4,63:1); alles Text in Open Sans bzw. Systemschrift, nie Abang.
   Kontraste nachgerechnet (WCAG), siehe BRANDING-REV1.md.
   =========================================================================== */

:root {
  /* --- Markenwerte [DOKU] ------------------------------------------------ */
  --bt-brand:        #55789a;
  --bt-accent:       #6ba9ce;   /* nur Akzent/Linie/Fokus, nie Text        */
  --bt-brand-dark:   #3F5A75;   /* Hover, weiße Schrift 7,17:1             */
  --bt-brand-darker: #2E4255;   /* dunkle Fläche                           */
  --bt-focus:        #6ba9ce;
  --bt-font:         "Open Sans", -apple-system, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bt-radius:       6px;
  --bt-field-height: 2.75rem;   /* 44 px */

  /* --- [INFERENZ – Vorschlag für die Tokendatei] -------------------------
     Markenblau + 45 % Weiß: Text und Links auf dunklem Grund.
     7,98:1 auf #171e26, 7,27:1 auf #1d262f, 4,92:1 auf #2E4255.          */
  --bt-brand-on-dark: #A2B5C7;

  /* --- Forgejo: Primärfarbe = Markenblau-Familie -------------------------- */
  --color-primary:          var(--bt-brand-on-dark);
  --color-primary-contrast: #020000;          /* 9,94:1 auf #A2B5C7 */
  --color-primary-dark-1:   #B4C4D3;
  --color-primary-dark-2:   #B4C4D3;
  --color-primary-dark-3:   #C9D4DF;
  --color-primary-dark-4:   #C9D4DF;
  --color-primary-dark-5:   #DCE4EC;
  --color-primary-dark-6:   #DCE4EC;
  --color-primary-dark-7:   #EEF2F5;
  --color-primary-light-1:  #8DA5BB;          /* 6,59:1 auf #171e26 */
  --color-primary-light-2:  #7892AC;
  --color-primary-light-3:  #55789a;
  --color-primary-light-4:  #3F5A75;
  --color-primary-light-5:  #3F5A75;
  --color-primary-light-6:  #2E4255;
  --color-primary-light-7:  #2E4255;
  --color-primary-alpha-10: #55789a19;
  --color-primary-alpha-20: #55789a33;
  --color-primary-alpha-30: #55789a4b;
  --color-primary-alpha-40: #55789a66;
  --color-primary-alpha-50: #55789a80;
  --color-primary-alpha-60: #55789a99;
  --color-primary-alpha-70: #55789ab3;
  --color-primary-alpha-80: #55789acc;
  --color-primary-alpha-90: #55789ae1;

  /* --- Navigation auf dunkler Markenfläche -------------------------------- */
  --color-nav-bg:       var(--bt-brand-darker);   /* Text #d2e0f0: 7,73:1 */
  --color-nav-hover-bg: var(--bt-brand-dark);     /* Text #d2e0f0: 5,34:1 */
  --bt-card-border:     rgba(201, 212, 223, 0.16);
  --bt-card-divider:    rgba(201, 212, 223, 0.12);

  /* --- Eingaberänder ≥ 3:1 (WCAG 1.4.11) ---------------------------------- */
  --color-input-border:       #7c8c9f;          /* 3,57:1 auf #2b3642 */
  --color-input-border-hover: #8DA5BB;

  --fonts-proportional: var(--bt-font);
  --border-radius: var(--bt-radius);
}

/* --- Schaltflächen: Markenblau mit weißer Schrift (Markenpaket) ------------ */
.ui.primary.button,
.ui.primary.buttons .button {
  background: var(--bt-brand);
  color: #ffffff;
}
.ui.primary.button:hover,
.ui.primary.buttons .button:hover,
.ui.primary.button:active,
.ui.primary.buttons .button:active {
  background: var(--bt-brand-dark);
  color: #ffffff;
}

/* --- Sichtbarer Fokus (3 px Akzent, 2 px Versatz) --------------------------- */
a:focus-visible,
.ui.button:focus-visible,
.ui.form input:focus-visible,
.ui.checkbox input:focus-visible + label {
  outline: 3px solid var(--bt-focus);
  outline-offset: 2px;
}

/* --- Navigation klar von der Seite abgesetzt --------------------------------- */
#navbar { border-bottom: 1px solid var(--bt-card-border); }

/* ===========================================================================
   Anmeldeseiten – eine kompakte Karte
   Gilt für: Anmeldung, 2FA, Recovery-Code, Sicherheitsschlüssel,
   Passwortwechsel beim ersten Login (.page-content.user.signin) und
   „Passwort vergessen" (.page-content.user.forgot.password).
   Das jeweils äußere Element wird selbst zur Karte:
     Logo (::before) · Überschrift · Formular · Fußlink
   Keine Vorlage wird überschrieben; nur Darstellung.
   =========================================================================== */

/* Seite füllt exakt den Platz zwischen Navigation und Fußzeile – keine
   künstliche Höhe, kein Scrollen bei wenig Inhalt */
.full.height:has(> .page-content.user.signin),
.full.height:has(> .page-content.user.forgot.password) {
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}
.page-content.user.signin,
.page-content.user.forgot.password {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 5vh, 3rem) var(--page-margin-x);
  background:
    radial-gradient(ellipse 60rem 30rem at 50% 0%, rgba(107, 169, 206, 0.08), rgba(107, 169, 206, 0) 70%),
    linear-gradient(180deg, #171e26 0%, #10161d 100%);
}

/* Äußere Hülle: feste, schmale Breite statt Raster-Rändern (3 %–23 %) */
.page-content.user.signin > .ui.page.grid,
.page-content.user.forgot.password > .ui.page.grid,
.page-content.user.signin > .ui.ui.ui.container:not(.fluid) {
  width: 100%;
  max-width: 24rem;
  margin: 0 auto;
  padding: 0;
}

/* Die Karte */
.page-content.user.signin > .ui.page.grid > .column,
.page-content.user.forgot.password > .ui.page.grid > .column,
.page-content.user.signin > .ui.ui.ui.container:not(.fluid) {
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  text-align: left;
  background: var(--color-box-body);
  border: 1px solid var(--bt-card-border);
  border-top: 3px solid var(--bt-accent);        /* Akzent als Linie */
  border-radius: var(--bt-radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.40);
  overflow: hidden;
}

/* Spalten tragen tw-max-w-2xl (42rem, !important) – in der Hülle auf volle Breite */
.page-content.user.signin > .ui.page.grid > .column,
.page-content.user.forgot.password > .ui.page.grid > .column { max-width: none !important; }

/* Logo oben in der Karte */
.page-content.user.signin > .ui.page.grid > .column::before,
.page-content.user.forgot.password > .ui.page.grid > .column::before,
.page-content.user.signin > .ui.ui.ui.container:not(.fluid)::before {
  content: "";
  display: block;
  width: 9.5rem;
  aspect-ratio: 640 / 360;
  margin: 1.5rem auto 0.25rem;
  background: url("../img/baertec/logo-weiss-640.png") center / contain no-repeat;
}

/* Innenleben: keine eigenen Kästen, Rahmen oder Breiten mehr */
.page-content.user.signin .ui.container.fluid,
.page-content.user.signin form.ui.form,
.page-content.user.forgot.password form.ui.form {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}
.page-content.user.signin .ui.attached.header,
.page-content.user.signin .ui.attached.segment,
.page-content.user.forgot.password .ui.attached.header,
.page-content.user.forgot.password .ui.attached.segment {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  width: auto;
  max-width: none;
}
.page-content.user.signin .ui.top.attached.header,
.page-content.user.forgot.password .ui.top.attached.header {
  padding: 0.5rem 1.5rem 0.25rem;
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
}
.page-content.user.signin .ui.attached.segment,
.page-content.user.forgot.password .ui.attached.segment {
  padding: 0.75rem 1.5rem 1.5rem;
}

/* „Passwort vergessen?" als Fußzeile der Karte statt zweiter Box */
.page-content.user.signin .ui.container.fluid + .ui.container.fluid {
  border-top: 1px solid var(--bt-card-divider);
}
.page-content.user.signin .ui.container.fluid + .ui.container.fluid .ui.attached.segment {
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 400;
}
.page-content.user.signin .ui.container.fluid + .ui.container.fluid .field { margin: 0; }

/* Meldungen (Fehler/Hinweis) innerhalb der Karte */
.page-content.user.signin .ui.message,
.page-content.user.forgot.password .ui.message {
  margin: 0.75rem 1.5rem 0;
}

/* Felder: 44 px, 16 px Schrift (kein Zoom auf iOS), volle Kartenbreite */
.page-content.user.signin .ui.form .field,
.page-content.user.forgot.password .ui.form .field { margin-bottom: 1rem; }
.page-content.user.signin .ui.form .field:last-child,
.page-content.user.forgot.password .ui.form .field:last-child { margin-bottom: 0; }
.page-content.user.signin .ui.form .field > label,
.page-content.user.forgot.password .ui.form .field > label {
  font-weight: 600;
  font-size: 0.875rem;
}
.page-content.user.signin .ui.form input[type="text"],
.page-content.user.signin .ui.form input[type="password"],
.page-content.user.signin .ui.form input[type="email"],
.page-content.user.signin .ui.form input:not([type]),
.page-content.user.forgot.password .ui.form input[type="email"],
.page-content.user.forgot.password .ui.form input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  min-height: var(--bt-field-height);
  font-size: 1rem;
  border-radius: var(--bt-radius);
}
.page-content.user.signin .ui.primary.button,
.page-content.user.forgot.password .ui.primary.button {
  width: 100%;
  min-height: var(--bt-field-height);
  margin: 0;
  border-radius: var(--bt-radius);
  font-weight: 600;
  font-size: 1rem;
}

/* Sehr schmale Geräte: Karte randlos, Innenabstand kleiner */
@media (max-width: 380px) {
  .page-content.user.signin,
  .page-content.user.forgot.password { padding: 0.75rem 0.5rem; }
  .page-content.user.signin .ui.top.attached.header,
  .page-content.user.forgot.password .ui.top.attached.header { padding-left: 1rem; padding-right: 1rem; }
  .page-content.user.signin .ui.attached.segment,
  .page-content.user.forgot.password .ui.attached.segment { padding-left: 1rem; padding-right: 1rem; }
  .page-content.user.signin > .ui.page.grid > .column::before,
  .page-content.user.forgot.password > .ui.page.grid > .column::before,
  .page-content.user.signin > .ui.ui.ui.container:not(.fluid)::before { width: 8rem; margin-top: 1.25rem; }
}

/* Niedrige Fenster (Handy quer): Logo kleiner, weniger Luft */
@media (max-height: 560px) {
  .page-content.user.signin,
  .page-content.user.forgot.password { padding-top: 0.75rem; padding-bottom: 0.75rem; }
  .page-content.user.signin > .ui.page.grid > .column::before,
  .page-content.user.forgot.password > .ui.page.grid > .column::before,
  .page-content.user.signin > .ui.ui.ui.container:not(.fluid)::before { width: 6.5rem; margin-top: 0.75rem; }
}

/* Weniger Bewegung/Transparenz gewünscht: Schatten reduzieren */
@media (prefers-reduced-transparency: reduce) {
  .page-content.user.signin > .ui.page.grid > .column,
  .page-content.user.forgot.password > .ui.page.grid > .column,
  .page-content.user.signin > .ui.ui.ui.container:not(.fluid) { box-shadow: none; }
}
