/*
 * AMAL mobile homepage, phase 1.
 *
 * Mobile product rules are scoped to the effective presentation selected by
 * the shared bootstrap. Viewport width may refine layout inside that mode, but
 * it never selects the mobile product or changes access by itself.
 */

@media all {
  html[data-amal-presentation="mobile"] {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  html[data-amal-presentation="mobile"] body.resource-home {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  html[data-amal-presentation="mobile"] body.resource-home main,
  html[data-amal-presentation="mobile"] body.resource-home section,
  html[data-amal-presentation="mobile"] body.resource-home footer {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  html[data-amal-presentation="mobile"] body.resource-home section[id] {
    scroll-margin-top: 72px;
  }

  /* Compact homepage header: brand, navigation, language and account. */
  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home {
    position: sticky;
    top: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 64px;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
    background: rgba(255, 255, 255, .98);
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-brand {
    min-width: 0;
    padding: 0;
    border-right: 0;
    overflow: hidden;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-brand img {
    width: clamp(104px, 29vw, 124px);
    max-width: 100%;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-page-title,
  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-header-links,
  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-help-btn {
    display: none;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-header-actions {
    grid-column: 2;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 4px;
    max-width: 100%;
    min-width: 0;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-nav-btn {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-nav-btn > span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-lang-btn {
    width: 48px;
    min-width: 48px;
    height: 44px;
    min-height: 44px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-login-btn {
    min-width: 60px;
    max-width: 72px;
    min-height: 44px;
    padding: 0 12px;
    font-size: 14px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-login-btn.signed-in {
    min-width: 60px;
    max-width: 72px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-menu,
  html[data-amal-presentation="mobile"] body.resource-home .home-navigation-menu,
  html[data-amal-presentation="mobile"] body.resource-home .auth-popover,
  html[data-amal-presentation="mobile"] body.resource-home .home-account-menu {
    position: fixed;
    top: calc(64px + env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    width: auto;
    min-width: 0;
    max-width: none;
    max-height: calc(100dvh - 88px - env(safe-area-inset-top));
    overflow-y: auto;
    border-radius: 14px;
    overscroll-behavior: contain;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-language-menu,
  html[data-amal-presentation="mobile"] body.resource-home .language-menu {
    left: auto;
    width: min(184px, calc(100vw - 24px));
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-menu::before,
  html[data-amal-presentation="mobile"] body.resource-home .home-account-menu::before,
  html[data-amal-presentation="mobile"] body.resource-home .auth-popover::before,
  html[data-amal-presentation="mobile"] body.resource-home .language-menu::before {
    display: none;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-navigation-menu a,
  html[data-amal-presentation="mobile"] body.resource-home .global-account-menu a,
  html[data-amal-presentation="mobile"] body.resource-home .global-account-menu button,
  html[data-amal-presentation="mobile"] body.resource-home .global-language-menu button {
    min-height: 48px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-login-form input,
  html[data-amal-presentation="mobile"] body.resource-home .auth-card input,
  html[data-amal-presentation="mobile"] body.resource-home .register-modal input,
  html[data-amal-presentation="mobile"] body.resource-home .register-modal select {
    min-height: 48px;
    font-size: 16px;
  }

  /* The static header is a no-script/loading fallback before shared-header JS. */
  html[data-amal-presentation="mobile"] body.resource-home > .site-header {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 64px;
    padding: 8px 12px;
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  html[data-amal-presentation="mobile"] body.resource-home > .site-header .site-brand {
    min-width: 0;
    padding: 0;
    border: 0;
  }

  html[data-amal-presentation="mobile"] body.resource-home > .site-header .site-brand img {
    width: clamp(124px, 36vw, 150px);
  }

  html[data-amal-presentation="mobile"] body.resource-home > .site-header .site-brand span,
  html[data-amal-presentation="mobile"] body.resource-home > .site-header .site-nav {
    display: none;
  }

  html[data-amal-presentation="mobile"] body.resource-home > .site-header .site-actions {
    flex-wrap: nowrap;
    gap: 4px;
    margin-left: 0;
  }

  html[data-amal-presentation="mobile"] body.resource-home > .site-header .lang-button,
  html[data-amal-presentation="mobile"] body.resource-home > .site-header .login-button {
    min-width: 44px;
    min-height: 44px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-login-form > a,
  html[data-amal-presentation="mobile"] body.resource-home .global-login-form p button,
  html[data-amal-presentation="mobile"] body.resource-home .forgot-link,
  html[data-amal-presentation="mobile"] body.resource-home .auth-card p button,
  html[data-amal-presentation="mobile"] body.resource-home .register-switch button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-password-field input,
  html[data-amal-presentation="mobile"] body.resource-home .password-field input {
    padding-right: 54px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-password-field button,
  html[data-amal-presentation="mobile"] body.resource-home .password-field button,
  html[data-amal-presentation="mobile"] body.resource-home .modal-close {
    width: 44px;
    height: 44px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-password-field button,
  html[data-amal-presentation="mobile"] body.resource-home .password-field button {
    right: 2px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .modal-close {
    top: 8px;
    right: 8px;
  }

  /* One-column mobile hero with one dominant action. */
  html[data-amal-presentation="mobile"] body.resource-home .hero-section {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 24px 16px 32px;
    padding-right: max(16px, env(safe-area-inset-right));
    padding-left: max(16px, env(safe-area-inset-left));
  }

  html[data-amal-presentation="mobile"] body.resource-home .hero-copy,
  html[data-amal-presentation="mobile"] body.resource-home .hero-preview {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    justify-self: stretch;
  }

  html[data-amal-presentation="mobile"] body.resource-home .hero-copy > *,
  html[data-amal-presentation="mobile"] body.resource-home .hero-actions,
  html[data-amal-presentation="mobile"] body.resource-home .quick-features {
    max-width: 100%;
    min-width: 0;
  }

  html[data-amal-presentation="mobile"] body.resource-home .hero-copy h1 {
    margin-bottom: 16px;
    font-size: clamp(30px, 8.8vw, 38px);
    line-height: 1.08;
    letter-spacing: -.02em;
    overflow-wrap: break-word;
  }

  html[data-amal-presentation="mobile"] body.resource-home .hero-copy h1::after {
    width: 48px;
    height: 4px;
    margin-top: 16px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .hero-copy p {
    max-width: none;
    font-size: 16px;
    line-height: 1.5;
    overflow-wrap: break-word;
  }

  html[data-amal-presentation="mobile"] body.resource-home .hero-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-top: 22px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .primary-action,
  html[data-amal-presentation="mobile"] body.resource-home .secondary-action {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 0 18px;
    border-radius: 12px;
    color: var(--ink);
    background: #fff;
    font-size: 16px;
    box-shadow: none;
  }

  html[data-amal-presentation="mobile"] body.resource-home .primary-action,
  html[data-amal-presentation="mobile"] body.resource-home .primary-action:hover,
  html[data-amal-presentation="mobile"] body.resource-home .primary-action:active {
    border: 0;
    color: #fff;
    background: linear-gradient(180deg, #0b64ff, #0045dc);
  }

  html[data-amal-presentation="mobile"] body.resource-home .secondary-action,
  html[data-amal-presentation="mobile"] body.resource-home .secondary-action:hover,
  html[data-amal-presentation="mobile"] body.resource-home .secondary-action:active {
    border: 1px solid #bcd1f4;
    color: #153a7a;
    background: #fff;
  }

  html[data-amal-presentation="mobile"] body.resource-home .quick-features {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-width: none;
    margin-top: 24px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .quick-features div {
    align-content: start;
    min-width: 0;
    min-height: 132px;
    padding: 14px 8px 12px;
    border: 1px solid #dbe8ff;
    border-radius: 12px;
    background: #f7faff;
    font-size: 13px;
    overflow-wrap: break-word;
  }

  html[data-amal-presentation="mobile"] body.resource-home .quick-features span {
    width: 52px;
    height: 52px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .quick-features img {
    width: 30px;
    height: 30px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .hero-preview {
    border-radius: 14px;
    box-shadow: 0 14px 36px rgba(7, 28, 95, .12);
  }

  /* Mobile sections are shorter, card-based and contained by their own viewport. */
  html[data-amal-presentation="mobile"] body.resource-home section h2 {
    margin-bottom: 22px;
    text-align: left;
    font-size: clamp(26px, 7.6vw, 32px);
  }

  html[data-amal-presentation="mobile"] body.resource-home .language-section,
  html[data-amal-presentation="mobile"] body.resource-home .benefits-section,
  html[data-amal-presentation="mobile"] body.resource-home .audience-section,
  html[data-amal-presentation="mobile"] body.resource-home .trust-section,
  html[data-amal-presentation="mobile"] body.resource-home .company-section {
    padding: 40px 16px;
    padding-right: max(16px, env(safe-area-inset-right));
    padding-left: max(16px, env(safe-area-inset-left));
  }

  html[data-amal-presentation="mobile"] body.resource-home .language-row {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 6px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .language-track {
    --language-gap: 10px;
    --visible-languages: 2;
  }

  html[data-amal-presentation="mobile"] body.resource-home .language-track span {
    width: 64px;
    height: 64px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .language-row button {
    width: 44px;
    height: 44px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .benefit-grid,
  html[data-amal-presentation="mobile"] body.resource-home .audience-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .benefit-grid article,
  html[data-amal-presentation="mobile"] body.resource-home .audience-grid article {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 14px;
    padding: 18px 16px;
    border: 1px solid #e1eaf7;
    border-radius: 14px;
    background: linear-gradient(135deg, #fff, #f8fbff);
    box-shadow: 0 8px 24px rgba(7, 28, 95, .06);
  }

  html[data-amal-presentation="mobile"] body.resource-home .benefit-grid span,
  html[data-amal-presentation="mobile"] body.resource-home .audience-grid span {
    width: 52px;
    height: 52px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .benefit-grid h3,
  html[data-amal-presentation="mobile"] body.resource-home .audience-grid h3 {
    margin-bottom: 6px;
    font-size: 18px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .benefit-grid p,
  html[data-amal-presentation="mobile"] body.resource-home .audience-grid p {
    grid-column: 2;
    font-size: 15px;
    line-height: 1.5;
  }

  html[data-amal-presentation="mobile"] body.resource-home .review-grid {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 100%;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 4px 0 16px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
  }

  html[data-amal-presentation="mobile"] body.resource-home .review-grid article {
    min-width: 0;
    padding: 22px 20px;
    border-radius: 14px;
    scroll-snap-align: start;
  }

  html[data-amal-presentation="mobile"] body.resource-home .cta-section {
    width: auto;
    max-width: none;
    margin: 24px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left));
    padding: 30px 18px 32px;
    border-radius: 16px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .stats-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 26px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .stats-row strong {
    gap: 5px;
    font-size: 24px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .stats-row span {
    font-size: 11px;
    line-height: 1.25;
  }

  html[data-amal-presentation="mobile"] body.resource-home .cta-section h2 {
    text-align: center;
  }

  html[data-amal-presentation="mobile"] body.resource-home .cta-section p {
    font-size: 16px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .cta-section a {
    width: 100%;
    min-width: 0;
    padding: 0 18px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .company-row {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 12px) / 2);
    gap: 12px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 6px 0 14px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
  }

  html[data-amal-presentation="mobile"] body.resource-home .company-row button {
    display: none;
  }

  html[data-amal-presentation="mobile"] body.resource-home .company-row b {
    min-width: 0;
    min-height: 76px;
    display: grid;
    place-items: center;
    border: 1px solid #e1eaf7;
    border-radius: 12px;
    background: #fff;
    font-size: 24px;
    scroll-snap-align: start;
  }

  html[data-amal-presentation="mobile"] body.resource-home .site-footer {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 34px 16px 0;
    padding-right: max(16px, env(safe-area-inset-right));
    padding-left: max(16px, env(safe-area-inset-left));
  }

  html[data-amal-presentation="mobile"] body.resource-home .footer-brand img {
    width: 156px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .site-footer nav {
    gap: 10px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
  }

  html[data-amal-presentation="mobile"] body.resource-home .site-footer a {
    min-height: 40px;
    display: flex;
    align-items: center;
  }

  html[data-amal-presentation="mobile"] body.resource-home .footer-bottom {
    display: grid;
    justify-items: start;
    gap: 10px;
    padding-bottom: max(22px, env(safe-area-inset-bottom));
    text-align: left;
  }

  /* Registration becomes a stable bottom sheet instead of a narrow desktop modal. */
  html[data-amal-presentation="mobile"] body.resource-home .auth-modal-backdrop {
    place-items: end center;
    padding: 12px 0 0;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  html[data-amal-presentation="mobile"] body.resource-home .register-modal {
    width: 100%;
    max-height: calc(100dvh - 12px - env(safe-area-inset-top));
    padding: 26px 18px max(22px, env(safe-area-inset-bottom));
    padding-right: max(18px, env(safe-area-inset-right));
    padding-left: max(18px, env(safe-area-inset-left));
    overflow-y: auto;
    border-radius: 18px 18px 0 0;
  }

  html[data-amal-presentation="mobile"] body.resource-home .form-grid.three,
  html[data-amal-presentation="mobile"] body.resource-home .form-grid.two,
  html[data-amal-presentation="mobile"] body.resource-home .phone-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 390px) {
  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home {
    gap: 6px;
    padding-right: max(8px, env(safe-area-inset-right));
    padding-left: max(8px, env(safe-area-inset-left));
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-brand img,
  html[data-amal-presentation="mobile"] body.resource-home > .site-header .site-brand img {
    width: 96px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-lang-btn {
    width: 44px;
    min-width: 44px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-login-btn,
  html[data-amal-presentation="mobile"] body.resource-home .global-site-header--home .global-login-btn.signed-in {
    min-width: 60px;
    max-width: 68px;
    padding-inline: 6px;
  }

  html[data-amal-presentation="mobile"] body.resource-home .hero-section {
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
  }

  html[data-amal-presentation="mobile"] body.resource-home .hero-copy h1 {
    font-size: clamp(29px, 8.6vw, 34px);
  }
}

@media (max-width: 340px) {
  html[data-amal-presentation="mobile"] body.resource-home .quick-features {
    grid-template-columns: minmax(0, 1fr);
  }

  html[data-amal-presentation="mobile"] body.resource-home .quick-features div {
    min-height: 108px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-amal-presentation="mobile"] body.resource-home *,
  html[data-amal-presentation="mobile"] body.resource-home *::before,
  html[data-amal-presentation="mobile"] body.resource-home *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
