/* Wealth-strategy button (header) and its information modal.
   The modal content itself is built out in a later iteration. */

.strategy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    flex-shrink: 0;
    animation: strategyPulse 2.4s ease-in-out infinite;
}

/* Subtle pulsing ring in the app's blue accent */
@keyframes strategyPulse {
    0%   { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.45); }
    70%  { box-shadow: 0 0 0 7px rgba(96, 165, 250, 0); }
    100% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0); }
}

.strategy-btn:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.strategy-btn svg {
    width: 15px;
    height: 15px;
}

#strategyModal.modal {
    position: absolute;
    inset: 0;
    background: transparent;
    backdrop-filter: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    border-radius: var(--shell-radius);
    overflow: hidden;
    overscroll-behavior: contain;
    z-index: 1000;
}

#strategyModal .modal-content {
    display: flex;
    flex-direction: column;
    background: rgb(30, 41, 59);
    width: min(100%, 760px);
    max-width: calc(100% - 32px);
    height: min(calc(100% - 32px), 760px);
    max-height: calc(100% - 32px);
    margin: 0 auto;
    border-radius: var(--shell-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: none;
    overflow: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Mobile keeps the scroll-to-bottom card treatment below. On desktop the
   strategy card stays locked to the main shell height. */
#strategyModal:not(.at-bottom) .modal-content {
    max-height: 100%;
    border-radius: var(--shell-radius);
}

#strategyModal .modal-content::-webkit-scrollbar {
    display: none;
}

#strategyModal .modal-header {
    flex: 0 0 auto;
    z-index: 2;
    padding-right: 72px;
    padding-left: 72px;
}

#strategyModal .modal-header h3 {
    font-size: 1.6rem;
}

#strategyModal .modal-header,
#strategyModal .modal-header::before {
    border-radius: var(--shell-radius) var(--shell-radius) 0 0;
}

.strategy-close-button {
    position: absolute;
    top: 50%;
    right: 20px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(15, 23, 42, 0.32);
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 1.45rem;
    font-weight: 500;
    line-height: 1;
    transform: translateY(-50%);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.strategy-close-button:hover,
.strategy-close-button:focus-visible {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(255, 255, 255, 0.7);
    outline: none;
    transform: translateY(-50%) scale(1.05);
}

/* Scrollable body inside the strategy modal */
#strategyModal .strategy-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 24px 14px 24px;
    color: #cbd5e1;
    line-height: 1.55;
}

#strategyModal .strategy-body::-webkit-scrollbar {
    display: none;
}

.strategy-body {
    padding: 24px 14px 30px;
    color: #cbd5e1;
    line-height: 1.55;
}

/* Styles for the About section in the modal (disclaimer content).
   Adds extra spacing between the two paragraphs and reduces font size/weight
   for a cleaner, lighter look. */
.about-body p {
    margin-bottom: 1.25em; /* extra space between paragraphs */
    font-size: 0.85rem;
    font-weight: 400;
}

.strategy-intro {
    text-align: center;
    color: #cbd5e1;
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 16px;
}

/* Collapsible 5-step outline (native <details>) */
.strategy-step {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    margin-bottom: 10px;
}

.strategy-step summary {
    list-style: none;
    cursor: pointer;
    min-height: 56px;
    padding: 16px;
    color: #f1f5f9;
    font-weight: 600;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.strategy-step summary::-webkit-details-marker {
    display: none;
}

.strategy-step summary::after {
    content: '+';
    color: #60a5fa;
    font-weight: 700;
    font-size: 1.2rem;
    line-height: 1;
}

.strategy-step[open] summary::after {
    content: '\2212'; /* minus */
}

.strategy-step summary:hover {
    color: #60a5fa;
}

.strategy-step p {
    margin: 0;
    padding: 0 16px 16px;
    color: #cbd5e1;
    font-size: 0.84rem;
    line-height: 1.55;
}

.strategy-cta-note {
    text-align: center;
    color: #94a3b8;
    font-size: 0.84rem;
    line-height: 1.5;
    margin: 18px 0 0;
}

/* Prominent "copy AI prompt" button shown near the top of the modal */
.copy-prompt-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 10px 20px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: fit-content;
    max-width: 100%;
    margin: 14px auto 0;
}

.copy-prompt-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-2px);
}

.copy-prompt-btn svg {
    width: 18px;
    height: 18px;
}

/* Toast for the strategy modal: drops in from the top, holds briefly, then
   whooshes off to the right. */
.strategy-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translate(-50%, -160px);
    background: rgba(71, 85, 105, 0.97);
    color: #fff;
    padding: 12px 20px;
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    width: auto;
    max-width: 500px;
    z-index: 4000;
    opacity: 0;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

/* Drop in from the top; the hold duration is controlled in JS (reading time),
   then the toast whooshes off to the right. */
.strategy-toast.in {
    animation: strategyToastIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.strategy-toast.out {
    animation: strategyToastOut 0.5s ease-in forwards;
}

@keyframes strategyToastIn {
    from { transform: translate(-50%, -160px); opacity: 0; }
    to   { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes strategyToastOut {
    from { transform: translate(-50%, 0); opacity: 1; }
    to   { transform: translate(100vw, 0); opacity: 0; }
}

/* Desktop: portrait card shorter than the main shell; body scrolls when expanded. */
@media (min-width: 601px) {
    #strategyModal.modal {
        align-items: center;
        justify-content: center;
    }

    #strategyModal .modal-content {
        width: min(100%, var(--desktop-strategy-width, 540px));
        max-width: var(--desktop-strategy-width, 540px);
        min-height: var(--desktop-strategy-height);
        height: var(--desktop-strategy-height);
        max-height: var(--desktop-strategy-height);
        margin: 0 auto;
    }

    #strategyModal:not(.at-bottom) .modal-content {
        max-height: var(--desktop-strategy-height);
    }

    #strategyModal .modal-header {
        padding: 18px 56px;
    }

    #strategyModal .modal-header h3 {
        font-size: 1.45rem;
    }

    #strategyModal .strategy-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 20px 22px 28px;
    }

    .strategy-intro {
        font-size: 0.88rem;
        line-height: 1.5;
        margin-bottom: 14px;
    }

    .strategy-step {
        margin-bottom: 10px;
    }

    .strategy-step summary {
        min-height: 50px;
        padding: 14px 16px;
        font-size: 0.9rem;
    }

    .strategy-step p {
        font-size: 0.84rem;
        line-height: 1.55;
        padding: 0 16px 16px;
    }

    .strategy-cta-note {
        font-size: 0.84rem;
        line-height: 1.5;
        margin: 16px 0 0;
    }

    .copy-prompt-btn {
        margin-top: 14px;
        padding: 10px 20px;
        font-size: 0.85rem;
    }
}

@media (max-width: 600px) {
    /*
     * Mirror the main card: content-sized shell, header fixed, body scrolls
     * only when content exceeds the viewport cap.
     */
    #strategyModal.modal {
        position: static;
        inset: auto;
        height: auto;
        flex: 1 1 auto;
        min-height: 0;
        background: transparent;
        border-radius: 0;
        overflow: hidden;
        justify-content: flex-start;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    #strategyModal .modal-content {
        width: 100%;
        max-width: 100%;
        height: auto;
        margin: 0;
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        border: none;
        border-radius: 0;
        background: rgb(30, 41, 59);
        box-shadow: none;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    #strategyModal .modal-header {
        flex: 0 0 auto;
        padding: 16px 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }

    #strategyModal .modal-header,
    #strategyModal .modal-header::before {
        border-radius: var(--shell-radius) var(--shell-radius) 0 0;
    }

    #strategyModal .strategy-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    #strategyModal .strategy-body::-webkit-scrollbar {
        display: none;
    }

    .container.strategy-open:not(.at-bottom) #strategyModal .strategy-body {
        -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 52px), transparent);
        mask-image: linear-gradient(to bottom, #000 calc(100% - 52px), transparent);
    }

    .container.strategy-open.at-bottom #strategyModal .strategy-body {
        -webkit-mask-image: none;
        mask-image: none;
    }

    #strategyModal .modal-header h3 {
        font-size: 1.22rem;
        margin: 0;
        text-align: center;
        flex: 1;
    }

    .strategy-close-button {
        right: 14px;
        width: 30px;
        height: 30px;
        font-size: 1.3rem;
        display: none !important; /* Hidden on mobile as requested */
    }

    .strategy-btn {
        width: 26px;
        height: 26px;
    }
    .strategy-btn svg { width: 13px; height: 13px; }
    #strategyModal .strategy-body { padding: 18px 14px 30px; }
    .strategy-intro { font-size: 0.84rem; }
    .strategy-step summary {
        min-height: 52px;
        padding: 14px;
        font-size: 0.84rem;
    }
    .strategy-step p {
        padding: 0 14px 14px;
        font-size: 0.8rem;
    }

    .about-body p {
        font-size: 0.8rem;
        margin-bottom: 1em;
    }
}
