/* ============================================
   COMMUNITY GHOST THEME
   A sidebar-driven theme for community orgs
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    color: #1a1a1a;
    background: #f5f5f5;
    line-height: 1.6;
}

a {
    color: var(--accent, #8B0000);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

a:hover {
    opacity: 0.8;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}


/* --- Layout: Sidebar + Content --- */
.site-wrapper {
    display: flex;
    min-height: 100vh;
}


/* --- Sidebar --- */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--sidebar-bg, #fff);
    border-right: 1px solid #e0e0e0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 100;
}

.sidebar-inner {
    padding: 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    height: 100%;
    position: relative;
}

/* Logo & Title */
.sidebar-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e8e8e8;
}

.sidebar-logo img {
    max-width: 140px;
    margin: 0 auto 0.75rem;
}

.sidebar-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}

.sidebar-title-link {
    color: #1a1a1a;
}

.sidebar-title-link:hover {
    opacity: 1;
    color: var(--accent, #8B0000);
}

.sidebar-description {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
    line-height: 1.4;
}

/* Navigation */
.sidebar-nav {
    margin-bottom: 2rem;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.125rem;
}

.sidebar-nav a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #333;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav a:hover,
.sidebar-nav .nav-current a {
    background: var(--accent, #8B0000);
    color: #fff;
    opacity: 1;
}

/* Social Links */
.sidebar-social {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e8e8e8;
}

.social-link {
    color: #666;
    transition: color 0.2s ease;
}

.social-link:hover {
    color: var(--accent, #8B0000);
    opacity: 1;
}

/* Member Links */
.sidebar-member {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
}

.member-link {
    display: block;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    color: #666;
    border-radius: 4px;
    text-align: center;
}

.member-link:hover {
    background: #f0f0f0;
    color: #333;
    opacity: 1;
}

/* Footer */
.sidebar-footer {
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: #999;
    position: absolute;
    bottom: 1.5rem;
    left: 0;
    right: 0;
}

.footer-custom {
    margin-top: 0.25rem;
}


/* --- Mobile Sidebar Toggle --- */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 200;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.6rem 0.5rem;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #333;
    border-radius: 2px;
    transition: transform 0.2s ease;
}


/* --- Main Content --- */
.site-content {
    flex: 1;
    margin-left: 260px;
    min-width: 0;
}

.content-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}


/* --- Banner --- */
.site-banner {
    background: var(--banner-bg, #8B0000);
    color: #fff;
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

.site-banner a {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.site-banner a:hover {
    opacity: 0.9;
}


/* --- Intro Section --- */
.intro-section {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.intro-text {
    font-size: 1rem;
    color: #444;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}


/* --- Post Card Grid --- */
.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.post-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.post-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.post-card-link {
    display: block;
    color: inherit;
}

.post-card-link:hover {
    opacity: 1;
}

.post-card-image {
    aspect-ratio: 8.5 / 11;
    overflow: hidden;
    background: #f0f0f0;
    line-height: 0;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f0f0f0;
    display: block;
}

.post-card-content {
    padding: 1rem 1.25rem 1.25rem;
}

.post-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.post-card-excerpt {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* --- Tag Header --- */
.tag-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--accent, #8B0000);
}

.tag-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a1a;
}

.tag-description {
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.95rem;
}


/* --- Author Header --- */
.author-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.author-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    object-fit: cover;
}

.author-name {
    font-size: 1.5rem;
    font-weight: 700;
}

.author-bio {
    margin-top: 0.5rem;
    color: #666;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}


/* --- Single Post / Page --- */
.post-full,
.page-full {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 2.5rem;
    max-width: 900px;
}

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

.post-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
    margin-bottom: 1rem;
    text-align: center;
}

.post-feature-image {
    margin: 0 0 1.5rem;
    border-radius: 6px;
    overflow: hidden;
}

.post-feature-image figcaption {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #999;
    text-align: center;
}


/* --- Post Content (Ghost editor output) --- */
.post-content {
    font-size: 1rem;
    line-height: 1.7;
    color: #333;
}

.post-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2rem 0 0.75rem;
    color: #1a1a1a;
}

.post-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
    color: #1a1a1a;
}

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

.post-content ul,
.post-content ol {
    margin: 0 0 1rem 1.5rem;
}

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

.post-content blockquote {
    border-left: 3px solid var(--accent, #8B0000);
    padding-left: 1.25rem;
    margin: 1.5rem 0;
    color: #555;
    font-style: italic;
}

.post-content a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-content img {
    border-radius: 6px;
    margin: 1.5rem 0;
}

.post-content hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 2rem 0;
}

.post-content pre {
    background: #f7f7f7;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.post-content code {
    background: #f0f0f0;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    font-size: 0.9em;
}

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

/* Ghost cards (bookmark, gallery, file, etc.) */
.post-content .kg-card {
    margin: 1.5rem 0;
}

.post-content .kg-image-card img,
.post-content .kg-gallery-image img {
    border-radius: 6px;
}

.post-content .kg-bookmark-card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.post-content .kg-file-card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.post-content .kg-callout-card {
    border-radius: 6px;
    padding: 1.25rem;
}

.post-content .kg-button-card a {
    background: var(--accent, #8B0000);
    color: #fff;
    padding: 0.6rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
}

.post-content .kg-toggle-card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}


/* --- Post Footer / Tags --- */
.post-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.post-tag {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    background: #f0f0f0;
    color: #555;
    font-size: 0.8rem;
    border-radius: 4px;
    text-decoration: none;
}

.post-tag:hover {
    background: var(--accent, #8B0000);
    color: #fff;
    opacity: 1;
}


/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.pagination-link {
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.85rem;
    color: #333;
}

.pagination-link:hover {
    background: var(--accent, #8B0000);
    color: #fff;
    border-color: var(--accent, #8B0000);
    opacity: 1;
}

.pagination-info {
    font-size: 0.85rem;
    color: #999;
}


/* --- Responsive --- */

/* Tablet */
@media (max-width: 1024px) {
    .post-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
    }

    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }

    .sidebar-toggle {
        display: flex;
    }

    .site-content {
        margin-left: 0;
    }

    .content-inner {
        padding: 1rem;
        padding-top: 4rem;
    }

    .post-grid {
        grid-template-columns: 1fr;
    }

    .post-full,
    .page-full {
        padding: 1.5rem;
    }

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

/* Small mobile */
@media (max-width: 480px) {
    .post-card-content {
        padding: 0.75rem 1rem 1rem;
    }

    .post-card-title {
        font-size: 1rem;
    }
}


/* --- Utility --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}


/* --- Ghost Portal Overrides (optional) --- */
.gh-portal-powered {
    display: none !important;
}
