/* BC Wine — landing + fullscreen chat overlay, soft wine palette */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Muted burgundy — desaturated so it reads as wine but stays easy on the eyes. */
    --primary: #7A3D4F;
    --primary-hover: #95506A;
    --primary-soft: #F4E7E9;
    --text-primary: #2A1F22;
    --text-secondary: #6B5B5E;
    --text-tertiary: #998A8C;
    --background: #FFFFFF;
    --background-secondary: #FBF6F6;
    --border-color: #ECDFE0;
    --border-subtle: #DCC9CC;
    --chat-surface: #F7EFEF;
}

html, body {
    height: 100%;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background: var(--background);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

/* ── Site header ─────────────────────────────────── */

.site-header {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--background);
}

.brand {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.2px;
}

/* ── Landing ─────────────────────────────────────── */

.landing {
    flex: 1;
    background: var(--background-secondary);
    padding: 4.5rem 0 4rem;
}

.hero {
    max-width: 720px;
    text-align: center;
    margin-bottom: 4.5rem;
}

.hero-title {
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.6px;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 2.25rem;
}

.btn-primary {
    background: var(--primary);
    color: var(--background);
    border: none;
    border-radius: 8px;
    padding: 0.85rem 2rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-large {
    padding: 1rem 2.4rem;
    font-size: 1.02rem;
}

.capabilities {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.cap {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.5rem 1.4rem;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.cap:hover {
    border-color: var(--border-subtle);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(122, 61, 79, 0.06);
}

.cap h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.55rem;
    letter-spacing: -0.1px;
}

.cap p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* ── Footer ──────────────────────────────────────── */

.site-footer {
    padding: 1.5rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--background);
}

.site-footer p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.site-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* ── Chat overlay (fullscreen) ───────────────────── */

.chat-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--background);
    display: none;
    flex-direction: column;
}

.chat-overlay.active {
    display: flex;
}

.chat-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: var(--primary);
    color: var(--background);
    padding: 0.9rem 1.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.chat-status {
    display: inline-flex;
    align-items: center;
    /* Hide the status text (font-size:0) so only the symbol shows; the text
       node stays in the DOM for the aria-live screen-reader announcement. */
    font-size: 0;
    gap: 0;
}

/* Leading status symbol: idle = steady solid dot, working = spinning ring. */
.chat-status::before {
    content: "";
    width: 25px;
    height: 25px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: currentColor;
    opacity: 0.85;
}

.chat-status.is-working::before {
    background: transparent;
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-save-pdf {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: var(--background);
    width: 34px;
    height: 34px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.chat-save-pdf svg {
    width: 16px;
    height: 16px;
}

.chat-save-pdf:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.7);
}

.chat-close {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: var(--background);
    padding: 0.35rem 0.95rem;
    border-radius: 6px;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.7);
}

/* ── Messages ────────────────────────────────────── */

.chat-messages-wrap {
    flex: 1;
    overflow-y: auto;
    background: var(--background);
}

.chat-messages {
    max-width: 880px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 100%;
}

.chat-message {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.93rem;
    line-height: 1.6;
    word-wrap: break-word;
    flex-shrink: 0;
}

.chat-message.ai {
    background: var(--chat-surface);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message.ai a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    word-break: break-word;
    font-weight: 600;
}

.chat-message.ai a:hover {
    color: var(--primary-hover);
}

.chat-message.ai table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.85rem;
}

.chat-message.ai th,
.chat-message.ai td {
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.55rem;
    text-align: left;
}

.chat-message.ai th {
    background: var(--primary-soft);
    font-weight: 600;
}

.chat-message.ai strong {
    font-weight: 700;
}

.chat-message.ai p {
    margin: 0.4rem 0;
}

.chat-message.ai ul,
.chat-message.ai ol {
    margin: 0.4rem 0;
    padding-left: 1.3rem;
}

.chat-message.user {
    background: var(--primary);
    color: var(--background);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* ── Clarification prompt ───────────────────────── */

.chat-message.ai.clarification {
    border: 1px dashed var(--primary);
    background: var(--primary-soft);
}

.clarification-question {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.clarification-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.35rem 0 0.4rem;
}

.clarification-option-btn {
    appearance: none;
    border: 1px solid var(--primary);
    background: var(--background);
    color: var(--primary);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, transform 0.06s ease;
}

.clarification-option-btn:hover:not(:disabled) {
    background: var(--primary);
    color: var(--background);
}

.clarification-option-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.clarification-option-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.clarification-hint {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ── Tool badges ─────────────────────────────────── */

.tool-badge {
    display: flex;
    flex-direction: column;
    align-self: flex-start;
    max-width: 92%;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--background-secondary);
    overflow: hidden;
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.tool-badge-header {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    width: 100%;
    background: transparent;
    border: none;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: default;
}

.tool-badge.done .tool-badge-header {
    cursor: pointer;
}

.tool-badge.done .tool-badge-header:hover {
    background: var(--primary-soft);
}

.tool-badge-label {
    flex: 0 0 auto;
    font-weight: 600;
}

.tool-badge-count {
    flex: 1 1 auto;
    color: var(--text-tertiary);
    font-size: 0.76rem;
}

.tool-badge-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: var(--border-subtle);
}

.tool-badge:not(.done) .tool-badge-indicator {
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    background: transparent;
    animation: spin 0.9s linear infinite;
}

.tool-badge.done .tool-badge-indicator {
    background: var(--primary);
}

.tool-badge-chevron {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--text-tertiary);
    border-bottom: 2px solid var(--text-tertiary);
    transform: rotate(45deg);
    margin-right: 2px;
    visibility: hidden;
    transition: transform 0.18s;
}

.tool-badge.done .tool-badge-chevron {
    visibility: visible;
}

.tool-badge.open .tool-badge-chevron {
    transform: rotate(-135deg);
    margin-top: 4px;
}

.tool-badge-panel {
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px 12px;
    background: var(--background);
    border-top: 1px solid var(--border-color);
}

.tool-badge.open .tool-badge-panel {
    display: flex;
}

.tool-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 7px 9px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    background: var(--background-secondary);
    transition: border-color 0.12s, background 0.12s;
}

a.tool-row:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.tool-row-title {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
}

.tool-row-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.tool-row-body {
    font-size: 0.83rem;
    color: var(--text-primary);
    line-height: 1.55;
    margin-top: 4px;
}

.tool-row-body p {
    margin: 0.3rem 0;
}

.tool-row-body strong {
    font-weight: 700;
    color: var(--primary);
}

.tool-row-body ul,
.tool-row-body ol {
    margin: 0.3rem 0;
    padding-left: 1.2rem;
}

.tool-row-body a {
    color: var(--primary);
    text-decoration: underline;
}

.tool-row-empty {
    padding: 6px 4px;
    color: var(--text-tertiary);
    font-style: italic;
    font-size: 0.82rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Input ───────────────────────────────────────── */

.chat-input-area {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem 1.2rem;
    flex-shrink: 0;
    background: var(--background);
}

.chat-input-row {
    max-width: 880px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 0.7rem 0.9rem;
    font-size: 0.93rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--background);
    resize: none;
    line-height: 1.5;
    max-height: 140px;
    overflow-y: auto;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.chat-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(122, 61, 79, 0.12);
}

.chat-send {
    background: var(--primary);
    color: var(--background);
    border: none;
    border-radius: 10px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, opacity 0.15s;
}

.chat-send:hover {
    background: var(--primary-hover);
}

.chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chat-send svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Image attachments ───────────────────────────── */

.chat-attach {
    background: var(--background);
    color: var(--primary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chat-attach:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
}

.chat-attach svg {
    width: 20px;
    height: 20px;
}

.chat-attachments {
    max-width: 880px;
    margin: 0 auto 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chat-attachment {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.chat-attachment img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-attachment-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: rgba(42, 31, 34, 0.72);
    color: #fff;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.chat-attachment-remove:hover {
    background: var(--primary);
}

/* Thumbnails rendered inside a sent user bubble. */
.chat-msg-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.chat-msg-thumb {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: block;
}

/* Drag-and-drop affordance over the whole chat overlay. */
.chat-overlay.drag-over .chat-input-area {
    background: var(--primary-soft);
    box-shadow: inset 0 0 0 2px var(--primary);
}

/* ── Responsive ──────────────────────────────────── */

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    .capabilities {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .chat-message {
        max-width: 90%;
    }
}
