/* styles/rem.css */
/* #ifdef H5 */

/* REM适配 - CSS实现（主方案） */

/* 1. 基础设置 */
html {
  /* 基础值 */
  font-size: 16px;
  
  /* 使用clamp作为现代浏览器的回退方案 */
  font-size: clamp(12px, 1.111vw, 22px);
}

/* 2. 1440px以下 - 等比缩放 */
@media screen and (max-width: 1440px) {
  html {
    /* 计算: 16px * (当前视口宽度 / 1440) */
    font-size: calc(16px * (100vw / 1440));
  }
}

/* 3. 1440px-1920px - 减缓增长 */
@media screen and (min-width: 1440px) and (max-width: 1920px) {
  html {
    /* 计算: 16px + 4px * ((当前宽度 - 1440) / 480) */
    /* 从16px开始，到1920px时最多增加4px，使用0.7的减缓系数 */
    /* font-size: calc(16px + 4px * ((100vw - 1440px) / 480) * 0.7); */
  }
}

/* 4. 1920px以上 - 固定最大值 */
@media screen and (min-width: 1920px) {
  html {
    /* 最大1.2倍，即19.2px */
    font-size: 19.2px;
  }
}

/* 5. 防止极端情况 */
/* 极小屏幕保护 */
@media screen and (max-width: 320px) {
  html {
    font-size: 12px !important;
  }
}

/* 极大屏幕限制 */
@media screen and (min-width: 2560px) {
  html {
    font-size: 22px !important;
  }
}

/* 横屏适配 */
@media screen and (orientation: landscape) and (max-height: 500px) {
  html {
    font-size: 14px !important;
  }
}

/* #endif */