/* ==========================================================================
   DenverNerd Engine — Articles, Reader Layout, ToC & Typography
   File: articles.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   Dynamic Responsive Card Grid Scaling (Ultra-wide to Mobile)
   -------------------------------------------------------------------------- */
.article-grid,
.grid-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 3.5rem;
}

/* Tablet / Laptop: 2 Columns */
@media (min-width: 640px) {
    .article-grid,
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop 1080p: 3 Columns with balanced aspect-ratio cards */
@media (min-width: 1024px) {
    .article-grid,
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Ultra-wide / 1440p+: 4 Responsive Columns */
@media (min-width: 1440px) {
    .article-grid,
    .grid-3 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* --------------------------------------------------------------------------
   Article Card Elements
   -------------------------------------------------------------------------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.6rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.22s ease, 
                box-shadow 0.22s ease,
                background-color 0.22s ease;
    box-shadow: var(--card-shadow, 0 4px 15px rgba(0, 0, 0, 0.25));
    position: relative;
    overflow: hidden;
}
.card:hover {
    transform: translateY(-4px);
    border-color: rgba(6, 182, 212, 0.6);
    background: var(--bg-card-hover);
    box-shadow: 0 14px 30px -10px rgba(6, 182, 212, 0.25), 0 0 20px rgba(6, 182, 212, 0.1);
}
.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.category-badge {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 0.22rem 0.6rem;
    border-radius: 6px;
    font-family: var(--font-mono);
}
.reading-time-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    padding: 0.18rem 0.55rem;
    border-radius: 6px;
}
.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.35;
}
.card-title a {
    color: var(--text);
    text-decoration: none;
}
.card-title a:hover {
    color: var(--accent-cyan);
}
.card-summary {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    flex: 1;
    line-height: 1.55;
}
.card-tags {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 0.75rem;
}
.tag-pill {
    font-family: var(--font-mono);
    font-size: 0.73rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    padding: 0.18rem 0.5rem;
    border-radius: 6px;
    transition: all 0.15s ease;
}
.tag-pill:hover {
    color: var(--accent-cyan);
    border-color: rgba(6, 182, 212, 0.4);
    background: rgba(6, 182, 212, 0.08);
}
.featured-image {
    width: 100%;
    height: auto;
    max-height: 480px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    display: block;
}

/* --------------------------------------------------------------------------
   Article Reading Surface (/blog/{slug})
   Fluid margins & comfortable 75-85ch typography measure
   -------------------------------------------------------------------------- */
.article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 3.5rem;
    align-items: start;
    justify-content: center;
}
@media (max-width: 1024px) {
    .article-layout {
        grid-template-columns: 1fr;
    }
    .article-toc-rail {
        display: none;
    }
}
.article-prose {
    max-width: min(100%, 82ch);
    width: 100%;
    margin: 0 auto;
}
.article-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.article-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.025em;
}
.article-meta-row {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.article-body {
    max-width: 80ch;
    font-size: 1.1rem;
    color: #e2e8f0;
    line-height: 1.8;
}
.article-body h2 {
    font-size: 1.75rem;
    margin: 2.5rem 0 1rem;
    letter-spacing: -0.02em;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4rem;
    scroll-margin-top: 5rem;
}
.article-body h3 {
    font-size: 1.35rem;
    margin: 2rem 0 0.75rem;
    color: #f1f5f9;
    scroll-margin-top: 5rem;
}
.article-body p {
    margin-bottom: 1.5rem;
}
.article-body ul, .article-body ol {
    margin-bottom: 1.5rem;
    padding-left: 1.75rem;
}
.article-body li {
    margin-bottom: 0.5rem;
}
.article-body img {
    cursor: zoom-in;
    transition: transform 0.2s ease, filter 0.2s ease;
    border-radius: 8px;
    max-width: 100%;
    height: auto;
}
.article-body img:hover {
    filter: brightness(1.05);
}

/* --------------------------------------------------------------------------
   Dynamic Sticky Table of Contents Rail
   -------------------------------------------------------------------------- */
.article-toc-rail {
    position: sticky;
    top: 5.5rem;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
    background: rgba(17, 24, 39, 0.6);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-muted);
}
.toc-title {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    text-transform: uppercase;
    font-family: var(--font-mono);
}
.toc-progress-text {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    font-weight: 700;
}
.reading-progress-track {
    width: 100%;
    height: 3px;
    background: var(--bg-surface);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 1rem;
}
.reading-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
    transition: width 0.1s linear;
}
.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.toc-item.level-3 {
    padding-left: 0.85rem;
}
.toc-link {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
    display: block;
    line-height: 1.4;
    transition: all 0.15s ease;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
}
.toc-link:hover {
    color: var(--text);
    border-color: rgba(6, 182, 212, 0.4);
}
.toc-link.active {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Syntax Highlighting & Code UX
   -------------------------------------------------------------------------- */
.code-block-wrapper {
    position: relative;
    margin: 1.75rem 0;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #060911;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.code-header,
.code-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 1rem;
    background: #0f1626;
    border-bottom: 1px solid var(--border);
}
.code-header-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.code-mac-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}
.mac-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
    transition: opacity 0.2s ease;
}
.mac-dot-red {
    background-color: #EF4444;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}
.mac-dot-yellow {
    background-color: #F59E0B;
    box-shadow: 0 0 4px rgba(245, 158, 11, 0.4);
}
.mac-dot-green {
    background-color: #10B981;
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.4);
}
.code-lang-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.code-lang-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--accent-cyan);
    display: inline-block;
}
.btn-copy-code,
.copy-code-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 4px;
    padding: 0.22rem 0.6rem;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-copy-code:hover,
.copy-code-btn:hover {
    color: var(--text);
    background: rgba(6, 182, 212, 0.15);
    border-color: var(--accent-cyan);
}
.btn-copy-code.copied,
.copy-code-btn.copied {
    color: var(--accent-emerald);
    border-color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.15);
}
.code-block-wrapper pre {
    margin: 0;
    border: none;
    border-radius: 0;
}
pre {
    padding: 1.25rem 1.25rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.92rem;
    line-height: 1.6;
    color: #e2e8f0;
    background: #060911;
}
code {
    font-family: var(--font-mono);
    font-size: 0.88em;
}
p code, li code {
    background: rgba(255, 255, 255, 0.07);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    color: var(--accent-cyan);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* --------------------------------------------------------------------------
   Callout Alerts & Markdown Elements
   -------------------------------------------------------------------------- */
blockquote {
    border-left: 3px solid var(--accent-cyan);
    padding: 1rem 1.25rem;
    margin: 1.75rem 0;
    background: rgba(6, 182, 212, 0.06);
    border-radius: 0 8px 8px 0;
    color: #cbd5e1;
    font-style: italic;
}
.callout-note {
    border-left: 3px solid var(--accent-cyan);
    background: rgba(6, 182, 212, 0.07);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}
.callout-tip {
    border-left: 3px solid var(--accent-emerald);
    background: rgba(16, 185, 129, 0.07);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}
.callout-warning {
    border-left: 3px solid var(--accent-amber);
    background: rgba(245, 158, 11, 0.07);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}

/* --------------------------------------------------------------------------
   Community Discussion Thread
   -------------------------------------------------------------------------- */
.comments-section {
    margin-top: 3.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}
.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.comments-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.comment-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.35rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
.comment-card:hover {
    border-color: rgba(6, 182, 212, 0.4);
}
.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.comment-author-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.comment-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    color: #070a11;
    font-weight: 800;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px rgba(6, 182, 212, 0.35);
    flex-shrink: 0;
}
.comment-author-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}
.comment-time {
    font-size: 0.78rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}
.comment-content {
    font-size: 0.95rem;
    color: #cbd5e1;
    line-height: 1.65;
}
.comment-content p { margin-bottom: 0.65rem; }
.comment-content p:last-child { margin-bottom: 0; }
.comment-pending-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   Newsletter Subscription Card
   -------------------------------------------------------------------------- */
.newsletter-card {
    background: linear-gradient(135deg, rgba(20, 28, 46, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-radius: 16px;
    padding: 2rem 2.25rem;
    margin: 2.5rem 0;
    box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(6, 182, 212, 0.1);
    position: relative;
    overflow: hidden;
}
.newsletter-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald), var(--accent-purple));
}
.newsletter-header {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
.newsletter-icon-badge {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.newsletter-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    margin-bottom: 0.25rem;
}
.newsletter-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}
.newsletter-form {
    margin-top: 1rem;
}
.newsletter-input-wrap {
    display: flex;
    gap: 0.75rem;
    max-width: 580px;
    flex-wrap: wrap;
}
.newsletter-input {
    flex: 1;
    min-width: 240px;
    background: #080c14;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 1.25rem;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.newsletter-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}
.newsletter-submit-btn {
    background: var(--accent-cyan);
    color: #080c14;
    border: none;
    border-radius: 8px;
    padding: 0.85rem 1.65rem;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.newsletter-submit-btn:hover {
    background: var(--accent-cyan-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}
.newsletter-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}
.newsletter-feedback {
    margin-top: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
}
.feedback-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--accent-emerald);
}
.feedback-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-rose);
}
.newsletter-footer-meta {
    margin-top: 0.85rem;
    font-size: 0.78rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* --------------------------------------------------------------------------
   Related Content Engine Grid
   -------------------------------------------------------------------------- */
.related-articles-section {
    margin-top: 3.5rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border);
}
.related-header {
    margin-bottom: 1.5rem;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
.related-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
}
.related-card:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   Legal & Compliance Document Surfaces
   -------------------------------------------------------------------------- */
.legal-container {
    max-width: 860px;
    margin: 3rem auto 5rem;
    padding: 0 1.5rem;
}
.legal-body {
    color: #cbd5e1;
    font-size: 1.05rem;
    line-height: 1.75;
}
.legal-body h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 0.75rem;
}
.legal-body h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.legal-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #e2e8f0;
    margin: 1.75rem 0 0.75rem;
}
.legal-body p {
    margin-bottom: 1.25rem;
}
.legal-body ul, .legal-body ol {
    margin: 1rem 0 1.5rem 1.5rem;
}
.legal-body li {
    margin-bottom: 0.5rem;
}
.legal-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}
.legal-body code {
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.07);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--accent-cyan);
}
.legal-body strong {
    color: var(--text);
}
