/* ==========================================================================
   blog.css - Blog-specific styles for ascend-digital.net
   Extends shared.css variables.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Blog layout
   -------------------------------------------------------------------------- */

.blog-index,
.blog-article {
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

/* --------------------------------------------------------------------------
   Page head (index + category pages)
   -------------------------------------------------------------------------- */

.page-head {
    margin-bottom: 2.25rem;
}

.page-head h1 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.page-head .sub {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0 0 0.5rem;
    line-height: 1.6;
}

.page-head .lang-note {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0;
}

.page-head .lang-note a {
    color: var(--accent);
    text-decoration: none;
}

.page-head .lang-note a:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Category overview grid
   -------------------------------------------------------------------------- */

.cat-overview {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

.cat-overview-item {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 1.25rem 1.375rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cat-overview-item:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.08);
}

[data-theme="dark"] .cat-overview-item:hover {
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.12);
}

.cat-overview-item .cat-label {
    font-size: 0.9rem;
    pointer-events: none;
}

.cat-overview-item .cat-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.cat-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: 0.5rem;
}

/* --------------------------------------------------------------------------
   Tag cloud
   -------------------------------------------------------------------------- */

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-top: 0.5rem;
}

.tag-item {
    display: inline-block;
    padding: 0.25em 0.75em;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    line-height: 1.5;
    transition: border-color 0.15s, color 0.15s;
}

/* --------------------------------------------------------------------------
   Article card list
   -------------------------------------------------------------------------- */

.card-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.article-card {
    position: relative;
    display: block;
    padding: 1.375rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.article-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.08);
}

[data-theme="dark"] .article-card:hover {
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.12);
}

.article-card .meta {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.625rem;
}

.cat-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--accent);
    text-decoration: none;
}

.cat-label:hover {
    text-decoration: underline;
}

.cat-more {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: 0;
}

.article-card .dot {
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1;
}

.article-card .date {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.article-card h2 {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.article-card p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 0.875rem;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
}

.read-more::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.article-card .cat-label {
    position: relative;
    z-index: 2;
}

.read-more svg {
    width: 15px;
    height: 15px;
    transition: transform 0.15s;
}

.article-card:hover .read-more svg {
    transform: translateX(3px);
}

.blog-empty {
    color: var(--text-muted);
    font-size: 0.9375rem;
    padding: 2rem 0;
}

.article-card.has-thumb {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.25rem;
}

.article-card.has-thumb:nth-child(even) {
    flex-direction: row-reverse;
}

.card-thumb {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.card-body {
    flex: 1;
    min-width: 0;
}

/* --------------------------------------------------------------------------
   Article page - header
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   Article banner - pseudo-hero between header and prose
   -------------------------------------------------------------------------- */

.article-banner {
    margin-bottom: 2rem;
}

.article-banner img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Article page - header
   -------------------------------------------------------------------------- */

.article-header {
    margin-bottom: 2.25rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.article-header .cat-label {
    display: inline-block;
    margin-bottom: 0.75rem;
}

.article-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 0.875rem;
    color: var(--text-primary);
}

@media (min-width: 640px) {
    .article-header h1 {
        font-size: 2.25rem;
    }
}

.article-subtitle {
    font-size: 1.0625rem;
    font-weight: 400;
    font-style: italic;
    color: var(--text-secondary);
    margin: -0.5rem 0 0.875rem;
    line-height: 1.5;
}


.meta-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.875rem;
}

.meta-row .dot {
    font-size: 0.625rem;
    opacity: 0.6;
}

.readtime {
    color: var(--text-muted);
}

.lang-switch-inline {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.lang-switch-inline a {
    color: var(--accent);
    text-decoration: none;
}

/* Dev preview date control - only visible on dev with htauth */
.blog-preview-ctrl {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
}

.blog-preview-ctrl input[type="date"] {
    font-size: 0.75rem;
    padding: 0.2rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
}

.blog-preview-reset {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    line-height: 1;
}

.blog-preview-reset:hover {
    color: var(--text-primary);
}

.lang-switch-inline a:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Prose - rendered Markdown
   -------------------------------------------------------------------------- */

.prose {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text-primary);
    text-align: justify;
}

.prose p {
    margin: 0 0 1.25rem;
}

.prose h2 {
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 2rem 0 0.75rem;
    color: var(--text-primary);
}

.prose h3 {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 1.625rem 0 0.625rem;
    color: var(--text-primary);
}

.prose h4,
.prose h5,
.prose h6 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem;
}

.prose ul,
.prose ol {
    margin: 0 0 1.25rem 1.375rem;
    padding: 0;
}

.prose li {
    margin-bottom: 0.375rem;
    line-height: 1.65;
}

.prose li > ul,
.prose li > ol {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.prose blockquote {
    margin: 1.5rem 0;
    padding: 0.875rem 1.25rem;
    border-left: 3px solid var(--accent);
    background: var(--accent-muted);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    font-style: italic;
}

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

.prose pre {
    margin: 1.25rem 0;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
}

.prose code {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
    font-size: 0.875em;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1em 0.35em;
}

.prose pre code {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    font-size: 1em;
}

.prose a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.prose a:hover {
    color: var(--accent-hover);
}

.prose strong {
    font-weight: 600;
}

.prose em {
    font-style: italic;
}

.prose del {
    opacity: 0.6;
}

.prose hr {
    border: none;
    border-top: 1px solid var(--border-strong);
    margin: 2rem 0;
}

.prose figure.blog-img {
    margin: 1.5rem 0;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.prose figure.blog-img img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: calc(var(--radius-sm) - 2px);
    margin: 0;
}

.prose figure.blog-img figcaption {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.375rem;
    font-style: italic;
}

.prose figure.blog-img.img-center {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.prose figure.blog-img.img-left {
    float: left;
    max-width: 45%;
    margin: 0.25rem 1.25rem 1rem 0;
}

.prose figure.blog-img.img-right {
    float: right;
    max-width: 45%;
    margin: 0.25rem 0 1rem 1.25rem;
}

.prose::after {
    content: '';
    display: table;
    clear: both;
}

/* Tables */
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9375rem;
    overflow-x: auto;
    display: block;
}

.prose thead {
    background: var(--bg-secondary);
}

.prose th,
.prose td {
    padding: 0.625rem 0.875rem;
    text-align: left;
    border: 1px solid var(--border-strong);
}

.prose th {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    white-space: nowrap;
}

.prose td {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.prose tr:nth-child(even) td {
    background: var(--bg-secondary);
}

/* --------------------------------------------------------------------------
   Article footer - post navigation
   -------------------------------------------------------------------------- */

.article-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.article-nav-item {
    flex: 1;
}

.article-nav-item.article-nav-center {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.article-nav-item.article-nav-right {
    text-align: right;
}

.back-link,
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.back-link svg,
.nav-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.back-link:hover,
.nav-link:hover {
    color: var(--accent);
}

.nav-link.nav-prev:hover svg {
    transform: translateX(-3px);
}

.nav-link.nav-next:hover svg {
    transform: translateX(3px);
}

@media (max-width: 640px) {
    .article-footer {
        flex-direction: column;
        gap: 0.75rem;
    }

    .article-nav-item.article-nav-center,
    .article-nav-item.article-nav-right {
        text-align: center;
    }
}

/* --------------------------------------------------------------------------
   Poem
   -------------------------------------------------------------------------- */

.poem {
    font-style: italic;
    line-height: 1.9;
    margin: 2rem 0;
}

/* --------------------------------------------------------------------------
   Webring
   -------------------------------------------------------------------------- */

.webring-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.webring-bar a {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.webring-bar a:hover {
    color: var(--accent);
}

.webring-bar svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
    .blog-index,
    .blog-article {
        padding: 1.25rem 1rem 2.5rem;
    }

    .page-head h1 {
        font-size: 1.625rem;
    }

    .article-header h1 {
        font-size: 1.5rem;
    }

    .prose pre {
        font-size: 0.8125rem;
        padding: 0.75rem 0.875rem;
    }

    .card-thumb {
        width: 80px;
        height: 80px;
    }

    .prose figure.blog-img.img-left,
    .prose figure.blog-img.img-right {
        float: none;
        max-width: 100%;
        margin: 1.5rem 0;
    }

    .cat-overview {
        grid-template-columns: 1fr;
    }
}
