/* ============================================
   Blog-specific typography overrides
   Loaded only on blog/*.html pages
   ============================================ */

/* Smooth scroll — prevents jarring jump when TOC links are clicked */
html {
    scroll-behavior: smooth;
}

/* Offset anchor targets so heading lands below the viewport top edge */
article h2[id],
article h3[id] {
    scroll-margin-top: 1.5rem;
}

/* Wider layout for blog pages */
main,
.wrapper footer {
    max-width: 1200px;
}

main.reverse {
    grid-template-columns: 1fr 220px;
    grid-gap: 80px;
}

/* Article byline — date + author, shown below h1 */
.article-byline {
    font-size: 0.875rem;
    color: #888;
    margin-top: -0.75rem;
    margin-bottom: 2rem;
    max-width: none;
    line-height: 1.5;
}

/* Fluid type scale — article scope only */
article h1 {
    font-size: clamp(1.75rem, 1.2rem + 2.5vw, 2.75rem);
    font-weight: 600;
    line-height: 1.15;
    padding-bottom: 1.25rem;
    letter-spacing: -0.04rem;
}

article h2 {
    font-size: clamp(1.25rem, 1rem + 1.25vw, 1.875rem);
    font-weight: 400;
    line-height: 1.25;
    margin-top: 2.5rem;
    margin-bottom: 0.6rem;
}

article h3 {
    font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.25rem);
    font-weight: 400;
    line-height: 1.3;
    margin-top: 1.75rem;
    margin-bottom: 0.4rem;
}

article p,
article li {
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    line-height: 1.75;
    color: #333;
}

article p {
    max-width: 68ch;
    margin-bottom: 1.25rem;
}

/* Fix list indentation (general.css sets padding: 0 40px — wrong side) */
article ul {
    padding: 0 0 0 1.5rem;
    margin-bottom: 1.25rem;
}

article li {
    margin-bottom: 0.4rem;
}

/* Ordered lists in article */
article ol {
    padding: 0 0 0 1.5rem;
    margin-bottom: 1.25rem;
}

article ol li {
    margin-bottom: 0.5rem;
}

/* Inline code in article */
article code {
    font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
    font-size: 0.875em;
    background: #f3f4f6;
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

/* ============================================
   Blog index — card grid
   ============================================ */

.blog-intro {
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    color: #555;
    margin-bottom: 2rem;
    max-width: 68ch;
}

.blog-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.blog-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem 1.75rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.blog-card:hover {
    border-color: #0cb5e6;
    box-shadow: 0 2px 10px rgba(12, 181, 230, 0.1);
}

.blog-card h2 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
}

.blog-card h2 a {
    text-decoration: none;
    color: #5a5959;
}

.blog-card h2 a:hover {
    color: #5a5959;
    text-decoration: underline;
}

.blog-card p {
    font-size: 0.9375rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 0.875rem;
    max-width: none;
}

.blog-card-read {
    font-size: 0.875rem;
    font-weight: 700;
    color: #0cb5e6;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.blog-card-read:hover {
    text-decoration: underline;
}

/* ============================================
   Aside: sticky TOC + back link
   ============================================ */

.sc-content-blog {
    padding: 1.5rem 0 2rem;    /* override general.css aside padding: 100px 0 50px */
    font-size: 1rem;
    position: sticky;
    top: 2rem;
    align-self: start;          /* required for sticky inside CSS Grid */
}

.blog-toc,
.blog-more {
    margin-bottom: 1.75rem;
}

.blog-toc-label {
    font-weight: 700;
    color: #5a5959;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
    max-width: none;             /* override article p max-width: 68ch */
    line-height: 1.5;
}

.sc-content-blog ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sc-content-blog li {
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

.sc-content-blog a {
    color: #5a5959;
    font-size: 1rem;
    text-decoration: none;
}

.sc-content-blog a:hover {
    color: #0cb5e6;
    text-decoration: underline;
}

/* Back-to-index link at bottom of sidebar */
.blog-back {
    display: block;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e5e7eb;
    font-size: 0.875rem;
    color: #5a5959;
    text-decoration: none;
}

.blog-back:hover {
    color: #0cb5e6;
}

/* ============================================
   Mobile overrides
   ============================================ */

@media screen and (max-width: 640px) {
    .blog-cards {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 480px) {
    article {
        word-break: normal;         /* override general.css word-break: break-all */
        overflow-wrap: break-word;  /* still handle genuinely long URLs/strings */
    }

    /* Disable sticky and stack sidebar below article on mobile */
    main.reverse {
        display: flex;
        flex-direction: column;
    }

    main.reverse aside {
        order: 2;
        padding: 1rem 0 0;
        position: static;
    }

    .sc-content-blog {
        padding: 1rem 0 0;
        position: static;
    }
}
