/**
 * Contact Form - A Visual Symphony
 * Walk the Dragon - Where messages meet magic
 * OS 13-Sep-2025
 * 
 * Inspired by neural connections, floating pages, and the art of conversation
 * Updated: Hero section removed, textareas enhanced, 100-word limit on messages
 * OS 13-Sep-2025: Subject field reverted to dropdown with reduced height
 * OS 13-Sep-2025: Enhanced with word limit display, styled dropdown, full-screen success
 * OS 13-Sep-2025: Fixed dropdown styling, centered checkmark, message label stays in place
 * OS 13-Sep-2025: Fixed dropdown z-index to appear above all form elements
 * OS 13-Sep-2025: Fixed double text display issue in custom dropdown
 */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600&family=Cormorant+Garamond:ital,wght@0,400;1,400&display=swap');

/* Canvas Setup */
body {
    overflow-x: hidden;
}

.contact-universe {
    position: relative;
    min-height: 100vh;
    background: linear-gradient(180deg, #ffffff 0%, #F4ECEA 50%, #ffffff 100%);
}

/* Message Particles - Floating thoughts */
.message-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(58, 53, 50, 0.1);
    border-radius: 50%;
    left: var(--x);
    top: var(--y);
    animation: particleFloat 20s infinite ease-in-out;
    animation-delay: var(--delay);
}

@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0) scale(0);
        opacity: 0;
    }
    10% {
        transform: translate(20px, -20px) scale(1);
        opacity: 0.3;
    }
    50% {
        transform: translate(-40px, 40px) scale(0.8);
        opacity: 0.1;
    }
    90% {
        transform: translate(30px, -60px) scale(0.5);
        opacity: 0;
    }
}

/* Connection Web - Neural network aesthetic */
.connection-web {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.03;
    z-index: 0;
}

.connection-line {
    fill: none;
    stroke: #3A3532;
    stroke-width: 1;
    opacity: 0;
    animation: connectionPulse 8s infinite ease-in-out;
    animation-delay: var(--delay);
}

@keyframes connectionPulse {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.5; }
}

/* Hero Section - Removed per user request */

.hero-content {
    text-align: center;
    animation: heroReveal 1.5s ease-out;
}

@keyframes heroReveal {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.contact-title {
    font-family: 'biennale', Georgia, serif;
    font-size: clamp(80px, 15vw, 200px);
    font-weight: 300;
    line-height: 0.9;
    margin: 0;
    letter-spacing: -0.03em;
    color: #000000;
}

.title-line {
    display: block;
    opacity: 0;
    animation: titleAppear 0.8s ease-out forwards;
}

.title-line:nth-child(2) {
    animation-delay: 0.3s;
}

.title-line.accent {
    background: linear-gradient(135deg, #000000 0%, #3A3532 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes titleAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
    from {
        opacity: 0;
        transform: translateY(30px);
    }
}

.contact-philosophy {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(16px, 2vw, 22px);
    font-weight: 200;
    color: #8E8C8A;
    margin-top: 40px;
    letter-spacing: 0.5px;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.6s forwards;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 50px;
    border: 2px solid rgba(58, 53, 50, 0.2);
    border-radius: 25px;
    display: flex;
    align-items: flex-start;
    padding: 8px;
}

.scroll-dot {
    width: 4px;
    height: 8px;
    background: #3A3532;
    border-radius: 2px;
    animation: scrollBounce 2s infinite;
    margin: 0 auto;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); opacity: 0.3; }
    50% { transform: translateY(20px); opacity: 1; }
}

/* Form Section */
.contact-form-section {
    position: relative;
    padding: 80px 0 120px 0;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 40px;
    position: relative;
    width: 100%;
}

.form-intro {
    text-align: center;
    margin-bottom: 80px;
    opacity: 0;
    animation: fadeInUp 1s ease-out forwards;
}

.form-title {
    font-family: 'biennale', Georgia, serif;
    font-size: clamp(40px, 6vw, 60px);
    font-weight: 300;
    margin: 0 0 20px 0;
    letter-spacing: -0.02em;
    text-transform: lowercase;
    color: #000000;
}

.form-subtitle {
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 200;
    color: #8E8C8A;
    letter-spacing: 0.3px;
}

/* Ethereal Form */
.ethereal-form {
    position: relative;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.form-field {
    position: relative;
    opacity: 0;
    animation: fieldAppear 0.8s ease-out forwards;
    z-index: 1;
}

.form-field:nth-child(1) { animation-delay: 0.1s; }
.form-field:nth-child(2) { animation-delay: 0.2s; }
.form-field:nth-child(3) { animation-delay: 0.3s; }
.form-field:nth-child(4) { animation-delay: 0.4s; }

@keyframes fieldAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
    from {
        opacity: 0;
        transform: translateY(20px);
    }
}

.form-field.full-width {
    grid-column: 1 / -1;
}

.form-field.select-field {
    z-index: 100;
    overflow: visible !important;
}

.form-input {
    width: 100%;
    padding: 20px 0;
    font-size: 18px;
    font-family: 'Poppins', sans-serif;
    font-weight: 300;
    border: none;
    border-bottom: 1px solid transparent;
    background: transparent;
    color: #3A3532;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
}

.form-label {
    position: absolute;
    top: 20px;
    left: 0;
    font-size: 18px;
    font-family: 'Poppins', sans-serif;
    font-weight: 300;
    color: #8E8C8A;
    pointer-events: none;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0;
    z-index: 1;
}

.form-field.focused .form-label,
.form-input:focus + .form-label,
.form-input:valid + .form-label {
    top: -10px;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #3A3532;
}

.field-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: #D9D9D9;
    transform-origin: left;
    transition: all 0.3s ease;
}

.field-line::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: #000000;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.form-input:focus ~ .field-line::after {
    transform: scaleX(1);
}

/* Textarea specific */
.form-textarea {
    resize: none;
    overflow-y: hidden;
}

.message-field {
    z-index: 1 !important;
}

.message-field .form-textarea {
    min-height: 150px;
    max-height: 300px;
}

/* Special message label behavior */
.message-field .message-label {
    transition: all 0.3s ease;
    pointer-events: none;
}

.message-field.message-focused .message-label {
    top: 20px !important;
    font-size: 18px !important;
    font-weight: 300 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    color: #8E8C8A !important;
}

/* Override floating behavior for message field */
.message-field .form-textarea:focus + .message-label,
.message-field .form-textarea:valid + .message-label {
    top: 20px !important;
    font-size: 18px !important;
    font-weight: 300 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

/* Custom Select Dropdown */
.custom-select-wrapper {
    position: relative;
    z-index: 10;
    padding-bottom:20px;
}

.custom-select-wrapper.open {
    z-index: 1001;
}

.custom-select-input {
    cursor: pointer;
    user-select: none;
    background: transparent;
    caret-color: transparent;
    color: transparent !important;
    text-shadow: none !important;
    -webkit-text-fill-color: transparent !important;
    font-size: 0 !important;
    line-height: normal;
}

/* Hide the actual input text */
.custom-select-input::-webkit-input-placeholder {
    color: transparent;
}

.custom-select-input:-moz-placeholder {
    color: transparent;
}

.custom-select-input::-moz-placeholder {
    color: transparent;
}

.custom-select-input:-ms-input-placeholder {
    color: transparent;
}

/* Display selected text */
.custom-select-wrapper[data-display]::after {
    content: attr(data-display);
    position: absolute;
    left: 0;
    top: 20px;
    pointer-events: none;
    color: #3A3532;
    font-size: 18px;
    font-weight: 300;
    z-index: 2;
    background: transparent;
}

/* Special handling for select label - hide when value selected */
.select-field .custom-select-wrapper[data-display] ~ .select-label {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.custom-select-arrow {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: transform 0.3s ease;
}

.custom-select-wrapper.open .custom-select-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% - 1px);
    left: -1px;
    right: -1px;
    background: #ffffff;
    background-color: #ffffff;
    border: 1px solid #D9D9D9;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.custom-select-wrapper.open .custom-select-dropdown {
    max-height: 300px;
    opacity: 1;
    overflow-y: auto;
}

.custom-option {
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 300;
    color: #3A3532;
    border-bottom: 1px solid rgba(217, 217, 217, 0.3);
    background: #ffffff;
    position: relative;
}

.custom-option:last-child {
    border-bottom: none;
}

.custom-option:hover {
    background: #F4ECEA;
    color: #000000;
    padding-left: 24px;
}

.custom-option.selected {
    background: #F4ECEA;
    color: #000000;
    font-weight: 400;
}

/* Custom scrollbar for dropdown */
.custom-select-dropdown::-webkit-scrollbar {
    width: 6px;
}

.custom-select-dropdown::-webkit-scrollbar-track {
    background: #f8f8f8;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
    background: #D9D9D9;
    border-radius: 3px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: #BBB8B6;
}


.character-count {
    position: absolute;
    right: 0;
    bottom: -25px;
    font-size: 12px;
    color: #BBB8B6;
    font-family: 'Poppins', sans-serif;
    font-weight: 300;
}

/* Submit Button - Cosmic style */
.form-submit-container {
    margin-top: 80px;
    text-align: center;
}

.cosmic-button {
    position: relative;
    padding: 20px 80px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: #000000;
    color: #ffffff;
    border: none;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s ease;
}

.cosmic-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
}

.cosmic-button:hover::before {
    left: 100%;
}

.cosmic-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.button-text,
.button-loading {
    position: relative;
    z-index: 2;
}

.button-loading {
    display: none;
}

.cosmic-button.loading .button-text {
    display: none;
}

.cosmic-button.loading .button-loading {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.loading-dot {
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
    animation: loadingDot 1.4s infinite ease-in-out;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Button Ripple Effect */
.button-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.cosmic-button:active .button-ripple {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    to {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* Response Messages */
.form-response {
    margin-top: 40px;
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
}

.response-error {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 30px;
    text-align: center;
}

.error-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 24px;
    background: rgba(74, 61, 61, 0.1);
    color: #4a3d3d;
}

.response-error p {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 300;
    margin: 0;
}

/* Full Screen Success Message */
.success-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #ffffff 0%, #F4ECEA 100%);
    z-index: 100;
    padding: 40px;
}

.success-content {
    text-align: center;
    max-width: 600px;
    animation: successReveal 1s ease-out;
}

@keyframes successReveal {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.success-icon-large {
    margin: 0 auto 40px;
    animation: iconBounce 1.5s ease-out;
}

@keyframes iconBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.checkmark {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: checkmarkDraw 0.8s ease-out 0.5s forwards;
}

@keyframes checkmarkDraw {
    to {
        stroke-dashoffset: 0;
    }
}

.success-title {
    font-family: 'biennale', Georgia, serif;
    font-size: clamp(48px, 8vw, 72px);
    font-weight: 300;
    letter-spacing: -0.02em;
    margin: 0 0 20px 0;
    color: #000000;
    text-transform: lowercase;
}

.success-message {
    font-family: 'Poppins', sans-serif;
    font-size: 20px;
    font-weight: 200;
    color: #3A3532;
    margin: 0 0 60px 0;
    line-height: 1.6;
}

.success-quote {
    margin: 0 auto 60px;
    padding: 40px;
    position: relative;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 24px;
    font-style: italic;
    color: #3A3532;
    line-height: 1.8;
    max-width: 500px;
}

.success-quote::before,
.success-quote::after {
    content: '"';
    position: absolute;
    font-size: 80px;
    font-family: 'biennale', Georgia, serif;
    color: rgba(187, 184, 182, 0.3);
    line-height: 1;
}

.success-quote::before {
    top: 0;
    left: 0;
}

.success-quote::after {
    bottom: -20px;
    right: 0;
}

.success-quote cite {
    display: block;
    margin-top: 20px;
    font-size: 16px;
    font-style: normal;
    font-family: 'Poppins', sans-serif;
    font-weight: 300;
    color: #8E8C8A;
    letter-spacing: 0.05em;
}

.return-home {
    display: inline-block;
    padding: 18px 60px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: transparent;
    color: #000000;
    border: 2px solid #000000;
    text-decoration: none;
    transition: all 0.4s ease;
}

.return-home:hover {
    background: #000000;
    color: #ffffff;
    transform: translateY(-2px);
}

/* Ambient Decoration */
.form-decoration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: -1;
}

.deco-circle {
    position: absolute;
    width: var(--size);
    height: var(--size);
    left: var(--x);
    top: var(--y);
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(187, 184, 182, 0.05) 0%, transparent 70%);
    animation: floatCircle 20s infinite ease-in-out;
}

@keyframes floatCircle {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(-30px, -20px) scale(1.1);
    }
    66% {
        transform: translate(20px, -40px) scale(0.9);
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .contact-title {
        font-size: clamp(60px, 20vw, 120px);
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .form-container {
        padding: 0 20px;
    }
    
    .cosmic-button {
        width: 100%;
        padding: 18px 40px;
    }
    
    .contact-hero {
        min-height: 70vh;
    }
    
    .scroll-indicator {
        bottom: 20px;
    }
}