/* =====================================================
   America Dreams Again - Dramatic Minimal UI
   ===================================================== */

/* CSS Variables */
:root {
    --deep-navy: #0D132D;
    --deep-navy-alt: #151A30;
    --charcoal: #293340;
    --white: #FFFFFF;
    --red-accent: #B50000;
    --red-bright: #D40000;
    --red-dark: #8B0000;
    --pale-gray: #D9DEE8;
    --light-gray: #F3F3F3;

    --font-body: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Instrument Serif', Georgia, serif;

    --transition: 0.3s ease;
    --transition-slow: 0.6s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background-color: var(--deep-navy);
    color: var(--white);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header */
.site-header {
    background-color: transparent;
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-text {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--white);
}

.nav-tagline {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 0.875rem;
    opacity: 0.6;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 8rem 2rem 12rem;
}

/* Hero Section - Hidden in new design */
.hero-section {
    display: none;
}

/* Chat Container - Centered Focus */
.chat-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
}

/* Question Display Area */
.question-display {
    text-align: center;
    margin-bottom: 3rem;
    perspective: 1000px;
}

.main-question {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 6vw, 4rem);
    font-weight: 400;
    line-height: 1.2;
    color: var(--white);
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}

.main-question .highlight {
    color: var(--red-accent);
    font-style: italic;
}

.subtext {
    font-family: var(--font-body);
    font-size: 1.125rem;
    color: var(--pale-gray);
    opacity: 0.7;
    max-width: 500px;
    margin: 0 auto;
    transition: opacity var(--transition);
}

/* Dissolve Animation */
.main-question.dissolving,
.subtext.dissolving {
    animation: dissolve 0.5s ease-out forwards;
}

.main-question.forming,
.subtext.forming {
    animation: form 0.6s ease-out forwards;
}

@keyframes dissolve {
    0% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.98);
        filter: blur(8px);
    }
}

@keyframes form {
    0% {
        opacity: 0;
        transform: scale(0.98);
        filter: blur(8px);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

/* Particle System */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    opacity: 0;
    filter: blur(1px);
}

.particle.red {
    background: var(--red-accent);
    box-shadow: 0 0 6px rgba(181, 0, 0, 0.6);
}

.particle.white {
    background: var(--white);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

/* Swirling particle animation */
.particle.swirling {
    opacity: 1;
    animation: swirl var(--swirl-duration, 3s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes swirl {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0.8;
    }
    25% {
        transform: translate(var(--tx1), var(--ty1)) scale(1.1);
        opacity: 1;
    }
    50% {
        transform: translate(var(--tx2), var(--ty2)) scale(0.9);
        opacity: 0.7;
    }
    75% {
        transform: translate(var(--tx3), var(--ty3)) scale(1.05);
        opacity: 0.9;
    }
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.8;
    }
}

/* Particle converging to form text */
.particle.converging {
    animation: converge 0.8s ease-out forwards;
}

@keyframes converge {
    0% {
        opacity: 1;
        transform: translate(var(--start-x), var(--start-y)) scale(1);
    }
    80% {
        opacity: 1;
        transform: translate(0, 0) scale(1.5);
    }
    100% {
        opacity: 0;
        transform: translate(0, 0) scale(0);
    }
}

/* Particle dispersing */
.particle.dispersing {
    animation: disperse 0.6s ease-out forwards;
}

@keyframes disperse {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

/* Response Display - positioned same as question */
.response-display {
    text-align: center;
    max-width: 700px;
    min-height: 80px;
    display: none;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
}

.response-text {
    font-family: var(--font-serif);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--white);
    line-height: 1.4;
    opacity: 0;
    transform: scale(0.98);
    filter: blur(8px);
    transition: none;
}

.response-text.visible {
    animation: form 0.6s ease-out forwards;
}

.response-text.dissolving {
    animation: dissolve 0.5s ease-out forwards;
}

/* Seamless Input Area */
.input-area {
    width: 100%;
    max-width: 700px;
    text-align: center;
    margin-top: 2rem;
}

.seamless-input {
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-serif);
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    color: var(--white);
    width: 100%;
    text-align: center;
    caret-color: var(--red-accent);
    padding: 1.5rem;
    position: relative;
}

.seamless-input::placeholder {
    color: var(--charcoal);
    opacity: 0.5;
}

.seamless-input.dissolving {
    animation: dissolve 0.5s ease-out forwards;
}

/* Input hint */
.input-hint {
    font-size: 0.75rem;
    color: var(--charcoal);
    margin-top: 1.5rem;
    opacity: 0.5;
    transition: opacity var(--transition);
}

.input-area:focus-within .input-hint {
    opacity: 0.8;
}

/* Red accent line */
.accent-line {
    width: 60px;
    height: 3px;
    background: var(--red-accent);
    margin: 0 auto 2rem;
    transition: width var(--transition);
}

.input-area:focus-within .accent-line {
    width: 120px;
}

/* Hide old chat messages */
.chat-messages {
    display: none;
}

/* Progress Indicator */
.progress-dots {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 3rem;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--charcoal);
    transition: background var(--transition), transform var(--transition);
}

.progress-dot.active {
    background: var(--red-accent);
    transform: scale(1.25);
}

.progress-dot.completed {
    background: var(--pale-gray);
}

/* Dreams Summary */
.dreams-summary {
    background: linear-gradient(135deg, var(--deep-navy-alt) 0%, var(--charcoal) 100%);
    border: 1px solid rgba(181, 0, 0, 0.3);
    border-radius: 12px;
    padding: 2.5rem;
    margin-top: 2rem;
    max-width: 600px;
    width: 100%;
    opacity: 0;
}

.dreams-summary.visible {
    animation: form 0.6s ease-out forwards;
}

.dreams-summary h3 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--red-accent);
    text-align: center;
}

.dream-item {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dream-item:last-child {
    border-bottom: none;
}

.dream-category {
    font-weight: 600;
    color: var(--red-accent);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.dream-text {
    color: var(--pale-gray);
    font-size: 1rem;
    font-family: var(--font-serif);
    font-style: italic;
}

/* Contact Form Styles */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
    max-width: 400px;
    width: 100%;
}

.contact-form input {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--white);
    transition: border-color var(--transition), background var(--transition);
}

.contact-form input:focus {
    outline: none;
    border-color: var(--red-accent);
    background: rgba(255, 255, 255, 0.08);
}

.contact-form input::placeholder {
    color: var(--pale-gray);
    opacity: 0.5;
}

.contact-form button {
    padding: 1rem 2rem;
    background: var(--red-accent);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.contact-form button:hover {
    background: var(--red-bright);
    transform: translateY(-2px);
}

.skip-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--pale-gray);
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    background: none;
    border: none;
    font-family: var(--font-body);
    opacity: 0.6;
    transition: opacity var(--transition);
}

.skip-link:hover {
    opacity: 1;
    color: var(--white);
}

/* Footer */
.site-footer {
    background-color: transparent;
    padding: 1.5rem 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.footer-text {
    font-size: 0.75rem;
    opacity: 0.4;
}

/* Loading State */
.loading-indicator {
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 2rem;
}

.loading-indicator span {
    width: 8px;
    height: 8px;
    background-color: var(--red-accent);
    border-radius: 50%;
    animation: loadingPulse 1.4s ease-in-out infinite;
}

.loading-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loadingPulse {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.4;
    }
    30% {
        transform: scale(1.3);
        opacity: 1;
    }
}

/* Background Gradient Animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 50% 50%, rgba(181, 0, 0, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .main-content {
        padding: 6rem 1.5rem 10rem;
    }

    .main-question {
        font-size: clamp(1.75rem, 8vw, 2.5rem);
    }

    .seamless-input {
        font-size: clamp(1.125rem, 4vw, 1.5rem);
    }

    .subtext {
        font-size: 1rem;
    }

    .question-display {
        margin-bottom: 2rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 5rem 1rem 8rem;
    }

    .dreams-summary {
        padding: 1.5rem;
    }

    .progress-dots {
        margin-bottom: 2rem;
    }
}

/* Focus visible for accessibility */
.seamless-input:focus-visible {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--red-accent);
    outline-offset: 2px;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

.invisible {
    opacity: 0;
    pointer-events: none;
}
