:root {
    /* Light mode (default) */
    --primary-color: #4a7ba7;
    --secondary-color: #083d77;
    --accent-color: rgb(35, 176, 255);
    --accent-alpha-20: rgba(35, 176, 255, .2);
    --accent-alpha-50: rgba(35, 176, 255, .5);
    --accent-alpha-70: rgba(35, 176, 255, .7);
    --background: whitesmoke;
    --color: #333333;
    --light-color: whitesmoke;
    --dark-color: #333333;
    --border-color: rgba(0, 0, 0, .1);
    --footnote-color: rgba(0, 0, 0, .5);
    --callout-background: rgba(0, 0, 0, .1);
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --code-background: #f7f7f7;
    --form-background: white;
    --post-background: white;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Dark mode styles */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: rgb(35, 176, 255);
        --secondary-color: rgb(100, 195, 255);
        --accent-color: rgb(35, 176, 255);
        --accent-alpha-20: rgba(35, 176, 255, .2);
        --accent-alpha-50: rgba(35, 176, 255, .5);
        --accent-alpha-70: rgba(35, 176, 255, .7);
        --background: #1D1E28;
        --color: whitesmoke;
        --light-color: #2d2e3a;
        --dark-color: whitesmoke;
        --border-color: rgba(255, 255, 255, .1);
        --footnote-color: rgba(255, 255, 255, .5);
        --callout-background: rgba(255, 255, 255, .1);
        --code-background: #2d2e3a;
        --form-background: #2d2e3a;
        --post-background: #2d2e3a;
        --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }
}

/* Font declarations */
@font-face {
    font-family: 'Source Sans';
    src: url('/static/fonts/sans/SourceSans3VF-Upright.otf.woff2') format('woff2');
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Source Sans';
    src: url('/static/fonts/sans/SourceSans3VF-Italic.otf.woff2') format('woff2');
    font-weight: 200 900;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Source Serif';
    src: url('/static/fonts/serif/SourceSerif4Variable-Roman.otf.woff2') format('woff2');
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Source Serif';
    src: url('/static/fonts/serif/SourceSerif4Variable-Italic.otf.woff2') format('woff2');
    font-weight: 200 900;
    font-style: italic;
    font-display: swap;
}

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

body {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Source Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: var(--color);
    background-color: var(--background);
}

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

a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Header and Navigation */
header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-left {
    display: flex;
    gap: 15px;
}

.nav-right {
    display: flex;
    gap: 15px;
}

nav a {
    font-size: 18px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: var(--border-radius);
}

nav a:hover {
    background-color: rgba(74, 123, 167, 0.1);
    text-decoration: none;
}

/* Posts */
.post {
    margin-bottom: 30px;
    padding: 25px;
    border-radius: var(--border-radius);
    background-color: var(--post-background);
    box-shadow: var(--box-shadow);
    position: relative;
}

.post.pinned {
    border-left: 4px solid var(--accent-color);
}

.pin-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--accent-color);
    font-size: 1.2rem;
}

.post-date {
    color: var(--footnote-color);
    font-size: 16px;
    margin-bottom: 10px;
}

.post-content {
    margin-bottom: 15px;
    line-height: 1.5;
    font-family: 'Source Serif', Georgia, serif;
}

.post-content h1, .post-content h2, .post-content h3 {
    margin-top: 1.2rem;
    margin-bottom: 0.7rem;
    color: var(--secondary-color);
    font-family: 'Source Serif', Georgia, serif;
}

.post-content h1 {
    font-size: 28px;
}

.post-content h2 {
    font-size: 24px;
}

.post-content h3 {
    font-size: 20px;
}

.post-content p {
    margin-bottom: 0.75rem;
}

.post-content p:last-child {
    margin-bottom: 0;
}

.post-content ul, .post-content ol {
    margin-bottom: 0.75rem;
    padding-left: 2rem;
}

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

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    cursor: pointer;
}

.post-content pre, .post-content code {
    background-color: var(--code-background);
    border-radius: 4px;
    padding: 2px 5px;
    font-family: monospace;
}

.post-content blockquote {
    border-left: 3px solid var(--primary-color);
    padding-left: 15px;
    color: var(--footnote-color);
    font-style: italic;
    font-family: 'Source Serif', Georgia, serif;
}

.post-files {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin: 10px 0 15px 0;
}

.file {
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* Image files */
.post-files img {
    max-width: 100%;
    height: auto;
    display: block;
    transition: var(--transition);
}

.post-files img:hover {
    opacity: 0.9;
}

/* Audio files */
.post-files audio {
    width: 100%;
    margin: 5px 0;
    border-radius: var(--border-radius);
}

/* Custom audio player styling */
.audio-container {
    background-color: var(--callout-background);
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.audio-container .audio-title {
    font-size: 16px;
    color: var(--secondary-color);
    text-align: center;
    word-break: break-word;
    margin-bottom: 5px;
}

/* Apply some browser-specific styles to make audio controls more attractive */
audio::-webkit-media-controls-panel {
    background-color: var(--light-color);
}

audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
    color: var(--dark-color);
}

audio::-webkit-media-controls-play-button,
audio::-webkit-media-controls-mute-button {
    background-color: var(--primary-color);
    border-radius: 50%;
    color: white;
}

/* Video files */
.post-files video {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.video-container {
    background-color: var(--callout-background);
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.video-container .video-title {
    font-size: 16px;
    color: var(--secondary-color);
    text-align: center;
    word-break: break-word;
    margin-bottom: 5px;
}

/* Document files */
.file-link {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: var(--callout-background);
    border-radius: var(--border-radius);
    transition: var(--transition);
    text-decoration: none;
}

.file-link:hover {
    background-color: var(--accent-alpha-20);
    text-decoration: none;
}

.file-link .file-icon {
    margin-right: 10px;
    font-size: 1.5rem;
}

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

.file-link .file-name {
    word-break: break-word;
    flex: 1;
}

.file-link .file-ext {
    background-color: var(--callout-background);
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 14px;
    margin-left: 8px;
    text-transform: uppercase;
}

.post-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.post-actions a, .post-actions button.link-button {
    padding: 5px 10px;
    border-radius: var(--border-radius);
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.post-actions a:hover, button.link-button:hover {
    background-color: var(--accent-alpha-20);
    text-decoration: none;
}

/* Pagination */
.pagination {
    margin-top: 40px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.pagination a {
    padding: 8px 16px;
    border-radius: var(--border-radius);
    background-color: var(--post-background);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.pagination a:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Forms */
form {
    margin: 20px 0;
    background-color: var(--form-background);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

textarea {
    width: 100%;
    min-height: 250px;
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 18px;
    resize: vertical;
    background-color: var(--post-background);
    color: var(--color);
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 123, 167, 0.2);
}

input[type="file"] {
    margin-bottom: 20px;
    width: 100%;
}

.existing-files {
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
}

.existing-files > div {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.existing-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-radius: var(--border-radius);
    background-color: var(--callout-background);
}

.existing-file-preview {
    display: flex;
    align-items: center;
}

.existing-file-preview .file-icon {
    font-size: 1.5rem;
    margin-right: 10px;
}

button {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

button:hover {
    background: var(--secondary-color);
}

button.link-button {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0;
    font: inherit;
    text-decoration: none;
}

button.link-button:hover {
    color: var(--secondary-color);
}

/* Delete button uses inline styles for the text color */

/* Footer */
footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--footnote-color);
    font-size: 16px;
}

/* Login Form */
.login-form {
    max-width: 400px;
    margin: 100px auto;
}

.login-form h1 {
    margin-bottom: 20px;
    text-align: center;
    color: var(--secondary-color);
    font-family: 'Source Serif', Georgia, serif;
}

.login-form input[type="password"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 18px;
    background-color: var(--post-background);
    color: var(--color);
}

.login-form button {
    width: 100%;
}

/* Form Hints and Button Groups */
.form-hint {
    color: var(--footnote-color);
    font-size: 16px;
    margin-bottom: 15px;
}

.file-upload-container {
    margin-bottom: 20px;
}

.file-upload-container h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: var(--secondary-color);
}

.button-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.button-link {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--light-color);
    color: var(--dark-color);
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: var(--transition);
}

.button-link:hover {
    background-color: var(--accent-alpha-20);
    text-decoration: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .post {
        padding: 20px;
    }
    
    .post-files {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .post-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pagination {
        flex-direction: column;
    }
    
    .button-group {
        flex-direction: column;
        width: 100%;
    }
    
    .button-link {
        text-align: center;
        width: 100%;
    }
}

/* Image Modal Styles */
.clickable-image {
    cursor: pointer;
    transition: var(--transition);
}

.clickable-image:hover {
    opacity: 0.9;
}

.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: var(--border-radius);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1001;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--accent-color);
}