/*
 * cs-prose.css
 * ------------
 * Long-form prose typography for any user-facing content area.
 * Apply class .cs-prose to a wrapper div around HTML content authored
 * in the CMS (blog posts, service detail pages, case studies, etc.)
 *
 * Modifiers (opt-in, applied alongside .cs-prose):
 *   .cs-prose--service    -- service detail page tweaks
 *   .cs-prose--blog       -- blog post tweaks (reserved, currently unused)
 *
 * History:
 *   - Originated as inline .blog-content rules in blogdetails.blade.php
 *   - Promoted to standalone stylesheet and renamed for shared use (P-CS-PROSE)
 *   - File served from /var/www/cs-cms-staging/assets/ via Apache Alias,
 *     not from Laravel's public/ — see vhost config for routing
 */


/* ========================================================================
   .cs-prose — scoped typography and layout for blog post body
   This rules-set ONLY applies inside .cs-prose so it never affects
   the storefront, sidebar, or other parts of the page.
   ======================================================================== */

.cs-prose {
    color: #2b3036;
    font-size: 17px;
    line-height: 1.75;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* --- Headings --- */
.cs-prose h1,
.cs-prose h2,
.cs-prose h3,
.cs-prose h4,
.cs-prose h5,
.cs-prose h6 {
    color: #1a1f24;
    font-weight: 700;
    line-height: 1.3;
    margin-top: 1.8em;
    margin-bottom: 0.6em;
    scroll-margin-top: 80px;
}
.cs-prose h1 { font-size: 2.0em; }
.cs-prose h2 { font-size: 1.6em; padding-bottom: 0.3em; border-bottom: 1px solid #eaecef; }
.cs-prose h3 { font-size: 1.3em; }
.cs-prose h4 { font-size: 1.1em; }
.cs-prose h5 { font-size: 1em; }
.cs-prose h6 { font-size: 0.95em; color: #4a5159; }

.cs-prose > h1:first-child,
.cs-prose > h2:first-child,
.cs-prose > h3:first-child {
    margin-top: 0;
}

/* --- Paragraphs --- */
.cs-prose p {
    margin: 0 0 1.2em 0;
}
.cs-prose p:last-child { margin-bottom: 0; }

/* --- Links --- */
.cs-prose a {
    color: #2563eb;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease;
}
.cs-prose a:hover {
    color: #1d4ed8;
    border-bottom-color: currentColor;
}

/* --- Lists --- */
.cs-prose ul,
.cs-prose ol {
    margin: 0 0 1.2em 0;
    padding-left: 1.6em;
}
.cs-prose li {
    margin-bottom: 0.5em;
}
.cs-prose li > ul,
.cs-prose li > ol {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}
.cs-prose ul { list-style: disc outside; }
.cs-prose ol { list-style: decimal outside; }

/* --- Blockquote --- */
.cs-prose blockquote {
    margin: 1.5em 0;
    padding: 0.6em 1.2em;
    border-left: 4px solid #2563eb;
    background-color: #f8fafc;
    color: #4a5159;
    font-style: italic;
}
.cs-prose blockquote p:last-child { margin-bottom: 0; }

/* --- Tables --- */
.cs-prose .table-responsive {
    overflow-x: auto;
    margin: 1.5em 0;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e1e4e8;
    border-radius: 4px;
}
.cs-prose table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    margin: 0;  /* margin lives on .table-responsive wrapper */
}
.cs-prose .table-responsive > table {
    margin: 0;
    border: none;  /* wrapper has the border */
}
.cs-prose table:not(.table-responsive table) {
    margin: 1.5em 0;
    border: 1px solid #e1e4e8;
}
.cs-prose th,
.cs-prose td {
    padding: 10px 14px;
    border: 1px solid #e1e4e8;
    text-align: left;
    vertical-align: top;
}
.cs-prose thead th {
    background-color: #f6f8fa;
    font-weight: 600;
    color: #1a1f24;
}
.cs-prose tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

/* --- Images & figures --- */
.cs-prose img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 0.8em 0;
}
.cs-prose figure {
    margin: 1.5em 0;
    text-align: center;
}
.cs-prose figure img {
    margin: 0 auto;
    display: block;
}
.cs-prose figcaption {
    margin-top: 0.6em;
    font-size: 0.9em;
    color: #6a7178;
    font-style: italic;
}

/* --- YouTube + iframe responsive 16:9 wrapper --- */
.cs-prose .video-wrapper {
    position: relative;
    width: 100%;
    margin: 1.5em 0;
    padding-bottom: 56.25%;  /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 6px;
    background-color: #000;
}
.cs-prose .video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
/* Bare iframes not wrapped (defensive — sanitizer wraps YouTube; others stay raw) */
.cs-prose > iframe,
.cs-prose p > iframe {
    max-width: 100%;
    border: 0;
}

/* --- Code & preformatted --- */
.cs-prose code {
    background-color: #f6f8fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 0.9em;
    color: #d63384;
}
.cs-prose pre {
    background-color: #f6f8fa;
    padding: 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5em 0;
    line-height: 1.5;
}
.cs-prose pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* --- Horizontal rule --- */
.cs-prose hr {
    border: 0;
    height: 1px;
    background-color: #e1e4e8;
    margin: 2em 0;
}

/* --- Strong/em --- */
.cs-prose strong, .cs-prose b { font-weight: 700; color: #1a1f24; }
.cs-prose em, .cs-prose i { font-style: italic; }

/* --- Defensive: kill any orphan inline styles that survived the sanitizer --- */
.cs-prose [style*="font-family"] { font-family: inherit !important; }
.cs-prose [style*="background-color: rgb(255, 255, 255)"] { background-color: transparent !important; }

/* ========================================================================
   Mobile responsive
   ======================================================================== */
@media (max-width: 768px) {
    .cs-prose { font-size: 16px; line-height: 1.7; }
    .cs-prose h1 { font-size: 1.7em; }
    .cs-prose h2 { font-size: 1.4em; }
    .cs-prose h3 { font-size: 1.2em; }
    .cs-prose blockquote { padding: 0.5em 1em; }
    .cs-prose th, .cs-prose td { padding: 8px 10px; font-size: 0.95em; }
}

/* ========================================================================
   Post header tweaks (post title bumped to h1 for SEO + visual hierarchy)
   ======================================================================== */
.blog-dteails-content > .content > h1.title {
    font-size: 2.2em;
    line-height: 1.25;
    margin-top: 0.5em;
    margin-bottom: 0.4em;
    color: #1a1f24;
    font-weight: 700;
}
@media (max-width: 768px) {
    .blog-dteails-content > .content > h1.title { font-size: 1.8em; }
}


/* ============================================================
   .cs-prose--service -- service detail page modifiers
   Currently identical to base; carve out as needs emerge.
   Examples (commented, ready to enable):

   .cs-prose--service h2 {
     border-bottom: none;
   }
   .cs-prose--service ul {
     list-style: square;
   }
   ============================================================ */
