/* =============================================================
   responsive.css
   职责：断点适配。目标断点 —— 1200px / 1100px / 900px /
        768px / 640px / 400px，保证 375px 起都好看
   ============================================================= */

/* -------------------------------------------------------------
   ≤1200px：正文留白收紧，网格改 2 列
   ------------------------------------------------------------- */
@media (max-width: 1200px) {
  :root { --page-max: 1040px; }

  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* -------------------------------------------------------------
  ≤1100px：Hero 间距压缩
   ------------------------------------------------------------- */
@media (max-width: 1100px) {
  .hero { gap: 32px; }
  .hero__visual { min-height: 300px; }
  .stack { width: min(100%, 320px); }
}

/* -------------------------------------------------------------
   ≤900px：导航折叠为抽屉；Hero 单列
   ------------------------------------------------------------- */
@media (max-width: 900px) {
  :root { --nav-h: 62px; }

  .nav-burger { display: grid; }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
  }
  .brand__text {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nav-actions {
    margin-left: auto;
  }

  .nav-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    z-index: 20;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px;
    border-radius: var(--r-lg);
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(var(--glass-saturate));
    backdrop-filter: blur(var(--blur-lg)) saturate(var(--glass-saturate));
    box-shadow: inset 0 0 0 1px var(--glass-brd-soft), var(--shadow-2);
    /* 收起态 */
    opacity: 0;
    transform: translate3d(0, -10px, 0) scale(0.98);
    transform-origin: top center;
    pointer-events: none;
    transition:
      opacity var(--dur) var(--ease),
      transform var(--dur) var(--ease-out);
  }
  .nav-panel.is-open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .nav-link {
    padding: 12px 16px;
    border-radius: var(--r-md);
    font-size: 15.5px;
  }

  .searchbox { width: 100%; height: 44px; }

  /* Hero 改为纵向单列，装饰图在下 */
  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding-top: clamp(32px, 6vw, 56px);
  }
  .hero__visual { order: 2; min-height: 260px; }
  .hero__copy { order: 1; }
  .hero__desc { max-width: none; }

  /* 关于区改纵向 */
  .about {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 24px;
  }
  .about__avatar { width: 68px; height: 68px; font-size: 27px; border-radius: 22px; }

  /* 模态框：桌面改为居中卡片 */
  .modal { place-items: center; padding: 16px; }
  .modal__panel {
    width: min(860px, 100%);
    height: min(90vh, 100%);
    border-radius: var(--r-xl);
  }
}

/* -------------------------------------------------------------
   ≤768px：平板
   ------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --page-pad: 18px;
    --blur-lg: 26px;
  }

  .section { padding-bottom: 56px; }

  .hero__stats { gap: 26px; margin-top: 32px; }
  .stat dd { font-size: 21px; }

  .grid { gap: 18px; }

  .card { padding: 10px 10px 18px; }
  .card__body { padding: 16px 8px 0; }
  .card__title { font-size: 17.5px; }

  .prose { font-size: 16px; padding-bottom: 32px; }
  .article__title { margin-top: 14px; }
  .article__nav { padding-bottom: 36px; }
}

/* -------------------------------------------------------------
   ≤640px：手机单列
   ------------------------------------------------------------- */
@media (max-width: 640px) {
  :root { --nav-h: 56px; }

  .site-header { padding-block: 10px; }
  .navbar {
    width: 100%;
    gap: 10px;
    padding: 0 9px 0 12px;
  }
  .brand { gap: 8px; }
  .brand__text { font-size: 16px; }
  .nav-actions { gap: 6px; }
  .icon-btn { width: 38px; height: 38px; }

  .grid { grid-template-columns: minmax(0, 1fr); }

  .section__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
  }

  .hero {
    gap: 12px;
    padding-top: 24px;
    padding-bottom: 28px;
  }
  .hero__title {
    margin-top: 16px;
    font-size: clamp(31px, 9vw, 40px);
  }
  .hero__desc {
    margin-top: 16px;
    line-height: 1.72;
  }
  .hero__cta {
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 24px;
  }

  .hero__cta .btn { flex: 1 1 auto; justify-content: center; }

  .hero__stats {
    justify-content: space-between;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
  }
  .stat { min-width: 0; }

  .hero__visual { min-height: 168px; }
  .stack { width: min(100%, 200px); }
  .stack__card { padding: 14px; }
  .stack__card:nth-child(1) {
    top: 0;
    right: 4%;
    width: 72%;
  }
  .stack__card:nth-child(2) {
    bottom: 0;
    left: 0;
    width: 70%;
  }
  .stack__card:nth-child(3) { display: none; }
  .stack__code { font-size: 10.5px; }
  .stack__chip { font-size: 10px; }
  .stack__ring { width: 48px; height: 48px; }

  .filterbar { margin-bottom: 18px; }

  /* 详情头部封面变矮，避免小屏被图占满 */
  .article__cover { height: 150px; }
  .article__head { margin-top: -34px; padding-inline: 18px; }
  .prose { padding-inline: 18px; }
  .article__nav {
    grid-template-columns: minmax(0, 1fr);
    padding-inline: 18px;
  }
  .pager--next { text-align: left; align-items: flex-start; }

  .article__meta { gap: 8px 12px; font-size: 13px; }

  .footer-inner { padding: 22px 18px; }
  .footer__rows { gap: 8px; }
  .footer__row { font-size: 12px; }
  .footer__pill { padding: 5px 12px; }
  .footer__badge { height: 16px; }
  .footer__icp .footer__badge { height: 18px; }
}

/* -------------------------------------------------------------
   ≤400px：窄屏细节修正（iPhone SE / 375px）
   ------------------------------------------------------------- */
@media (max-width: 400px) {
  :root { --page-pad: 14px; }

  .navbar { padding: 0 7px 0 10px; gap: 6px; }
  .brand__text { font-size: 15.5px; }
  .brand__mark { width: 30px; height: 30px; border-radius: 10px; }
  .icon-btn { width: 36px; height: 36px; }

  .hero__title { font-size: 30px; }
  .hero__cta .btn { padding-inline: 13px; }
  .hero__stats { gap: 18px; }
  .stat dd { font-size: 19px; }
  .stat dt { font-size: 11.5px; }

  .chip { padding: 8px 13px; font-size: 13px; }

  .card__title { font-size: 16.5px; }
  .card__excerpt { font-size: 13.5px; }

  .footer-inner { padding: 18px 14px; }
  .footer__rows { gap: 7px; }
  .footer__row { font-size: 11px; gap: 5px; }
  .footer__pill { padding: 4px 10px; }
  .footer__badge { height: 15px; }
  .footer__icp .footer__badge { height: 17px; }

  .modal { padding: 0; }
  .modal__panel {
    height: 96vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
  .modal__close { top: 10px; right: 10px; width: 34px; height: 34px; }

  .toast { left: 14px; right: 14px; bottom: 20px; text-align: center; }
}

/* -------------------------------------------------------------
   超宽屏：限制内容宽度，避免行长过长
   ------------------------------------------------------------- */
@media (min-width: 1600px) {
  :root { --page-max: 1280px; }
  body { font-size: 16.5px; }
}

/* -------------------------------------------------------------
   触摸设备：去掉 hover 位移，避免点击后"粘住"的悬浮态
   ------------------------------------------------------------- */
@media (hover: none) {
  .card-shell:hover { transform: none; }
  .btn:hover,
  .chip:hover,
  .icon-btn:hover,
  .pager:hover:not(:disabled) { transform: none; }
  .card-shell:hover .cover::after { opacity: 0; }
}

/* -------------------------------------------------------------
   打印：去掉玻璃与装饰，输出纯文本
   ------------------------------------------------------------- */
@media print {
  .aurora,
  .grain,
  .site-header,
  .to-top,
  .hero__visual,
  .filterbar,
  .site-footer { display: none !important; }

  body { background: #fff; color: #000; }
  .glass,
  .glass-soft { backdrop-filter: none !important; background: #fff !important; box-shadow: none !important; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .modal { position: static; display: block; }
  .modal__panel { height: auto; box-shadow: none; }
  .modal__scroll { overflow: visible; }
}
