/**
 * PRM Content Engine — Front-end defaults for the class hooks the worker
 * emits inside generated post content.
 *
 * Every selector here is a low-specificity default. WordPress themes can
 * (and often will) override these with their own brand styling. The goal
 * is "looks like a real button / heading / box even on a stock theme,"
 * not "wins every theme cascade fight."
 *
 * Loaded by the plugin only on the front-end singular-post template via
 * wp_enqueue_scripts (see prm_ce_enqueue_frontend_assets in the main
 * plugin file).
 *
 * @since 4.4.1
 */

/* ── CTA button ─────────────────────────────────────────────────────── */
.prm-ce-cta-button {
    display: inline-block;
    padding: 12px 26px;
    background: #2d6a4f;
    color: #ffffff !important;
    border-radius: 6px;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
    text-decoration: none !important;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    border: none;
    box-shadow: 0 1px 2px rgba(26, 58, 42, 0.15);
}
.prm-ce-cta-button:hover,
.prm-ce-cta-button:focus {
    background: #1a3a2a;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(26, 58, 42, 0.22);
    text-decoration: none !important;
}
.prm-ce-cta-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(26, 58, 42, 0.18);
}

/* ── H2 hook (the worker emits <h2 class="prm-ce-h2"> in 4.4.0+) ────── */
/* Default treatment for themes that under-style H2s. Sites with strong
   theme typography just override these rules. */
.prm-ce-h2 {
    font-size: 1.6em;
    font-weight: 700;
    line-height: 1.3;
    margin-top: 1.6em;
    margin-bottom: 0.5em;
    color: inherit;
}

/* ── Key Takeaways box ──────────────────────────────────────────────── */
.prm-key-takeaways {
    background: #f0fdf4;
    border-left: 4px solid #2d6a4f;
    border-radius: 4px;
    padding: 14px 20px;
    margin: 1.5em 0;
}
.prm-key-takeaways h3 {
    margin: 0 0 8px;
    font-size: 1.05em;
    color: #1a3a2a;
}
.prm-key-takeaways ul {
    margin: 0;
    padding-left: 20px;
}
.prm-key-takeaways li {
    margin-bottom: 4px;
    line-height: 1.5;
}

/* ── FAQ block (only when worker compiled FAQ inline, faq_format=html) ── */
.prm-faq {
    margin: 1.5em 0;
}
.prm-faq-item {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 10px;
    background: #ffffff;
}
.prm-faq-question {
    margin: 0 0 6px;
    font-size: 1.05em;
    font-weight: 700;
    color: #1a3a2a;
}
.prm-faq-answer p {
    margin: 0;
    line-height: 1.55;
}

/* ── FAQ accordion (faq_format=accordion) ───────────────────────────── */
/* Moved here from inline <style> in class-page-builder.php in 4.8.1 so
   the rules cache and don't ship a fresh <style> block per article. */
.prm-faq-wrap {
    margin: 2em 0;
    font-family: inherit;
}
.prm-faq-title {
    font-size: 1.4em;
    font-weight: 700;
    margin-bottom: 1em;
    color: inherit;
}
.prm-faq-wrap .prm-faq-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    background: #ffffff;
    padding: 0;
}
.prm-faq-wrap .prm-faq-item[open] {
    border-color: #2d6a4f;
}
.prm-faq-wrap .prm-faq-item[open] .prm-faq-question {
    background: #f0fdf4;
    color: #2d6a4f;
}
.prm-faq-wrap .prm-faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    list-style: none;
    color: #1a202c;
    background: #f8fafc;
    transition: background 0.15s ease, color 0.15s ease;
    margin: 0;
}
.prm-faq-wrap .prm-faq-question::-webkit-details-marker { display: none; }
.prm-faq-wrap .prm-faq-question::after {
    content: "+";
    font-size: 1.4em;
    font-weight: 300;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 12px;
}
.prm-faq-wrap .prm-faq-item[open] .prm-faq-question::after { content: "−"; }
.prm-faq-wrap .prm-faq-answer {
    padding: 16px 20px;
    color: #4a5568;
    line-height: 1.7;
    border-top: 1px solid #e2e8f0;
}
.prm-faq-wrap .prm-faq-answer p { margin: 0; }

/* ── Key Takeaways aside (4.8.1+ wraps in <aside role="complementary">) ── */
aside.prm-key-takeaways {
    background: #f0fdf4;
    border-left: 4px solid #2d6a4f;
    border-radius: 4px;
    padding: 14px 20px;
    margin: 1.5em 0;
}

/* ── Comparison tables (4.5.0+) ─────────────────────────────────────── */
/* Worker emits <div class="prm-ce-table-wrap"><table class="prm-ce-table">…
   Wrapper provides horizontal scroll on narrow viewports so a 4–5 column
   table doesn't break the article layout on mobile. */
.prm-ce-table-wrap {
    overflow-x: auto;
    margin: 1.5em 0;
    -webkit-overflow-scrolling: touch;
}
.prm-ce-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
    line-height: 1.45;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}
.prm-ce-table thead th {
    background: #1a3a2a;
    color: #ffffff;
    text-align: left;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 0.9em;
    letter-spacing: 0.02em;
    border-bottom: 1px solid #1a3a2a;
}
.prm-ce-table tbody td,
.prm-ce-table tbody th[scope="row"] {
    padding: 10px 14px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: top;
}
/* Row-header cells (first column in each body row, marked th scope="row" by
   the worker's sanitizer in 4.5.2+). Visually weighted so it carries the
   attribute label without needing markdown bold inside the cell text. */
.prm-ce-table tbody th[scope="row"] {
    background: #f0fdf4;
    color: #1a3a2a;
    font-weight: 700;
    text-align: left;
    width: 1%;        /* shrinks to natural width on wide layouts */
    white-space: nowrap;
    border-right: 1px solid #d8f3dc;
}
.prm-ce-table tbody tr:nth-child(even) td {
    background: #f8fafc;
}
.prm-ce-table tbody tr:nth-child(even) th[scope="row"] {
    background: #e8f7ec;
}
.prm-ce-table tbody tr:last-child td,
.prm-ce-table tbody tr:last-child th[scope="row"] {
    border-bottom: none;
}
.prm-ce-table tbody tr:hover td {
    background: #f0fdf4;
}
.prm-ce-table tbody tr:hover th[scope="row"] {
    background: #dcfce7;
}
@media (max-width: 600px) {
    /* On narrow viewports allow row-header to wrap so the table doesn't
       force the user into a permanent horizontal scroll just for labels. */
    .prm-ce-table tbody th[scope="row"] { white-space: normal; width: auto; }
}
