:root {
    --primary-color: #2c3e50;
    --secondary-color: #ecf0f1;
    --accent-color: #3498db;
    --text-color: #333;
    --card-bg: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --header-text: #ffffff;
    --hero-overlay: rgba(44, 62, 80, 0.8);
}

[data-theme="dark"] {
    --primary-color: #1a252f;
    --secondary-color: #2c3e50;
    --accent-color: #3498db;
    --text-color: #ecf0f1;
    --card-bg: #34495e;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --header-text: #ecf0f1;
    --hero-overlay: rgba(0, 0, 0, 0.7);
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--secondary-color);
    color: var(--text-color);
    background-image: url('data:image/svg+xml,%3Csvg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%239C92AC" fill-opacity="0.05"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 960px;
    margin: auto;
    overflow: hidden;
    padding: 0 2rem;
}

header {
    background: var(--primary-color);
    color: var(--header-text);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: background-color 0.3s ease;
}

header h1 {
    float: left;
    margin: 0;
    font-weight: 700;
}

header nav {
    float: right;
    display: flex;
    align-items: center;
}

header nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

header nav ul li {
    display: inline;
    margin-left: 20px;
}

header a {
    color: var(--header-text);
    text-decoration: none;
    font-weight: 300;
    transition: color 0.3s ease;
}

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

#theme-toggle {
    background: none;
    border: none;
    color: var(--header-text);
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 20px;
    padding: 5px;
    transition: transform 0.3s ease, color 0.3s ease;
}

#theme-toggle:hover {
    color: var(--accent-color);
    transform: rotate(15deg);
}

#hero {
    background: linear-gradient(var(--hero-overlay), var(--hero-overlay)), url('https://images.unsplash.com/photo-1505664194779-8be3f07e0df0?q=80&w=2070&auto=format&fit=crop') center/cover no-repeat;
    color: #fff;
    text-align: center;
    padding: 6rem 0;
    transition: background 0.3s ease;
}

#hero h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.content-section {
    padding: 4rem 0;
}

.content-section h3 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.card {
    background: var(--card-bg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 5px 25px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* Contact Form Styles */
.contact-form .form-group {
    margin-bottom: 1.5rem;
}

.contact-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    background-color: var(--secondary-color);
    color: var(--text-color);
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.contact-form input[type="text"]:focus,
.contact-form input[type="email"]:focus,
.contact-form textarea:focus {
    border-color: var(--accent-color);
    outline: none;
    background-color: var(--card-bg);
}

.contact-form textarea {
    resize: vertical;
}

.contact-form .submit-button {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background-color: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.contact-form .submit-button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

/* Latest Precedents Section */
.section-desc {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-color);
    opacity: 0.8;
}

.precedent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.precedent-card {
    border-left: 5px solid var(--accent-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.precedent-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.precedent-card .badge {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.8rem;
}

[data-theme="dark"] .precedent-card .badge {
    background-color: #455a64; /* Slightly lighter than card bg */
    color: #fff;
}

.precedent-card .date {
    color: #7f8c8d;
    font-size: 0.85rem;
}

[data-theme="dark"] .precedent-card .date {
    color: #bdc3c7;
}

.precedent-card h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.precedent-card .summary-title {
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.precedent-card .summary-text {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
    flex-grow: 1;
}

.precedent-card .read-more {
    align-self: flex-start;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.precedent-card .read-more:hover {
    color: #2980b9;
}

.more-link-container {
    text-align: center;
    margin-top: 2rem;
    margin-bottom: 3rem; /* Add some space below the button container for desktop */
}

.btn-secondary {
    display: inline-block;
    padding: 12px 25px; /* Slightly more padding */
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    border-radius: 28px; /* Slightly more rounded */
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem; /* Consistent font size */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); /* Subtle shadow */
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: var(--accent-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2); /* Enhanced shadow on hover */
    transform: translateY(-2px); /* Slight lift on hover */
}

.btn-secondary .ko-ref {
    display: inline;
    font-size: 0.8em; /* Adjusted relative to button font size */
    margin-left: 8px;
    vertical-align: middle;
    color: var(--accent-color); /* Keep accent color for desktop, but slightly muted */
    opacity: 0.7;
}

[data-theme="dark"] .btn-secondary .ko-ref {
    color: #fff; /* White for dark mode hover */
    opacity: 0.8;
}
/* Korean Reference Text Styling */
.ko-ref {
    display: block;
    font-size: 0.85em;
    color: #7f8c8d; /* Muted gray */
    font-weight: 400;
    margin-top: 4px;
}

h1 .ko-ref, h3 .ko-ref, h4 .ko-ref, h5 .ko-ref {
    display: inline-block;
    font-size: 0.6em;
    margin-left: 8px;
    vertical-align: middle;
    opacity: 0.8;
}

h3 .ko-ref {
    display: block;
    font-size: 0.6em;
    margin-top: 5px;
    margin-left: 0;
}

.submit-button .ko-ref {
    display: inline;
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.8);
    margin-left: 5px;
}

[data-theme="dark"] .ko-ref {
    color: #bdc3c7; /* Lighter gray for dark mode */
}

.card h4 {
    color: var(--accent-color);
    margin-top: 0;
    font-weight: 700;
}

footer {
    background: var(--primary-color);
    color: #fff;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
}

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

    header {
        padding: 0.5rem 0;
    }

    header h1 {
        float: none;
        text-align: center;
        margin-bottom: 0.5rem;
        font-size: 1.3rem;
    }
    
    header h1 .ko-ref {
        display: none; /* Hide subtitle on mobile for cleaner look */
    }

    header nav {
        float: none;
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
    }

    header nav ul {
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0;
        padding: 0;
        gap: 15px; /* Spacing between items */
        flex-wrap: nowrap;
        overflow-x: auto; /* Allow scrolling on very small screens */
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px; /* For scrollbar spacing if needed */
    }

    header nav ul li {
        display: inline-block;
        margin: 0; /* Use gap instead */
        flex-shrink: 0;
    }
    
    header nav ul li a {
        font-size: 0.9rem;
        font-weight: 500;
        padding: 5px 0;
    }

    #theme-toggle {
        margin-left: 15px;
        font-size: 1rem;
        padding: 0;
    }

    #hero h2 {
        font-size: 1.8rem;
    }
    
    /* Improve card padding on mobile */
    .card {
        padding: 1.5rem;
    }

    /* Mobile improvements for buttons */
    .more-link-container {
        margin-top: 1.5rem;
        padding: 0;
        margin-bottom: 2rem;
    }

    .btn-secondary {
        display: block;
        max-width: 100%;
        width: auto;
        margin: 0.5rem auto;
        padding: 10px 15px; /* Slightly reduced padding */
        font-size: 1rem;
        background-color: var(--accent-color);
        color: #fff;
        border: none;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        transform: translateY(0);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        line-height: 1.4; /* Ensure good line spacing */
    }

    .btn-secondary .ko-ref {
        display: block; /* Force new line for Korean text */
        font-size: 0.75rem; /* Smaller font for Korean */
        color: rgba(255, 255, 255, 0.9);
        margin-top: 2px; /* Small spacing from English text */
    }

    .btn-secondary .fas.fa-external-link-alt {
        font-size: 0.75rem; /* Smaller icon size */
        margin-left: 5px;
    }
    
    .btn-secondary:active {
        transform: translateY(2px);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
}