/* ==========================================================
   BCS LLC — "The Thinking Machine"
   Muted Neon on Dark + Basquiat AI Abstraction
   See design/AESTHETIC.md for full rationale
   ========================================================== */

/* --- Palette Variables --- */
:root {
    --deep-void: #08080F;
    --surface: #10101A;
    --elevated: #1A1A2E;
    --synapse-blue: #5B8DEF;
    --signal-cyan: #4ECDC4;
    --cortex-purple: #9B72CF;
    --firing-pink: #EC4899;
    --ember-orange: #F59E0B;
    --text-primary: #E2E8F0;
    --text-secondary: #7B8BA8;
    --text-muted: #4A5568;
    --border-glow: rgba(91, 141, 239, 0.12);
    --border-subtle: rgba(255, 255, 255, 0.06);
}

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

html {
    overflow-x: hidden;
}

/* --- Body: The Thinking Machine Background ---
   Layered radial gradients simulate neural activations
   bleeding through the dark chip surface.
   Noise grain overlay adds Basquiat's raw painted texture.
*/
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--deep-void);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* ==========================================================
   BASQUIAT LAYER — Bold neon neural activations
   Like looking inside a skull and seeing the machine think.
   High-intensity color blobs, raw and expressive.
   ========================================================== */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    animation: neuralDrift 12s ease-in-out infinite alternate;
    background:
        /* === PRIMARY STRIKES — bold, Basquiat brushstroke energy === */

        /* Big synapse blue slash — upper left, like a raw brushstroke */
        radial-gradient(ellipse 550px 220px at 10% 18%,
            rgba(91, 141, 239, 0.45) 0%,
            rgba(91, 141, 239, 0.15) 35%,
            transparent 60%),

        /* Cyan signal streak — diagonal, data in transit */
        radial-gradient(ellipse 800px 180px at 65% 12%,
            rgba(78, 205, 196, 0.35) 0%,
            rgba(78, 205, 196, 0.08) 45%,
            transparent 70%),

        /* Cortex purple mass — center, the deep processing core */
        radial-gradient(ellipse 450px 500px at 48% 50%,
            rgba(155, 114, 207, 0.30) 0%,
            rgba(155, 114, 207, 0.08) 40%,
            transparent 65%),

        /* Hot pink FIRE — bottom right, neural spike / error flash */
        radial-gradient(ellipse 380px 300px at 82% 72%,
            rgba(236, 72, 153, 0.35) 0%,
            rgba(236, 72, 153, 0.10) 35%,
            transparent 60%),

        /* Ember voltage — lower left, heat on the die */
        radial-gradient(ellipse 350px 200px at 20% 78%,
            rgba(245, 158, 11, 0.30) 0%,
            rgba(245, 158, 11, 0.06) 40%,
            transparent 60%),

        /* === SECONDARY WASHES — depth and layering === */

        /* Cyan bleed — upper right */
        radial-gradient(ellipse 280px 350px at 88% 25%,
            rgba(78, 205, 196, 0.20) 0%,
            transparent 55%),

        /* Blue anchor pool — bottom center */
        radial-gradient(ellipse 600px 350px at 45% 88%,
            rgba(91, 141, 239, 0.25) 0%,
            transparent 55%),

        /* Purple echo — far left */
        radial-gradient(ellipse 250px 400px at 5% 55%,
            rgba(155, 114, 207, 0.18) 0%,
            transparent 50%),

        /* Pink scatter — upper center */
        radial-gradient(ellipse 200px 200px at 55% 8%,
            rgba(236, 72, 153, 0.15) 0%,
            transparent 50%),

        /* Ember fleck — right edge */
        radial-gradient(ellipse 180px 280px at 95% 60%,
            rgba(245, 158, 11, 0.14) 0%,
            transparent 50%);
    pointer-events: none;
}

/* Slow breathing animation — the machine is alive */
@keyframes neuralDrift {
    0% {
        opacity: 1;
        filter: hue-rotate(0deg) brightness(1);
    }
    50% {
        opacity: 0.85;
        filter: hue-rotate(8deg) brightness(1.1);
    }
    100% {
        opacity: 1;
        filter: hue-rotate(-5deg) brightness(0.95);
    }
}

/* Heavy grain overlay — Basquiat's raw, scraped canvas texture */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1;
    opacity: 0.08;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 512px 512px;
    mix-blend-mode: overlay;
}

/* --- Canvas: Skull/Chip art layer --- */
#thinking-machine {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- Container --- */
.container {
    text-align: center;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    position: relative;
    z-index: 2;
}

.container.page {
    max-width: 800px;
    text-align: left;
    padding: 3rem 2rem;
}

/* --- Heading: Basquiat-style confident lettering --- */
h1 {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: #ffffff;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.tagline {
    font-size: 1.1rem;
    font-weight: 300;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* --- Form --- */
.info-form-section h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.45rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 600;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    background-color: rgba(16, 16, 26, 0.6);
    backdrop-filter: blur(8px);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
    font-style: italic;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--synapse-blue);
    box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.15),
                0 0 20px rgba(91, 141, 239, 0.08);
}

/* --- Field hints & errors --- */
.field-hint {
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    margin: -0.25rem 0 0.75rem;
    text-align: left;
    font-style: italic;
}

.field-error {
    font-size: 0.72rem;
    color: #E63946;
    letter-spacing: 0.04em;
    margin: -0.25rem 0 0.5rem;
    text-align: left;
    font-weight: 600;
}

/* --- Consent Ticker — gallery admission ticket style --- */
.consent-ticker {
    margin: 1.25rem 0 0.5rem;
    text-align: left;
}

.ticker-edge {
    height: 1px;
    background: repeating-linear-gradient(
        90deg,
        var(--text-muted) 0px,
        var(--text-muted) 4px,
        transparent 4px,
        transparent 8px
    );
    opacity: 0.4;
}

.ticker-body {
    padding: 0.8rem 0.9rem;
    border-left: 2px solid rgba(91, 141, 239, 0.3);
    border-right: 2px solid rgba(91, 141, 239, 0.3);
    background: rgba(16, 16, 26, 0.5);
}

.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    cursor: pointer;
    position: relative;
}

/* Hide native checkbox */
.consent-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Custom checkmark — raw box with Basquiat energy */
.checkmark {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-secondary);
    border-radius: 2px;
    position: relative;
    margin-top: 1px;
    transition: all 0.2s ease;
    transform: rotate(-2deg);
}

.consent-label:hover .checkmark {
    border-color: var(--synapse-blue);
    box-shadow: 0 0 8px rgba(91, 141, 239, 0.2);
}

/* Checked state — bold X mark like Basquiat's crosses */
.consent-label input[type="checkbox"]:checked + .checkmark {
    border-color: var(--synapse-blue);
    background: rgba(91, 141, 239, 0.1);
}

.consent-label input[type="checkbox"]:checked + .checkmark::before,
.consent-label input[type="checkbox"]:checked + .checkmark::after {
    content: "";
    position: absolute;
    background: var(--synapse-blue);
    border-radius: 1px;
}

.consent-label input[type="checkbox"]:checked + .checkmark::before {
    width: 14px;
    height: 2.5px;
    top: 7px;
    left: 1px;
    transform: rotate(45deg);
}

.consent-label input[type="checkbox"]:checked + .checkmark::after {
    width: 14px;
    height: 2.5px;
    top: 7px;
    left: 1px;
    transform: rotate(-45deg);
}

.consent-text {
    font-size: 0.72rem;
    line-height: 1.6;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
}

.consent-text a {
    color: var(--synapse-blue);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

.consent-text a:hover {
    color: var(--signal-cyan);
}

/* --- Submit Button — black & red gallery admission ticker --- */
button[type="submit"] {
    margin-top: 1.25rem;
    width: 100%;
    padding: 0.95rem 2rem;
    border: none;
    border-radius: 0;
    background: #0A0A0A;
    color: #E63946;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    transform: rotate(-0.6deg);
    box-shadow: inset 0 0 0 3px #E63946;
}

/* Red strip accent on left edge — like a ticket tear line */
button[type="submit"]::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 5px;
    height: 100%;
    background: #E63946;
    transition: width 0.3s ease;
}

button[type="submit"] .btn-text {
    position: relative;
    z-index: 1;
}

button[type="submit"] .btn-arrow {
    font-size: 1.15rem;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
}

button[type="submit"]:hover {
    background: #E63946;
    color: #0A0A0A;
    box-shadow: inset 0 0 0 3px #0A0A0A,
                0 0 30px rgba(230, 57, 70, 0.25);
    transform: rotate(0deg);
}

button[type="submit"]:hover::before {
    width: 100%;
    background: #E63946;
}

button[type="submit"]:hover .btn-arrow {
    transform: translateX(5px);
}

button[type="submit"]:active {
    transform: scale(0.97) rotate(0.4deg);
    box-shadow: inset 0 0 0 3px #0A0A0A;
}

/* --- Confirmation --- */
.confirmation p {
    font-size: 1.1rem;
    color: var(--signal-cyan);
    padding: 1.5rem 0;
}

.hidden {
    display: none;
}

/* --- Legal Pages --- */
.back-link {
    display: inline-block;
    color: var(--synapse-blue);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--signal-cyan);
    text-decoration: underline;
}

.legal-content h2 {
    font-size: 1.6rem;
    color: #ffffff;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.legal-content h3 {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.legal-content p {
    font-size: 0.9rem;
    line-height: 1.8;
    color: rgba(226, 232, 240, 0.7);
    margin-bottom: 0.75rem;
}

.legal-content a {
    color: var(--synapse-blue);
    transition: color 0.2s ease;
}

.legal-content a:hover {
    color: var(--signal-cyan);
}

/* --- Footer --- */
footer {
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

footer nav {
    margin-bottom: 0.5rem;
}

footer nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
}

footer nav a:hover {
    color: var(--synapse-blue);
}

footer .sep {
    color: var(--border-subtle);
    margin: 0 0.5rem;
    font-size: 0.8rem;
}

footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==========================================================
   Chat Widget — Glass-morphism on dark
   ========================================================== */

/* --- Chat Bubble Button --- */
.chat-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 10000;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 1px solid rgba(155, 114, 207, 0.3);
    background: rgba(16, 16, 26, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--signal-cyan);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(155, 114, 207, 0.2),
                0 0 40px rgba(91, 141, 239, 0.08),
                inset 0 0 20px rgba(78, 205, 196, 0.05);
    transition: all 0.3s ease;
    animation: chat-pulse 3s ease-in-out infinite;
}

.chat-btn:hover {
    transform: translateY(-2px) scale(1.08);
    border-color: rgba(78, 205, 196, 0.4);
    color: #ffffff;
    box-shadow: 0 6px 32px rgba(155, 114, 207, 0.35),
                0 0 48px rgba(78, 205, 196, 0.15),
                inset 0 0 24px rgba(91, 141, 239, 0.08);
    animation: none;
}

@keyframes chat-pulse {
    0%, 100% { box-shadow: 0 4px 24px rgba(155, 114, 207, 0.2), 0 0 40px rgba(91, 141, 239, 0.08); }
    50% { box-shadow: 0 4px 28px rgba(155, 114, 207, 0.3), 0 0 52px rgba(78, 205, 196, 0.12); }
}

.chat-btn.hidden {
    display: none;
}

/* --- Chat Window --- */
.chat-window {
    position: fixed;
    bottom: 5.5rem;
    right: 1.5rem;
    z-index: 10001;
    width: 380px;
    max-height: 520px;
    border-radius: 12px;
    border: 1px solid rgba(155, 114, 207, 0.15);
    background: rgba(10, 10, 18, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6),
                0 0 48px rgba(155, 114, 207, 0.06),
                0 0 80px rgba(91, 141, 239, 0.04);
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* --- Chat Header --- */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(155, 114, 207, 0.1);
    background: rgba(20, 20, 34, 0.6);
}

.chat-header-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.chat-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.chat-close:hover {
    color: var(--text-primary);
}

/* --- Messages Area --- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-height: 300px;
    max-height: 360px;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 2px;
}

/* --- Message Bubbles --- */
.chat-msg {
    max-width: 80%;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    font-size: 0.88rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-msg--user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--cortex-purple), rgba(91, 141, 239, 0.7));
    color: #ffffff;
    border-bottom-right-radius: 3px;
}

.chat-msg--bot {
    align-self: flex-start;
    background: rgba(78, 205, 196, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(78, 205, 196, 0.1);
    border-bottom-left-radius: 3px;
}

/* --- Typing Indicator --- */
.chat-msg--typing {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1rem;
}

.chat-msg--typing .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typing-bounce 1.2s infinite;
}

.chat-msg--typing .dot:nth-child(2) {
    animation-delay: 0.15s;
}

.chat-msg--typing .dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typing-bounce {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

/* --- Chat Input Form --- */
.chat-form {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border-top: 1px solid var(--border-subtle);
    background: rgba(26, 26, 46, 0.4);
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    background: rgba(8, 8, 15, 0.6);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.chat-input:focus {
    border-color: var(--synapse-blue);
    box-shadow: 0 0 0 2px rgba(91, 141, 239, 0.12);
}

.chat-input:disabled {
    opacity: 0.5;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-send {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--cortex-purple), var(--synapse-blue));
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.chat-send:hover {
    background: linear-gradient(135deg, #B088E0, #7BA4F5);
    transform: scale(1.05);
    box-shadow: 0 0 16px rgba(155, 114, 207, 0.3);
}

/* --- Responsive --- */
@media (max-width: 600px) {
    h1 {
        font-size: 2.4rem;
        letter-spacing: 0.15em;
    }

    .tagline {
        font-size: 0.95rem;
    }

    .container {
        padding: 1.5rem 1rem;
    }

    .chat-window {
        width: calc(100vw - 1.5rem);
        right: 0.75rem;
        bottom: 4.5rem;
        max-height: 70vh;
    }

    .chat-btn {
        bottom: 1rem;
        right: 1rem;
    }
}
