/* Create account (register.html). Builds on the shared sign-in styles in css/index.css
   (card, fields, buttons, alerts). The rules and messages come from scripts/create-account.js
   (the page's validation, unchanged from register.js); this file only presents them.
   css/register.css and scripts/register.js belong to the pre-2026-11-14 page and stay only for
   browsers still holding that old register.html in cache; delete both on or after 2026-12-17. */

/* ---- Field messages ----
   As before, a message shows only with a result class: when a field is cleared,
   the script resets the class but keeps the old text, which must stay hidden. */
.auth-card--register .field-feedback{ display: none; transition: color .2s ease; }
.auth-card--register .field-feedback.success,
.auth-card--register .field-feedback.error{
  display: block;
  animation: reg-note-in .22s var(--ease-out) backwards;
}

/* ---- Rules under a field: always shown; green with a tick when met, rose when not ---- */
.requirements{ display: grid; gap: 3px; margin-top: 8px; }
.auth-card--register .field-feedback.success + .requirements,
.auth-card--register .field-feedback.error + .requirements{ margin-top: 5px; }
.requirement{
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500; line-height: 1.45;
  color: var(--ink-muted);
  transition: color .2s ease;
}
.requirement.invalid{ color: var(--danger); }
.requirement.valid{ color: var(--success); }
/* A tick, so a met rule is not told apart by colour alone */
.requirement.valid::after{
  content: ""; flex: none; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: reg-tick-in .28s var(--ease-out) backwards;
}

/* Before a field has any text, its unmet rules (and "Please re-enter your password")
   read as guidance rather than errors. Browsers without :has() keep them rose. */
.auth-card--register .field:has(input:placeholder-shown) .requirement.invalid,
.auth-card--register .field:has(input:placeholder-shown) .field-feedback.error{ color: var(--ink-muted); }

/* ---- Submit ---- */
.register-actions{ margin-top: 24px; }
.auth-btn--block{ display: flex; width: 100%; }

/* ---- Keep the whole password hint visible ----
   Placeholders cannot wrap, so "≥6 chars, letters & numbers" (Inter: ~13.1px wide per px of
   font size) shrinks a little whenever its field is too narrow for 15px: on small phones, or
   on a zoomed desktop where a scrollbar takes width. The size follows the field's own width
   (100cqw = the field; minus 2px border and the icon/eye padding); browsers without container
   units use the viewport-based fallback below. */
.auth-card--register .field-control--action{ container-type: inline-size; }
.auth-card--register .field-control--action input::placeholder{
  font-size: clamp(12px, calc((100cqw - 98px) / 13.5), 15px);
}
/* Narrow phones: a little less card padding, and the text may run 4px closer to the eye
   button (which spans 7-43px from the field's right edge). */
@media (max-width: 380px){
  .auth-card--register{ padding-left: 16px; padding-right: 16px; }
  .auth-card--register .field-control--action input{ padding-right: 46px; }
  .auth-card--register .field-control--action input::placeholder{
    font-size: clamp(12px, calc((100vw - 158px) / 13.5), 15px);
    font-size: clamp(12px, calc((100cqw - 92px) / 13.5), 15px);
  }
}

@keyframes reg-note-in{
  from{ opacity: 0; transform: translateY(-3px); }
}
@keyframes reg-tick-in{
  from{ opacity: 0; transform: scale(.4); }
}

@media (forced-colors: active){
  .requirement.valid::after{ forced-color-adjust: none; background: CanvasText; }
}

@media (prefers-reduced-motion: reduce){
  .auth-card--register .field-feedback.success,
  .auth-card--register .field-feedback.error,
  .requirement.valid::after{ animation: none; }
  .auth-card--register .field-feedback, .requirement{ transition: none; }
}
