/* ═══════════════════════════════════════════════════════════════
   Nova Pixel — Discovery Chat
   Matches the hero-v5 design system (see design.md)
   ═══════════════════════════════════════════════════════════════ */

:root {
    --primary: #1F3BFF;
    --primary-hover: #152bd6;
    --primary-light: rgba(31, 59, 255, 0.08);
    --bg-dark: #0C0D10;
    --bg-light: #F5F4EF;
    --text-dark: #3A3B3E;
    --text-light: #56575B;
    --text-muted: #9A9B9F;
    --border-light: rgba(12, 13, 16, 0.10);
    --border-lighter: rgba(12, 13, 16, 0.06);
    --font-sans: "Hanken Grotesk", system-ui, sans-serif;
    --font-heading: "Bricolage Grotesque", sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
}

body.discovery-page {
    font-family: var(--font-sans);
    background: var(--bg-light);
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

/* ── Background grid (brand "engineering" texture) ─────────── */
.dsc-grid-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(12, 13, 16, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(12, 13, 16, 0.045) 1px, transparent 1px);
    background-size: 100px 100px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, black 0%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, black 0%, transparent 75%);
}

/* ── Layout ──────────────────────────────────────────────────── */
.dsc-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 28px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 24px;
    height: 100dvh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.dsc-sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
}
.dsc-sidebar::-webkit-scrollbar { display: none; }

.dsc-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 2px;
}
.dsc-logo img { height: 24px; width: auto; }
.dsc-logo span {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
    color: var(--bg-dark);
}

.dsc-card {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 18px;
    padding: 22px;
}

.dsc-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 13px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 100px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 14px;
}
.dsc-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    animation: dscPulse 1.8s ease-in-out infinite;
}
@keyframes dscPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

.dsc-client-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 24px;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: var(--bg-dark);
    margin: 0 0 4px;
    overflow-wrap: anywhere;
}
.dsc-client-email {
    font-size: 13.5px;
    color: var(--text-muted);
    margin: 0;
    overflow-wrap: anywhere;
}

.dsc-steps-title {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 16px;
}
.dsc-step {
    display: flex;
    gap: 12px;
    position: relative;
    padding-bottom: 18px;
}
.dsc-step:last-child { padding-bottom: 0; }
.dsc-step::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 28px;
    bottom: 2px;
    width: 1px;
    background: var(--border-light);
}
.dsc-step:last-child::before { display: none; }
.dsc-step-num {
    flex-shrink: 0;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-light);
}
.dsc-step.active .dsc-step-num {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(31, 59, 255, 0.30);
}
.dsc-step.done .dsc-step-num {
    background: var(--bg-dark);
    border-color: var(--bg-dark);
    color: #fff;
}
.dsc-step-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--bg-dark);
    padding-top: 4px;
}
.dsc-step-desc {
    font-size: 12.5px;
    color: var(--text-light);
    line-height: 1.5;
    margin-top: 2px;
}

/* ── Live project brief ─────────────────────────────────────── */
.dsc-brief-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border-lighter);
    font-size: 12.5px;
}
.dsc-brief-row:last-of-type { border-bottom: none; }
.dsc-brief-label {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--text-muted);
}
.dsc-brief-value {
    text-align: right;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}
.dsc-brief-row.filled .dsc-brief-value {
    color: var(--bg-dark);
    font-weight: 600;
}
.dsc-brief-row.filled .dsc-brief-label::after {
    content: " ✓";
    color: var(--primary);
    font-weight: 700;
}
.dsc-brief-row.flash {
    animation: dscBriefFlash 1.2s ease;
}
@keyframes dscBriefFlash {
    0% { background: var(--primary-light); }
    100% { background: transparent; }
}
.dsc-brief-fit {
    display: none;
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--primary-light);
    border: 1px solid rgba(31, 59, 255, 0.18);
    border-radius: 12px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--primary);
    animation: dscMsgIn 0.35s ease both;
}
.dsc-brief-fit.show { display: block; }
.dsc-brief-fit::before {
    content: "Best fit";
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 3px;
}

/* ── Quick-reply chips ──────────────────────────────────────── */
.dsc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-self: flex-start;
    max-width: 78%;
    margin-left: 40px;
    animation: dscMsgIn 0.3s ease both;
}
.dsc-chip {
    padding: 9px 17px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    background: #fff;
    border: 1px solid rgba(31, 59, 255, 0.30);
    border-radius: 100px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.15s;
}
.dsc-chip:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}

.dsc-note {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-light);
    background: transparent;
    border: 1px dashed var(--border-light);
    border-radius: 14px;
    padding: 14px 16px;
}
.dsc-note strong { color: var(--bg-dark); }

/* ── Chat panel ──────────────────────────────────────────────── */
.dsc-chat {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(12, 13, 16, 0.06);
}

.dsc-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-lighter);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
}
.dsc-chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.dsc-avatar {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
}
.dsc-avatar.nova {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(31, 59, 255, 0.30);
}
.dsc-avatar.lead {
    background: var(--bg-dark);
    color: #fff;
    font-size: 13px;
}
.dsc-chat-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15.5px;
    letter-spacing: -0.01em;
    color: var(--bg-dark);
    line-height: 1.15;
}
.dsc-chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}
.dsc-online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #27C93F;
}
.dsc-close {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 100px;
    transition: background 0.2s, color 0.2s;
}
.dsc-close:hover { background: var(--hover-overlay, rgba(12,13,16,0.05)); }

/* Messages */
.dsc-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 26px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    /* Soft off-white canvas so white Nova bubbles and blue lead bubbles
       both pop against the chat background */
    background:
        linear-gradient(rgba(12, 13, 16, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(12, 13, 16, 0.025) 1px, transparent 1px),
        #FAF9F5;
    background-size: 40px 40px, 40px 40px, auto;
}

.dsc-msg {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    max-width: 78%;
    animation: dscMsgIn 0.3s ease both;
}
@keyframes dscMsgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.dsc-msg.nova { align-self: flex-start; }
.dsc-msg.lead { align-self: flex-end; flex-direction: row-reverse; }

/* Consecutive messages from the same sender group tighter, avatar only once */
.dsc-msg.grouped { margin-top: -8px; }
.dsc-msg.grouped .dsc-avatar { visibility: hidden; }

.dsc-msg .dsc-avatar {
    width: 30px;
    height: 30px;
    font-size: 11px;
}

.dsc-msg-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.dsc-msg.lead .dsc-msg-body { align-items: flex-end; }

/* Sender label + timestamp above each message group */
.dsc-msg-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 6px 5px;
}
.dsc-msg.nova .dsc-msg-meta { color: var(--primary); }
.dsc-msg-meta .dsc-meta-time {
    font-weight: 500;
    color: var(--text-muted);
}
.dsc-ai-tag {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px solid rgba(31, 59, 255, 0.18);
    border-radius: 100px;
    padding: 1px 7px;
}

.dsc-bubble {
    padding: 12px 17px;
    font-size: 14.5px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.dsc-msg.nova .dsc-bubble {
    background: #fff;
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--primary);
    color: var(--text-dark);
    border-radius: 4px 16px 16px 4px;
    box-shadow: 0 4px 14px rgba(12, 13, 16, 0.05);
}
.dsc-msg.lead .dsc-bubble {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #fff;
    border-radius: 18px 18px 5px 18px;
    box-shadow: 0 8px 20px rgba(31, 59, 255, 0.25);
}
.dsc-bubble.typing-bubble {
    padding: 8px 14px;
}

/* Typing indicator */
.dsc-typing-dots {
    display: inline-flex;
    gap: 5px;
    padding: 3px 2px;
}
.dsc-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: dscTyping 1.2s infinite ease-in-out;
}
.dsc-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.dsc-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dscTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Input */
.dsc-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    border-top: 1px solid var(--border-lighter);
    background: #fff;
}
.dsc-input {
    flex: 1;
    min-width: 0;
    padding: 14px 20px;
    font-family: var(--font-sans);
    font-size: 16px;
    color: var(--bg-dark);
    background: var(--bg-light);
    border: 1px solid var(--border-lighter);
    border-radius: 100px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    /* Field is intentionally light-on-light; tell mobile browsers so they
       don't force-darken it, and keep font-size at 16px so iOS Safari
       doesn't auto-zoom the page in on focus. */
    color-scheme: light;
}
.dsc-input::placeholder { color: var(--text-muted); }
.dsc-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: #fff;
}
.dsc-input:-webkit-autofill,
.dsc-input:-webkit-autofill:hover,
.dsc-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--bg-dark);
    caret-color: var(--bg-dark);
    transition: background-color 99999s ease-in-out 0s;
}
.dsc-send {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 26px rgba(31, 59, 255, 0.30);
    transition: background 0.2s, transform 0.15s;
}
.dsc-send:hover { background: var(--primary-hover); transform: translateY(-1px); }
.dsc-send:disabled { opacity: 0.5; cursor: default; transform: none; }
.dsc-send svg { width: 18px; height: 18px; }

.dsc-input-hint {
    text-align: center;
    font-size: 11.5px;
    color: var(--text-muted);
    padding: 0 18px 12px;
    background: #fff;
}

/* Done state button */
.dsc-done-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0 auto;
    padding: 14px 30px;
    background: var(--bg-dark);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 100px;
    cursor: pointer;
    transition: background 0.2s;
}
.dsc-done-btn:hover { background: var(--primary); }

/* ── Success overlay ────────────────────────────────────────── */
.dsc-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(245, 244, 239, 0.90);
    backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}
.dsc-overlay.active { opacity: 1; visibility: visible; }

.dsc-overlay-card {
    max-width: 480px;
    width: 100%;
    text-align: center;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: 0 24px 70px rgba(12, 13, 16, 0.12);
    transform: translateY(12px);
    transition: transform 0.35s ease;
}
.dsc-overlay.active .dsc-overlay-card { transform: translateY(0); }

.dsc-overlay-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 22px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 30px rgba(31, 59, 255, 0.35);
}
.dsc-overlay-icon svg { width: 30px; height: 30px; }
.dsc-overlay-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 28px;
    letter-spacing: -0.03em;
    color: var(--bg-dark);
    margin: 0 0 10px;
}
.dsc-overlay-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-light);
    margin: 0 0 6px;
}
.dsc-overlay-sub {
    font-size: 13.5px;
    color: var(--text-muted);
    margin: 0 0 28px;
}
.dsc-overlay-cta {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 15px 30px;
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    border-radius: 100px;
    box-shadow: 0 10px 26px rgba(31, 59, 255, 0.30);
    transition: background 0.2s;
}
.dsc-overlay-cta:hover { background: var(--primary-hover); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
    .dsc-shell {
        grid-template-columns: 1fr;
        padding: 14px;
        gap: 14px;
        grid-template-rows: auto 1fr;
    }
    .dsc-sidebar {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        overflow: visible;
    }
    .dsc-sidebar .dsc-card { padding: 14px 16px; }
    .dsc-sidebar .dsc-card.dsc-lead-card { flex: 1; }
    .dsc-steps-card, .dsc-brief-card, .dsc-note, .dsc-logo span { display: none; }
    .dsc-chips { margin-left: 38px; max-width: 88%; }
    .dsc-client-name { font-size: 17px; }
    .dsc-badge { margin-bottom: 8px; }
    .dsc-messages { padding: 18px 14px; }
    .dsc-msg { max-width: 88%; }
    .dsc-chat { border-radius: 18px; }
}
