/* ============================================
   AUTH SHEET — shared bottom-sheet shell + primitives
   ============================================
   Auth redesign foundations (A1). Consumed by js/components/AuthSheet.js
   and (later tickets) the login/reset/join flow screens that compose these
   primitives. See mockups/design_handoff_auth_flows/README.md "Screens /
   Views" (shared shell spec) for the source measurements.

   Namespace: `.auth-sheet-*`. Distinct from the legacy `.auth-*` classes in
   auth-modals.css (Modals.js) — that file keeps working until the flow
   tickets replace its consumers.

   CODENOTE: the mobile backdrop is intentionally transparent. Per the
   handoff, the dim-to-0.28 treatment is applied to the signed-out home page
   itself (it stays mounted behind every sheet), not painted by the sheet's
   own backdrop — that's HomePage's job in a later ticket. The scrim color
   only applies at the >=768px centered-modal breakpoint. */

.auth-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet-scrim, 300);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: transparent;
  animation: auth-sheet-backdrop-fade 240ms cubic-bezier(.2, .8, .2, 1);
}

@keyframes auth-sheet-backdrop-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.auth-sheet {
  position: relative;
  z-index: var(--z-sheet, 400);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--color-white);
  border-top: 4px solid var(--color-accent-aqua);
  border-radius: 12px 12px 0 0;
  padding: 10px 20px max(22px, env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .35);
  box-sizing: border-box;
  animation: auth-sheet-slide-up 240ms cubic-bezier(.2, .8, .2, 1);
}

.auth-sheet--dragging {
  animation: none;
}

@keyframes auth-sheet-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.auth-sheet-handle {
  position: relative;
  width: 44px;
  height: 4px;
  margin: 0 auto 16px;
  border-radius: 9999px;
  background: var(--color-structure-lighter);
  cursor: grab;
  touch-action: none;
}

/* Expand the drag hit target to >=44px tall without changing the visible handle size */
.auth-sheet-handle::before {
  content: '';
  position: absolute;
  inset: -20px -24px;
}

.auth-sheet-body {
  display: flex;
  flex-direction: column;
}

/* ============================================
   RESPONSIVE: centered modal >=768px
   ============================================ */
@media (min-width: 768px) {
  .auth-sheet-backdrop {
    align-items: center;
    background: var(--scrim-black-modal);
  }

  .auth-sheet {
    max-width: 420px;
    max-height: 85vh;
    border-radius: 12px;
    animation: auth-sheet-fade-in 240ms cubic-bezier(.2, .8, .2, 1);
  }

  .auth-sheet-handle {
    display: none;
  }
}

@keyframes auth-sheet-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   TITLE / SUBTITLE / FINE PRINT
   ============================================ */
.auth-sheet-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 2.5px;
  line-height: 1;
  color: var(--color-structure-deepest);
  text-transform: uppercase;
}

.auth-sheet-subtitle {
  margin: 6px 0 0;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-structure-deep);
}

.auth-sheet-fine-print {
  margin-top: 14px;
  text-align: center;
  font-family: var(--font-primary);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-structure-deep);
}

/* ============================================
   STEP PILLS
   ============================================ */
.auth-sheet-step-pills {
  display: flex;
  gap: 7px;
  margin-bottom: 10px;
}

.auth-sheet-step-pill {
  width: 28px;
  height: 4px;
  border-radius: 9999px;
  background: var(--color-structure-lighter);
}

.auth-sheet-step-pill--filled {
  background: var(--color-action-primary);
}

/* ============================================
   FIELDS
   ============================================ */
.auth-sheet-field {
  margin-top: 16px;
}

.auth-sheet-label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 2.5px;
  color: var(--color-structure-deep);
  text-transform: uppercase;
}

.auth-sheet-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 13px;
  border: 3px solid var(--border-medium);
  border-radius: 4px;
  font-family: var(--font-primary);
  font-size: var(--font-size-input);
  font-weight: 600;
  color: var(--color-structure-deepest);
  background: var(--color-white);
}

.auth-sheet-input::placeholder {
  color: var(--color-structure-deep);
  opacity: .55;
}

.auth-sheet-input:focus {
  outline: none;
  border-color: var(--color-action-primary);
  box-shadow: 0 0 0 3px rgba(240, 124, 15, .15);
}

.auth-sheet-input--error,
.auth-sheet-input--error:focus {
  border-color: var(--color-danger-primary);
}

.auth-sheet-input:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.auth-sheet-input-wrapper {
  position: relative;
}

.auth-sheet-input-wrapper .auth-sheet-input {
  padding-right: 48px;
}

.auth-sheet-reveal-btn {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: none;
  /* structure-deep, not the spec's structure-medium — 2.47:1 on white fails the 3:1 UI floor */
  color: var(--color-structure-deep);
  cursor: pointer;
}

.auth-sheet-reveal-btn:hover {
  color: var(--color-structure-deepest);
}

.auth-sheet-reveal-btn:focus-visible {
  outline: 2px solid var(--color-action-primary);
  outline-offset: 2px;
}

.auth-sheet-reveal-btn[aria-pressed="true"] {
  color: var(--color-accent-aqua-dark);
}

/* ============================================
   BUTTONS
   ============================================ */
.auth-sheet-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin-top: 18px;
  padding: 15px 16px;
  border: none;
  border-radius: 4px;
  background: var(--color-action-primary);
  /* action-darkest, not white — white on action-primary is 2.76:1 (lottery CTA precedent) */
  color: var(--color-action-darkest);
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  box-shadow: var(--shadow-action);
  cursor: pointer;
  transition: background var(--transition-default);
}

.auth-sheet-btn-primary:hover {
  background: var(--color-action-dark);
}

.auth-sheet-btn-primary:disabled,
.auth-sheet-btn-primary--submitting,
.auth-sheet-btn-primary[aria-disabled="true"] {
  background: var(--color-action-medium);
  /* action-darkest on action-medium is 2.57:1 — below even the 3:1 large-text
     floor. White is 4.17:1, which clears 3:1 for the 20px display label. */
  color: var(--color-white);
  cursor: not-allowed;
  pointer-events: none;
}

.auth-sheet-btn-primary--success {
  background: var(--color-success);
}

.auth-sheet-btn-primary--success:hover {
  background: var(--color-success-dark);
}

.auth-sheet-spinner {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  border: 3px solid var(--scrim-white-medium);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: auth-sheet-spin .7s linear infinite;
}

@keyframes auth-sheet-spin {
  to { transform: rotate(360deg); }
}

.auth-sheet-btn-ghost {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--color-accent-aqua-dark);
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
}

.auth-sheet-btn-ghost:hover {
  background: var(--color-accent-aqua-bg);
}

.auth-sheet-btn-ghost:disabled,
.auth-sheet-btn-ghost[aria-disabled="true"] {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

/* aria-disabled buttons stay in the Tab order but must not accept clicks */
.auth-sheet-btn-primary[aria-disabled="true"],
.auth-sheet-btn-ghost[aria-disabled="true"] {
  pointer-events: none;
}

.auth-sheet-btn-outline {
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  padding: 12px 16px;
  border: 3px solid var(--color-accent-aqua);
  border-radius: 4px;
  background: transparent;
  color: var(--color-accent-aqua-dark);
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
}

.auth-sheet-btn-outline:hover {
  background: var(--color-accent-aqua-bg);
}

/* ============================================
   BANNERS (danger / success / hint)
   Error/danger banners must carry role="alert" in the consuming component
   ============================================ */
.auth-sheet-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 4px;
  font-family: var(--font-primary);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
}

.auth-sheet-banner-icon {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
}

.auth-sheet-banner--danger {
  background: var(--color-danger-bg);
  border-left: 6px solid var(--color-danger-primary);
  color: var(--color-danger-dark);
}

.auth-sheet-banner--danger .auth-sheet-banner-icon {
  color: var(--color-danger-primary);
}

.auth-sheet-banner--success {
  background: var(--color-success-bg);
  border-left: 6px solid var(--color-success);
  color: var(--color-success-dark);
}

.auth-sheet-banner--success .auth-sheet-banner-icon {
  color: var(--color-success-dark);
}

.auth-sheet-banner--hint {
  background: var(--color-accent-aqua-bg);
  border-left: 6px solid var(--color-accent-aqua);
  color: var(--color-accent-aqua-dark);
  font-weight: 600;
}

.auth-sheet-banner--hint .auth-sheet-banner-icon {
  color: var(--color-accent-aqua-dark);
}

/* ============================================
   RESET PASSWORD (5e-5h) — ResetSheet.js
   ============================================ */
.auth-reset-icon-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 8px;
}

.auth-reset-icon-tile--aqua {
  background: var(--color-accent-aqua-bg);
  color: var(--color-accent-aqua-dark);
}

.auth-reset-icon-tile--success {
  background: var(--color-success-bg);
  color: var(--color-success-dark);
}

.auth-reset-icon-wrap {
  display: inline-flex;
}

.auth-reset-email-echo {
  margin-top: 16px;
  padding: 9px 12px;
  border-radius: 4px;
  background: var(--color-structure-lightest);
  color: var(--color-structure-deepest);
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 800;
  text-align: center;
  word-break: break-all;
}

.auth-reset-rules {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.auth-reset-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-primary);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-structure-deep);
}

.auth-reset-rule--met {
  color: var(--color-success-dark);
}

.auth-reset-verifying {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px 0;
}

.auth-reset-verifying-spinner {
  border-color: var(--color-structure-lighter);
  border-top-color: var(--color-action-primary);
}

/* Visually-hidden but screen-reader-audible text (#505 follow-up, cycle 2 —
   the invite "verifying" screen's spinner is aria-hidden and nothing else
   announced the state). Same clip technique as .matchup-sr-only
   (pages/matchup.css) / .lot-sr-only (features/lottery.css); no shared
   global .sr-only utility exists yet. */
.auth-sheet-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   LEAGUE PICKER ROWS (5d)
   Consumed by js/components/LeaguePickerSheet.js. Rows are real buttons
   carrying role="radio"; the checked state is styled off aria-checked so the
   visual and the accessibility tree can never drift apart.
   ============================================ */
.league-picker-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.league-picker-row {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 13px;
  border: 3px solid var(--border-default);
  border-radius: 4px;
  background: var(--color-white);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-default), background var(--transition-default);
}

.league-picker-row[aria-checked="true"] {
  border-color: var(--color-action-primary);
  background: var(--color-action-bg);
}

.league-picker-row:focus-visible {
  outline: 2px solid var(--color-action-primary);
  outline-offset: 2px;
}

.league-picker-tile {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: var(--color-structure-deepest);
  color: var(--color-highlight-cream);
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 1px;
}

.league-picker-text {
  flex: 1;
  min-width: 0;
}

.league-picker-name {
  display: block;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 1.5px;
  line-height: 1.1;
  color: var(--color-structure-deepest);
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.league-picker-team {
  display: block;
  margin-top: 3px;
  font-family: var(--font-primary);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-structure-deep);
  overflow-wrap: anywhere;
}

/* structure-deep, not the mock's lighter grey — a lighter chevron lands at
   ~1.9:1 on white, under the 3:1 non-text floor. */
.league-picker-chevron {
  flex-shrink: 0;
  color: var(--color-structure-deep);
}

/* ============================================
   JOIN FLOW (6a–6i)
   Consumed by js/components/JoinSheet.js.
   ============================================ */

/* Trailing (non-interactive) status icon inside an input — the 6i "x" that
   marks a taken username. The wrapper already reserves 48px right padding. */
.auth-sheet-input-trailing-icon {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.auth-sheet-input-trailing-icon--danger {
  color: var(--color-danger-primary);
}

/* Locked "Your Team" display (6c/6d) — reads as an input but isn't editable. */
.auth-sheet-locked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border: 3px solid var(--color-action-primary);
  border-radius: 4px;
  background: var(--color-action-bg);
}

.auth-sheet-locked-name {
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 800;
  color: var(--color-structure-deepest);
  overflow-wrap: anywhere;
}

.auth-sheet-locked-tag {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--color-action-dark);
  text-transform: uppercase;
}

/* Locked "No Open Slots" row (6f) — a deliberate dead end. */
.auth-sheet-locked-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 13px;
  border: 3px solid var(--border-default);
  border-radius: 4px;
  background: var(--color-structure-lightest);
  opacity: .7;
}

.auth-sheet-locked-row-tile {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  background: var(--color-structure-lighter);
  color: var(--color-structure-deep);
}

.auth-sheet-locked-row-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.auth-sheet-locked-row-title {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--color-structure-deepest);
  text-transform: uppercase;
}

.auth-sheet-locked-row-body {
  font-family: var(--font-primary);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-structure-deep);
}

/* Selectable branch rows (6g) — radiogroup styled off aria-checked so the
   visual and accessibility tree can't drift (same contract as 5d rows). */
.auth-sheet-choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.auth-sheet-choice-row {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 13px;
  border: 3px solid var(--border-default);
  border-radius: 4px;
  background: var(--color-white);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-default), background var(--transition-default);
}

.auth-sheet-choice-row[aria-checked="true"] {
  border-color: var(--color-action-primary);
  background: var(--color-action-bg);
}

.auth-sheet-choice-row:focus-visible {
  outline: 2px solid var(--color-action-primary);
  outline-offset: 2px;
}

.auth-sheet-choice-tile {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: var(--color-structure-deepest);
  color: var(--color-highlight-cream);
}

.auth-sheet-choice-text {
  flex: 1;
  min-width: 0;
}

.auth-sheet-choice-title {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--color-structure-deepest);
  text-transform: uppercase;
}

.auth-sheet-choice-body {
  display: block;
  margin-top: 3px;
  font-family: var(--font-primary);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-structure-deep);
}

.auth-sheet-choice-chevron {
  flex-shrink: 0;
  color: var(--color-structure-deep);
}

/* Live password-requirements list (6c/6d). Met rows flip icon + text to the
   success token; unmet rows sit in structure-deep. */
.auth-sheet-rules {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.auth-sheet-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-primary);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-structure-deep);
}

.auth-sheet-rule--met {
  color: var(--color-success-dark);
}

.auth-sheet-rule-icon {
  flex-shrink: 0;
}

/* Commissioner opt-in (6c). */
.auth-sheet-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  border: 3px solid var(--border-default);
  border-radius: 4px;
  cursor: pointer;
}

.auth-sheet-checkbox-box {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 3px solid var(--color-structure-light);
  border-radius: 3px;
  accent-color: var(--color-action-primary);
  cursor: pointer;
}

.auth-sheet-checkbox-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-sheet-checkbox-title {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-structure-deepest);
}

.auth-sheet-checkbox-desc {
  font-family: var(--font-primary);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-structure-deep);
}

/* Username suggestion line (6i). */
.auth-sheet-suggestion {
  margin: 8px 0 0;
  font-family: var(--font-primary);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-structure-deep);
}

.auth-sheet-suggestion strong {
  color: var(--color-action-dark);
}
