/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Georgia, Times, serif;
    line-height: 1.1;
    color: #333;
    background: #fff;
}

/* Two-column layout wrapper */
#wrapper {
    width: 1030px;
    margin: 0 auto;
    position: relative;
}

/* Main content area */
#posts {
    width: 800px;
    float: left;
}

header > h1,
.post-header > h1
{
  font-size: 1.7rem;
}

/* Header image */
#header-img {
    display: block;
    border: none;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

#header-img:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Sidebar */
#sidebar {
    width: 210px;
    float: right;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #f1f3f4 100%);
    margin-top: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow-wrap: break-word;
    word-wrap: break-word;
}

#sidebar h1 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
}

#sidebar h1 a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
}

#sidebar h1 a:hover {
    color: #3498db;
}

.info {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e1e8ed;
}

#about {
    font-size: 0.9rem;
    color: #5a6c7d;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.info-rest {
    color: #6c757d;
    font-size: 0.85rem;
    line-height: 1.4;
}

.info-rest-hidden {
    display: none;
    margin-top: 0.8rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.info:hover .info-rest-hidden {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.info hr {
    display: none;
}

/* Navigation links in sidebar - block display for Archive, Tags, RSS */
#sidebar > a {
    color: #5D707A;
    text-decoration: underline;
    display: block;
    margin: 0.8rem 0;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    transition: color 0.3s ease;
    font-weight: 500;
}

#sidebar > a:hover {
    color: #0F98E0;
}

/* Biographical text links - inline display for natural text flow */
.info-rest a {
    color: #5D707A;
    text-decoration: underline;
    display: inline;
    margin: 0;
    padding: 0;
    border-radius: 0;
    transition: color 0.3s ease;
    font-weight: normal;
}

.info-rest a:hover {
    color: #0F98E0;
}

#sidebar h3 {
    font-size: 1.1rem;
    color: #2c3e50;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

.ul-padded {
    list-style: none;
    padding: 0;
}

.ul-padded li {
    margin: 0.6rem 0;
    line-height: 1.4;
}

.ul-padded li a {
    color: #5a6c7d;
    text-decoration: none;
    display: inline;
    padding: 0.3rem 0;
    border-radius: 4px;
    transition: color 0.3s ease;
}

.ul-padded li a:hover {
    color: #3498db;
}

ul, ol {
    list-style-position: inside;
}

/* Container for backward compatibility */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.site-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #ccc;
}

.site-title a {
    color: #333;
    text-decoration: none;
    font-size: 2.5rem;
    font-weight: bold;
}

.site-description {
    color: #666;
    margin: 1rem 0;
    font-size: 1.1rem;
}

.main-nav {
    margin-top: 1.5rem;
}

.main-nav a {
    color: #5D707A;
    text-decoration: none;
    margin: 0 1rem;
    padding: 0.5rem 1rem;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.main-nav a:hover {
    color: #0F98E0;
    background: #f5f5f5;
}

/* Main content */
.main-content {
    margin-bottom: 3rem;
}

/* Posts */
.post {
    margin-bottom: 4rem;
}

.post-header {
    margin-bottom: 2rem;
}

.post-title {
    color: #000;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.post-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-id {
    margin-left: 1rem;
    opacity: 0.7;
}

.post-content {
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    color: #000;
    margin-bottom: 8px;
}

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

.post-content img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    display: block;
}

.post-content code {
    background: #f4f4f4;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 0.9rem;
}

.post-content pre {
    background: #f8f8f8;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1rem 0;
}

.post-content pre code {
    background: none;
    padding: 0;
}

.post-content a {
    color: #5D707A;
    text-decoration: underline;
}

.post-content a:hover {
    color: #0F98E0;
}

/* Post summaries */
.post-summary {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.post-summary:last-child {
    border-bottom: none;
}

.post-summary h2,
.post-summary h3 {
    margin-bottom: 0.5rem;
}

.post-summary h2 a,
.post-summary h3 a {
    color: #000;
    text-decoration: none;
}

.post-summary h2 a:hover,
.post-summary h3 a:hover {
    color: #5D707A;
}

.summary {
    color: #666;
    margin-top: 1rem;
}

/* Image gallery styling for summaries */
.summary {
    color: #666;
    margin-top: 1rem;
}

.summary img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.summary img:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Create a masonry-style grid for images in summaries */
.summary p:has(img) {
    margin: 0;
    padding: 0;
}

.summary p img {
    display: block;
    width: 100%;
    margin: 0 0 0.75rem 0;
}

/* If multiple images exist, create a grid layout */
.summary:has(img) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(390px, 1fr));
    gap: 0.75rem;
    align-items: start;
}

/* Style text content differently from images */
.summary p:not(:has(img)) {
    grid-column: 1 / -1;
    margin: 1rem 0;
    line-height: 1.6;
}

.summary h1 {
    grid-column: 1 / -1;
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    color: #333;
}

.summary em {
    grid-column: 1 / -1;
    display: block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Apply masonry layout to tag pages */
.tag-page .main-content:has(img) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(390px, 1fr));
    gap: 0.75rem;
    align-items: start;
}

.post-content p:has(img),
.tag-page .main-content p:has(img) {
    margin: 0;
    padding: 0;
}

.post-content p img,
.tag-page .main-content p img {
    display: block;
    width: 100%;
    margin: 0 0 0.75rem 0;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-content p img:hover,
.tag-page .main-content p img:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Style text content differently from images in posts */
.post-content p:not(:has(img)),
.tag-page .main-content p:not(:has(img)) {
    grid-column: 1 / -1;
    margin: 1rem 0;
    line-height: 1.8;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6,
.tag-page .main-content h1,
.tag-page .main-content h2,
.tag-page .main-content h3,
.tag-page .main-content h4,
.tag-page .main-content h5,
.tag-page .main-content h6 {
    grid-column: 1 / -1;
    color: #000;
}

.post-content em,
.tag-page .main-content em {
    grid-column: 1 / -1;
    display: block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Tags */
.tags {
    margin: 1rem 0;
}

.tag {
    background: #829FAE;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 0.25rem;
}

.tag:hover {
    background: #6a8291;
    color: white;
}

/* Tag pages */
.tag-page .tag-description {
    color: #666;
    margin-bottom: 2rem;
}

.tag-navigation {
    margin-top: 3rem;
    text-align: center;
}

.tag-navigation a {
    color: #5D707A;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 3px;
}

.tag-navigation a:hover {
    color: #0F98E0;
    background: #f5f5f5;
}

/* Tags overview page */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 2rem 0;
}

/* Sidebar tag cloud for Popular Tags */
#sidebar .tag_cloud {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

#sidebar .tag_cloud .tag_list {
    list-style: none;
    margin-left: 0;
    padding-left: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: center;
}

#sidebar .tag_cloud .tag_list li {
    display: inline-block;
    margin-right: 0;
    margin-bottom: 0.25rem;
}

#sidebar .tag_cloud .tag_list li a {
    color: #5a6c7d;
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-block;
    padding: 0.1rem 0.2rem;
    border-radius: 2px;
}

#sidebar .tag_cloud .tag_list li a:hover {
    color: #3498db;
    background-color: rgba(52, 152, 219, 0.1);
}

.tag-item {
    margin: 0.5rem 0;
}

.tag-link {
    color: #5D707A;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    display: inline-block;
    transition: all 0.3s ease;
}

.tag-link:hover {
    color: #0F98E0;
    border-color: #0F98E0;
    background: #f5f5f5;
}

.tag-name {
    font-weight: bold;
}

.tag-count {
    color: #666;
    font-size: 0.9rem;
    margin-left: 0.25rem;
}

/* Audio player */
.audio-container {
    margin: 2rem 0;
    padding: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
}

.audio-title {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.1rem;
}

.audio-player {
    width: 100%;
    margin: 0.5rem 0;
}

.audio-description {
    margin: 1rem 0 0 0;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

/* Post navigation */
.post-navigation {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

.nav-next,
.nav-prev {
    flex: 1;
}

.nav-prev {
    text-align: right;
}

.post-navigation a {
    color: #5D707A;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 3px;
    display: inline-block;
}

.post-navigation a:hover {
    color: #0F98E0;
    background: #f5f5f5;
}

/* Footer */
.site-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #ccc;
    text-align: center;
    color: #666;
}

.social-links {
    margin-top: 1rem;
}

.social-links a {
    color: #5D707A;
    text-decoration: none;
    margin: 0 1rem;
}

.social-links a:hover {
    color: #0F98E0;
}

/* List pages */
.list-header {
    margin-bottom: 2rem;
    text-align: center;
}

.list-header h1 {
    color: #000;
    margin-bottom: 1rem;
}

.list-description {
    color: #666;
}

/* Footer pagination */
#footer {
    clear: both;
    padding: 2rem;
    text-align: center;
    border-top: 1px solid #e1e8ed;
    margin-top: 3rem;
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.pagination {
    display: flex;
    justify-content: center;
    width: 100%;
}

#footer ul,
.pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
    max-width: 100%;
}

#footer li,
.pagination li {
    margin: 0;
}

#footer a,
.pagination a {
    color: #5D707A;
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: 2px solid #e1e8ed;
    font-weight: 500;
    transition: all 0.3s ease;
    background: #fff;
    display: inline-block;
}

#footer a:hover,
.pagination a:hover {
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Responsive design */
@media (max-width: 1050px) {
    #wrapper {
        width: 100%;
        margin: 0;
        padding: 0 1rem;
        display: flex;
        flex-direction: column;
    }

    #posts {
        width: 100%;
        float: none;
        order: 3;
    }

    #sidebar {
        width: 100%;
        float: none;
        order: 1;
        margin-top: 0;
        margin-bottom: 2rem;
        padding: 1rem;
        background: linear-gradient(135deg, #f8f9fa 0%, #f1f3f4 100%);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    #header-img {
        width: 100vw;
        height: auto;
        max-width: none;
        order: 2;
        margin-bottom: 1rem;
        margin-left: -1rem;
        margin-right: -1rem;
    }

    #footer {
        order: 4;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 768px) {
    #posts {
    }

    #sidebar {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    /* Truncate sidebar content on mobile */
    #sidebar h3 {
        display: none;
    }

    #sidebar .tag_cloud,
    #sidebar .ul-padded,
    #sidebar hr {
        display: none;
    }

    #sidebar > a {
        display: none;
    }

    #sidebar h1 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    #sidebar .info {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }

    #sidebar .info-rest-hidden {
        display: none !important;
    }

    .post-title {
        font-size: 1.5rem;
    }

    /* Adjust image grid for mobile */
    .summary:has(img),
    .post-content:has(img),
    .tag-page .main-content:has(img) {
        grid-template-columns: 1fr;
    }

    #footer ul,
    .pagination ul {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    #footer a,
    .pagination a {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    .container {
        padding: 1rem;
    }

    .site-title a {
        font-size: 2rem;
    }

    .main-nav a {
        display: block;
        margin: 0.5rem 0;
    }

    .post-navigation {
        flex-direction: column;
    }

    .nav-prev {
        text-align: left;
        margin-top: 1rem;
    }
}
