/* Public blog listing + post detail — mobile-first */

.blog-page {
    overflow-x: hidden;
}

.blog-page .container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.blog-page .section-title {
    font-size: clamp(1.5rem, 5vw, 2rem);
    margin: 0.75rem 0 0;
    line-height: 1.25;
    word-break: break-word;
}

.blog-page .section-title span {
    color: #00f2ff;
}

.blog-page .back-link {
    color: #00f2ff;
    text-decoration: none;
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.95rem;
}

.blog-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
    gap: 1.5rem;
    padding: 1.25rem 0 2rem;
    align-items: start;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.blog-card {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(0, 242, 255, 0.1);
    border-radius: 12px;
    padding: 0 !important; /* override legacy responsive.css padding */
    overflow: hidden;
    transition: border-color 0.3s, transform 0.3s;
    min-width: 0;
}

.blog-card:hover {
    border-color: #00f2ff;
    transform: translateY(-2px);
}

.blog-card-media {
    display: block;
    aspect-ratio: 16 / 9;
    background: rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.blog-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.blog-card-body {
    padding: 1.15rem 1.25rem 1.25rem;
}

.blog-card .category {
    color: #00f2ff;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.blog-card h3 {
    font-size: clamp(1.05rem, 3.5vw, 1.2rem);
    margin: 0.5rem 0;
    line-height: 1.35;
    word-break: break-word;
}

.blog-card h3 a {
    color: #e2e8f0;
    text-decoration: none;
}

.blog-card h3 a:hover {
    color: #00f2ff;
}

.blog-card .excerpt {
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.6;
}

.blog-card .meta {
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
}

.blog-page .sidebar-card {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(0, 242, 255, 0.1);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.blog-page .sidebar-card h4 {
    color: #e2e8f0;
    margin-bottom: 0.85rem;
}

.blog-page .sidebar-card ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.blog-page .sidebar-card ul li {
    margin-bottom: 0.5rem;
}

.blog-page .sidebar-card ul li a {
    color: #94a3b8;
    text-decoration: none;
    word-break: break-word;
}

.blog-page .sidebar-card ul li a:hover {
    color: #00f2ff;
}

.blog-page .pagination {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    padding: 1.5rem 0 0.5rem;
    flex-wrap: wrap;
}

.blog-page .pagination a,
.blog-page .pagination span {
    padding: 0.45rem 0.85rem;
    border: 1px solid rgba(0, 242, 255, 0.1);
    border-radius: 6px;
    text-decoration: none;
    color: #94a3b8;
    min-width: 2.5rem;
    text-align: center;
}

.blog-page .pagination a:hover,
.blog-page .pagination .active {
    background: rgba(0, 242, 255, 0.1);
    color: #00f2ff;
    border-color: #00f2ff;
}

/* Single post */
.blog-post {
    padding: 1.25rem 0 2rem;
}

.post-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
    gap: 1.5rem;
    align-items: start;
}

.post-main {
    min-width: 0; /* allow content to shrink inside grid */
}

.post-header {
    margin-bottom: 1.25rem;
}

.post-header .category {
    color: #00f2ff;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-header h1 {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    color: #e2e8f0;
    margin: 0.5rem 0;
    line-height: 1.2;
    word-break: break-word;
}

.post-header .meta {
    color: #94a3b8;
    display: flex;
    gap: 0.75rem 1.25rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.post-featured {
    width: 100%;
    max-height: min(420px, 50vw);
    height: auto;
    object-fit: cover;
    border-radius: 12px;
    margin: 0 0 1.25rem;
    border: 1px solid rgba(0, 242, 255, 0.15);
    display: block;
}

.post-content {
    color: #94a3b8;
    line-height: 1.75;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
    color: #e2e8f0;
    margin: 1.35rem 0 0.55rem;
    line-height: 1.3;
}

.post-content p {
    margin-bottom: 1rem;
}

.post-content ul,
.post-content ol {
    margin: 0 0 1rem 1.25rem;
    padding-left: 0.25rem;
}

.post-content li {
    margin-bottom: 0.35rem;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
    display: block;
}

.post-content a {
    color: #22d3ee;
    word-break: break-word;
}

.post-content pre,
.post-content code {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* Tables: scroll horizontally on narrow screens */
.post-content .table-scroll,
.post-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.25rem 0;
}

.post-content table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 0.9rem;
    display: table;
    table-layout: auto;
}

.post-content th,
.post-content td {
    border: 1px solid rgba(0, 242, 255, 0.2);
    padding: 0.55rem 0.7rem;
    text-align: left;
    vertical-align: top;
}

.post-content th {
    background: rgba(0, 242, 255, 0.08);
    color: #e2e8f0;
    font-weight: 600;
}

.post-content caption {
    caption-side: bottom;
    color: #64748b;
    font-size: 0.8rem;
    padding-top: 0.35rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
    gap: 0.85rem;
    margin: 1rem 0;
}

.related-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(0, 242, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    min-width: 0;
}

.related-card h5 a {
    color: #e2e8f0;
    text-decoration: none;
    word-break: break-word;
}

.comments-section {
    margin-top: 2rem;
    border-top: 1px solid rgba(0, 242, 255, 0.1);
    padding-top: 1.5rem;
}

.comment {
    background: rgba(15, 23, 42, 0.5);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.comment .author {
    color: #00f2ff;
    font-weight: 600;
}

.comment .date {
    color: #64748b;
    font-size: 0.75rem;
}

.comment .content {
    color: #94a3b8;
    margin-top: 0.5rem;
    word-break: break-word;
}

.related-card .date {
    color: #64748b;
    font-size: 0.75rem;
}

.blog-page .sidebar-card .count {
    color: #64748b;
    font-size: 0.75rem;
}

.comment-form {
    margin-top: 1.25rem;
}

.comment-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.comment-form textarea,
.comment-form input {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 242, 255, 0.2);
    border-radius: 8px;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 1rem; /* avoid iOS zoom */
    box-sizing: border-box;
}

.comment-form textarea {
    margin-bottom: 0.5rem;
    min-height: 110px;
    resize: vertical;
}

.comment-form button {
    width: 100%;
    max-width: 280px;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #00f2ff, #8b5cf6);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
}

.blog-page .empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #64748b;
}

/* Tablet */
@media (max-width: 1024px) {
    .blog-layout,
    .post-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.25rem;
    }

    .blog-page .sidebar {
        order: 2;
    }

    .blog-layout > div:first-child,
    .post-main {
        order: 1;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .blog-page .container {
        padding: 0 0.85rem;
    }

    .blog-layout,
    .blog-post {
        padding-top: 0.75rem;
        padding-bottom: 1.5rem;
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .blog-card-body {
        padding: 1rem;
    }

    .post-featured {
        max-height: 220px;
        border-radius: 10px;
        margin-bottom: 1rem;
    }

    .post-content ul,
    .post-content ol {
        margin-left: 1rem;
    }

    .post-content table {
        min-width: 460px;
        font-size: 0.85rem;
    }

    .post-content th,
    .post-content td {
        padding: 0.45rem 0.55rem;
    }

    .comment-form-row {
        grid-template-columns: 1fr;
    }

    .comment-form button {
        max-width: none;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .blog-page .section-title {
        font-size: 1.35rem;
    }

    .post-header h1 {
        font-size: 1.4rem;
    }

    .blog-card .meta,
    .post-header .meta {
        font-size: 0.78rem;
        gap: 0.5rem 0.75rem;
    }

    .post-content {
        font-size: 0.95rem;
        line-height: 1.7;
    }
}
