/* ============================================================
   MSK Skating login: "Rink Loop"
   Inherits the Skill Patch Jacket world (see DESIGN.md) in Mission purple.
   The rink is drawn by login-rink.js into [data-rink-svg]; the skater is the
   logo mark and laps the stadium centreline counter-clockwise.
   ============================================================ */
:root {
  --ground: #f5f4f9;
  --surface: #ffffff;
  --ink: #1d1628;
  --ink-2: #3f3752;
  --muted: #625b73;
  --wordmark: #44235a;
  --brand: #5b3490;
  --brand-press: #4a2877;
  --brand-deep: #3b1f5f;
  --brand-tint: #efe9f7;
  --brand-edge: #d3c4ea;
  --brand-rgb: 91, 52, 144;
  --coral: #d6334f;
  --hairline-2: rgba(29, 22, 40, .14);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --rink-inset: 12px;
  --rink-h: 240px;
  --band: 34px;
  --font: "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
body.rk {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
::selection { background: rgba(var(--brand-rgb), .18); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- The rink ---------- */
.rk-rink {
  position: absolute;
  top: calc(var(--rink-inset) + env(safe-area-inset-top));
  left: max(var(--rink-inset), env(safe-area-inset-left));
  right: max(var(--rink-inset), env(safe-area-inset-right));
  height: var(--rink-h);
  pointer-events: none;
  z-index: 0;
}
.rk-track { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rk-skater {
  position: absolute;
  top: 0;
  left: 0;
  height: 48px;
  width: auto;
  transform-origin: 50% 100%;
  will-change: transform;
  filter: drop-shadow(0 3px 3px rgba(29, 22, 40, .18));
  visibility: hidden; /* shown once placed on the track */
}
.rk-skater.is-placed { visibility: visible; }

/* ---------- Stage ---------- */
.rk-stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
  padding: calc(var(--rink-inset) + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}

/* brand type lives in the rink's infield */
.rk-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: var(--rink-h);
  padding: calc(var(--band) + 8px) calc(var(--band) + 40px);
  text-align: center;
}
.rk-logo { display: block; width: auto; max-width: 100%; height: 100%; max-height: 156px; object-fit: contain; }
.rk-card .rk-prompt { margin: -12px 0 20px; color: var(--muted); font-size: .9375rem; }
.rk-card .rk-prompt:first-child { margin-top: 0; }

/* ---------- Card ---------- */
.rk-card {
  width: 100%;
  max-width: 440px;
  margin-top: 16px;
  padding: 24px 20px 20px;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(29, 22, 40, .05), 0 10px 30px rgba(29, 22, 40, .08);
}
.rk-card-title { margin: 0 0 16px; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.rk-foot { margin-top: auto; padding-top: 20px; color: var(--muted); font-size: .8125rem; }

/* ---------- The stock Identity UI form, re-set ---------- */
.rk-card h1, .rk-card hr { display: none; }
.rk--login .rk-card form h2, .rk-card section > h3 { display: none; }
.rk-card h2:not(.rk-card-title) { font-size: 1rem; font-weight: 500; color: var(--ink-2); margin: 0 0 12px; }
.rk-card .row { display: block; margin: 0; }
.rk-card .row > [class*="col"] { width: 100%; max-width: 100%; padding: 0; margin: 0; }
.rk-card .row > [class*="offset"] { display: none; } /* external-login column */

.rk-card .form-floating { position: relative; margin-bottom: 12px !important; }
.rk-card .form-control {
  height: 52px;
  min-height: 52px;
  padding: 22px 14px 6px;
  border: 1.5px solid var(--hairline-2);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px; /* no iOS zoom */
  caret-color: var(--brand);
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.rk-card .form-floating > .form-control { height: 52px; padding: 22px 14px 6px; }
.rk-card .form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .18); }
.rk-card .form-floating > label { padding: 15px 14px; color: var(--muted); font-size: 1rem; }
.rk-card .form-floating > .form-control:focus ~ label,
.rk-card .form-floating > .form-control:not(:placeholder-shown) ~ label { transform: scale(.8) translateY(-.6rem) translateX(.15rem); color: var(--muted); }
.rk-card .form-floating > .form-control:focus ~ label::after,
.rk-card .form-floating > .form-control:not(:placeholder-shown) ~ label::after { background: transparent; }
.rk-card .form-control.input-validation-error { border-color: var(--coral); }
.rk-card .form-floating .text-danger,
.rk-card .field-validation-error { display: block; margin-top: 4px; font-size: .8125rem; color: var(--coral); }

/* password visibility toggle (added by login-rink.js) */
.rk-card .form-floating.has-reveal > .form-control { padding-right: 52px; }
.rk-reveal {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.125rem;
}
.rk-reveal:hover { color: var(--ink); background: var(--ground); }

.rk-card .checkbox { margin: 4px 0 16px !important; }
.rk-card .checkbox label { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; color: var(--ink-2); font-size: .9375rem; cursor: pointer; }
.rk-card .form-check-input { width: 20px; height: 20px; margin: 0; border: 1.5px solid rgba(29, 22, 40, .28); border-radius: 8px; }
.rk-card .form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.rk-card .form-check-input:focus { box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .2); border-color: var(--brand); }

.rk-card .btn-primary,
.rk-card button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(29, 22, 40, .12), 0 6px 16px rgba(var(--brand-rgb), .26);
  transition: background-color .15s var(--ease-out), transform .12s var(--ease-out), box-shadow .15s var(--ease-out);
}
.rk-card .btn-primary:hover,
.rk-card button[type="submit"]:hover { background: var(--brand-press); color: #fff; }
.rk-card .btn-primary:active,
.rk-card button[type="submit"]:active { transform: scale(.97); background: var(--brand-deep); }
.rk-card button[type="submit"].is-busy { background: var(--brand-press); pointer-events: none; }
.rk-card button[type="submit"] .spinner-border { width: 18px; height: 18px; border-width: 2px; }

.rk-card form > div:last-child:not(.form-floating):not(.checkbox) { margin-top: 12px; }
.rk-card p { margin: 0; }
.rk-card a {
  display: inline-block;
  padding: 6px 0;
  color: var(--brand);
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
}
.rk-card a:hover { color: var(--brand-press); text-decoration: underline; text-underline-offset: 3px; }

/* validation summary */
.rk-card .validation-summary-valid { display: none; }
.rk-card .validation-summary-errors {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fde8ec;
  color: #8a1a2e;
  font-size: .9375rem;
}
.rk-card .validation-summary-errors ul { margin: 0; padding-left: 18px; }

/* ---------- Desktop: the rink fills the viewport; brand left, card right ---------- */
@media (min-width: 992px) {
  :root { --rink-inset: 24px; --band: 64px; }
  .rk-rink { position: fixed; inset: var(--rink-inset); height: auto; }
  .rk-skater { height: 100px; }
  .rk-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
    align-items: center;
    column-gap: 48px;
    padding-block: calc(var(--rink-inset) + var(--band) + 24px) calc(var(--rink-inset) + var(--band) + 48px);
    padding-inline: calc(var(--rink-inset) + var(--band) + 6vw) calc(var(--rink-inset) + var(--band) + 6vw + var(--card-nudge, 0px));
  }
  .rk-brand { align-items: flex-start; height: auto; padding: 0; }
  .rk-logo { height: auto; width: min(100%, 380px); max-height: none; }
  .rk-card { margin: 0; padding: 32px 32px 28px; justify-self: end; }
  /* centred on the bottom straight's infield edge: never on a bend, never on a lane */
  .rk-foot {
    position: fixed;
    left: 50%;
    bottom: calc(var(--rink-inset) + var(--band) + 34px); /* clears the skater's head as it passes */
    transform: translateX(-50%);
    margin: 0;
    padding: 0;
    white-space: nowrap;
  }
}

/* ---------- Right-to-left (Arabic UI) ---------- */
[dir="rtl"] .rk-reveal { right: auto; left: 4px; }
[dir="rtl"] .rk-card .form-floating.has-reveal > .form-control { padding-right: 14px; padding-left: 52px; }
[dir="rtl"] .rk-card .form-floating > .form-control:focus ~ label,
[dir="rtl"] .rk-card .form-floating > .form-control:not(:placeholder-shown) ~ label { transform: scale(.8) translateY(-.6rem) translateX(-.15rem); }
[dir="rtl"] .rk-card .validation-summary-errors ul { padding-left: 0; padding-right: 18px; }
[dir="rtl"] body.rk { font-family: "Noto Sans Arabic", var(--font); }
/* short laptop screens: a slimmer band and a tighter card keep the card inside the lap */
@media (min-width: 992px) and (max-height: 820px) {
  :root { --band: 48px; }
  .rk-skater { height: 84px; }
  .rk-card { padding: 24px 28px 18px; }
  .rk-card-title { margin-bottom: 10px; font-size: 1.375rem; }
  .rk-card .checkbox { margin: 0 0 10px !important; }
  .rk-card a { padding: 3px 0; }
}
@media (min-width: 992px) and (max-height: 640px) {
  .rk-rink { position: absolute; height: max(100%, 640px); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
}

.rk-home { color: var(--brand); font-weight: 500; text-decoration: none; }
.rk-home:hover { text-decoration: underline; text-underline-offset: 3px; }
