/**
 * Authority Engine V1.0 — Isolated Visual Engine
 * McKinsey-standard reading experience for high-value technical assets.
 * Enqueued ONLY on posts using the Authority Engine template.
 * Zero bleed into the rest of the site.
 */

/* ========================================
   SCROLL PROGRESS BAR
   ======================================== */
.authority-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: #C5A55A;
    z-index: 99999;
    transition: width 50ms linear;
}

/* ========================================
   ARTICLE CONTAINER — Paper Effect
   ======================================== */
.authority-article {
    background: #FAFAFA;
    padding-bottom: 64px;
}

/* ========================================
   READING LANE — 750px Centered
   ======================================== */
.authority-reading-lane {
    max-width: 750px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}

/* ========================================
   BREADCRUMBS
   ======================================== */
.authority-breadcrumbs {
    padding: 20px 0 0;
}
.authority-breadcrumbs .breadcrumbs,
.authority-breadcrumbs .rank-math-breadcrumb {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    color: #666666;
}
.authority-breadcrumbs .breadcrumbs a,
.authority-breadcrumbs .rank-math-breadcrumb a {
    color: #C5A55A;
    text-decoration: none;
}
.authority-breadcrumbs .breadcrumbs a:hover,
.authority-breadcrumbs .rank-math-breadcrumb a:hover {
    text-decoration: underline;
}

/* ========================================
   ARTICLE HEADER
   ======================================== */
.authority-header {
    padding: 32px 0 24px;
    border-bottom: 2px solid #C5A55A;
    margin-bottom: 0;
}
.authority-header h1 {
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.2;
    color: #002147;
    margin: 12px 0 16px;
    border-left: 3px solid #C5A55A;
    padding-left: 16px;
    margin-left: -2px;
}
.authority-meta {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    color: #666666;
    font-style: italic;
}
.authority-meta-sep {
    margin: 0 6px;
    color: #CCCCCC;
}

/* ========================================
   BLUF — EXECUTIVE SUMMARY
   ======================================== */
.authority-bluf {
    padding: 32px 0 0;
}
.authority-bluf-box {
    background: #FFFFFF;
    border: 1px solid #E1E8ED;
    border-left: 4px solid #002147;
    border-radius: 4px;
    padding: 24px 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.authority-bluf-label {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #002147;
    margin: 0 0 10px;
}
.authority-bluf-box p {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: #2C3E50;
    margin: 0;
}

/* ========================================
   TABLE OF CONTENTS — In-lane
   ======================================== */
.authority-toc {
    background: #FFFFFF;
    border: 1px solid #EAEAEA;
    border-left: 3px solid #C5A55A;
    border-radius: 4px;
    padding: 20px 24px;
    margin: 32px 0;
}
/* TOC Toggle Button — full-width, no button chrome */
.authority-toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    margin: 0 0 12px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
.authority-toc-toggle:focus-visible {
    outline: 2px solid #C5A55A;
    outline-offset: 2px;
    border-radius: 2px;
}
.authority-toc-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #002147;
    margin: 0;
}
/* Chevron icon — rotates on collapse */
.authority-toc-icon {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-right: 2px solid #666666;
    border-bottom: 2px solid #666666;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.authority-toc-toggle[aria-expanded="false"] .authority-toc-icon {
    transform: rotate(-45deg);
}
.authority-toc-toggle[aria-expanded="false"] {
    margin-bottom: 0;
}
.authority-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.authority-toc li {
    margin-bottom: 6px;
}
.authority-toc a {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.85rem;
    color: #666666;
    text-decoration: none;
    transition: color 0.15s ease;
    display: block;
    padding: 2px 0;
}
.authority-toc a:hover,
.authority-toc a.active {
    color: #C5A55A;
}

/* ========================================
   READING LANE — PROSE TYPOGRAPHY (18px/1.8)
   ======================================== */
.authority-prose {
    padding-top: 32px;
    position: relative;
}

.authority-prose p {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1.125rem;
    line-height: 1.8;
    color: #2C3E50;
    margin-bottom: 1.5rem;
}

.authority-prose h2 {
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    font-weight: 700;
    color: #002147;
    margin: 3rem 0 1rem;
    border-left: 3px solid #C5A55A;
    padding-left: 14px;
    margin-left: -2px;
    line-height: 1.3;
}

.authority-prose h3 {
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: clamp(1.15rem, 2.5vw, 1.4rem);
    font-weight: 600;
    color: #002147;
    margin: 2rem 0 0.75rem;
    line-height: 1.35;
}

.authority-prose h4 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #002147;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 1.5rem 0 0.5rem;
}

.authority-prose ul,
.authority-prose ol {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1.125rem;
    line-height: 1.8;
    color: #2C3E50;
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.authority-prose li {
    margin-bottom: 0.5rem;
}

.authority-prose blockquote {
    border-left: 3px solid #C5A55A;
    margin: 2rem 0;
    padding: 16px 24px;
    background: #FFFFFF;
    font-style: italic;
    color: #4a4a4a;
    border-radius: 0 4px 4px 0;
}

.authority-prose blockquote p {
    margin-bottom: 0;
}

.authority-prose a {
    color: #C5A55A;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.authority-prose a:hover {
    color: #A8893E;
}

.authority-prose strong {
    font-weight: 600;
    color: #1a1a1a;
}

.authority-prose code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    background: #F0F0F0;
    padding: 2px 6px;
    border-radius: 3px;
}

.authority-prose pre {
    background: #1a1a2e;
    color: #e0e0e0;
    padding: 20px 24px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.875rem;
    line-height: 1.6;
}
.authority-prose pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Tables */
.authority-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}
.authority-prose th {
    background: #002147;
    color: #FFFFFF;
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
}
.authority-prose td {
    padding: 10px 14px;
    border-bottom: 1px solid #EAEAEA;
}
.authority-prose tr:nth-child(even) {
    background: #FAFAFA;
}

/* Images */
.authority-prose img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1.5rem 0;
}
.authority-prose figure {
    margin: 2rem 0;
}
.authority-prose figcaption {
    font-size: 0.8rem;
    color: #666666;
    text-align: center;
    margin-top: 8px;
    font-style: italic;
}

/* ========================================
   AUDITOR PRO-TIP — Margin Notes
   Desktop: Right-gutter absolute positioning
   Mobile: Inline gold call-out box
   ======================================== */
.auditor-pro-tip {
    background: #FFFDF5;
    border: 1px solid #E8D5A0;
    border-left: 4px solid #C5A55A;
    border-radius: 4px;
    padding: 16px 20px;
    margin: 1.5rem 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #2C3E50;
}
.auditor-pro-tip::before {
    content: "Auditor Pro-Tip";
    display: block;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #C5A55A;
    margin-bottom: 8px;
}
.auditor-pro-tip p {
    font-size: 0.9rem !important;
    line-height: 1.6 !important;
    margin-bottom: 0 !important;
}

/* Desktop: Pull pro-tips into right margin gutter.
   Positioned ancestor is .authority-prose (already position:relative).
   No phantom margin when pro-tips are absent — the reading lane
   stays centered via margin:0 auto on .authority-reading-lane. */
@media (min-width: 1200px) {
    .authority-content-wrapper {
        overflow: visible;
    }

    .auditor-pro-tip {
        position: absolute;
        right: -280px;
        width: 240px;
        margin: 0;
        font-size: 0.82rem;
    }
    .auditor-pro-tip p {
        font-size: 0.82rem !important;
    }

    /* When no pro-tips exist, ensure zero gutter residue */
    .authority-prose:not(:has(.auditor-pro-tip)) {
        position: static;
    }
}

/* ========================================
   ARTICLE SIGN-OFF & KIT CTA
   ======================================== */
.authority-article .article-signoff {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    font-style: italic;
    color: #666666;
    border-top: 1px solid #EAEAEA;
    padding-top: 24px;
    margin-top: 48px;
}

.authority-kit-cta {
    margin-top: 32px;
    padding: 28px;
    background: #FFFFFF;
    border: 1px solid #EAEAEA;
    border-radius: 8px;
    text-align: center;
}
.authority-kit-cta .kit-form {
    max-width: 400px;
    margin: 0 auto;
}
.authority-kit-cta .newsletter-form {
    display: flex;
    gap: 8px;
}
.authority-kit-cta .newsletter-form input[type="email"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #E1E8ED;
    border-radius: 50px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9rem;
}
.authority-kit-cta .newsletter-form button {
    background: #C5A55A;
    color: #FFFFFF;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}
.authority-kit-cta .newsletter-form button:hover {
    background: #A8893E;
}

/* ========================================
   RELATED KNOWLEDGE — Authority Style
   ======================================== */
.authority-related {
    background: #F4F6F8;
    padding: 48px 0 64px;
}
.authority-related h2 {
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: #002147;
    margin: 0 0 24px;
}
.authority-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.authority-related-card {
    background: #FFFFFF;
    border: 1px solid #EAEAEA;
    border-bottom: 3px solid #C5A55A;
    border-radius: 6px;
    padding: 20px;
    transition: box-shadow 0.15s ease;
}
.authority-related-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.authority-related-card h3 {
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 8px 0 10px;
}
.authority-related-card h3 a {
    color: #002147;
    text-decoration: none;
}
.authority-related-card h3 a:hover {
    color: #C5A55A;
}
.authority-related-card .authority-meta {
    margin-bottom: 12px;
}
.authority-read-more {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #C5A55A;
    text-decoration: none;
}
.authority-read-more:hover {
    text-decoration: underline;
}

/* Related Card Thumbnails */
.authority-card-thumb {
    display: block;
    margin: -20px -20px 16px;
    overflow: hidden;
    border-radius: 6px 6px 0 0;
}
.authority-card-thumb img {
    width: 100%;
    height: auto;
    display: block;
}
.authority-card-thumb-placeholder {
    margin: -20px -20px 16px;
    aspect-ratio: 1200 / 630;
    background: linear-gradient(135deg, #002147, #003366);
    border-radius: 6px 6px 0 0;
}

/* ========================================
   EDGE CASE: Long Titles (3-line H1)
   Prevents BLUF overlap by ensuring header
   has enough bottom padding regardless of
   title length.
   ======================================== */
.authority-header {
    overflow: visible;
}
.authority-header h1 {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}
.authority-bluf {
    clear: both;
}

/* ========================================
   EDGE CASE: Wide Tables on Mobile
   Horizontal scroll wrapper for 6+ column
   tables on 320px screens.
   ======================================== */
.authority-prose .table-responsive,
.authority-prose .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.5rem 0;
}
.authority-prose .table-responsive table,
.authority-prose .table-wrapper table {
    margin: 0;
    min-width: 600px;
}
/* Direct tables without a wrapper */
.authority-prose > table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
}

/* ========================================
   EDGE CASE: Ultra-Wide Screens (>2000px)
   Guarantees 750px lane stays dead-center.
   ======================================== */
.authority-reading-lane {
    margin-left: auto !important;
    margin-right: auto !important;
}
.authority-content-wrapper {
    max-width: 100vw;
}

/* ========================================
   TYPOGRAPHY ENFORCEMENT
   Inter 18px (1.125rem) / 1.8 line-height
   applied to all paragraph-level elements
   inside the reading lane. No exceptions.
   ======================================== */
.authority-prose p,
.authority-prose li,
.authority-prose dd,
.authority-prose dt {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1.125rem;
    line-height: 1.8;
    color: #2C3E50;
}

/* ========================================
   RESPONSIVE — Mobile Hardening
   ======================================== */
@media (max-width: 768px) {
    .authority-reading-lane {
        padding-left: 20px;
        padding-right: 20px;
    }

    .authority-header h1 {
        font-size: 1.6rem;
    }

    /* 18px holds on mobile — no reduction */
    .authority-prose p,
    .authority-prose ul,
    .authority-prose ol,
    .authority-prose li {
        font-size: 1.125rem;
        line-height: 1.8;
    }

    .authority-related-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .authority-kit-cta .newsletter-form {
        flex-direction: column;
    }
    .authority-kit-cta .newsletter-form input[type="email"],
    .authority-kit-cta .newsletter-form button {
        width: 100%;
    }

    /* Wide table scroll hint on small screens */
    .authority-prose > table {
        white-space: normal;
    }
}

/* Tablet breakpoint */
@media (min-width: 769px) and (max-width: 1024px) {
    .authority-related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   ELEMENTOR CLEANUP — Strip div-soup
   When Authority Engine is active, neutralize
   Elementor wrapper noise on legacy content.
   ======================================== */
.authority-prose .elementor-section-wrap,
.authority-prose .elementor-section,
.authority-prose .elementor-container,
.authority-prose .elementor-column-wrap,
.authority-prose .elementor-column,
.authority-prose .elementor-widget-wrap,
.authority-prose .elementor-widget,
.authority-prose .elementor-widget-container,
.authority-prose .elementor-element,
.authority-prose .elementor-row {
    display: contents !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    max-width: none !important;
    min-height: 0 !important;
}

/* Override Elementor inline width/padding */
.authority-prose [data-element_type] {
    width: auto !important;
    max-width: none !important;
    padding: 0 !important;
}

/* Elementor text widget inherits Authority prose */
.authority-prose .elementor-text-editor p {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1.125rem;
    line-height: 1.8;
    color: #2C3E50;
}
.authority-prose .elementor-text-editor h2 {
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    font-weight: 700;
    color: #002147;
    border-left: 3px solid #C5A55A;
    padding-left: 14px;
    margin-left: -2px;
}

/* ========================================
   THE AUDIT FIX — Actionable remedy box
   ======================================== */
.authority-prose .audit-fix {
    background: #F0F7F0;
    border: 1px solid #D4EDDA;
    border-left: 4px solid #0F7A3D;
    border-radius: 0 6px 6px 0;
    padding: 20px 24px;
    margin: var(--space-2xl, 48px) 0;
    font-size: 0.95rem;
    line-height: 1.6;
}
.authority-prose .audit-fix::before {
    content: "THE AUDIT FIX";
    display: block;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #0F7A3D;
    margin-bottom: 8px;
}
.authority-prose .audit-fix p {
    margin-bottom: 0.5rem;
}
.authority-prose .audit-fix p:last-child {
    margin-bottom: 0;
}

/* ========================================
   SIGNATURE BLOCK — Article Closing
   ======================================== */
.signature-block {
    border-top: 1px solid #EAEAEA;
    padding-top: 2rem;
    margin-top: 3rem;
}
.signature-block p {
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-size: 1.15rem;
    color: #002147;
    margin-bottom: 0.5rem;
}
.signature-block .signature-name {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-style: normal;
    font-weight: 600;
    font-size: 0.85rem;
    color: #666666;
}

/* ========================================
   AUTHOR BIO — E-E-A-T Signal
   ======================================== */
.authority-bio {
    margin-top: 2rem;
    padding: 24px 0;
    border-top: 1px solid #EAEAEA;
}
.authority-bio-inner {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}
.authority-bio .authority-bio-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid #E1E8ED;
}
.authority-bio-name {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: #002147;
    margin-bottom: 2px;
}
.authority-bio-credentials {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #C5A55A;
    margin-bottom: 8px;
}
.authority-bio-desc {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9rem !important;
    line-height: 1.6 !important;
    color: #4a4a4a;
    margin: 0 !important;
}

@media (max-width: 480px) {
    .authority-bio-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* ========================================
   PRINT STYLES — Clean Paper Output
   ======================================== */
@media print {
    .authority-progress-bar,
    .authority-toc,
    .authority-kit-cta,
    .authority-bio,
    .site-header,
    .site-footer,
    .authority-related {
        display: none !important;
    }
    .authority-article {
        background: #FFFFFF;
    }
    .authority-prose {
        font-size: 12pt;
        line-height: 1.6;
    }
}
