/* ==========================================================================
   28. 字體放大後的行動版防護（v2.3）
   解決：Hero 面板溢出、長文字斷行、按鈕擠壓
   ========================================================================== */

/* ---------- 全域：防止橫向溢出 ---------- */
html,
body {
  overflow-x: hidden;
  max-width: 100%;
}

/* 長英文字串（如 DGAI、Email、網址）強制斷行 */
.hero__lead,
.page-hero__lead,
.lead,
.section-subtitle,
.card p,
.svc-card p,
.port-card p,
.faq-a__inner,
.footer__legal,
.info-card__value {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ---------- Hero 面板：手機版改為完整寬度 ---------- */
@media (max-width: 900px) {
  .hero__grid {
    gap: 32px;
  }

  /* 面板不再用固定寬，改成充滿可用寬度 */
  .hero__panel {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 20px 18px 20px;
    margin: 0;
  }

  /* 清單項目：文字可換行，不再被裁掉 */
  .hero__list li {
    gap: 10px;
    padding: 12px 2px;
    align-items: flex-start;
  }

  .hero__list-num {
    width: 20px;
    font-size: 0.62rem;
    padding-top: 3px;
  }

  .hero__list-name {
    font-size: 0.94rem;
    line-height: 1.55;
    white-space: normal;
    overflow-wrap: break-word;
  }

  /* 右側小圓點在窄螢幕容易擠壓，隱藏 */
  .hero__list-dot {
    display: none;
  }

  /* 統計列：兩欄排列，避免文字擠成一坨 */
  .hero__stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
  }

  .hero__stat {
    padding-right: 12px;
    padding-bottom: 5px;
  }

  .hero__stat + .hero__stat {
    padding-left: 14px;
  }

  .hero__stat:nth-child(3) {
    padding-left: 0;
    border-left: none;
  }

  .hero__stat:nth-child(3),
  .hero__stat:nth-child(4) {
    padding-top: 16px;
    margin-top: 4px;
    border-top: 1px solid var(--line-dark-soft);
  }

  .hero__stat strong {
    font-size: 1.9rem;
  }

  .hero__stat span {
    font-size: 0.82rem;
    line-height: 1.45;
  }

  /* Hero 按鈕：窄螢幕改為上下堆疊、滿寬 */
  .hero__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .hero__actions .btn {
    width: 100%;
  }

  /* 服務卡內距縮小，避免小螢幕擁擠 */
  .svc-card {
    padding: 24px 20px 26px;
  }

  .svc-card--photo .svc-card__body {
    padding: 20px 20px 24px;
  }
}

@media (max-width: 640px) {
  .hero__panel {
    padding: 18px 15px 18px;
    border-radius: var(--r-md);
  }

  .hero__list-name {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .hero__list li {
    padding: 11px 0;
  }

  .hero__stat strong {
    font-size: 1.72rem;
  }

  .hero__stat span {
    font-size: 0.78rem;
  }

  /* 極窄螢幕：Hero 標題避免過大 */
  .hero h1 {
    font-size: clamp(1.85rem, 8.4vw, 2.6rem);
    line-height: 1.2;
  }

  .hero__lead {
    font-size: 1.02rem;
    line-height: 1.9;
  }

  /* 卡片標題縮一階 */
  .card-title {
    font-size: 1.12rem;
  }

  .svc-card h3 {
    font-size: 1.1rem;
  }

  .port-card h3 {
    font-size: 1.16rem;
  }

  /* 表單標籤與輸入框 */
  .field label {
    font-size: 0.9rem;
  }

  .field input,
  .field select,
  .field textarea {
    font-size: 1rem;
  }

  /* 麵包屑 */
  .breadcrumb {
    font-size: 0.66rem;
  }

  /* 頁尾 */
  .footer__col a,
  .footer__contact-item {
    font-size: 0.94rem;
  }

  .footer__bottom {
    font-size: 0.68rem;
  }

  /* 圖片牆：兩欄，避免過擠 */
  .photo-wall {
    gap: 8px;
  }

  /* 服務對照清單：字級與間距 */
  .svc-card__sub {
    font-size: 0.72rem;
  }
}

/* ---------- 極窄螢幕（360px 以下） ---------- */
@media (max-width: 380px) {
  .hero h1 {
    font-size: 1.72rem;
  }

  .hero__stat strong {
    font-size: 1.56rem;
  }

  .logo__text strong {
    font-size: 1.3rem;
  }

  .logo__mark {
    width: 46px;
    height: 46px;
  }
}

/* ---------- 平板（768–900）微調 ---------- */
@media (min-width: 641px) and (max-width: 900px) {
  .hero__panel {
    max-width: 560px;
    margin: 0 auto;
  }

  .hero__actions {
    flex-direction: row;
  }

  .hero__actions .btn {
    width: auto;
  }
}
