/* TradeDebug product page — sits inside the Cogentico chrome. */

.td-app .cog-main { overflow-x: hidden; }
.td-app.is-investigating { overflow: hidden; }
.td-app.is-investigating .cog-main { padding: 0; }

.td-landing { position: relative; padding-bottom: 5rem; }

.td-backdrop {
    pointer-events: none;
    position: absolute;
    inset: 0 0 auto;
    height: 640px;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, var(--cog-glow), transparent),
        radial-gradient(circle at 18% 30%, rgba(244, 63, 94, 0.08), transparent 45%),
        radial-gradient(circle at 82% 45%, rgba(249, 115, 22, 0.1), transparent 40%);
}

.td-backdrop::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image: radial-gradient(circle at center, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(to bottom, black 20%, transparent 85%);
    -webkit-mask-image: linear-gradient(to bottom, black 20%, transparent 85%);
}

.td-hero {
    position: relative;
    max-width: 820px;
    margin: 0 auto;
    padding: clamp(2.5rem, 7vw, 4.5rem) 1.25rem 2.25rem;
    text-align: center;
}

.td-crumb {
    margin: 0 0 1.1rem;
    font-size: 0.82rem;
    color: var(--cog-muted-dim);
}

.td-crumb a { color: var(--cog-accent-from); }
.td-crumb a:hover { color: #fdba74; }
.td-crumb span { margin: 0 0.4rem; }

.td-eyebrow {
    margin: 0 0 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--cog-muted-dim);
}

.td-hero h1 {
    margin: 0 0 1.1rem;
    font-size: clamp(2.1rem, 5.2vw, 3.2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.td-hero h1 .accent { color: var(--cog-accent-from); }

.td-lead {
    margin: 0 auto 1.75rem;
    max-width: 640px;
    color: var(--cog-muted);
}

.td-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }

.td-pills li {
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
    color: var(--cog-muted);
    background: var(--cog-surface);
    border: 1px solid var(--cog-border);
    border-radius: 999px;
}

.td-cases { position: relative; max-width: var(--cog-max); margin: 0 auto; padding: 0 1.25rem; }

.td-section-head { text-align: center; max-width: 560px; margin: 0 auto 2.5rem; }
.td-section-head h2 { margin: 0 0 0.6rem; font-size: clamp(1.6rem, 3.2vw, 2rem); font-weight: 700; letter-spacing: -0.02em; }
.td-section-head p { margin: 0; color: var(--cog-muted); }

.td-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 720px) { .td-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .td-grid { grid-template-columns: repeat(3, 1fr); } }

.td-case {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    text-align: left;
    cursor: pointer;
    border: 1px solid var(--cog-border);
    border-radius: var(--cog-radius-lg);
    background: linear-gradient(165deg, var(--cog-surface) 0%, var(--cog-bg-elevated) 100%);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.td-case:hover {
    transform: translateY(-2px);
    border-color: rgba(249, 115, 22, 0.35);
    box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.08), 0 24px 48px -24px rgba(0, 0, 0, 0.6);
}

.td-case-icon {
    align-self: flex-start;
    width: 40px;
    height: 40px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cog-accent-from);
    border-radius: 10px;
    background: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.25);
}

.td-case-icon svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.td-case.baseline .td-case-icon { color: var(--cog-muted); background: rgba(255, 255, 255, 0.05); border-color: var(--cog-border); }

.td-badge {
    align-self: flex-start;
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cog-accent-from);
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-radius: 999px;
}

.td-case.baseline .td-badge { color: var(--cog-muted); background: rgba(255, 255, 255, 0.04); border-color: var(--cog-border); }

.td-case h3 { margin: 0.75rem 0 0.5rem; font-size: 1.05rem; font-weight: 600; line-height: 1.35; letter-spacing: -0.02em; }
.td-case p { margin: 0 0 1.25rem; font-size: 0.88rem; color: var(--cog-muted); line-height: 1.55; }

.td-case-link {
    padding: 0;
    font: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
    background: none;
    border: none;
}

.td-case-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.td-case-link:focus-visible { outline: none; }
.td-case-link:focus-visible::after { outline: 2px solid var(--cog-accent-from); outline-offset: 2px; }

.td-case-meta {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--cog-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.td-case-counts { font-size: 0.76rem; color: var(--cog-muted-dim); }

.td-go {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    color: var(--cog-muted-dim);
    border: 1px solid var(--cog-border);
    border-radius: 999px;
    transition: color 0.2s, border-color 0.2s, transform 0.2s, background 0.2s;
}

.td-go svg { width: 0.95rem; height: 0.95rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.td-case:hover .td-go {
    transform: translateX(3px);
    color: #0a0a0b;
    border-color: transparent;
    background: linear-gradient(135deg, #fdba74, var(--cog-accent-from));
}

/* ---------------------------------------------------------------- investigation */

.td-investigation {
    display: none;
    flex-direction: column;
    position: fixed;
    top: var(--cog-nav-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cog-bg);
    z-index: 50;
}

.td-app.is-investigating .td-investigation { display: flex; }

.td-topbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: clamp(1rem, 3vw, 2rem);
    padding: 1rem clamp(1rem, 4vw, 2rem);
    border-bottom: 1px solid var(--cog-border);
    background: var(--cog-bg-elevated);
}

.td-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    font: inherit;
    font-size: 0.85rem;
    color: var(--cog-muted);
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--cog-border);
    border-radius: 999px;
    white-space: nowrap;
}

.td-back svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.td-back:hover { color: var(--cog-text); border-color: var(--cog-muted-dim); }

.td-case-id { min-width: 0; flex: 1; display: flex; align-items: center; gap: 0.75rem; }
.td-case-id h2 { margin: 0; font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.td-stats { display: flex; gap: 1.5rem; }
.td-stats div { text-align: right; }
.td-stats dt { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--cog-muted-dim); }
.td-stats dd { margin: 0; font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.td-stats dd.bad { color: #f87171; }
.td-stats dd.ok { color: #4ade80; }

@media (max-width: 860px) { .td-stats { display: none; } }

.td-messages { flex: 1; overflow-y: auto; padding: clamp(1.25rem, 4vw, 2.5rem) 1.25rem; }
.td-messages > * { max-width: 820px; margin-left: auto; margin-right: auto; }

.td-intro { text-align: center; padding: clamp(1rem, 6vh, 3rem) 0; }
.td-intro h3 { margin: 0 0 0.6rem; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.td-intro p { margin: 0 auto 2rem; max-width: 520px; color: var(--cog-muted); }

.td-suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }

.td-suggestion {
    padding: 0.55rem 1rem;
    font: inherit;
    font-size: 0.85rem;
    color: var(--cog-muted);
    cursor: pointer;
    background: var(--cog-surface);
    border: 1px solid var(--cog-border);
    border-radius: 999px;
}

.td-suggestion:hover { color: var(--cog-text); border-color: var(--cog-accent-from); }

.td-msg { margin-bottom: 1.25rem; }
.td-msg.user { display: flex; justify-content: flex-end; }

.td-msg.user .td-bubble {
    max-width: 75%;
    padding: 0.7rem 1.1rem;
    border-radius: 18px 18px 4px 18px;
    background: linear-gradient(135deg, #fdba74, var(--cog-accent-from));
    color: #0a0a0b;
    font-weight: 500;
}

.td-msg.assistant .td-bubble {
    padding: 1.1rem 1.4rem;
    border: 1px solid var(--cog-border);
    border-radius: 4px 18px 18px 18px;
    background: var(--cog-surface);
}

.td-bubble > *:first-child { margin-top: 0; }
.td-bubble > *:last-child { margin-bottom: 0; }
.td-bubble p { margin: 0 0 0.75rem; }
.td-bubble h4 { margin: 1.25rem 0 0.5rem; font-size: 0.95rem; font-weight: 600; }
.td-bubble ul, .td-bubble ol { margin: 0 0 0.75rem; padding-left: 1.3rem; }
.td-bubble li { margin-bottom: 0.3rem; }
.td-bubble hr { border: none; border-top: 1px solid var(--cog-border); margin: 1rem 0; }
.td-bubble code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.85em; color: var(--cog-accent-from); }
.td-bubble pre { margin: 0 0 0.75rem; padding: 0.9rem 1rem; overflow-x: auto; background: var(--cog-bg); border: 1px solid var(--cog-border); border-radius: var(--cog-radius); }
.td-bubble pre code { color: var(--cog-muted); }

.td-thinking { color: var(--cog-muted-dim); }
.td-thinking::after { content: ""; animation: td-dots 1.2s steps(4, end) infinite; }
@keyframes td-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.td-composer {
    flex-shrink: 0;
    display: flex;
    gap: 0.6rem;
    padding: 1rem clamp(1rem, 4vw, 2.5rem) 1.5rem;
    border-top: 1px solid var(--cog-border);
    background: var(--cog-bg-elevated);
}

.td-composer input {
    flex: 1;
    min-width: 0;
    padding: 0.8rem 1.1rem;
    font: inherit;
    color: var(--cog-text);
    background: var(--cog-surface);
    border: 1px solid var(--cog-border);
    border-radius: 999px;
    outline: none;
}

.td-composer input:focus { border-color: var(--cog-accent-from); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12); }
.td-composer input::placeholder { color: var(--cog-muted-dim); }

.td-composer button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.8rem 1.4rem;
    font: inherit;
    font-weight: 600;
    color: #0a0a0b;
    cursor: pointer;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #fdba74, var(--cog-accent-from));
    box-shadow: 0 4px 20px var(--cog-glow);
}

.td-composer button svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.td-composer button:hover:not(:disabled) { filter: brightness(1.06); }
.td-composer button:disabled { opacity: 0.45; cursor: default; box-shadow: none; }

@media (min-width: 900px) {
    .td-composer { justify-content: center; }
    .td-composer input { max-width: 700px; }
}
