@tailwind base;
@tailwind components;
@tailwind utilities;

@layer utilities {
    .content-auto { content-visibility: auto; }
    .card-hover { @apply transition-all duration-300 hover:shadow-lg hover:-translate-y-1; }
}

/* 全站主内容版心（约 1408px 居中列 + 两侧灰底） */
:root {
    /* 品牌三色（深 → 中 → 浅），供非 Tailwind 的 CSS 引用 */
    --color-brand-deep: #0a032e;
    --color-brand-mid: #163268;
    --color-brand-light: #85b1e0;
    --site-layout-max: 88rem;
    --site-layout-gutter: clamp(0.75rem, 2vw, 1.125rem);
    --site-layout-vw: 100%;
    --site-page-bg: #ebebeb;
    --site-page-bg-image: url("../images/site/backgrounds/background.jpeg");
    --site-content-bg: transparent;
    /* 学术顶栏占位：由 header.js / 顶栏内联脚本按实际高度写入；以下为各断点近似值 */
    --site-academic-header-offset: 6.5rem;
    /* 移动端全屏菜单起点：与顶栏同高，运行期由 JS 覆盖 */
    --site-academic-mobile-menu-top: 6.75rem;
}

@media (min-width: 768px) {
    :root {
        --site-academic-header-offset: 11.75rem;
        --site-academic-mobile-menu-top: 12rem;
    }
}

.site-layout-wide {
    width: 100%;
    max-width: min(var(--site-layout-max, 75rem), var(--site-layout-vw, 100%));
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--site-layout-gutter);
    padding-right: var(--site-layout-gutter);
    box-sizing: border-box;
}

/* 模板若仍带 Tailwind px-*，横向与顶栏版心保持一致 */
.site-layout-wide[class*="px-"] {
    padding-left: var(--site-layout-gutter) !important;
    padding-right: var(--site-layout-gutter) !important;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--site-academic-header-offset, 9.75rem);
    min-height: 100%;
    overflow-x: clip;
}

/* 与固定顶栏配合：锚点与「跳到主内容」落点不被遮挡 */
#main-content {
    scroll-margin-top: var(--site-academic-header-offset, 9.75rem);
}

html.news-site-html #main-content {
    scroll-margin-top: var(--news-site-header-offset, 7.75rem);
}

/* 固定顶栏占位：团队简介等首屏内容不被遮挡（与 .site-header 高度协调） */
#intro {
    scroll-margin-top: var(--site-academic-header-offset, 9.75rem);
}

/* 首页「#home」锚点落在合并卡顶部时与顶栏留白一致 */
#home.home-hero-intro-card {
    scroll-margin-top: var(--site-academic-header-offset, 9.75rem);
}

/* 固定顶栏下主内容顶距（与双层顶栏 + 加高主导航条对齐） */
header.site-header.site-header--academic ~ main {
    padding-top: var(--site-academic-header-offset, 9.75rem);
}

.page-index #intro .home-hero-intro-card--nav-flush {
    scroll-margin-top: var(--site-academic-header-offset, 9.75rem);
}

header.site-header:not(.site-header--academic) ~ main {
    padding-top: 6.5rem;
}

/* 版心：居中内容列透明，透出页面背景图；卡片等组件可单独设实底 */
.site-column-sheet {
    background-color: var(--site-content-bg, transparent);
    box-sizing: border-box;
}

body {
  background-color: var(--site-page-bg, #ebebeb);
  background-image: var(--site-page-bg-image);
  background-repeat: no-repeat;
  background-position: center top;
  background-size: cover;
  background-attachment: fixed;
  color: #171717;

  margin: 0;
  min-height: 100vh;
  line-height: 1.8;
  overflow-x: clip;

  padding-bottom: 0;
  font-family: Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (max-width: 767.98px) {
  body {
    background-attachment: scroll;
  }

  .site-layout-wide {
    --site-layout-gutter: clamp(0.85rem, 4vw, 1.1rem);
  }

  header.site-header.site-header--academic ~ main {
    padding-top: var(--site-academic-header-offset, 5.25rem);
  }

  #main-content section {
    overflow-x: clip;
  }
}

/* 顶部导航链接下划线动画 */
.nav-link {
    @apply relative;
}
.nav-link::after {
    content: '';
    @apply absolute bottom-0 left-0 w-0 h-[2px] bg-primary transition-all duration-300;
}
.nav-link:hover::after {
    @apply w-full;
}

/* 按钮波纹效果 */
.btn-primary {
    position: relative;
    overflow: hidden;
}
.btn-primary:after {
    content: "";
    display: block;
    position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	pointer-events: none;
	background-image: radial-gradient(circle, #fff 10%, transparent 10.01%);
	background-repeat: no-repeat;
	background-position: 50%;
	transform: scale(10, 10);
	opacity: 0;
	transition: transform .5s, opacity 1s;
}
.btn-primary:active:after {
	transform: scale(0, 0);
	opacity: .3;
	transition: 0s;
}


/* 首页顶区：科研成果轮播 */
.home-hero-intro-stack {
    position: relative;
    width: 100%;
}

.home-hero-intro-card__media {
    padding: 0;
}

.home-hero-intro-card__media .home-top-card__news {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
}

.home-hero-intro-card__media .home-top-card__news .bilibili-news-carousel {
    position: relative;
    width: 100%;
}

.home-hero-intro-card__media #news-bilibili-viewport {
    border-radius: 0;
    box-shadow: none;
}

@media (min-width: 1024px) {
    .home-hero-intro-stack {
        padding-bottom: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-hero-intro-card__media {
        transition: none;
    }
}
/* 导航下划线 */
nav a {
    position: relative;
    padding-bottom: 4px;
}
nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #163268;
    transition: width 0.3s ease;
}
nav a:hover::after {
    width: 100%;
}

/* 移动端抽屉链接不使用桌面主导航的下划线伪元素 */
.site-header__mobile-link::after {
    display: none !important;
}

/* 文本截断（避免内容溢出） */
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 767.98px) {
    #news .grid {
        gap: 6px;
    }
}

/* 首页学术成果卡片链接：去掉默认下划线 */
.achievement-card-link {
    text-decoration: none;
}

/* 更多新闻按钮样式 */
.more-news-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 0;
    cursor: pointer;
}

.more-news-btn:hover {
    background-color: #0056b3;
}

/* 新闻列表页面样式补充 */
.news-container {
    width: 90%;
    max-width: min(var(--site-layout-max, 100%), var(--site-layout-vw, 100%));
    margin: 20px auto;
}

.news-item {
    border-bottom: 1px solid #eee;
    padding: 15px 0;
}

.news-cover {
    width: 150px;
    height: 100px;
    object-fit: cover;
    margin-right: 15px;
    float: left;
}

.news-title {
    margin: 0 0 8px 0;
    color: #333;
}

.news-time {
    color: #999;
    font-size: 14px;
    margin: 0 0 8px 0;
}

.news-content {
    color: #666;
    line-height: 1.6;
}

/* ========== 通用基础样式（新闻/科研成果共用） ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


/* ========== 统一容器样式（新闻/科研成果共用） ========== */
.container {
    width: 90%;
    max-width: min(var(--site-layout-max, 100%), var(--site-layout-vw, 100%));
    margin: 30px auto;
    padding: 0 20px;
}

/* ========== 统一返回按钮样式（新闻/科研成果共用） ========== */
.back-btn {
    display: inline-block;
    margin-bottom: 20px;
    color: #163268;
    text-decoration: none;
    font-size: 14px;
}
.back-btn:hover {
    color: #0d47a1;
    text-decoration: underline;
}

/* ========== 详情页通用样式（新闻/科研成果共用） ========== */
.detail-card {
    background: white;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 30px;
}
.detail-title {
    font-size: 24px;
    margin-bottom: 15px;
    font-weight: bold;
    font-family: "SimHei", sans-serif;
    color: #111;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}
.detail-meta {
    color: #999;
    font-size: 14px;
    margin-bottom: 20px;
    display: block;
}
.detail-content {
    color: #666;
    line-height: 1.8;
}
.detail-content p {
    margin-bottom: 15px;
}

/* ========== 列表页通用样式（新闻/科研成果共用，可选补充） ========== */
.page-title {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-weight: bold;
    font-family: "SimHei", sans-serif;
    color: #111;
    font-size: 24px;
}
.item-card {
    border-bottom: 1px dashed #ddd;
    padding: 20px 0;
    overflow: hidden;
    background: white;
    border-radius: 0;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}
.item-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
.item-title {
    font-size: 18px;
    margin-bottom: 8px;
    font-weight: bold;
    font-family: "SimHei", "Microsoft YaHei", sans-serif;
    color: #111111;
    text-decoration: none;
}
.item-title a {
    color: #111111;
    text-decoration: none;
}
.item-title a:hover {
    color: #163268;
}
.item-meta {
    color: #999;
    font-size: 14px;
    margin-bottom: 10px;
    display: block;
}
.item-content {
    color: #666;
    margin-bottom: 15px;
    max-width: 100%;
    word-wrap: break-word;
}
.item-more {
    display: inline-block;
    padding: 5px 12px;
    background: #163268;
    color: white;
    text-decoration: none;
    border-radius: 0;
    font-size: 14px;
    transition: all 0.3s ease;
}
.item-more:hover {
    background: #0d47a1;
}
.empty-tip {
    text-align: center;
    padding: 60px 0;
    color: #999;
    font-size: 16px;
}
.empty-tip i {
    font-size: 48px;
    margin-bottom: 20px;
    display: block;
    color: #d1d5db;
}
/* 新闻详情页图片（基础；详情页增强样式见 pages/news-site.css） */
.news-images {
    margin: 20px 0;
    text-align: center;
}
.news-images img {
    max-width: 100%;
    height: auto;
    margin: 10px 0;
    border-radius: 0;
}

/* 新闻详情页专属布局（与 news-site.css 协同） */
.news-detail {
    flex: 1;
    width: 90%;
    max-width: min(var(--site-layout-max, 100%), var(--site-layout-vw, 100%));
    margin: 30px auto;
    padding: 0 20px;
}

/* 新闻详情页元数据（基础） */
.meta {
    color: #999;
    font-size: 14px;
    margin-bottom: 20px;
    text-align: center;
    display: block;
}
/* 首页团队动态轮播：样式见 pages/home-news.css（哔哩哔哩式单屏横幅） */
#news-prev,
#news-next {
    user-select: none;
}

/* 首页团队带头人介绍：微软雅黑 */
#members .teacher-featured {
    font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", sans-serif;
}
