/**
 * dashi.help 首页 · 旗舰机 / 平板逻辑宽度分档（CSS 像素，非机型硬编码）
 *
 * A ≤374        · iPhone SE · 小屏安卓
 * B 375–389     · iPhone 14–18（6.1"）· 华为/小米标准档
 * C 390–427     · iPhone Pro · 小米14/15 · 华为 Mate/P Pro（约 393–412）
 * D 428–767     · iPhone Plus/Pro Max（430–440）· 小米14/15 Ultra · 三星 S Ultra
 * T 768–1023    · iPad mini/Air/Pro 竖屏 · 安卓平板
 * D+ 1024–1199  · iPad 横屏 · 小桌面
 */

body.lms-at.at-home-geo {
  --at-safe-l: env(safe-area-inset-left, 0px);
  --at-safe-r: env(safe-area-inset-right, 0px);
  --at-safe-t: env(safe-area-inset-top, 0px);
  --at-safe-b: env(safe-area-inset-bottom, 0px);
  --at-home-gutter: max(1.125rem, var(--at-safe-l), var(--at-safe-r));
  --at-h1-en: clamp(1.45rem, 5.2vw + 0.35rem, 2.05rem);
  --at-h1-zh: clamp(1.4rem, 4.8vw + 0.35rem, 1.95rem);
  --at-shell-top: max(3.65rem, calc(var(--at-safe-t) + 2.85rem));
}

html:has(body.at-home-geo),
body.lms-at.at-home-geo {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.lms-at.at-home-geo {
  overflow-y: visible;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

body.lms-at.at-home-geo .at-help-shell.at-home-geo-main,
body.lms-at.at-home-geo .at-home-hero-shell,
body.lms-at.at-home-geo .at-home-hero--stage,
body.lms-at.at-home-geo .at-home-impact-inner,
body.lms-at.at-home-geo .at-home-body-grid,
body.lms-at.at-home-geo .at-footer,
body.lms-at.at-home-geo .at-home-hero-headline,
body.lms-at.at-home-geo .at-home-hero-aside,
body.lms-at.at-home-geo .at-home-pillar,
body.lms-at.at-home-geo .at-home-research-card,
body.lms-at.at-home-geo .at-home-stat {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

body.lms-at.at-home-geo .at-help-shell.at-home-geo-main {
  padding-inline: var(--at-home-gutter);
  padding-bottom: max(2.5rem, calc(var(--at-safe-b) + 1.25rem));
}

body.lms-at.at-home-geo .at-home-geo-h1 {
  font-size: var(--at-h1-en);
  word-break: break-word;
  overflow-wrap: anywhere;
}

html[lang="zh-CN"] body.lms-at.at-home-geo .at-home-geo-h1 {
  font-size: var(--at-h1-zh);
}

/* 手机 / 小平板触控：内容始终可见（不依赖滚动动画） */
@media (max-width: 1023px) {
  body.lms-at.at-home-geo .at-home-reveal {
    opacity: 1;
    transform: none;
  }
}

/* —— 手机通用 ≤767 —— */
@media (max-width: 767px) {
  body.lms-at.at-home-geo .at-help-shell.at-home-geo-main {
    padding-top: var(--at-shell-top);
  }

  body.lms-at.at-home-geo .at-home-hero-aside {
    display: flex;
    flex-direction: column;
  }

  body.lms-at.at-home-geo .at-home-tagline {
    order: 1;
    font-size: 0.9375rem;
    line-height: 1.48;
  }

  body.lms-at.at-home-geo .at-home-hero-cta {
    order: 2;
    margin-top: 0.35rem;
  }

  body.lms-at.at-home-geo .at-home-geo-lead {
    order: 4;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.8125rem;
    line-height: 1.5;
  }

  body.lms-at.at-home-geo .at-home-hero--stage {
    border-radius: 18px;
    border: 1px solid rgba(94, 234, 212, 0.16);
    box-shadow:
      0 24px 48px rgba(0, 0, 0, 0.38),
      inset 0 1px 0 rgba(255, 255, 255, 0.04);
  }

  body.lms-at.at-home-geo .at-home-jump {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.45rem;
    padding-bottom: 0.35rem;
    mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  }

  body.lms-at.at-home-geo .at-home-jump::-webkit-scrollbar {
    display: none;
  }

  body.lms-at.at-home-geo .at-home-jump a {
    flex: 0 0 auto;
    scroll-snap-align: start;
    white-space: nowrap;
    min-height: 44px;
    padding: 0.5rem 0.9rem;
    font-size: 0.6875rem;
  }

  body.lms-at.at-home-geo .at-home-hero-cta .at-btn-enter,
  body.lms-at.at-home-geo .at-home-geo-cta .at-btn-enter {
    min-height: 48px;
    width: 100%;
    max-width: none;
  }

  body.lms-at.at-home-geo .at-home-geo-section {
    padding: 1.15rem 1.05rem;
  }

  body.lms-at.at-home-geo .at-home-stat span {
    font-size: 0.625rem;
    line-height: 1.35;
  }

  body.lms-at.at-home-geo .at-home-geo-linkrow a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  body.lms-at.at-home-geo .at-footer {
    padding-bottom: max(1rem, var(--at-safe-b));
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
  }
}

/* Tier A · ≤374 */
@media (max-width: 374px) {
  body.lms-at.at-home-geo {
    --at-h1-en: 1.32rem;
    --at-h1-zh: 1.28rem;
    --at-home-gutter: max(1rem, var(--at-safe-l), var(--at-safe-r));
  }

  body.lms-at.at-home-geo .at-home-kicker {
    font-size: 0.5rem;
    letter-spacing: 0.1em;
  }
}

/* Tier B · 375–389（iPhone 14–18 标准 · 华为/小米常规） */
@media (min-width: 375px) and (max-width: 389px) {
  body.lms-at.at-home-geo {
    --at-h1-en: clamp(1.42rem, 4.6vw + 0.4rem, 1.72rem);
    --at-h1-zh: clamp(1.38rem, 4.2vw + 0.4rem, 1.65rem);
    --at-home-gutter: max(1.0625rem, var(--at-safe-l), var(--at-safe-r));
  }
}

/* Tier C · 390–427（Pro · 小米14/15 · 华为 Pro） */
@media (min-width: 390px) and (max-width: 427px) {
  body.lms-at.at-home-geo {
    --at-h1-en: clamp(1.48rem, 4.2vw + 0.45rem, 1.82rem);
    --at-h1-zh: clamp(1.42rem, 3.8vw + 0.45rem, 1.75rem);
    --at-home-gutter: max(1.125rem, var(--at-safe-l), var(--at-safe-r));
  }

  body.lms-at.at-home-geo .at-home-stats {
    gap: 0.65rem;
  }
}

/* Tier D · 428–767（Max / Ultra · 含 iPhone 16/17/18 Pro Max ~440） */
@media (min-width: 428px) and (max-width: 767px) {
  body.lms-at.at-home-geo {
    --at-h1-en: clamp(1.58rem, 3.8vw + 0.5rem, 2.05rem);
    --at-h1-zh: clamp(1.5rem, 3.5vw + 0.5rem, 1.95rem);
    --at-home-gutter: max(1.25rem, var(--at-safe-l), var(--at-safe-r));
    --at-shell-top: max(3.85rem, calc(var(--at-safe-t) + 3rem));
  }

  body.lms-at.at-home-geo .at-home-stats {
    gap: 0.85rem;
  }

  body.lms-at.at-home-geo .at-home-stat strong {
    font-size: 1.35rem;
  }
}

/* 华为 / 小米系统放大（约 110%–120% 显示） */
@media (max-width: 767px) and (min-resolution: 2.5dppx) {
  body.lms-at.at-home-geo {
    --at-h1-en: clamp(1.35rem, 4.8vw + 0.25rem, 1.85rem);
    --at-h1-zh: clamp(1.3rem, 4.4vw + 0.25rem, 1.75rem);
  }
}

/* Tier T · 768–1023（iPad · 平板） */
@media (min-width: 768px) and (max-width: 1023px) {
  body.lms-at.at-home-geo {
    --at-home-gutter: max(1.75rem, var(--at-safe-l), var(--at-safe-r));
    --at-home-max: min(56rem, 100%);
    --at-h1-en: clamp(1.85rem, 2.4vw + 0.65rem, 2.55rem);
    --at-h1-zh: clamp(1.75rem, 2.2vw + 0.65rem, 2.35rem);
    --at-shell-top: max(5rem, calc(var(--at-safe-t) + 4rem));
  }

  body.lms-at.at-home-geo .at-help-shell.at-home-geo-main {
    padding-top: var(--at-shell-top);
  }

  body.lms-at.at-home-geo .at-home-hero--stage {
    width: 100%;
    margin: 0;
    border-radius: 22px;
    padding: clamp(1.75rem, 4vh, 2.5rem) var(--at-home-gutter);
  }

  body.lms-at.at-home-geo .at-home-hero-stage {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
    gap: clamp(1.75rem, 4vw, 2.75rem);
    min-height: 0;
    align-items: center;
  }

  body.lms-at.at-home-geo .at-home-tagline,
  body.lms-at.at-home-geo .at-home-hero-cta,
  body.lms-at.at-home-geo .at-home-geo-lead {
    order: unset;
  }

  body.lms-at.at-home-geo .at-home-hero-aside {
    max-width: none;
    padding-bottom: 0;
  }

  body.lms-at.at-home-geo .at-home-jump {
    flex-wrap: wrap;
    justify-content: center;
    mask-image: none;
  }

  body.lms-at.at-home-geo .at-home-jump a {
    flex: 0 1 auto;
    min-height: 44px;
  }

  body.lms-at.at-home-geo .at-home-body-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.15rem;
  }

  body.lms-at.at-home-geo .at-home-body-grid .at-home-geo-section--wide {
    grid-column: 1 / -1;
  }

  body.lms-at.at-home-geo .at-home-pillars {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.lms-at.at-home-geo .at-home-research {
    grid-template-columns: 1fr 1fr;
  }

  .at-lead-modal {
    align-items: center;
    padding: max(1rem, var(--at-safe-t)) var(--at-home-gutter) max(1rem, var(--at-safe-b));
  }

  .at-lead-dialog {
    width: min(100%, 38rem);
    max-height: min(88dvh, 680px);
    border-radius: 18px;
  }
}

/* iPad Pro 12.9 / 横屏 · 1024–1199 */
@media (min-width: 1024px) and (max-width: 1199px) {
  body.lms-at.at-home-geo {
    --at-home-max: min(72rem, 100%);
    --at-home-gutter: max(2rem, var(--at-safe-l), var(--at-safe-r));
  }
}

/* 手机横屏（矮视口） */
@media (max-height: 480px) and (orientation: landscape) and (max-width: 932px) {
  body.lms-at.at-home-geo {
    --at-shell-top: max(3rem, calc(var(--at-safe-t) + 2.5rem));
  }

  body.lms-at.at-home-geo .at-home-hero-stage {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
  }

  body.lms-at.at-home-geo .at-home-hero--stage {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
  }

  body.lms-at.at-home-geo {
    --at-h1-en: clamp(1.2rem, 3.5vh + 0.5rem, 1.55rem);
    --at-h1-zh: clamp(1.15rem, 3.2vh + 0.5rem, 1.48rem);
  }

  body.lms-at.at-home-geo .at-home-geo-lead {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
  }

  body.lms-at.at-home-geo .at-home-jump {
    display: none;
  }
}

/* 线索表单 · 全手机 */
@media (max-width: 767px) {
  .at-lead-modal {
    padding:
      max(0.35rem, var(--at-safe-t))
      max(0.5rem, var(--at-safe-r))
      max(0.5rem, var(--at-safe-b))
      max(0.5rem, var(--at-safe-l));
    align-items: end;
  }

  .at-lead-dialog {
    width: 100%;
    max-height: min(92dvh, 720px);
    border-radius: 18px 18px 0 0;
    padding-bottom: max(1.25rem, var(--at-safe-b));
  }

  .at-lead-field input,
  .at-lead-field select,
  .at-lead-field textarea {
    font-size: 16px;
    min-height: 44px;
  }
}
