/* CSS Variables - Light Theme (default) */
:root {
    --bg-primary: #f5f5f5;
    --bg-card: #ffffff;
    --bg-code: #f4f4f4;
    --bg-navbar: #2c3e50;
    --bg-footer: #2c3e50;
    --badge-github-bg: #333;

    --text-primary: #333;
    --text-secondary: #555;
    --text-muted: #666;
    --text-date: #7f8c8d;
    --text-heading: #2c3e50;
    --text-navbar: #ecf0f1;
    --text-footer: #ecf0f1;

    --accent-primary: #3498db;
    --accent-hover: #2980b9;

    --border-color: #ecf0f1;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
}

/* Dark Theme - explicit toggle */
[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-card: #16213e;
    --bg-code: #0f0f1a;
    --bg-navbar: #0f0f1a;
    --bg-footer: #0f0f1a;
    --badge-github-bg: #555;

    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-date: #a1a1aa;
    --text-heading: #f4f4f5;
    --text-navbar: #e4e4e7;
    --text-footer: #a1a1aa;

    --accent-primary: #60a5fa;
    --accent-hover: #3b82f6;

    --border-color: #374151;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.4);
}

/* Dark Theme - system preference (when no manual override set) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #1a1a2e;
        --bg-card: #16213e;
        --bg-code: #0f0f1a;
        --bg-navbar: #0f0f1a;
        --bg-footer: #0f0f1a;
        --badge-github-bg: #555;

        --text-primary: #e4e4e7;
        --text-secondary: #a1a1aa;
        --text-muted: #71717a;
        --text-date: #a1a1aa;
        --text-heading: #f4f4f5;
        --text-navbar: #e4e4e7;
        --text-footer: #a1a1aa;

        --accent-primary: #60a5fa;
        --accent-hover: #3b82f6;

        --border-color: #374151;
        --shadow-color: rgba(0, 0, 0, 0.3);
        --shadow-hover: rgba(0, 0, 0, 0.4);
    }
}

/* Reset and Base Styles */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background-color: var(--bg-navbar);
    padding: 1rem 0;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Hamburger button */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 4px;
    color: var(--text-navbar);
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--text-navbar);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}

.hamburger-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

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

.hamburger-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.hamburger:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-brand h1 {
    color: #fff;
    font-size: 1.5rem;
}

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

.nav-menu a {
    color: var(--text-navbar);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--accent-primary);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-navbar);
    transition: background-color 0.3s;
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .sun-icon {
        display: block;
    }
    :root:not([data-theme="light"]) .theme-toggle .moon-icon {
        display: none;
    }
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

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

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Page Header */
.page-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 0;
    text-align: center;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Features Section */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.feature-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-color);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.feature-card h2 {
    color: var(--text-heading);
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Button */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--accent-primary);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
    font-weight: 500;
}

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

/* About Section */
.about {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-color);
    margin: 3rem 0;
}

.about h2 {
    color: var(--text-heading);
    margin-bottom: 1rem;
}

/* Blog Posts */
.blog-posts {
    margin: 3rem 0;
}

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

.blog-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.blog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.blog-meta .date {
    color: var(--text-date);
    font-size: 0.9rem;
}

.blog-meta .tag {
    background-color: var(--accent-primary);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.blog-card h2 {
    color: var(--text-heading);
    margin-bottom: 0.5rem;
}

.blog-card h2 a {
    color: var(--text-heading);
    text-decoration: none;
    transition: color 0.3s;
}

.blog-card h2 a:hover {
    color: var(--accent-primary);
}

.blog-card p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.read-more {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.read-more:hover {
    color: var(--accent-hover);
}

/* Blog Post */
.blog-post {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-color);
    margin: 3rem 0;
}

.post-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.post-header h1 {
    color: var(--text-heading);
    font-size: 2rem;
    margin-top: 1rem;
}

.post-content h2 {
    color: var(--text-heading);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.post-content h3 {
    color: var(--text-heading);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.post-content p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.post-content ul,
.post-content ol {
    margin: 1rem 0 1rem 2rem;
    color: var(--text-secondary);
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-content pre {
    background-color: var(--bg-code);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1rem 0;
}

.post-content code {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.post-content p code,
.post-content li code {
    background-color: var(--bg-code);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

.post-content a {
    color: var(--accent-primary);
    text-decoration: none;
}

.post-content a:hover {
    text-decoration: underline;
}

.post-content blockquote {
    border-left: 4px solid var(--accent-primary);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-muted);
    font-style: italic;
}

.post-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

.post-content strong {
    color: var(--text-heading);
}

.post-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
}

.back-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--accent-hover);
}

.post-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Share Buttons */
.share-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.share-label {
    font-weight: 500;
    color: var(--text-heading);
}

.share-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--accent-primary);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.share-btn:hover {
    background-color: var(--accent-hover);
}

.share-twitter {
    background-color: #000;
}

.share-twitter:hover {
    background-color: #333;
}

.share-facebook {
    background-color: #1877f2;
}

.share-facebook:hover {
    background-color: #166fe5;
}

.share-linkedin {
    background-color: #0a66c2;
}

.share-linkedin:hover {
    background-color: #004182;
}

.share-copy {
    background-color: #6c757d;
}

.share-copy:hover {
    background-color: #5a6268;
}

/* Exchange Section */
.exchange-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin: 3rem 0;
    align-items: start;
}

.exchange-info {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.exchange-info h2 {
    color: var(--text-heading);
    margin-bottom: 1rem;
}

.exchange-info p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.features-list {
    margin-top: 1.5rem;
}

.feature-item {
    padding: 0.5rem 0;
    color: var(--text-heading);
    font-weight: 500;
}

.widget-container {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

.swap-widget {
    width: 404px;
    height: 536px;
    border-radius: 20px;
    border: none;
}

/* Footer */
footer {
    background-color: var(--bg-footer);
    color: var(--text-footer);
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-badges {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.badge-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    transition: opacity 0.3s;
}

.badge-link:hover {
    opacity: 0.85;
}

.badge-link svg {
    flex-shrink: 0;
}

.badge-kofi {
    background-color: #ff5e5b;
}

.badge-github {
    background-color: var(--badge-github-bg);
}

/* FAQ Section */
.faq-section {
    margin: 4rem 0;
    padding: 3rem 0;
}

.faq-section h2 {
    color: var(--text-heading);
    text-align: center;
    margin-bottom: 2rem;
}

.faq-item {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.faq-item h3 {
    color: var(--text-heading);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.faq-item p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 0;
        background-color: var(--bg-navbar);
        padding: 0.5rem 0;
        margin-top: 0.5rem;
    }

    .nav-menu.nav-open {
        display: flex;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a {
        display: block;
        padding: 0.6rem 0;
        text-align: center;
    }

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

    .exchange-section {
        grid-template-columns: 1fr;
    }

    .swap-widget {
        width: 100%;
        max-width: 404px;
        height: 617px;
    }

    .blog-post {
        padding: 1.5rem;
    }

    .share-buttons {
        justify-content: center;
    }

    .share-label {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.5rem;
    }

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

    .share-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
}
