/* Custom Substack Form Overlay - styled form over hidden iframe */
/* ONLY FOR SUBSTACK NEWSLETTER FORMS */

/* Wrapper for the overlay and iframe */
.substack-iframe-wrapper {
    position: relative;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Newsletter title styling */
.newsletter-title {
    color: #F9F4F1;
    font-family: "Inter", sans-serif;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    margin: 0 0 20px 0;
    padding: 0;
}

/* Newsletter disclaimer styling */
.newsletter-disclaimer {
    color: rgba(249, 244, 241, 0.8);
    font-family: "Inter", sans-serif;
    font-size: 12px;
    font-weight: 400;
    text-align: center;
    margin: 15px 0 0 0;
    padding: 0;
    line-height: 1.4;
}

.newsletter-disclaimer a {
    color: rgba(249, 244, 241, 0.9);
    text-decoration: underline;
    transition: color 0.3s ease;
}

.newsletter-disclaimer a:hover {
    color: #F9F4F1;
    text-decoration: none;
}

/* Hide the Substack iframe */
.hidden-substack-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

/* Custom form overlay that looks like our design */
.custom-form-overlay {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: stretch;
    gap: 0;
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid #F9F4F1;
    background: #F9F4F1;
}

/* Custom input wrapper */
.custom-input-wrapper {
    flex: 1;
    background: #F9F4F1;
}

/* Apply to all custom email inputs on different pages */
input[id^="custom-email-input"] {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 0;
    background-color: #F9F4F1;
    color: #174541;
    font-family: "Inter", sans-serif;
    font-size: 16px;
    outline: none;
    margin: 0;
    box-sizing: border-box;
    box-shadow: none !important;
    text-shadow: none !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input[id^="custom-email-input"]:focus {
    outline: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    border: none !important;
}

/* Apply to all custom email inputs on different pages */
input[id^="custom-email-input"]::placeholder {
    color: #C99F92 !important;
    font-weight: 400 !important;
    border: none !important;
    outline: none !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

input[id^="custom-email-input"]::-webkit-input-placeholder {
    color: #C99F92 !important;
    font-weight: 400 !important;
    border: none !important;
    outline: none !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

input[id^="custom-email-input"]::-moz-placeholder {
    color: #C99F92 !important;
    font-weight: 400 !important;
    border: none !important;
    outline: none !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

input[id^="custom-email-input"]:-ms-input-placeholder {
    color: #C99F92 !important;
    font-weight: 400 !important;
    border: none !important;
    outline: none !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

/* Custom subscribe button */
.custom-subscribe-btn {
    background: #C56B31;
    background: linear-gradient(135deg, #C56B31 0%, #B85A28 100%);
    color: #F9F4F1;
    border: none;
    border-radius: 0;
    padding: 15px 25px;
    font-family: "Inter", sans-serif;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.custom-btn-text {
    color: #F9F4F1;
    font-weight: 500;
    transition: transform 0.3s ease;
}

/* Hover state - show bold white arrow after SUBSCRIBE text */
.custom-subscribe-btn:hover .custom-btn-text {
    transform: translateX(-8px); /* Move text left to make room for arrow */
}

.custom-subscribe-btn:hover::after {
    content: "→";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%) translateX(0);
    color: #F9F4F1;
    font-size: 20px;
    font-weight: bold;
    opacity: 1;
    transition: all 0.3s ease;
    line-height: 1;
}

.custom-subscribe-btn::after {
    content: "→";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    color: #F9F4F1;
    font-size: 20px;
    font-weight: bold;
    opacity: 0;
    transition: all 0.3s ease;
    line-height: 1;
}

/* Mobile responsive adjustments */
@media (max-width: 576px) {
    .substack-iframe-wrapper {
        max-width: 100%;
        margin: 0 10px;
    }
    
    .custom-subscribe-btn {
        min-width: 100px;
        padding: 15px 20px;
        font-size: 14px;
    }
    
    input[id^="custom-email-input"] {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Dark variant for light backgrounds (like contact page) - only target Substack forms */
.input__contact .substack-iframe-wrapper {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 0;
}

.input__contact .substack-iframe-wrapper .newsletter-title {
    color: #174541 !important; /* Dark brown for light background */
    font-family: "Inter", sans-serif;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    margin: 0 0 20px 0;
    padding: 0;
}

.input__contact .substack-iframe-wrapper .custom-form-overlay {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: stretch;
    gap: 0;
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid #C56B31 !important; /* Brown border for visibility */
    background: #F9F4F1;
}

.input__contact .substack-iframe-wrapper .newsletter-disclaimer {
    color: #174541 !important; /* Dark brown for light background */
    font-family: "Inter", sans-serif;
    font-size: 12px;
    font-weight: 400;
    text-align: center;
    margin: 15px 0 0 0;
    padding: 0;
    line-height: 1.4;
}

.input__contact .substack-iframe-wrapper .newsletter-disclaimer a {
    color: #C56B31 !important; /* Brown links for better visibility */
    text-decoration: underline;
    transition: color 0.3s ease;
}

.input__contact .substack-iframe-wrapper .newsletter-disclaimer a:hover {
    color: #B85A28 !important; /* Darker brown on hover */
    text-decoration: none;
}

/* Hide the iframe in the light background version - only for Substack forms */
.input__contact .substack-iframe-wrapper .hidden-substack-iframe {
    display: none;
}

/* Success message styling for after form submission */
.substack-form-success {
    background: rgba(81, 207, 102, 0.1) !important;
    color: #F9F4F1 !important;
    padding: 15px !important;
    border-radius: 15px !important;
    text-align: center !important;
    border: 1px solid rgba(81, 207, 102, 0.3) !important;
    margin-top: 15px;
    display: none; /* Initially hidden */
}

/* Error message styling */
.substack-form-error {
    background: rgba(255, 107, 107, 0.1) !important;
    color: #F9F4F1 !important;
    padding: 15px !important;
    border-radius: 15px !important;
    text-align: center !important;
    border: 1px solid rgba(255, 107, 107, 0.3) !important;
    margin-top: 15px;
    display: none; /* Initially hidden */
}

/* Loading state styling - only for custom subscribe buttons */
.custom-subscribe-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.custom-subscribe-btn.loading .custom-btn-text:after {
    content: "...";
}