/* ===========================================================================
 * Soft-UI design kit: sign-in page
 * ---------------------------------------------------------------------------
 * A light split page: the form on the left, a rounded grey "stage" of floating
 * white feature tiles on the right. Load tokens.css first; this file does not
 * need components.css.
 *
 * Layout: from 1024px two columns; below that one column with the stage under
 * the form; below 640px no stage. Laid out to work from 320px.
 *
 * The stage is built from the product's own feature tiles: no illustration, no
 * mascot, no emoji. Light only.
 * =========================================================================== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100%; }

body.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] { display: none !important; }

/* ---- Shell -------------------------------------------------------------------
 * The left column has a clamped width and the stage takes the rest, so a wide
 * monitor grows the stage, never the form. */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 14px;
  display: grid;
  grid-template-columns: clamp(460px, 40vw, 620px) minmax(0, 1fr);
}

.login-left {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 26px 52px 20px;
}

.login-top,
.login-main,
.login-footer-line {
  width: 100%;
  max-width: 456px;
  margin-inline: auto;
}

.login-top  { flex: none; }
.login-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 36px 0;
}

/* ---- Brand ------------------------------------------------------------------- */
.login-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.login-logo svg { flex: none; width: 30px; height: 30px; }

.login-eyebrow {
  margin-bottom: 14px;
  font-size: var(--eyebrow-size);
  font-weight: var(--eyebrow-weight);
  letter-spacing: var(--eyebrow-track);
  text-transform: uppercase;
  color: var(--muted);
}

.login-headline {
  font-size: clamp(30px, 4.2vw, 38px);
  font-weight: 700;
  line-height: 1.13;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.login-headline span { display: block; }

.login-tagline {
  margin-top: 12px;
  font-size: 16px;
  color: var(--muted);
}

.login-footer-line {
  flex: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

/* ---- Form ----------------------------------------------------------------------
 * The fields of a step sit in ONE grey panel; the primary action sits below it on
 * the page. minmax(0, 1fr), not an auto track: an auto track cannot go below its
 * content's minimum width, and six code boxes would then push a small phone wide. */
.login-card { width: 100%; margin-top: 28px; }

.login-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.login-panel {
  padding: 12px;
  background: var(--fill);
  border-radius: 22px;
}

.login-label {
  display: block;
  margin: 2px 4px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-strong);
}

.login-input {
  display: block;
  width: 100%;
  height: 52px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--fill-2);
  border: 0;
  border-radius: var(--radius-md);
  text-overflow: ellipsis;
  -webkit-appearance: none;
  appearance: none;
}
.login-input::placeholder {
  color: var(--placeholder);
  opacity: 1;
  text-overflow: ellipsis;
}
/* Keep the grey fill when the browser autofills. */
.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover,
.login-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 1000px var(--fill-2) inset;
  caret-color: var(--ink);
}

.login-help {
  margin: 8px 4px 2px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted-strong);
}

/* ---- Primary button: an ink capsule ---------------------------------------------- */
.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 56px;
  padding: 0 24px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: #FFFFFF;
  background: var(--ink);
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform var(--dur-press) var(--ease-out), opacity var(--dur-fade) ease;
}
@media (hover: hover) {
  .login-btn:hover:not(:disabled) { opacity: 0.92; }
}
.login-btn:active:not(:disabled) { transform: scale(var(--scale-press)); }
.login-btn:disabled {
  color: var(--faint);
  background: var(--fill-2);
  cursor: not-allowed;
}

/* ---- Back row -------------------------------------------------------------------- */
.login-back-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.login-back-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--ink);
  background: var(--fill);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color var(--dur-fade) ease, transform var(--dur-press) var(--ease-out);
}
@media (hover: hover) {
  .login-back-btn:hover { background: var(--fill-2); }
}
.login-back-btn:active { transform: scale(var(--scale-press)); }

.login-back-text {
  min-width: 0;
  font-size: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.login-back-text strong { color: var(--ink); font-weight: 600; }

/* ---- Messages: a status colour on a soft tint, never a bordered alert -------------- */
.login-error,
.login-note {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}
.login-error { background: var(--neg-bg); color: var(--neg); }
.login-note  { background: var(--fill);   color: var(--muted-strong); }

/* ---- Six-digit code ------------------------------------------------------------------ */
.login-panel-code { padding: 16px 12px; }

.code-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 14px 0;
}

.code-input {
  flex: 1 1 0;
  min-width: 0;
  max-width: 52px;
  height: 56px;
  padding: 0;
  text-align: center;
  font-family: inherit;
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--fill-2);
  border: 0;
  border-radius: var(--radius-md);
  -webkit-appearance: none;
  appearance: none;
}

.code-meta {
  text-align: center;
  font-size: 13px;
  color: var(--muted-strong);
}
.code-meta strong { color: var(--ink); font-weight: 600; }

.login-center { text-align: center; }

.resend-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color var(--dur-fade) ease, transform var(--dur-press) var(--ease-out);
}
@media (hover: hover) {
  .resend-btn:hover { background: var(--fill); }
}
.resend-btn:active { transform: scale(var(--scale-press)); }

/* ---- Stage: feature tiles as white cards floating on a soft grey panel -------------
 * The tilt and the column stagger use the individual rotate and translate
 * properties, so they compose with the entrance animation's transform. A browser
 * without them simply shows the cards straight. */
.login-stage {
  position: relative;
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 48px 40px;
  overflow: hidden;
  background: var(--fill);
  border-radius: var(--radius-xl);
}
/* A faint wash of the brand colour behind the cards. */
.login-stage::before {
  content: '';
  position: absolute;
  inset: 8% 6%;
  background: radial-gradient(closest-side, var(--brand-wash), transparent);
  opacity: .9;
  pointer-events: none;
}

.login-tiles {
  position: relative;
  list-style: none;
  width: min(100%, 600px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 24px;
}

.login-tile {
  --tilt: 0deg;
  --dx: 0px;
  --dy: 0px;
  --i: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border-radius: 22px;
  box-shadow: var(--elev-float);
  rotate: var(--tilt);
  translate: var(--dx) var(--dy);
}
/* The left column sits a little higher than the right; each card leans its own way. */
.login-tile:nth-child(odd)  { --dy: -20px; }
.login-tile:nth-child(even) { --dy:  20px; }
.login-tile:nth-child(1) { --tilt: -3deg;   --dx: -6px; }
.login-tile:nth-child(2) { --tilt:  2.5deg; --dx:  8px; }
.login-tile:nth-child(3) { --tilt:  1.5deg; --dx: 10px; }
.login-tile:nth-child(4) { --tilt: -2deg;   --dx: -4px; }
.login-tile:nth-child(5) { --tilt: -1.5deg; --dx: -10px; }
.login-tile:nth-child(6) { --tilt:  3deg;   --dx:  6px; }
.login-tile:nth-child(7) { --tilt:  2deg;   --dx:  4px; }
.login-tile:nth-child(8) { --tilt: -2.5deg; --dx: -8px; }

.login-tile-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--brand);
  background: var(--brand-wash);
  border-radius: 50%;
}
.login-tile-icon svg { width: 20px; height: 20px; }

.login-tile-text {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.login-tile-label {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--ink);
}

.login-tile-sub {
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
}

/* ---- Focus (WCAG 2.4.7) ----------------------------------------------------------------
 * A text field always shows the ring when focused, so it is clear where typing lands. */
:where(a, button, input, select, textarea, summary, [tabindex]) { outline: none; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---- Entrance --------------------------------------------------------------------------
 * Opacity and an 8px rise, staggered 50ms. Declared ONLY when the visitor has not asked
 * for reduced motion, so under that setting nothing moves on load. */
@keyframes login-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .login-enter {
    animation: login-rise 380ms var(--ease-out) backwards;
    animation-delay: calc(var(--i, 0) * 50ms);
  }
  .login-top          { --i: 0; }
  .login-eyebrow      { --i: 1; }
  .login-headline     { --i: 2; }
  .login-tagline      { --i: 3; }
  .login-card         { --i: 4; }
  .login-footer-line  { --i: 5; }
  .login-tile:nth-child(1) { --i: 3; }
  .login-tile:nth-child(2) { --i: 4; }
  .login-tile:nth-child(3) { --i: 5; }
  .login-tile:nth-child(4) { --i: 6; }
  .login-tile:nth-child(5) { --i: 7; }
  .login-tile:nth-child(6) { --i: 8; }
  .login-tile:nth-child(7) { --i: 9; }
  .login-tile:nth-child(8) { --i: 10; }

  /* A step swapping in. */
  .login-step:not([hidden]) { animation: login-rise 240ms var(--ease-out) backwards; }
}

/* ---- Wide monitors: the stage grows, so the cards step up with it -------------------------- */
@media (min-width: 1600px) {
  .login-tiles { width: min(100%, 720px); gap: 28px 30px; }
  .login-tile { padding: 20px 22px; border-radius: 24px; gap: 16px; }
  .login-tile-icon { width: 52px; height: 52px; }
  .login-tile-label { font-size: 17px; }
  .login-tile-sub { font-size: 14px; }
}

/* ---- Tablet and phone: one column, stage under the form ------------------------------------
 * .login-left dissolves (display: contents) so its three parts and the stage can be
 * ordered as siblings: logo, form, stage, footer. */
@media (max-width: 1023.98px) {
  .login-wrap {
    display: flex;
    flex-direction: column;
  }
  .login-left { display: contents; }

  .login-top,
  .login-main,
  .login-footer-line {
    max-width: 496px;
    padding-inline: 20px;
  }
  .login-top  { order: 1; padding-top: 20px; }
  .login-main {
    order: 2;
    flex: 0 0 auto;
    justify-content: flex-start;
    padding-top: 40px;
    padding-bottom: 36px;
  }
  .login-stage {
    order: 3;
    flex: none;
    padding: 28px 22px;
  }
  .login-footer-line {
    order: 4;
    margin-top: auto;
    padding-top: 18px;
    padding-bottom: 8px;
    text-align: center;
  }

  .login-tiles {
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
  }
  .login-tile {
    rotate: calc(var(--tilt) * 0.4);
    translate: none;
  }
}

/* Phones: the stage is decoration the form does not need. */
@media (max-width: 639.98px) {
  .login-stage { display: none; }
  .login-main  { padding-bottom: 28px; }
}

/* Small phones (down to 320px): tighter gutters so six code boxes still fit. */
@media (max-width: 400px) {
  .login-wrap { padding: 10px; }
  .login-top,
  .login-main,
  .login-footer-line { padding-inline: 14px; }
  .login-input { padding: 0 14px; }
  .login-input::placeholder { font-size: 15px; }
  .code-row { gap: 6px; }
}
