/* css/layout.css 页面布局：从 style.css 迁移的导航与首页布局规则。 */

/* ==========================================================================
   1. 顶部品牌区
   ========================================================================== */

.hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand,
.brand-link {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-link {
    text-decoration: none;
    color: inherit;
}

.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: block;
    object-fit: contain;
}

.brand-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.brand-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.top-user-menu__trigger:focus-visible,
.top-user-menu__item:focus-visible,
.top-bar-icon-link:focus-visible {
    outline: 2px solid rgba(200, 29, 37, 0.55);
    outline-offset: 2px;
}

/* ==========================================================================
   2. 首页/分类页网格布局
   ========================================================================== */

.container {
    max-width: 1200px;
    margin: 36px auto 48px;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
}

.container.portal {
    display: block;
}

/* ==========================================================================
   3. 首页 Hero
   ========================================================================== */

.portal-home-hero {
    margin-bottom: var(--portal-home-hero-margin-bottom, 28px);
    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
    background: linear-gradient(130deg, color-mix(in srgb, var(--accent) 12%, #fff) 0%, #fff 70%);
    border-radius: 16px;
    padding: var(--portal-home-hero-padding, 24px 24px 20px);
    box-shadow: var(--shadow-sm);
}

.portal-home-hero__eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.portal-home-hero h2 {
    margin: 0;
    font-size: clamp(1.3rem, 2.4vw, 2rem);
    line-height: 1.35;
}

.portal-home-hero__desc {
    margin: 10px 0 14px;
    color: var(--muted);
    max-width: 780px;
}

.portal-home-hero__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.portal-home-hero__chips span {
    border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
    background: #fff;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.84rem;
    color: #334155;
}

/* ==========================================================================
   4. Portal 首页主体布局
   ========================================================================== */

.portal-layout {
    display: grid;
    grid-template-columns: var(--portal-layout-columns, minmax(0, 2fr) minmax(0, 1fr));
    gap: var(--portal-layout-gap, 32px);
    align-items: start;
}

.portal-main,
.portal-sidebar {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.portal-section {
    margin-bottom: 40px;
}

.portal-sidebar .portal-section {
    margin-bottom: 0;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 16px;
    background: #fafafa;
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.section-header h2 {
    margin: 0;
    font-size: 1.5rem;
    letter-spacing: 0.4px;
}

.section-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.portal-sidebar .section-header {
    margin-bottom: 12px;
    align-items: baseline;
}

.portal-sidebar .section-header h2 {
    font-size: 16px;
    color: #333;
}

.portal-sidebar .section-meta {
    font-size: 12px;
    color: #999;
}

/* ==========================================================================
   5. Portal 卡片网格
   ========================================================================== */

.portal-grid {
    display: grid;
    gap: 24px;
}

.portal-top-grid {
    grid-template-columns: var(--portal-top-grid-columns, repeat(3, minmax(0, 1fr)));
}

.portal-secondary-grid,
.portal-hot-grid,
.portal-latest-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.portal-latest-grid {
    grid-template-columns: 1fr;
    gap: 18px;
}

.portal-card {
    min-width: 0;
}

.portal-card .card-thumb,
.portal-card .thumb {
    border-bottom: 1px solid var(--border);
}

.portal-card .card-content {
    padding: 18px;
}

.portal-card .meta {
    padding: 10px 18px;
    font-size: 0.82rem;
}

.portal-card.card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

.portal-top-grid .portal-card--compact,
.portal-top-grid .portal-card--hero {
    grid-column: span 2;
}

.portal-top-grid .portal-card--hero {
    grid-column: var(--portal-top-grid-hero-span, span 2);
}

.portal-card--hero .card-content h3 {
    font-size: 1.5rem;
}

.portal-card--compact .card-content {
    padding: 16px;
}

.portal-card--compact .card-content h3 {
    font-size: 1rem;
    line-height: 1.45;
}

.portal-card--compact .meta {
    padding: 10px 16px;
}

.portal-sidebar .portal-top-grid {
    grid-template-columns: 1fr;
}

.portal-sidebar .portal-top-grid .portal-card--compact,
.portal-sidebar .portal-top-grid .portal-card--hero {
    grid-column: auto;
}

/* ==========================================================================
   6. 首页右侧栏列表兜底样式
   ========================================================================== */

.portal-sidebar .sidebar-list li {
    gap: 4px;
    padding: 12px 0;
}

.portal-sidebar .sidebar-list a {
    line-height: 1.55;
}

.portal-sidebar .sidebar-list .meta {
    font-size: 12px;
    color: #94a3b8;
}

.portal-sidebar .sidebar-list .empty {
    font-size: 0.92rem;
    color: #94a3b8;
}

.portal .pagination {
    grid-column: auto;
    margin-top: 10px;
}

/* ==========================================================================
   7. 空状态
   ========================================================================== */

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 28px;
    color: #94a3b8;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 12px;
}

/* ==========================================================================
   8. 页面容器
   ========================================================================== */

.site-page {
    padding: 32px 0 56px;
    background: linear-gradient(180deg, rgba(244, 247, 251, 0.88), rgba(255, 255, 255, 0.98));
}

.site-page__hero {
    padding: var(--site-page-hero-padding, 28px);
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(55, 99, 244, 0.08), rgba(74, 144, 226, 0.04));
    border: 1px solid rgba(55, 99, 244, 0.12);
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
}

.site-page__content {
    display: grid;
    gap: 18px;
}

.site-page__section {
    padding: var(--site-page-section-padding, 24px 26px);
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   9. tag.php / 列表页
   ========================================================================== */

.tag-container {
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 20px;
}

.tag-header {
    border-bottom: 2px solid var(--accent);
    padding-bottom: 15px;
    margin-bottom: 30px;
}

.news-item {
    display: flex;
    align-items: flex-start;
    gap: clamp(14px, 2vw, 20px);
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.news-item .thumb {
    width: 200px;
    aspect-ratio: 20 / 13;
    overflow: hidden;
    border-radius: 8px;
    flex-shrink: 0;
}

.news-item .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-item .info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.news-item h3 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.4;
}

.news-item h3 a {
    color: var(--primary);
    text-decoration: none;
}

.news-item h3 a:hover {
    color: var(--accent);
}

.tag-list-meta {
    font-size: 13px;
    color: #999;
    margin-top: 10px;
}

.tag-list-meta__author {
    margin-left: 15px;
}

.tag-empty-tip {
    text-align: center;
    padding: 100px 0;
    color: #bbb;
}

.tag-empty-tip__link {
    color: #e74c3c;
    text-decoration: underline;
}

/* ==========================================================================
   10. 全站横向溢出兜底
   ========================================================================== */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body,
header,
main,
footer,
.top-bar,
.hero-header,
.nav-container {
    max-width: 100%;
}

img,
video,
iframe,
embed,
object {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   11. 微信来源提示
   ========================================================================== */

.wechat-source-note {
    font-size: 12px;
    color: #666;
    line-height: 1.6;
}

.wechat-source-note__link {
    color: inherit;
}

/* ==========================================================================
   12. 首页插槽
   ========================================================================== */

.home-slot-item {
    width: 100%;
}
