/* Shared site chrome: theme, reset, header, nav, theme toggle, mobile menu.
   Page-specific styles stay inline in each page. */

:root {
    --bg-color: #fafafa;
    --bg-gradient: linear-gradient(135deg, #fafafa 0%, #f0f4f8 100%);
    --text-color: #1a1a1a;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --accent-color: #2f7fc9;
    --accent-hover: #246db8;
    --link-color: #2f7fc9;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --card-shadow: none;
    --card-shadow-hover: none;
    --header-bg: rgba(250, 250, 250, 0.9);
    --toggle-bg: #e2e8f0;
    --toggle-icon: #4a5568;
    --hover-bg: #f1f5f9;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --text-color: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent-color: #4a9edc;
    --accent-hover: #6cb5e9;
    --link-color: #4a9edc;
    --border-color: #334155;
    --card-bg: #1e293b;
    --card-shadow: none;
    --card-shadow-hover: none;
    --header-bg: rgba(15, 23, 42, 0.9);
    --toggle-bg: #334155;
    --toggle-icon: #cbd5e1;
    --hover-bg: rgba(255, 255, 255, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-color);
    background: var(--bg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 30px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    transition: padding 0.3s ease;
}

header.scrolled .header-inner {
    padding: 12px 30px;
}

.logo {
    font-size: 1.8rem;
    font-weight: 600;
    margin-right: 50px;
    transition: font-size 0.3s ease;
    letter-spacing: -0.02em;
}

header.scrolled .logo {
    font-size: 1.35rem;
}

.logo a {
    text-decoration: none;
    color: var(--text-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

nav {
    display: flex;
    align-items: center;
    height: 100%;
}

nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 30px;
    margin: 0;
    padding: 0;
}

nav li {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

nav a, nav a:link, nav a:visited {
    text-decoration: none !important;
    color: #1a1a1a !important;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1;
    display: inline-block;
}

nav a:hover {
    text-decoration: underline !important;
    text-underline-offset: 4px;
    color: #1a1a1a !important;
}

nav a.active {
    text-decoration: underline !important;
    text-underline-offset: 4px;
}

nav a .external-icon {
    width: 10px;
    height: 10px;
    margin-left: 3px;
    vertical-align: middle;
    position: relative;
    top: -1px;
    fill: currentColor;
    opacity: 0.5;
}

[data-theme="dark"] nav a, [data-theme="dark"] nav a:link, [data-theme="dark"] nav a:visited, [data-theme="dark"] nav a:hover {
    color: #e5e5e5 !important;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    background: var(--toggle-bg);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.2s ease, width 0.3s ease, height 0.3s ease, top 0.3s ease;
}

.theme-toggle.scrolled {
    width: 34px;
    height: 34px;
    top: 15px;
}

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

.theme-toggle:hover {
    transform: scale(1.1);
}

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

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

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

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-color);
    margin: 5px 0;
    transition: all 0.3s ease;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 30px 80px;
}

@media (max-width: 900px) {
    .header-inner {
        padding: 18px 25px;
    }

    header.scrolled .header-inner {
        padding: 12px 25px;
    }

    main {
        padding: 50px 25px 70px;
    }

    nav ul {
        gap: 20px;
    }

}

@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    .header-inner {
        padding: 15px 20px;
    }

    header.scrolled .header-inner {
        padding: 12px 20px;
    }

    .logo {
        font-size: 1.5rem;
    }

    header.scrolled .logo {
        font-size: 1.25rem;
    }

    .menu-toggle {
        display: block;
        order: 2;
    }

    .header-right {
        gap: 15px;
    }

    nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-color);
        padding: 80px 30px 30px;
        transition: right 0.3s ease;
        box-shadow: -5px 0 20px rgba(0,0,0,0.1);
        z-index: 99;
        display: block;
    }

    nav.open {
        right: 0;
    }

    nav ul {
        flex-direction: column;
        gap: 0;
        align-items: stretch;
    }

    nav li {
        display: block;
        border-bottom: 1px solid var(--border-color);
    }

    nav a {
        display: block;
        padding: 15px 0;
        font-size: 1.1rem;
    }

    nav a:hover, nav a.active {
        text-decoration: none !important;
    }

    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 98;
    }

    .nav-overlay.open {
        display: block;
    }

    .theme-toggle {
        top: 15px;
        right: 15px;
        width: 36px;
        height: 36px;
    }

    main {
        padding: 40px 20px 60px;
    }

}

@media (max-width: 480px) {
    .header-inner {
        padding: 12px 15px;
    }

    main {
        padding: 30px 15px 50px;
    }

}

