/* ============================================================
 * Meiqia Theme — 全局布局与设计系统 (Layout / Design Tokens)
 * 目标：统一全站排版结构 · 清晰视觉层级 · 稳定响应式
 * 该文件在 tailwind.css 之后加载，用于收敛与覆盖散落的固定宽度工具类。
 * ============================================================ */

:root {
  --mq-header-h: 72px;
  --mq-maxw: 1188px;
  --mq-gutter: 24px;
  --mq-brand: #1880FF;
  --mq-brand-soft: #E6F1FF;
  --mq-ink: #040F42;
  --mq-text: #475569;
  --mq-muted: #9CA3AF;
  --mq-line: #EEF2F7;
  --mq-bg-soft: #F5FAFF;
  --mq-radius: 16px;
  --mq-shadow: 0 18px 48px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--mq-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: #fff;
  line-height: 1.6;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5, h6 { margin: 0; color: var(--mq-ink); line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }

/* 统一内容容器（资讯模块已在 news.css 定义，此处保证一致性） */
.mq-container {
  width: 100%;
  max-width: var(--mq-maxw);
  margin-inline: auto;
  padding-inline: var(--mq-gutter);
}

/* ============================================================
 * 顶部导航（统一头部，全站复用）
 * ============================================================ */
.mq-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--mq-header-h);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--mq-line);
}
.mq-header__inner {
  height: 100%;
  max-width: var(--mq-maxw);
  margin-inline: auto;
  padding-inline: var(--mq-gutter);
  display: flex;
  align-items: center;
  gap: 24px;
}
.mq-header__logo { flex: 0 0 auto; display: inline-flex; align-items: center; }
.mq-header__logo img { height: 36px; width: auto; }

.mq-header__nav { flex: 1 1 auto; display: flex; justify-content: center; }
.mq-header__nav .mq-nav {
  background: transparent !important;
  backdrop-filter: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  gap: 4px;
}
.mq-header__nav .mq-nav a {
  color: var(--mq-text) !important;
  font-size: 15px;
  font-weight: 500;
  padding: 8px 14px !important;
  border-radius: 999px !important;
  transition: color .2s ease, background .2s ease;
}
.mq-header__nav .mq-nav a:hover { color: var(--mq-brand) !important; background: var(--mq-bg-soft); }
.mq-header__nav .mq-nav a.\!text-\[\#1880FF\] { color: var(--mq-brand) !important; font-weight: 600; }

.mq-header__actions { flex: 0 0 auto; display: flex; align-items: center; gap: 14px; }

/* 语言切换：原生 details，无需 JS，键盘可达 */
.mq-lang { position: relative; }
.mq-lang > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--mq-line);
  border-radius: 999px;
  font-size: 14px;
  color: var(--mq-text);
  user-select: none;
  transition: border-color .2s ease, color .2s ease;
}
.mq-lang > summary::-webkit-details-marker { display: none; }
.mq-lang > summary::after {
  content: "";
  width: 6px; height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform .2s ease;
}
.mq-lang[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.mq-lang[open] > summary { border-color: var(--mq-brand); color: var(--mq-brand); }
.mq-lang__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 150px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--mq-line);
  border-radius: 12px;
  box-shadow: var(--mq-shadow);
}
.mq-lang__menu li {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--mq-ink);
  cursor: pointer;
}
.mq-lang__menu li:hover { background: var(--mq-bg-soft); color: var(--mq-brand); }
.mq-lang__menu li.is-active { background: var(--mq-brand-soft); color: var(--mq-brand); font-weight: 600; }

/* 移动端汉堡按钮 */
.mq-header__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px; height: 42px;
  padding: 9px;
  border: none;
  background: transparent;
  cursor: pointer;
}
.mq-header__burger span {
  display: block;
  height: 2px;
  background: var(--mq-ink);
  border-radius: 2px;
  transition: transform .25s ease, opacity .25s ease;
}

/* 主按钮 */
.mq-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--mq-brand);
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .2s ease, box-shadow .2s ease, transform .2s ease;
}
.mq-btn-primary:hover { background: #0F6FE0; box-shadow: 0 8px 20px rgba(24, 128, 255, .35); }

/* ---- 移动端导航面板 ---- */
@media (max-width: 860px) {
  .mq-header__burger { display: flex; }
  .mq-header__nav {
    position: absolute;
    top: var(--mq-header-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: 14px var(--mq-gutter) 22px;
    background: #fff;
    border-bottom: 1px solid var(--mq-line);
    box-shadow: 0 16px 32px rgba(15, 23, 42, .08);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform .2s ease, opacity .2s ease;
  }
  .mq-header.is-open .mq-header__nav {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .mq-header__nav .mq-nav { flex-direction: column; align-items: stretch; gap: 2px; }
  .mq-header__nav .mq-nav a { padding: 12px 14px !important; border-radius: 10px !important; }
  .mq-header.is-open .mq-header__burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .mq-header.is-open .mq-header__burger span:nth-child(2) { opacity: 0; }
  .mq-header.is-open .mq-header__burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ============================================================
 * 首页固定宽度容器 → 响应式流体化（避免常见分辨率横向溢出）
 * 仅作用于 .mq-home 作用域，不影响资讯模块
 * ============================================================ */
.mq-home [class*="w-[1188px]"],
.mq-home [class*="w-[1100px]"],
.mq-home [class*="w-[920px]"] {
  width: 100% !important;
  max-width: var(--mq-maxw);
  margin-inline: auto;
  padding-inline: var(--mq-gutter);
  box-sizing: border-box;
}

/* 大尺寸媒体/卡片 → 流体并保留最大宽度，避免溢出 */
.mq-home [class*="w-[704px]"],
.mq-home [class*="w-[668px]"],
.mq-home [class*="w-[651px]"],
.mq-home [class*="w-[621px]"],
.mq-home [class*="w-[560px]"],
.mq-home [class*="w-[520px]"],
.mq-home [class*="w-[420px]"],
.mq-home [class*="w-[366px]"],
.mq-home [class*="w-[336px]"],
.mq-home [class*="w-[280px]"],
.mq-home [class*="w-[256px]"] {
  width: 100% !important;
  box-sizing: border-box;
}
.mq-home [class*="w-[704px]"] { max-width: 704px; }
.mq-home [class*="w-[668px]"] { max-width: 668px; }
.mq-home [class*="w-[651px]"] { max-width: 651px; }
.mq-home [class*="w-[621px]"] { max-width: 621px; }
.mq-home [class*="w-[560px]"] { max-width: 560px; }
.mq-home [class*="w-[520px]"] { max-width: 520px; }
.mq-home [class*="w-[420px]"] { max-width: 420px; }
.mq-home [class*="w-[366px]"] { max-width: 366px; }
.mq-home [class*="w-[336px]"] { max-width: 336px; }
.mq-home [class*="w-[280px]"] { max-width: 280px; }
.mq-home [class*="w-[256px]"] { max-width: 256px; }

/* 首屏数据统计：允许换行并在小屏均匀分布 */
.mq-home [class*="mt-[42px]"].flex.justify-between { flex-wrap: wrap; justify-content: center; gap: 20px 12px; }
.mq-home [class*="w-[200px]"] { width: 100% !important; max-width: 200px; flex: 1 1 140px; box-sizing: border-box; }

/* 三列网格 → 平板两列、手机单列 */
@media (max-width: 1024px) {
  .mq-home .grid.grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .mq-home .grid.grid-cols-3 { grid-template-columns: minmax(0, 1fr); }
}

/* 特性双栏 → 移动端纵向堆叠 */
@media (max-width: 960px) {
  .mq-home [class*="w-[1188px]"].flex.justify-between {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 28px !important;
  }
}

/* ============================================================
 * 页脚一致性（限定最大宽度，居中对齐）
 * ============================================================ */
.mq-footer__cta-inner,
.mq-footer__cols,
.mq-footer__bottom { max-width: var(--mq-maxw); margin-inline: auto; }

/* ============================================================
 * 通用区块节奏（资讯模块之外的页面统一间距）
 * ============================================================ */
.mq-section { padding-block: 72px; }
@media (max-width: 768px) {
  .mq-section { padding-block: 52px; }
}

/* 移动端巨型标题降级，避免常见分辨率下溢出挤压 */
@media (max-width: 640px) {
  .mq-home [class*="text-[64px]"] { font-size: 32px !important; line-height: 42px !important; }
  .mq-home [class*="text-[56px]"] { font-size: 30px !important; line-height: 40px !important; }
  .mq-home [class*="text-[48px]"] { font-size: 28px !important; line-height: 38px !important; }
  .mq-home [class*="text-[40px]"] { font-size: 26px !important; line-height: 36px !important; }
  .mq-home [class*="text-[32px]"] { font-size: 22px !important; line-height: 30px !important; }
}

/* ============================================================
 * 404 页面（全站统一视觉）
 * - 复用品牌蓝 #1880FF 与渐变（与首页 hero 一致）
 * - 避开 fixed header（高度 = --mq-header-h = 72px）
 * ============================================================ */
.mq-404 {
  width: 100%;
  min-height: calc(100vh - var(--mq-header-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 140px 24px 96px;
  background:
    radial-gradient(1200px 480px at 50% -10%, #E6F1FF 0%, rgba(230, 241, 255, 0) 60%),
    #fff;
}
.mq-404__inner {
  max-width: 640px;
  width: 100%;
  text-align: center;
}
.mq-404__eyebrow {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--mq-brand);
  margin: 0 0 16px;
}
.mq-404__title {
  font-size: 96px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.02em;
  background: linear-gradient(120deg, #35B7FF 0%, #1880FF 55%, #FF73F6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin: 0 0 20px;
}
.mq-404__desc {
  font-size: 17px;
  line-height: 1.75;
  color: var(--mq-text);
  margin: 0 auto 36px;
  max-width: 520px;
}
.mq-404__actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
}
/* 幽灵按钮：与 .mq-btn-primary 视觉对齐 */
.mq-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 22px;
  border-radius: 999px;
  background: #fff;
  color: var(--mq-brand) !important;
  border: 1.5px solid var(--mq-brand);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background .2s ease, box-shadow .2s ease, transform .2s ease;
}
.mq-btn-ghost:hover {
  background: var(--mq-bg-soft);
  box-shadow: 0 8px 20px rgba(24, 128, 255, .18);
}
.mq-404__search {
  max-width: 440px;
  margin: 0 auto;
}
/* WP 默认搜索框贴合品牌 */
.mq-404__search form {
  display: flex;
  gap: 10px;
}
.mq-404__search input[type="search"],
.mq-404__search input[type="text"] {
  flex: 1 1 auto;
  height: 44px;
  padding: 0 18px;
  border: 1px solid var(--mq-line);
  border-radius: 999px;
  font-size: 15px;
  color: var(--mq-ink);
  background: #fff;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.mq-404__search input[type="search"]:focus,
.mq-404__search input[type="text"]:focus {
  border-color: var(--mq-brand);
  box-shadow: 0 0 0 3px rgba(24, 128, 255, .15);
}
.mq-404__search input[type="submit"] {
  flex: 0 0 auto;
  height: 44px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--mq-brand);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease;
}
.mq-404__search input[type="submit"]:hover { background: #0F6FE0; }

@media (max-width: 640px) {
  .mq-404 { padding: 110px 20px 72px; }
  .mq-404__title { font-size: 64px; }
  .mq-404__desc { font-size: 15px; }
  .mq-404__actions { flex-direction: column; }
  .mq-404__actions .mq-btn-primary,
  .mq-404__actions .mq-btn-ghost { width: 100%; }
  .mq-404__search form { flex-direction: column; }
  .mq-404__search input[type="submit"] { width: 100%; }
}
