

/* Top Categories (main page) */
.top-categories {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.top-category-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem 1.5rem;
    background: var(--gradient-light-bg);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-2xl);
    text-decoration: none;
    color: var(--color-gray-900);
    transition: var(--transition-fast);
    flex: 1;
    min-width: 220px;
    position: relative;
    overflow: hidden;
}

/* Background image */
.top-category-bg-img {
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 100px;
    height: 100px;
    object-fit: contain;
    opacity: 0.1;
    pointer-events: none;
}

/* Icon image */
.top-category-icon {
    width: 52px;
    height: 52px;
    object-fit: contain;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.top-category-card:hover {
    border-color: var(--color-primary-alpha-30);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.top-category-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    position: relative;
    z-index: 1;
}

.top-category-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.top-category-count {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-gray-600);
}

.top-category-desc {
    font-size: 0.85rem;
    color: var(--color-gray-700);
    line-height: 1.4;
}

/* Category Overview (Main Page) */
.category-overview-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2.5rem;
    margin-bottom: 2rem;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);
}

@keyframes subcategoryFlow {
    0% {
        background-position: 0% 0%;
    }
    50% {
        background-position: 100% 100%;
    }
    100% {
        background-position: 0% 0%;
    }
}

/* Responsive */
@media (max-width: 900px) {
    .subcategory-row {
        flex-direction: column;
        gap: 0.5rem;
        height: auto;
    }

    .subcategory-item-vertical {
        width: 100%;
        min-height: auto;
        flex-direction: row;
        justify-content: flex-start;
        padding: 0.5rem 1rem;
    }

    .subcategory-icon-lg {
        width: 36px;
        height: 36px;
    }

    .subcategory-posts .home-card {
        flex: 0 0 180px;
        min-width: 180px;
    }
}

/* Post List */
.post-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.tag {
    padding: 0.25rem 0.7rem;
    background: var(--color-bg-hover);
    color: var(--color-primary);
    border-radius: var(--radius-2xl);
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--color-primary-alpha-30);
}

/* Empty Message */
.empty-message {
    color: var(--color-gray-700);
    font-style: italic;
    text-align: center;
    padding: 3rem;
    background: var(--color-gray-50);
    border-radius: var(--radius-xl);
    border: 1px dashed var(--color-gray-400);
}

.page-meta > span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.page-meta .separator {
    color: var(--color-gray-500);
    font-size: 0.9rem;
    font-weight: 300;
}

.post-date,
.post-reading-time {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
    color: var(--color-gray-800);
}

.meta-tag {
    display: inline-flex; align-items: center; height: 26px; padding: 0 10px;
    border: 0; border-radius: 8px; background: var(--s-row); color: var(--s-sub);
    font-size: 12.5px; font-weight: 600; letter-spacing: -.01em;
    transition: background .1s ease-out, color .1s ease-out;
}
.meta-tag:hover { background: var(--s-blue-bg); color: var(--s-blue); }
.page-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Post Navigation (Previous/Next) */
.post-navigation {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    margin: 40px 0 24px; padding: 0; border: 0;
}
.nav-prev, .nav-next { max-width: none; min-width: 0; }
.nav-next { grid-column: 2; text-align: right; }
.nav-prev a, .nav-next a {
    display: block; padding: 14px 16px; border: 1px solid var(--s-line); border-radius: 14px;
    background: #fff; text-decoration: none;
    transition: border-color .1s ease-out, box-shadow .16s ease, transform .16s ease;
}
.nav-prev a:hover, .nav-next a:hover {
    background: #fff; border-color: #D6E4F7; box-shadow: 0 2px 8px rgba(9, 30, 66, .05); transform: translateY(-1px);
}
.nav-label { display: block; margin-bottom: 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; color: var(--s-faint); }
.nav-title {
    display: block; font-size: 14px; font-weight: 700; line-height: 1.45; color: #191F28;
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.nav-prev a:hover .nav-title, .nav-next a:hover .nav-title { color: var(--s-blue); }
@media (max-width: 600px) {
    .post-navigation { grid-template-columns: 1fr; }
    .nav-next { grid-column: 1; text-align: left; }
}

/* Related Posts Section */
.related-posts-section,
.similar-posts-section {
    margin-top: 2rem;
}

.related-posts-section h2,
.similar-posts-section h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

/* Comments Section */
.comments-section {
    margin-top: 4rem;
    padding-top: 2.5rem;
    border-top: 2px solid var(--color-border);
}

.comments-section h2 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.comments-section h2::before {
    content: '';
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c0392b' stroke-width='2'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
    background-size: contain;
}

/* Comment Form */
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.comment-form input,
.comment-form textarea {
    padding: 0.8rem 1rem;
    border: 1px solid var(--color-gray-400);
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color var(--d-base);
}

.comment-form textarea {
    min-height: 100px;
    resize: vertical;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.comment-form button {
    align-self: flex-end;
    padding: 0.7rem 1.5rem;
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--d-base);
}

.comment-form button:hover {
    background: var(--color-primary-dark);
}

/* Comments List */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comments-list > .comment {
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
    background: var(--color-gray-50);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-200);
}

.comments-list .comment-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.comment-avatar-placeholder {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--color-gray-400);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gray-600);
}

.comments-list .comment-author {
    font-weight: 600;
    color: var(--color-gray-900);
}

.comments-list .comment-date {
    font-size: 0.8rem;
    color: var(--color-gray-600);
}

.comments-list .comment-content {
    color: var(--color-gray-800);
    line-height: 1.6;
}

.comments-list .comment-delete {
    margin-left: auto;
    padding: 0.2rem 0.5rem;
    background: transparent;
    border: 1px solid #d44;
    color: #d44;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.comments-list .comment-delete:hover {
    background: #d44;
    color: var(--color-white);
}

.login-prompt {
    padding: 1.5rem;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-lg);
    text-align: center;
    margin-top: 1.5rem;
}

.login-prompt a {
    color: var(--color-primary);
    font-weight: 600;
}

.comments-list .comment-replies {
    margin-top: 1rem;
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--color-gray-400);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.comments-list .comment.reply {
    background: var(--color-gray-100);
}

.no-comments {
    color: var(--color-gray-600);
    text-align: center;
    padding: 2rem;
    font-style: italic;
}

/* Pager — the list's own control system: 32px targets, 8px radius, the blue that marks
   the current row in the tree. The old one was 42px circles with a sliding red bubble. */
.pager {
    display: flex; align-items: center; gap: 2px;
    margin: 40px 0 8px; padding-top: 20px;
    border-top: 1px solid var(--s-line);
}
.pager-nav, .pager-num {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px; padding: 0 8px;
    border-radius: 8px; color: var(--s-sub); text-decoration: none;
    font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
    transition: background .1s ease-out, color .1s ease-out;
}
.pager-nav:hover, .pager-num:hover { background: var(--s-row); color: var(--s-text); }
.pager-num.on { background: var(--s-blue-bg); color: var(--s-blue); }
.pager-nav svg { width: 16px; height: 16px; }
.pager-nav[aria-disabled] { color: var(--s-faint); pointer-events: none; }
.pager-gap {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 24px; height: 32px; color: var(--s-faint); font-size: 13px;
}
.pager-count {
    margin-left: auto; font-size: 12.5px; color: var(--s-faint);
    font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) { .pager-count { display: none; } }

/* ===== Responsive: 1300px ===== */
@media (max-width: 1300px) {
    .category-post-card:nth-child(3) {
        display: none;
    }
}

/* ===== Responsive: 1100px ===== */
@media (max-width: 1100px) {
    .category-post-card:nth-child(2) {
        display: none;
    }
}

/* ===== Responsive: 600px ===== */
@media (max-width: 600px) {
    .category-overview-list {
        display: none;
    }
}

/* ===== Responsive: 900px (Tablet) Layout ===== */
@media (max-width: 900px) {
    .category-post-card:nth-child(2) {
        display: flex;
    }

    .top-categories {
        display: none;
    }

    .post-list {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 0.6rem;
    }
}

/* ===== Responsive: 768px (Small Tablet) ===== */
@media (max-width: 768px) {
    .category-post-card:nth-child(2) {
        display: none;
    }

    .meta-tag {
        font-size: 0.75rem;
        padding: 0.1rem 0.4rem;
    }

    .post-navigation {
        flex-direction: column;
        gap: 1rem;
        margin: 2rem 0 1.5rem;
        padding: 1rem 0;
    }

    .nav-prev, .nav-next {
        max-width: 100%;
    }

    .nav-next {
        text-align: left;
    }

    .comments-section {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }

    .post-list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .post-card-thumbnail {
        height: 120px;
    }

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

    .page-title-row {
        gap: 0.5rem;
    }
}

/* ===== Responsive: 600px (Large Phone) ===== */
@media (max-width: 600px) {
    .page-meta .separator {
        display: none;
    }

    .page-meta > span {
        margin-right: 0.5rem;
    }

    .post-tags-inline {
        display: none;
    }

    .post-list {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .post-card-thumbnail {
        height: 120px;
    }

    .post-card-body {
        padding: 0.4rem 0.6rem;
    }

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

    .post-card-summary {
        font-size: 0.75rem;
        -webkit-line-clamp: 1;
    }

    .post-card-meta {
        font-size: 0.65rem;
    }

    .post-card-tags {
        display: none;
    }

    .nav-title {
        font-size: 0.9rem;
    }

    .comments-section h2 {
        font-size: 1.1rem;
    }

    .comment-form textarea {
        min-height: 80px;
    }
}

/* ===== Responsive: 480px (Small Phone) ===== */
@media (max-width: 480px) {
    .post-card-thumbnail {
        height: 100px;
    }

    .post-card-body {
        padding: 0.35rem 0.5rem;
        gap: 0.1rem;
    }

    .post-card-title {
        font-size: 0.8rem;
        line-height: 1.3;
    }

    .post-card-summary {
        display: none;
    }

    .post-card-meta {
        font-size: 0.6rem;
    }

    .post-navigation {
        margin: 1.5rem 0 1rem;
    }

    .nav-label {
        font-size: 0.7rem;
    }

    .nav-title {
        font-size: 0.85rem;
    }

    .comments-section {
        margin-top: 1.5rem;
    }

    .comments-section h2 {
        font-size: 1rem;
    }

    .comments-list > .comment {
        padding: 0.75rem 1rem;
    }
}

/* ==================== Unified Post Card Styles ==================== */
/* the card grid's columns live in card.css alone; a second set here broke it on phones */

.home-cards-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 0.75rem;
    row-gap: 2rem;
    grid-auto-rows: 1fr;
}

.home-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: var(--transition-fast);
}

.home-card:hover .home-card-thumb img {
    transform: scale(1.03);
}

.home-card:hover .home-card-title {
    color: var(--color-primary);
}

.home-card-thumb {
    width: 100%;
    height: 140px;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-200);
}

.home-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--d-slow) ease;
}

.home-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, var(--s-line) 50%, #f1f3f5 100%);
}

.home-card-placeholder span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-gray-600);
    text-align: center;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-card-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-gray-600);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-card-breadcrumb .breadcrumb-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex-shrink: 0;
}

.home-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.home-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-gray-900);
    margin: 0 0 0.3rem 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-card-summary {
    font-size: 0.8rem;
    color: var(--color-gray-700);
    margin: 0 0 auto 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-card-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--color-gray-700);
    font-weight: 500;
}

.home-card-footer span {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.home-card-footer svg {
    width: 12px;
    height: 12px;
}

.home-card-footer .sep {
    color: var(--color-gray-400);
}

.home-card-tags {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.2rem;
    margin-top: 0.3rem;
    overflow: hidden;
}

.home-tag {
    padding: 0.05rem 0.35rem;
    background: transparent;
    border-radius: var(--radius-xs);
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid currentColor;
}

.home-tag-more {
    font-size: 0.7rem;
    color: var(--color-gray-500);
}

/* Responsive */
@media (max-width: 1024px) {
    .home-cards-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .home-cards-list {
        grid-template-columns: minmax(0, 1fr);
        grid-auto-rows: auto;
    }
    .home-cards-list .home-card-summary {
        margin-bottom: 0;
    }
}

/* A post's own emoji beside its title, the way Confluence marks a page. These rules ship to
   readers too — the editing states live in edit-panel.css, which only staff load. */
.page-head { display: flex; align-items: flex-start; justify-content: flex-start; gap: 12px; }
.page-emoji {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; margin-top: 2px; padding: 0;
    border: 0; border-radius: 8px; background: none; cursor: pointer;
    transition: background .12s ease;
}
.page-emoji img { width: 40px; height: 40px; display: block; }
.page-emoji:disabled { cursor: default; pointer-events: none; }
.page-emoji.empty { display: none; }
@media (max-width: 640px) {
    .page-emoji { width: 34px; height: 34px; }
    .page-emoji img { width: 30px; height: 30px; }
}

/* the list page's end: air under the grid, the pager, and then the footer */
.post-list { padding-bottom: 8px; }
.pager { margin-bottom: 24px; }

/* ---- All Posts, below the list: one section per top category, each subcategory a row of
   home cards under a small heading. It used to be a tall grey tile beside a 2x2 of
   mini-cards, with the category's mark ghosted behind. ---- */
.category-overview-list { display: flex; flex-direction: column; gap: 40px; margin: 40px 0 8px; }
.cat-block .posts-header { margin-bottom: 14px; align-items: baseline; }
.cat-block .posts-header h2 {
    display: flex; align-items: center; gap: 8px; margin: 0;
    font-size: 16px; font-weight: 700; letter-spacing: -.01em; color: #191F28;
}
.cat-block .posts-header h2 img { width: 22px; height: 22px; object-fit: contain; }
.cat-block .posts-header h2 em { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--s-faint); font-variant-numeric: tabular-nums; }
.cat-block .posts-header .view-all {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 12.5px; font-weight: 600; color: var(--s-faint); text-decoration: none;
    transition: color .1s ease-out, gap .12s ease-out;
}
.cat-block .posts-header .view-all:hover { color: var(--s-blue); gap: 6px; }
.cat-sub + .cat-sub { margin-top: 20px; }
.cat-sub-head {
    display: inline-flex; align-items: center; gap: 6px; margin: 0 0 10px;
    padding: 4px 8px 4px 4px; border-radius: 8px;
    font-size: 13px; font-weight: 700; color: var(--s-sub); text-decoration: none;
    transition: background .1s ease-out, color .1s ease-out;
}
.cat-sub-head img { width: 20px; height: 20px; object-fit: contain; }
.cat-sub-head svg { width: 14px; height: 14px; color: var(--s-faint); transition: transform .12s ease-out; }
.cat-sub-head:hover { background: var(--s-row); color: var(--s-text); }
.cat-sub-head:hover svg { transform: translateX(2px); }
/* .posts-header's row layout lives in home.css, which this page does not load */
.cat-block .posts-header { display: flex; justify-content: space-between; }

/* the list's search field shows for everyone, so its styles live here, not in post-manage.css */
.list-search{position:relative;display:flex;align-items:center;gap:var(--s-2);margin:0 0 var(--s-3);padding:0 var(--s-3);
    height:var(--h-ctl);border:1px solid var(--c-border);border-radius:var(--r-ctl);background:var(--c-surface);color:var(--c-text-subtlest)}
.list-search:focus-within{border-color:var(--s-blue)}
.list-search svg{width:16px;height:16px;flex:none}
.list-search input{flex:1;min-width:0;border:0;background:none;font:inherit;font-size:var(--fs-ui);color:var(--c-text);outline:0}
.list-search input::-webkit-search-cancel-button{display:none}
.list-search-clear{display:inline-flex;align-items:center;color:var(--c-text-subtlest)}
.list-search-clear:hover{color:var(--c-text)}
.post-list > [data-off] { display: none; }
.pager[hidden] { display: none; }
