/* ============================================
   顶部导航（header 区域样式）
   参考 public/v2/assets/style.css 的 .site-header 结构，
   覆盖 css.css 中旧的 .top / .topmenu / .topsearch 样式。
   ============================================ */
:root{
  --red:     #990000;
  --red-nav: #A62721;
  --ink:     #333333;
  --sans:  "Noto Sans SC","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
}

.site-header,
.site-header *{ box-sizing:border-box; }

/* ---------- 顶部导航 ---------- */
.site-header{
  position:relative;
  z-index:100;
  height:178px;
  background:#F7F3EA url(../images/topbg.jpg) center top / 100% 100% no-repeat;
  font-family:var(--sans);
  -webkit-font-smoothing:antialiased;
}
.header-inner{ position:relative; max-width:1440px; height:178px; margin:0 auto; }
.header-logo{ position:absolute; left:72px; top:60px; width:286px; height:80px; }
.header-logo img{ width:100%; height:100%; object-fit:contain; }

.main-nav{
  position:absolute; left:470px; top:66px;
  display:flex; align-items:center; gap:24px; height:40px;
  white-space:nowrap;
  transition:gap .34s cubic-bezier(.4,0,.2,1), transform .34s cubic-bezier(.4,0,.2,1);
}
/* 搜索展开时，导航自动收紧并让出位置，避免被输入框压住 */
.site-header.search-open .main-nav{ gap:12px; transform:translateX(-47px); }
.main-nav a{
  font-size:17px; font-weight:700; color:var(--red-nav);
  padding:8px; border-radius:5px; line-height:1;
  transition:background .2s,color .2s;
}
.main-nav a:hover{ color:#7d1c18; }
.main-nav a.active{ background:var(--red-nav); color:#FFFFFF; }

/* 搜索：默认收起为圆形图标按钮，点击向左展开输入框 */
.header-search{
  position:absolute; right:76px; top:66px;
  width:40px; height:40px;
  background:#FFFFFF; border-radius:20px;
  box-shadow:0 2px 8px rgba(153,26,26,.15);
  overflow:hidden;
  transition:width .34s cubic-bezier(.4,0,.2,1), box-shadow .25s;
}
.header-search:hover{ box-shadow:0 4px 14px rgba(153,26,26,.22); }
.header-search.open{ width:212px; box-shadow:0 4px 16px rgba(153,26,26,.2); }

.header-search input{
  position:absolute; left:18px; right:44px; top:0; height:40px; width:auto;
  border:none; outline:none; background:transparent;
  font-size:13px; font-family:var(--sans); color:var(--ink);
  opacity:0; visibility:hidden;
  transition:opacity .18s ease;
}
.header-search.open input{
  opacity:1; visibility:visible;
  transition:opacity .22s ease .12s;
}
.header-search input::placeholder{ color:#BBBBBB; }

.search-toggle{
  position:absolute; right:0; top:0;
  width:40px; height:40px; padding:0;
  display:flex; align-items:center; justify-content:center;
  border:none; background:transparent; border-radius:20px; cursor:pointer;
}
.search-toggle svg{ display:block; }
.search-toggle:focus-visible{ outline:2px solid var(--red-nav); outline-offset:-2px; }
.header-search:not(.open) .search-toggle:hover svg circle,
.header-search:not(.open) .search-toggle:hover svg path{ stroke:#7d1c18; }

/* 窄屏导航按钮（桌面隐藏） */
.nav-toggle{ display:none; }

/* ---------- 红色压边 ---------- */
.red-strip{ height:4px; background:var(--red); }

/* ============================================================
   响应式适配：桌面原样保留，窄屏逐级收缩
   ============================================================ */

/* ---------- 笔记本 / 中小桌面 ---------- */
@media (max-width:1439px) and (min-width:1024px){
  .header-logo{ left:36px; top:66px; width:240px; height:68px; }
  .main-nav{ left:296px; gap:10px; }
  .main-nav a{ font-size:14px; padding:6px; }
  .site-header.search-open .main-nav{ gap:6px; transform:translateX(-24px); }
  .header-search{ right:32px; }
}

/* ---------- 平板：导航改汉堡菜单 ---------- */
@media (max-width:1023px){
  .site-header,.header-inner{ height:104px; }
  .site-header{ --search-open-w:212px; }
  .header-logo{ left:24px; top:22px; width:220px; height:62px; transition:opacity .25s ease; }
  .header-search{ right:24px; top:32px; }
  .header-search.open{ width:var(--search-open-w); }
  .nav-toggle{
    position:absolute; right:74px; top:32px;
    display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px;
    width:40px; height:40px; padding:9px 8px;
    border:1px solid rgba(166,39,33,.25); background:rgba(255,255,255,.9);
    border-radius:6px; cursor:pointer;
    transition:right .34s cubic-bezier(.4,0,.2,1);
  }
  /* 搜索展开时，菜单按钮让到搜索框左侧，保持一个固定间隙 */
  .site-header.search-open .nav-toggle{ right:calc(24px + var(--search-open-w) + 12px); }
  .nav-toggle span{
    display:block; width:100%; height:2px; background:var(--red-nav);
    border-radius:1px; transition:transform .25s ease,opacity .2s ease;
  }
  .site-header.nav-open .nav-toggle span:nth-child(1){ transform:translateY(7px) rotate(45deg); }
  .site-header.nav-open .nav-toggle span:nth-child(2){ opacity:0; }
  .site-header.nav-open .nav-toggle span:nth-child(3){ transform:translateY(-7px) rotate(-45deg); }
  .main-nav{
    position:absolute; top:100%; left:0; right:0; height:auto;
    display:none; flex-direction:column; align-items:stretch; gap:0;
    white-space:normal; z-index:30;
    padding:6px 24px 12px;
    background:#FDFAF4; border-top:1px solid rgba(166,39,33,.2);
    box-shadow:0 12px 24px rgba(51,51,51,.16);
  }
  .site-header.nav-open .main-nav{ display:flex; }
  .site-header.search-open .main-nav{ gap:0; transform:none; }
  .main-nav a{
    font-size:15px; padding:12px 8px; border-radius:0;
    border-bottom:1px solid #EADFD8;
  }
  .main-nav a:last-child{ border-bottom:none; }
  .main-nav a.active{ border-radius:4px; }
}

/* ---------- 手机 ---------- */
@media (max-width:767px){
  .site-header,.header-inner{ height:92px; }
  .site-header{ --search-open-w:min(170px, calc(100vw - 190px)); }
  .header-logo{ left:16px; top:20px; width:176px; height:50px; }
  .header-search{ right:16px; top:26px; }
  .header-search.open{ width:var(--search-open-w); }
  .nav-toggle{ right:64px; top:26px; width:36px; height:36px; padding:8px 7px; }
  .site-header.search-open .nav-toggle{ right:calc(16px + var(--search-open-w) + 10px); }
  .main-nav{ padding:4px 16px 10px; }
}

/* ---------- 超小屏 ---------- */
@media (max-width:400px){
  .header-logo{ width:150px; height:42px; top:24px; }
  /* 超小屏搜索展开时空间不足，暂时让 logo 淡出，避免与菜单按钮重叠 */
  .site-header.search-open .header-logo{ opacity:0; pointer-events:none; }
  .nav-toggle{ right:60px; }
}
