/* Custom Block Styles for wp_blocks.py */

.aff-block {
    margin: 2.75rem 0;
    border: var(--border-width) solid var(--dark);
    border-radius: var(--radius);
    background: var(--white);
    overflow: hidden;
}

.aff-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.35rem;
    border-bottom: var(--border-width) solid var(--dark);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.82rem;
    background: var(--surface-alt);
}

.aff-body {
    padding: 1.35rem 1.5rem 1.5rem;
}

.aff-icon {
    flex: 0 0 auto;
}

.aff-point {
    border-left-width: 12px;
    border-left-color: var(--primary);
}

.aff-point .aff-head {
    background: var(--white);
}

.aff-point .aff-body {
    font-weight: 600;
    font-size: 1.02rem;
}

.aff-info {
    background: repeating-linear-gradient(
        -45deg,
        #ffffff 0,
        #ffffff 14px,
        #f3f3f3 14px,
        #f3f3f3 28px
    );
}

.aff-info .aff-head {
    background: var(--dark);
    color: var(--white);
}

.aff-info .aff-body {
    background: rgba(255, 255, 255, 0.92);
}

.aff-warn {
    border-color: var(--dark);
    background: #fff8ef;
}

.aff-warn .aff-head {
    background: var(--primary);
    color: var(--dark);
}

.aff-warn .aff-body {
    position: relative;
    padding-left: 2.25rem;
}

.aff-warn .aff-body::before {
    content: "!";
    position: absolute;
    left: 1rem;
    top: 1.25rem;
    width: 1rem;
    height: 1rem;
    font-weight: 900;
}

.aff-step {
    position: relative;
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr);
    gap: 1.2rem;
    align-items: flex-start;
    margin: 2.2rem 0;
}

.aff-step::before {
    content: "";
    position: absolute;
    left: 1.72rem;
    top: 2.45rem;
    bottom: -2.2rem;
    width: 1px;
    background: rgba(0, 0, 0, 0.18);
}

.aff-step + .aff-step {
    margin-top: -0.2rem;
}

.aff-step:last-child {
    margin-bottom: 0;
}

.aff-step:last-child::before {
    display: none;
}

.aff-step-marker {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    padding-top: 0.1rem;
}

.aff-step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border: 2px solid var(--dark);
    border-radius: 999px;
    background: var(--primary);
    color: var(--dark);
    font-weight: 900;
    font-size: 1rem;
    line-height: 1;
    box-shadow: 0 0 0 5px var(--bg);
}

.aff-step-content {
    position: relative;
    min-width: 0;
    padding: 0.15rem 0 1.4rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.aff-step:last-child .aff-step-content {
    padding-bottom: 0;
    border-bottom: 0;
}

.aff-step-kicker {
    margin: 0 0 0.35rem;
    min-width: 0;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    color: var(--muted);
}

.aff-step-title {
    margin: 0 0 0.65rem;
    font-family: inherit;
    font-weight: 900;
    font-size: 1.35rem;
    line-height: 1.2;
}

.aff-step .aff-body {
    padding: 0;
    border: 0;
    background: transparent;
}

.aff-checklist {
    background: var(--white);
}

.aff-checklist .aff-head {
    background: var(--dark);
    color: var(--white);
}

.aff-checklist-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.8rem;
}

.aff-check-item {
    padding: 0;
    border-bottom: 2px solid #e8e8e8;
}

.aff-check-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.aff-check-toggle {
    width: 100%;
    display: grid;
    grid-template-columns: 2rem 1fr;
    gap: 0.9rem;
    align-items: start;
    padding: 0.9rem 0;
    border: 0;
    background: transparent;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.aff-check-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border: 3px solid var(--dark);
    border-radius: 999px;
    background: #fff8d8;
    position: relative;
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.aff-check-mark::before {
    content: "";
    width: 0.55rem;
    height: 0.95rem;
    border-right: 3px solid var(--dark);
    border-bottom: 3px solid var(--dark);
    transform: rotate(45deg) scale(0);
    transform-origin: center;
    transition: transform 0.16s ease;
}

.aff-check-text {
    font-weight: 600;
    transition: opacity 0.18s ease;
}

.aff-check-toggle[aria-pressed="true"] .aff-check-mark {
    background: var(--primary);
    transform: scale(1.02);
}

.aff-check-toggle[aria-pressed="true"] .aff-check-mark::before {
    transform: rotate(45deg) scale(1);
}

.aff-check-toggle[aria-pressed="true"] .aff-check-text {
    opacity: 0.72;
}

.aff-data .aff-head {
    background: var(--surface-alt);
}

.aff-data-table {
    display: grid;
    gap: 0.7rem;
}

.aff-data-row {
    display: grid;
    grid-template-columns: minmax(120px, 180px) 1fr;
    border: 2px solid var(--dark);
    background: var(--white);
}

.aff-data-label,
.aff-data-value {
    padding: 0.85rem 1rem;
}

.aff-data-label {
    font-weight: 800;
    border-right: 2px solid var(--dark);
    background: #f5f5f5;
}

.aff-cta {
    border-width: 5px;
    box-shadow: var(--shadow-sm);
    background: var(--primary);
}

.aff-cta .aff-head {
    background: var(--dark);
    color: var(--primary);
}

.aff-cta .aff-body {
    padding: 1.5rem;
    font-size: 1.02rem;
    font-weight: 700;
}

.aff-faq {
    border-width: 3px;
}

.aff-faq .aff-head {
    background: var(--white);
    border-bottom-width: 2px;
}

.aff-faq .aff-body {
    padding: 0;
}

.aff-faq-item {
    border-top: 1px solid rgba(0, 0, 0, 0.14);
    background: var(--white);
}

.aff-faq-item:first-child {
    border-top: 0;
}

.aff-faq-question {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    list-style: none;
    padding: 1.1rem 1.25rem 0.95rem;
    font-weight: 800;
    line-height: 1.55;
    background: #fbfbfb;
}

.aff-faq-question::-webkit-details-marker {
    display: none;
}

.aff-faq-question::before {
    content: "Q";
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border: 2px solid var(--dark);
    border-radius: 999px;
    background: var(--primary);
    color: var(--dark);
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1;
}

.aff-faq-question::after {
    content: "";
    margin-left: auto;
    width: 0.6rem;
    height: 0.6rem;
    border-right: 2px solid rgba(0, 0, 0, 0.6);
    border-bottom: 2px solid rgba(0, 0, 0, 0.6);
    transform: rotate(45deg) translateY(-1px);
    flex: 0 0 auto;
}

.aff-faq-item[open] .aff-faq-question::after {
    transform: rotate(225deg) translateY(-1px);
}

.aff-faq-answer {
    position: relative;
    padding: 0.2rem 1.25rem 1.2rem 4rem;
    background: var(--white);
    color: rgba(0, 0, 0, 0.84);
}

.aff-faq-answer::before {
    content: "A";
    position: absolute;
    left: 1.25rem;
    top: 0.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 999px;
    background: var(--dark);
    color: var(--white);
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1;
}

.aff-faq-answer > *:last-child {
    margin-bottom: 0;
}

.aff-quiz {
    background: #fffdf4;
    color: var(--text);
    border-width: 4px;
}

.aff-quiz-head {
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 900;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    color: var(--dark);
    background: var(--primary);
    border-bottom: 3px solid var(--dark);
}

.aff-quiz-question {
    padding: 1.4rem 1.5rem 1rem;
    font-size: 1.08rem;
    line-height: 1.45;
    font-weight: 800;
}

.aff-quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
    padding: 0 1.5rem 1.5rem;
}

.aff-option {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 0.9rem;
    border: 2px solid var(--dark);
    border-radius: var(--radius);
    background: var(--white);
    font-weight: 700;
    font: inherit;
    color: inherit;
    cursor: pointer;
    font-size: 0.92rem;
    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.aff-option:hover {
    transform: translateY(-1px);
}

.aff-opt-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 999px;
    background: var(--primary);
    color: var(--dark);
    font-weight: 900;
}

.aff-option.is-active {
    border-color: rgba(0, 0, 0, 0.62);
}

.aff-option.is-correct {
    background: #fff3b0;
    box-shadow: 0 0 0 3px rgba(255, 208, 0, 0.2);
}

.aff-option.is-incorrect {
    background: #f8f2ee;
}

.aff-quiz-details {
    border-top: 3px solid var(--dark);
}

.aff-quiz-summary {
    cursor: pointer;
    padding: 1rem 1.25rem;
    font-weight: 800;
    background: #f3f3f3;
    text-align: center;
}

.aff-quiz-answer-box {
    padding: 1.35rem 1.5rem 1.5rem;
    background: var(--white);
}

.aff-quiz.is-correct .aff-quiz-answer-box {
    animation: aff-quiz-pop 0.42s ease;
}

.aff-quiz-answer-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
    font-weight: 900;
    color: var(--dark);
}

@keyframes aff-quiz-pop {
    0% {
        transform: translateY(4px);
        background: #fff7d7;
    }
    100% {
        transform: translateY(0);
        background: var(--white);
    }
}

@media (max-width: 768px) {
    .aff-block {
        margin: 2.25rem 0;
    }

    .aff-body,
    .aff-step-content,
    .aff-cta .aff-body,
    .aff-quiz-question,
    .aff-quiz-answer-box {
        padding-left: 1.15rem;
        padding-right: 1.15rem;
    }

    .aff-quiz-options {
        grid-template-columns: 1fr;
        padding-left: 1.15rem;
        padding-right: 1.15rem;
    }

    .aff-step-content {
        padding-left: 0;
    }

    .aff-step {
        grid-template-columns: 2.9rem minmax(0, 1fr);
        gap: 1rem;
    }

    .aff-step::before {
        left: 1.4rem;
        top: 2.25rem;
        bottom: -1.9rem;
    }

    .aff-data-row {
        grid-template-columns: 1fr;
    }

    .aff-data-label {
        border-right: 0;
        border-bottom: 2px solid var(--dark);
    }
}
