398 lines
7.1 KiB
CSS
398 lines
7.1 KiB
CSS
/* 响应式样式文件 */
|
|
/* 文件位置: portfolio/css/responsive.css */
|
|
/* 创建时间: 2026-03-31 */
|
|
|
|
/* 大桌面设备 (1200px以上) */
|
|
@media (min-width: 1200px) {
|
|
.container {
|
|
max-width: 1140px;
|
|
}
|
|
}
|
|
|
|
/* 桌面设备 (1024px - 1199px) */
|
|
@media (max-width: 1199px) {
|
|
.container {
|
|
max-width: 960px;
|
|
}
|
|
|
|
.hero-title {
|
|
font-size: 3rem;
|
|
}
|
|
|
|
.skills-grid,
|
|
.projects-grid {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
}
|
|
|
|
/* 平板设备 (768px - 1023px) */
|
|
@media (max-width: 1023px) {
|
|
.container {
|
|
max-width: 720px;
|
|
}
|
|
|
|
/* 导航栏响应式 */
|
|
.menu-toggle {
|
|
display: block;
|
|
}
|
|
|
|
.nav-links {
|
|
position: fixed;
|
|
top: 70px;
|
|
left: -100%;
|
|
width: 100%;
|
|
flex-direction: column;
|
|
background-color: var(--color-primary);
|
|
padding: var(--spacing-lg);
|
|
transition: var(--transition-normal);
|
|
box-shadow: var(--shadow-md);
|
|
}
|
|
|
|
.nav-links.active {
|
|
left: 0;
|
|
}
|
|
|
|
.menu-toggle.active .bar:nth-child(1) {
|
|
transform: rotate(45deg) translate(5px, 5px);
|
|
}
|
|
|
|
.menu-toggle.active .bar:nth-child(2) {
|
|
opacity: 0;
|
|
}
|
|
|
|
.menu-toggle.active .bar:nth-child(3) {
|
|
transform: rotate(-45deg) translate(7px, -6px);
|
|
}
|
|
|
|
/* Hero 部分响应式 */
|
|
.hero .container {
|
|
grid-template-columns: 1fr;
|
|
text-align: center;
|
|
}
|
|
|
|
.hero-buttons {
|
|
justify-content: center;
|
|
}
|
|
|
|
.hero-image {
|
|
order: -1;
|
|
margin-bottom: var(--spacing-lg);
|
|
}
|
|
|
|
.image-placeholder {
|
|
width: 250px;
|
|
height: 250px;
|
|
font-size: 6rem;
|
|
}
|
|
|
|
/* 关于部分响应式 */
|
|
.about-content {
|
|
grid-template-columns: 1fr;
|
|
text-align: center;
|
|
}
|
|
|
|
.avatar-placeholder {
|
|
width: 200px;
|
|
height: 200px;
|
|
font-size: 5rem;
|
|
margin: 0 auto var(--spacing-lg);
|
|
}
|
|
|
|
/* 联系部分响应式 */
|
|
.contact-content {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
/* 页脚响应式 */
|
|
.footer-content {
|
|
grid-template-columns: 1fr;
|
|
gap: var(--spacing-lg);
|
|
}
|
|
}
|
|
|
|
/* 移动设备 (576px - 767px) */
|
|
@media (max-width: 767px) {
|
|
.container {
|
|
max-width: 540px;
|
|
}
|
|
|
|
.section-title {
|
|
font-size: 2rem;
|
|
}
|
|
|
|
.hero-title {
|
|
font-size: 2.5rem;
|
|
}
|
|
|
|
.hero-subtitle {
|
|
font-size: 1.2rem;
|
|
}
|
|
|
|
.hero-buttons {
|
|
flex-direction: column;
|
|
align-items: center;
|
|
}
|
|
|
|
.btn {
|
|
width: 100%;
|
|
max-width: 300px;
|
|
}
|
|
|
|
.skills-grid,
|
|
.projects-grid {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.experience {
|
|
grid-template-columns: 1fr;
|
|
gap: var(--spacing-sm);
|
|
}
|
|
|
|
.footer-bottom {
|
|
flex-direction: column;
|
|
text-align: center;
|
|
gap: var(--spacing-xs);
|
|
}
|
|
}
|
|
|
|
/* 小移动设备 (575px以下) */
|
|
@media (max-width: 575px) {
|
|
.container {
|
|
padding: 0 var(--spacing-sm);
|
|
}
|
|
|
|
.hero-title {
|
|
font-size: 2rem;
|
|
}
|
|
|
|
.hero-subtitle {
|
|
font-size: 1rem;
|
|
}
|
|
|
|
.image-placeholder {
|
|
width: 200px;
|
|
height: 200px;
|
|
font-size: 5rem;
|
|
}
|
|
|
|
.avatar-placeholder {
|
|
width: 150px;
|
|
height: 150px;
|
|
font-size: 4rem;
|
|
}
|
|
|
|
.about-text h3 {
|
|
font-size: 1.5rem;
|
|
}
|
|
|
|
.skill-category {
|
|
padding: var(--spacing-md);
|
|
}
|
|
|
|
.project-content {
|
|
padding: var(--spacing-md);
|
|
}
|
|
|
|
.contact-item {
|
|
flex-direction: column;
|
|
text-align: center;
|
|
gap: var(--spacing-xs);
|
|
}
|
|
|
|
.contact-item i {
|
|
margin-bottom: var(--spacing-xs);
|
|
}
|
|
|
|
.newsletter-form {
|
|
flex-direction: column;
|
|
}
|
|
|
|
.back-to-top {
|
|
bottom: 20px;
|
|
right: 20px;
|
|
width: 40px;
|
|
height: 40px;
|
|
}
|
|
}
|
|
|
|
/* 打印样式 */
|
|
@media print {
|
|
.navbar,
|
|
.hero-buttons,
|
|
.contact-form,
|
|
.footer,
|
|
.back-to-top {
|
|
display: none;
|
|
}
|
|
|
|
body {
|
|
color: #000;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.container {
|
|
max-width: 100%;
|
|
padding: 0;
|
|
}
|
|
|
|
.hero,
|
|
.about,
|
|
.skills,
|
|
.projects,
|
|
.contact {
|
|
padding: 1rem 0;
|
|
page-break-inside: avoid;
|
|
}
|
|
|
|
a {
|
|
color: #000;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.section-title::after {
|
|
background-color: #000;
|
|
}
|
|
}
|
|
|
|
/* 高对比度模式支持 */
|
|
@media (prefers-contrast: high) {
|
|
:root {
|
|
--color-text: #000000;
|
|
--color-text-light: #333333;
|
|
--color-primary: #ffffff;
|
|
--color-secondary: #f0f0f0;
|
|
--color-bg-light: #e0e0e0;
|
|
--color-border: #000000;
|
|
}
|
|
|
|
.highlight {
|
|
color: #0000ff;
|
|
}
|
|
|
|
.btn-primary {
|
|
background-color: #0000ff;
|
|
color: #ffffff;
|
|
}
|
|
|
|
.skill-level {
|
|
background: #0000ff;
|
|
}
|
|
}
|
|
|
|
/* 减少动画偏好 */
|
|
@media (prefers-reduced-motion: reduce) {
|
|
*,
|
|
*::before,
|
|
*::after {
|
|
animation-duration: 0.01ms !important;
|
|
animation-iteration-count: 1 !important;
|
|
transition-duration: 0.01ms !important;
|
|
scroll-behavior: auto !important;
|
|
}
|
|
|
|
.skill-level {
|
|
transition: none;
|
|
}
|
|
|
|
.project-card:hover {
|
|
transform: none;
|
|
}
|
|
}
|
|
|
|
/* 黑暗模式支持(系统级) */
|
|
@media (prefers-color-scheme: dark) {
|
|
/* 我们的主题已经是深色,所以不需要额外调整 */
|
|
/* 这里可以添加针对系统黑暗模式的微调 */
|
|
}
|
|
|
|
/* 横屏模式 */
|
|
@media (orientation: landscape) and (max-height: 500px) {
|
|
.hero {
|
|
min-height: auto;
|
|
padding: var(--spacing-xl) 0;
|
|
}
|
|
|
|
.hero .container {
|
|
grid-template-columns: 2fr 1fr;
|
|
}
|
|
|
|
.hero-title {
|
|
font-size: 2.5rem;
|
|
}
|
|
|
|
.image-placeholder {
|
|
width: 150px;
|
|
height: 150px;
|
|
font-size: 4rem;
|
|
}
|
|
}
|
|
|
|
/* 超大屏幕支持 */
|
|
@media (min-width: 1600px) {
|
|
.container {
|
|
max-width: 1400px;
|
|
}
|
|
|
|
.hero-title {
|
|
font-size: 4rem;
|
|
}
|
|
|
|
.section-title {
|
|
font-size: 3rem;
|
|
}
|
|
}
|
|
|
|
/* 触摸设备优化 */
|
|
@media (hover: none) and (pointer: coarse) {
|
|
.nav-link:hover::after {
|
|
width: 0;
|
|
}
|
|
|
|
.nav-link.active::after {
|
|
width: 100%;
|
|
}
|
|
|
|
.btn:hover,
|
|
.social-link:hover,
|
|
.project-link:hover {
|
|
transform: none;
|
|
}
|
|
|
|
.project-card:hover {
|
|
transform: none;
|
|
}
|
|
|
|
/* 增加触摸目标大小 */
|
|
.nav-link {
|
|
padding: 12px 0;
|
|
}
|
|
|
|
.btn {
|
|
padding: 16px 32px;
|
|
}
|
|
|
|
.social-link {
|
|
width: 48px;
|
|
height: 48px;
|
|
}
|
|
|
|
.project-link {
|
|
padding: 8px;
|
|
}
|
|
}
|
|
|
|
/* 性能优化:在低端设备上减少特效 */
|
|
@media (max-width: 1024px) and (prefers-reduced-data: reduce) {
|
|
.hero {
|
|
background: var(--color-primary);
|
|
}
|
|
|
|
.image-placeholder,
|
|
.avatar-placeholder {
|
|
background: var(--color-accent);
|
|
}
|
|
|
|
.skill-level {
|
|
background: var(--color-accent);
|
|
}
|
|
} |