You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DjangoBlog/static/css/style.css

714 lines
13 KiB

/* 南京非遗主题自定义样式 */
:root {
--nj-red: #c62f2f;
--nj-gold: #d4af37;
--nj-brown: #8b4513;
--nj-light-brown: #a0522d;
--primary-color: var(--nj-brown);
--secondary-color: var(--nj-light-brown);
--accent-color: var(--nj-gold);
--text-dark: #2c1810;
--text-light: #5d4037;
--bg-light: #faf3e8;
--bg-white: #fffaf0;
--border-color: #e8d5c4;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Noto Serif SC", "Source Han Serif SC", "Microsoft YaHei", serif;
line-height: 1.7;
color: var(--text-dark);
background: linear-gradient(135deg, #faf3e8 0%, #fffaf0 100%);
min-height: 100vh;
}
/* 头部样式 - 中国风设计 */
.header {
background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
padding: 0;
box-shadow: 0 4px 20px rgba(139, 69, 19, 0.3);
position: relative;
overflow: hidden;
}
.header::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
background: linear-gradient(90deg, var(--nj-gold), var(--nj-red), var(--nj-gold));
animation: shimmer 3s infinite;
}
@keyframes shimmer {
0% { background-position: -200% 0; }
100% { background-position: 200% 0; }
}
.nav-container {
max-width: 1400px;
margin: 0 auto;
padding: 0 30px;
}
.site-brand {
text-align: center;
padding: 20px 0;
border-bottom: 1px solid rgba(255,255,255,0.2);
}
.site-title {
color: #fff;
font-size: 2.5em;
font-weight: 700;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
letter-spacing: 4px;
}
.site-subtitle {
color: var(--nj-gold);
font-size: 1.1em;
margin-top: 8px;
font-style: italic;
}
.main-nav {
display: flex;
justify-content: center;
list-style: none;
padding: 15px 0;
}
.main-nav a {
display: block;
padding: 12px 25px;
color: #fff;
text-decoration: none;
font-size: 16px;
font-weight: 500;
transition: all 0.3s ease;
border-radius: 25px;
margin: 0 8px;
position: relative;
overflow: hidden;
}
.main-nav a::before {
content: "";
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
transition: left 0.5s;
}
.main-nav a:hover::before {
left: 100%;
}
.main-nav a:hover {
background: rgba(255,255,255,0.1);
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
/* 当前分类高亮样式 */
.current-category {
background: rgba(255, 255, 255, 0.25);
border: 2px solid var(--nj-gold);
font-weight: 600;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
/* 搜索框样式 */
.search-box {
text-align: center;
padding: 15px 0;
border-top: 1px solid rgba(255,255,255,0.2);
}
.search-box form {
display: inline-flex;
max-width: 500px;
width: 100%;
}
.search-box input {
flex: 1;
padding: 12px 20px;
border: none;
border-radius: 25px 0 0 25px;
font-size: 14px;
outline: none;
}
.search-box button {
background: var(--nj-gold);
color: var(--text-dark);
border: none;
padding: 12px 25px;
border-radius: 0 25px 25px 0;
cursor: pointer;
font-weight: 600;
transition: background 0.3s;
}
.search-box button:hover {
background: #ffd700;
}
/* 主要内容布局 */
.main-container {
max-width: 1400px;
margin: 40px auto;
padding: 0 30px;
display: grid;
grid-template-columns: 1fr 350px;
gap: 40px;
}
/* 文章内容区域 */
.content {
background: var(--bg-white);
border-radius: 15px;
box-shadow: 0 10px 30px rgba(139, 69, 19, 0.1);
overflow: hidden;
border: 1px solid var(--border-color);
}
.content-header {
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
color: white;
padding: 25px 30px;
text-align: center;
}
/* 分类标签样式 */
.category-label {
display: inline-block;
background: rgba(255, 255, 255, 0.2);
padding: 6px 16px;
border-radius: 20px;
font-size: 0.9em;
margin-bottom: 12px;
border: 1px solid var(--nj-gold);
font-weight: 500;
}
.content-header h1 {
font-size: 2em;
margin-bottom: 8px;
text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}
.content-intro {
font-size: 1.1em;
opacity: 0.95;
max-width: 800px;
margin: 0 auto;
line-height: 1.6;
padding: 0 20px;
}
.posts-list {
padding: 0;
}
/* 文章项样式 */
.post-item {
padding: 35px 30px;
border-bottom: 1px solid var(--border-color);
transition: all 0.3s ease;
position: relative;
}
.post-item::before {
content: "";
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 4px;
background: linear-gradient(to bottom, var(--primary-color), var(--accent-color));
opacity: 0;
transition: opacity 0.3s ease;
}
.post-item:hover {
background: linear-gradient(135deg, #fffaf0, #faf3e8);
transform: translateX(5px);
}
.post-item:hover::before {
opacity: 1;
}
.post-item:last-child {
border-bottom: none;
}
.post-title {
margin-bottom: 20px;
}
.post-title a {
color: var(--text-dark);
text-decoration: none;
font-size: 1.8em;
font-weight: 600;
line-height: 1.3;
transition: color 0.3s ease;
display: block;
}
.post-title a:hover {
color: var(--primary-color);
text-decoration: underline;
text-underline-offset: 3px;
}
.post-meta {
color: var(--text-light);
font-size: 14px;
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 25px;
flex-wrap: wrap;
}
.post-meta span {
display: flex;
align-items: center;
gap: 6px;
}
.post-meta i {
font-style: normal;
opacity: 0.7;
}
.post-content {
color: var(--text-light);
font-size: 16px;
line-height: 1.8;
margin-bottom: 25px;
text-align: justify;
}
.read-more {
color: var(--primary-color);
text-decoration: none;
font-weight: 600;
font-size: 15px;
display: inline-flex;
align-items: center;
gap: 8px;
transition: all 0.3s ease;
padding: 8px 16px;
border: 2px solid var(--primary-color);
border-radius: 25px;
}
.read-more:hover {
background: var(--primary-color);
color: white;
transform: translateX(5px);
}
.post-footer {
color: var(--text-light);
font-size: 13px;
margin-top: 25px;
padding-top: 20px;
border-top: 1px dashed var(--border-color);
display: flex;
flex-wrap: wrap;
gap: 15px;
align-items: center;
}
.post-tags {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.tag {
background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
color: white;
padding: 4px 12px;
border-radius: 15px;
font-size: 12px;
font-weight: 500;
}
/* 非遗徽章样式 */
.heritage-badge {
background: linear-gradient(135deg, var(--nj-red), var(--nj-brown));
color: white;
padding: 4px 12px;
border-radius: 20px;
font-size: 12px;
font-weight: bold;
border: 1px solid var(--nj-gold);
}
.heritage-item {
border-left: 3px solid var(--nj-red);
background: linear-gradient(135deg, #fffaf0, #faf3e8);
}
/* 侧边栏样式 */
.sidebar {
display: flex;
flex-direction: column;
gap: 25px;
}
.sidebar-widget {
background: var(--bg-white);
border-radius: 15px;
box-shadow: 0 8px 25px rgba(139, 69, 19, 0.1);
padding: 25px;
border: 1px solid var(--border-color);
}
.widget-title {
color: var(--primary-color);
font-size: 1.3em;
font-weight: 600;
margin-bottom: 20px;
padding-bottom: 12px;
border-bottom: 2px solid var(--accent-color);
display: flex;
align-items: center;
gap: 10px;
}
.widget-title::before {
content: "◆";
color: var(--secondary-color);
}
.views-list {
list-style: none;
}
.views-list li {
padding: 12px 0;
border-bottom: 1px solid var(--border-color);
color: var(--text-light);
font-size: 14px;
transition: all 0.3s ease;
display: flex;
justify-content: space-between;
align-items: center;
}
.views-list li:hover {
color: var(--primary-color);
transform: translateX(5px);
}
.views-list li:last-child {
border-bottom: none;
}
.view-count {
background: var(--accent-color);
color: white;
padding: 2px 8px;
border-radius: 10px;
font-size: 12px;
font-weight: 500;
}
/* 分类标签云 */
.tag-cloud {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.cloud-tag {
background: linear-gradient(135deg, #e8d5c4, #d7ccc8);
color: var(--text-light);
padding: 6px 12px;
border-radius: 15px;
font-size: 12px;
text-decoration: none;
transition: all 0.3s ease;
}
.cloud-tag:hover {
background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
color: white;
transform: translateY(-2px);
}
/* 文章详情页特定样式 */
.post-detail {
padding: 40px;
margin: 0;
}
.post-header {
text-align: center;
margin-bottom: 40px;
border-bottom: 2px solid var(--border-color);
padding-bottom: 30px;
}
.post-detail .post-title {
font-size: 2.2em;
color: var(--text-dark);
margin-bottom: 20px;
line-height: 1.3;
}
.post-detail .post-meta {
color: var(--text-light);
font-size: 14px;
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 25px;
flex-wrap: wrap;
justify-content: center;
}
.post-image img {
max-width: 100%;
height: auto;
border-radius: 10px;
margin-top: 20px;
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.post-detail .post-content {
font-size: 16px;
line-height: 1.8;
color: var(--text-light);
margin-bottom: 30px;
}
.post-detail .post-content p {
margin-bottom: 20px;
text-align: justify;
}
.post-detail .post-footer {
color: var(--text-light);
font-size: 13px;
margin-top: 25px;
padding-top: 20px;
border-top: 1px dashed var(--border-color);
display: flex;
flex-wrap: wrap;
gap: 15px;
align-items: center;
}
/* 评论区域样式 */
.comments-section {
margin-top: 50px;
padding-top: 30px;
border-top: 2px solid var(--border-color);
}
.comment-form {
margin-bottom: 30px;
}
.comment-form textarea {
width: 100%;
padding: 15px;
border: 1px solid var(--border-color);
border-radius: 8px;
resize: vertical;
min-height: 100px;
font-family: inherit;
font-size: 14px;
transition: border-color 0.3s;
}
.comment-form textarea:focus {
outline: none;
border-color: var(--primary-color);
}
.submit-btn {
background: var(--primary-color);
color: white;
border: none;
padding: 12px 30px;
border-radius: 25px;
cursor: pointer;
margin-top: 15px;
font-weight: 600;
transition: all 0.3s;
}
.submit-btn:hover {
background: var(--secondary-color);
transform: translateY(-2px);
}
.comment-item {
background: var(--bg-light);
padding: 20px;
border-radius: 8px;
margin-bottom: 15px;
border-left: 4px solid var(--accent-color);
transition: transform 0.3s;
}
.comment-item:hover {
transform: translateX(5px);
}
.comment-header {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
font-size: 14px;
}
.comment-author {
font-weight: 600;
color: var(--primary-color);
}
.comment-time {
color: var(--text-light);
}
.comment-content {
line-height: 1.6;
color: var(--text-dark);
}
.no-comments {
text-align: center;
color: var(--text-light);
padding: 40px;
font-style: italic;
background: var(--bg-light);
border-radius: 8px;
}
.login-prompt {
text-align: center;
padding: 20px;
background: var(--bg-light);
border-radius: 8px;
margin-bottom: 20px;
}
.login-prompt a {
color: var(--primary-color);
text-decoration: none;
font-weight: 600;
}
.login-prompt a:hover {
text-decoration: underline;
}
/* 响应式设计 */
@media (max-width: 1024px) {
.main-container {
grid-template-columns: 1fr;
gap: 25px;
}
.sidebar {
width: 100%;
}
}
@media (max-width: 768px) {
.nav-container {
padding: 0 15px;
}
.main-nav {
flex-wrap: wrap;
}
.main-nav a {
padding: 10px 15px;
font-size: 14px;
margin: 4px;
}
.site-title {
font-size: 2em;
}
.main-container {
padding: 0 15px;
margin: 20px auto;
}
.post-item {
padding: 25px 20px;
}
.post-title a {
font-size: 1.5em;
}
.content-header {
padding: 20px;
}
.content-header h1 {
font-size: 1.6em;
}
.post-detail {
padding: 20px;
}
.post-detail .post-title {
font-size: 1.8em;
}
.post-detail .post-meta {
gap: 15px;
font-size: 12px;
}
.comment-header {
flex-direction: column;
gap: 5px;
}
}
/* 页脚样式 */
.footer {
background: linear-gradient(135deg, var(--primary-color), var(--text-dark));
color: white;
text-align: center;
padding: 30px 20px;
margin-top: 60px;
}
.footer p {
opacity: 0.8;
font-size: 14px;
}