/**
 * FM-POLISH-005B — Welcome Layout Scaling
 * Height-aware composition. No redesign, no color/hierarchy change.
 */

/* Optical center — composition sits slightly above midpoint */
body.fm-polish-005b-auth #auth-session-overlay.fm-ds-001c-overlay {
  justify-content: flex-start !important;
  padding-top: clamp(28px, 6.5vh, 56px) !important;
  padding-bottom: clamp(20px, 4.5vh, 40px) !important;
  padding-left: clamp(20px, 4vw, 40px) !important;
  padding-right: clamp(20px, 4vw, 40px) !important;
}

body.fm-polish-005b-auth #fm-ds-001c-root.fm-polish-005-root,
body.fm-polish-005b-auth #fm-ds-001c-root.fm-ds-002-root {
  width: clamp(480px, 42vw, 560px) !important;
  max-width: min(68vw, 560px) !important;
  margin: 0 auto;
  transform: translateY(clamp(0px, 1.5vh, 16px));
}

/* Card hugs content; never dominate viewport height */
body.fm-polish-005b-auth .fm-auth-card {
  padding:
    clamp(18px, 3.2vh, 28px)
    clamp(22px, 2.8vw, 34px)
    clamp(14px, 2.4vh, 22px) !important;
  max-height: min(78vh, 820px);
  overflow: auto;
}

body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] {
  padding:
    clamp(18px, 3vh, 26px)
    clamp(24px, 2.8vw, 34px)
    clamp(14px, 2.2vh, 20px) !important;
}

/* Dynamic vertical rhythm */
body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-brand {
  padding-top: clamp(2px, 0.8vh, 8px);
}
body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-mark {
  padding: clamp(2px, 0.8vh, 8px) 0 clamp(0px, 0.4vh, 4px) !important;
}
body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-name {
  margin-top: clamp(8px, 1.6vh, 14px) !important;
}
body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-tagline {
  margin-top: clamp(4px, 0.9vh, 8px) !important;
}
body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-title {
  margin-top: clamp(14px, 2.8vh, 24px) !important;
}
body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-purpose {
  margin-top: clamp(6px, 1.2vh, 12px) !important;
}
body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-actions {
  margin-top: clamp(14px, 2.6vh, 22px) !important;
  gap: clamp(8px, 1.2vh, 12px) !important;
}
body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-legal-footer {
  margin-top: clamp(12px, 2.2vh, 20px) !important;
}

/* Logo — height-aware, not enlarged */
body.fm-polish-005b-auth .fm-auth-mark img {
  height: clamp(110px, 12vh, 130px) !important;
}

body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-signin"] .fm-auth-mark img,
body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-create"] .fm-auth-mark img,
body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-forgot"] .fm-auth-mark img,
body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-reset"] .fm-auth-mark img {
  height: clamp(88px, 10vh, 108px) !important;
}

/* Buttons — slightly smaller; full width; same colors */
body.fm-polish-005b-auth .fm-auth-btn {
  min-height: 56px !important;
  padding: 13px 18px !important;
  border-radius: 18px !important;
  font-size: clamp(16px, 1.15vw, 18px) !important;
}

/* —— Height breakpoints —— */
@media (max-height: 900px) {
  body.fm-polish-005b-auth #auth-session-overlay.fm-ds-001c-overlay {
    padding-top: clamp(20px, 4.5vh, 36px) !important;
    padding-bottom: clamp(16px, 3.5vh, 28px) !important;
  }
  body.fm-polish-005b-auth .fm-auth-mark img {
    height: clamp(104px, 11.5vh, 118px) !important;
  }
  body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-title {
    margin-top: clamp(12px, 2.2vh, 20px) !important;
  }
  body.fm-polish-005b-auth .fm-auth-btn {
    min-height: 54px !important;
  }
  body.fm-polish-005b-auth .fm-auth-card {
    max-height: 76vh;
  }
}

@media (max-height: 820px) {
  body.fm-polish-005b-auth #fm-ds-001c-root.fm-polish-005-root {
    width: clamp(460px, 40vw, 520px) !important;
    transform: translateY(0);
  }
  body.fm-polish-005b-auth .fm-auth-mark img {
    height: clamp(96px, 11vh, 108px) !important;
  }
  body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-name {
    margin-top: clamp(6px, 1.2vh, 12px) !important;
  }
  body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-title {
    margin-top: clamp(10px, 1.8vh, 16px) !important;
  }
  body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-actions {
    margin-top: clamp(12px, 2vh, 18px) !important;
  }
  body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-legal-footer {
    margin-top: clamp(10px, 1.6vh, 16px) !important;
    font-size: 13px;
  }
  body.fm-polish-005b-auth .fm-auth-btn {
    min-height: 52px !important;
    padding: 11px 16px !important;
    border-radius: 16px !important;
  }
  body.fm-polish-005b-auth .fm-auth-card {
    max-height: 74vh;
  }
}

@media (max-height: 760px) {
  body.fm-polish-005b-auth #auth-session-overlay.fm-ds-001c-overlay {
    padding-top: 14px !important;
    padding-bottom: 12px !important;
  }
  body.fm-polish-005b-auth #fm-ds-001c-root.fm-polish-005-root {
    width: clamp(440px, 38vw, 500px) !important;
  }
  body.fm-polish-005b-auth .fm-auth-mark img {
    height: clamp(88px, 10.5vh, 100px) !important;
  }
  body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-brand {
    padding-top: 0;
  }
  body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-mark {
    padding: 0 !important;
  }
  body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-title {
    margin-top: 10px !important;
  }
  body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-purpose {
    margin-top: 6px !important;
    font-size: 14px;
  }
  body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-actions {
    margin-top: 12px !important;
    gap: 8px !important;
  }
  body.fm-polish-005b-auth .fm-auth-card[data-testid="fm-ds-001c-welcome"] .fm-auth-legal-footer {
    margin-top: 10px !important;
  }
  body.fm-polish-005b-auth .fm-auth-btn {
    min-height: 50px !important;
  }
  body.fm-polish-005b-auth .fm-auth-card {
    max-height: 80vh;
    padding:
      clamp(12px, 2vh, 18px)
      clamp(18px, 2.4vw, 28px)
      clamp(10px, 1.6vh, 16px) !important;
  }
}

/* Tall displays — keep generous atmosphere */
@media (min-height: 1000px) {
  body.fm-polish-005b-auth #auth-session-overlay.fm-ds-001c-overlay {
    padding-top: clamp(40px, 8vh, 72px) !important;
  }
  body.fm-polish-005b-auth .fm-auth-mark img {
    height: clamp(118px, 11vh, 130px) !important;
  }
  body.fm-polish-005b-auth .fm-auth-card {
    max-height: 72vh;
  }
}

/* Narrow width still wins for tablets/phones */
@media (max-width: 900px) {
  body.fm-polish-005b-auth #fm-ds-001c-root.fm-polish-005-root {
    width: calc(100% - 72px) !important;
    max-width: none !important;
    transform: none;
  }
}

@media (max-width: 640px) {
  body.fm-polish-005b-auth #fm-ds-001c-root.fm-polish-005-root {
    width: calc(100% - 32px) !important;
  }
  body.fm-polish-005b-auth .fm-auth-mark img {
    height: clamp(82px, 14vh, 96px) !important;
  }
  body.fm-polish-005b-auth .fm-auth-card {
    max-height: none;
  }
}
