Files
rust-imager/assets/css/album.css
2026-03-23 03:07:04 +08:00

672 lines
14 KiB
CSS

/* 相册详情页面特定样式 - 增强响应式支持 */
:root {
--primary-blue: #1e40af;
--secondary-blue: #3b82f6;
--light-blue: #dbeafe;
--accent-blue: #60a5fa;
--white: #ffffff;
--light-gray: #f8fafc;
--medium-gray: #e2e8f0;
--dark-gray: #475569;
--text-dark: #1e293b;
--text-light: #64748b;
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
--shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
--shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
--shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
--border-radius: 12px;
--border-radius-lg: 20px;
--mobile-breakpoint: 768px;
--tablet-breakpoint: 1024px;
}
body {
font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
background: linear-gradient(135deg, var(--light-blue) 0%, var(--white) 100%);
min-height: 100vh;
color: var(--text-dark);
line-height: 1.6;
overflow-x: hidden;
}
.container {
max-width: 1400px;
margin: 0 auto;
padding: 30px 20px;
}
.header { margin-bottom: 40px; }
.back-link {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 12px 24px;
background: var(--white);
color: var(--primary-blue);
text-decoration: none;
border-radius: var(--border-radius);
box-shadow: var(--shadow-sm);
margin-bottom: 25px;
transition: all 0.3s ease;
border: 1px solid var(--medium-gray);
font-weight: 500;
}
.back-link:hover {
background: var(--light-blue);
transform: translateX(-5px);
box-shadow: var(--shadow-md);
color: var(--primary-blue);
}
.album-title {
color: var(--text-dark);
font-size: 2.5rem;
text-align: center;
margin-bottom: 15px;
font-weight: 700;
background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.album-info {
text-align: center;
color: var(--text-light);
font-size: 1.2rem;
margin-bottom: 40px;
background: var(--white);
padding: 20px;
border-radius: var(--border-radius);
box-shadow: var(--shadow-sm);
border: 1px solid var(--medium-gray);
max-width: 800px;
margin-left: auto;
margin-right: auto;
}
/* 智能图片网格布局 - 自适应瀑布流效果 */
.images-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 25px;
margin-bottom: 50px;
align-items: start; /* 顶部对齐 */
}
/* 大屏幕下的优化布局 */
@media (min-width: 1200px) {
.images-grid {
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 30px;
}
}
/* 宽幅图片布局 - 超宽图片 (ratio > 1.5) */
.image-item.landscape {
grid-column: span 1;
}
.image-item.landscape img {
aspect-ratio: 16/9;
height: auto;
width: 100%;
object-fit: cover;
}
/* 竖幅图片布局 - 超高图片 (ratio < 0.67) */
.image-item.portrait {
grid-column: span 1;
}
.image-item.portrait img {
aspect-ratio: 3/4;
height: auto;
width: 100%;
object-fit: cover;
}
/* 较宽图片布局 (1.3 < ratio ≤ 1.5) */
.image-item.wide {
grid-column: span 1;
}
.image-item.wide img {
aspect-ratio: 4/3;
height: auto;
width: 100%;
object-fit: cover;
}
/* 较高图片布局 (0.83 ≤ ratio < 1.3) */
.image-item.tall {
grid-column: span 1;
}
.image-item.tall img {
aspect-ratio: 3/4;
height: auto;
width: 100%;
object-fit: cover;
}
/* 方形图片布局 (接近1:1) */
.image-item.square {
grid-column: span 1;
}
.image-item.square img {
aspect-ratio: 1/1;
height: auto;
width: 100%;
object-fit: cover;
}
/* 默认图片样式(未分类的图片) */
.image-item {
position: relative;
overflow: hidden;
border-radius: var(--border-radius);
box-shadow: var(--shadow-lg);
background: var(--white);
transition: all 0.3s ease;
cursor: pointer;
border: 1px solid var(--medium-gray);
}
.image-item:hover {
transform: translateY(-8px);
box-shadow: var(--shadow-xl);
border-color: var(--accent-blue);
}
/* 通用图片样式 - 移除固定高度,使用自适应 */
.image-item img {
width: 100%;
height: auto; /* 改为自适应高度 */
object-fit: cover;
display: block;
transition: transform 0.5s ease;
}
.image-item:hover img {
transform: scale(1.05);
}
.image-caption {
padding: 12px;
text-align: center;
color: var(--text-dark);
font-size: 0.9rem;
font-weight: 500;
line-height: 1.4;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
.image-caption small {
background: var(--light-gray);
padding: 4px 8px;
border-radius: 4px;
font-size: 0.8rem;
color: var(--text-light);
}
/* 收藏按钮样式 */
.favorite-btn {
position: absolute;
top: 10px;
right: 10px;
background: rgba(255, 255, 255, 0.9);
border: none;
border-radius: 50%;
width: 36px;
height: 36px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
backdrop-filter: blur(10px);
box-shadow: var(--shadow-sm);
opacity: 0;
z-index: 10;
}
.image-item:hover .favorite-btn {
opacity: 1;
}
.favorite-btn:hover {
background: rgba(255, 255, 255, 1);
transform: scale(1.1);
box-shadow: var(--shadow-md);
}
.favorite-btn.favorited {
color: #ec4899;
background: rgba(236, 72, 153, 0.1);
}
.favorite-btn.favorited:hover {
background: rgba(236, 72, 153, 0.2);
}
.favorite-btn i {
font-size: 16px;
transition: all 0.3s ease;
}
/* 触摸设备显示收藏按钮 */
@media (hover: none) and (pointer: coarse) {
.favorite-btn {
opacity: 0.7;
}
.image-item:active .favorite-btn {
opacity: 1;
transform: scale(1.1);
}
}
/* 图片加载状态 */
.image-loading {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--light-gray);
display: flex;
align-items: center;
justify-content: center;
color: var(--text-light);
}
.image-loading .fa-spinner {
font-size: 1.5rem;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* 图片查看器样式 */
.lightbox {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(30, 41, 59, 0.95);
z-index: 1000;
justify-content: center;
align-items: center;
flex-direction: column;
backdrop-filter: blur(10px);
}
.lightbox img {
max-width: 85%;
max-height: 75%;
object-fit: contain;
border-radius: 12px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}
.lightbox-close {
position: absolute;
top: 30px;
right: 40px;
color: var(--white);
font-size: 36px;
cursor: pointer;
z-index: 1001;
background: rgba(255, 255, 255, 0.1);
width: 50px;
height: 50px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
backdrop-filter: blur(10px);
}
.lightbox-close:hover {
background: rgba(255, 255, 255, 0.2);
transform: scale(1.1);
}
.lightbox-nav {
position: absolute;
top: 50%;
width: 100%;
display: flex;
justify-content: space-between;
padding: 0 20px;
transform: translateY(-50%);
z-index: 1001;
}
.lightbox-nav button {
background: rgba(255,255,255,0.2);
color: var(--white);
font-size: 30px;
padding: 12px 24px;
cursor: pointer;
border-radius: var(--border-radius);
backdrop-filter: blur(10px);
transition: all 0.3s ease;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.lightbox-nav button:hover {
background: rgba(255,255,255,0.3);
transform: scale(1.1);
border-color: rgba(255, 255, 255, 0.3);
}
.lightbox-info {
color: var(--white);
text-align: center;
margin-top: 25px;
font-size: 1.2rem;
background: rgba(255, 255, 255, 0.1);
padding: 15px 25px;
border-radius: var(--border-radius);
backdrop-filter: blur(10px);
max-width: 80%;
}
/* 响应式媒体查询 - 移动端优化 */
@media (max-width: 1024px) {
.container {
padding: 25px 15px;
}
.header {
margin-bottom: 35px;
}
.album-title {
font-size: 2.2rem;
}
.album-info {
font-size: 1.1rem;
padding: 18px;
margin-bottom: 35px;
}
.images-grid {
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
}
.image-item img {
height: auto; /* 自适应高度 */
}
.lightbox img {
max-width: 90%;
max-height: 70%;
}
.lightbox-close {
top: 20px;
right: 25px;
font-size: 30px;
width: 45px;
height: 45px;
}
}
@media (max-width: 768px) {
.container {
padding: 20px 15px;
}
.header {
margin-bottom: 30px;
}
.back-link {
padding: 10px 20px;
font-size: 0.9rem;
margin-bottom: 20px;
}
.album-title {
font-size: 1.8rem;
margin-bottom: 12px;
}
.album-info {
font-size: 1rem;
padding: 15px;
margin-bottom: 30px;
}
.images-grid {
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 15px;
}
.image-item {
border-radius: 10px;
}
.image-item img {
height: auto; /* 自适应高度 */
}
.image-caption {
padding: 10px;
font-size: 0.85rem;
}
.image-caption small {
font-size: 0.75rem;
padding: 3px 6px;
}
.lightbox {
padding: 20px;
}
.lightbox img {
max-width: 95%;
max-height: 65%;
}
.lightbox-close {
top: 15px;
right: 15px;
font-size: 24px;
width: 40px;
height: 40px;
}
.lightbox-nav {
padding: 0 10px;
}
.lightbox-nav button {
font-size: 24px;
padding: 10px 20px;
}
.lightbox-info {
font-size: 1rem;
padding: 12px 20px;
margin-top: 20px;
}
}
@media (max-width: 480px) {
.container {
padding: 15px 10px;
}
.header {
margin-bottom: 25px;
}
.back-link {
padding: 8px 16px;
font-size: 0.85rem;
margin-bottom: 15px;
}
.album-title {
font-size: 1.6rem;
margin-bottom: 10px;
}
.album-info {
font-size: 0.9rem;
padding: 12px;
margin-bottom: 25px;
}
.images-grid {
grid-template-columns: 1fr;
gap: 12px;
}
.image-item img {
height: auto; /* 自适应高度 */
}
.image-caption {
padding: 8px;
font-size: 0.8rem;
flex-direction: column;
align-items: flex-start;
gap: 6px;
}
.lightbox {
padding: 15px;
}
.lightbox img {
max-width: 100%;
max-height: 60%;
}
.lightbox-close {
top: 10px;
right: 10px;
font-size: 20px;
width: 35px;
height: 35px;
}
.lightbox-nav {
padding: 0 5px;
}
.lightbox-nav button {
font-size: 20px;
padding: 8px 16px;
}
.lightbox-info {
font-size: 0.9rem;
padding: 10px 15px;
margin-top: 15px;
max-width: 95%;
}
}
/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
.image-item:hover {
transform: none;
box-shadow: var(--shadow-lg);
}
.image-item:active {
transform: scale(0.98);
box-shadow: var(--shadow-md);
}
.back-link:hover {
transform: none;
}
.back-link:active {
transform: scale(0.95);
}
.lightbox-nav button:hover {
transform: none;
}
.lightbox-nav button:active {
transform: scale(0.9);
}
.lightbox-close:hover {
transform: none;
}
.lightbox-close:active {
transform: scale(0.9);
}
}
/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
.lightbox {
flex-direction: row;
align-items: center;
}
.lightbox img {
max-width: 70%;
max-height: 85%;
}
.lightbox-info {
margin-top: 0;
margin-left: 20px;
max-width: 25%;
}
}
/* 高分辨率屏幕优化 */
@media (min-resolution: 2dppx) {
.image-item img {
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
}
.lightbox img {
image-rendering: auto;
}
}
/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
:root {
--primary-blue: #3b82f6;
--light-blue: #1e293b;
--white: #0f172a;
--light-gray: #334155;
--medium-gray: #475569;
--text-dark: #f1f5f9;
--text-light: #cbd5e1;
}
body {
background: linear-gradient(135deg, var(--light-blue) 0%, var(--white) 100%);
}
}
@media (max-width: 768px) {
.images-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.album-title { font-size: 1.8rem; }
.lightbox img { max-width: 95%; max-height: 60%; }
.lightbox-nav button { font-size: 24px; padding: 10px 18px; }
.container { padding: 20px 15px; }
.album-info { font-size: 1.1rem; padding: 15px; }
}