/* ==========================================================================
   ARTICLE INTERACTIVE — Engaging Content Components
   Flip cards, quizzes, accordions, reveals, animated stats
   ========================================================================== */

/* --- Design Tokens (inherits from article.css :root) --- */


/* ==========================================================================
   1. READING PROGRESS BAR
   ========================================================================== */

.cb-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 10000;
    pointer-events: none;
}

.cb-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-gold, #890808), var(--color-gold-light, #992424), var(--color-gold, #890808));
    background-size: 200% 100%;
    animation: cb-shimmer 2s linear infinite;
    transition: width 0.15s linear;
    border-radius: 0 2px 2px 0;
}

@keyframes cb-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ==========================================================================
   2. STATS BAR
   ========================================================================== */

.cb-stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--color-gold, #890808);
    border-radius: 12px;
    overflow: hidden;
    margin: 2.5rem 0;
}

.cb-stat {
    background: var(--color-cream, #ffe4e4);
    padding: 1.5rem 1rem;
    text-align: center;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.cb-stat.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.cb-stat:nth-child(2).is-visible { transition-delay: 0.15s; }
.cb-stat:nth-child(3).is-visible { transition-delay: 0.3s; }

.cb-stat-number {
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--color-gold, #890808);
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

.cb-stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-light, #8a4444);
    font-weight: 400;
    line-height: 1.3;
}

.cb-stat-value {
    display: inline-block;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cb-stat.is-visible .cb-stat-value {
    animation: cb-popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cb-popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}


/* ==========================================================================
   3. BRAND COMPARISON CARDS
   ========================================================================== */

.cb-brand-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0 2rem;
}

.cb-brand-card {
    background: var(--color-cream, #ffe4e4);
    border: 1px solid rgba(137, 8, 8, 0.1);
    border-radius: 12px;
    padding: 1.5rem 1.25rem;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: default;
    display: flex;
    flex-direction: column;
}

.cb-brand-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(85, 0, 0, 0.08);
}

.cb-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-gold, #890808);
    color: #fff;
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
}

.cb-brand-name {
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--color-text, #550000);
}

.cb-brand-def {
    font-style: italic;
    font-size: 0.9rem;
    color: var(--color-text-light, #8a4444);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.cb-brand-count {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--color-gold, #890808);
    font-weight: 500;
    margin-top: auto;
}

.cb-brand-count strong {
    font-size: 1.3em;
}


/* ==========================================================================
   4. CALLOUT BOX
   ========================================================================== */

.cb-callout {
    display: flex;
    gap: 1rem;
    background: var(--color-cream, #ffe4e4);
    border-left: 4px solid var(--color-gold, #890808);
    border-radius: 0 12px 12px 0;
    padding: 1.5rem;
    margin: 2rem 0;
    align-items: flex-start;
}

.cb-callout-icon {
    font-size: 1.8rem;
    line-height: 1;
    flex-shrink: 0;
}

.cb-callout-text {
    font-size: 0.95rem;
    line-height: 1.7;
}

.cb-callout-text strong {
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-size: 1.15em;
}


/* ==========================================================================
   5. MYTH vs FACT FLIP CARDS
   ========================================================================== */

.cb-flip-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1.5rem 0 2.5rem;
    perspective: 1200px;
}

.cb-flip-card {
    height: 260px;
    cursor: pointer;
    perspective: 800px;
}

.cb-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.cb-flip-card.is-flipped .cb-flip-inner {
    transform: rotateY(180deg);
}

.cb-flip-front,
.cb-flip-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.cb-flip-front {
    background: linear-gradient(135deg, var(--color-cream, #ffe4e4), #fff);
    border: 2px solid rgba(137, 8, 8, 0.12);
}

.cb-flip-back {
    background: #fff;
    border: 2px solid var(--color-gold, #890808);
    transform: rotateY(180deg);
}

.cb-flip-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-gold, #890808);
    color: #fff;
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    animation: cb-pulse 2s ease-in-out infinite;
}

@keyframes cb-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(137, 8, 8, 0.2); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(137, 8, 8, 0); }
}

.cb-flip-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--color-text, #550000);
    margin: 0;
}

.cb-flip-front .cb-flip-text {
    font-style: italic;
}

.cb-flip-hint {
    margin-top: auto;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-gold, #890808);
    opacity: 0.7;
    padding-top: 0.5rem;
}

.cb-flip-verdict {
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-size: 1.3rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 0.25rem 1rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.cb-verdict--myth {
    background: rgba(180, 30, 30, 0.1);
    color: #890808;
}

.cb-verdict--fact {
    background: rgba(45, 106, 79, 0.1);
    color: #2d6a4f;
}


/* ==========================================================================
   6. INGREDIENT ACCORDIONS
   ========================================================================== */

.cb-ingredients {
    margin: 1.5rem 0 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cb-ingredient {
    border: 1px solid rgba(137, 8, 8, 0.12);
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.cb-ingredient:hover {
    border-color: rgba(137, 8, 8, 0.25);
}

.cb-ingredient.is-open {
    border-color: var(--color-gold, #890808);
    box-shadow: 0 4px 20px rgba(85, 0, 0, 0.06);
}

.cb-ingredient-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    color: var(--color-text, #550000);
    text-align: left;
    transition: background 0.2s ease;
}

.cb-ingredient-header:hover {
    background: rgba(137, 8, 8, 0.02);
}

.cb-ingredient-name {
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-weight: 600;
    font-size: 1.15rem;
}

.cb-ingredient-verdict {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 500;
}

.cb-verdict-safe {
    background: rgba(45, 106, 79, 0.1);
    color: #2d6a4f;
}

.cb-verdict-caution {
    background: rgba(184, 134, 11, 0.15);
    color: #8a6508;
}

.cb-ingredient-toggle {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-cream, #ffe4e4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 300;
    color: var(--color-gold, #890808);
    transition: transform 0.3s ease, background 0.3s ease;
    flex-shrink: 0;
}

.cb-ingredient.is-open .cb-ingredient-toggle {
    background: var(--color-gold, #890808);
    color: #fff;
    transform: rotate(45deg);
}

.cb-ingredient-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
    padding: 0 1.25rem;
}

.cb-ingredient.is-open .cb-ingredient-body {
    padding-bottom: 1.25rem;
}

.cb-ingredient-body p {
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.cb-ingredient-body p:last-child {
    margin-bottom: 0;
}

/* Safety Meter */
.cb-safety-meter {
    position: relative;
    height: 8px;
    background: rgba(137, 8, 8, 0.08);
    border-radius: 4px;
    margin-bottom: 2.5rem;
    overflow: visible;
}

.cb-safety-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.25, 0.1, 0.25, 1) 0.2s;
}

[data-safety="85"] .cb-safety-fill { background: linear-gradient(90deg, #2d6a4f, #40916c); }
[data-safety="75"] .cb-safety-fill { background: linear-gradient(90deg, #40916c, #95d5b2); }
[data-safety="45"] .cb-safety-fill { background: linear-gradient(90deg, #b8860b, #daa520); }

.cb-safety-label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-light, #8a4444);
    margin-top: 0.5rem;
}


/* ==========================================================================
   7. REVEAL CARDS
   ========================================================================== */

.cb-reveal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1.5rem 0 2.5rem;
}

.cb-reveal-card {
    position: relative;
    min-height: 180px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(137, 8, 8, 0.1);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.cb-reveal-card:hover:not([data-revealed="true"]) {
    border-color: var(--color-gold, #890808);
    box-shadow: 0 4px 20px rgba(85, 0, 0, 0.06);
}

.cb-reveal-front {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-cream, #ffe4e4), #fff);
    z-index: 2;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.cb-reveal-card[data-revealed="true"] .cb-reveal-front {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

.cb-reveal-number {
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-gold, #890808);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.cb-reveal-prompt {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-text-light, #8a4444);
    animation: cb-pulse-opacity 2s ease-in-out infinite;
}

@keyframes cb-pulse-opacity {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.cb-reveal-back {
    padding: 1.25rem;
    background: #fff;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease 0.15s, transform 0.4s ease 0.15s;
}

.cb-reveal-card[data-revealed="true"] .cb-reveal-back {
    opacity: 1;
    transform: translateY(0);
}

.cb-reveal-back strong {
    display: block;
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-size: 1.05rem;
    margin-bottom: 0.4rem;
    color: var(--color-text, #550000);
}

.cb-reveal-back p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--color-text-light, #8a4444);
    margin: 0;
}


/* ==========================================================================
   8. COMPARISON TRIO
   ========================================================================== */

.cb-compare-trio {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0 2.5rem;
}

.cb-compare-card {
    background: #fff;
    border: 1px solid rgba(137, 8, 8, 0.1);
    border-radius: 12px;
    padding: 1.5rem 1.25rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cb-compare-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(85, 0, 0, 0.06);
}

.cb-compare-badge {
    display: inline-block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.cb-badge--unregulated {
    background: rgba(180, 30, 30, 0.08);
    color: #890808;
}

.cb-badge--regulated {
    background: rgba(45, 106, 79, 0.1);
    color: #2d6a4f;
}

.cb-compare-card h4 {
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text, #550000);
}

.cb-compare-card p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--color-text-light, #8a4444);
    margin: 0;
}


/* ==========================================================================
   9. INTERACTIVE QUIZ
   ========================================================================== */

.cb-quiz {
    background: linear-gradient(135deg, var(--color-cream, #ffe4e4), #fff);
    border: 2px solid rgba(137, 8, 8, 0.12);
    border-radius: 16px;
    padding: 2rem;
    margin: 2.5rem 0;
    overflow: hidden;
}

.cb-quiz-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.cb-quiz-header h3 {
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--color-text, #550000);
    margin-bottom: 0.25rem;
}

.cb-quiz-subtitle {
    font-size: 0.9rem;
    color: var(--color-text-light, #8a4444);
    margin-bottom: 1rem;
}

.cb-quiz-progress {
    height: 4px;
    background: rgba(137, 8, 8, 0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.cb-quiz-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--color-gold, #890808);
    border-radius: 2px;
    transition: width 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.cb-quiz-score {
    font-size: 0.8rem;
    color: var(--color-text-light, #8a4444);
}

.cb-quiz-question {
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.cb-quiz-q-text {
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-size: 1.15rem;
    font-weight: 500;
    text-align: center;
    margin-bottom: 1.25rem;
    line-height: 1.5;
    color: var(--color-text, #550000);
}

.cb-quiz-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
}

.cb-quiz-option {
    padding: 0.8rem 1rem;
    background: #fff;
    border: 2px solid rgba(137, 8, 8, 0.12);
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--color-text, #550000);
    transition: all 0.25s ease;
    text-align: center;
}

.cb-quiz-option:hover:not(:disabled) {
    border-color: var(--color-gold, #890808);
    background: var(--color-cream, #ffe4e4);
    transform: translateY(-2px);
}

.cb-quiz-option:active:not(:disabled) {
    transform: translateY(0);
}

.cb-quiz-option:disabled {
    cursor: default;
    opacity: 0.7;
}

.cb-quiz-option--correct {
    border-color: #2d6a4f !important;
    background: rgba(45, 106, 79, 0.08) !important;
    color: #2d6a4f !important;
    opacity: 1 !important;
    animation: cb-correctPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cb-quiz-option--wrong {
    border-color: #890808 !important;
    background: rgba(137, 8, 8, 0.05) !important;
    opacity: 1 !important;
    animation: cb-wrongShake 0.4s ease;
}

@keyframes cb-correctPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

@keyframes cb-wrongShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.cb-quiz-explanation {
    margin-top: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.6;
    animation: cb-slideDown 0.3s ease;
}

@keyframes cb-slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.cb-quiz-explanation--correct {
    background: rgba(45, 106, 79, 0.06);
    border-left: 3px solid #2d6a4f;
    color: #2d6a4f;
}

.cb-quiz-explanation--wrong {
    background: rgba(137, 8, 8, 0.04);
    border-left: 3px solid #890808;
    color: var(--color-text, #550000);
}

/* Quiz Result */
.cb-quiz-result-inner {
    text-align: center;
    padding: 1.5rem 0;
    animation: cb-slideDown 0.5s ease;
}

.cb-quiz-result-score {
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--color-gold, #890808);
    line-height: 1;
}

.cb-quiz-result-percent {
    font-size: 1.2rem;
    color: var(--color-text-light, #8a4444);
    margin: 0.25rem 0 0.75rem;
}

.cb-quiz-result-message {
    font-size: 1rem;
    color: var(--color-text, #550000);
    margin-bottom: 1.25rem;
}

.cb-quiz-restart {
    padding: 0.6rem 1.5rem;
    background: var(--color-gold, #890808);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    transition: all 0.25s ease;
}

.cb-quiz-restart:hover {
    background: var(--color-gold-light, #992424);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(137, 8, 8, 0.2);
}


/* ==========================================================================
   10. FAQ (within article body)
   ========================================================================== */

.cb-faq {
    margin: 1rem 0 2rem;
}

.cb-faq .faq-item {
    border: 1px solid rgba(137, 8, 8, 0.1);
    border-radius: 10px;
    margin-bottom: 0.6rem;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.cb-faq .faq-item.is-open {
    border-color: var(--color-gold, #890808);
}

.cb-faq .faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--color-text, #550000);
    text-align: left;
    line-height: 1.4;
    transition: background 0.2s ease;
}

.cb-faq .faq-question:hover {
    background: rgba(137, 8, 8, 0.02);
}

.cb-faq .faq-question::after {
    content: '+';
    font-size: 1.3rem;
    font-weight: 300;
    color: var(--color-gold, #890808);
    margin-left: 1rem;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.cb-faq .faq-item.is-open .faq-question::after {
    transform: rotate(45deg);
}

.cb-faq .faq-answer {
    padding: 0 1.25rem;
}

.cb-faq .faq-answer p {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--color-text-light, #8a4444);
    padding-bottom: 1rem;
    margin: 0;
}


/* ==========================================================================
   11. RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    .cb-stats-bar {
        grid-template-columns: 1fr;
    }

    .cb-stat-number {
        font-size: 1.8rem;
    }

    .cb-brand-cards {
        grid-template-columns: 1fr;
    }

    .cb-flip-grid {
        grid-template-columns: 1fr;
    }

    .cb-flip-card {
        height: 220px;
    }

    .cb-callout {
        flex-direction: column;
        gap: 0.5rem;
    }

    .cb-reveal-grid {
        grid-template-columns: 1fr;
    }

    .cb-reveal-card {
        min-height: 140px;
    }

    .cb-compare-trio {
        grid-template-columns: 1fr;
    }

    .cb-quiz {
        padding: 1.25rem;
    }

    .cb-quiz-options {
        grid-template-columns: 1fr;
    }

    .cb-quiz-header h3 {
        font-size: 1.3rem;
    }

    .cb-quiz-result-score {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .cb-flip-card {
        height: 200px;
    }

    .cb-flip-front,
    .cb-flip-back {
        padding: 1rem;
    }

    .cb-flip-text {
        font-size: 0.82rem;
    }

    .cb-ingredient-header {
        padding: 0.8rem 1rem;
        flex-wrap: wrap;
    }

    .cb-ingredient-verdict {
        order: 3;
        margin-top: 0.25rem;
    }
}
