/* 全局样式 */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Microsoft YaHei', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color, #333);
    background-color: var(--md-sys-color-background);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    color: #0056b3;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #003366;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    /* 防止布局抖动，默认宽高和比例 */
    aspect-ratio: 3/2;
}

/* 头部样式 */
header {
    background-color: var(--md-sys-color-surface);
    box-shadow: var(--box-shadow, 0 2px 5px rgba(0, 0, 0, 0.1));
    padding: 15px 0;
    margin-bottom: 30px;
}

header h1 {
    font-size: 24px;
    font-weight: 700;
}

header h1 a {
    color: #222;
}

header h1 a:hover {
    color: #0056b3;
}

/* 底部样式 */
footer {
    background-color: var(--md-sys-color-surface);
    padding: 20px 0;
    margin-top: 30px;
    box-shadow: var(--box-shadow, 0 -2px 5px rgba(0, 0, 0, 0.1));
    text-align: center;
    color: #555;
    font-size: 14px;
}

/* 主内容区 */
main {
    min-height: 500px;
}

/* 图片集网格 */
.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.album-card {
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-medium);
    overflow: hidden;
    box-shadow: var(--box-shadow, 0 2px 10px rgba(0, 0, 0, 0.1));
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.album-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* 优化图片容器，防止布局抖动 */
.album-thumbnail {
    height: 200px;
    min-height: 200px;
    background: #f3f3f3;
    display: flex;
    align-items: center;
    justify-content: center;
}
.album-thumbnail img {
    width: 300px;
    height: 200px;
    aspect-ratio: 3/2;
    object-fit: cover;
    background: #f3f3f3;
}

.album-info {
    padding: 15px;
}

.album-info h3 {
    margin-bottom: 10px;
    font-size: 18px;
    color: #222;
}

.album-desc {
    color: #444;
    font-size: 14px;
    margin-bottom: 10px;
    height: 60px;
    overflow: hidden;
}

.album-meta {
    color: #555;
    font-size: 12px;
    text-align: right;
}

/* 图片集详情页 */
.album-view {
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: 30px;
    box-shadow: var(--box-shadow, 0 2px 10px rgba(0, 0, 0, 0.1));
}

.album-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 15px;
}

.album-header h1, .album-header h2 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #222;
}

.album-description {
    margin: 20px 0;
    color: #444;
    line-height: 1.8;
}

.current-image {
    margin: 40px 0;
    text-align: center;
}

.image-counter {
    margin-bottom: 15px;
    color: #555;
    font-size: 14px;
}

.album-image {
    min-height: 600px;
    background: #f3f3f3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.album-image img {
    width: 800px;
    height: 600px;
    aspect-ratio: 4/3;
    object-fit: cover;
    background: #f3f3f3;
}

.image-caption {
    margin-top: 15px;
    color: #444;
    font-style: italic;
}

/* 图片查看器样式 */
.zoomable-image {
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.zoomable-image:hover {
    transform: scale(1.02);
}

.image-viewer {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.image-viewer.active {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.close-viewer {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 10000;
}

.close-viewer:hover {
    color: #bbb;
}

.viewer-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* 图片预览区 */
.album-preview {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.album-preview h3 {
    margin-bottom: 15px;
    font-size: 20px;
    color: #222;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.preview-item {
    position: relative;
    border-radius: 3px;
    overflow: hidden;
}

.preview-item.active {
    box-shadow: 0 0 0 3px #3498db;
}

.preview-item img {
    width: 100px;
    height: 80px;
    aspect-ratio: 5/4;
    object-fit: cover;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preview-item:hover img {
    opacity: 0.85;
    transform: scale(1.05);
}

/* 翻页导航 */
.pagination {
    display: flex;
    justify-content: space-between;
    margin: 30px 0;
}

.prev-page,
.next-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--md-sys-shape-corner-medium);
    background-color: #0056b3;
    color: #ffffff;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.prev-page:hover,
.next-page:hover {
    background-color: #003366;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 返回图片集按钮 */
.back-to-album {
    margin-bottom: 20px;
}

.back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--md-sys-shape-corner-medium);
    background-color: #0056b3;
    color: #ffffff;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.back-button:hover {
    background-color: #003366;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.album-navigation {
    margin-top: 40px;
    text-align: center;
}

.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--md-sys-shape-corner-medium);
    background-color: #0056b3;
    color: #ffffff;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.back-link:hover {
    background-color: #003366;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 响应式布局 */
@media (max-width: 768px) {
    .albums-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .album-view {
        padding: 15px;
    }
    
    .album-header h1 {
        font-size: 22px;
    }
    
    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
    
    .preview-item img {
        height: 60px;
    }
    
    .pagination {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
}

/* Material Design 3 & 语言选择器附加样式 */
.lang-selector {
    display: flex;
    gap: 8px;
    margin-left: auto;
}
.lang-selector .lang-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 12px;
    border-radius: 16px;
    background: #e0e0e0;
    color: #222;
    font-weight: 500;
}
.lang-selector .lang-item.active {
    background: #0056b3;
    color: #ffffff;
}
.lang-selector .lang-item:hover {
    filter: brightness(0.9);
}

.header-inner {
    display: flex;
    align-items: center;
}

.site-title {
    font-size: 22px;
    font-weight: 600;
    margin-right: 15px;
}

.album-card.md-elevation-1 {
    border-radius: var(--md-sys-shape-corner-medium);
}

/* ----- 以下新增: 移动端两列瀑布流布局 ----- */
@media (max-width: 600px) {
    /* 针对随机生成的网格类，统一两列布局 */
    [class^="grid-"] {
        display: block !important;
        column-count: 2;
        column-gap: 12px;
    }

    [class^="card-"] {
        display: inline-block;
        width: 100%;
        margin: 0 0 12px;
    }
}

/* ----- 以下新增: 内容页默认缩小大图，以引导点击查看 ----- */
@media (max-width: 768px) {
    .album-image img {
        max-width: 100%;
    }
}

/* ----- 以下新增: 主题切换按钮 ----- */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
    color: #0056b3;
    padding: 4px;
    transition: transform 0.2s ease;
}
.theme-toggle:hover {
    transform: rotate(20deg);
}
.dark-mode .theme-toggle {
    color: #0056b3;
}

/* ----- 以下新增: 暗黑模式支持 ----- */
.dark-mode body {
    background-color: #121212;
    color: #ffffff;
}

.dark-mode header,
.dark-mode footer,
.dark-mode .album-card,
.dark-mode .album-view {
    background-color: #1a1a1a;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.dark-mode a {
    color: #74b9ff;
}
.dark-mode a:hover {
    color: #ffffff;
}

.dark-mode .album-card:hover {
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.08);
}

/* ----- 以下新增: 缩放比例标签 ----- */
.scale-label {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: auto;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: none;
}
.image-viewer.active .scale-label {
    display: block;
}

/* ----- 2025-05-12 新增: 下拉语言菜单、省略号、暗黑字体、移动端头部 ----- */

/* 通用省略号工具类 */
.ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 语言下拉菜单（桌面隐藏） */
.lang-dropdown {
    display: none;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid #999;
    background: #fff;
    color: #222;
    margin-left: auto;
}

@media (max-width: 600px) {
    /* 允许头部换行 */
    .header-inner {
        flex-wrap: wrap;
    }
    .site-title {
        flex: 1 1 100%;
        margin-bottom: 6px;
    }
    .lang-selector {
        display: none; /* 隐藏横向语言链接 */
    }
    .lang-dropdown {
        display: inline-block; /* 显示下拉 */
    }
    .theme-toggle {
        margin-left: 8px;
    }
    /* 小屏文字省略 */
    .album-info h3,
    .site-title {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* 暗黑模式字体微调 */
.dark-mode body,
.dark-mode .album-desc,
.dark-mode .image-caption {
    color: #ffffff;
}

.dark-mode .lang-dropdown {
    background: #2a2a2a;
    color: #ffffff;
    border-color: #666;
}

/* 强化暗黑模式文本为白色 */
.dark-mode body,
.dark-mode header,
.dark-mode footer,
.dark-mode .album-card,
.dark-mode .album-view,
.dark-mode .album-header h1,
.dark-mode .album-header h2,
.dark-mode .album-desc,
.dark-mode .image-caption,
.dark-mode .album-meta,
.dark-mode .site-title,
.dark-mode .album-info h3,
.dark-mode .pagination,
.dark-mode .back-button,
.dark-mode .back-link,
.dark-mode .lang-item {
    color: #ffffff !important;
}

.dark-mode .lang-dropdown {
    color: #ffffff;
}

/* ---- Flutter(Material) 风格统一 ---- */
.album-card {
    border-radius: var(--md-sys-shape-corner-medium);
}

/* ---- 隐藏白标文本短语（不可见但保留布局占位） ---- */
.topic-tag,
.footer-tag,
.domain-phrase {
    opacity: 0;
    pointer-events: none;
    user-select: none;
}

/* ==== 自定义需求改动开始 ==== */
/* 1. 桌面端彻底隐藏右侧侧边栏 */
.side-menu.right-menu {
    display: none !important;
}

/* 2. 暗黑模式：所有文本改为纯白 */
.dark-mode, .dark-mode * {
    color: #ffffff !important;
}

/* 3. 暗黑模式下语言选择器与主题按钮颜色同步 */
.dark-mode .lang-selector .lang-item,
.dark-mode .lang-selector-vertical .lang-item,
.dark-mode .lang-dropdown {
    color: #ffffff !important;
}
.dark-mode .theme-toggle {
    color: #ffffff !important;
}

/* 4. 友链导航样式 */
.friend-links {
    display: flex;
    gap: 12px;
    margin-left: 20px;
}
.friend-links a {
    color: var(--md-sys-color-primary);
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid transparent;
}
.friend-links a:hover {
    color: color-mix(in srgb, var(--md-sys-color-primary) 80%, #000 20%);
    text-decoration: none;
    background: rgba(var(--md-sys-color-primary-rgb), 0.1);
    border-color: color-mix(in srgb, var(--md-sys-color-primary) 50%, transparent 50%);
    transform: translateY(-2px);
}
.dark-mode .friend-links a {
    color: #ffffff;
}
.dark-mode .friend-links a:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}
/* ==== 自定义需求改动结束 ==== */

/* ======================= Material 3 / Flutter 风格变量 ======================= */
:root {
    /* Flutter Pastel 颜色 - 提升对比度 */
    --flutter-primary: #5240a0;
    --flutter-on-primary: #ffffff;
    --flutter-surface: #ffffff;
    --flutter-surface-variant: #e0e0e0;
    --flutter-shadow: 0 2px 6px rgba(0,0,0,0.12);
    /* 兼容旧变量名，避免移除全部引用 */
    --md-sys-color-background: var(--flutter-surface);
    --md-sys-color-surface: var(--flutter-surface);
    --md-sys-color-surface-variant: var(--flutter-surface-variant);
    --md-sys-color-primary: var(--flutter-primary);
    --md-sys-color-on-primary: var(--flutter-on-primary);
    --md-sys-color-primary-container: color-mix(in srgb, var(--flutter-primary) 15%, #fff 85%);
    --md-sys-color-on-secondary: #222;
    --md-sys-shape-corner-medium: 10px;
    --text-color: #222;
}

body {
    /* 替换字体为 Roboto / 系统默认 */
    font-family: 'Roboto', 'Microsoft YaHei', Arial, sans-serif;
    background-color: var(--md-sys-color-background);
    color: var(--text-color, #222);
}

header,
footer,
.album-card,
.album-view {
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-medium);
    box-shadow: var(--box-shadow, 0 1px 3px rgba(0,0,0,0.1));
}

/* Elevation helpers (M3) */
.md-elevation-1 { box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.md-elevation-2 { box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.md-elevation-3 { box-shadow: 0 3px 8px rgba(0,0,0,0.18); }

/* Material Filled Button */
.prev-page,
.next-page,
.back-link,
.back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--md-sys-shape-corner-medium);
    background-color: #0056b3;
    color: #ffffff;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.prev-page:hover,
.next-page:hover,
.back-link:hover,
.back-button:hover {
    background-color: #003366;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Material "Chip" 语言切换 */
.lang-selector .lang-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 12px;
    border-radius: 16px;
    background: #e0e0e0;
    color: #222;
    font-weight: 500;
}
.lang-selector .lang-item.active {
    background: #0056b3;
    color: #ffffff;
}
.lang-selector .lang-item:hover {
    filter: brightness(0.9);
}

/* Material TextField 风格的语言下拉 */
.lang-dropdown {
    border: 1px solid #999;
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-surface);
    padding: 6px 8px;
}

/* Material 图集卡片 Hover 提升 */
.album-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.album-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* 主题切换按钮颜色 */
.theme-toggle {
    color: #0056b3;
}

/* ----- 以下新增: 暗黑模式支持 ----- */
.dark-mode body {
    background-color: #121212;
    color: #ffffff;
}

.dark-mode header,
.dark-mode footer,
.dark-mode .album-card,
.dark-mode .album-view {
    background-color: #1a1a1a;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.dark-mode a {
    color: #74b9ff;
}
.dark-mode a:hover {
    color: #ffffff;
}

.dark-mode .album-card:hover {
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.08);
}

/* ----- 以下新增: 缩放比例标签 ----- */
.scale-label {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: auto;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: none;
}
.image-viewer.active .scale-label {
    display: block;
}

/* ----- 2025-05-12 新增: 下拉语言菜单、省略号、暗黑字体、移动端头部 ----- */

/* 通用省略号工具类 */
.ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 语言下拉菜单（桌面隐藏） */
.lang-dropdown {
    display: none;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid #999;
    background: #fff;
    color: #222;
    margin-left: auto;
}

@media (max-width: 600px) {
    /* 允许头部换行 */
    .header-inner {
        flex-wrap: wrap;
    }
    .site-title {
        flex: 1 1 100%;
        margin-bottom: 6px;
    }
    .lang-selector {
        display: none; /* 隐藏横向语言链接 */
    }
    .lang-dropdown {
        display: inline-block; /* 显示下拉 */
    }
    .theme-toggle {
        margin-left: 8px;
    }
    /* 小屏文字省略 */
    .album-info h3,
    .site-title {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* 暗黑模式字体微调 */
.dark-mode body,
.dark-mode .album-desc,
.dark-mode .image-caption {
    color: #ffffff;
}

.dark-mode .lang-dropdown {
    background: #2a2a2a;
    color: #ffffff;
    border-color: #666;
}

/* 强化暗黑模式文本为白色 */
.dark-mode body,
.dark-mode header,
.dark-mode footer,
.dark-mode .album-card,
.dark-mode .album-view,
.dark-mode .album-header h1,
.dark-mode .album-header h2,
.dark-mode .album-desc,
.dark-mode .image-caption,
.dark-mode .album-meta,
.dark-mode .site-title,
.dark-mode .album-info h3,
.dark-mode .pagination,
.dark-mode .back-button,
.dark-mode .back-link,
.dark-mode .lang-item {
    color: #ffffff !important;
}

.dark-mode .lang-dropdown {
    color: #ffffff;
}

/* ---- Flutter(Material) 风格统一 ---- */
.album-card {
    border-radius: var(--md-sys-shape-corner-medium);
}

/* ---- 隐藏白标文本短语（不可见但保留布局占位） ---- */
.topic-tag,
.footer-tag,
.domain-phrase {
    opacity: 0;
    pointer-events: none;
    user-select: none;
}

/* --- side-menu 右侧仅桌面显示 --- */
.side-menu.right-menu { display: none; }
@media (min-width: 1024px) {
    .side-menu.right-menu { display: block; }
}

/* --- 移动端首页两列瀑布流 --- */
@media (max-width: 600px) {
    /* 使用 columns 实现瀑布流 */
    [class^="grid-"] {
        column-count: 2;
        column-gap: 12px;
    }
    [class^="card-"] {
        display: inline-block;
        width: 100%;
        margin: 0 0 12px;
    }
}

/* --- viewer-content 拖拽光标 --- */
.viewer-content.grab { cursor: grab; }
.viewer-content.grabbing { cursor: grabbing; }

/* --- 缩小内容页大图默认尺寸 --- */
.album-image img { max-width: 60%; }
@media (max-width: 768px) { .album-image img { max-width: 100%; } }

/* ==== 自定义需求补强：放在末尾，确保优先级最高 ==== */
.dark-mode, .dark-mode * {
    color: #ffffff !important;
}
.dark-mode a,
.dark-mode a:visited,
.dark-mode .lang-selector .lang-item,
.dark-mode .lang-selector-vertical .lang-item,
.dark-mode .lang-dropdown,
.dark-mode .theme-toggle {
    color: #ffffff !important;
}

/* 新增 section-title 样式 */
.section-title {
    margin-bottom: 20px;
    font-size: 24px;
    color: #222;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.dark-mode .section-title {
    color: #ffffff !important;
    border-bottom-color: #444;
}

/* 新增：屏幕阅读器专用类 - 视觉上隐藏但对屏幕阅读器可访问 */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.pagination span {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    color: #555;
    font-size: 14px;
}
.dark-mode .pagination span {
    color: #fff;
} 