/*
 * 首页专属样式（hero 轮播 / 公告条 / 学院网格）。
 * 只在 index.html 加载；通用组件一律放 system.css。
 */

/* 首页栏目通过字号与留白区分层级。 */
.page--home .section__title {
    font-size: var(--text-2xl);
}

.home-section-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-3);
}

.home-section-heading__note {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

/* --- 公告条 ------------------------------------------------------------- */

.announcement-bar {
    background: var(--color-surface);
}

.announcement {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    color: var(--color-text-secondary);
    font-size: var(--text-md);
}

.announcement__main {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.announcement__title {
    color: var(--color-text);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
}

.announcement__content {
    overflow: hidden;
    color: inherit;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}

.announcement__content:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.announcement__aside {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: var(--space-3);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
}

.announcement__dismiss {
    border: 0;
    background: none;
    color: inherit;
    opacity: 0.75;
    cursor: pointer;
}

.announcement__dismiss:hover {
    opacity: 1;
}

/* --- Hero 轮播 ---------------------------------------------------------- */

.home-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 13rem;
    /* 底部多留两档，给轮播指示点让位，避免与搜索框视觉重叠 */
    padding: var(--space-8) var(--space-4) var(--space-16);
    overflow: hidden;
    background-color: var(--color-hero-bg);
}

.carousel-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.carousel-slide {
    position: absolute;
    inset: 0;
    z-index: 1;
    background-position: center;
    background-size: cover;
    opacity: 0;
    visibility: hidden;
    transition: opacity 800ms ease-in, visibility 0s linear 800ms;
}

.carousel-slide.active {
    z-index: 2;
    opacity: 1;
    visibility: visible;
    transition: opacity 800ms ease-out, visibility 0s linear;
}

/*
 * 压暗 + 底部加深的渐变，保证标题与搜索框在任何底图上都达到对比度要求。
 */
.carousel-slide::before {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(15, 19, 24, 0.36) 0%,
        rgba(15, 19, 24, 0.48) 55%,
        rgba(15, 19, 24, 0.66) 100%
    );
    content: "";
}

.carousel-btn {
    position: absolute;
    top: 50%;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.22);
    color: var(--color-text-inverse);
    cursor: pointer;
    transform: translateY(-50%);
    transition: var(--transition-colors);
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.75);
    color: var(--color-text-on-light);
}

.carousel-btn-prev {
    left: var(--space-6);
}

.carousel-btn-next {
    right: var(--space-6);
}

.carousel-indicators {
    position: absolute;
    bottom: var(--space-2);
    left: 50%;
    z-index: 20;
    display: flex;
    gap: var(--space-2);
    align-items: center;
    /* 内边距扩大整块热区，便于触控操作 */
    padding: var(--space-2) var(--space-3);
    transform: translateX(-50%);
}

.carousel-indicator {
    width: 0.5rem;
    height: 0.5rem;
    padding: 0;
    border: 0;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background-color var(--duration-base) var(--ease-out),
        transform var(--duration-base) var(--ease-out);
}

.carousel-indicator.active {
    background: var(--color-text-inverse);
    transform: scale(1.3);
}

/* 轮播暂停按钮：WCAG 2.2.2 要求自动播放内容可停止 */
.carousel-pause {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    margin-left: var(--space-2);
    padding: 0;
    border: 0;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.28);
    color: var(--color-text-inverse);
    font-size: var(--text-2xs);
    cursor: pointer;
    transition: var(--transition-colors);
}

.carousel-pause:hover {
    background: rgba(255, 255, 255, 0.75);
    color: var(--color-text-on-light);
}

.home-hero__content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 44rem;
    text-align: center;
}

.home-hero__feature {
    display: flex;
    min-height: 6rem;
    margin: 0 auto var(--space-8);
    align-items: center;
    justify-content: center;
}

.home-hero__site-name {
    margin: 0;
    color: rgba(255, 255, 255, 0.96);
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    letter-spacing: 0;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.home-hero__search {
    display: flex;
    align-items: stretch;
    overflow: hidden;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.home-hero__search input {
    flex: 1 1 auto;
    min-width: 0;
    padding: var(--space-4) var(--space-5);
    border: 0;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--text-base);
}

.home-hero__search input:focus {
    outline: none;
}

.home-hero__search:focus-within {
    box-shadow: var(--shadow-lg), 0 0 0 3px rgba(255, 255, 255, 0.55);
}

.home-hero__search button {
    flex-shrink: 0;
    padding: 0 var(--space-6);
    border: 0;
    background: var(--color-btn-primary-bg);
    color: var(--color-text-inverse);
    font-size: var(--text-base);
    cursor: pointer;
    transition: var(--transition-colors);
}

.home-hero__search button:hover {
    background: var(--color-btn-primary-hover);
}

/* 学期提示：跟在搜索框下方的一行安静文字（未配置学期时不渲染） */
/* 开学周数：半透明深底的胶囊，周数用大字，一眼能看到 */
.home-hero__semester,
.home-hero__guide {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-5) 0 0;
    padding: var(--space-2) var(--space-5);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.45);
    color: rgba(255, 255, 255, 0.92);
    font-size: var(--text-md);
    font-variant-numeric: tabular-nums;
    backdrop-filter: blur(6px);
}

/* 搜索框下面的一排胶囊：使用说明 + 学期 */
.home-hero__pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

.home-hero__pills .home-hero__semester,
.home-hero__pills .home-hero__guide {
    margin: 0;
}

.home-hero__guide {
    font-weight: var(--weight-semibold);
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease-standard);
}

.home-hero__guide:hover {
    background: rgba(0, 0, 0, 0.6);
}

.home-hero__semester i {
    opacity: 0.8;
}

.home-hero__semester-name {
    color: rgba(255, 255, 255, 0.78);
}

.home-hero__week {
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    line-height: 1;
}

.home-hero__credit {
    padding: var(--space-2) var(--space-4);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    text-align: right;
}

.home-hero__credit a {
    color: inherit;
}

/* --- 资料卡片网格 -------------------------------------------------------- */

/* 热门资料保留表头分隔，正文行使用更轻的分隔色。 */
#popular-materials .data-table tbody tr:not(:last-child) td {
    border-bottom-color: var(--color-surface-sunken);
}

#popular-materials .file-cell__body > .link-title {
    font-size: var(--text-base);
}

#popular-materials .file-cell__icon {
    color: var(--color-text-muted);
}

#popular-materials .user-cell {
    color: var(--color-text-secondary);
}

#popular-materials .user-cell:hover,
#popular-materials .user-cell:focus-visible {
    color: var(--color-accent);
}

#popular-materials .data-table__actions {
    gap: var(--space-1);
}

#popular-materials .table-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--control-h-sm);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
}

/* “查看”“下载”是同级的文字操作：按钮与链接同一外观 */
#popular-materials .table-link:hover,
#popular-materials .table-link:focus-visible {
    background: var(--color-surface-sunken);
    color: var(--color-accent);
}

/* --- 我的课程：左课程卡片，右课程求助 -------------------------------------- */

.home-request-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
}

.home-columns {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: var(--space-8);
    align-items: start;
}

.home-course-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
}

.home-course {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
    padding: var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    color: var(--color-text);
    text-decoration: none;
    transition: var(--transition-colors), var(--transition-lift);
}

.home-course:hover {
    border-color: var(--color-border-emphasis);
    box-shadow: var(--shadow-sm);
    transform: translateY(var(--motion-lift));
}

.home-course__name {
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
}

.home-course__meta {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.home-course__head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.home-course__stats {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
    margin-top: var(--space-2);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

.home-course__time {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    white-space: nowrap;
}

/* ==========================================================================
   从 system.css 迁入：仅本页使用的块
   ========================================================================== */

.home-hero :focus-visible {
    outline-color: var(--focus-ring-color-inverse) !important;
}
