/**
 * PianoChords 全局样式
 * 响应式、现代简洁设计
 */

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #1a1a2e;
    --color-accent: #e63946;
    --color-accent-light: #ff6b6b;
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-text: #2d3436;
    --color-text-light: #636e72;
    --color-border: #dfe6e9;
    --color-key-white: #ffffff;
    --color-key-black: #2d3436;
    --color-key-active: #e63946;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-heading: 'Georgia', serif;
    --max-width: 1200px;
    --header-height: 64px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--color-accent-light);
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    line-height: 1.3;
    color: var(--color-primary);
}

h1 { font-size: 2.2rem; margin-bottom: 1rem; }
h2 { font-size: 1.6rem; margin: 2rem 0 1rem; }
h3 { font-size: 1.3rem; margin: 1.5rem 0 0.8rem; }

p { margin-bottom: 1rem; }

img { max-width: 100%; height: auto; }

/* === Layout === */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.site-main {
    flex: 1;
    padding: 2rem 0;
}

/* === Header === */
.site-header {
    background: var(--color-primary);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.site-header .container {
    display: flex;
    align-items: center;
    height: var(--header-height);
    gap: 1.5rem;
}

.site-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    font-family: var(--font-heading);
    white-space: nowrap;
}

.site-logo:hover {
    color: var(--color-accent-light);
}

.site-nav {
    flex: 1;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    margin: 5px 0;
    transition: 0.3s;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 0.2rem;
}

.nav-list a {
    color: rgba(255,255,255,0.8);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-list a:hover,
.nav-list a.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.lang-switcher select {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}

.lang-switcher select option {
    background: var(--color-primary);
    color: #fff;
}

/* === Hero === */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-intro {
    font-size: 1.15rem;
    color: var(--color-text-light);
    max-width: 700px;
    margin: 0 auto;
}

/* === Content Section === */
.content-section {
    background: var(--color-surface);
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* === Chord Grid === */
.chord-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.chord-card {
    display: block;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    color: var(--color-text);
}

.chord-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--color-accent);
}

.chord-card-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--color-primary);
    margin-bottom: 0.3rem;
}

.chord-card-notes {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
}

.chord-card-diagram {
    height: 40px;
    margin-top: 0.5rem;
}

/* === Root Grid & Type Grid === */
.root-grid,
.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 1rem 0;
}

.root-card,
.type-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.2rem;
}

.root-card h4,
.type-card h4 {
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
    color: var(--color-accent);
}

.root-card ul,
.type-card ul {
    list-style: none;
}

.root-card li,
.type-card li {
    padding: 0.2rem 0;
}

.root-card a,
.type-card a {
    font-size: 0.9rem;
}

/* === FAQ === */
.faq-section .faq-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.faq-section .faq-item:last-child {
    border-bottom: none;
}

.faq-item h3 {
    color: var(--color-primary);
    font-size: 1.1rem;
}

/* === Chord Page === */
.chord-page {
    max-width: 900px;
    margin: 0 auto;
}

.breadcrumb {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

.breadcrumb a {
    color: var(--color-text-light);
}

.breadcrumb a:hover {
    color: var(--color-accent);
}

.chord-diagram-section {
    background: var(--color-surface);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.piano-keyboard {
    display: inline-block;
    width: 100%;
    max-width: 600px;
}

.chord-info {
    background: var(--color-surface);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.info-block {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.info-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.chord-notes-list {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

.fingering-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.fingering-numbers {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

/* === Related Chords === */
.related-chords {
    background: var(--color-surface);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.related-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.chord-mini-card {
    display: inline-block;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    color: var(--color-text);
    transition: all 0.2s;
}

.chord-mini-card:hover {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

.back-link {
    margin-top: 1.5rem;
}

/* === Footer === */
.site-footer {
    background: var(--color-primary);
    color: rgba(255,255,255,0.8);
    padding: 3rem 0 1.5rem;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-about h3,
.footer-links h3,
.footer-languages h3 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.footer-links ul,
.footer-languages ul {
    list-style: none;
}

.footer-links li,
.footer-languages li {
    padding: 0.3rem 0;
}

.footer-links a,
.footer-languages a {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

.footer-links a:hover,
.footer-languages a:hover {
    color: #fff;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
}

/* === Responsive === */
@media (max-width: 768px) {
    .site-header .container {
        flex-wrap: wrap;
    }
    
    .nav-toggle {
        display: block;
    }
    
    .nav-list {
        display: none;
        width: 100%;
        flex-direction: column;
        padding-top: 1rem;
    }
    
    .nav-list.open {
        display: flex;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .content-section {
        padding: 1.2rem;
    }
    
    .chord-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .root-grid,
    .type-grid {
        grid-template-columns: 1fr;
    }
    
    .fingering-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.3rem; }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .hero {
        padding: 2rem 0 1rem;
    }
    
    .chord-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === Play Chord Button === */
.play-chord-btn {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.6rem 1.5rem;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.play-chord-btn:hover {
    background: var(--color-accent-light);
    transform: scale(1.05);
}

.play-chord-btn:active {
    transform: scale(0.98);
}

/* 迷你键盘点击提示 */
.chord-card-diagram svg {
    transition: opacity 0.2s;
}

.chord-card-diagram:hover svg {
    opacity: 0.85;
}