/* ==========================================================================
   Corporate Blog Theme for Ghost
   ========================================================================== */

/* 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: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #1a1a2e;
    line-height: 1.6;
    background: #fff;
}

a {
    color: inherit;
    text-decoration: none;
}

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

/* Layout
   ========================================================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.site-logo img {
    height: 32px;
    width: auto;
}

.site-logo-text {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-separator {
    color: #d1d5db;
    font-size: 20px;
    font-weight: 300;
}

.header-blog-link {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    color: #1a1a2e;
    transition: background 0.2s;
}

.search-btn:hover {
    background: #f3f4f6;
}

.subscribe-btn {
    background: #1a1a2e;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.subscribe-btn:hover {
    background: #2563eb;
}

/* Blog Banner
   ========================================================================== */

.blog-banner {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #2563eb 100%);
    color: #fff;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 386px;
}

.banner-content {
    padding: 72px 24px;
    max-width: 640px;
    margin: 0 auto;
}

.banner-title {
    font-size: 40px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.2;
}

.banner-description {
    font-size: 20px;
    opacity: 0.85;
    margin-bottom: 36px;
    line-height: 1.6;
}

.banner-search {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 440px;
    margin: 0 auto;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.banner-search:hover {
    background: rgba(255, 255, 255, 0.15);
}

.banner-search svg {
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

.banner-search span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 15px;
}

/* Tag Tabs
   ========================================================================== */

.tag-tabs {
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    position: sticky;
    top: 64px;
    z-index: 90;
}

.tabs-wrapper {
    display: flex;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tabs-wrapper::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.tab:hover {
    color: #1a1a2e;
}

.tab.active {
    color: #1a1a2e;
    border-bottom-color: #1a1a2e;
    font-weight: 600;
}

/* Posts Section
   ========================================================================== */

.posts-section {
    padding: 48px 0 64px;
}

/* Featured Post
   ========================================================================== */

.featured-post {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
    margin-bottom: 56px;
    align-items: center;
}

.featured-post.has-image {
    grid-template-columns: 1.2fr 1fr;
}

.featured-image-link {
    display: block;
    border-radius: 16px;
    overflow: hidden;
}

.featured-image-link img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.featured-image-link:hover img {
    transform: scale(1.03);
}

.post-tag {
    display: inline-block;
    padding: 4px 14px;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    transition: background 0.2s;
}

.post-tag:hover {
    background: #dbeafe;
}

.featured-title {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 14px;
}

.featured-title a:hover {
    color: #2563eb;
}

.featured-excerpt {
    color: #6b7280;
    font-size: 16px;
    line-height: 1.65;
    margin-bottom: 24px;
}

/* Post Meta
   ========================================================================== */

.post-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #9ca3af;
}

.author-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.author-name {
    font-weight: 500;
    color: #6b7280;
}

.meta-tag {
    padding: 2px 10px;
    background: #f3f4f6;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    margin-left: auto;
}

.meta-tag:hover {
    background: #e5e7eb;
}

/* Post Grid
   ========================================================================== */

.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

/* Post Card
   ========================================================================== */

.post-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

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

.post-card-image {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-card:hover .post-card-image img {
    transform: scale(1.05);
}

.post-card-content {
    padding: 20px;
}

.post-card-tags {
    margin-bottom: 8px;
}

.post-card-tag {
    display: inline-block;
    padding: 2px 10px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
}

.post-card-tag:hover {
    background: #e5e7eb;
}

.post-card-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
}

.post-card-title a:hover {
    color: #2563eb;
}

.post-card-excerpt {
    color: #6b7280;
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Pagination
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding-top: 56px;
}

.pagination-link {
    padding: 10px 24px;
    border-radius: 8px;
    background: #f3f4f6;
    color: #1a1a2e;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.2s;
}

.pagination-link:hover {
    background: #e5e7eb;
}

/* Single Post
   ========================================================================== */

.post-header {
    text-align: center;
    padding: 56px 0 40px;
}

.post-header .container {
    max-width: 800px;
}

.post-header-tags {
    margin-bottom: 16px;
}

.post-title {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 24px;
}

.post-header-meta {
    justify-content: center;
    gap: 16px;
}

.post-author-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-feature-image {
    max-width: 1000px;
    margin: 0 auto 48px;
    border-radius: 16px;
    overflow: hidden;
}

.post-feature-image img {
    width: 100%;
}

.post-feature-image figcaption {
    text-align: center;
    font-size: 14px;
    color: #9ca3af;
    padding: 12px 0;
}

/* Post Content Typography
   ========================================================================== */

.post-content {
    max-width: 720px;
    margin: 0 auto;
    font-family: Georgia, Times, 'Times New Roman', serif;
    font-size: 20px;
    line-height: 1.8;
    padding-bottom: 48px;
}

.post-content h2 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 28px;
    font-weight: 700;
    margin: 48px 0 16px;
    line-height: 1.3;
}

.post-content h3 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 22px;
    font-weight: 700;
    margin: 36px 0 12px;
    line-height: 1.35;
}

.post-content h4 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 18px;
    font-weight: 700;
    margin: 28px 0 8px;
}

.post-content p {
    margin-bottom: 24px;
}

.post-content a {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-content a:hover {
    color: #1d4ed8;
}

.post-content img {
    border-radius: 12px;
    margin: 32px auto;
}

.post-content blockquote {
    border-left: 3px solid #2563eb;
    padding-left: 24px;
    margin: 32px 0;
    color: #6b7280;
    font-family: Georgia, Times, 'Times New Roman', serif;
    font-style: italic;
    font-size: 20px;
}

.post-content ul,
.post-content ol {
    margin-bottom: 24px;
    padding-left: 24px;
}

.post-content li {
    margin-bottom: 8px;
}

.post-content code {
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
}

.post-content pre {
    background: #1a1a2e;
    color: #e5e7eb;
    padding: 24px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 32px 0;
    font-size: 15px;
    line-height: 1.6;
}

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

.post-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 48px 0;
}

.post-content figure {
    margin: 32px 0;
}

.post-content figcaption {
    text-align: center;
    font-size: 14px;
    color: #9ca3af;
    margin-top: 12px;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
    font-size: 16px;
}

.post-content th,
.post-content td {
    border: 1px solid #e5e7eb;
    padding: 12px 16px;
    text-align: left;
}

.post-content th {
    background: #f8f9fa;
    font-weight: 600;
}

/* Post Author Section
   ========================================================================== */

.post-author-section {
    padding-bottom: 64px;
}

.post-author-row {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 720px;
    margin: 0 auto;
}

.post-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.post-author-name {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
}

.post-author-socials {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.post-author-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #6b7280;
    transition: color 0.2s, background 0.2s;
}

.post-author-social-link:hover {
    color: #2563eb;
    background: #eff6ff;
}

.post-author-social-link svg {
    width: 18px;
    height: 18px;
}

/* Author Page
   ========================================================================== */

.author-header {
    padding: 56px 0 40px;
    background: #f8f9fa;
}

.author-header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
}

.author-header-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.author-header-name {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.author-header-bio {
    color: #6b7280;
    font-size: 16px;
}

/* Error Page
   ========================================================================== */

.error-page {
    text-align: center;
    padding: 120px 24px;
}

.error-code {
    font-size: 120px;
    font-weight: 700;
    color: #e5e7eb;
    line-height: 1;
    margin-bottom: 16px;
}

.error-message {
    font-size: 20px;
    color: #6b7280;
    margin-bottom: 32px;
}

.error-link {
    display: inline-block;
    padding: 12px 28px;
    background: #1a1a2e;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s;
}

.error-link:hover {
    background: #2563eb;
}

/* Footer
   ========================================================================== */

.site-footer {
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
    padding: 24px 0;
    color: #9ca3af;
    font-size: 14px;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-copyright {
    margin: 0;
}

.footer-rss {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-rss:hover {
    color: #2563eb;
}

.footer-rss svg {
    flex-shrink: 0;
}

/* Responsive - Tablet
   ========================================================================== */

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

    .featured-post {
        gap: 32px;
    }

    .featured-title {
        font-size: 24px;
    }
}

/* Responsive - Mobile
   ========================================================================== */

@media (max-width: 768px) {
    .header-inner {
        height: 56px;
    }

    .subscribe-btn {
        padding: 8px 18px;
        font-size: 13px;
    }

    .blog-banner {
        min-height: 326px;
    }

    .banner-content {
        padding: 56px 20px;
    }

    .banner-title {
        font-size: 28px;
    }

    .banner-description {
        font-size: 17px;
        margin-bottom: 28px;
    }

    .banner-subscribe {
        flex-direction: column;
        border-radius: 0;
        box-shadow: none;
    }

    .banner-subscribe input {
        border-radius: 8px;
        margin-bottom: 10px;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .banner-subscribe button {
        border-radius: 8px;
        padding: 14px;
    }

    .tag-tabs {
        top: 56px;
    }

    .tab {
        padding: 14px 18px;
        font-size: 14px;
    }

    .posts-section {
        padding: 32px 0 48px;
    }

    .featured-post {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 40px;
    }

    .featured-title {
        font-size: 22px;
    }

    .featured-excerpt {
        font-size: 15px;
    }

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

    .post-title {
        font-size: 28px;
    }

    .post-content {
        font-size: 18px;
        padding: 0 0 40px;
    }

    .post-content h2 {
        font-size: 24px;
        margin: 36px 0 12px;
    }

    .post-content h3 {
        font-size: 20px;
        margin: 28px 0 10px;
    }

    .post-content pre {
        padding: 16px;
        font-size: 14px;
        border-radius: 8px;
    }

    .author-header-inner {
        flex-direction: column;
        text-align: center;
    }

    .author-header-name {
        font-size: 24px;
    }

    .error-code {
        font-size: 80px;
    }
}

/* Ghost-specific: Members form states
   ========================================================================== */

[data-members-form].loading .loading-message {
    display: block;
}

[data-members-form].success .success-message {
    display: block;
}

[data-members-form].error .error-message {
    display: block;
}

/* Ghost-specific: Bookmark cards, galleries, etc.
   ========================================================================== */

.kg-bookmark-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin: 32px 0;
}

.kg-bookmark-container {
    display: flex;
    text-decoration: none;
    color: inherit;
}

.kg-bookmark-content {
    flex: 1;
    padding: 20px;
}

.kg-bookmark-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.kg-bookmark-description {
    font-size: 14px;
    color: #6b7280;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 13px;
    color: #9ca3af;
}

.kg-bookmark-icon {
    width: 20px;
    height: 20px;
}

.kg-bookmark-thumbnail {
    width: 200px;
    flex-shrink: 0;
}

.kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kg-gallery-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 32px 0;
}

.kg-gallery-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.kg-gallery-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.kg-image-card img {
    margin: 0 auto;
}

.kg-width-wide {
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.kg-width-full {
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Utility: No feature image fallback
   ========================================================================== */

.post-card-image-placeholder {
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.featured-image-placeholder {
    border-radius: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    aspect-ratio: 16 / 10;
}

/* Announcement Bar
   ========================================================================== */

.announcement-bar {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.announcement-bar-inner {
    padding: 10px 24px;
}

.announcement-bar-inner a {
    color: inherit;
    text-decoration: underline;
}

/* Post CTA
   ========================================================================== */

.post-cta {
    padding: 0 0 48px;
}

.post-cta-box {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
    padding: 40px 32px;
    background: #f8f9fa;
    border-radius: 16px;
}

.post-cta-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.post-cta-description {
    color: #6b7280;
    font-size: 15px;
    margin-bottom: 20px;
}

/* Subscribe Modal
   ========================================================================== */

[hidden] {
    display: none !important;
}

.subscribe-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.subscribe-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.subscribe-modal-dialog {
    position: relative;
    background: #fff;
    border-radius: 20px;
    padding: 48px 40px;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15);
    animation: modal-enter 0.25s ease-out;
}

@keyframes modal-enter {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.subscribe-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

.subscribe-modal-close:hover {
    background: #f3f4f6;
    color: #1a1a2e;
}

.subscribe-modal-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
    color: #1a1a2e;
}

.subscribe-modal-description {
    font-size: 15px;
    color: #6b7280;
    text-align: center;
    margin-bottom: 28px;
}

.subscribe-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subscribe-form input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    color: #1a1a2e;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.subscribe-form input::placeholder {
    color: #9ca3af;
}

.subscribe-form input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.subscribe-form-btn {
    width: 100%;
    padding: 14px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    margin-top: 4px;
}

.subscribe-form-btn:hover {
    background: #2563eb;
}

.subscribe-success {
    text-align: center;
    color: #059669;
    font-size: 15px;
    font-weight: 500;
    margin-top: 20px;
    padding: 16px;
    background: #ecfdf5;
    border-radius: 12px;
}

.subscribe-error {
    text-align: center;
    color: #dc2626;
    font-size: 15px;
    font-weight: 500;
    margin-top: 20px;
    padding: 16px;
    background: #fef2f2;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .subscribe-modal-dialog {
        padding: 36px 24px;
    }

    .subscribe-modal-title {
        font-size: 20px;
    }

    .post-cta-box {
        padding: 32px 20px;
    }

    .post-cta-title {
        font-size: 20px;
    }
}
