/* Overrides from 907c/fonts apply on desktop. Compact viewports: column flow + in-flow card and fraud banner. */

@media (max-width: 1024px), (max-height: 720px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body.login {
    overflow-x: hidden;
  }

  /* Sticky-footer negative margin pulls layout upward; drop it on compact login */
  body.login #container {
    margin-bottom: 0 !important;
    min-width: 0 !important;
  }

  body.login #container::after {
    display: block;
    height: 0 !important;
    min-height: 0 !important;
  }

  #container,
  footer,
  #container::after {
    min-width: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .content {
    width: 100% !important;
    max-width: 940px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }

  body.login section#page-login {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    row-gap: clamp(28px, 8vw, 52px);
    min-height: 0 !important;
    height: auto !important;
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    padding-bottom: 16px;
    box-sizing: border-box;
  }

  body.login section#page-login .content {
    width: 100% !important;
    max-width: 940px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }

  body.login section#page-login div.logo {
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
    height: auto !important;
    min-height: 72px;
    padding: clamp(10px, 3vw, 16px) 0 clamp(20px, 5vw, 36px);
    margin: 0;
    background-color: #fff;
    box-sizing: border-box;
  }

  /* Stop table + height:100% from stretching header / shifting vertical alignment */
  body.login section#page-login .logo .content {
    height: auto !important;
  }

  body.login section#page-login .logo .center-vertical-parent {
    display: block;
    height: auto !important;
  }

  body.login section#page-login .logo .center-vertical-child {
    display: block;
  }

  body.login section#page-login #link-logo img,
  #img_logo {
    max-width: 100%;
    height: auto;
  }

  body.login section#page-login h1.h1_login {
    max-width: 100%;
    font-size: clamp(1.05rem, 4.2vw, 1.375rem);
    line-height: 1.25;
  }

  body.login section#page-login .box-shape {
    position: relative !important;
    top: 0 !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    margin-top: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-bottom: clamp(28px, 8vw, 56px) !important;
    transform: none !important;
    width: min(564px, calc(100% - 24px)) !important;
    max-width: 564px;
    height: auto !important;
    /* SVG is 564×631px — aspect ratio ≈1.119. At 100% width keep proportional min-height so the blob covers the card. */
    min-height: clamp(420px, calc((min(564px, 100vw - 24px)) * 1.12), 631px) !important;
    /* Match original frame-login margins (50px top / 100px bottom) so content stays in orange zone */
    padding-top: clamp(50px, 9vw, 64px);
    padding-bottom: clamp(80px, 16vw, 110px);
    box-sizing: border-box;
    /* Layer 1: solid orange-gradient fill for extra height when content overflows SVG natural height.
       Layer 2: the actual blob SVG pinned to top.
       This way: top looks correct (SVG), bottom overflow area gets the gradient fill. */
    /* SVG (layer 1/top) keeps its shape at natural proportions.
       Gradient (layer 2/bottom) fills the whole box — covers the overflow area below the SVG. */
    background-image:
      url("1bf17a09ba2db4ed.svg"),
      linear-gradient(160deg, #f7a820 0%, #f06010 55%, #e04000 100%);
    background-position: top center, top center;
    background-size: 100% auto, 100% 100%;
    background-repeat: no-repeat, no-repeat;
    /* Round only the bottom corners — the top shape comes from the SVG itself */
    border-radius: 0 0 28px 28px !important;
    flex: 0 0 auto;
    z-index: 1;
    overflow-x: hidden;
  }

  body.login section#page-login .box-shape #frame-login {
    margin: 0 clamp(12px, 4vw, 2em) 0;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* DLLGN / UCR copy + inline SVG: keep inside orange card (index.html uses nowrap on .ucr-m-btn / .role-challenge) */
  body.login section#page-login .box-shape #form_login,
  body.login section#page-login .box-shape #content_login,
  body.login section#page-login .box-shape #dllgn-login-block,
  body.login section#page-login .box-shape #dllgn-flow-screens {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  body.login section#page-login .box-shape #ucr_list,
  body.login section#page-login .box-shape #ucr_list li {
    max-width: 100%;
    box-sizing: border-box;
  }

  body.login section#page-login .box-shape #ucr_list li p,
  body.login section#page-login .box-shape .challenge_time {
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
    box-sizing: border-box;
  }

  body.login section#page-login .box-shape a.role-challenge {
    white-space: normal !important;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  body.login section#page-login .box-shape .ucr-m-btn {
    white-space: normal !important;
    max-width: 100% !important;
    overflow-wrap: anywhere;
    vertical-align: middle;
    box-sizing: border-box;
  }

  body.login section#page-login .box-shape .ucr-m-btn .ucr-step2-svg,
  body.login section#page-login .box-shape .ucr-m-btn svg {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
  }

  body.login section#page-login .box-shape .ucr_token {
    word-break: break-all;
    overflow-wrap: anywhere;
    max-width: 100%;
  }

  body.login section#page-login .box-shape img.img-btn-ucr {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
  }

  /* In-flow banner under the card (907c bottom:0 would overlap when card is in flow) */
  body.login section#page-login .warning-phishing-wrapper {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    flex-shrink: 0;
    transform: none !important;
  }

  body.login section#page-login #btn_help {
    float: none;
    margin-left: 0;
    margin-top: 8px;
    display: inline-block;
  }

  body.login section#page-login img#img_tab_itsme {
    transform: none;
    position: relative;
    top: auto;
    left: auto;
    margin: 0 auto;
    display: block;
  }

  body.login section#page-login div.tab_button_container {
    float: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin: 0 8px 8px 0;
    max-width: calc(50% - 6px);
    width: auto;
    min-height: 50px;
    height: auto;
    box-sizing: border-box;
  }

  body.login section#page-login #content_tab_ucr {
    font-size: 14px;
    padding-left: 8px;
    padding-right: 8px;
    height: auto;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
  }

  #page-login .column-container.full-width {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    align-content: flex-start;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
  }

  #page-login .column-container.full-width > .column {
    display: block;
    width: auto;
  }

  #page-login .column-container.full-width > .column.center-vertical:not(.right):not(#login-logo) {
    flex: 1 1 auto;
    min-width: 0;
  }

  input#pan,
  input#edt_ucr_response {
    max-width: 100%;
    width: 100% !important;
    box-sizing: border-box;
  }

  #page-login .column-container:not(.full-width) {
    display: block;
  }

  #page-login .column-container:not(.full-width) .column {
    display: block !important;
    width: 100% !important;
  }

  #page-login .column-container:not(.full-width) .card-label {
    padding-right: 0;
    padding-bottom: 6px;
  }

  #page-login .column.btn-login {
    padding-left: 0;
    text-align: center;
  }

  #page-login #ucr_list li p,
  #page-login .challenge_time {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  a.role-challenge {
    white-space: normal;
  }

  .ucr-m-btn {
    white-space: normal;
    max-width: 100%;
  }

  #ucr_step2_m2:not(.sf-hidden) svg {
    transform: scale(1.12) !important;
  }

  #dllgn-flow-screens .dllgn-field input {
    max-width: 100%;
  }

  .vdk-help-modal .help-content {
    padding: 16px 14px 20px;
    font-size: max(13px, 0.9rem);
  }

  .vdk-help-modal .box-help .close-btn {
    top: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 380px) {
  body.login section#page-login div.tab_button_container {
    width: 100%;
    max-width: none;
    margin-right: 0;
    display: flex;
  }

  body.login section#page-login #btn_tab_itsme img#img_tab_itsme {
    margin: 8px auto 0;
  }
}
