/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c5aa0;
    --secondary-color: #ff6b6b;
    --accent-color: #4ecdc4;
    --text-dark: #2d3748;
    --text-light: #4a5568;
    --bg-light: #f7fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navigation */
.navbar {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
    text-decoration: none;
}

.logo-icon {
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link:hover {
    color: var(--primary-color);
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--text-dark);
    margin: 3px 0;
    transition: var(--transition);
}

/* Hero Section */
.hero {
    padding: 120px 0 80px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    text-align: center;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.cta-button {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Names Section */
.names-section {
    padding: 80px 0;
    background: var(--bg-white);
}

.names-section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--primary-color);
}

.alphabet-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 3rem;
}

.letter-btn {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    min-width: 50px;
}

.letter-btn:hover,
.letter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.names-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.name-card {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.name-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.name-card h3 {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.name-romanization {
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 0.75rem;
}

.name-meaning {
    color: var(--text-dark);
    font-size: 0.9rem;
}

/* Article Section */
.article-section {
    padding: 80px 0;
    background: var(--bg-light);
}

.main-article {
    background: var(--bg-white);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    max-width: 900px;
    margin: 0 auto;
}

.main-article h2 {
    color: var(--primary-color);
    font-size: 2.25rem;
    margin-bottom: 2rem;
}

.main-article h3 {
    color: var(--text-dark);
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
}

.main-article h4 {
    color: var(--text-dark);
    font-size: 1.25rem;
    margin: 1.5rem 0 1rem;
}

.main-article p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

.main-article a {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
}

.main-article a:hover {
    color: var(--secondary-color);
}

/* Blockquotes */
blockquote {
    background: var(--bg-light);
    border-left: 4px solid var(--accent-color);
    padding: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    border-radius: 0 10px 10px 0;
}

/* Tables */
.names-table,
.regional-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: var(--bg-white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.names-table th,
.names-table td,
.regional-table th,
.regional-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.names-table th,
.regional-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.names-table tr:hover,
.regional-table tr:hover {
    background: var(--bg-light);
}

/* Lists */
.highlight-list li {
    margin-bottom: 0.5rem;
    position: relative;
    padding-left: 1.5rem;
}

.highlight-list li::before {
    content: '🔸';
    position: absolute;
    left: 0;
}

/* Sources */
.sources {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: 10px;
    margin-top: 3rem;
}

.sources h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.sources ol li {
    margin-bottom: 0.5rem;
}

/* Related Articles */
.related-articles {
    padding: 80px 0;
    background: var(--bg-white);
}

.related-articles h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--primary-color);
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.article-card {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: 15px;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.article-card h3 {
    margin-bottom: 1rem;
}

.article-card h3 a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1.25rem;
}

.article-card h3 a:hover {
    color: var(--secondary-color);
}

.article-card p {
    color: var(--text-light);
    margin: 0;
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #cbd5e0;
    text-decoration: none;
    transition: var(--transition);
}

.footer-section ul li a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #4a5568;
    color: #cbd5e0;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

/* Names Section */
.names-section {
    padding: 4rem 0;
    background: linear-gradient(135deg, #f8faff 0%, #e6f2ff 100%);
}

.names-section h2 {
    text-align: center;
    margin-bottom: 1rem;
    color: #1e3a8a;
    font-size: 2.5rem;
}

.section-description {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 3rem;
    font-size: 1.1rem;
    color: #64748b;
    line-height: 1.6;
}

/* Alphabet Filter */
.alphabet-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.filter-btn {
    background: white;
    border: 2px solid #e2e8f0;
    color: #64748b;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    min-width: 40px;
}

.filter-btn:hover {
    border-color: #4ecdc4;
    color: #2c5aa0;
    transform: translateY(-2px);
}

.filter-btn.active {
    background: #2c5aa0;
    border-color: #2c5aa0;
    color: white;
}

/* Names Counter */
.names-counter {
    text-align: center;
    margin-bottom: 2rem;
}

.names-counter span {
    background: #2c5aa0;
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Names Grid */
.names-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.name-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.name-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4ecdc4, #2c5aa0);
}

.name-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(44, 90, 160, 0.1);
    border-color: #4ecdc4;
}

.korean-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e3a8a;
    margin-bottom: 0.5rem;
    font-family: 'Noto Sans KR', sans-serif;
}

.romanization {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 0.75rem;
    font-style: italic;
}

.meaning {
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.4;
}

.name-letter {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #4ecdc4;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

/* Loading Animation */
.loading {
    text-align: center;
    padding: 3rem;
    color: #64748b;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #4ecdc4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No names message */
.no-names {
    text-align: center;
    padding: 3rem;
    color: #64748b;
    font-size: 1.1rem;
    grid-column: 1 / -1;
}

/* Cookie Notice */
.cookie-notice {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    background: var(--text-dark);
    color: white;
    padding: 1rem;
    border-radius: 10px;
    max-width: 350px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
}

.cookie-notice.show {
    transform: translateY(0);
    opacity: 1;
}

.cookie-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cookie-content p {
    margin: 0;
    font-size: 0.9rem;
}

.cookie-content a {
    color: var(--accent-color);
}

.cookie-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    align-self: flex-start;
}

.cookie-btn:hover {
    background: var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--bg-white);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: 2rem;
        transition: var(--transition);
        box-shadow: var(--shadow-md);
    }

    .nav-menu.active {
        left: 0;
    }

    .hamburger {
        display: flex;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }

    /* Names Section Mobile */
    .names-section h2 {
        font-size: 2rem;
    }
    
    .alphabet-filter {
        gap: 0.3rem;
        padding: 0 0.5rem;
    }
    
    .filter-btn {
        padding: 0.4rem 0.8rem;
        min-width: 35px;
        font-size: 0.9rem;
    }
    
    .names-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .name-card {
        padding: 1.25rem;
    }
    
    .korean-name {
        font-size: 1.3rem;
    }

    .hero {
        padding: 100px 0 60px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .names-section,
    .article-section,
    .related-articles {
        padding: 60px 0;
    }

    .main-article {
        padding: 2rem 1.5rem;
    }

    .names-grid {
        grid-template-columns: 1fr;
    }

    .articles-grid {
        grid-template-columns: 1fr;
    }

    .alphabet-nav {
        gap: 0.25rem;
    }

    .letter-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
        min-width: 40px;
    }

    .names-table,
    .regional-table {
        font-size: 0.9rem;
    }

    .names-table th,
    .names-table td,
    .regional-table th,
    .regional-table td {
        padding: 0.75rem 0.5rem;
    }

    .cookie-notice {
        left: 0.5rem;
        right: 0.5rem;
        max-width: none;
    }

    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .main-article {
        padding: 1.5rem 1rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .names-section h2,
    .related-articles h2 {
        font-size: 2rem;
    }

    .main-article h2 {
        font-size: 1.75rem;
    }

    .main-article h3 {
        font-size: 1.25rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .back-to-top,
    .cookie-notice {
        display: none;
    }

    .hero {
        background: none;
        color: var(--text-dark);
    }

    .main-article {
        box-shadow: none;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus,
.nav-link:focus,
.letter-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000080;
        --secondary-color: #cc0000;
        --text-dark: #000000;
        --border-color: #000000;
    }
}
