/* 基础样式 */
* {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #95a9ce;
    color: #efefef;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: #efefef;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.menu {
    display: none;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    flex-direction: column;
    position: absolute;
    line-height: 2.4rem;
    font-size: 1.2rem;
    width: 2.4rem;
    left: 6px;
    top: 0;
}

/* 头部样式 */
header {
    height: 2.4rem;
    width: 100%;
    background-color: #1f6fc6;
    padding: 0.8rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    z-index: 1000;
}

header h1 {
    position: absolute;
    left: 30px;
    top: 0;
    font-size: 1.6rem;
    line-height: 2.4rem;
}

header nav ul {
    position: absolute;
    right: 10px;
    top: 0;
    line-height: 2.4rem;
}

header nav li {
    display: inline;
    margin: 0 0.6rem;
}

#language-selector {
    background-color: #1f6fc6;
    color: #efefef;
    border: 1px solid #efefef;
    border-radius: 5px;
    padding: 0.2rem 0.4rem;
    cursor: pointer;
}

#language-selector:focus {
    outline: none;
}

/* 头部内容样式 */
#head {
    background-color: #95a9ce;
    height: 100vh;
    background-image: url('image/backg-image-2.png');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-shadow: #1f6fc6 0 0 10px;
}

#head div {
    padding: 1rem;
    margin-left: 6vw;
}

#head h1 {
    margin-top: -20vh;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

#head h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

/* 动画样式 */
@keyframes lineFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animated-text {
    opacity: 0;
}

#head h1.animated-text {
    animation: lineFadeIn 1s ease-out 0.2s forwards;
}

#head h3.animated-text {
    animation: lineFadeIn 1s ease-out 0.4s forwards;
}

#head p .animated-text {
    animation: lineFadeIn 1s ease-out 0.6s forwards;
}

/* 新闻部分样式 */
main {
    position: relative; /* 添加相对定位，作为 #news 绝对定位的参考 */
    padding-top: 2.4rem; /* 考虑到头部是固定定位，添加内边距避免内容被遮挡 */
}

#news {
    position: absolute; 
    right: 80px;
    bottom: 260px;
    width: 320px;
    height: 40vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-shadow: #1f6fc6 0 0 10px;
    padding: 1rem;
    box-sizing: border-box; /* 确保内边距包含在元素总尺寸内 */
}

#all-news {
    min-height: calc(100vh - 6.4rem);
    background-color: #95a9ce;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-shadow: #1f6fc6 0 0 10px;
    padding: 1rem;
}

#all-news-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    width: 100%;
}

#all-news-container .news-item {
    position: relative;
    width: 300px;
    min-height: 200px;
    opacity: 1;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    border-radius: 8px;
    margin-bottom: 1rem;
}

#all-news-container .news-item h3,
#all-news-container .news-item p {
    transition: transform 0.3s ease;
}

#all-news-container .news-item:hover h3,
#all-news-container .news-item:hover p {
    transform: scale(1.05);
}

.news-slider {
    position: relative;
    width: 400px;
    border-radius: 12px;
    overflow: hidden;
}

.news-item {
    position: absolute;
    width: 100%;
    opacity: 0;
    left: 0;
    min-height: 200px;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    border-radius: 12px;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.news-item.active {
    position: relative;
    opacity: 1;
    transform: translateX(0);
}

.news-item.prev {
    opacity: 0;
    transform: translateX(-100%);
}

.news-item.next {
    opacity: 0;
    transform: translateX(100%);
}


#news-dots {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.news-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #95a9ce55;
    margin: 0 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.news-dot.active {
    background-color: #1f6fc666;
}

/* 服务部分样式 */
#services {
    background-color: #95a9ce;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-shadow: #1f6fc6 0 0 10px;
    padding: 1rem;
}

.services-container {
    display: flex;
    flex-direction: row;
}

.service {
    border: #efefef 1px solid;
    box-shadow: #efefef 0 0 5px;
    border-radius: 15px;
    padding: 1rem;
    margin: 1rem;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    background-color: #1f6fc655;
    border: #efefef 1px solid;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    transition: background-color 0.3s;
    font-size: 0.9rem;
}

.btn:hover {
    background-color: #ffffff44;
    text-decoration: none;
}

/* 页脚样式 */
footer {
    color: #afafaf;
    height: 4rem;
    text-align: center;
    padding: 0.5rem;
    background-color: #1f6fc6;
    font-size: 0.9rem;
}

/* 媒体查询 */
/* 针对小屏幕设备（手机）调整样式 */
@media (max-width: 550px) {
    header h1 {
        font-size: 1.4rem;
        left: 20px;
    }
    #head h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    #head h3 {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    .btn {
        padding: 0.5rem 1rem;
    }
    footer {
        padding: 1rem;
        font-size: 0.8rem;
    }
}

@media screen and (max-width: 768px) {
    .menu {
        display: block;
        line-height: 3rem;
    }
    header{
        height: 3rem;
    }
    header h1 {
        left: 50%;
        transform: translateX(-50%);
        text-align: center;
        line-height: 3rem;
    }
    header nav ul {
        background-color: #00000066;
        top: 3rem;
        left: -45%;
        height: 100vh;
        width: 45%;
        padding: 2rem;
        display: flex;
        flex-direction: column;
        position: absolute;
        transition: left 0.3s ease; /* 添加过渡效果 */
    }
    header nav ul.show {
        left: 0; /* 显示侧边栏 */
    }
    #head div {
        margin-left: 0;
    }
    #head h1 {
        margin-top: 5vh;
    }
    #head {
        align-items: center;
        text-align: center;
    }
    #news {
        position: relative;
        right: auto;
        bottom: auto;
        width: 100%;
        height: auto;
    }
    .news-dot {
        background-color: rgba(255, 255, 255, 0.5);
    }
    .news-dot.active {
        background-color: rgba(255, 255, 255, 1);
    }
    #all-news-container .news-item {
        width: 45%;
    }
    .services-container {
        flex-direction: column;
    }
    #language-selector {
        background: none;
    }
}

@media screen and (max-width: 550px)  {
    #all-news-container .news-item {
        width: 90%;
    }
}

.news-item h3,
.news-item p {
    transition: transform 0.3s ease; /* 添加过渡效果使放大更平滑 */
}

.news-item:hover h3,
.news-item:hover p {
    transform: scale(1.05); /* 鼠标悬停时文字放大 5%，可按需调整 */
}

/* 404 页面样式 */
section[style*="text-align: center; padding: 4rem;"] {
    background-color: #95a9ce;
    min-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

section[style*="text-align: center; padding: 4rem;"] h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

section[style*="text-align: center; padding: 4rem;"] p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}