/* ==========================================================================
   Case Study Lead-Capture Modal
   Brand tokens: --color-primary #d01847 | --color-secondary #012842
   ========================================================================== */

/* --------------------------------------------------------------------------
   Overlay
   -------------------------------------------------------------------------- */
.lead-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(1, 28, 50, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);

    /* Animation state — toggled by JS */
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.lead-modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */
.lead-modal-card {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    padding: 2.5rem 2.5rem 2rem;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow:
        0 0 0 1px rgba(1, 40, 66, 0.06),
        0 24px 60px rgba(1, 40, 66, 0.22),
        0 6px 18px rgba(0, 0, 0, 0.08);

    /* Slide-up entry */
    transform: translateY(24px) scale(0.98);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    opacity: 0;
}

.lead-modal-overlay.is-open .lead-modal-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Thin red accent stripe at top */
.lead-modal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 16px 16px 0 0;
    background: linear-gradient(90deg, #d01847 0%, #ad132a 100%);
}

/* --------------------------------------------------------------------------
   Close button
   -------------------------------------------------------------------------- */
.lead-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 0.35rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background 0.2s ease;
    line-height: 1;
}

.lead-modal-close:hover,
.lead-modal-close:focus-visible {
    color: #d01847;
    background: rgba(208, 24, 71, 0.08);
    outline: none;
}

/* --------------------------------------------------------------------------
   Modal header
   -------------------------------------------------------------------------- */
.lead-modal-header {
    margin-bottom: 1.5rem;
}

.lead-modal-eyebrow {
    display: inline-block;
    font-family: 'Manrope', sans-serif;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #d01847;
    margin-bottom: 0.5rem;
}

.lead-modal-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: #012842;
    line-height: 1.2;
    margin: 0 0 0.5rem;
}

.lead-modal-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Form grid
   -------------------------------------------------------------------------- */
.lead-form-row {
    display: grid;
    gap: 1rem;
}

.lead-form-row--2 {
    grid-template-columns: 1fr 1fr;
}

.lead-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.lead-form-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #012842;
    letter-spacing: 0.01em;
}

.lead-required {
    color: #d01847;
}

.lead-form-input {
    font-family: 'Inter', sans-serif;
    font-size: 0.9375rem;
    color: #1a1a2e;
    background: #f7f8fc;
    border: 1.5px solid #e1e4ed;
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    width: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.lead-form-input:focus {
    border-color: #d01847;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(208, 24, 71, 0.1);
}

.lead-form-input.is-error {
    border-color: #d01847;
    background: #fff8f9;
}

.lead-form-input::placeholder {
    color: #b0b7c3;
}

/* --------------------------------------------------------------------------
   Hidden-attribute reset inside the modal
   CSS `display` declarations beat the HTML [hidden] attribute by default.
   This restores the expected behaviour for every element inside the card.
   -------------------------------------------------------------------------- */
.lead-modal-card [hidden] {
    display: none !important;
}

/* --------------------------------------------------------------------------
   Field errors
   -------------------------------------------------------------------------- */
.lead-field-error {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #d01847;
    font-weight: 500;
    /* Default hidden — JS removes [hidden] to show. The rule above ensures
       [hidden] always wins, so we only need display here for the shown state. */
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.lead-field-error::before {
    content: '!';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    background: #d01847;
    color: white;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 800;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Form-level error banner
   -------------------------------------------------------------------------- */
.lead-form-error {
    background: #fff0f3;
    border: 1.5px solid rgba(208, 24, 71, 0.2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: #d01847;
    font-weight: 500;
    margin-bottom: 1rem;
    line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Consent
   -------------------------------------------------------------------------- */
.lead-consent-group {
    margin-bottom: 1.25rem;
}

.lead-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    cursor: pointer;
}

.lead-consent-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: #d01847;
    cursor: pointer;
    border-radius: 4px;
}

.lead-consent-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #666;
    line-height: 1.5;
}

.lead-consent-text a {
    color: #d01847;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.lead-consent-text a:hover {
    color: #ad132a;
}

/* --------------------------------------------------------------------------
   Submit button
   -------------------------------------------------------------------------- */
.lead-submit-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #d01847 0%, #ad132a 100%);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    font-family: 'Manrope', sans-serif;
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        opacity 0.2s ease;
    box-shadow: 0 4px 16px rgba(208, 24, 71, 0.32);
    position: relative;
    overflow: hidden;
}

.lead-submit-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0);
    transition: background 0.2s ease;
}

.lead-submit-btn:hover:not(:disabled)::after {
    background: rgba(255, 255, 255, 0.08);
}

.lead-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(208, 24, 71, 0.4);
}

.lead-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.lead-submit-btn:disabled,
.lead-submit-btn.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Spinner animation */
.lead-submit-spinner svg {
    animation: lead-spin 0.8s linear infinite;
}

@keyframes lead-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* --------------------------------------------------------------------------
   Success state
   -------------------------------------------------------------------------- */
.lead-success-content {
    text-align: center;
    padding: 1.5rem 0;
}

.lead-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(208, 24, 71, 0.1) 0%, rgba(208, 24, 71, 0.05) 100%);
    color: #d01847;
    margin: 0 auto 1.25rem;
}

.lead-success-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: #012842;
    margin: 0 0 0.75rem;
}

.lead-success-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.9375rem;
    color: #555;
    line-height: 1.6;
    margin: 0;
}

.lead-success-text a {
    color: #d01847;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 540px) {
    .lead-modal-card {
        padding: 2rem 1.25rem 1.5rem;
    }

    .lead-form-row--2 {
        grid-template-columns: 1fr;
    }

    .lead-modal-title {
        font-size: 1.3rem;
    }
}