/* ================================
   FORMULACOMPARE - PREMIUM ARTICLE STYLES
   Substack-Quality Reading Experience
   ================================ */

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 18px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.7;
    color: #1a1a1a;
    background: #ffffff;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === PREMIUM NAVIGATION === */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    z-index: 1000;
    padding: 16px 32px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #0f172a;
    font-weight: 800;
    font-size: 1.125rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo:hover {
    transform: scale(1.02);
}

.nav-links {
    display: flex;
    gap: 8px;
    list-style: none;
    align-items: center;
}

.nav-links li a {
    padding: 10px 18px;
    border-radius: 12px;
    text-decoration: none;
    color: #64748b;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links li a:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(236, 72, 153, 0.1) 100%);
    color: #dc2626;
    transform: translateY(-1px);
}

/* === READING PROGRESS BAR === */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #ef4444 0%, #ec4899 50%, #8b5cf6 100%);
    z-index: 9999;
    transition: width 0.1s ease-out;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

/* === ARTICLE CONTAINER === */
.article {
    margin-top: 80px;
    min-height: 100vh;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 60px 24px 100px;
}

/* === ARTICLE HEADER === */
.article-header {
    margin-bottom: 56px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.article-header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    color: #0f172a;
    line-height: 1.15;
    letter-spacing: -0.04em;
    margin-bottom: 24px;
}

.subtitle {
    font-size: 1.375rem;
    color: #64748b;
    line-height: 1.6;
    font-weight: 500;
    margin-bottom: 32px;
}

/* Article Meta */
Meta, .article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: 0.9375rem;
    color: #64748b;
    font-weight: 600;
}

Meta span, .article-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.5) 0%, rgba(237, 233, 254, 0.5) 100%);
    border-radius: 16px;
    border: 1.5px solid rgba(148, 163, 184, 0.1);
}

.author-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444 0%, #ec4899 50%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}

.author-details {
    flex: 1;
}

.author-name {
    font-size: 1.0625rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
}

.author-role {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 600;
}

/* === ARTICLE CONTENT === */
Content, .article-content {
    display: block;
}

.article p, Content p {
    font-size: 1.125rem;
    line-height: 1.8;
    color: #1e293b;
    margin-bottom: 1.75rem;
    font-weight: 400;
}

.article p:first-of-type, Content p:first-of-type {
    font-size: 1.25rem;
    color: #0f172a;
    line-height: 1.75;
    font-weight: 500;
}

/* Headers */
.article h2, Content h2, .section-title {
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
    letter-spacing: -0.03em;
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
    scroll-margin-top: 100px;
}

.article h3, Content h3, .subsection-title {
    font-size: clamp(1.375rem, 2.5vw, 1.625rem);
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
    letter-spacing: -0.02em;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    scroll-margin-top: 100px;
}

.article h4, Content h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #334155;
    line-height: 1.4;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* Lists */
.article ul, Content ul,
.article ol, Content ol {
    margin-bottom: 1.75rem;
    padding-left: 1.5rem;
}

.article li, Content li {
    font-size: 1.0625rem;
    line-height: 1.75;
    color: #1e293b;
    margin-bottom: 0.75rem;
    font-weight: 400;
}

.article li strong, Content li strong {
    color: #0f172a;
    font-weight: 700;
}

/* === PREMIUM HIGHLIGHT BOXES === */
.highlight-box, [class*="highlight"] {
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.6) 0%, rgba(237, 233, 254, 0.6) 100%);
    border-left: 4px solid #ef4444;
    border-radius: 12px;
    padding: 28px;
    margin: 2.5rem 0;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.1);
}

.highlight-box p, [class*="highlight"] p {
    margin-bottom: 1rem;
}

.highlight-box p:last-child, [class*="highlight"] p:last-child {
    margin-bottom: 0;
}

.highlight-box strong {
    color: #dc2626;
    font-weight: 800;
}

/* Info Card */
InfoCard, .info-card {
    background: linear-gradient(135deg, rgba(219, 234, 254, 0.6) 0%, rgba(237, 233, 254, 0.6) 100%);
    border-left: 4px solid #3b82f6;
    border-radius: 12px;
    padding: 28px;
    margin: 2.5rem 0;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.1);
}

InfoCard strong, .info-card strong {
    color: #2563eb;
    font-weight: 800;
}

/* Warning Box */
.warning-box {
    background: linear-gradient(135deg, rgba(254, 243, 199, 0.6) 0%, rgba(254, 249, 195, 0.6) 100%);
    border-left: 4px solid #f59e0b;
    border-radius: 12px;
    padding: 28px;
    margin: 2.5rem 0;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.1);
}

.warning-box strong {
    color: #d97706;
    font-weight: 800;
}

/* === TABLES === */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2.5rem 0;
    font-size: 0.9375rem;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

thead {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
}

th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    color: #334155;
    line-height: 1.6;
}

tbody tr {
    background: white;
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: rgba(254, 242, 242, 0.3);
}

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

/* === SECTION DIVIDERS === */
section {
    margin: 4rem 0;
}

section:first-of-type {
    margin-top: 0;
}

/* === BLOCKQUOTES === */
blockquote {
    border-left: 4px solid #e5e7eb;
    padding-left: 24px;
    margin: 2.5rem 0;
    font-style: italic;
    color: #475569;
    font-size: 1.1875rem;
    line-height: 1.7;
}

blockquote p {
    margin-bottom: 1rem;
}

/* === CODE BLOCKS === */
code {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    font-size: 0.9em;
    font-weight: 600;
}

pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 24px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 2.5rem 0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.3);
}

pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: 0.9375rem;
}

/* === IMAGES === */
.article img, Content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2.5rem 0;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.1);
}

/* === TABLE OF CONTENTS === */
.table-of-contents {
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.4) 0%, rgba(237, 233, 254, 0.4) 100%);
    border-radius: 16px;
    padding: 32px;
    margin: 3rem 0;
    border: 1.5px solid rgba(148, 163, 184, 0.1);
}

.table-of-contents h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 20px;
    margin-top: 0;
}

.table-of-contents ul {
    list-style: none;
    padding-left: 0;
}

.table-of-contents li {
    margin-bottom: 12px;
}

.table-of-contents a {
    color: #475569;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
}

.table-of-contents a:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    transform: translateX(4px);
}

/* === RELATED ARTICLES === */
.related-articles {
    margin-top: 5rem;
    padding-top: 3rem;
    border-top: 2px solid rgba(148, 163, 184, 0.15);
}

.related-articles h3 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 2rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.related-card {
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    border: 1.5px solid rgba(148, 163, 184, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.related-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    border-color: rgba(239, 68, 68, 0.2);
}

.related-card a {
    color: #0f172a;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.0625rem;
    line-height: 1.5;
}

.related-card:hover a {
    color: #ef4444;
}

/* === SHARE BUTTONS === */
.share-section {
    margin: 4rem 0;
    padding: 32px;
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.4) 0%, rgba(237, 233, 254, 0.4) 100%);
    border-radius: 16px;
    text-align: center;
}

.share-section h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 20px;
    margin-top: 0;
}

.share-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9375rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.5px solid rgba(148, 163, 184, 0.2);
    background: white;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.15);
}

.share-btn.twitter {
    color: #1da1f2;
    border-color: #1da1f2;
}

.share-btn.facebook {
    color: #4267B2;
    border-color: #4267B2;
}

.share-btn.linkedin {
    color: #0077b5;
    border-color: #0077b5;
}

/* === FOOTER === */
.footer {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #ffffff;
    padding: 80px 24px 40px;
    margin-top: 100px;
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 120px;
    background: #ffffff;
    clip-path: polygon(0 0, 100% 0, 100% 50%, 0 100%);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 48px;
    margin-bottom: 48px;
    position: relative;
    z-index: 1;
}

.footer-section h3 {
    font-size: 1.1875rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.7;
    font-size: 1rem;
}

.footer-section a {
    display: block;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 8px 0;
    font-weight: 500;
    transition: all 0.2s ease;
}

.footer-section a:hover {
    color: #ffffff;
    transform: translateX(4px);
}

.footer-bottom {
    text-align: center;
    padding-top: 32px;
    border-top: 1.5px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    position: relative;
    z-index: 1;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    html {
        font-size: 17px;
    }
    
    .navbar {
        padding: 16px 20px;
    }
    
    .container {
        padding: 40px 20px 80px;
    }
    
    .article-header {
        margin-bottom: 40px;
        padding-bottom: 32px;
    }
    
    .article-header h1 {
        font-size: 2rem;
        margin-bottom: 20px;
    }
    
    .subtitle {
        font-size: 1.1875rem;
        margin-bottom: 24px;
    }
    
    .author-info {
        padding: 16px;
    }
    
    .author-avatar {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
    
    .article p, Content p {
        font-size: 1.0625rem;
    }
    
    .article p:first-of-type, Content p:first-of-type {
        font-size: 1.125rem;
    }
    
    .article h2, Content h2, .section-title {
        font-size: 1.625rem;
        margin-top: 2.5rem;
    }
    
    .article h3, Content h3, .subsection-title {
        font-size: 1.375rem;
        margin-top: 2rem;
    }
    
    .highlight-box, [class*="highlight"],
    InfoCard, .info-card,
    .warning-box {
        padding: 20px;
        margin: 2rem 0;
    }
    
    .table-of-contents {
        padding: 24px;
    }
    
    .nav-links {
        gap: 4px;
    }
    
    .nav-links li a {
        padding: 8px 12px;
        font-size: 0.875rem;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 12px 16px;
    }
    
    .share-btn {
        padding: 10px 20px;
        font-size: 0.875rem;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 16px;
    }
    
    .container {
        padding: 32px 16px 60px;
    }
    
    .article-header h1 {
        font-size: 1.75rem;
    }
    
    .nav-links li a span:first-child {
        display: none;
    }
}

/* === PRINT STYLES === */
@media print {
    .navbar,
    .share-section,
    .related-articles,
    .reading-progress {
        display: none;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .article {
        margin-top: 0;
    }
}

/* === ACCESSIBILITY === */
*:focus-visible {
    outline: 2px solid #ef4444;
    outline-offset: 3px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === CUSTOM SCROLLBAR === */
::-webkit-scrollbar {
    width: 14px;
}

::-webkit-scrollbar-track {
    background: #f8fafc;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #ef4444 0%, #ec4899 50%, #8b5cf6 100%);
    border-radius: 8px;
    border: 3px solid #f8fafc;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #dc2626 0%, #db2777 50%, #7c3aed 100%);
}

/* === SELECTION === */
::selection {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(236, 72, 153, 0.2) 100%);
    color: #0f172a;
}

