/* Depthkit Community Archive - Discourse-inspired light theme */

:root {
    --primary: #222;
    --secondary: #fff;
    --tertiary: #0088cc;
    --header-bg: #ffffff;
    --header-border: #e1e4e8;
    --body-bg: #f5f5f5;
    --card-bg: #ffffff;
    --card-border: #e1e4e8;
    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --banner-bg: #fdf6e3;
    --banner-border: #f0d98c;
    --link-color: #0088cc;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --max-width: 1100px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-stack);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--body-bg);
}

a { color: var(--link-color); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

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

.site-title {
    font-size: 18px;
    font-weight: 600;
}

.header-nav {
    display: flex;
    gap: 20px;
}

.header-nav a {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.header-nav a:hover {
    background: #f0f0f0;
    text-decoration: none;
}

.header-nav .nav-external {
    border-left: 1px solid var(--card-border);
    padding-left: 20px;
    margin-left: 4px;
}

/* Archive banner */
.archive-banner {
    background: var(--banner-bg);
    border-bottom: 1px solid var(--banner-border);
    padding: 12px 20px;
    font-size: 14px;
    color: #6d5d00;
}

.banner-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 20px;
}

.banner-text {
    flex: 1;
}

.banner-inner a {
    color: #5a4e00;
    font-weight: 600;
    text-decoration: underline;
}

.banner-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    background: #5a4e00;
    color: #fff !important;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
}

.banner-btn:hover {
    background: #3d3500;
}

/* Content */
.site-content {
    min-height: calc(100vh - 200px);
}

.content-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px;
}

/* Page titles */
.page-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Breadcrumb */
.breadcrumb {
    font-size: 14px;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.breadcrumb a { color: var(--link-color); }
.breadcrumb .sep { margin: 0 6px; color: #ccc; }

/* Homepage two-column layout */
.homepage-columns {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 0;
    align-items: start;
}

/* Categories table */
.homepage-table {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    overflow: hidden;
}

.homepage-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--card-border);
    background: #fafafa;
}

.homepage-table-header .ht-col-topics {
    min-width: 60px;
    text-align: center;
}

.homepage-category-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.homepage-category-row:last-child { border-bottom: none; }

.homepage-category-row:hover { background: #fafafa; }

.homepage-category-row .ht-col-category { flex: 1; min-width: 0; }

.homepage-category-row .ht-col-topics {
    min-width: 60px;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    padding-top: 2px;
}

.hcat-main {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.hcat-swatch {
    display: inline-block;
    width: 6px;
    min-width: 6px;
    border-radius: 3px;
    align-self: stretch;
    min-height: 28px;
}

.hcat-info { flex: 1; min-width: 0; }

.hcat-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.hcat-name:hover { color: var(--link-color); text-decoration: none; }

.hcat-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hcat-subcategories {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 8px;
}

.hcat-subcategory {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--link-color);
    white-space: nowrap;
}

.hcat-subcategory:hover { text-decoration: underline; }

.hcat-sub-swatch {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

/* Homepage latest topics sidebar */
.homepage-latest {
    border-left: 1px solid var(--card-border);
    padding-left: 20px;
    margin-left: 20px;
}

.homepage-latest-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 10px;
    margin-bottom: 0;
    border-bottom: 2px solid var(--card-border);
    font-size: 12px;
}

.homepage-latest-row {
    display: grid;
    grid-template-columns: 45px 1fr auto;
    gap: 0 12px;
    align-items: start;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.homepage-latest-row:last-child { border-bottom: none; }

.hlatest-avatar {
    width: 45px;
    height: 45px;
    flex-shrink: 0;
    overflow: hidden;
}

.avatar-small {
    width: 45px;
    height: 45px;
    max-width: 45px;
    font-size: 17px;
}

.hlatest-info {
    min-width: 0;
    padding-top: 2px;
}

.hlatest-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.35;
    display: block;
}

.hlatest-title:hover { color: var(--link-color); text-decoration: none; }

.hlatest-meta {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.hlatest-meta .category-badge {
    font-size: 11px;
    padding: 1px 7px;
}

.hlatest-stats {
    text-align: right;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    padding-top: 2px;
}

.hlatest-replies {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.hlatest-stats time {
    font-size: 12px;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .homepage-columns {
        grid-template-columns: 1fr;
    }
    .homepage-latest {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        margin-top: 24px;
        border-top: 1px solid var(--card-border);
        padding-top: 16px;
    }
}

/* Legacy category card styles (used in other contexts if needed) */
.category-name {
    font-size: 16px;
    font-weight: 600;
}

/* Category header */
.category-header {
    margin-bottom: 20px;
}

.category-header h2 {
    font-size: 22px;
    font-weight: 600;
}

.category-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Topic list */
.topic-list {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    overflow: hidden;
}

.topic-list-header {
    display: grid;
    grid-template-columns: 1fr 70px 70px 90px;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--card-border);
    background: #fafafa;
}

.topic-list-header:has(.topic-col-category) {
    grid-template-columns: 1fr 150px 70px 70px 90px;
}

.topic-row {
    display: grid;
    grid-template-columns: 1fr 70px 70px 90px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
}

.topic-row:has(.topic-col-category) {
    grid-template-columns: 1fr 150px 70px 70px 90px;
}

.topic-col-title { min-width: 0; }

.topic-col-category {
    min-width: 0;
    overflow: hidden;
}

.topic-col-category .category-badge {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.topic-row:last-child { border-bottom: none; }

.topic-row:hover {
    background: #fafafa;
}

.topic-row.pinned {
    background: #fafbff;
}

.topic-col-title a {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
}

.topic-col-title a:hover { color: var(--link-color); }

.topic-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.topic-author { margin-right: 8px; }

.topic-col-replies,
.topic-col-views,
.topic-col-activity {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

.topic-col-activity time {
    font-size: 12px;
}

.pin-icon, .lock-icon {
    font-size: 12px;
    margin-right: 4px;
    vertical-align: middle;
}

.category-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.category-badge:hover { text-decoration: none; opacity: 0.9; }

/* Tag badges */
.tag-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    background: #e9e9e9;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
}

.tag-badge:hover { background: #ddd; text-decoration: none; }

/* Tags index page */
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tags-list-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s;
}

.tags-list-item:hover { background: #f0f0f0; text-decoration: none; }

.tags-list-item .tag-count {
    font-size: 12px;
    color: var(--text-muted);
    background: #f0f0f0;
    padding: 1px 6px;
    border-radius: 10px;
}

/* Topic page */
.topic-header {
    margin-bottom: 20px;
}

.topic-header h1 {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.topic-info {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.topic-tags {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.badge-closed { background: #e8e8e8; color: #666; }
.badge-archived { background: #fff3cd; color: #856404; }
.badge-admin { background: #e3f2fd; color: #1565c0; }
.badge-mod { background: #e8f5e9; color: #2e7d32; }

/* Post stream */
.post-stream {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.post {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
}

.post-layout {
    display: grid;
    grid-template-columns: 65px 1fr;
    min-height: 80px;
}

.post-avatar {
    padding: 16px 0 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

.avatar-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.avatar-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.post-body {
    padding: 14px 16px;
    min-width: 0;
}

.post-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.post-username {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}

.post-fullname {
    font-size: 13px;
    color: var(--text-muted);
}

.post-user-title {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

.post-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.post-number {
    font-size: 12px;
    color: #ccc;
}

.post-number:hover { color: var(--link-color); text-decoration: none; }

/* Post content - cooked HTML from Discourse */
.post-content {
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.post-content p { margin-bottom: 12px; }
.post-content p:last-child { margin-bottom: 0; }

.post-content h1, .post-content h2, .post-content h3,
.post-content h4, .post-content h5, .post-content h6 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 600;
}

.post-content h2 { font-size: 20px; }
.post-content h3 { font-size: 17px; }

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 4px 0;
}

.post-content pre {
    background: #f6f8fa;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 13px;
    margin-bottom: 12px;
}

.post-content code {
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 13px;
}

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

.post-content blockquote {
    border-left: 3px solid #ddd;
    padding: 8px 16px;
    margin: 8px 0;
    color: var(--text-secondary);
}

.post-content ul, .post-content ol {
    margin: 8px 0 8px 24px;
}

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

.post-content a { color: var(--link-color); }

.post-content .lightbox-wrapper { display: block; }
.post-content .lightbox-wrapper img { cursor: default; }

.post-content .emoji {
    width: 20px;
    height: 20px;
    vertical-align: text-bottom;
}

.post-content table {
    border-collapse: collapse;
    margin: 8px 0;
    width: 100%;
}

.post-content table th,
.post-content table td {
    border: 1px solid #ddd;
    padding: 6px 10px;
    font-size: 14px;
}

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

.post-content .onebox, .post-content .link-preview {
    border: 1px solid var(--card-border);
    border-radius: 4px;
    padding: 12px;
    margin: 8px 0;
    background: #fafafa;
}

.post-content .onebox img { max-width: 100%; }

/* Reply indicator */
.reply-indicator {
    padding: 6px 16px 0 80px;
    font-size: 12px;
}

.reply-indicator a {
    color: var(--text-muted);
}

/* Post action (small/moderator) */
.post-action-small {
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

.action-user {
    font-weight: 600;
    color: var(--text-secondary);
    font-style: normal;
}

/* Post footer */
.post-footer {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.like-count {
    font-size: 13px;
    color: #e0245e;
}

/* Topic status notice */
.topic-status-notice {
    background: #f8f8f8;
    border: 1px solid var(--card-border);
    border-radius: 4px;
    padding: 12px 16px;
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
    font-size: 14px;
}

.pagination a {
    padding: 6px 12px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 4px;
}

.pagination a:hover {
    background: #f0f0f0;
    text-decoration: none;
}

.page-info { color: var(--text-muted); }

/* Search page */
.search-page h2 {
    font-size: 22px;
    margin-bottom: 16px;
}

.search-box {
    margin-bottom: 16px;
}

#search-input {
    width: 100%;
    max-width: 600px;
    padding: 10px 16px;
    font-size: 16px;
    border: 1px solid var(--card-border);
    border-radius: 4px;
    font-family: var(--font-stack);
    outline: none;
    transition: border-color 0.15s;
}

#search-input:focus {
    border-color: var(--tertiary);
    box-shadow: 0 0 0 2px rgba(0, 136, 204, 0.15);
}

.search-status {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-result {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    padding: 14px 16px;
}

.search-result-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.search-result-title a { color: var(--text-primary); }
.search-result-title a:hover { color: var(--link-color); }

.search-result-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.search-result-excerpt {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.search-result-excerpt mark {
    background: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
}

/* Footer */
.site-footer {
    background: var(--header-bg);
    border-top: 1px solid var(--header-border);
    padding: 16px 20px;
    margin-top: 40px;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* Responsive */
@media (max-width: 700px) {
    .header-inner { padding: 8px 12px; }
    .site-title { font-size: 15px; }
    .header-nav { gap: 10px; }
    .header-nav a { font-size: 13px; padding: 2px 4px; }

    .content-inner { padding: 12px; }

    .topic-list-header { display: none; }
    .topic-row {
        display: block;
        padding: 10px 12px;
    }
    .topic-col-replies,
    .topic-col-views,
    .topic-col-activity,
    .topic-col-category {
        display: inline;
        font-size: 12px;
        text-align: left;
    }
    .topic-col-replies::before { content: "Replies: "; }
    .topic-col-views::before { content: "Views: "; }
    .topic-col-activity::before { content: "Activity: "; }
    .topic-meta { display: flex; gap: 8px; }

    .post-layout { grid-template-columns: 50px 1fr; }
    .post-avatar { padding-left: 8px; }
    .avatar { width: 35px; height: 35px; }
    .post-body { padding: 10px 12px; }
    .reply-indicator { padding-left: 60px; }
}
