/* Blog-specific styles.
 *
 * Every blog page loads /public/css/style.css FIRST, which supplies the whole
 * design system: the --light_theme/--dark_theme token sets, fonts, the fixed
 * header, .navlist, .title and the card recipe. This file only adds what the
 * blog needs on top. Don't redefine colours here — use the tokens so the blog
 * and the portfolio can never drift apart.
 *
 * Note: the portfolio's reset is `* { padding:0; margin:0; text-decoration:none;
 * list-style:none }`. That's fine for a landing page but it flattens rendered
 * Markdown, so .post-body below deliberately restores prose defaults.
 */

/* ---------- Layout ---------- */

/* Keep the footer at the bottom of the viewport on short pages (a one-post
   index, an error state). The fixed site header is out of flow, so the section
   is the only child that needs to absorb the slack. */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body > section {
    flex: 1 0 auto;
}

/* ---------- Index ---------- */

.blog-intro {
    max-width: 620px;
    margin: 1.5rem auto 0;
    text-align: center;
    color: var(--second-color);
    font-size: var(--p-font);
    line-height: 1.8;
}

/* Standing note under the intro. Deliberately quieter than .blog-intro — it's
   a caveat, not a headline — and left-aligned so the wrapped lines stay easy to
   read next to the icon. */
.blog-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    max-width: 620px;
    margin: 1.4rem auto 0;
    padding: 0.9rem 1.15rem;
    text-align: left;
    color: var(--second-color);
    font-size: 0.9rem;
    line-height: 1.7;
    background: color-mix(in oklab, var(--main-color), transparent 94%);
    border: 1px solid var(--border-color);
    border-left: 3px solid color-mix(in oklab, var(--main-color), transparent 35%);
    border-radius: var(--radius-md);
}

.blog-disclaimer i {
    flex-shrink: 0;
    margin-top: 0.15rem;
    font-size: 1.05rem;
    color: var(--main-color);
}

/* The portfolio stylesheet paints every bare <span> in the accent colour (it
   uses them for the highlighted word in headings). This one is just a text
   wrapper, so it keeps the paragraph's own colour. */
.blog-disclaimer span {
    color: inherit;
}

.blog-disclaimer strong {
    font-weight: 800;
    color: var(--text-color);
}

.post-list {
    display: grid;
    gap: 1.6rem;
    margin-top: 3rem;
}

.post-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1.7rem 1.6rem;
    color: inherit;
    background: linear-gradient(180deg, color-mix(in oklab, var(--surface-strong), #fff 6%), var(--surface-color));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.post-card:hover {
    transform: translateY(-6px);
    border-color: color-mix(in oklab, var(--main-color), transparent 45%);
    box-shadow: 0 28px 60px -20px color-mix(in oklab, var(--main-color), transparent 72%);
}

.post-card h2 {
    font-family: 'Fraunces', serif;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text-color);
    transition: color 0.25s ease;
}

.post-card:hover h2 {
    color: var(--main-color);
}

.post-card .post-excerpt {
    color: var(--second-color);
    font-size: 0.95rem;
    line-height: 1.7;
}

.post-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--main-color);
}

.post-card-more {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.3rem;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--main-color);
}

.post-card-more i {
    transition: transform 0.25s ease;
}

.post-card:hover .post-card-more i {
    transform: translateX(4px);
}

/* Loading / empty / error states */
.blog-status {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--second-color);
    font-size: 0.95rem;
    line-height: 1.7;
}

.blog-status code {
    font-size: 0.88em;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    background: color-mix(in oklab, var(--text-color), transparent 92%);
}

/* ---------- Single post ---------- */

/* The portfolio stylesheet targets the BARE `header` element for the fixed site
   nav (position: fixed; top: 0; z-index: 1000). Any <header> inside the article
   — one in a post's Markdown, say — would inherit that and pin itself over the
   real nav, so nested headers are forced back to normal flow here. */
.post-article header,
.post-body header {
    position: static;
    display: block;
    width: auto;
    padding: 0;
    z-index: auto;
    background: none;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.post-article {
    max-width: 720px;
    margin: 0 auto;
}

.post-header {
    text-align: center;
    padding-bottom: 2.2rem;
    margin-bottom: 2.8rem;
    border-bottom: 1px solid var(--border-color);
}

.post-header h1 {
    font-family: 'Fraunces', serif;
    font-size: clamp(2.1rem, 5vw, 3.4rem);
    font-weight: 700;
    line-height: 1.08;
    color: var(--text-color);
    margin-top: 0.9rem;
    text-wrap: balance;
}

/* Rendered Markdown. The global reset zeroes margins and strips list markers
   and underlines, so prose defaults are restored here. */
.post-body {
    color: var(--second-color);
    font-size: 1.08rem;
    line-height: 1.85;
}

.post-body > *:first-child {
    margin-top: 0;
}

.post-body p,
.post-body ul,
.post-body ol,
.post-body pre,
.post-body blockquote,
.post-body table {
    margin: 0 0 1.4rem;
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
    font-family: 'Fraunces', serif;
    color: var(--text-color);
    line-height: 1.25;
    margin: 2.6rem 0 1rem;
}

.post-body h1 { font-size: 1.95rem; }
.post-body h2 { font-size: 1.6rem; }
.post-body h3 { font-size: 1.3rem; }
.post-body h4 { font-size: 1.12rem; }

.post-body strong {
    color: var(--text-color);
    font-weight: 800;
}

.post-body a {
    color: var(--main-color);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: opacity 0.2s ease;
}

.post-body a:hover {
    opacity: 0.72;
}

/* Restore list markers killed by the global `list-style: none`. */
.post-body ul,
.post-body ol {
    padding-left: 1.4rem;
}

/* The marker must be set on the <li> itself, not just the parent list: the
   global `* { list-style: none }` matches each <li> directly, and a direct rule
   beats the value the list would otherwise pass down. */
.post-body ul,
.post-body ul > li { list-style: disc; }

.post-body ol,
.post-body ol > li { list-style: decimal; }

.post-body li { margin-bottom: 0.55rem; }
.post-body li::marker { color: var(--main-color); }
.post-body li > ul,
.post-body li > ol { margin: 0.55rem 0 0; }

.post-body code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.88em;
    padding: 0.18rem 0.42rem;
    border-radius: 6px;
    color: var(--text-color);
    background: color-mix(in oklab, var(--main-color), transparent 88%);
    border: 1px solid var(--border-color);
}

.post-body pre {
    padding: 1.25rem 1.35rem;
    overflow-x: auto;
    border-radius: var(--radius-md);
    background: color-mix(in oklab, var(--surface-strong), var(--text-color) 6%);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.post-body pre code {
    padding: 0;
    border: none;
    background: none;
    font-size: 0.9rem;
    line-height: 1.7;
}

.post-body blockquote {
    padding: 0.3rem 0 0.3rem 1.3rem;
    border-left: 3px solid var(--main-color);
    color: var(--second-color);
    font-style: italic;
}

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

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.post-body hr {
    height: 1px;
    border: none;
    background: var(--border-color);
    margin: 2.6rem 0;
}

.post-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.post-body th,
.post-body td {
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.post-body th {
    color: var(--text-color);
    font-weight: 800;
    background: color-mix(in oklab, var(--main-color), transparent 92%);
}

/* ---------- Footer / back link ---------- */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3.5rem;
    padding: 0.85rem 1.4rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    transition: transform 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.back-link:hover {
    transform: translateY(-2px);
    border-color: var(--main-color);
    color: var(--main-color);
}

.site-footer {
    padding: 2.5rem 10% 3rem;
    border-top: 1px solid var(--border-color);
    color: var(--second-color);
    font-size: 0.88rem;
    text-align: center;
    background: var(--second-bg-color);
}

.site-footer a {
    color: var(--main-color);
    font-weight: 700;
}

@media (max-width: 1200px) {
    .site-footer { padding-left: 6.5%; padding-right: 6.5%; }
}
