/* É — hidden-build chat widget. Matches the theme design system. */

.ee-root {
    position: fixed;
    right: 20px;
    bottom: 20px;
    /* Above every piece of site chrome (highest elsewhere is 99999). */
    z-index: 100000;
    font-family: inherit;
}

.ee-bubble {
    width: 54px;
    height: 54px;
    padding: 0;
    border: 2px solid var(--accent);
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease;
}
.ee-bubble__face {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.ee-bubble:hover {
    transform: scale(1.06);
}

/* The hidden attribute must win over our display values. */
.ee-panel[hidden],
.ee-nudge[hidden] {
    display: none;
}

.ee-nudge {
    position: absolute;
    right: 0;
    bottom: 72px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 290px;
    padding: 14px 32px 14px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text);
    cursor: pointer;
    animation: ee-nudge-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Speech-bubble tail pointing at Enzo's head. */
.ee-nudge::after {
    content: "";
    position: absolute;
    right: 19px;
    bottom: -7px;
    width: 12px;
    height: 12px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    transform: rotate(45deg);
}
.ee-nudge__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
}
.ee-nudge__text {
    flex: 1;
    min-width: 0;
}
@keyframes ee-nudge-in {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ee-nudge__close {
    position: absolute;
    top: 6px;
    right: 9px;
    border: none;
    background: none;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
}
.ee-nudge__close:hover {
    color: var(--text);
}
@media (prefers-reduced-motion: reduce) {
    .ee-nudge { animation: none; }
}

.ee-head__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    align-self: center;
}

.ee-panel {
    position: absolute;
    right: 0;
    bottom: 68px;
    width: min(360px, calc(100vw - 40px));
    height: min(480px, calc(100vh - 120px));
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.ee-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.ee-head__name {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text);
}
.ee-head__sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.ee-close {
    margin-left: auto;
    border: none;
    background: none;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    /* Real-thumb tap target (Apple minimum 44x44) without growing visually. */
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    margin-top: -8px;
    margin-bottom: -8px;
    margin-right: -12px;
}
.ee-close:hover {
    color: var(--text);
}

.ee-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ee-msg {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}
.ee-msg--assistant {
    align-self: flex-start;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}
.ee-msg--assistant a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.ee-msg--user {
    align-self: flex-end;
    background: var(--accent);
    color: #fff;
}

.ee-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
}
.ee-input {
    flex: 1;
    padding: 10px 13px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.ee-input:focus {
    outline: none;
    border-color: var(--accent);
}
.ee-send {
    width: 42px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    transition: opacity 0.15s ease;
}
.ee-send:hover {
    opacity: 0.85;
}

.ee-human {
    display: block;
    padding: 8px 12px 12px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}
.ee-human:hover {
    color: var(--accent);
}

@media (max-width: 480px) {
    .ee-root { right: 12px; bottom: 12px; }
}

/* Phones: the chat is a full-screen sheet, not a floating card. Dynamic
   viewport height keeps it sized correctly with the keyboard open. */
@media (max-width: 640px) {
    .ee-panel {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border: none;
        border-radius: 0;
    }
    .ee-head {
        padding-top: calc(14px + env(safe-area-inset-top, 0px));
    }
    .ee-human {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    /* 16px stops iOS Safari's auto-zoom on input focus. */
    .ee-input {
        font-size: 16px;
    }
    /* The bubble is redundant while the sheet is open. */
    .ee-root:has(.ee-panel:not([hidden])) .ee-bubble,
    .ee-root:has(.ee-panel:not([hidden])) .ee-nudge {
        display: none;
    }
}
