/* Login page. Brand stage on the left is pure vector (sharp on every screen); fonts are local (CSP: 'self' only). */
@font-face { font-family: "Inter"; src: url('/login/fonts/inter.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url('/login/fonts/jakarta.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }

/* Cross-fade into /app after signing in (the app opts in as well). */
@view-transition { navigation: auto; }

:root {
  --ink: #111216; --ink-2: #464a53; --ink-3: #82868f; --line: #e6e4e1; --line-strong: #d6d3cf; --field: #ffffff;
  --brand: #e73237; --brand-strong: #c8202a; --brand-soft: #fdeeee; --canvas: #fbfaf9;
  --stage: #0a0a0c; --ease: cubic-bezier(.2, .7, .2, 1); --spring: cubic-bezier(.34, 1.4, .64, 1);
  color-scheme: light;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink); background: var(--canvas);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f3f3f4; --ink-2: #b9bcc3; --ink-3: #82868f; --line: #26272c; --line-strong: #34353b; --field: #16171a;
    --brand: #ef4a4f; --brand-strong: #e73237; --brand-soft: #33161a; --canvas: #0f1012;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100dvh; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
h1, h2 { font-family: "Jakarta", "Inter", sans-serif; letter-spacing: -.03em; text-wrap: balance; }
svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* The brand stage fills the whole screen; the form sits centred on top of it as a card. */
.login {
  position: relative; isolation: isolate; min-height: 100dvh; display: grid; place-items: center;
  padding: clamp(24px, 6vh, 64px) 16px;
}
/* ---------- Brand stage ---------- */
/* Pure backdrop: dark room, fine grid, and the lit Eglin sign ("e" and "weiter denken") to the right
   of the card. --mx / --my (-0.5 … 0.5) come from login.js and follow the pointer for a little depth. */
.stage {
  --mx: 0; --my: 0; --w: min(60vh, 36vw, 580px);
  position: absolute; inset: 0; z-index: -1; overflow: hidden; isolation: isolate; color: #fff; background: var(--stage);
}
/* Red light of the sign on the wall around it. */
.stage::before {
  content: ""; position: absolute; z-index: -3; left: calc(50% + 300px + var(--w) / 2); top: 50%; translate: -50% -50%; width: min(1100px, 110vmin); aspect-ratio: 1;
  background: radial-gradient(closest-side, rgba(231, 50, 55, .34), rgba(231, 50, 55, .08) 55%, transparent);
  animation: fade 1.2s 1s both, glow 7s 2s ease-in-out infinite alternate;
}
/* Vignette towards the edges. */
.stage::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 90% 90% at 50% 50%, transparent 50%, rgba(10, 10, 12, .85) 100%);
}
.stage-grid {
  position: absolute; inset: -24px; z-index: -4;
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 48px 48px; background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(70% 70% at 50% 50%, #000 10%, transparent 70%);
  mask-image: radial-gradient(70% 70% at 50% 50%, #000 10%, transparent 70%);
  transform: translate3d(calc(var(--mx) * -8px), calc(var(--my) * -8px), 0);
}

/* The sign: the e whole and uncut, "weiter denken" below, like the lit logo on the office wall. */
.stage-sign {
  /* No pointer parallax and no layer hint here: the sign must stay pixel-sharp. */
  position: absolute; z-index: -2; left: calc(50% + 300px); top: 50%; width: var(--w); translate: 0 -54%;
}
.stage-e {
  display: block; width: 100%; height: auto; overflow: visible; stroke: none;
  filter: drop-shadow(0 0 60px rgba(231, 50, 55, .5)) drop-shadow(0 30px 60px rgba(0, 0, 0, .5));
  /* Fades in calmly and then stays still; the breathing light is the glow behind it (.stage::before). */
  animation: fade 1.4s .2s var(--ease) both;
}
/* Laser along the outline of the e: a faint track, an intense red point and a shaded trail
   (four layers, each longer, thinner and fainter; together they fade out behind the point). */
.e-led-track { fill: none; stroke: rgba(231, 50, 55, .14); stroke-width: 2; }
/* One shared motion; each trail layer sits right behind the point via its dash pattern (gap first, then the dash). */
.laser { fill: none; stroke-linecap: round; animation: laser 8s linear infinite; }
.laser-dot { stroke: #ff3a40; stroke-width: 7; stroke-dasharray: 8 992; }
.laser-t1 { stroke: #e8262d; stroke-width: 5; stroke-dasharray: 0 940 60 0; opacity: .75; }
.laser-t2 { stroke: #c01b24; stroke-width: 4; stroke-dasharray: 0 850 150 0; opacity: .42; }
.laser-t3 { stroke: #8c1219; stroke-width: 3; stroke-dasharray: 0 700 300 0; opacity: .24; }

/* "weiter denken": draws together out of the blur, then a light sheen glides through the letters. */
.stage-tagline {
  position: relative; display: block; margin-top: calc(var(--w) * .05); text-align: center; white-space: nowrap;
  font-family: "Jakarta", "Inter", sans-serif; font-weight: 300; font-size: calc(var(--w) * .12); letter-spacing: -.01em;
  color: transparent; -webkit-background-clip: text; background-clip: text;
  /* Warm muted grey; the sheen passing through is red light, not white. */
  background-image: linear-gradient(100deg, #a39394 0%, #a39394 36%, #d9585c 45%, #ff4d52 50%, #d9585c 55%, #a39394 64%, #a39394 100%);
  background-size: 300% 100%; background-position: 100% 0;
  animation: tagline-in 1.8s 1s var(--ease) both, tagline-sheen 7s 3.2s ease-in-out infinite;
}
/* A fine red light line drawing itself under the words. */
.stage-tagline::after {
  content: ""; display: block; width: 0; height: 2px; margin: calc(var(--w) * .03) auto 0; border-radius: 2px;
  background: linear-gradient(90deg, transparent, #9e1a22 18%, #e73237 50%, #9e1a22 82%, transparent);
  box-shadow: 0 0 12px rgba(231, 50, 55, .7);
  animation: line-draw 1.6s 2.4s var(--ease) forwards;
}

/* A few sparks rising from the sign. */
.spark {
  position: absolute; bottom: 30%; width: 3px; height: 3px; border-radius: 50%; opacity: 0;
  background: #ff5a5f; box-shadow: 0 0 8px 2px rgba(231, 50, 55, .8);
  animation: spark 5.5s ease-out infinite;
}
.spark.s1 { left: 18%; animation-delay: 2.4s; --dx: -14px; }
.spark.s2 { left: 36%; animation-delay: 3.9s; --dx: 10px; animation-duration: 6.5s; }
.spark.s3 { left: 55%; animation-delay: 5.1s; --dx: -6px; }
.spark.s4 { left: 72%; animation-delay: 2.9s; --dx: 16px; animation-duration: 7s; }
.spark.s5 { left: 86%; animation-delay: 6.2s; --dx: -10px; animation-duration: 6s; }
.spark.s6 { left: 46%; animation-delay: 7.4s; --dx: 8px; animation-duration: 5s; }

/* ---------- Form panel ---------- */
/* The inner block centres itself with auto margins; the footer stays in the flow, so nothing overlaps on short screens. */
/* Dark glass card over the stage; its own colour set, independent of the system light/dark mode. */
.panel {
  --ink: #f3f3f4; --ink-2: #c4c7cd; --ink-3: #8e929b; --line: rgba(255, 255, 255, .1); --line-strong: rgba(255, 255, 255, .16);
  --field: rgba(255, 255, 255, .055); --brand-soft: rgba(231, 50, 55, .15); --canvas: transparent;
  color-scheme: dark; color: var(--ink);
  position: relative; width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center;
  padding: clamp(26px, 4vh, 36px) clamp(22px, 3vw, 36px) 20px; border-radius: 26px;
  background: linear-gradient(180deg, rgba(24, 24, 28, .78), rgba(14, 14, 17, .82));
  -webkit-backdrop-filter: blur(24px) saturate(1.3); backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, .09);
  box-shadow: 0 40px 110px -30px rgba(0, 0, 0, .85), 0 0 0 1px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .07);
  animation: appear .7s .05s var(--ease) both;
}
/* Light along the card edge and a faint glow inside, both following the pointer (--px/--py from login.js). */
.panel::before, .panel::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; }
.panel::before {
  padding: 1px;
  background: radial-gradient(260px circle at var(--px, 50%) var(--py, -10%), rgba(255, 96, 100, .75), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.panel::after { background: radial-gradient(420px circle at var(--px, 50%) var(--py, -10%), rgba(231, 50, 55, .08), transparent 60%); }
.panel-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 0 0 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.panel-brand img { width: 150px; height: auto; }
.panel-brand span { font-size: 11.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.panel .login-error { color: #ffb4b6; }
.panel .field-input input::placeholder { color: #6f737c; }
.panel-inner { width: 100%; transition: opacity .3s, filter .3s; }
.panel-inner > *, .login-form > * { animation: enter .6s var(--ease) both; }
.panel-inner > :nth-child(1) { animation-delay: .12s; }
.panel-inner > :nth-child(2) { animation-delay: .16s; }
.panel-inner > :nth-child(3) { animation-delay: .2s; }
.login-form > :nth-child(1) { animation-delay: .24s; }
.login-form > :nth-child(2) { animation-delay: .28s; }
.login-form > :nth-child(3) { animation-delay: .32s; }
.panel-inner > .divider { animation-delay: .36s; }
.panel-inner > .portal { animation-delay: .4s; }
.panel h2 { margin: 0; font-size: clamp(26px, 1vw + 18px, 32px); font-weight: 800; }
.panel-hint { margin: 8px 0 clamp(20px, 3.5vh, 28px); color: var(--ink-3); font-size: 15px; }

.login-form { display: grid; gap: clamp(14px, 2.2vh, 18px); }
.field { display: grid; gap: 8px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); transition: color .15s; }
.field:focus-within .field-label { color: var(--ink); }
.field-input { position: relative; display: flex; align-items: center; }
.field-input > svg { position: absolute; left: 15px; color: var(--ink-3); pointer-events: none; transition: color .2s, transform .25s var(--spring); }
.field-input:focus-within > svg { color: var(--brand); transform: scale(1.08); }
.field-input input {
  width: 100%; height: 50px; padding: 0 46px; font: inherit; font-size: 15.5px; color: var(--ink);
  background: var(--field); border: 1px solid var(--line-strong); border-radius: 12px; outline: none;
  box-shadow: 0 1px 2px rgba(17, 18, 22, .04);
  transition: border-color .2s, box-shadow .25s var(--ease), background .2s;
}
.field-input input::placeholder { color: var(--ink-3); opacity: .8; transition: opacity .2s; }
.field-input input:focus::placeholder { opacity: .45; }
.field-input input:hover { border-color: color-mix(in srgb, var(--ink-3) 55%, var(--line-strong)); }
.field-input input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent), 0 1px 2px rgba(17, 18, 22, .04); }
.field-input input[readonly] { opacity: .7; }
.login-toggle { position: absolute; right: 6px; display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-3); cursor: pointer; transition: background .15s, color .15s, transform .15s; }
.login-toggle:hover { background: color-mix(in srgb, var(--ink-3) 14%, transparent); color: var(--ink); }
.login-toggle:active { transform: scale(.92); }
.login-toggle[hidden] { display: none; }
.login-toggle .icon-hide, .login-toggle[aria-pressed="true"] .icon-show { display: none; }
.login-toggle[aria-pressed="true"] .icon-hide { display: block; }
.login-caps { font-size: 12.5px; font-weight: 500; color: #b26b00; animation: enter .25s var(--ease) both; }
.login-caps[hidden] { display: none; }

/* "Passwort vergessen": link under the password, back link and note on its own page. */
.login-forgot { justify-self: end; margin-top: -6px; font-size: 13px; font-weight: 500; color: var(--ink-3); text-decoration: none; border-radius: 6px; }
.login-forgot:hover { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 3px; }
.login-back { display: inline-flex; align-items: center; gap: 8px; margin-top: clamp(18px, 3vh, 24px); font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; border-radius: 6px; }
.login-back:hover { color: var(--brand-strong); }
.login-back svg { transition: transform .2s var(--ease); }
.login-back:hover svg { transform: translateX(-3px); }
.login-note { margin: 0; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); background: var(--field); border: 1px solid var(--line); }
.field-optional { font-weight: 400; color: var(--ink-3); }

.login-submit {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 10px; height: 50px; margin-top: 6px;
  font: inherit; font-weight: 600; font-size: 15.5px; color: #fff; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--brand); box-shadow: 0 1px 2px rgba(17, 18, 22, .1), 0 8px 20px -8px rgba(200, 32, 42, .65), inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: background .2s, transform .15s var(--ease), box-shadow .2s;
}
/* Light sweep on hover. */
.login-submit::after {
  content: ""; position: absolute; inset: 0; translate: -120% 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .22) 50%, transparent 70%);
  transition: translate .7s var(--ease);
}
.login-submit:hover { background: var(--brand-strong); box-shadow: 0 1px 2px rgba(17, 18, 22, .1), 0 12px 26px -10px rgba(200, 32, 42, .75), inset 0 1px 0 rgba(255, 255, 255, .18); }
.login-submit:hover::after { translate: 120% 0; }
.login-submit:active { transform: scale(.985); }
.login-arrow { width: 17px; height: 17px; transition: transform .25s var(--spring); }
.login-submit:hover .login-arrow { transform: translateX(3px); }
.login-spinner { display: none; width: 17px; height: 17px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .7s linear infinite; }
.login-submit.is-busy { cursor: progress; }
.login-submit.is-busy .login-spinner { display: block; }
.login-submit.is-busy .login-arrow { display: none; }
.login-form[data-busy] .field { opacity: .65; transition: opacity .3s; }

.divider { display: flex; align-items: center; gap: 14px; margin: clamp(18px, 3vh, 24px) 0 clamp(14px, 2.4vh, 18px); font-size: 12.5px; color: var(--ink-3); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.portal {
  display: flex; align-items: center; justify-content: center; gap: 10px; height: 48px; border-radius: 12px;
  font-size: 14.5px; font-weight: 600; color: var(--ink); text-decoration: none;
  background: var(--field); border: 1px solid var(--line-strong); box-shadow: 0 1px 2px rgba(17, 18, 22, .04);
  transition: border-color .2s, background .2s, transform .15s var(--ease);
}
.portal:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line-strong)); background: color-mix(in srgb, var(--brand-soft) 60%, var(--field)); }
.portal:active { transform: scale(.985); }
.portal img { width: 18px; height: 18px; transition: transform .3s var(--spring); }
.portal:hover img { transform: rotate(-8deg) scale(1.1); }

.login-error {
  display: flex; gap: 10px; align-items: flex-start; margin: 0 0 20px; padding: 12px 14px; border-radius: 12px;
  background: var(--brand-soft); color: var(--brand-strong); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
  font-size: 14px; line-height: 1.45;
}
.panel-inner > .login-error { animation: shake .42s .2s cubic-bezier(.36, .07, .19, .97) both; }

/* Password rules on the password page; each turns green once met (pure CSS tick, the CSP allows no data: images). */
.rules { list-style: none; display: grid; gap: 7px; margin: -4px 0 0; padding: 0; font-size: 13px; color: var(--ink-3); }
.rules li { position: relative; display: flex; align-items: center; gap: 9px; transition: color .2s; }
.rules li::before { content: ""; width: 16px; height: 16px; flex: none; box-sizing: border-box; border-radius: 50%; border: 1.5px solid var(--line-strong); transition: background-color .2s, border-color .2s; }
.rules li::after {
  content: ""; position: absolute; left: 5.5px; top: 50%; width: 4px; height: 8px; margin-top: -5.5px;
  border: solid #fff; border-width: 0 2px 2px 0; rotate: 45deg; opacity: 0; scale: .5; transition: opacity .2s, scale .25s var(--spring);
}
.rules li.is-met { color: var(--ink-2); }
.rules li.is-met::before { border-color: #1f9d55; background: #1f9d55; }
.rules li.is-met::after { opacity: 1; scale: 1; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.panel-foot {
  width: 100%; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin-top: 26px; white-space: nowrap;
  font-size: 12.5px; color: var(--ink-3); animation: fade .8s .5s both;
}
.panel-foot span { display: inline-flex; align-items: center; gap: 7px; }
.panel-foot svg { width: 14px; height: 14px; }

/* ---------- Motion ---------- */
@keyframes enter { from { opacity: 0; transform: translateY(12px); } }
@keyframes appear { from { opacity: 0; scale: .94; } }
@keyframes fade { from { opacity: 0; } }
@keyframes glow { to { opacity: .7; transform: scale(1.06); } }
@keyframes spark { 0% { opacity: 0; transform: translate(0, 0) scale(1); } 12% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx, 0), calc(var(--w) * -.55)) scale(.3); } }
@keyframes laser { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -1000; } }
@keyframes tagline-in { from { opacity: 0; letter-spacing: .28em; filter: blur(8px); } to { opacity: 1; letter-spacing: -.01em; filter: none; } }
@keyframes tagline-sheen { 0% { background-position: 100% 0; } 55%, 100% { background-position: 0 0; } }
@keyframes line-draw { to { width: 62%; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); } 30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); } }

/* ---------- Large screens ---------- */
@media (min-width: 1800px) {
  .panel { max-width: 460px; }
  .field-input input, .login-submit { height: 54px; }
  .portal { height: 52px; }
}

/* ---------- Tablet ---------- */
/* ---------- No room beside the card: the e steps back, faint and centred behind it ---------- */
@media (max-width: 1240px) {
  .stage { --w: min(90vh, 110vw); }
  .stage-sign { left: 50%; translate: -50% -50%; opacity: .16; }
  .stage-e { animation: none; filter: none; }
  .stage-tagline, .spark { display: none; }
  .stage::before { left: 50%; width: min(1000px, 130vmin); }
}

/* ---------- Phone: card from the top ---------- */
@media (max-width: 600px) {
  .login { place-items: start center; padding: 20px 12px calc(20px + env(safe-area-inset-bottom)); }
  .panel { padding: 26px 20px 16px; border-radius: 20px; }
  /* 16px keeps iOS from zooming into the field on focus. */
  .field-input input { font-size: 16px; }
}
@media (max-width: 360px) {
  .login { padding-left: 8px; padding-right: 8px; }
  .panel { padding-left: 16px; padding-right: 16px; }
}

/* ---------- Phone in landscape: tighter card ---------- */
@media (max-height: 560px) and (orientation: landscape) {
  .login { padding-top: 20px; padding-bottom: 20px; place-items: center; }
  .panel { padding: 20px 24px 14px; }
  .panel-hint { margin-bottom: 16px; }
  .panel-foot { margin-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .spark, .laser { display: none; }
  .stage-tagline::after { width: 62%; }
  .login-spinner { animation: spin 1.6s linear infinite !important; }
}
