/* =========================================================
   Blog (index + posts) in the 4.0 "Frameless Stack" look.
   Loaded AFTER ../landing.css, which provides the tokens, type,
   buttons, sticky header, footer, post cards and tags; this file
   only adds what the blog needs on top.
   ========================================================= */

/* the header is always shown on blog pages, so the content starts below it */
.page-blog main { padding-top: 76px; }
.site-header .btn { flex: none; }

/* a narrow reading column for posts; the index keeps the landing page's width */
.wrap.read { max-width: calc(760px + 2 * var(--gutter)); }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--fg-3);
    transition: color .2s ease;
}
.back-link:hover { color: var(--fg); }

a.tag { transition: background .2s ease; }
a.tag:hover { background: rgba(222,115,86,0.22); }

/* =========================================================
   Index
   ========================================================= */
.blog-hero {
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 2vw, 24px);
    padding-block: clamp(36px, 6vw, 88px) clamp(28px, 4vw, 48px);
}
.blog-hero .lede { color: var(--fg-2); max-width: 32em; }
.blog-hero .lede a { color: var(--fg); border-bottom: 1px solid var(--line-2); }
.blog-hero .lede a:hover { border-color: var(--fg-2); }

.tag-filter { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-filter a {
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--card);
    box-shadow: inset 0 0 0 1px var(--line);
    font-weight: 700;
    font-size: 15px;
    color: var(--fg-2);
    transition: color .2s ease, box-shadow .2s ease, background .2s ease;
}
.tag-filter a:hover { color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-2); }
.tag-filter a[aria-current="true"] { background: var(--clay); color: var(--clay-ink); box-shadow: none; }

.page-blog .post-grid {
    margin-top: clamp(24px, 3vw, 36px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.page-blog .post-card { padding: clamp(22px, 2.4vw, 30px); gap: 14px; min-height: 230px; }
.page-blog .post-card h3 { font-size: clamp(20px, 1.9vw, 24px); text-wrap: balance; }
.page-blog .post-card p { display: block; font-size: 15.5px; line-height: 1.5; text-wrap: pretty; }
.page-blog .post-card time { margin-top: auto; }

/* the newest post leads as a clay field across the whole row */
.page-blog .post-grid .post-card:first-child {
    grid-column: 1 / -1;
    background: var(--clay);
    color: var(--clay-ink);
    box-shadow: none;
    padding: clamp(28px, 4vw, 56px);
    min-height: 0;
}
.page-blog .post-grid .post-card:first-child h3 {
    font-weight: 900;
    font-stretch: 125%;
    font-size: clamp(28px, 3.6vw, 46px);
    line-height: 0.95;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    max-width: 18em;
}
.page-blog .post-grid .post-card:first-child p { color: rgba(29,15,10,0.78); font-size: clamp(16px, 1.4vw, 19px); max-width: 38em; }
.page-blog .post-grid .post-card:first-child time { color: rgba(29,15,10,0.62); margin-top: 6px; }
.page-blog .post-grid .post-card:first-child .tag { background: rgba(29,15,10,0.12); color: var(--clay-ink); }
.page-blog .post-grid .post-card:first-child:hover { box-shadow: none; transform: translateY(-3px); }

.blog-empty { grid-column: 1 / -1; color: var(--fg-3); font-size: 16px; padding: 24px 0; }

/* =========================================================
   Post
   ========================================================= */
.post-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    padding-block: clamp(32px, 5vw, 72px) clamp(32px, 4vw, 52px);
    border-bottom: 1px solid var(--line);
}
.post-header .back-link { margin-bottom: 4px; }
.post-title {
    font-weight: 900;
    font-stretch: 125%;
    font-size: clamp(30px, 4.4vw, 52px);
    line-height: 0.95;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    text-wrap: balance;
}
.post-title code {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.82em;
    font-weight: 700;
    text-transform: none;
    letter-spacing: -0.03em;
    color: var(--clay);
}
.post-lede { font-size: clamp(18px, 1.6vw, 21px); line-height: 1.45; color: var(--fg-2); text-wrap: pretty; }
.post-meta { font-size: 14px; font-weight: 600; color: var(--fg-3); }

.post-body {
    padding-top: clamp(28px, 4vw, 48px);
    font-size: 18px;
    line-height: 1.65;
    color: var(--fg-2);
}
.post-body > * + * { margin-top: 20px; }
.post-body h2 {
    margin-top: clamp(44px, 5vw, 60px);
    font-weight: 900;
    font-stretch: 125%;
    font-size: clamp(22px, 2.3vw, 28px);
    line-height: 1;
    letter-spacing: -0.015em;
    text-transform: uppercase;
    text-wrap: balance;
    color: var(--fg);
}
.post-body h2 code { text-transform: none; }
.post-body h3 { margin-top: 32px; font-size: 19px; font-weight: 800; font-stretch: 110%; letter-spacing: -0.01em; color: var(--fg); }
.post-body h2 + *, .post-body h3 + * { margin-top: 14px; }
.post-body strong { color: var(--fg); font-weight: 700; }
.post-body a { color: var(--fg); border-bottom: 1.5px solid rgba(222,115,86,0.6); transition: border-color .2s ease, color .2s ease; }
.post-body a:hover { color: var(--clay); border-color: var(--clay); }
.post-body ul, .post-body ol { padding-left: 24px; }
.post-body li { padding-left: 4px; }
.post-body li + li { margin-top: 10px; }
.post-body li::marker { color: var(--clay); font-weight: 800; }
.post-body code {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.86em;
    padding: 2px 7px;
    border-radius: 7px;
    background: var(--night-3);
    color: var(--fg);
}
.post-body pre {
    overflow-x: auto;
    padding: 18px 20px;
    border-radius: 14px;
    background: var(--night-2);
    box-shadow: inset 0 0 0 1px var(--line);
}
.post-body pre code { padding: 0; background: none; font-size: 15px; line-height: 1.6; }

.callout {
    padding: 22px 24px;
    border-radius: var(--r-card);
    background: rgba(222,115,86,0.12);
    box-shadow: inset 0 0 0 1px rgba(222,115,86,0.32);
    font-size: 16.5px;
    line-height: 1.6;
}
.callout strong:first-child {
    display: block;
    margin-bottom: 6px;
    font-size: 17px;
    font-weight: 800;
    font-stretch: 110%;
    color: var(--clay);
}
.callout-muted { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.callout-muted strong:first-child { color: var(--fg); }

/* an embedded post shows as a quiet card until (or unless) the widget loads */
.post-body blockquote.twitter-tweet {
    padding: 20px 22px;
    border-radius: var(--r-card);
    background: var(--night-2);
    box-shadow: inset 0 0 0 1px var(--line);
    font-size: 16px;
}
.post-body .twitter-tweet-rendered { margin-inline: auto; }

/* closing: one clay card for the app, then the way back */
.post-cta {
    margin-top: clamp(56px, 7vw, 88px);
    padding: clamp(28px, 4vw, 44px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px 28px;
    align-items: center;
}
.post-cta .copy { display: flex; flex-direction: column; gap: 12px; }
.post-cta p { color: rgba(29,15,10,0.75); font-size: 16.5px; line-height: 1.45; max-width: 30em; }
.post-footer { margin-top: 28px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

@media (max-width: 900px) {
    .page-blog main { padding-top: 64px; }
    .page-blog .post-grid { grid-template-columns: 1fr; }
    .post-cta { grid-template-columns: 1fr; }
    .post-cta .btn { justify-self: start; }
}
@media (max-width: 600px) {
    .post-body { font-size: 17px; }
    .site-header .brand span { font-size: 14px; }
}
