/* ==========================================================================
   站点顶栏（菜单样式与导航模式参考 new/ 的 ux-header）
   近黑吸顶导航：品牌 + 主导航 + 「更多」下拉(含机房版) + 开始创作 CTA
   + 汉堡切换 + 搜索 dialog。强调色沿用站内琥珀色系，仅作用于
   .site-header / .site-search-dialog，不影响页面其余样式。
   ========================================================================== */

:root { --site-header-h: 68px; --site-accent: #f5c26b; --site-accent-hover: #efb34e; }

/* 顶栏在 .wrapper 内，模板的横向裁剪会让 sticky 失效；横向溢出仍由 body 裁剪兜底 */
body.has-site-header .wrapper { overflow-x: visible; }
html:has(.site-header) { scroll-padding-top: calc(var(--site-header-h) + 14px); }

.site-header {
  height: var(--site-header-h);
  /* 近黑玻璃：底部 #121920 与前版一致，顶部微亮一档增加层次 */
  background: linear-gradient(180deg, #1c2630e6, #121920e6);
  -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  border-bottom: 1px solid #ffffff17;
  position: sticky; top: 0; z-index: 1050;
}
.site-header-inner {
  width: min(1240px, calc(100% - 80px));
  margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 25px; height: 100%;
}

/* 品牌：logo 本身透明底，直接展示，不强加底色衬框（按高度缩放适配矮顶栏） */
.site-header .site-brand {
  display: inline-flex; line-height: 0; flex-shrink: 0;
}
.site-brand img { display: block; width: auto; height: 48px; }
/* logo 旁的平台标识 os.png（Android | HarmonyOS | iOS，浅灰图形透明底）：
   独立链接（发布日志），细线分隔 + 缩一档高度，作低调陪衬不与主标识抢层级。
   注意：页面模板多有全局 border-box，且居中定位会抵消 padding 的空隙——
   这里显式 content-box + 按竖线偏移定位，保证线与图形之间空隙稳定（width 须含偏移量，否则图形右侧被裁）*/
.site-brand-group { display: inline-flex; align-items: center; flex-shrink: 0; }
.site-brand-os {
  align-self: center;
  box-sizing: content-box;
  width: 164px; height: 30px;
  margin-left: 26px;
  border-left: 1px solid #ffffff26;
  background: url('/static/images/os.png') 14px center / 150px 30px no-repeat;
  opacity: .85;
  text-decoration: none;
}
.site-brand-os:hover { opacity: 1; }
.site-header .site-brand-os:focus-visible { outline: 2px solid var(--site-accent); outline-offset: 4px; }

/* 主导航 */
.site-nav { display: flex; align-items: center; gap: 22px; font-size: 13px; }
.site-nav > a {
  color: #c2cdd8; padding: 12px 0;
  text-decoration: none; white-space: nowrap;
}
.site-nav > a:hover { color: #ffffff; }
.site-nav a[aria-current="page"] { color: var(--site-accent); font-weight: 600; }
.site-header :is(a, button, summary):focus-visible { outline: 2px solid var(--site-accent); outline-offset: 4px; }

/* 「更多」下拉 */
.site-nav-more { position: relative; }
.site-nav-more summary {
  list-style: none; cursor: pointer; color: #c2cdd8; padding: 12px 0; white-space: nowrap;
}
.site-nav-more summary::-webkit-details-marker { display: none; }
.site-nav-more summary:hover { color: #ffffff; }
.site-nav-more summary span { padding-left: 5px; color: #93a1ad; }
.site-nav-more[open] summary span { transform: rotate(180deg); display: inline-block; }
.site-nav-more > div {
  position: absolute; top: 42px; right: -20px; width: 210px;
  padding: 9px; background: #1a242ee6;
  border: 1px solid #ffffff1f; border-radius: 9px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 18px 35px #0005;
  display: grid;
}
.site-nav-more > div a {
  font-size: 12px; padding: 8px 13px; border-radius: 5px;
  color: #c0ccd6; text-decoration: none;
}
.site-nav-more > div a:hover { background: #f5c26b14; color: #ffffff; }
.site-nav-more > div a[aria-current="page"] { color: var(--site-accent); font-weight: 600; }
.site-nav-more .site-search-open {
  display: block; width: 100%; text-align: left;
  padding: 9px 13px; margin-top: 2px;
  background: none; border: 0; border-top: 1px solid #ffffff1a;
  color: #cbbfa4; font-size: 12px; cursor: pointer; border-radius: 0;
}
.site-nav-more .site-search-open:hover { color: var(--site-accent); }
/* 原 logo 旁的平台说明，收进下拉作小注 */
.site-nav-more .site-nav-note {
  display: block; padding: 9px 13px 6px; margin-top: 2px;
  border-top: 1px solid #ffffff14;
  font-size: 11px; color: #8b98a4;
}

/* 开始创作 CTA */
.site-header-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 15px;
  min-height: 36px; padding: 9px 14px 7px;
  background: var(--site-accent); color: #283449;
  border-radius: 6px; font-size: 11px; font-weight: 600; line-height: 1;
  text-decoration: none; white-space: nowrap;
  transition: background .2s ease, transform .2s ease;
}
.site-header-cta:hover { background: var(--site-accent-hover); color: #28323f; transform: translateY(-1px); }
.site-header-cta span { color: #283449aa; }

/* 汉堡按钮（仅移动端显示） */
.site-menu-toggle {
  display: none; order: 3;
  flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 34px; height: 34px;
  background: transparent; border: 1px solid #3d4750; border-radius: 5px;
  cursor: pointer; flex-shrink: 0;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.site-menu-toggle span { width: 15px; height: 1px; background: #e8eef4; }
.site-menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
.site-menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

/* 搜索弹窗 */
.site-search-dialog {
  background: #151d25f2; color: #b4bcc9;
  border: 1px solid #ffffff1f; border-radius: 11px;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  width: min(570px, calc(100% - 30px)); max-height: 90dvh;
  padding: 30px; box-shadow: 0 20px 90px #0007;
}
.site-search-dialog::backdrop { background: #050a0899; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.site-dialog-heading {
  display: flex; align-items: center; justify-content: space-between;
  gap: 15px; margin-bottom: 25px;
}
.site-dialog-heading h2 { font-size: 22px; font-weight: 550; margin: 0; color: #f2e9d8; }
.site-search-close {
  width: 33px; height: 33px; font-size: 25px; line-height: 1;
  border: 1px solid #ffffff26; background: #232d36; color: #f5c26b; border-radius: 5px;
  cursor: pointer;
}
.site-search-close:hover { background: #2c3944; }
.site-search-dialog form > label { font-size: 12px; display: block; margin-bottom: 12px; }
.site-search-dialog form > div { display: flex; gap: 10px; }
.site-search-dialog input[type="search"] {
  min-width: 0; flex: 1; font-size: 13px;
  background: #10161d; border: 1px solid #3d4750; color: #e4eaf1;
  border-radius: 6px; padding: 11px 13px;
}
.site-search-dialog input[type="search"]:focus-visible { outline: 2px solid var(--site-accent); outline-offset: 2px; }
.site-search-submit {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 43px; padding: 11px 20px;
  background: var(--site-accent); color: #283449;
  border: 0; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.site-search-submit:hover { background: var(--site-accent-hover); }

/* 平板收窄 */
@media (max-width: 1100px) {
  .site-header-inner { width: calc(100% - 56px); gap: 20px; }
  /* 主导航增至 7 项（离线/机房/教育版升至顶级）：收窄间距与字号防换行 */
  .site-nav { gap: 13px; font-size: 12.5px; }
  .site-brand img { height: 44px; }
  .site-brand-os { width: 141px; height: 26px; margin-left: 14px; background-position: 13px center; background-size: 128px 26px; }
}
@media (max-width: 900px) {
  .site-nav { gap: 15px; font-size: 12px; }
  .site-brand img { height: 40px; }
  .site-brand-os { display: none; }
  .site-header-cta { gap: 8px; padding: 8px 11px; }
}

/* 移动端：汉堡展开主导航为下拉面板（同 new/ 模式） */
@media (max-width: 760px) {
  :root { --site-header-h: 60px; }
  .site-header-inner { width: calc(100% - 36px); gap: 12px; }
  .site-brand img { height: 38px; }
  /* 移动端去掉 CTA 按钮腾出空间，改显平台标识（logo 实宽仅 ~119px，放得下） */
  .site-header-cta { display: none; }
  .site-brand-os {
    display: block; width: 112px; height: 20px; margin-left: 16px;
    background-position: 12px center; background-size: 100px 20px;
  }
  .site-menu-toggle { display: flex; }
  .site-nav {
    display: none;
    position: absolute; left: 0; right: 0; top: calc(var(--site-header-h) - 1px);
    flex-direction: column; align-items: stretch; gap: 0;
    background: #171f27f2;
    border-bottom: 1px solid #ffffff17;
    -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
    padding: 14px 22px;
    max-height: calc(100dvh - var(--site-header-h));
    overflow: auto;
    box-shadow: 0 20px 35px #0007;
  }
  .site-nav.is-open { display: flex; }
  .site-nav > a { padding: 12px 6px; font-size: 14px; }
  .site-nav-more summary { padding: 12px 6px; font-size: 14px; }
  .site-nav-more > div {
    position: static; width: 100%;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    box-shadow: none; background: #1c2530; border-color: #ffffff17;
  }
  .site-nav-more > div a { font-size: 12px; padding: 10px; }
  .site-nav-more .site-search-open { grid-column: 1 / -1; padding: 12px; }
  .site-nav-more .site-nav-note { grid-column: 1 / -1; padding: 10px 13px 4px; }
  .site-search-dialog { padding: 23px; }
  .site-search-dialog form > div { flex-wrap: wrap; }
  .site-search-dialog input[type="search"] { width: 100%; flex-basis: 100%; }
  .site-dialog-heading h2 { font-size: 20px; }
}
@media (max-width: 360px) {
  .site-header-inner { width: calc(100% - 28px); gap: 8px; }
  .site-brand img { height: 30px; }
  .site-brand-os { width: 95px; height: 17px; margin-left: 14px; background-position: 10px center; background-size: 85px 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .site-header-cta { transition: none; }
  .site-menu-toggle span { transition: none; }
}

/* Subtle feedback shared across desktop navigation, mobile menu and search. */
.site-nav > a { position: relative; }
.site-nav > a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 5px; height: 2px;
  border-radius: 2px; background: var(--site-accent); transform: scaleX(0);
  transform-origin: left; transition: transform .22s ease;
}
.site-nav > a[aria-current="page"]::after, .site-nav > a:hover::after { transform: scaleX(1); }
.site-menu-toggle span { transition: transform .22s ease; }
.site-nav-more summary span { display: inline-block; transition: transform .22s ease; }
.site-nav-more[open] > div, .site-search-dialog[open] { animation: site-panel-in .2s ease-out; }
.site-search-dialog { margin: auto; }
.site-search-close { width: 40px; height: 40px; flex-shrink: 0; }
@keyframes site-panel-in { from { opacity: .4; translate: 0 -6px; } to { opacity: 1; translate: 0 0; } }
@media (max-width: 1100px) and (min-width: 901px) { .site-brand-os { display: none; } }
@media (max-width: 760px) {
  .site-menu-toggle { width: 44px; height: 44px; }
  .site-nav.is-open { animation: site-panel-in .2s ease-out; }
  .site-nav > a::after { display: none; }
  .site-nav > a[aria-current="page"] { background: #f5c26b10; border-radius: 6px; padding-left: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .site-nav-more[open] > div, .site-search-dialog[open], .site-nav.is-open { animation: none; }
  .site-nav > a::after, .site-nav-more summary span, .site-menu-toggle span { transition: none; }
}
.site-nav > .site-mobile-start { display: none; }
@media (max-width: 760px) {
  .site-nav > .site-mobile-start {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 12px; padding: 12px 14px; min-height: 44px;
    border-radius: 7px; background: var(--site-accent); color: #263449; font-weight: 600;
  }
}
