/* treechat.com/ai — builds on cli.css; adds the treecore layer (grain, HUD labels, violet beam) */

body.ai-page {
    background: #0b0a0f;
}

.ai-grain {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.09;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.ai-page-container {
    position: relative;
    z-index: 1;
    background-image: linear-gradient(
            100deg,
            transparent 38%,
            rgba(161, 20, 255, 0.1) 48%,
            rgba(199, 198, 255, 0.05) 52%,
            transparent 62%
        ),
        radial-gradient(ellipse 60% 45% at 50% 0%, rgba(161, 20, 255, 0.24), transparent 70%),
        radial-gradient(ellipse 50% 35% at 90% 100%, rgba(184, 207, 252, 0.1), transparent 70%);
    background-repeat: no-repeat;
    background-size: 100% 1400px, 100% 100%, 100% 100%;
}

.ai-content code,
.ai-hud,
.ai-section-hud,
.ai-mode-tag,
.ai-stat-label,
.ai-chain span {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ------------------------------- hero ------------------------------- */

.ai-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 940px;
}

.ai-hud {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 10px;
    margin: 0 0 26px;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: rgba(255, 255, 255, 0.62);
}

.ai-hud-sep {
    color: rgba(255, 255, 255, 0.3);
}

.ai-hud-bars {
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.55);
}

.ai-hud-bars b {
    color: #ff3b3b;
    font-weight: 400;
}

.ai-title {
    margin: 0;
    text-align: center;
    font-size: clamp(2.3rem, 7.5vw, 4.6rem);
    font-weight: 700;
    line-height: 1.04;
    letter-spacing: -0.045em;
}

.ai-title-glow {
    color: #e9e3ff;
    text-shadow: 0 0 6px #a114ff, 0 0 26px rgba(161, 20, 255, 0.7),
        0 0 60px rgba(199, 198, 255, 0.35);
}

.ai-subtitle {
    max-width: 720px;
}

.ai-hero-code {
    width: 100%;
    margin-top: 34px;
}

/* ------------------------------- stats ------------------------------ */

.ai-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
    max-width: 940px;
    margin-top: 64px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.ai-stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 22px 18px;
}

.ai-stat + .ai-stat {
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.ai-stat-value {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.ai-stat-label {
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

/* ------------------------------ sections ---------------------------- */

.ai-section-hud {
    margin: 0 0 10px;
    font-size: 0.74rem;
    letter-spacing: 0.2em;
    color: #c7a6ff;
}

/* ------------------------------- modes ------------------------------ */

.ai-modes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 26px;
}

.ai-mode {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 22px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.035);
}

.ai-mode-tag {
    margin: 0 0 10px;
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    color: #c7a6ff;
}

.ai-mode h3 {
    margin: 0 0 10px;
    font-size: 1.1rem;
}

.ai-mode h3 code {
    font-size: 0.95rem;
}

.ai-mode p:not(.ai-mode-tag) {
    flex: 1;
    margin: 0 0 16px;
    font-size: 0.95rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.74);
}

.ai-mode .cli-code-block pre code {
    font-size: 0.8rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ------------------------------- models ----------------------------- */

.ai-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

.ai-filter {
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.ai-filter span {
    margin-left: 4px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.45);
}

.ai-filter.is-active {
    border-color: rgba(161, 20, 255, 0.8);
    background: rgba(161, 20, 255, 0.18);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(161, 20, 255, 0.35);
}

.ai-models {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.ai-model {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.03);
    transition: border-color 0.18s ease, background-color 0.18s ease;
}

.ai-model[hidden] {
    display: none;
}

.ai-model:hover {
    border-color: rgba(161, 20, 255, 0.55);
    background: rgba(161, 20, 255, 0.08);
}

.ai-model[data-ref]::after,
.ai-ref-dot {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #a114ff;
    box-shadow: 0 0 8px #a114ff;
}

.ai-model[data-ref]::after {
    position: absolute;
    top: 14px;
    right: 14px;
}

.ai-content .ai-model-tag {
    align-self: flex-start;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: none;
    background: none;
    padding: 0;
    font-size: 0.82rem;
    color: #c7a6ff;
}

.ai-model-name {
    font-weight: 700;
    font-size: 1rem;
}

.ai-model-meta {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.55);
}

.ai-legend {
    display: block;
    margin-top: 16px;
}

/* ------------------------------- chain ------------------------------ */

.ai-chain {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 24px 0 18px;
    padding: 0;
    list-style: none;
}

.ai-chain li {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid rgba(161, 20, 255, 0.45);
    background: rgba(161, 20, 255, 0.08);
}

.ai-chain li + li {
    margin-left: 22px;
}

.ai-chain li + li::before {
    content: '\2192';
    position: absolute;
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
}

.ai-chain span {
    font-size: 0.66rem;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.5);
}

.ai-chain code {
    align-self: flex-start;
}

/* ------------------------------ responsive -------------------------- */

@media (max-width: 900px) {
    .ai-modes {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .ai-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .ai-stat:nth-child(3) {
        border-left: none;
    }

    .ai-stat:nth-child(n + 3) {
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }

    .ai-models {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 420px) {
    .ai-models {
        grid-template-columns: 1fr;
    }
}

.ai-model-price {
    margin-top: 2px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: #e9e3ff;
}
