:root {
    /* Layout */
    --border-radius: 3px;

    /* Font Sizes */
    --font-size-base: 15px;

    /* Colors - Light Mode */
    --bg-color: #fff;
    --text-color: #333;
    --text-secondary: #666;
    --border-color: #e0e0e0;
    --border-color-medium: #d0d0d0;
    --callout-bg: #f8f8f8;
    --callout-border: #d0d0d0;
    --link-color: #0066cc;
    --button-bg: #f8f8f8;
    --button-hover: #e8e8e8;
    --popup-bg: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

body.dark-mode {
    /* Colors - Dark Mode */
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --text-secondary: #999;
    --border-color: #404040;
    --border-color-medium: #404040;
    --callout-bg: #252525;
    --callout-border: #404040;
    --link-color: #6699ff;
    --button-bg: #252525;
    --button-hover: #303030;
    --popup-bg: #252525;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

body.text-small {
    --font-size-base: 13px;
}

body.text-large {
    --font-size-base: 20px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    background: var(--bg-color);
    font-size: var(--font-size-base);
}

main {
    max-width: 650px;
    margin: 0 auto;
    padding: 2rem 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    margin-bottom: 2rem;
    position: relative;
}

.profile-photo {
    position: absolute;
    top: 0;
    right: 0;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 10;
    transform: scale(1.5);
    transform-origin: top right;
    -webkit-mask-image: radial-gradient(circle at center, black 60%, transparent 70%);
    mask-image: radial-gradient(circle at center, black 60%, transparent 70%);
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

h1 {
    font-size: 1.75em;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9em;
}

nav {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

nav a {
    margin-right: 1.5rem;
    font-size: 0.85em;
}

nav a.active {
    font-weight: 600;
}

section {
    margin-bottom: 4rem;
}

.callout {
    border: 1px solid var(--callout-border);
    background: var(--callout-bg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
}

.site-links {
    margin-top: 2rem;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.filter-dropdown {
    font-size: 1.25rem;
    font-weight: 600;
    font-family: inherit;
    font-style: italic;
    color: var(--text-color);
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: auto;
    min-width: 0;
}

.filter-dropdown:hover {
    color: var(--link-color);
}

.filter-dropdown:focus {
    outline: none;
    color: var(--link-color);
}

p {
    margin-bottom: 1rem;
}

ul {
    list-style: none;
}

li {
    margin-bottom: 0.75rem;
}

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

a:hover {
    text-decoration: underline;
}

.connect {
    margin-top: auto;
    margin-bottom: 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.social-links {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    transition: color 0.2s ease;
}

.social-links a:hover {
    color: var(--link-color);
    text-decoration: none;
}

.social-links svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* Settings Icon and Popup */
.settings-icon {
    position: fixed;
    bottom: 1.5rem;
    right: calc(50% - 325px + 2rem);
    width: 40px;
    height: 40px;
    border: 1px solid var(--callout-border);
    background: var(--callout-bg);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: all 0.2s ease;
    z-index: 100;
    padding: 0;
}

.settings-icon:hover {
    background: var(--button-hover);
    transform: scale(1.05);
}

.settings-icon img {
    display: block;
    width: 20px;
    height: 20px;
}

.settings-popup {
    position: fixed;
    bottom: 5rem;
    right: calc(50% - 325px + 2rem);
    background: var(--popup-bg);
    border: 1px solid var(--border-color-medium);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 16px var(--shadow-color);
    z-index: 99;
    min-width: 200px;
}

.settings-popup.hidden {
    display: none;
}

.settings-popup h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.setting-group {
    margin-bottom: 1.25rem;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.setting-buttons {
    display: flex;
    gap: 0.5rem;
}

.setting-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color-medium);
    background: var(--popup-bg);
    color: var(--text-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.setting-btn:hover {
    background: var(--button-hover);
}

.setting-btn.active {
    background: var(--link-color);
    color: white;
    border-color: var(--link-color);
}

/* Dark mode is handled by CSS variables in body.dark-mode */

@media (max-width: 800px) {
    .settings-icon {
        right: 1.5rem;
    }

    .settings-popup {
        right: 1.5rem;
    }
}

@media (max-width: 600px) {
    main {
        padding: 3rem 1.5rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .social-links {
        flex-direction: column;
        gap: 1rem;
    }

    .profile-photo {
        width: 120px;
        height: 120px;
        transform: scale(1.3);
    }
}
