/* 扁平化科技蓝主题 */
:root {
    --tech-blue: #1a73e8;
    --tech-dark: #202124;
    --tech-light: #f8f9fa;
    --tech-gray: #5f6368;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    line-height: 1.6;
    color: var(--tech-dark);
    background-color: var(--tech-light);
}

/* 居中导航栏 */
header {
    background-color: white;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--tech-blue);
    margin-right: 0;
}

/* 桌面导航 */
.desktop-nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.desktop-nav a {
    color: var(--tech-gray);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.2s;
}

.desktop-nav a:hover,
.desktop-nav a.active {
    color: var(--tech-blue);
}

.desktop-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--tech-blue);
    transition: width 0.3s;
}

.desktop-nav a:hover::after {
    width: 100%;
}

/* 移动导航 */
.mobile-nav {
    display: none;
    width: 100%;
    background-color: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.mobile-nav ul {
    list-style: none;
}

.mobile-nav li {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.mobile-nav a {
    color: var(--tech-dark);
    text-decoration: none;
    display: block;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--tech-blue);
    font-size: 1.8rem;
    cursor: pointer;
}

/* 主要内容区域 */
main {
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section {
    margin-bottom: 3rem;
}

.section-title {
    color: var(--tech-blue);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--tech-blue);
    font-size: 1.8rem;
}

/* 卡片样式 */
.card {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    overflow: hidden;
}

/* 左图右文布局 */
.card.left-image-layout {
    display: grid;
    grid-template-columns: 45% 1fr;
    gap: 2rem;
    align-items: center;
}

/* 右图左文布局 */
.card.right-image-layout {
    display: grid;
    grid-template-columns: 1fr 45%;
    gap: 2rem;
    align-items: center;
}

/* 上下图文布局 */
.card.vertical-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2rem;
}

.card.vertical-layout .card-image {
    width: 100%;
    max-width: 500px;
    margin-bottom: 1rem;
}

.card-image {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--tech-light);
    border-radius: 8px;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.feature-group {
    background-color: var(--tech-light);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.feature-group h3 {
    color: var(--tech-blue);
    margin-bottom: 0.8rem;
}

.feature-group p {
    color: var(--tech-gray);
    line-height: 1.6;
}

.card-content ul {
    list-style: none;
    padding: 0;
}

.card-content ul li {
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: var(--tech-light);
    border-radius: 8px;
    transition: transform 0.2s;
}

.card-content ul li:hover {
    transform: translateX(5px);
}

.card-content ul li strong {
    color: var(--tech-blue);
    display: inline-block;
    margin-right: 0.5rem;
}

/* 响应式布局调整 */
@media (max-width: 768px) {
    .card.left-image-layout,
    .card.right-image-layout {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .card-image {
        margin: 0 auto;
        max-width: 400px;
    }
    
    .card-content {
        padding: 1rem 0;
    }
}

/* 左图右文布局 */
.card.left-image-layout {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.card.left-image-layout .card-image {
    flex: 0 0 40%;
}

.card.left-image-layout .card-content {
    flex: 1;
}

/* 右图左文布局 */
.card.right-image-layout {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 2rem;
}

.card.right-image-layout .card-image {
    flex: 0 0 40%;
}

.card.right-image-layout .card-content {
    flex: 1;
}

/* 上下图文布局 */
.card.vertical-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
}

.card.vertical-layout .card-image {
    width: 60%;
    max-width: 400px;
}

/* 响应式布局 */
@media (max-width: 768px) {
    .card.left-image-layout,
    .card.right-image-layout {
        flex-direction: column;
        text-align: center;
    }
    
    .card.left-image-layout .card-image,
    .card.right-image-layout .card-image {
        flex: 0 0 auto;
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }
}

.card-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.card h2 {
    color: var(--tech-dark);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.card h3 {
    color: var(--tech-blue);
    margin: 1.5rem 0 0.5rem;
    font-size: 1.2rem;
}

.card ul, .card ol {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.card li {
    margin-bottom: 0.5rem;
    color: var(--tech-gray);
}

/* 尺子容器 */
.ruler-container {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin: 2rem 0;
}

.calibration-input {
    background-color: #f1f8fe;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.calibration-input label {
    font-weight: 500;
    display: block;
    margin-bottom: 1rem;
    color: var(--tech-dark);
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 1rem 0;
}

.input-group input {
    padding: 0.8rem;
    border: 1px solid #dadce0;
    border-radius: 4px;
    width: 120px;
    font-size: 1rem;
}

.input-group span {
    color: var(--tech-gray);
    font-weight: 500;
}

.calibration-input button {
    padding: 0.8rem 1.5rem;
    background-color: var(--tech-blue);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.calibration-input button:hover {
    background-color: #1557b0;
}

.measurement-result {
    font-size: 1.2rem;
    color: var(--tech-dark);
    margin-top: 1rem;
}

.measurement-result span {
    font-weight: 700;
    color: var(--tech-blue);
}

#ruler-canvas {
    width: 100%;
    height: 100px;
    background-color: white;
    border: 1px solid #ddd;
    cursor: pointer;
}

footer {
    text-align: center;
    padding: 2rem;
    background-color: var(--tech-dark);
    color: white;
    margin-top: 3rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-container {
        justify-content: space-between;
    }
    
    .desktop-nav {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .mobile-nav.active {
        display: block;
    }
    
    .card {
        padding: 1.5rem;
    }
}