@import url("/readingclub/readingclub-theme.css");

:root {
    --community-paper: oklch(0.975 0.012 80);
    --community-playbill: oklch(0.955 0.018 82);
    --community-ink: oklch(0.25 0.028 255);
    --community-muted: oklch(0.45 0.018 255);
    --community-red: oklch(0.59 0.2 29);
    --community-blue: oklch(0.48 0.17 255);
    --community-green: oklch(0.47 0.105 158);
    --community-coffee: oklch(0.43 0.08 58);
    --community-gold: oklch(0.82 0.14 87);
    --community-sage: oklch(0.88 0.045 158);
    --community-rule: oklch(0.25 0.028 255 / 0.22);
}

body[data-community-module="ai"] {
    --module-accent: var(--community-blue);
    --module-accent-dark: oklch(0.35 0.14 255);
    --module-accent-soft: oklch(0.91 0.045 255);
}

body[data-community-module="news"] {
    --module-accent: var(--community-green);
    --module-accent-dark: oklch(0.34 0.09 158);
    --module-accent-soft: oklch(0.92 0.035 158);
}

body[data-community-module="coffeechat"] {
    --module-accent: var(--community-coffee);
    --module-accent-dark: oklch(0.32 0.07 58);
    --module-accent-soft: oklch(0.93 0.035 70);
}

body[data-community-module] {
    --site-accent: var(--module-accent);
    --site-accent-dark: var(--module-accent-dark);
    --site-accent-soft: var(--module-accent-soft);
    --accent: var(--module-accent);
    --accent-soft: var(--module-accent-soft);
    --green: var(--module-accent);
    --green-dark: var(--module-accent-dark);
    --paper: var(--community-paper);
    --ink: var(--community-ink);
    --muted: var(--community-muted);
    --line: var(--community-rule);
    --surface: var(--community-playbill);
    --bg: var(--community-paper);
    --card: var(--community-playbill);
    --bg-elevated: var(--community-playbill);
    --bg-muted: color-mix(in oklch, var(--community-playbill) 86%, var(--module-accent-soft));
    --border: var(--community-rule);
    --border-strong: var(--community-ink);
    color: var(--community-ink);
    background: var(--community-paper);
}

body[data-community-module] .xia-nav {
    --site-accent: var(--module-accent);
    --site-accent-dark: var(--module-accent-dark);
    --site-accent-soft: var(--module-accent-soft);
}

body[data-community-module] .xia-nav-brand-icon {
    background: var(--module-accent);
}

body[data-community-module] .xia-nav-btn-subscribe {
    background: var(--module-accent);
}

body[data-community-module] :is(h1, h2, .tool-card-title, .item-card h3, .section-heading) {
    font-family: var(--rc-serif);
    letter-spacing: 0;
}

body[data-community-module] :is(
    .page-header,
    .hero,
    header.hero,
    .subscribe-hero,
    .result-header,
    .tree-header
) {
    border-radius: 4px;
}

body[data-community-module] :is(
    .tool-card,
    .item-card,
    .inline-cta,
    .subscribe-form-section,
    .card,
    .panel,
    .result-card,
    .quiz-card,
    .question-card,
    .domain-card,
    .level-card,
    .archive-month,
    .article-card
) {
    border: 1px solid var(--community-ink);
    border-radius: 4px;
    background: var(--community-playbill);
    box-shadow: none;
}

body[data-community-module] :is(button, .btn, .button, .cta-btn, .cta-btn-sm) {
    border-radius: 4px;
}

body[data-community-module] :is(
    .tool-card,
    .item-card,
    .card,
    .panel,
    .scenario-row,
    .archive-list a
) {
    transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 180ms cubic-bezier(0.16, 1, 0.3, 1), color 180ms ease;
}

@media (hover: hover) {
    body[data-community-module] :is(
        .tool-card,
        .item-card,
        .card,
        .panel,
        .scenario-row,
        .archive-list a
    ):hover {
        transform: translateY(-3px);
    }
}

/* AI practice */
body[data-community-module="ai"] .main-content {
    padding-top: clamp(2rem, 5vw, 4rem);
}

body[data-community-module="ai"].event-archive-page {
    display: block;
    padding: 0;
    overflow-x: clip;
}

body[data-community-module="ai"].event-archive-page > .container {
    margin-block: 24px;
}

body[data-community-module="ai"] .main-content > .container > .page-header {
    margin: 0 0 56px;
    padding: clamp(2.25rem, 6vw, 4.5rem) 0;
    border: 0;
    border-bottom: 1px solid var(--community-ink);
    background: transparent;
    text-align: left;
}

body[data-community-module="ai"] .main-content > .container > .page-header h1 {
    max-width: 10em;
    margin-bottom: 18px;
    font-size: clamp(2.8rem, 7vw, 5rem);
    line-height: 1.02;
}

body[data-community-module="ai"] .main-content > .container > .page-header p {
    max-width: 38rem;
    margin: 0;
    color: var(--community-muted);
    font-size: 1.05rem;
    line-height: 1.8;
}

body[data-community-module="ai"] .tools-grid {
    gap: clamp(18px, 2.2vw, 28px);
    border: 0;
    counter-reset: ai-tool;
}

body[data-community-module="ai"] .tool-card {
    position: relative;
    min-height: 220px;
    padding: 24px 8px 26px;
    border: 0;
    border-top: 2px solid var(--community-ink);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    counter-increment: ai-tool;
}

body[data-community-module="ai"] .tool-card::before {
    content: counter(ai-tool, decimal-leading-zero);
    position: absolute;
    top: 18px;
    right: 20px;
    color: var(--community-muted);
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

body[data-community-module="ai"] .tool-card:hover {
    border-color: var(--module-accent);
    box-shadow: none;
    transform: translateY(-2px);
}

body[data-community-module="ai"] .tool-card-icon {
    margin-bottom: 24px;
    color: var(--module-accent);
    font-family: var(--rc-sans);
    font-size: 0.78rem;
    font-weight: 800;
}

body[data-community-module="ai"] .tool-card-meta {
    border-color: currentColor;
}

body[data-community-module="ai"] .tool-card-meta::after {
    content: "↗";
    display: grid;
    width: 28px;
    height: 28px;
    margin-left: auto;
    border: 1px solid var(--community-ink);
    border-radius: 50%;
    place-items: center;
    color: var(--community-ink);
    background: var(--community-paper);
    font-size: 0.9rem;
}

body[data-community-module="ai"] .bottom-cta {
    border: 1px solid var(--community-ink);
    border-radius: 4px;
    background: var(--community-playbill);
    box-shadow: 10px 10px 0 var(--community-sage);
}

body[data-community-module="ai"] > :is(.container, .wrap, .page, .app-shell) {
    width: min(1160px, calc(100% - 40px));
    margin-inline: auto;
}

body[data-community-module="ai"] > .container > :is(header, .hero, .intro):first-child,
body[data-community-module="ai"] > :is(.hero, header.hero):first-of-type {
    position: relative;
    margin: 38px 12px 60px 0;
    padding: clamp(2rem, 5vw, 4.5rem);
    border: 1px solid var(--community-ink);
    background: var(--community-playbill);
    box-shadow: 12px 12px 0 var(--community-gold);
}

body[data-community-module="ai"] > .container > :is(header, .hero, .intro):first-child::before,
body[data-community-module="ai"] > :is(.hero, header.hero):first-of-type::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 9px;
    background: var(--module-accent);
}

body[data-community-module="ai"] :is(.tag, .badge, .pill, .tool-card-tag) {
    border-radius: 3px;
}

body[data-community-module="ai"] :is(.progress-fill, .progress-bar-fill, .level-progress-fill) {
    background: var(--module-accent);
}

body[data-community-module="ai"]:has(.tree-scroll-container) .tree-header {
    border-bottom: 1px solid var(--community-ink);
    background: var(--community-playbill);
    box-shadow: 0 6px 0 var(--community-gold);
}

body[data-community-module="ai"]:has(.tree-scroll-container) .tree-footer {
    border-top: 1px solid var(--community-ink);
    background: var(--community-playbill);
}

body[data-community-module="ai"]:has(.tree-scroll-container) .tree-scroll-container {
    background-color: var(--community-paper);
}

body[data-community-module="ai"]:has(.panel) .panel {
    box-shadow: 7px 7px 0 var(--community-gold);
}

/* AI news */
body[data-community-module="news"] .main-content,
body[data-community-module="news"] > main {
    width: min(820px, calc(100% - 40px));
    margin-inline: auto;
    padding-top: clamp(2.5rem, 6vw, 5rem);
}

body[data-community-module="news"] .stats-banner,
body[data-community-module="news"] .daily-header,
body[data-community-module="news"] .page-header,
body[data-community-module="news"] .subscribe-hero {
    position: relative;
    margin: 0 10px 58px 0;
    padding: clamp(2rem, 5vw, 4rem);
    border: 1px solid var(--community-ink);
    border-radius: 4px;
    background: var(--community-playbill);
    box-shadow: 10px 10px 0 var(--community-gold);
}

body[data-community-module="news"] :is(.stats-banner, .daily-header, .page-header, .subscribe-hero)::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 8px;
    background: var(--module-accent);
}

body[data-community-module="news"] .section-heading {
    display: block;
    padding: 0 0 14px;
    border-bottom: 1px solid var(--community-ink);
    color: var(--community-ink);
    font-size: clamp(1.5rem, 3vw, 2.2rem);
}

body[data-community-module="news"] .item-card {
    margin-bottom: 0;
    padding: 26px 0;
    border-width: 0 0 1px;
    background: transparent;
}

body[data-community-module="news"] .item-card.headline {
    padding: 28px 26px;
    border: 1px solid var(--community-ink);
    border-left: 8px solid var(--module-accent);
    background: var(--community-playbill);
}

body[data-community-module="news"] .item-card.headline:first-of-type {
    box-shadow: 8px 8px 0 var(--community-gold);
}

body[data-community-module="news"] .item-card .score {
    border-radius: 3px;
    background: var(--module-accent);
}

body[data-community-module="news"] :is(.tag-cloud .tag, .item-card .tag) {
    border: 1px solid color-mix(in oklch, var(--module-accent) 35%, transparent);
    border-radius: 3px;
    background: var(--module-accent-soft);
    color: var(--module-accent-dark);
}

body[data-community-module="news"] .inline-cta,
body[data-community-module="news"] .subscribe-form-section {
    border: 1px solid var(--community-ink);
    background: var(--community-playbill);
    box-shadow: 8px 8px 0 var(--community-sage);
}

body[data-community-module="news"] :is(.cta-btn-sm, button[type="submit"]) {
    border: 1px solid var(--community-ink);
    background: var(--module-accent);
    box-shadow: 3px 3px 0 var(--community-gold);
}

body[data-community-module="news"] .archive-list {
    border-top: 1px solid var(--community-ink);
}

body[data-community-module="news"] .archive-list li {
    border-color: var(--community-rule);
}

/* CoffeeChat keeps its operational density while sharing the material language. */
body[data-community-module="coffeechat"] {
    --radius: 4px;
    background: var(--community-paper);
}

body[data-community-module="coffeechat"] .site-header {
    position: relative;
    width: min(1200px, calc(100% - 40px));
    height: auto;
    margin: 34px auto 0;
    padding: 28px 34px;
    border: 1px solid var(--community-ink);
    border-radius: 4px;
    background: var(--community-playbill);
    box-shadow: 8px 8px 0 var(--community-gold);
}

body[data-community-module="coffeechat"] .site-header::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 8px;
    background: var(--module-accent);
}

body[data-community-module="coffeechat"] .wordmark {
    font-family: var(--rc-serif);
    color: var(--community-ink);
}

body[data-community-module="coffeechat"] main {
    padding-top: 24px;
}

body[data-community-module="coffeechat"] :is(.catalog-heading, .briefing-main) h1 {
    font-family: var(--rc-serif);
    letter-spacing: 0;
}

body[data-community-module="coffeechat"] .catalog-heading {
    padding-bottom: 24px;
    border-bottom: 1px solid var(--community-ink);
}

body[data-community-module="coffeechat"] .catalog-filters input,
body[data-community-module="coffeechat"] .catalog-filters select,
body[data-community-module="coffeechat"] textarea,
body[data-community-module="coffeechat"] .practice-toolbar select {
    border: 1px solid var(--community-ink);
    border-radius: 4px;
    background: var(--community-playbill);
}

body[data-community-module="coffeechat"] .scenario-group ul {
    border-color: var(--community-ink);
}

body[data-community-module="coffeechat"] .scenario-row {
    border-color: var(--community-rule);
}

body[data-community-module="coffeechat"] .scenario-row:hover {
    background: var(--module-accent-soft);
}

body[data-community-module="coffeechat"] :is(.button, button.primary, .send) {
    border: 1px solid var(--community-ink);
    background: var(--module-accent);
    box-shadow: 3px 3px 0 var(--community-gold);
}

body[data-community-module="coffeechat"] .secondary {
    border: 1px solid var(--community-ink);
    background: var(--community-playbill);
    color: var(--community-ink);
    box-shadow: none;
}

body[data-community-module="coffeechat"] .briefing {
    margin: 34px 10px 60px 0;
    padding: clamp(2rem, 5vw, 4rem);
    border: 1px solid var(--community-ink);
    border-left: 8px solid var(--module-accent);
    border-radius: 4px;
    background: var(--community-playbill);
    box-shadow: 10px 10px 0 var(--community-gold);
}

body[data-community-module="coffeechat"] .role-intro {
    border-color: var(--community-rule);
}

body[data-community-module="coffeechat"] .chat-workspace {
    border: 1px solid var(--community-ink);
    border-radius: 4px;
    background: var(--community-playbill);
    box-shadow: 8px 8px 0 var(--community-gold);
}

body[data-community-module="coffeechat"] .messages {
    background: color-mix(in oklch, var(--community-paper) 88%, var(--module-accent-soft));
}

body[data-community-module="coffeechat"] .message p {
    border-radius: 4px;
    background: var(--module-accent-soft);
}

body[data-community-module="coffeechat"] .message.user p {
    border-color: var(--community-ink);
    background: var(--community-playbill);
}

body[data-community-module="coffeechat"] :is(.view-tabs, .view-heading, .facts, .reveal-overview, .feedback) {
    border-color: var(--community-rule);
}

body[data-community-module="coffeechat"] .view-tabs [aria-current] {
    color: var(--module-accent);
    border-color: var(--module-accent);
}

body[data-community-module="coffeechat"] .reveal-round {
    border: 1px solid var(--community-ink);
    border-radius: 4px;
    background: var(--community-playbill);
}

body[data-community-module="coffeechat"] .site-footer {
    width: min(1200px, calc(100% - 40px));
    margin-inline: auto;
    padding: 12px 0 18px;
    border-top-color: var(--community-rule);
    background: transparent;
}

body[data-community-module="coffeechat"] .site-footer > span {
    display: none;
}

body[data-community-module="coffeechat"] .site-footer nav {
    margin-left: auto;
}

body[data-community-module="coffeechat"]:has(.conversation) .site-header {
    display: none;
}

body[data-community-module="coffeechat"]:has(.conversation) main {
    padding-top: 0;
}

@media (max-width: 720px) {
    body[data-community-module] > :is(.container, .wrap, .page, .app-shell) {
        width: min(100% - 28px, 1160px);
    }

    body[data-community-module="ai"] .main-content {
        padding-inline: 14px;
    }

    body[data-community-module="ai"] .main-content > .container > .page-header,
    body[data-community-module="ai"] > .container > :is(header, .hero, .intro):first-child,
    body[data-community-module="ai"] > :is(.hero, header.hero):first-of-type {
        margin-right: 7px;
        padding: 30px 22px;
        box-shadow: 7px 7px 0 var(--community-gold);
    }

    body[data-community-module="ai"] .main-content > .container > .page-header h1 {
        font-size: clamp(2.6rem, 15vw, 4rem);
    }

    body[data-community-module="ai"] .tools-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    body[data-community-module="ai"] .tool-card {
        min-height: 0;
        padding: 24px;
        box-shadow: 4px 4px 0 var(--community-gold);
    }

    body[data-community-module="news"] .main-content,
    body[data-community-module="news"] > main {
        width: min(100% - 28px, 820px);
        padding-inline: 0;
    }

    body[data-community-module="news"] :is(.stats-banner, .daily-header, .page-header, .subscribe-hero) {
        margin-right: 7px;
        padding: 28px 22px;
        box-shadow: 7px 7px 0 var(--community-gold);
    }

    body[data-community-module="coffeechat"] .site-header {
        width: min(100% - 28px, 1200px);
        margin-top: 24px;
        padding: 22px 20px;
        box-shadow: 6px 6px 0 var(--community-gold);
    }

    body[data-community-module="coffeechat"] main {
        padding-inline: 14px;
    }

    body[data-community-module="coffeechat"] .briefing {
        margin-right: 6px;
        padding: 26px 20px;
        box-shadow: 6px 6px 0 var(--community-gold);
    }

    body[data-community-module="coffeechat"] .chat-workspace {
        box-shadow: 5px 5px 0 var(--community-gold);
    }
}

@media (max-width: 640px) {
    body[data-community-module="coffeechat"]:has(.conversation) .conversation:has(#composer:not([hidden])) .messages {
        height: min(18svh, 180px);
        min-height: 140px;
    }
}
