/* ==========================================================
   blog.css — Blog-specific styles
   Portfolio palette: stone-50→900, orange-400/500
   Fonts: Inter (sans), JetBrains Mono (mono), Caveat (hand)
   ========================================================== */

/* Grid pattern (matches portfolio hero: 28px cells, subtle 0.06 opacity) */
.bg-grid-pattern {
    background-size: 28px 28px;
    background-image:
        linear-gradient(to right, rgba(0, 0, 0, 0.06) 0.5px, transparent 0.5px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.06) 0.5px, transparent 0.5px);
}
.grid-fade {
    mask-image: linear-gradient(to bottom, black 30%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 30%, transparent 100%);
}

/* Marquee ticker */
@keyframes marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}
.marquee-track {
    animation: marquee 20s linear infinite;
}
.marquee-track:hover {
    animation-play-state: paused;
}

/* Hover underline — orange line slides in */
.hover-line {
    position: relative;
}
.hover-line::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: #fb923c;
    transition: width 0.3s ease;
}
.hover-line:hover::after {
    width: 100%;
}

/* Card border — removed orange top bar on hover (was distracting) */

/* Scroll progress bar */
.scroll-progress {
    transform-origin: left;
    transform: scaleX(0);
}

/* Tag pill */
.tag-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* =============================================
   Article prose — complete editorial styling
   ============================================= */

/* --- Headings hierarchy --- */
.article-prose h2 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: -0.025em;
    color: #1c1917;
    margin-top: 3rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #1c1917;
}
.article-prose h3 {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    color: #1c1917;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}
.article-prose h4 {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 1.0625rem;
    letter-spacing: -0.01em;
    color: #44403c;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

/* --- Body text --- */
.article-prose p {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    color: #57534e;
    line-height: 1.85;
    margin-bottom: 1.35rem;
    font-size: 1rem;
}
.article-prose strong {
    font-weight: 500;
    color: #1c1917;
}
.article-prose em {
    font-style: italic;
    color: #57534e;
}
.article-prose mark {
    background: rgba(251, 146, 60, 0.15);
    color: #1c1917;
    padding: 0.125rem 0.25rem;
    border-radius: 0.125rem;
}

/* --- Drop cap on first paragraph --- */
.article-prose > p:first-child::first-letter {
    float: left;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 3.5rem;
    line-height: 0.85;
    margin-right: 0.5rem;
    margin-top: 0.15rem;
    color: #1c1917;
}

/* --- Blockquotes --- */
.article-prose blockquote {
    border-left: 3px solid #1c1917;
    padding-left: 1.5rem;
    margin: 2.5rem 0;
    font-style: italic;
    color: #78716c;
    font-size: 1.0625rem;
    line-height: 1.75;
}
.article-prose blockquote p {
    margin-bottom: 0;
    color: inherit;
}

/* --- Lists --- */
.article-prose ul {
    list-style: none;
    padding-left: 0;
    margin: 1.5rem 0;
}
.article-prose ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    color: #57534e;
    font-weight: 300;
    line-height: 1.75;
}
.article-prose ul li::before {
    content: '\2014';
    position: absolute;
    left: 0;
    color: #1c1917;
    font-weight: 500;
}
.article-prose ol {
    list-style: none;
    padding-left: 0;
    margin: 1.5rem 0;
    counter-reset: ol-counter;
}
.article-prose ol li {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 0.75rem;
    color: #57534e;
    font-weight: 300;
    line-height: 1.75;
    counter-increment: ol-counter;
}
.article-prose ol li::before {
    content: counter(ol-counter) '.';
    position: absolute;
    left: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #fb923c;
    top: 0.15em;
}

/* --- Links --- */
.article-prose a {
    color: #fb923c;
    text-decoration: none;
    border-bottom: 1px solid rgba(251, 146, 60, 0.3);
    transition:
        border-color 0.2s ease,
        color 0.2s ease;
}
.article-prose a:hover {
    border-bottom-color: #fb923c;
    color: #f97316;
}

/* --- Horizontal rule --- */
.article-prose hr {
    border: none;
    margin: 3rem auto;
    text-align: center;
    height: auto;
}
.article-prose hr::after {
    content: '\2022  \2022  \2022';
    display: block;
    font-size: 0.875rem;
    letter-spacing: 0.5em;
    color: #fb923c;
}

/* --- Images & figures --- */
.article-prose img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    margin: 2rem 0;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.06),
        0 1px 2px rgba(0, 0, 0, 0.04);
}
.article-prose figure {
    margin: 2.5rem 0;
}
.article-prose figure img {
    margin-bottom: 0.75rem;
}
.article-prose figcaption {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    color: #a8a29e;
    text-align: center;
    letter-spacing: 0.02em;
}

/* --- Tables --- */
.article-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.875rem;
}
.article-prose thead th {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #78716c;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid #e7e5e4;
}
.article-prose tbody td {
    padding: 0.75rem 1rem;
    color: #57534e;
    border-bottom: 1px solid #f5f5f4;
    font-weight: 300;
}
.article-prose tbody tr:hover {
    background: #fafaf9;
}

/* --- Code blocks (basic pre/code) --- */
.article-prose pre {
    background: #1c1917;
    border: 1px solid #292524;
    border-radius: 0.375rem;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 2rem 0;
}
.article-prose pre::-webkit-scrollbar {
    height: 6px;
}
.article-prose pre::-webkit-scrollbar-track {
    background: #292524;
    border-radius: 3px;
}
.article-prose pre::-webkit-scrollbar-thumb {
    background: #44403c;
    border-radius: 3px;
}
.article-prose pre::-webkit-scrollbar-thumb:hover {
    background: #57534e;
}
.article-prose code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    line-height: 1.7;
    color: #d6d3d1;
}
.article-prose p code,
.article-prose li code,
.article-prose td code {
    background: #f5f5f4;
    color: #1c1917;
    padding: 0.15rem 0.4rem;
    border-radius: 0.1875rem;
    font-size: 0.8125rem;
    border: 1px solid #e7e5e4;
}

/* --- Code block with header (premium) --- */
.code-block {
    margin: 2.5rem 0;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid #292524;
}
.code-block .code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: #292524;
    border-bottom: 1px solid #44403c;
}
.code-block .code-file {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    color: #a8a29e;
    letter-spacing: 0.02em;
}
.code-block .code-lang {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    color: rgba(251, 146, 60, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.code-block pre {
    margin: 0;
    border: none;
    border-radius: 0;
}
.code-block .code-copy {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #44403c;
    border: 1px solid #57534e;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    color: #a8a29e;
    cursor: pointer;
    opacity: 0;
    transition:
        opacity 0.2s ease,
        background 0.15s ease;
}
.code-block:hover .code-copy {
    opacity: 1;
}
.code-block .code-copy:hover {
    background: #57534e;
    color: #d6d3d1;
}
.code-block .code-copy.copied {
    color: #fb923c;
}
.code-block .code-body {
    position: relative;
}

/* --- Author card --- */
.author-card {
    border: 1px solid #e7e5e4;
    border-radius: 0.5rem;
    padding: 1.5rem;
    background: #fafaf9;
    transition: border-color 0.2s ease;
}
.author-card:hover {
    border-color: #d6d3d1;
}
.author-card .author-avatar {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #e7e5e4 0%, #d6d3d1 100%);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: #78716c;
}

/* --- Article entrance animation --- */
@keyframes articleFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.article-enter {
    animation: articleFadeIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.article-enter-delay-1 {
    animation-delay: 0.05s;
    opacity: 0;
}
.article-enter-delay-2 {
    animation-delay: 0.1s;
    opacity: 0;
}
.article-enter-delay-3 {
    animation-delay: 0.15s;
    opacity: 0;
}
.article-enter-delay-4 {
    animation-delay: 0.2s;
    opacity: 0;
}
.article-enter-delay-5 {
    animation-delay: 0.25s;
    opacity: 0;
}

/* --- Content section fade-in on scroll --- */
.prose-section {
    opacity: 0;
    transform: translateY(16px);
    transition:
        opacity 0.5s ease,
        transform 0.5s ease;
}
.prose-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ZBS glow effect */
.zbs-glow {
    text-shadow: 0 0 8px rgba(251, 146, 60, 0.4);
}

/* Filter button active state */
.tag-filter.active {
    background-color: #1c1917;
    color: #fafaf9;
}

.tag-filter.active:hover {
    color: #fafaf9;
}

/* =============================================
   Responsive — Mobile adjustments
   ============================================= */
@media (max-width: 767px) {
    /* Smaller drop cap on mobile */
    .article-prose > p:first-child::first-letter {
        font-size: 2.75rem;
        margin-right: 0.35rem;
    }

    /* Tighter prose spacing */
    .article-prose h2 {
        font-size: 1.25rem;
        margin-top: 2.25rem;
    }
    .article-prose h3 {
        font-size: 1.125rem;
        margin-top: 2rem;
    }
    .article-prose h4 {
        font-size: 1rem;
    }
    .article-prose p {
        font-size: 0.9375rem;
        line-height: 1.8;
    }
    .article-prose blockquote {
        font-size: 0.9375rem;
        padding-left: 1.125rem;
        margin: 1.75rem 0;
    }

    /* Smaller code on mobile */
    .article-prose code {
        font-size: 0.75rem;
    }
    .article-prose p code,
    .article-prose li code,
    .article-prose td code {
        font-size: 0.75rem;
    }
    .article-prose pre {
        padding: 0.875rem;
        margin: 1.5rem -1.5rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .code-block {
        margin-left: -1.5rem;
        margin-right: -1.5rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    /* Table scroll on mobile */
    .article-prose table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Author card stacked on small screens */
    .author-card {
        padding: 1.25rem;
    }

    /* Full-width images on mobile */
    .article-prose img {
        margin-left: -1.5rem;
        margin-right: -1.5rem;
        max-width: calc(100% + 3rem);
        border-radius: 0;
    }
    .article-prose figure {
        margin-left: -1.5rem;
        margin-right: -1.5rem;
    }
    .article-prose figure img {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}
