/* ==========================================================================
   Claire – Wealth Central chat widget
   A dark, gold-accented concierge panel that sits with the site's dark sections.
   ========================================================================== */

.claire {
    --claire-bg: #101212;
    --claire-surface: #1A1D1D;
    --claire-raised: #232727;
    --claire-gold: #C9A87C;
    --claire-gold-deep: #B8956A;
    --claire-line: rgba(201, 168, 124, 0.24);
    --claire-hairline: rgba(255, 255, 255, 0.07);
    --claire-text: #F3EFE8;
    --claire-muted: #A9A49B;
    --claire-ink: #14120E;
    --claire-heading: var(--wc-font-heading, 'Cormorant Garamond'), 'Cormorant Garamond', Georgia, serif;
    --claire-body: var(--wc-font-body, 'Jost'), 'Jost', 'Helvetica Neue', Arial, sans-serif;
    --claire-ease: cubic-bezier(0.2, 0.8, 0.2, 1);

    position: fixed;
    bottom: 24px;
    z-index: 99990;
    font-family: var(--claire-body);
    color: var(--claire-text);
    -webkit-font-smoothing: antialiased;
}
.claire--right { right: 24px; }
.claire--left { left: 24px; }
.claire *, .claire *::before, .claire *::after { box-sizing: border-box; }

.claire-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.claire button:focus-visible,
.claire a:focus-visible {
    outline: 2px solid var(--claire-gold);
    outline-offset: 2px;
}

/* Avatar */
.claire-monogram {
    position: relative;
    flex-shrink: 0;
    display: block;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--claire-gold-deep);
    box-shadow: 0 0 0 1px rgba(201, 168, 124, 0.7);
}
.claire-monogram img,
.claire-msg-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    border-radius: 50%;
    object-fit: cover;
}
.claire-dot {
    position: absolute;
    right: 0;
    bottom: 1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #6FCF97;
    border: 2px solid var(--claire-bg);
}

/* Launcher */
.claire-launcher {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 6px 26px 6px 6px;
    background: linear-gradient(145deg, #1E2121 0%, #0E1010 100%);
    color: var(--claire-text);
    border: 1px solid rgba(201, 168, 124, 0.5);
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
    transition: transform 0.35s var(--claire-ease), border-color 0.35s ease, box-shadow 0.35s ease;
    animation: claire-rise 0.6s var(--claire-ease) both;
}
.claire-launcher:hover {
    transform: translateY(-3px);
    border-color: var(--claire-gold);
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.45), 0 0 0 4px rgba(201, 168, 124, 0.1);
}
.claire-launcher-text {
    font-family: var(--claire-heading);
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.03em;
    line-height: 1;
}
.claire.is-open .claire-launcher { display: none; }

/* Panel */
.claire-panel {
    display: flex;
    flex-direction: column;
    width: 400px;
    height: min(660px, calc(100vh - 48px));
    overflow: hidden;
    border: 1px solid var(--claire-line);
    border-radius: 20px;
    background:
        radial-gradient(130% 55% at 100% 0%, rgba(201, 168, 124, 0.13) 0%, transparent 62%),
        var(--claire-bg);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
    transform-origin: bottom right;
    animation: claire-open 0.38s var(--claire-ease);
}
.claire--left .claire-panel { transform-origin: bottom left; }
.claire-panel[hidden] { display: none; }

@keyframes claire-open {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to { opacity: 1; transform: none; }
}
@keyframes claire-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

/* Header */
.claire-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 18px 18px 22px;
}
.claire-header::after {
    content: '';
    position: absolute;
    left: 22px;
    right: 22px;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--claire-gold) 0%, rgba(201, 168, 124, 0.08) 100%);
    opacity: 0.55;
}
.claire-heading { flex: 1; min-width: 0; }
.claire-name {
    font-family: var(--claire-heading);
    font-size: 27px;
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: 0.01em;
    color: var(--claire-text);
}
.claire-sub {
    margin-top: 3px;
    font-size: 12.5px;
    font-weight: 300;
    letter-spacing: 0.02em;
    color: var(--claire-muted);
}
.claire-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--claire-muted);
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease;
}
.claire-close:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--claire-text);
}

/* Messages */
.claire-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 18px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(201, 168, 124, 0.3) transparent;
}
.claire-messages::-webkit-scrollbar { width: 5px; }
.claire-messages::-webkit-scrollbar-thumb {
    background: rgba(201, 168, 124, 0.3);
    border-radius: 5px;
}

.claire-msg {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 14px;
    animation: claire-rise 0.35s var(--claire-ease) both;
}
.claire-msg--user { justify-content: flex-end; }
.claire-msg-avatar {
    flex-shrink: 0;
    display: block;
    width: 30px;
    height: 30px;
    margin-top: 1px;
    border-radius: 50%;
    background: var(--claire-gold-deep);
    box-shadow: 0 0 0 1px var(--claire-line);
}
.claire-avatar-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding-bottom: 2px;
    border-radius: 50%;
    background: linear-gradient(145deg, #DCC29C 0%, #B8956A 55%, #97764E 100%);
    color: var(--claire-ink);
    font-family: var(--claire-heading);
    font-size: 24px;
    font-weight: 500;
    line-height: 1;
}
.claire-msg-avatar .claire-avatar-letter { font-size: 16px; }
.claire-bubble {
    max-width: 84%;
    padding: 11px 15px;
    font-size: 14.5px;
    font-weight: 400;
    line-height: 1.58;
    overflow-wrap: anywhere;
}
.claire-msg--assistant .claire-bubble {
    background: var(--claire-surface);
    color: var(--claire-text);
    border: 1px solid var(--claire-hairline);
    border-radius: 4px 16px 16px 16px;
}
.claire-msg--user .claire-bubble {
    background: linear-gradient(145deg, #D4B88F 0%, #B8956A 100%);
    color: var(--claire-ink);
    border-radius: 16px 16px 4px 16px;
}
.claire-bubble a {
    color: var(--claire-gold);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.claire-msg--user .claire-bubble a { color: var(--claire-ink); }

/* Quick questions */
.claire-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 2px 0 14px 40px;
    animation: claire-rise 0.45s var(--claire-ease) 0.12s both;
}
.claire-chip {
    margin: 0;
    padding: 8px 14px;
    border: 1px solid var(--claire-line);
    border-radius: 999px;
    background: rgba(201, 168, 124, 0.05);
    color: var(--claire-text);
    font-family: var(--claire-body);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.claire-chip:hover {
    background: var(--claire-gold);
    border-color: var(--claire-gold);
    color: var(--claire-ink);
    transform: translateY(-1px);
}

/* Typing indicator */
.claire-msg--assistant .claire-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 15px 16px;
}
.claire-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--claire-gold);
    animation: claire-dot 1.2s infinite ease-in-out;
}
.claire-typing span:nth-child(2) { animation-delay: 0.15s; }
.claire-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes claire-dot {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

/* Details form */
.claire-lead {
    margin: 2px 0 14px;
    padding: 20px 18px 18px;
    border: 1px solid var(--claire-line);
    border-radius: 16px;
    background: var(--claire-surface);
    animation: claire-rise 0.4s var(--claire-ease) both;
}
.claire-lead-title {
    font-family: var(--claire-heading);
    font-size: 23px;
    font-weight: 500;
    line-height: 1.1;
    color: var(--claire-text);
}
.claire-lead-intro {
    margin: 4px 0 16px;
    font-size: 12.5px;
    font-weight: 300;
    line-height: 1.45;
    color: var(--claire-muted);
}
.claire-lead label {
    display: block;
    margin: 0 0 12px;
    font-size: 12.5px;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: var(--claire-muted);
}
.claire-lead label span[aria-hidden] { color: var(--claire-gold); }
.claire .claire-lead input[type="text"],
.claire .claire-lead input[type="email"],
.claire .claire-lead input[type="tel"],
.claire .claire-lead textarea {
    display: block;
    width: 100%;
    margin: 5px 0 0;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--claire-text);
    font-family: var(--claire-body);
    font-size: 14.5px;
    box-shadow: none;
    transition: border-color 0.25s ease, background 0.25s ease;
}
.claire .claire-lead textarea { resize: none; }
.claire .claire-lead input:focus,
.claire .claire-lead textarea:focus {
    outline: none;
    border-color: var(--claire-gold);
    background: rgba(255, 255, 255, 0.06);
}
.claire-lead .claire-consent {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 14px;
    font-size: 12.5px;
    letter-spacing: 0;
    line-height: 1.45;
}
.claire-lead .claire-consent input {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    margin: 2px 0 0;
    accent-color: var(--claire-gold-deep);
}
.claire-lead .claire-consent a { color: var(--claire-gold); }
.claire-lead-error {
    margin: 0 0 10px;
    font-size: 12.5px;
    color: #F0A594;
}
.claire-lead-error:empty { display: none; }
.claire-lead-submit {
    width: 100%;
    margin: 0;
    padding: 12px 18px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(145deg, #D4B88F 0%, #B8956A 100%);
    color: var(--claire-ink);
    font-family: var(--claire-body);
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: filter 0.25s ease, transform 0.25s ease;
}
.claire-lead-submit:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
}
.claire-lead-submit:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
}

/* Composer */
.claire-composer { padding: 10px 16px 12px; }
.claire-input {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 0;
    padding: 6px 6px 6px 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 26px;
    background: var(--claire-surface);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.claire-input:focus-within {
    border-color: var(--claire-gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 124, 0.12);
}
.claire .claire-input textarea {
    flex: 1;
    min-width: 0;
    max-height: 120px;
    margin: 0;
    padding: 8px 0;
    border: none;
    border-radius: 0;
    outline: none;
    resize: none;
    background: transparent;
    box-shadow: none;
    color: var(--claire-text);
    font-family: var(--claire-body);
    font-size: 14.5px;
    line-height: 1.4;
}
.claire .claire-input textarea::placeholder {
    color: var(--claire-muted);
    opacity: 1;
}
.claire-send {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, #D4B88F 0%, #B8956A 100%);
    color: var(--claire-ink);
    cursor: pointer;
    transition: transform 0.25s ease, filter 0.25s ease;
}
.claire-send:hover {
    transform: translateY(-1px);
    filter: brightness(1.07);
}
.claire-send:disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
}

.claire-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 9px 6px 0;
    font-size: 11.5px;
    font-weight: 300;
    color: var(--claire-muted);
}
.claire-team-link {
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    color: var(--claire-gold);
    font-family: var(--claire-body);
    font-size: 11.5px;
    font-weight: 400;
    white-space: nowrap;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.claire-team-link:hover { color: var(--claire-text); }

/* Phones: the panel fills the screen */
@media (max-width: 480px) {
    .claire { bottom: 16px; }
    .claire--right { right: 16px; }
    .claire--left { left: 16px; }
    .claire.is-open { top: 0; right: 0; bottom: 0; left: 0; }
    .claire-panel {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        border: none;
        border-radius: 0;
    }
    .claire-composer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
    .claire-monogram { width: 42px; height: 42px; }

    /* Just the portrait on phones, so the button covers less of the page. */
    .claire-launcher { padding: 5px; }
    .claire-launcher-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }
    .claire-panel .claire-monogram { width: 46px; height: 46px; }
    /* 16px stops iOS zooming in on focus. */
    .claire .claire-input textarea,
    .claire .claire-lead input[type="text"],
    .claire .claire-lead input[type="email"],
    .claire .claire-lead input[type="tel"],
    .claire .claire-lead textarea { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .claire *, .claire *::before, .claire *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
    }
}
