/* 首页置顶 banner 改为内容区域 hero，header 不再承载大图 */
.md-header {
  height: auto;
  background-image: none;
}

/* 首页 hero：作为内容区顶端的背景图块，随页面一起上滚并被内容遮住 */
.home-hero {
  width: 100%;
  height: 200px;
  background-image: url('../assets/images/banner_1.png');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  margin-bottom: 1.5rem;
}

/* 顶部横条：半透明主题色背景延伸至屏幕全宽，确保始终在最上层 */
.md-header {
  z-index: 100 !important;
  position: sticky !important;
}

.md-tabs {
  z-index: 99 !important;
  position: sticky !important;
}

.md-header__inner {
  position: relative;
  background-color: transparent !important;
}

.md-header__inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -50vw;
  width: 100vw;
  height: 100%;
  background-color: rgba(63, 81, 181, 0.82);
  z-index: -1;
}

/* 站点标题 AIplay：稍大字号、加粗 */
.md-header__title {
  font-size: 1.35rem !important;
  font-weight: 700 !important;
}

/* ========== 全宽布局：标题栏、tabs、侧边栏与主内容贴至浏览器左右边缘 ========== */

/* 最外层容器占满宽 */
.md-container {
  max-width: none !important;
  width: 100% !important;
}

/* 主布局网格占满视口宽 */
.md-grid {
  max-width: none !important;
  width: 100% !important;
}

/* 顶部 header 内层（标题 + 搜索）占满宽，内容可贴左右 */
.md-header__inner {
  max-width: none !important;
  width: 100% !important;
  padding-left: 0.8rem !important;
  padding-right: 0.8rem !important;
  box-sizing: border-box !important;
}

/* 顶部 tabs 占满宽（行仍在 header 下方，由主题控制滚动行为） */
.md-tabs {
  width: 100% !important;
}

.md-tabs__inner {
  max-width: none !important;
  width: 100% !important;
  padding-left: 0.8rem !important;
  padding-right: 0.8rem !important;
  box-sizing: border-box !important;
}

/* 主容器与主内容区占满可用宽 */
.md-main {
  max-width: none !important;
  width: 100% !important;
}

.md-main__inner {
  max-width: none !important;
  width: 100% !important;
}

/* 侧边栏与主内容在网格内平分/按比例使用全宽 */
.md-content {
  max-width: none !important;
}

.md-sidebar--primary,
.md-sidebar--secondary {
  max-width: none !important;
}

/* 移动端侧边栏抽屉始终浮于页面内容上层 */
.md-sidebar--primary {
  z-index: 77 !important;
}

/* ========== 首页特殊布局：隐藏侧边栏，卡片内容占满全宽 ========== */

/* 针对首页：通过 .homepage-layout 标识隐藏左右侧边栏 */
body:has(.homepage-layout) .md-sidebar--primary,
body:has(.homepage-layout) .md-sidebar--secondary {
  display: none !important;
}

/* 首页主内容区占满全宽 */
body:has(.homepage-layout) .md-content {
  max-width: 100% !important;
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 1.2rem !important;
  padding-right: 1.2rem !important;
}

/* 首页网格布局调整：让内容区占满全宽（移除侧边栏列） */
body:has(.homepage-layout) .md-grid {
  grid-template-columns: 0 1fr 0 !important;
}

/* ========== Header Refresh: Scheme A / Safer Brand Navigation ========== */

:root {
  --alab-header-start: #3148b0;
  --alab-header-mid: #365ebc;
  --alab-header-end: #2094bd;
  --alab-tabs-bg: rgba(16, 20, 34, 0.96);
  --alab-tabs-border: rgba(255, 255, 255, 0.08);
  --alab-link-muted: rgba(233, 238, 255, 0.68);
  --alab-link-strong: #ffffff;
  --alab-accent: #7dd3fc;
}

.md-header {
  background:
    radial-gradient(circle at top right, rgba(125, 211, 252, 0.14), transparent 24%),
    linear-gradient(90deg, var(--alab-header-start) 0%, var(--alab-header-mid) 55%, var(--alab-header-end) 100%) !important;
  box-shadow: 0 8px 24px rgba(10, 16, 38, 0.2);
}

.md-header__inner {
  background: transparent !important;
}

.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  border-radius: 0.55rem;
  box-shadow: 0 6px 16px rgba(7, 12, 35, 0.24);
}

.md-header__title {
  font-size: 1.36rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em;
}

/* Keep the brand title fixed in the header instead of switching to page titles. */
.md-header__topic + .md-header__topic {
  display: none !important;
}

.md-header__topic:first-child {
  display: block !important;
  visibility: visible !important;
}

.md-tabs {
  background: var(--alab-tabs-bg) !important;
  border-bottom: 1px solid var(--alab-tabs-border);
  box-shadow: 0 10px 24px rgba(4, 8, 24, 0.14);
}

.md-tabs__inner {
  background: transparent !important;
}

.md-tabs__link {
  color: var(--alab-link-muted) !important;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.md-tabs__link:is(:hover, :focus-visible) {
  color: var(--alab-link-strong) !important;
}

.md-tabs__item--active {
  position: relative;
}

.md-tabs__item--active .md-tabs__link {
  color: var(--alab-link-strong) !important;
}

.md-tabs__item--active::after {
  content: "";
  position: absolute;
  left: 0.2rem;
  right: 0.2rem;
  bottom: -0.05rem;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8b9cff, var(--alab-accent));
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.32);
}

.md-search__form {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(17, 25, 61, 0.32) !important;
  backdrop-filter: blur(8px);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.md-search__form:hover,
.md-search__form:focus-within {
  background: rgba(17, 25, 61, 0.5) !important;
  border-color: rgba(125, 211, 252, 0.32);
}

.md-search__input,
.md-search__icon {
  color: rgba(255, 255, 255, 0.95) !important;
}

.md-search__input::placeholder {
  color: rgba(231, 238, 255, 0.68);
}

@media screen and (max-width: 44.9375em) {
  .md-header__title {
    font-size: 1.18rem !important;
  }
}

/* Projects sidebar category cards */
.md-sidebar--primary .md-nav__item--nested {
  margin: 0.45rem 0.15rem;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 0.85rem;
  background:
    radial-gradient(circle at top right, rgba(125, 211, 252, 0.08), transparent 36%),
    rgba(15, 23, 42, 0.38);
  overflow: hidden;
}

.md-sidebar--primary .md-nav__item--nested > .md-nav__link {
  min-height: auto;
  padding: 0.62rem 0.75rem;
  font-weight: 800;
  color: rgba(248, 250, 252, 0.96) !important;
}

.md-sidebar--primary .md-nav__item--nested > .md-nav__link .md-nav__icon {
  margin-left: auto;
}

.md-sidebar--primary .md-nav__item--nested > .md-nav {
  padding: 0 0.5rem 0.55rem;
}

.md-sidebar--primary .md-nav__item--nested .md-nav__item {
  margin: 0.12rem 0;
}

.md-sidebar--primary .md-nav__item--nested .md-nav__item .md-nav__link {
  border-radius: 0.55rem;
  padding: 0.32rem 0.45rem;
}

.md-sidebar--primary .md-nav__item--nested .md-nav__item .md-nav__link:hover {
  background: rgba(125, 211, 252, 0.09);
}

[data-md-color-scheme="default"] .md-sidebar--primary .md-nav__item--nested {
  border-color: rgba(79, 70, 229, 0.16);
  background:
    radial-gradient(circle at top right, rgba(79, 70, 229, 0.06), transparent 36%),
    rgba(248, 250, 252, 0.92);
}

[data-md-color-scheme="default"] .md-sidebar--primary .md-nav__item--nested > .md-nav__link {
  color: #0f172a !important;
}

[data-md-color-scheme="default"] .md-sidebar--primary .md-nav__item--nested .md-nav__item .md-nav__link:hover {
  background: rgba(79, 70, 229, 0.08);
}
