/* ═══════════════════════════════════════════════════════════════
   Beehiiv Content Gate v2 — TPB Editorial Theme
   ═══════════════════════════════════════════════════════════════ */

/* ─── Trigger element (invisible) ──────────────────────────── */
.bcg-trigger {
    display: block;
    height: 0;
    overflow: hidden;
    clear: both;
}

/* ─── Content blur for hard gate ───────────────────────────── */
.bcg-blur-start ~ * {
    filter: blur(6px) saturate(0.5);
    opacity: 0.5;
    user-select: none;
    pointer-events: none;
    transition: filter 0.4s ease, opacity 0.4s ease;
}

.bcg-blur-start ~ .bcg-trigger {
    filter: none;
    opacity: 1;
}

body.bcg-unlocked .bcg-blur-start ~ * {
    filter: none;
    opacity: 1;
    user-select: auto;
    pointer-events: auto;
}

/* ─── Overlay & Backdrop ───────────────────────────────────── */
.bcg-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.bcg-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 29, 35, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* Entrance animation */
.bcg-overlay.bcg-animate-in .bcg-backdrop {
    animation: bcgFadeIn 0.3s ease forwards;
}
.bcg-overlay.bcg-animate-in .bcg-modal {
    animation: bcgSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes bcgFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

/* Exit animation */
.bcg-overlay.bcg-animate-out .bcg-backdrop {
    animation: bcgFadeOut 0.25s ease forwards;
}
.bcg-overlay.bcg-animate-out .bcg-modal {
    animation: bcgSlideDown 0.25s ease forwards;
}

@keyframes bcgFadeOut {
    to { opacity: 0; }
}
@keyframes bcgSlideDown {
    to {
        opacity: 0;
        transform: translateY(16px);
    }
}

/* ─── Modal ────────────────────────────────────────────────── */
.bcg-modal {
    position: relative;
    background: #FEFDFB;
    border-radius: 0;
    max-width: 440px;
    width: 100%;
    padding: 2.5rem 2rem 2rem;
    border: 1px solid #D4D0C8;
    border-top: 3px solid #1A1D23;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* ─── Steps (only one visible at a time) ───────────────────── */
.bcg-step {
    text-align: center;
}

/* ─── Icon ─────────────────────────────────────────────────── */
.bcg-modal-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    line-height: 1;
    opacity: 0.7;
}

/* ─── Typography ───────────────────────────────────────────── */
.bcg-modal-title {
    font-family: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: #1A1D23;
    margin: 0 0 0.4rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.bcg-modal-subtitle {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.9rem;
    color: #4A4F5C;
    margin: 0 0 1.75rem;
    line-height: 1.55;
}

/* ─── Three option buttons ─────────────────────────────────── */
.bcg-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bcg-option-btn {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #D4D0C8;
    border-radius: 0;
    background: #FEFDFB;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
}

.bcg-option-btn:hover {
    border-color: #922B21;
    background: #F8F6F0;
}

.bcg-option-btn:active {
    background: #EFEAE0;
}

.bcg-opt-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0;
    background: #1A1D23;
    color: #FEFDFB;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
}

.bcg-opt-subscribe .bcg-opt-icon {
    background: #922B21;
}

.bcg-opt-leave .bcg-opt-icon {
    background: #8890A0;
}

.bcg-opt-content {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.bcg-opt-content strong {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1A1D23;
}

.bcg-opt-desc {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.75rem;
    color: #8890A0;
    line-height: 1.35;
}

/* ─── Back arrow ───────────────────────────────────────────── */
.bcg-back-arrow {
    position: absolute;
    top: 1.1rem;
    left: 1.1rem;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #8890A0;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0;
    transition: color 0.15s, background 0.15s;
    font-family: inherit;
    line-height: 1;
}

.bcg-back-arrow:hover {
    color: #1A1D23;
    background: #F8F6F0;
}

/* ─── Form ─────────────────────────────────────────────────── */
.bcg-form {
    max-width: 340px;
    margin: 0 auto;
}

.bcg-input {
    display: block;
    width: 100%;
    padding: 0.7rem 0.875rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.9rem;
    border: 1px solid #D4D0C8;
    border-radius: 0;
    background: #F8F6F0;
    color: #1A1D23;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    margin-bottom: 0.75rem;
    box-sizing: border-box;
}

.bcg-input:focus {
    border-color: #922B21;
    box-shadow: 0 0 0 2px rgba(146, 43, 33, 0.1);
    background: #FEFDFB;
}

.bcg-input::placeholder {
    color: #8890A0;
}

/* ─── Primary button ───────────────────────────────────────── */
.bcg-primary-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: #922B21;
    color: #fff;
    border: none;
    border-radius: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s;
    min-height: 44px;
    box-sizing: border-box;
}

.bcg-primary-btn:hover {
    background: #7B241C;
}

.bcg-primary-btn:active {
    background: #6B1E17;
}

.bcg-primary-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ─── Spinner ──────────────────────────────────────────────── */
.bcg-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bcgSpin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes bcgSpin {
    to { transform: rotate(360deg); }
}

/* ─── Messages ─────────────────────────────────────────────── */
.bcg-msg {
    margin-top: 0.75rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0;
    line-height: 1.45;
    text-align: left;
}

.bcg-msg-error {
    background: #fef2f2;
    color: #922B21;
    border: 1px solid #e8c4c0;
}

.bcg-msg-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.bcg-msg-warning {
    background: #EFEAE0;
    color: #7B241C;
    border: 1px solid #D4D0C8;
}

.bcg-msg-info {
    background: #F8F6F0;
    color: #2D3038;
    border: 1px solid #D4D0C8;
}

/* ─── Hint text ────────────────────────────────────────────── */
.bcg-hint {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.75rem;
    color: #8890A0;
    margin: 1rem 0 0;
    line-height: 1.4;
}

/* ─── Step transition ──────────────────────────────────────── */
.bcg-step-enter {
    animation: bcgStepIn 0.25s ease forwards;
}

@keyframes bcgStepIn {
    from {
        opacity: 0;
        transform: translateX(16px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
    .bcg-modal {
        padding: 2rem 1.25rem 1.5rem;
    }

    .bcg-modal-title {
        font-size: 1.2rem;
    }

    .bcg-option-btn {
        padding: 0.625rem 0.75rem;
        gap: 0.7rem;
    }

    .bcg-opt-icon {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
}
