/* ============================================================
   Chadura sign-in page
   Injected by nginx sub_filter on pages with data-testid="login-page".
   Palette sampled from the Chadura mark: #3AC7F3 -> #5266AF.

   Layout targets (GitLab 19 devise layout):
     main.content > .row > .col-md:first-child   heading + description
     main.content > .row > .col-md:last-child    logo + form
     .col-sm-12.bar                              form wrapper -> the card
   ============================================================ */

:root {
  --ch-cyan:   #3AC7F3;
  --ch-sky:    #4FB0DE;
  --ch-blue:   #4080C0;
  --ch-indigo: #5266AF;
  --ch-deep:   #0C1015;
}

/* ---------------- 1. GROUND ---------------- */
body.login-page {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  background: #F4F8FB;
}

/* aurora: large, genuinely visible colour masses that drift */
body.login-page::before {
  content: "";
  position: fixed;
  inset: -30vmax;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42vmax 34vmax at 20% 18%, rgba(58, 199, 243, .55), transparent 60%),
    radial-gradient(38vmax 30vmax at 84% 22%, rgba(82, 102, 175, .50), transparent 62%),
    radial-gradient(46vmax 36vmax at 72% 88%, rgba(64, 128, 192, .42), transparent 62%),
    radial-gradient(34vmax 28vmax at 12% 84%, rgba(58, 199, 243, .34), transparent 62%);
  filter: blur(30px) saturate(115%);
  animation: ch-aurora 30s ease-in-out infinite alternate,
             ch-hue 44s ease-in-out infinite alternate;
}

@keyframes ch-aurora {
  0%   { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
  50%  { transform: translate3d(2%, -2.5%, 0) scale(1.09) rotate(1.5deg); }
  100% { transform: translate3d(-2%, 2%, 0) scale(1.05) rotate(-1.5deg); }
}

/* diamond grid echoing the logo mark - outlines, tiled, not triangles */
body.login-page::after {
  content: "";
  position: fixed;
  inset: -10vmax;
  z-index: 0;
  pointer-events: none;
  opacity: .34;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%2760%27%20height%3D%2760%27%20viewBox%3D%270%200%2060%2060%27%3E%3Cpath%20d%3D%27M30%209L51%2030L30%2051L9%2030Z%20M0%20-21L21%200L0%2021L-21%200Z%20M60%20-21L81%200L60%2021L39%200Z%20M0%2039L21%2060L0%2081L-21%2060Z%20M60%2039L81%2060L60%2081L39%2060Z%27%20fill%3D%27none%27%20stroke%3D%27rgba%28120%2C170%2C220%2C0.55%29%27%20stroke-width%3D%271%27%2F%3E%3C%2Fsvg%3E");
  background-size: 60px 60px;
  -webkit-mask-image: radial-gradient(72vmax 56vmax at 50% 46%, transparent 18%, #000 82%);
  mask-image: radial-gradient(72vmax 56vmax at 50% 46%, transparent 18%, #000 82%);
  animation: ch-grid 90s linear infinite,
             ch-breathe 38s ease-in-out infinite alternate;
}

@keyframes ch-grid {
  from { background-position: 0 0; }
  to   { background-position: 60px 60px; }
}

body.login-page > *,
body.login-page main.content { position: relative; z-index: 1; }

/* ---------------- 2. LAYOUT: fill the viewport ---------------- */
body.login-page main.content {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 132px);
  padding: 2.5rem 1.25rem;
  box-sizing: border-box;
}

body.login-page main.content > .row {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  align-items: center;
  row-gap: 2.5rem;
}

/* ---------------- 3. LEFT COLUMN ---------------- */
body.login-page main.content > .row > .col-md:first-child {
  animation: ch-in .8s cubic-bezier(.16, .84, .32, 1) both;
}

body.login-page main.content > .row > .col-md:first-child h1 {
  font-size: clamp(2.6rem, 5vw, 4.1rem) !important;
  line-height: 1.02;
  letter-spacing: -.035em;
  font-weight: 800;
  margin-bottom: 1.1rem !important;
  background: linear-gradient(115deg, var(--ch-cyan) 0%, var(--ch-blue) 45%, var(--ch-indigo) 100%);
  background-size: 210% 100%;
  background-position: 28% 50%;
  animation: ch-in .8s cubic-bezier(.16, .84, .32, 1) both,
             ch-shimmer 11s 1.2s ease-in-out infinite;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-wrap: balance;
}

body.login-page main.content > .row > .col-md:first-child p {
  font-size: 1.075rem;
  line-height: 1.62;
  max-width: 34ch;
  color: #4a5462;
}

body.login-page main.content > .row > .col-md:first-child .md::after {
  content: "";
  display: block;
  height: 3px;
  width: 0;
  margin-top: 1.75rem;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--ch-cyan), var(--ch-indigo));
  animation: ch-rule 1.1s .5s cubic-bezier(.16, .84, .32, 1) forwards;
}

@keyframes ch-rule { to { width: 116px; } }

/* ---------------- 4. RIGHT COLUMN: the card ---------------- */
body.login-page main.content > .row > .col-md:last-child {
  animation: ch-in .8s .1s cubic-bezier(.16, .84, .32, 1) both;
}

body.login-page .col-sm-12.bar {
  max-width: 420px;
  margin-inline: auto;
  padding: 2.1rem 1.9rem 1.8rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, .74);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(82, 102, 175, .18);
  box-shadow:
    0 1px 2px rgba(12, 16, 21, .04),
    0 24px 60px -20px rgba(82, 102, 175, .38);
  transition: box-shadow .4s ease;
}

body.login-page .col-sm-12.bar:hover {
  box-shadow:
    0 1px 2px rgba(12, 16, 21, .04),
    0 32px 76px -22px rgba(82, 102, 175, .46);
}

@keyframes ch-in {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* GitLab's js-portrait-logo-detection can leave gl-invisible on the logo;
   don't depend on that script winning its race */
body.login-page img[alt="Chadura"] {
  visibility: visible !important;
  height: 2.5rem;
  width: auto;
}

/* motion lives on the wrapper so it never interacts with the replaced image box */
body.login-page .col-sm-12.bar > .gl-text-center:first-child {
  animation: ch-logo-in .8s .18s cubic-bezier(.16,.84,.32,1) both,
             ch-logo-float 7s 1.1s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes ch-logo-in    { from { opacity: 0; transform: scale(.93); } to { opacity: 1; transform: scale(1); } }
@keyframes ch-logo-float { from { transform: translateY(-2.5px); }    to { transform: translateY(2.5px); } }

/* ---------------- 5. CONTROLS ---------------- */
body.login-page .form-control,
body.login-page .gl-form-input,
body.login-page input[type="text"],
body.login-page input[type="email"],
body.login-page input[type="password"] {
  border-radius: 10px;
  border-color: rgba(82, 102, 175, .30);
  padding-block: .58rem;
  transition: border-color .2s ease, box-shadow .2s ease;
}

body.login-page .form-control:focus,
body.login-page .gl-form-input:focus,
body.login-page input[type="text"]:focus,
body.login-page input[type="email"]:focus,
body.login-page input[type="password"]:focus {
  border-color: var(--ch-sky);
  box-shadow: 0 0 0 3px rgba(58, 199, 243, .28);
  outline: none;
}

body.login-page .btn-confirm,
body.login-page [data-testid="sign-in-button"] {
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: 10px;
  padding-block: .55rem;
  color: #fff !important;
  font-weight: 600;
  background-image: linear-gradient(115deg, var(--ch-cyan) 0%, var(--ch-blue) 50%, var(--ch-indigo) 100%);
  background-size: 190% 190%;
  background-position: 0% 50%;
  box-shadow: 0 6px 18px -6px rgba(82, 102, 175, .60);
  transition: background-position .55s ease, transform .16s ease, box-shadow .3s ease;
}

body.login-page .btn-confirm:hover,
body.login-page [data-testid="sign-in-button"]:hover {
  background-position: 100% 50%;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -8px rgba(82, 102, 175, .68);
}

body.login-page .btn-confirm:active,
body.login-page [data-testid="sign-in-button"]:active { transform: translateY(0); }

body.login-page [data-testid="sign-in-button"]::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.42), transparent);
  transform: skewX(-18deg);
  animation: ch-sweep 4.6s 1.4s ease-in-out infinite;
}

@keyframes ch-sweep {
  0%, 62%, 100% { left: -60%; }
  84%           { left: 118%; }
}

body.login-page [data-testid="passkey-login-button"] { border-radius: 10px; }

body.login-page .btn-confirm:focus-visible,
body.login-page [data-testid="sign-in-button"]:focus-visible,
body.login-page a:focus-visible {
  outline: 2px solid var(--ch-indigo);
  outline-offset: 2px;
}

body.login-page a { color: var(--ch-blue); }
body.login-page a:hover { color: var(--ch-indigo); }

/* ---------------- 6. DARK MODE ---------------- */
@media (prefers-color-scheme: dark) {
  body.login-page { background: var(--ch-deep); }
  body.login-page::before { filter: blur(34px) saturate(125%); opacity: .75; }
  body.login-page::after  { opacity: .42; }
  body.login-page main.content > .row > .col-md:first-child p { color: #9aa6b6; }
  body.login-page .col-sm-12.bar {
    background: rgba(19, 24, 31, .72);
    border-color: rgba(58, 199, 243, .20);
    box-shadow:
      0 1px 2px rgba(0, 0, 0, .5),
      0 28px 70px -22px rgba(0, 0, 0, .78),
      inset 0 1px 0 rgba(255, 255, 255, .05);
  }
  body.login-page img[alt="Chadura"] { content: url("/brand/out-logo-dark-mode.png"); }
  body.login-page a { color: var(--ch-cyan); }
  body.login-page a:hover { color: #7FDCFB; }
}

/* ---------------- 7. NARROW SCREENS ---------------- */
@media (max-width: 767px) {
  body.login-page main.content {
    min-height: auto;
    padding: 1.75rem 1rem 2.5rem;
    align-items: flex-start;
  }
  body.login-page .col-sm-12.bar { padding: 1.5rem 1.25rem 1.35rem; border-radius: 15px; }
  body.login-page main.content > .row > .col-md:first-child .md::after { margin-top: 1.2rem; }
}

/* ---------------- 8. MOTION PREFERENCES ---------------- */
@media (prefers-reduced-motion: reduce) {
  body.login-page::before,
  body.login-page::after,
  body.login-page main.content > .row > .col-md:first-child,
  body.login-page main.content > .row > .col-md:last-child,
  body.login-page .col-sm-12.bar > .gl-text-center:first-child,
  body.login-page [data-testid="sign-in-button"]::after { animation: none !important; }
  body.login-page main.content > .row > .col-md:first-child .md::after { animation: none !important; width: 116px; }
  body.login-page * { transition-duration: .01ms !important; }
}


/* ============================================================
   ADDITIONAL MOTION - design unchanged, movement layered on
   ============================================================ */

/* the gradient travels through the headline letters */
@keyframes ch-shimmer {
  0%, 100% { background-position: 28% 50%; }
  50%      { background-position: 72% 50%; }
}

/* the aurora breathes through neighbouring hues */
@keyframes ch-hue {
  from { filter: blur(30px) saturate(115%) hue-rotate(-10deg); }
  to   { filter: blur(30px) saturate(125%) hue-rotate(10deg); }
}

/* the diamond field drifts toward and away from the viewer */
@keyframes ch-breathe {
  from { transform: scale(1); }
  to   { transform: scale(1.05); }
}

/* ---- staggered field entrance: the form assembles itself ---- */
body.login-page .col-sm-12.bar form[data-testid="sign-in-form"] .form-group,
body.login-page .col-sm-12.bar form[data-testid="sign-in-form"] > div.gl-mb-3,
body.login-page .col-sm-12.bar form[data-testid="sign-in-form"] > button,
body.login-page .col-sm-12.bar [data-testid="passkey-login-button"] {
  animation: ch-field .6s cubic-bezier(.16, .84, .32, 1) both;
}

@keyframes ch-field {
  from { opacity: 0; transform: translateY(9px); }
  to   { opacity: 1; transform: translateY(0); }
}

body.login-page .col-sm-12.bar form[data-testid="sign-in-form"] .form-group:nth-of-type(1) { animation-delay: .34s; }
body.login-page .col-sm-12.bar form[data-testid="sign-in-form"] .form-group:nth-of-type(2) { animation-delay: .42s; }
body.login-page .col-sm-12.bar form[data-testid="sign-in-form"] > div.gl-mb-3              { animation-delay: .50s; }
body.login-page .col-sm-12.bar form[data-testid="sign-in-form"] > button                   { animation-delay: .58s; }
body.login-page .col-sm-12.bar [data-testid="passkey-login-button"]                        { animation-delay: .66s; }

/* ---- one-time sheen crossing the card after it lands ---- */
body.login-page .col-sm-12.bar { position: relative; overflow: hidden; }

body.login-page .col-sm-12.bar::before {
  content: "";
  position: absolute;
  top: -60%;
  bottom: -60%;
  left: -40%;
  width: 34%;
  pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .16), transparent);
  transform: skewX(-16deg);
  animation: ch-sheen 1.5s .85s cubic-bezier(.3, .7, .4, 1) 1 both;
}

@keyframes ch-sheen {
  from { left: -40%; opacity: 0; }
  25%  { opacity: 1; }
  to   { left: 128%; opacity: 0; }
}

/* ---- the card's edge glows faintly, in and out ---- */
body.login-page .col-sm-12.bar {
  animation: ch-edge 9s 1.6s ease-in-out infinite alternate;
}

@keyframes ch-edge {
  from { border-color: rgba(82, 102, 175, .18); }
  to   { border-color: rgba(58, 199, 243, .34); }
}

/* ---- focus lands with a ring that expands, not just appears ---- */
body.login-page .form-control:focus,
body.login-page .gl-form-input:focus,
body.login-page input[type="text"]:focus,
body.login-page input[type="email"]:focus,
body.login-page input[type="password"]:focus {
  animation: ch-ring .34s cubic-bezier(.16, .84, .32, 1) 1;
}

@keyframes ch-ring {
  from { box-shadow: 0 0 0 0 rgba(58, 199, 243, .48); }
  to   { box-shadow: 0 0 0 3px rgba(58, 199, 243, .28); }
}

/* ---- secondary action earns a hover response too ---- */
body.login-page [data-testid="passkey-login-button"] {
  transition: transform .16s ease, box-shadow .28s ease, border-color .28s ease;
}
body.login-page [data-testid="passkey-login-button"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -8px rgba(82, 102, 175, .45);
}

/* ---- links: the underline draws in from the left ---- */
body.login-page .col-sm-12.bar a,
body.login-page main.content a {
  position: relative;
  text-decoration: none;
}

body.login-page .col-sm-12.bar a::after,
body.login-page main.content a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  height: 1px;
  width: 0;
  background: currentColor;
  transition: width .26s cubic-bezier(.16, .84, .32, 1);
}

body.login-page .col-sm-12.bar a:hover::after,
body.login-page main.content a:hover::after { width: 100%; }

/* ---- the brand rule keeps a slow shimmer after it draws ---- */
body.login-page main.content > .row > .col-md:first-child .md::after {
  background-size: 220% 100%;
  animation: ch-rule 1.1s .5s cubic-bezier(.16, .84, .32, 1) forwards,
             ch-rule-shift 7s 1.8s ease-in-out infinite alternate;
}

@keyframes ch-rule-shift {
  from { background-position: 0% 50%; }
  to   { background-position: 100% 50%; }
}

/* ---- motion preferences: stop all of the above ---- */
@media (prefers-reduced-motion: reduce) {
  body.login-page .col-sm-12.bar,
  body.login-page .col-sm-12.bar::before,
  body.login-page .col-sm-12.bar form[data-testid="sign-in-form"] .form-group,
  body.login-page .col-sm-12.bar form[data-testid="sign-in-form"] > div.gl-mb-3,
  body.login-page .col-sm-12.bar form[data-testid="sign-in-form"] > button,
  body.login-page .col-sm-12.bar [data-testid="passkey-login-button"],
  body.login-page main.content > .row > .col-md:first-child h1 {
    animation: none !important;
  }
  body.login-page .col-sm-12.bar::before { display: none; }
  body.login-page .col-sm-12.bar a::after,
  body.login-page main.content a::after { transition: none !important; }
}
