/*
 * Blog Content Styles - Unancor
 * Modern, readable typography for blog posts
 * Maintains brand consistency with Unancor's design system
 */

/* ==========================================================================
   Base Content Styles
   ========================================================================== */

.blog-content {
    font-size: 1.125rem; /* 18px */
    line-height: 1.8;
    color: #374151;
    max-width: 100%;
}

/* ==========================================================================
   Typography Hierarchy
   ========================================================================== */

.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4,
.blog-content h5,
.blog-content h6 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
    letter-spacing: -0.02em;
    scroll-margin-top: 100px; /* For anchor links with sticky header */
}

.blog-content h1 {
    font-size: 2.5rem; /* 40px */
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.blog-content h2 {
    font-size: 2rem; /* 32px */
    margin-top: 3.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid #E5E7EB;
    position: relative;
}

.blog-content h2::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, #4E8AFF 0%, #7C3AED 100%);
}

.blog-content h3 {
    font-size: 1.75rem; /* 28px */
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: #1F2937;
}

.blog-content h4 {
    font-size: 1.5rem; /* 24px */
    margin-top: 2rem;
    margin-bottom: 0.875rem;
    color: #374151;
}

.blog-content h5 {
    font-size: 1.25rem; /* 20px */
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
}

.blog-content h6 {
    font-size: 1.125rem; /* 18px */
    margin-top: 1.5rem;
    margin-bottom: 0.625rem;
    font-weight: 600;
}

/* ==========================================================================
   Paragraphs & Text Elements
   ========================================================================== */

.blog-content p {
    margin-bottom: 1.75rem;
    line-height: 1.8;
    color: #374151;
}

.blog-content p:last-child {
    margin-bottom: 0;
}

/* Lead paragraph - first paragraph gets special treatment */
.blog-content > p:first-of-type {
    font-size: 1.3rem; /* 20.8px */
    line-height: 1.7;
    color: #1F2937;
    font-weight: 400;
    margin-bottom: 2.5rem;
}

.blog-content strong,
.blog-content b {
    font-weight: 600;
    color: #111827;
}

.blog-content em,
.blog-content i {
    font-style: italic;
    color: #4B5563;
}

.blog-content mark {
    background: linear-gradient(to right, #FEF3C7, #FDE68A);
    padding: 2px 4px;
    border-radius: 3px;
}

.blog-content small {
    font-size: 0.875rem;
    color: #6B7280;
}

/* ==========================================================================
   Links
   ========================================================================== */

.blog-content a {
    color: #4E8AFF;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: rgba(78, 138, 255, 0.4);
    transition: all 0.2s ease;
    font-weight: 500;
}

.blog-content a:hover {
    color: #2d3e7a;
    text-decoration-thickness: 2px;
    text-decoration-color: rgba(45, 62, 122, 0.8);
}

.blog-content a:focus-visible {
    outline: 2px solid #4E8AFF;
    outline-offset: 3px;
    border-radius: 3px;
}

/* External links indicator */
.blog-content a[href^="http"]::after {
    content: "↗";
    display: inline-block;
    margin-left: 4px;
    font-size: 0.85em;
    opacity: 0.6;
}

.blog-content a[href^="http"]:hover::after {
    opacity: 1;
}

/* ==========================================================================
   Lists
   ========================================================================== */

.blog-content ul,
.blog-content ol {
    margin: 2rem 0;
    padding-left: 2rem;
}

.blog-content ul:not(.toc-list):not(.toc-sublist) {
    list-style-type: none;
}

.blog-content ul:not(.toc-list):not(.toc-sublist) li {
    position: relative;
    padding-left: 1.5rem;
}

.blog-content ul:not(.toc-list):not(.toc-sublist) li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.65em;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #4E8AFF 0%, #7C3AED 100%);
    border-radius: 50%;
}

.blog-content ol {
    list-style-type: none;
    counter-reset: custom-counter;
}

.blog-content ol li {
    position: relative;
    padding-left: 2rem;
    counter-increment: custom-counter;
}

.blog-content ol li::before {
    content: counter(custom-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, #4E8AFF 0%, #7C3AED 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
}

.blog-content li {
    margin: 1rem 0;
    line-height: 1.7;
    color: #374151;
}

.blog-content ul ul,
.blog-content ol ol,
.blog-content ul ol,
.blog-content ol ul {
    margin: 0.75rem 0;
}

.blog-content li > p {
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   Blockquotes
   ========================================================================== */

.blog-content blockquote {
    position: relative;
    margin: 3rem 0;
    padding: 2rem 2rem 2rem 3rem;
    border-left: 5px solid #4E8AFF;
    background: linear-gradient(to right, #F5F9FF 0%, rgba(245, 249, 255, 0.3) 100%);
    font-style: italic;
    color: #1F2937;
    border-radius: 0 1rem 1rem 0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.blog-content blockquote::before {
    content: '"';
    position: absolute;
    left: 1rem;
    top: 1rem;
    font-size: 4rem;
    line-height: 1;
    color: rgba(78, 138, 255, 0.15);
    font-family: Georgia, serif;
    font-weight: 700;
}

.blog-content blockquote p {
    margin-bottom: 1rem;
    font-size: 1.125rem;
    position: relative;
    z-index: 1;
}

.blog-content blockquote p:last-child {
    margin-bottom: 0;
}

.blog-content blockquote cite {
    display: block;
    margin-top: 1rem;
    font-size: 0.9rem;
    font-style: normal;
    color: #6B7280;
    font-weight: 500;
}

.blog-content blockquote cite::before {
    content: "— ";
}

/* ==========================================================================
   Code & Pre
   ========================================================================== */

.blog-content code {
    background: #F3F4F6;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.9em;
    color: #7C3AED;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    border: 1px solid #E5E7EB;
    font-weight: 500;
}

.blog-content pre {
    background: #1F2937;
    color: #F9FAFB;
    padding: 1.75rem;
    border-radius: 1rem;
    overflow-x: auto;
    margin: 2.5rem 0;
    line-height: 1.6;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.blog-content pre::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 36px;
    background: #111827;
    border-radius: 1rem 1rem 0 0;
    border-bottom: 1px solid #374151;
}

.blog-content pre::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 16px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #EF4444;
    box-shadow: 20px 0 0 #F59E0B, 40px 0 0 #10B981;
}

.blog-content pre code {
    background: transparent;
    padding: 0;
    border: none;
    color: inherit;
    font-size: 0.9rem;
    display: block;
    margin-top: 36px;
}

/* Inline code inside pre */
.blog-content pre code {
    font-weight: 400;
}

/* ==========================================================================
   Images & Figures
   ========================================================================== */

.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 1rem;
    margin: 3rem auto;
    display: block;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.1), 0 4px 16px rgba(15, 23, 42, 0.06);
}

.blog-content figure {
    margin: 3rem 0;
}

.blog-content figure img {
    margin: 0 auto 1rem;
}

.blog-content figcaption {
    text-align: center;
    font-size: 0.9rem;
    color: #6B7280;
    margin-top: 1rem;
    font-style: italic;
    line-height: 1.5;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2.5rem 0;
    font-size: 0.95rem;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.03);
}

.blog-content thead {
    background: linear-gradient(135deg, #4E8AFF 0%, #7C3AED 100%);
}

.blog-content th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    color: white;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.blog-content td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid #E5E7EB;
    color: #374151;
}

.blog-content tbody tr {
    background: white;
    transition: background-color 0.2s ease;
}

.blog-content tbody tr:hover {
    background: #F9FAFB;
}

.blog-content tbody tr:last-child td {
    border-bottom: none;
}

/* ==========================================================================
   Horizontal Rule
   ========================================================================== */

.blog-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #E5E7EB 50%, transparent 100%);
    margin: 4rem 0;
    position: relative;
}

.blog-content hr::after {
    content: '✦';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    color: #4E8AFF;
    padding: 0 1rem;
    font-size: 1.25rem;
}

/* ==========================================================================
   Video & Iframes
   ========================================================================== */

.blog-content iframe,
.blog-content video {
    max-width: 100%;
    border-radius: 1rem;
    margin: 3rem 0;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.1);
    display: block;
}

/* Responsive video container */
.blog-content .video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 1rem;
    margin: 3rem 0;
}

.blog-content .video-container iframe,
.blog-content .video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
}

/* ==========================================================================
   Special Elements
   ========================================================================== */

.blog-content abbr[title] {
    text-decoration: underline dotted;
    cursor: help;
    color: #4E8AFF;
}

.blog-content kbd {
    background: #F3F4F6;
    border: 1px solid #D1D5DB;
    border-radius: 0.375rem;
    padding: 0.125rem 0.5rem;
    font-family: 'Monaco', monospace;
    font-size: 0.875rem;
    box-shadow: 0 2px 0 #D1D5DB;
}

.blog-content sub,
.blog-content sup {
    font-size: 0.75em;
    line-height: 0;
}

.blog-content del {
    text-decoration: line-through;
    color: #9CA3AF;
}

.blog-content ins {
    text-decoration: underline;
    text-decoration-color: #10B981;
    color: #047857;
    background: #D1FAE5;
    padding: 0 2px;
}

/* ==========================================================================
   Selection Styling
   ========================================================================== */

.blog-content ::selection {
    background: #B3CBFF;
    color: #0A0E27;
}

.blog-content ::-moz-selection {
    background: #B3CBFF;
    color: #0A0E27;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1024px) {
    .blog-content {
        font-size: 1.0625rem; /* 17px */
    }
}

@media (max-width: 768px) {
    .blog-content {
        font-size: 1rem; /* 16px */
    }

    .blog-content h1 {
        font-size: 2rem; /* 32px */
        margin-bottom: 1.25rem;
    }

    .blog-content h2 {
        font-size: 1.75rem; /* 28px */
        margin-top: 2.5rem;
    }

    .blog-content h3 {
        font-size: 1.5rem; /* 24px */
        margin-top: 2rem;
    }

    .blog-content h4 {
        font-size: 1.25rem; /* 20px */
    }

    .blog-content > p:first-of-type {
        font-size: 1.125rem; /* 18px */
        margin-bottom: 2rem;
    }

    .blog-content pre {
        padding: 1.25rem;
        font-size: 0.875rem;
        margin: 2rem 0;
    }

    .blog-content blockquote {
        padding: 1.5rem 1.5rem 1.5rem 2.5rem;
        margin: 2rem 0;
    }

    .blog-content blockquote::before {
        font-size: 3rem;
        left: 0.75rem;
    }

    .blog-content ul,
    .blog-content ol {
        padding-left: 1.5rem;
    }

    .blog-content img {
        margin: 2rem auto;
        border-radius: 0.75rem;
    }

    .blog-content table {
        font-size: 0.875rem;
    }

    .blog-content th,
    .blog-content td {
        padding: 0.75rem;
    }
}

@media (max-width: 640px) {
    .blog-content pre code {
        font-size: 0.8rem;
    }

    .blog-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* ==========================================================================
   Special Content Blocks (Notes, Warnings, Tips, Info)
   ========================================================================== */

.blog-content .note,
.blog-content .warning,
.blog-content .tip,
.blog-content .info {
    position: relative;
    margin: 2.5rem 0;
    padding: 1.75rem 1.75rem 1.75rem 4.5rem;
    border-radius: 1rem;
    border-left: 5px solid;
    font-size: 1rem;
    line-height: 1.7;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.blog-content .note::before,
.blog-content .warning::before,
.blog-content .tip::before,
.blog-content .info::before {
    content: '';
    position: absolute;
    left: 1.25rem;
    top: 1.75rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
}

/* Note Block - Blue */
.blog-content .note {
    background: linear-gradient(to right, #EFF6FF 0%, rgba(239, 246, 255, 0.3) 100%);
    border-left-color: #3B82F6;
    color: #1E40AF;
}

.blog-content .note::before {
    content: 'ℹ';
    background: #3B82F6;
    color: white;
}

.blog-content .note strong {
    color: #1E40AF;
}

/* Warning Block - Orange/Red */
.blog-content .warning {
    background: linear-gradient(to right, #FEF3C7 0%, rgba(254, 243, 199, 0.3) 100%);
    border-left-color: #F59E0B;
    color: #92400E;
}

.blog-content .warning::before {
    content: '⚠';
    background: #F59E0B;
    color: white;
}

.blog-content .warning strong {
    color: #92400E;
}

/* Tip Block - Green */
.blog-content .tip {
    background: linear-gradient(to right, #D1FAE5 0%, rgba(209, 250, 229, 0.3) 100%);
    border-left-color: #10B981;
    color: #065F46;
}

.blog-content .tip::before {
    content: '💡';
    background: #10B981;
    font-size: 1rem;
}

.blog-content .tip strong {
    color: #065F46;
}

/* Info Block - Purple */
.blog-content .info {
    background: linear-gradient(to right, #F3E8FF 0%, rgba(243, 232, 255, 0.3) 100%);
    border-left-color: #7C3AED;
    color: #5B21B6;
}

.blog-content .info::before {
    content: '✦';
    background: #7C3AED;
    color: white;
}

.blog-content .info strong {
    color: #5B21B6;
}

.blog-content .note p,
.blog-content .warning p,
.blog-content .tip p,
.blog-content .info p {
    margin-bottom: 0.75rem;
}

.blog-content .note p:last-child,
.blog-content .warning p:last-child,
.blog-content .tip p:last-child,
.blog-content .info p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .blog-content {
        color: #D1D5DB;
    }

    .blog-content h1,
    .blog-content h2,
    .blog-content h3,
    .blog-content h4,
    .blog-content h5,
    .blog-content h6 {
        color: #F9FAFB;
    }

    .blog-content h2 {
        border-bottom-color: #374151;
    }

    .blog-content > p:first-of-type {
        color: #E5E7EB;
    }

    .blog-content p {
        color: #D1D5DB;
    }

    .blog-content strong,
    .blog-content b {
        color: #F9FAFB;
    }

    .blog-content em,
    .blog-content i {
        color: #D1D5DB;
    }

    .blog-content a {
        color: #60A5FA;
        text-decoration-color: rgba(96, 165, 250, 0.4);
    }

    .blog-content a:hover {
        color: #93C5FD;
        text-decoration-color: rgba(147, 197, 253, 0.8);
    }

    .blog-content code {
        background: #374151;
        color: #C084FC;
        border-color: #4B5563;
    }

    .blog-content pre {
        background: #111827;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    }

    .blog-content pre::before {
        background: #0F172A;
        border-bottom-color: #1F2937;
    }

    .blog-content blockquote {
        background: linear-gradient(to right, rgba(30, 58, 138, 0.2) 0%, rgba(30, 58, 138, 0.05) 100%);
        color: #E5E7EB;
        border-left-color: #60A5FA;
    }

    .blog-content blockquote::before {
        color: rgba(96, 165, 250, 0.15);
    }

    .blog-content blockquote cite {
        color: #9CA3AF;
    }

    .blog-content table {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    .blog-content thead {
        background: linear-gradient(135deg, #1E40AF 0%, #6D28D9 100%);
    }

    .blog-content td {
        border-bottom-color: #374151;
        color: #D1D5DB;
    }

    .blog-content tbody tr {
        background: #1F2937;
    }

    .blog-content tbody tr:hover {
        background: #374151;
    }

    .blog-content hr {
        background: linear-gradient(90deg, transparent 0%, #374151 50%, transparent 100%);
    }

    .blog-content hr::after {
        background: #1F2937;
        color: #60A5FA;
    }

    .blog-content figcaption {
        color: #9CA3AF;
    }

    .blog-content kbd {
        background: #374151;
        border-color: #4B5563;
        box-shadow: 0 2px 0 #4B5563;
    }

    .blog-content mark {
        background: linear-gradient(to right, #78350F, #92400E);
        color: #FCD34D;
    }

    .blog-content small {
        color: #9CA3AF;
    }

    .blog-content del {
        color: #6B7280;
    }

    .blog-content ins {
        background: #064E3B;
        color: #6EE7B7;
        text-decoration-color: #10B981;
    }

    /* Dark mode special blocks */
    .blog-content .note {
        background: linear-gradient(to right, rgba(30, 58, 138, 0.2) 0%, rgba(30, 58, 138, 0.05) 100%);
        color: #93C5FD;
        border-left-color: #60A5FA;
    }

    .blog-content .note::before {
        background: #3B82F6;
    }

    .blog-content .warning {
        background: linear-gradient(to right, rgba(120, 53, 15, 0.2) 0%, rgba(120, 53, 15, 0.05) 100%);
        color: #FCD34D;
        border-left-color: #F59E0B;
    }

    .blog-content .warning::before {
        background: #F59E0B;
    }

    .blog-content .tip {
        background: linear-gradient(to right, rgba(6, 78, 59, 0.2) 0%, rgba(6, 78, 59, 0.05) 100%);
        color: #6EE7B7;
        border-left-color: #10B981;
    }

    .blog-content .tip::before {
        background: #10B981;
    }

    .blog-content .info {
        background: linear-gradient(to right, rgba(88, 28, 135, 0.2) 0%, rgba(88, 28, 135, 0.05) 100%);
        color: #D8B4FE;
        border-left-color: #A855F7;
    }

    .blog-content .info::before {
        background: #7C3AED;
    }

    .blog-content ::selection {
        background: #1E40AF;
        color: #F9FAFB;
    }

    .blog-content ::-moz-selection {
        background: #1E40AF;
        color: #F9FAFB;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .blog-content {
        font-size: 12pt;
        line-height: 1.6;
        color: #000;
    }

    .blog-content a {
        color: #000;
        text-decoration: underline;
    }

    .blog-content a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }

    .blog-content pre,
    .blog-content blockquote {
        page-break-inside: avoid;
        border: 1pt solid #ccc;
    }

    .blog-content img {
        max-width: 100%;
        page-break-inside: avoid;
    }

    .toc-container,
    .reading-time {
        display: none;
    }
}
