/* ==========================================================================
   Shared system for "explanation" pages (plans.php, compare.php, …) — the
   standalone conceptual / comparison pages, as opposed to the step-by-step
   guides in guides/guide.css. Registry: explanations/_list.php.
   ========================================================================== */

/* --- Hero (explanations/_hero.php) --- */
.explain-hero {
    position: relative;
    text-align: center;
    padding: 80px 20px 120px;
    background: radial-gradient(circle at top right, #f6f8f9, #ffffff);
    overflow: hidden;
}

.explain-hero .hero-blob {
    position: absolute;
    top: -50%; left: -10%;
    width: 600px; height: 600px;
    background: linear-gradient(135deg, #eef2f6 0%, #ffffff 100%);
    border-radius: 50%;
    z-index: 0;
    opacity: 0.6;
    pointer-events: none;
}

.explain-hero .hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.explain-hero .hero-content h1 { color: var(--dark); margin-bottom: 20px; }
.explain-hero .hero-content p {
    color: var(--muted);
    margin: 0 auto;
    line-height: 1.6;
    max-width: 650px;
}

/* --- Floating card section (comparison tables, plan stacks, …) --- */
.explain-section {
    max-width: 1000px;
    margin: -80px auto 100px;
    padding: 0 20px;
    position: relative;
    z-index: 5;
}

.explain-card {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.03);
    padding: 40px;
}

/* --- Section header (title + lede above a content block) --- */
.section-header { text-align: center; margin-bottom: 60px; }
.section-header h2 { color: var(--dark); margin-bottom: 15px; }
.section-header p { color: var(--muted); max-width: 600px; margin: 0 auto; }

/* --- Scroll-in animations (footer.php wires the observer globally) --- */
.animate-on-scroll { opacity: 0; transform: translateY(40px); transition: opacity 0.8s ease-out, transform 0.8s ease-out; }
.animate-on-scroll.animated { opacity: 1; transform: translateY(0); }

.stagger-children > * { opacity: 0; transform: translateY(30px); transition: all 0.6s ease-out; }
.stagger-children.animated > * { opacity: 1; transform: translateY(0); }
.stagger-children.animated > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.animated > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.animated > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.animated > *:nth-child(4) { transition-delay: 0.4s; }

/* --- FAQ accordion (explain.js wires the click handler) --- */
.explain-faq-block { max-width: 860px; margin: 0 auto 100px; padding: 0 20px; }
.explain-faq-grid { display: flex; flex-direction: column; gap: 16px; }

.explain-faq-item {
    border: 1px solid #eef0f3;
    border-radius: 18px;
    overflow: hidden;
    background: #fafbfc;
    transition: box-shadow 0.35s ease, border-color 0.35s ease;
}

.explain-faq-item:hover {
    box-shadow: 0 8px 30px rgba(0,0,0,0.07);
    border-color: #dde1e7;
}

.explain-faq-item.open {
    border-color: var(--primary);
    box-shadow: 0 12px 40px rgba(49,53,58,0.1);
    background: white;
}

.explain-faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 26px 30px;
    cursor: pointer;
    gap: 20px;
    user-select: none;
}

.explain-faq-question-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dark);
    flex: 1;
    transition: color 0.3s;
}

.explain-faq-item.open .explain-faq-question-text { color: var(--primary); }

.explain-faq-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #eef0f3;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.3s, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.explain-faq-icon i { font-size: 14px; color: var(--muted); transition: color 0.3s; }

.explain-faq-item.open .explain-faq-icon { background: var(--primary); transform: rotate(45deg); }
.explain-faq-item.open .explain-faq-icon i { color: white; }

.explain-faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
    padding: 0 30px;
}

.explain-faq-item.open .explain-faq-answer { max-height: 800px; }

.explain-faq-answer-inner {
    padding-bottom: 26px;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.85;
    border-top: 1px solid #eef0f3;
    padding-top: 20px;
}

.explain-faq-answer-inner p { margin: 0 0 12px; }
.explain-faq-answer-inner ul { margin: 0; padding-inline-start: 20px; list-style: none; }
.explain-faq-answer-inner li { margin-bottom: 12px; position: relative; padding-right: 32px; }
.explain-faq-answer-inner li:last-child { margin-bottom: 0; }

.explain-faq-answer-inner li::before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 0; top: 2px;
    color: #38a169;
    font-size: 1.1rem;
}

.explain-faq-answer-inner li strong {
    color: var(--dark);
    font-weight: 800;
    background: #f1f5f9;
    padding: 3px 10px;
    border-radius: 8px;
    margin-left: 6px;
    display: inline-block;
    border: 1px solid #e2e8f0;
}

/* --- Closing CTA (explanations/_cta.php) --- */
.explain-cta { text-align: center; margin-bottom: 100px; }
.explain-cta .btn { padding: 15px 40px; font-size: 1.2rem; }

@media (max-width: 768px) {
    .explain-hero { padding: 60px 15px 100px; }
    .explain-card { padding: 20px 10px; border-radius: 16px; margin-top: -60px; }
}

/* --- Landing page (explanations/index.php) --- */
.explanations-index {
    max-width: 1000px;
    margin: -30px auto 60px;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.explanations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.explain-page-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    background: #fff;
    padding: 28px;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.explain-page-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.08);
    border-color: #e2e8f0;
}

.explain-page-card .card-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    color: var(--primary);
    font-size: 1.25rem;
}

.explain-page-card h2 { margin: 0; font-size: 1.25rem; font-weight: 800; color: var(--dark); }
.explain-page-card p { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.7; }
.explain-page-card .card-go { margin-top: auto; padding-top: 8px; color: var(--primary); font-weight: 700; font-size: 0.9rem; }
.explain-page-card .card-go i { transition: transform 0.25s ease; }
.explain-page-card:hover .card-go i { transform: translateX(-4px); }

@media (prefers-reduced-motion: reduce) {
    .explain-page-card, .explain-page-card .card-go i { transition: none; }
    .explain-page-card:hover { transform: none; }
}
