/**
 * TopDune Blog — Frontend Styles
 */

:root {
    --blog-primary: #A9CF38;
    --blog-primary-dark: #8AB62E;
    --blog-ink: #111827;
    --blog-muted: #6b7280;
    --blog-border: #e5e7eb;
    --blog-bg: #fafafa;
    --blog-card-radius: 16px;
    --blog-max: 1200px;
    --blog-article-max: 760px;
}

.blog-page {
    background: #fff;
    color: var(--blog-ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.7;
}

.container-custom {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Hero */
.blog-hero {
    position: relative;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 50%, #0d1208 100%);
    color: #fff;
    padding: 5rem 0 4.5rem;
    overflow: hidden;
}

.blog-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 100%, rgba(169, 207, 56, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse 60% 50% at 90% 20%, rgba(169, 207, 56, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.blog-hero-inner {
    position: relative;
    z-index: 1;
    max-width: var(--blog-max);
    margin: 0 auto;
    padding: 0 2rem;
}

.blog-hero-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--blog-primary);
    margin-bottom: 1rem;
}

.blog-hero-label::before {
    content: '';
    width: 24px;
    height: 2px;
    background: var(--blog-primary);
}

.blog-hero h1 {
    font-size: clamp(2.25rem, 5vw, 3.25rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    max-width: 720px;
}

.blog-hero p {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.72);
    max-width: 560px;
    line-height: 1.65;
}

/* Layout */
.blog-layout {
    max-width: var(--blog-max);
    margin: 0 auto;
    padding: 3.5rem 2rem 5rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .blog-layout {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
}

/* Post grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

@media (max-width: 768px) {
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }
}

.blog-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--blog-card-radius);
    border: 1px solid var(--blog-border);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    border-color: rgba(169, 207, 56, 0.35);
}

.blog-card-image {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--blog-bg);
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.04);
}

.blog-card-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    color: #9ca3af;
    font-size: 2.5rem;
}

.blog-card-body {
    padding: 1.5rem 1.5rem 1.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    font-size: 0.8125rem;
    color: var(--blog-muted);
    margin-bottom: 0.75rem;
}

.blog-card-category {
    color: var(--blog-primary-dark);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.6875rem;
}

.blog-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.625rem;
    letter-spacing: -0.01em;
    color: var(--blog-ink);
}

.blog-card-excerpt {
    font-size: 0.9375rem;
    color: var(--blog-muted);
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-footer {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--blog-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.blog-read-more {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--blog-ink);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.blog-read-more svg {
    transition: transform 0.2s;
}

.blog-card:hover .blog-read-more svg {
    transform: translateX(4px);
}

/* Sidebar */
.blog-sidebar {
    position: sticky;
    top: 120px;
}

.blog-sidebar-widget {
    background: #fff;
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-card-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.blog-sidebar-widget h3 {
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--blog-ink);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--blog-primary);
}

.blog-sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.blog-sidebar-list li {
    margin-bottom: 0.5rem;
}

.blog-sidebar-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    color: var(--blog-muted);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: color 0.15s;
}

.blog-sidebar-list a:hover {
    color: var(--blog-primary-dark);
}

.blog-sidebar-list .count {
    font-size: 0.75rem;
    background: var(--blog-bg);
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--blog-muted);
}

.blog-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.blog-tag {
    display: inline-block;
    padding: 6px 14px;
    background: var(--blog-bg);
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--blog-muted);
    text-decoration: none;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.blog-tag:hover,
.blog-tag.active {
    background: rgba(169, 207, 56, 0.12);
    color: var(--blog-primary-dark);
    border-color: rgba(169, 207, 56, 0.3);
}

/* Filter bar */
.blog-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--blog-border);
}

.blog-filter-bar h2 {
    font-size: 1.125rem;
    font-weight: 700;
    flex: 1;
}

.blog-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--blog-muted);
}

.blog-empty h3 {
    font-size: 1.25rem;
    color: var(--blog-ink);
    margin-bottom: 0.5rem;
}

/* Pagination */
.blog-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 3rem;
}

.blog-pagination a,
.blog-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--blog-border);
    color: var(--blog-ink);
    transition: all 0.15s;
}

.blog-pagination a:hover {
    border-color: var(--blog-primary);
    background: rgba(169, 207, 56, 0.08);
}

.blog-pagination .active {
    background: var(--blog-primary);
    border-color: var(--blog-primary);
    color: #000;
}

/* Single article */
.blog-article-hero {
    position: relative;
    min-height: 420px;
    display: flex;
    align-items: flex-end;
    background: #111;
    overflow: hidden;
}

.blog-article-hero.has-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0.2) 100%);
    z-index: 1;
}

.blog-article-hero img.hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-article-hero-content {
    position: relative;
    z-index: 2;
    max-width: var(--blog-article-max);
    margin: 0 auto;
    padding: 4rem 2rem 3rem;
    width: 100%;
    color: #fff;
}

.blog-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    margin-bottom: 1.25rem;
    color: rgba(255,255,255,0.65);
}

.blog-breadcrumb a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
}

.blog-breadcrumb a:hover {
    color: var(--blog-primary);
}

.blog-article-hero h1 {
    font-size: clamp(1.875rem, 4.5vw, 2.75rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 1.25rem;
}

.blog-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    font-size: 0.875rem;
    color: rgba(255,255,255,0.75);
}

.blog-article-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.blog-article-wrap {
    max-width: var(--blog-article-max);
    margin: 0 auto;
    padding: 3rem 2rem 4rem;
}

.blog-article-content-card {
    background: #fff;
    border: 1px solid var(--blog-border);
    border-radius: 20px;
    padding: clamp(1.5rem, 4vw, 2.75rem);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Article typography — overrides Tailwind resets */
.blog-page .blog-article-prose {
    font-size: 1.0625rem;
    line-height: 1.85;
    color: #374151;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
}

.blog-page .blog-article-prose p:empty,
.blog-page .blog-article-prose div:empty:not(.blog-table-wrap) {
    display: none;
    margin: 0;
    padding: 0;
}

.blog-page .blog-article-prose br + br {
    display: none;
}

.blog-page .blog-article-prose > *:first-child {
    margin-top: 0 !important;
}

.blog-page .blog-article-prose > *:last-child {
    margin-bottom: 0 !important;
}

.blog-page .blog-article-prose h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--blog-ink);
    margin: 0 0 1.25rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.blog-page .blog-article-prose h2 {
    font-size: 1.625rem;
    font-weight: 800;
    color: var(--blog-ink);
    margin: 2.5rem 0 1rem;
    letter-spacing: -0.01em;
    line-height: 1.3;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(169, 207, 56, 0.35);
}

.blog-page .blog-article-prose h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--blog-ink);
    margin: 2rem 0 0.75rem;
    line-height: 1.35;
}

.blog-page .blog-article-prose h4,
.blog-page .blog-article-prose h5,
.blog-page .blog-article-prose h6 {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--blog-ink);
    margin: 1.5rem 0 0.5rem;
}

.blog-page .blog-article-prose p {
    margin-bottom: 1.25rem;
}

.blog-page .blog-article-prose strong,
.blog-page .blog-article-prose b {
    font-weight: 700;
    color: var(--blog-ink);
}

.blog-page .blog-article-prose a {
    color: var(--blog-primary-dark);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: normal;
    word-break: normal;
}

.blog-page .blog-article-prose a:hover {
    color: var(--blog-ink);
}

.blog-page .blog-article-prose img {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    border-radius: 12px;
    margin: 2rem auto;
    display: block;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.blog-page .blog-article-prose ul,
.blog-page .blog-article-prose ol {
    margin: 1rem 0 1.5rem;
    padding-left: 1.5rem;
}

.blog-page .blog-article-prose ul {
    list-style-type: disc;
}

.blog-page .blog-article-prose ol {
    list-style-type: decimal;
}

.blog-page .blog-article-prose li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.blog-page .blog-article-prose li::marker {
    color: var(--blog-primary-dark);
}

.blog-page .blog-article-prose blockquote {
    border-left: 4px solid var(--blog-primary);
    padding: 1rem 1.25rem 1rem 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--blog-muted);
    background: var(--blog-bg);
    border-radius: 0 12px 12px 0;
}

.blog-page .blog-article-prose hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--blog-border), transparent);
    margin: 2.5rem 0;
}

.blog-page .blog-article-prose pre {
    background: #1f2937;
    color: #f3f4f6;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.blog-page .blog-article-prose code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    background: var(--blog-bg);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    color: #1f2937;
}

.blog-page .blog-article-prose pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

/* Tables — must stay display:table (NOT block) */
.blog-page .blog-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 2rem 0;
    border-radius: 12px;
    border: 1px solid var(--blog-border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    background: #fff;
}

.blog-page .blog-article-prose table,
.blog-page .blog-article-prose .blog-content-table {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    margin: 0 !important;
    font-size: 0.9375rem;
    table-layout: auto;
}

.blog-page .blog-article-prose thead {
    display: table-header-group !important;
}

.blog-page .blog-article-prose tbody {
    display: table-row-group !important;
}

.blog-page .blog-article-prose tfoot {
    display: table-footer-group !important;
}

.blog-page .blog-article-prose tr {
    display: table-row !important;
}

.blog-page .blog-article-prose th,
.blog-page .blog-article-prose td {
    display: table-cell !important;
    border: 1px solid var(--blog-border) !important;
    padding: 0.75rem 1rem !important;
    text-align: left;
    vertical-align: top;
    min-width: 80px;
    background: #fff;
    color: #374151;
}

.blog-page .blog-article-prose th {
    background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%) !important;
    font-weight: 700;
    color: var(--blog-ink);
}

.blog-page .blog-article-prose tbody tr:nth-child(even) td {
    background: #fafafa !important;
}

.blog-page .blog-article-prose tbody tr:hover td {
    background: rgba(169, 207, 56, 0.06) !important;
}

@media (max-width: 640px) {
    .blog-article-content-card {
        padding: 1.25rem;
        border-radius: 14px;
    }

    .blog-page .blog-article-prose table,
    .blog-page .blog-article-prose .blog-content-table {
        font-size: 0.8125rem;
    }

    .blog-page .blog-article-prose th,
    .blog-page .blog-article-prose td {
        padding: 0.5rem 0.625rem !important;
        min-width: 64px;
    }
}

/* Author bio */
.blog-author-bio {
    margin-top: 2.5rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--blog-border);
}

.blog-author-bio-inner {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    padding: 1.75rem;
    background: linear-gradient(135deg, #fafafa 0%, #fff 100%);
    border: 1px solid var(--blog-border);
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.blog-author-bio-avatar {
    flex-shrink: 0;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(169, 207, 56, 0.45);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.blog-author-bio-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-author-bio-avatar--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blog-bg);
    color: var(--blog-muted);
    font-size: 2rem;
}

.blog-author-bio-content {
    flex: 1;
    min-width: 0;
}

.blog-author-bio-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--blog-primary-dark);
    margin-bottom: 0.35rem;
}

.blog-author-bio-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--blog-ink);
    margin: 0 0 0.25rem;
    letter-spacing: -0.01em;
}

.blog-author-bio-role {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--blog-muted);
    margin: 0 0 0.75rem;
}

.blog-author-bio-text {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: #4b5563;
    margin: 0;
}

@media (max-width: 640px) {
    .blog-author-bio-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1.5rem;
    }
}

.blog-article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--blog-border);
}

/* Related posts */
.blog-related {
    background: var(--blog-bg);
    padding: 4rem 2rem;
}

.blog-related-inner {
    max-width: var(--blog-max);
    margin: 0 auto;
}

.blog-related h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    text-align: center;
}

.blog-related .blog-grid {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
    .blog-related .blog-grid {
        grid-template-columns: 1fr;
    }
}

.blog-cta {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, #0f0f0f, #1a2a0a);
    color: #fff;
}

.blog-cta h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.blog-cta p {
    color: rgba(255,255,255,0.7);
    margin-bottom: 1.5rem;
}

.blog-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--blog-primary);
    color: #000;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s, transform 0.2s;
}

.blog-cta-btn:hover {
    background: var(--blog-primary-dark);
    transform: translateY(-2px);
}

@media (max-width: 640px) {
    .blog-hero {
        padding: 3.5rem 0 3rem;
    }

    .blog-layout {
        padding: 2rem 1.25rem 3rem;
    }

    .blog-article-wrap {
        padding: 2rem 1.25rem 3rem;
    }

    .blog-sidebar {
        position: static;
    }
}
