/* Shared sspai-style site header — used by Spotlight and reading layouts. */

:root {
  --header-h: 57px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid #ECECEC;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
.site-header .header-inner {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 40px;
  max-width: 1280px;
  margin: 0 auto;
}
.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  color: inherit;
  text-decoration: none;
}
.site-header .mark {
  width: 28px;
  height: 28px;
  display: block;
  flex: 0 0 28px;
}
.site-header .wordmark {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #000;
  line-height: 1;
}

.site-header .nav {
  display: flex;
  align-items: center;
  gap: 32px;
}
.site-header .nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 400;
  color: #6F7174;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  background: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transition: color 150ms ease;
}
.site-header .nav a svg { width: 16px; height: 16px; flex: 0 0 16px; }
.site-header .nav a.is-active,
.site-header .nav a.is-on,
.site-header .nav a:hover { color: #000; }
.site-header .nav a.is-active,
.site-header .nav a.is-on { font-weight: 500; }

.site-header .header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 18px;
}
.site-header .icon-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #4a4c4f;
  border-radius: 50%;
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  cursor: pointer;
  transition: color 150ms ease;
}
.site-header .icon-btn svg { width: 20px; height: 20px; }
.site-header .icon-btn:hover { color: #000; }
.site-header .avatar-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #D0D0D0;
  display: grid;
  place-items: center;
  color: #8a8c8f;
  background: #fff;
}
.site-header .avatar-btn svg { width: 16px; height: 16px; }

.site-header .header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid #D0D0D0;
  display: block;
  background: #fff;
  box-shadow: none;
  padding: 0;
}
.site-header .header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.site-header .menu-btn {
  display: none;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #ECECEC;
  font-size: 13px;
  font-weight: 500;
  color: #6F7174;
  background: #fff;
  box-shadow: none;
  cursor: pointer;
  transition: color 150ms ease;
}
.site-header .menu-btn:hover { color: #000; }
.site-header .mode-btn { position: relative; }
.site-header .mode-btn .i-moon { display: none; }
.site-header .mode-btn svg { width: 18px; height: 18px; }

.menu-layer {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.4rem 1rem;
  backdrop-filter: none;
}
.menu-layer[hidden] { display: none; }
.menu-layer .menu-card {
  width: min(22rem, 100%);
  background: #fff;
  border: 1px solid #ECECEC;
  border-radius: 12px;
  padding: 14px 16px 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}
.menu-layer .menu-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #6F7174;
  font-size: 13px;
  font-weight: 400;
  margin-bottom: 4px;
}
.menu-layer .menu-x {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #6F7174;
  background: none;
  border: 0;
  cursor: pointer;
}
.menu-layer .menu-x:hover { color: #000; background: #F7F8F9; }
.menu-layer .menu-x svg { width: 16px; height: 16px; }
.menu-layer .menu-list { display: grid; }
.menu-layer .menu-list a {
  padding: 10px 2px;
  font-size: 15px;
  font-weight: 600;
  border-top: 1px solid #ECECEC;
  color: #000;
  text-decoration: none;
  background: none;
  border-radius: 0;
}
.menu-layer .menu-list a:first-child { border-top: 0; }
.menu-layer .menu-list a.is-on,
.menu-layer .menu-list a.is-active { color: #0F88EB; }

html.night .site-header {
  background: #111;
  border-bottom-color: #2a2a2a;
}
html.night .site-header .wordmark,
html.night .site-header .nav a.is-active,
html.night .site-header .nav a.is-on,
html.night .site-header .nav a:hover,
html.night .site-header .icon-btn:hover { color: #e5e5e5; }
html.night .site-header .nav a,
html.night .site-header .icon-btn { color: #a1a1aa; }
html.night .site-header .menu-btn {
  background: #1a1a1a;
  border-color: #2a2a2a;
  color: #a1a1aa;
}
html.night .site-header .header-avatar {
  background: #1a1a1a;
  border-color: #2a2a2a;
}
html.night .site-header .mode-btn .i-sun { display: none; }
html.night .site-header .mode-btn .i-moon { display: block; }
html.night .menu-layer .menu-card {
  background: #1a1a1a;
  border-color: #2a2a2a;
}
html.night .menu-layer .menu-list a {
  color: #e5e5e5;
  border-top-color: #2a2a2a;
}
html.night .menu-layer .menu-x:hover { background: #222; color: #e5e5e5; }

@media (max-width: 1020px) {
  .site-header .header-inner { padding: 0 16px; }
  .site-header .nav { gap: 18px; }
}

@media (max-width: 860px) {
  .site-header .nav { display: none; }
  .site-header .menu-btn { display: inline-flex; }
  .site-header .header-inner {
    grid-template-columns: 1fr auto;
    padding: 0 12px;
  }
  .site-header .header-actions { gap: 8px; }
  .site-header .wordmark {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header .nav a,
  .site-header .icon-btn,
  .site-header .menu-btn {
    transition: none !important;
  }
}
