html {
    --more-button-height: 40px;
    --more-button-width: 400px;
    --more-button-init-width: 40px;
    --card-background-color: rgba(68, 150, 239, 0.5);
    --web-title-background-color: rgba(26, 109, 197, 0.5);
    background-color: #000000;
}

body {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* 隐藏滚动条 */
::-webkit-scrollbar {
    display: none;
}

* {
    scrollbar-width: none;
}

.background-star-canvas {
    position: fixed;
    left: 0;
    top: 0;
    z-index: -1;
}

.web-title {
    font-size: 25px;
    font-weight: 600;
    color: #ffffff;
    background: var(--web-title-background-color);
    text-align: center;
    max-width: 70%;
    margin: 20px auto 50px auto;
    padding: 5px;
    border-radius: 99999px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.main-container {
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    width: fit-content;
    flex: 1;
}

.center-card {
    display: block;
    margin: 0 auto;
    width: 100%;
    padding: 15px;
    margin-bottom: 60px;
    background: var(--card-background-color);
    border-radius: 20px;
    text-align: center;
    width: fit-content;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 每 3 个项目为一行 */
    gap: 10px;
    width: 100%;
    margin-top: 24px;
}

/* 预留网格占位：固定宽度 500px（三列均分列宽 160px，覆盖当前最宽项目卡片内容
   ~158px 不换行）；纵向 min-height 设为 85px（单行卡片实测高度），空态与生产单行
   项目布局完全一致避免偏移；初始隐藏，待项目加载完成后淡入。
   注意：若项目数增至两行以上，加载后网格自然从 85px 撑高至 ~180px，"联系我们"
   卡片会随之下移——这是用户知情选择的权衡（生产 3 项目一行，180px 会留下大片
   空白，故下调至 85px）。 */
#projects-grid {
    width: 500px;
    min-height: 85px;
    opacity: 0;
    transition: opacity 600ms ease;
}

/* 项目填充完成后由 loadProjects.js 添加 loaded 类触发淡入 */
#projects-grid.loaded {
    opacity: 1;
}

.grid-item,
button.grid-item {
    background: rgba(89, 178, 246, 0.2);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    min-width: 130px;
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-size: inherit;
    color: white;
    transition: background-color 0.3s ease;
}

/* 同时覆盖 <a class="grid-item">：友链渲染为 <a>，基类规则（background/padding/cursor
   等）已通过 .grid-item 选择器覆盖，悬停保持视觉一致 */
.grid-item:hover {
    background: rgba(89, 178, 246, 0.4);
}

.card-text {
    color: white;
    font-weight: normal;
    margin: 0px;
}

h1.card-text {
    font-size: 30px;
}

a.card-text {
    font-size: 16px;
}

.beian-box {
    /* position: relative; */
    width: 100%;
    margin-left: calc(50% - 50vw);
    /* 防止与边缘之间出现空隙 */
    margin-right: calc(50% - 50vw);
    padding-left: calc(50% - 50vw);
    padding-right: calc(50% - 50vw);
    background-color: rgba(46, 46, 46, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 0;
}

.beian-text {
    font-family: Arial, Helvetica, sans-serif;
    margin-left: 20px;
    font-size: 13px;
    color: #ababab;
    text-decoration: none;
    font-weight: normal;
}

.footer {
    position: relative; /* 作为 commit-hash 叠放的定位基准 */
}

/* === 友链 === */
/* 友链 grid 由 loadFriendLinks.js 从 /api/getFriendLinks 动态填充。
   复用 #projects-grid 的占位策略：固定 width:500px（三列均分列宽 ≈160px，覆盖当前最宽
   卡片 ≈158px 不换行）+ min-height:85px（单行卡片实测高度）+ opacity:0 + 0.6s 过渡。
   加载前先撑开与「我的作品」完全一致的空间，避免 fetch 返回后友链撑开区域把下方内容
   推下产生 CLS（布局偏移）；加载完成后由 JS 加 .loaded 触发淡入。
   三种终态行为：
   - 加载中（无 .loaded）：占位（width + min-height + opacity 0），无布局偏移；
   - 加载完成 N>0 条（非空 + .loaded）：填充并淡入显示；
   - 加载完成 0 条（空 + .loaded）：见下方 .friend-links-grid.loaded:empty 收起。
   JS 加载失败时由 catch 分支兜底 add('loaded')，与 0 条空态同等处理。 */
.friend-links-grid {
    width: 500px;
    min-height: 85px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

/* 友链渲染为 <a class="grid-item">，覆盖 UA 默认下划线（含 :hover/:visited） */
.friend-links-grid .grid-item {
    text-decoration: none;
}

/* 仅在加载完成后才允许空 grid 退出布局：避免未加载时 grid 占位消失把下方「提示文本」
   提前拉近到标题下方产生偏移；收起后标题→提示文本间距恢复为 24px（避免 .grid 自带
   margin-top:24px 与提示文本 margin-top:24px 叠加为 48px），与「我的作品」标题→卡片间距一致。
   必须带 .loaded 前缀，否则加载前空 grid 会被立即隐藏导致占位失效。 */
.friend-links-grid.loaded:empty {
    display: none;
}

/* 友链填充完成后由 loadFriendLinks.js 添加 loaded 类触发淡入 */
.friend-links-grid.loaded {
    opacity: 1;
}

.friend-link-hint {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 24px;
}

.contact-emails {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.email-link {
    color: #ffffff;
    font-size: 15px;
    text-decoration: none;
    padding: 8px 20px;
    background: rgba(89, 178, 246, 0.3);
    border-radius: 25px;
    transition: background-color 0.3s ease;
}

.email-link:hover {
    background: rgba(89, 178, 246, 0.6);
}

/* commit hash 仅供开发调试：刻意保持低对比度（用户决策，无需可访问性）；
   绝对定位于备案区域（footer）左下角，与备案文字重叠不占行，随文档滚动 */
.commit-hash {
    position: absolute;
    left: 10px;
    bottom: 10px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #ababab;
    opacity: 0.4;
    cursor: default;
    user-select: text;
}
