/* =============================================================
   寿光市人民政府门户网站（静态演示样板）
   文件：assets/css/responsive.css
   职责：全断点响应式。验证视口：360 / 375 / 768 / 1024 / 1366 / 1920。
         移动菜单、悬浮工具折叠、表格卡片化、各频道布局降级。
   依赖：前序全部样式文件（必须最后引入）
   ============================================================= */

/* ---------- 全局：移动菜单打开时锁定滚动 ---------- */
body.no-scroll { overflow: hidden; }

/* =============================================================
   ≥1600px：大屏呼吸感（1366/1920 共用 1240 栅格，仅增间距）
   ============================================================= */
@media (min-width: 1600px) {
  .section { padding-top: var(--sp-16); padding-bottom: var(--sp-16); }
  .section--tight { padding-top: var(--sp-10); padding-bottom: var(--sp-10); }
}

/* =============================================================
   ≤1279px（含 1024 验证档）
   ============================================================= */
@media (max-width: 1279.98px) {
  .container { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .main-nav__link { padding: 0 var(--sp-4); }
  .home-primary { gap: var(--sp-5); }
}

/* =============================================================
   ≤1023px：平板 / 移动导航切换点
   ============================================================= */
@media (max-width: 1023.98px) {

  /* ---------- 移动菜单 ---------- */
  .mobile-menu-toggle { display: inline-flex; }
  .main-nav__quick-search { display: none !important; }
  .main-nav .container { position: relative; justify-content: space-between; }

  .main-nav__list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--c-gov-blue-dark);
    display: none;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
  }
  .main-nav.is-mobile-open .main-nav__list { display: flex; }

  .main-nav__item { width: 100%; }
  .main-nav__link {
    width: 100%;
    min-height: 54px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    border-left: 3px solid transparent;
    justify-content: space-between;
  }
  .main-nav__link[aria-current="page"],
  .main-nav__item.is-active > .main-nav__link {
    border-bottom-color: rgba(255, 255, 255, 0.10);
    border-left-color: var(--c-sg-green);
  }

  /* 下拉改为面内手风琴；禁用桌面 focus-within 兜底 */
  .main-nav__item:focus-within > .main-nav__dropdown { display: none; }
  .main-nav__dropdown {
    position: static;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: rgba(0, 0, 0, 0.22);
    padding: 0;
    min-width: 0;
  }
  .main-nav__item.is-open > .main-nav__dropdown { display: block; }
  .main-nav__dropdown a {
    color: rgba(255, 255, 255, 0.92);
    min-height: 48px;
    padding-left: calc(var(--sp-5) + 18px);
  }
  .main-nav__dropdown a:hover {
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
  }
  .main-nav__dropdown a.is-highlight { color: #A8E6DE; }
  .main-nav__dropdown a.is-highlight::before { background: #A8E6DE; }

  /* ---------- 布局降级（minmax(0,1fr) 防止子元素 min-content 撑破轨道） ---------- */
  .layout-main-side,
  .layout-side-main,
  .guide-layout,
  .gazette-layout,
  .map-layout,
  .calendar-layout,
  .home-primary { grid-template-columns: minmax(0, 1fr); }

  .layout-main-side > *,
  .layout-side-main > *,
  .guide-layout > *,
  .gazette-layout > *,
  .map-layout > *,
  .calendar-layout > *,
  .home-primary > * { min-width: 0; }

  .guide-nav {
    position: static;
    display: flex;
    overflow-x: auto;
    gap: var(--sp-1);
    padding: var(--sp-2);
  }
  .guide-nav a {
    white-space: nowrap;
    border-left: 0;
    border-bottom: 3px solid transparent;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }
  .guide-nav a.is-current {
    border-left: 0;
    border-bottom-color: var(--c-gov-blue);
  }

  .issue-list { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: var(--sp-2); }
  .issue-list li { margin: 0; flex: 0 0 auto; }
  .issue-btn { white-space: nowrap; }

  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sitemap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .place-list { max-height: 300px; }
}

/* =============================================================
   ≤767px：手机（768/375/360 验证档入口）
   ============================================================= */
@media (max-width: 767.98px) {

  .section { padding: var(--sp-8) 0; }

  /* ---------- 页头纵排 ---------- */
  .site-header .container {
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-4);
    padding-top: var(--sp-5);
    padding-bottom: var(--sp-5);
  }
  .site-search { max-width: none; min-width: 0; flex: none; }
  .site-search__form { flex-wrap: nowrap; }
  .site-search__btn { padding: 0 var(--sp-4); }
  .site-search__ask { padding: 0 var(--sp-3); }

  /* ---------- 网格降级 ---------- */
  .grid { gap: var(--sp-4); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sitemap-grid { grid-template-columns: 1fr; }
  .site-footer__cols { grid-template-columns: 1fr; gap: var(--sp-5); }

  /* ---------- 列表与标题 ---------- */
  .doc-list__item { flex-wrap: wrap; min-width: 0; }
  .doc-list__title { white-space: normal; min-width: 0; }
  .policy-mini { min-width: 0; }
  .policy-mini__title { white-space: normal; min-width: 0; }
  .news-item__title, .news-item__summary, .result-item__title { min-width: 0; }
  .mini-tabs { flex-wrap: wrap; }
  .filter-group__options { min-width: 0; }
  .list-toolbar { min-width: 0; }
  .list-toolbar .form-input { width: 100%; }
  .list-toolbar .form-input,
  .list-toolbar .sort-select { min-width: 0; }
  .side-card, .card, .article { min-width: 0; }
  .sec-head { flex-direction: column; align-items: flex-start; }
  .notice-flash { flex-wrap: wrap; row-gap: var(--sp-1); }
  .notice-flash__link { white-space: normal; overflow: visible; }
  .headline-card__title { font-size: var(--fs-xl); }

  /* ---------- 文章 ---------- */
  .article { padding: var(--sp-5) var(--sp-4); }
  .article__title { font-size: var(--fs-xl); }
  .meta-grid { grid-template-columns: 1fr; }
  .meta-grid > div:nth-last-child(-n+2) { border-bottom: 1px solid var(--c-border-light); }
  .meta-grid > div:last-child { border-bottom: 0; }
  .meta-grid dt { flex: 0 0 96px; }

  /* ---------- 筛选条 ---------- */
  .filter-group { flex-direction: column; gap: var(--sp-2); }
  .filter-group__label { flex: none; padding-top: 0; }
  .list-toolbar { flex-direction: column; align-items: stretch; }

  /* ---------- 公报 / 指南 / 表格横向滚动兜底 ---------- */
  .guide-layout { display: block; }
  .guide-nav { max-width: 100%; margin-bottom: var(--sp-4); }
  .issue-list { max-width: 100%; }
  .gazette-layout .sec-head { width: 100%; }
  .table-wrap { max-width: 100%; }
  .toc-box, .gazette-head__info { min-width: 0; }

  /* ---------- 表格：滚动提示 + 卡片化模式 ---------- */  .table-wrap__hint { display: block; }
  .data-table--cards { min-width: 0; }
  .data-table--cards thead { display: none; }
  .data-table--cards tbody tr {
    display: block;
    border-bottom: 6px solid var(--c-bg-page);
  }
  .data-table--cards td {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-4);
    border-bottom: 1px dashed var(--c-border-light);
  }
  .data-table--cards td::before {
    content: attr(data-label);
    flex: 0 0 88px;
    font-weight: 700;
    color: var(--c-text-secondary);
  }
  .data-table--cards tbody tr:last-child { border-bottom: 0; }

  /* ---------- 步骤流程转纵向 ---------- */
  .step-flow { flex-direction: column; gap: 0; }
  .step-flow > li {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-4);
    text-align: left;
    padding: 0 0 var(--sp-5);
  }
  .step-flow > li::before { margin: 0; flex: 0 0 auto; }
  .step-flow > li::after {
    top: 44px;
    left: 19px;
    width: 2px;
    height: calc(100% - 48px);
  }
  .step-flow > li:last-child { padding-bottom: 0; }
  .step-flow__body { flex: 1; min-width: 0; padding-top: 6px; }

  /* ---------- 悬浮工具折叠为紧凑图标钮 ---------- */
  .float-tools { right: 10px; bottom: 84px; gap: var(--sp-2); }
  .float-tools__btn {
    width: 48px;
    min-height: 48px;
    border-radius: 50%;
    padding: 0;
    gap: 0;
  }
  .float-tools__btn svg { width: 22px; height: 22px; }
  .float-tools__label { display: none; }
  body.care-mode .float-tools__btn {
    width: 56px;
    min-height: 56px;
  }
  body.care-mode .float-tools__btn svg { width: 26px; height: 26px; }

  /* ---------- 问答面板全宽贴底 ---------- */
  .chat-panel {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 24px);
  }
  body.care-mode .chat-panel { width: auto; }

  /* ---------- 模态框 ---------- */
  .modal { max-width: 100%; max-height: 92vh; }
  .modal-backdrop { padding: var(--sp-3); }

  /* ---------- 日历紧凑 ---------- */
  .calendar__cell { min-height: 50px; font-size: var(--fs-xs); padding: 3px; }
  .calendar__daynum { width: 20px; height: 20px; font-size: var(--fs-xs); }
  .calendar__dot { width: 6px; height: 6px; }
  .event-date { width: 52px; }

  /* ---------- 地图 ---------- */
  .map-canvas { padding-bottom: 86%; }

  /* ---------- 页脚底行 ---------- */
  .site-footer__bottom .container { flex-direction: column; align-items: flex-start; }

  /* ---------- 其他 ---------- */
  .flow-diagram { flex-direction: column; }
  .flow-diagram__arrow { transform: rotate(90deg); align-self: center; }
  .gazette-head { flex-direction: row; }
  .about-hero { padding: var(--sp-8) 0; }
  .ai-intro { padding: var(--sp-5); }
  .feature-band .band-links a { flex: 1 1 auto; justify-content: center; }
}

/* =============================================================
   ≤479px：小屏手机（375 / 360 验证档）
   ============================================================= */
@media (max-width: 479.98px) {

  .container { padding-left: var(--sp-3); padding-right: var(--sp-3); }

  h1 { font-size: var(--fs-2xl); }
  .site-brand__name { font-size: var(--fs-xl); letter-spacing: 1px; }
  .site-brand__sub { letter-spacing: 2px; }
  .site-brand__logo { width: 48px; height: 48px; }
  .site-brand__logo img,
  .site-brand__logo svg { width: 38px; height: 38px; }

  .util-bar__status { display: none; }
  .util-bar .container { gap: var(--sp-1) var(--sp-3); }
  .util-bar__left { display: none; }
  .util-bar__right { width: 100%; justify-content: space-between; }
  .util-bar__right .util-bar__divider { display: none; }
  .hide-sm { display: none !important; }
  .site-search__btn, .site-search__ask { padding: 0 var(--sp-3); font-size: var(--fs-sm); }

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

  .entry-card { min-height: 0; }
  .icon-chip { width: 40px; height: 40px; }

  .article { padding: var(--sp-4) var(--sp-3); }
  .page-404__code { font-size: 72px; }

  .pagination { gap: var(--sp-1); }
  .pagination__btn { min-width: 40px; padding: 0 var(--sp-2); }

  .chat-msg__bubble { max-width: 92%; }
  .search-big input { min-height: 48px; }
  .search-big button { min-height: 48px; padding: 0 var(--sp-4); }

  .map-pin__label { display: none; }
  .gazette-cover { width: 80px; height: 108px; }

  .brand-card { flex-direction: column; }
  .headline-card { padding: var(--sp-4); }
  .guide-block { padding: var(--sp-4); }
}
