/**
 * FlashGL Prose — Unified Body Typography System
 *
 * One typography system for the_content() across ALL CPT single templates:
 *   service / case-study / news / post / route / team / airport / location /
 *   job / glossary / document / eme_event
 *
 * Usage:
 *   <div class="xxx-content__body flashgl-prose"> ... the_content() ... </div>
 *   Template-rendered section headings additionally get .flashgl-prose-heading.
 *
 * Design language mirrors the Industry single body system (service.css):
 *   - Headings: h2 brand blue, h3 red left-bar, h4 dark
 *   - Lead paragraph: enlarged intro
 *   - UL: brand-red CSS checkmarks; OL: blue circular number chips
 *   - Blockquote / table / img / hr fallbacks so nothing renders unstyled
 *
 * IMPORTANT: this file is enqueued AFTER page-specific CSS so its rules win
 * over the older scattered per-CPT body rules at equal specificity.
 *
 * @package FlashGL
 */

/* ── Base ─────────────────────────────────────────────────────────────── */
.flashgl-prose {
    font-size: 1.0625rem;
    line-height: 1.85;
    color: var(--wp--preset--color--gray-700, #374151);
}

/* ── Template-level section heading (e.g. "About X", "Definition") ───── */
.flashgl-prose-heading {
    position: relative;
    margin-top: 0;
    margin-bottom: 1.75rem;
    padding-bottom: 0.875rem;
    color: var(--flashgl-primary, #1A2B8C);
    font-size: var(--wp--preset--font-size--2xl, 1.5rem);
    font-weight: 700;
    line-height: 1.3;
    border-bottom: 2px solid rgba(26, 43, 140, 0.1);
}

.flashgl-prose-heading::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 56px;
    height: 2px;
    background: var(--flashgl-accent, #D00020);
}

/* ── Lead paragraph ───────────────────────────────────────────────────── */
/* Case A: heading inside the prose container, lead follows it directly.  */
.flashgl-prose .flashgl-prose-heading + p,
/* Case B: heading outside the container → first paragraph is the lead.   */
.flashgl-prose > p:first-child {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--wp--preset--color--gray-800, #1F2937);
}

/* ── Headings inside editor content ───────────────────────────────────── */
.flashgl-prose h2 {
    margin: 2.5rem 0 1rem;
    padding: 0;
    border: 0;
    color: var(--wp--preset--color--primary, #1A2B8C);
    font-size: var(--wp--preset--font-size--xl, 1.375rem);
    font-weight: 700;
    line-height: 1.35;
}

.flashgl-prose h2:first-child {
    margin-top: 0;
}

/* Neutralize legacy decorations (e.g. news h2::before icon) */
.flashgl-prose h2::before,
.flashgl-prose h3::before {
    content: none;
}

.flashgl-prose h3 {
    margin: 2.25rem 0 0.875rem;
    padding-left: 0.875rem;
    border-left: 3px solid var(--flashgl-accent, #D00020);
    color: var(--wp--preset--color--gray-900, #111827);
    font-size: 1.1875rem;
    font-weight: 700;
    line-height: 1.4;
}

.flashgl-prose h4 {
    margin: 1.75rem 0 0.75rem;
    color: var(--wp--preset--color--gray-900, #111827);
    font-size: 1.0625rem;
    font-weight: 700;
}

/* ── Paragraphs ───────────────────────────────────────────────────────── */
.flashgl-prose p {
    margin: 0 0 1.25rem;
}

.flashgl-prose p:last-child {
    margin-bottom: 0;
}

/* ── Unordered lists — brand check markers ────────────────────────────── */
.flashgl-prose ul {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}

.flashgl-prose ul li {
    position: relative;
    padding: 0;
    padding-left: 1.75rem;
    margin-bottom: 0.625rem;
    border: 0;
    background: none;
    line-height: 1.7;
}

.flashgl-prose ul li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.68em;
    width: 10px;
    height: 5px;
    background: none;
    border-left: 2.5px solid var(--flashgl-accent, #D00020);
    border-bottom: 2.5px solid var(--flashgl-accent, #D00020);
    border-top: 0;
    border-right: 0;
    border-radius: 1px;
    transform: rotate(-45deg);
}

/* ── Ordered lists — numbered chips ───────────────────────────────────── */
.flashgl-prose ol {
    list-style: none;
    counter-reset: flashgl-ol;
    margin: 0 0 1.5rem;
    padding: 0;
}

.flashgl-prose ol li {
    position: relative;
    counter-increment: flashgl-ol;
    padding: 0;
    padding-left: 2.25rem;
    margin-bottom: 0.625rem;
    border: 0;
    background: none;
    line-height: 1.7;
}

.flashgl-prose ol li::before {
    content: counter(flashgl-ol);
    position: absolute;
    left: 0;
    top: 0.18em;
    width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 43, 140, 0.07);
    color: var(--flashgl-primary, #1A2B8C);
    border: 0;
    border-radius: 50%;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.5rem;
    text-align: center;
    transform: none;
}

/* Nested lists */
.flashgl-prose li > ul,
.flashgl-prose li > ol {
    margin: 0.5rem 0 0.25rem;
}

/* ── Inline elements ──────────────────────────────────────────────────── */
.flashgl-prose strong {
    color: var(--wp--preset--color--gray-900, #111827);
    font-weight: 700;
}

/* Only classless anchors = editor content links.
   Buttons/CTAs inside content keep their own component styles. */
.flashgl-prose a:not([class]) {
    color: var(--flashgl-primary, #1A2B8C);
    text-decoration: underline;
    text-decoration-color: rgba(26, 43, 140, 0.3);
    text-underline-offset: 3px;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.flashgl-prose a:not([class]):hover {
    color: var(--flashgl-accent, #D00020);
    text-decoration-color: currentColor;
}

/* ── Blockquote ───────────────────────────────────────────────────────── */
.flashgl-prose blockquote {
    margin: 1.75rem 0;
    padding: 1.25rem 1.5rem;
    background: rgba(26, 43, 140, 0.035);
    border: 0;
    border-left: 4px solid var(--flashgl-primary, #1A2B8C);
    border-radius: 0 var(--flashgl-radius-md, 8px) var(--flashgl-radius-md, 8px) 0;
    color: var(--wp--preset--color--gray-800, #1F2937);
    font-style: italic;
}

.flashgl-prose blockquote p:last-child {
    margin-bottom: 0;
}

/* ── Tables ───────────────────────────────────────────────────────────── */
.flashgl-prose table {
    width: 100%;
    margin: 1.75rem 0;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.flashgl-prose th {
    background: rgba(26, 43, 140, 0.05);
    color: var(--flashgl-primary, #1A2B8C);
    font-weight: 700;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid rgba(26, 43, 140, 0.15);
}

.flashgl-prose td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--wp--preset--color--gray-100, #F3F4F6);
}

/* ── Media & separators ───────────────────────────────────────────────── */
.flashgl-prose img {
    max-width: 100%;
    height: auto;
    border-radius: var(--flashgl-radius-md, 8px);
    margin: 1.5rem 0;
}

.flashgl-prose hr {
    margin: 2.5rem 0;
    border: 0;
    border-top: 1px solid var(--wp--preset--color--gray-100, #E5E7EB);
}

/* ── Mobile refinements ───────────────────────────────────────────────── */
@media (max-width: 640px) {
    .flashgl-prose {
        font-size: 1rem;
        line-height: 1.75;
    }
    .flashgl-prose-heading {
        font-size: 1.375rem;
        margin-bottom: 1.375rem;
    }
    .flashgl-prose .flashgl-prose-heading + p,
    .flashgl-prose > p:first-child {
        font-size: 1.0625rem;
    }
    .flashgl-prose h2 {
        font-size: 1.25rem;
        margin-top: 2rem;
    }
    .flashgl-prose h3 {
        font-size: 1.125rem;
        margin-top: 1.75rem;
    }
}
