/* 13Forum — classic forum homepage (mockup layout)
   Token bridge: prefer global design tokens where possible (AUD-UI-017). */
body.page-home {
    --home-gap: 1.1rem;
    --home-grid-gap: .65rem;
    --home-radius: var(--radius-md, 12px);
    --home-blue: var(--primary, #5b63eb);
    --home-blue-dark: var(--primary-hover, #4a52d9);
    --home-blue-soft: var(--primary-light, #e8f1ff);
    --home-surface: var(--surface, #ffffff);
    --home-bg: var(--bg, #eef0f4);
    --home-text: var(--text, #1a2233);
    --home-muted: var(--text-muted, #475569);
    --home-border: var(--border, #e2e8f0);
    --home-shadow: var(--shadow-md, 0 1px 3px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .04));
}

body.page-home .main-content {
    padding-top: 0;
    padding-bottom: 2rem;
    background: var(--home-bg);
}

.home-page {
    padding: 1.25rem 0 0;
}

.home-canvas {
    display: flex;
    flex-direction: column;
    gap: var(--home-gap);
}

/* Hero */
.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(300px, 1fr);
    gap: .65rem;
    align-items: stretch;
}

.home-hero__main {
    display: flex;
    align-items: center;
    min-height: 188px;
    padding: 1.125rem 1.35rem;
    border-radius: var(--home-radius);
    background: var(--home-surface);
    border: 1px solid var(--home-border);
    box-shadow: var(--home-shadow);
}

.home-hero__copy {
    max-width: 34rem;
}

.home-hero__copy h1 {
    margin: 0 0 .5rem;
    font-size: clamp(1.5rem, 2.5vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--home-text);
}

.home-hero__copy p {
    margin: 0 0 .95rem;
    font-size: .95rem;
    line-height: 1.55;
    color: var(--home-muted);
    max-width: 46ch;
}

.home-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
}

.home-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .48rem .95rem;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, transform .12s ease;
}

.home-btn--primary {
    background: var(--home-blue);
    color: #fff;
    border: 1px solid var(--home-blue);
}

.home-btn--primary:hover {
    background: var(--home-blue-dark);
    color: #fff;
}

.home-btn--secondary {
    background: var(--home-surface);
    color: var(--home-blue);
    border: 1px solid var(--home-border);
}

.home-btn--secondary:hover {
    border-color: color-mix(in srgb, var(--home-blue) 35%, var(--home-border));
    color: var(--home-blue-dark);
}

/* Stats card — reference layout */
.home-stats-card {
    padding: 0.875rem 1rem 0.95rem;
    border-radius: var(--home-radius);
    background: var(--home-surface);
    border: 1px solid var(--home-border);
    box-shadow: var(--home-shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.home-stats-card h2 {
    margin: 0 0 .65rem;
    padding: 0 .15rem;
    font-size: .95rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.home-stats-card__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    align-items: stretch;
}

.home-stat {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: .3rem;
    padding: .35rem .5rem;
    min-height: 0;
}

.home-stat + .home-stat::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10%;
    height: 80%;
    width: 1px;
    background: #e2e8f0;
}

.home-stat__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3b82f6;
    line-height: 0;
    margin-bottom: .1rem;
}

.home-stat__icon svg {
    width: 44px;
    height: 44px;
    display: block;
}

.home-stat__icon--online {
    color: #22c55e;
}

.home-stat strong {
    font-size: clamp(1.25rem, 2vw, 1.55rem);
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
    letter-spacing: -.02em;
}

.home-stat__label {
    font-size: .875rem;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.2;
}

/* 3-column card grid (3×3) */
.home-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--home-grid-gap);
}

.home-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: var(--home-surface);
    border: 1px solid var(--home-border);
    border-radius: var(--home-radius);
    box-shadow: var(--home-shadow);
    overflow: hidden;
}

.home-card__head {
    padding: .85rem 1rem .65rem;
    border-bottom: 1px solid var(--home-border);
}

.home-card__head h2 {
    margin: 0;
    font-size: .88rem;
    font-weight: 800;
    color: var(--home-text);
}

.home-projects-tabs {
    min-width: 0;
}

.home-projects-tabs__nav {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    padding: .55rem 1rem .65rem;
    border-bottom: 1px solid var(--home-border);
    background: color-mix(in srgb, var(--home-bg) 45%, var(--home-surface));
}

.home-projects-tabs__tab {
    appearance: none;
    border: 1px solid var(--home-border);
    border-radius: 999px;
    background: var(--home-surface);
    color: var(--home-muted);
    font: inherit;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.2;
    padding: .32rem .65rem;
    cursor: pointer;
    max-width: 100%;
    white-space: nowrap;
}

.home-projects-tabs__tab:hover {
    color: var(--home-blue);
    border-color: color-mix(in srgb, var(--home-blue) 35%, var(--home-border));
}

.home-projects-tabs__tab.is-active {
    background: var(--home-blue-soft);
    border-color: color-mix(in srgb, var(--home-blue) 35%, var(--home-border));
    color: var(--home-blue-dark);
}

.home-projects-tabs__panel {
    display: none;
    min-width: 0;
    overflow: hidden;
}

.home-projects-tabs__panel.is-active {
    display: block;
}

.home-projects-tabs__foot {
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .2rem .35rem;
    align-items: center;
}

.home-card__foot {
    margin-top: auto;
    padding: .65rem 1rem .85rem;
    border-top: 1px solid var(--home-border);
}

.home-card__foot a {
    font-size: .78rem;
    font-weight: 700;
    color: var(--home-blue);
}

.home-card__foot a:hover {
    color: var(--home-blue-dark);
}

.home-card__empty {
    margin: 0;
    padding: 1rem;
    font-size: .8rem;
    color: var(--home-muted);
    text-align: center;
}

.home-card__empty--inline {
    padding: .35rem 1rem .15rem;
    text-align: left;
}

/* Category list */
.home-catlist {
    list-style: none;
    margin: 0;
    padding: .35rem 0;
}

.home-catlist__item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: .65rem;
    align-items: center;
    padding: .55rem 1rem;
    color: var(--home-text);
    transition: background .12s ease;
}

.home-catlist__item:hover {
    background: #f8fafc;
    color: var(--home-text);
}

.home-catlist__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--home-blue-soft);
    font-size: 1rem;
}

.home-catlist__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.home-catlist__body strong {
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.3;
}

.home-catlist__body em {
    font-style: normal;
    font-size: .72rem;
    color: var(--home-muted);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-catlist__stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .1rem;
    font-size: .68rem;
    font-weight: 600;
    color: var(--home-muted);
    white-space: nowrap;
}

/* Post list */
.home-postlist,
.home-userlist,
.home-simplelist,
.home-updatelist,
.home-leaderboard {
    list-style: none;
    margin: 0;
    padding: .35rem 0;
}

.home-postlist__item,
.home-userlist__item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .6rem;
    align-items: center;
    padding: .5rem 1rem;
    color: var(--home-text);
    transition: background .12s ease;
}

.home-postlist__item:hover,
.home-userlist__item:hover {
    background: #f8fafc;
    color: var(--home-text);
}

.home-postlist__item img,
.home-userlist__item img {
    border-radius: 50%;
    border: 1px solid var(--home-border);
}

.home-postlist__body,
.home-userlist__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .08rem;
}

.home-postlist__body strong,
.home-userlist__body strong {
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.35;
}

.home-postlist__body em,
.home-userlist__body em {
    font-style: normal;
    font-size: .72rem;
    color: var(--home-muted);
}

/* Simple list (unanswered / leading) */
.home-simplelist__item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: .5rem;
    align-items: center;
    padding: .5rem 1rem;
    color: var(--home-text);
    transition: background .12s ease;
}

.home-simplelist__item:hover {
    background: #f8fafc;
    color: var(--home-text);
}

.home-simplelist__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--home-blue-soft);
    color: var(--home-blue);
}

.home-simplelist__icon--trend {
    background: #ecfdf5;
    color: #059669;
}

.home-simplelist__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .08rem;
}

.home-simplelist__body strong {
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-simplelist__body em {
    font-style: normal;
    font-size: .7rem;
    color: var(--home-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-simplelist__badge {
    font-size: .72rem;
    font-weight: 800;
    color: var(--home-muted);
    padding: .15rem .4rem;
    border-radius: 6px;
    background: #f1f5f9;
}

.home-simplelist__views {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    font-size: .7rem;
    font-weight: 700;
    color: var(--home-muted);
    white-space: nowrap;
}

/* Leaderboard */
.home-leaderboard {
    counter-reset: rank;
}

.home-leaderboard__item {
    display: grid;
    grid-template-columns: auto auto 1fr minmax(48px, 72px) auto;
    gap: .45rem;
    align-items: center;
    padding: .45rem 1rem;
    color: var(--home-text);
    transition: background .12s ease;
}

.home-leaderboard__item:hover {
    background: #f8fafc;
    color: var(--home-text);
}

.home-leaderboard__rank {
    width: 1.1rem;
    font-size: .75rem;
    font-weight: 800;
    color: var(--home-blue);
    text-align: center;
}

.home-leaderboard__item img {
    border-radius: 50%;
    border: 1px solid var(--home-border);
}

.home-leaderboard__name {
    font-size: .78rem;
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-leaderboard__bar {
    height: 6px;
    border-radius: 999px;
    background: #eef2f7;
    overflow: hidden;
}

.home-leaderboard__bar span {
    display: block;
    height: 100%;
    width: var(--pct, 0%);
    border-radius: inherit;
    background: linear-gradient(90deg, var(--home-blue), #60a5fa);
}

.home-leaderboard__count {
    font-size: .72rem;
    font-weight: 800;
    color: var(--home-muted);
    text-align: right;
}

/* Online users */
.home-online {
    padding: .85rem 1rem 1rem;
}

.home-online__avatars {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: .5rem;
}

.home-online__avatar {
    display: block;
}

.home-online__avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--home-surface);
    box-shadow: 0 0 0 1px var(--home-border);
}

.home-online__summary {
    margin: 0;
    font-size: .82rem;
    font-weight: 700;
    color: var(--home-text);
}

/* Updates list */
.home-updatelist__item {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .55rem 1rem;
    color: var(--home-text);
    transition: background .12s ease;
}

.home-updatelist__item:hover {
    background: #f8fafc;
    color: var(--home-text);
}

.home-updatelist__badge {
    align-self: flex-start;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--home-blue);
    background: var(--home-blue-soft);
    padding: .12rem .38rem;
    border-radius: 4px;
}

.home-updatelist__badge--news {
    color: #7c3aed;
    background: #f3e8ff;
}

.home-updatelist__item strong {
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.35;
}

.home-updatelist__item time {
    font-size: .7rem;
    color: var(--home-muted);
}

/* Features strip */
.home-features {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--home-grid-gap);
    padding: .25rem 0 1rem;
}

.home-feature {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .8rem .9rem;
    border-radius: var(--home-radius);
    background: var(--home-surface);
    border: 1px solid var(--home-border);
    box-shadow: var(--home-shadow);
    text-align: left;
}

.home-feature__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--home-blue-soft);
    color: var(--home-blue);
}

.home-feature__body {
    min-width: 0;
}

.home-feature h3 {
    margin: 0 0 .2rem;
    font-size: .84rem;
    font-weight: 800;
    color: var(--home-text);
    line-height: 1.3;
}

.home-feature p {
    margin: 0;
    font-size: .74rem;
    line-height: 1.4;
    color: var(--home-muted);
}

/* Dark theme */
[data-theme="dark"] body.page-home .main-content {
    background: var(--bg);
}

[data-theme="dark"] body.page-home {
    --home-surface: var(--surface);
    --home-bg: var(--bg);
    --home-text: var(--text);
    --home-muted: var(--text-muted);
    --home-border: var(--border);
    --home-blue-soft: color-mix(in srgb, var(--home-blue) 15%, transparent);
    --home-shadow: none;
}

[data-theme="dark"] .home-catlist__item:hover,
[data-theme="dark"] .home-postlist__item:hover,
[data-theme="dark"] .home-userlist__item:hover,
[data-theme="dark"] .home-simplelist__item:hover,
[data-theme="dark"] .home-hot__item:hover,
[data-theme="dark"] .home-leaderboard__item:hover,
[data-theme="dark"] .home-updatelist__item:hover {
    background: var(--bg-elevated);
}

.home-search {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin: 0 0 1.5rem;
}
.home-search .form-control {
    flex: 1;
}
.home-hot {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: .35rem 0;
}
.home-hot__item {
    display: grid;
    grid-template-columns: 1.75rem minmax(0, 1fr) auto;
    gap: .55rem;
    align-items: center;
    padding: .5rem 1rem;
    text-decoration: none;
    color: inherit;
    transition: background .12s ease;
}
.home-hot__item:hover {
    background: #f8fafc;
    color: inherit;
}
.home-hot__rank {
    font-weight: 700;
    opacity: 0.55;
    flex-shrink: 0;
}
.home-hot__title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.35;
}
.home-hot__stat {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: .72rem;
    font-weight: 700;
    color: var(--home-muted);
}
.home-cta {
    margin-top: 2rem;
    padding: 1.5rem;
    text-align: center;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 165, 233, 0.06));
}
.home-cta p {
    margin: 0.5rem 0 1rem;
}

/* Responsive */
@media (max-width: 1100px) {
    .home-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .home-features {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .home-hero {
        grid-template-columns: 1fr;
    }
    .home-stats-card__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .home-grid,
    .home-features {
        grid-template-columns: 1fr;
    }
    .home-catlist__stats {
        display: none;
    }
    .home-leaderboard__bar {
        display: none;
    }
    .home-leaderboard__item {
        grid-template-columns: auto auto 1fr auto;
    }
}

@media (max-width: 480px) {
    .home-hero__main {
        padding: 1.25rem 1rem;
    }
}
