/* ============================================================
   Shaher Jamal Eddin — /blog
   Extends styles.css (tokens, fonts, footer, links all inherited).
   Adds: blog top bar, index list, article prose, book block,
   TOC, pull quotes, prev/next nav.
   Same philosophy: quiet one-column document, one blue accent,
   Inter everywhere, mono for data/labels only, hairlines not boxes.
   ============================================================ */

/* ---------- Top bar ----------
   The homepage is a one-pager with no nav. Blog pages live at /blog/*,
   so they need a quiet way back. A slim, borderless bar: the mark on
   the left links home, a single "Blog" wordmark, nothing else.
   ----------------------------------------------------------------- */
/* ---------- Blog width ----------
   Matches the homepage's standard container width so the site reads as
   one consistent column, whether you're on the homepage or in an article.
   Scoped to .container--blog so any future divergence stays intentional.
   ----------------------------------------------------------------- */
.container--blog { max-width: 840px; }

.topbar {
    max-width: 840px;
    margin: 0 auto;
    padding: var(--space-3) var(--space-3) 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.topbar__home {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    border-bottom: none;
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.topbar__home:hover { color: var(--color-text); border-bottom: none; }
.topbar__home img { width: 30px; height: 30px; }

.topbar__home .topbar__sep {
    color: var(--color-rule);
    font-weight: 400;
}

.topbar__home .topbar__section {
    color: var(--color-text-muted);
    font-weight: 500;
}

.topbar__back {
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}
.topbar__back:hover { color: var(--color-accent); }

/* ---------- Blog index header ---------- */
.blog-head {
    padding: var(--space-5) 0 var(--space-4);
    border-bottom: 1px solid var(--color-rule);
}

.blog-head h1 {
    margin: 0 0 var(--space-2);
    font-size: clamp(1.85rem, 4vw, 2.4rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-weight: 700;
}

.blog-head__lead {
    margin: 0;
    max-width: 48ch;
    color: var(--color-text-soft);
    font-size: 1.05rem;
    line-height: 1.7;
}

/* ---------- Index: year group ----------
   Posts are grouped under a year. The year sits in the mono left rail
   like a section number, so it reads as "data", consistent with the
   timeline and section-number patterns on the homepage.
   ----------------------------------------------------------------- */
.post-group {
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-rule);
}
.post-group:last-of-type { border-bottom: none; }

.post-group__year {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    padding-top: 0.4rem;
    margin: 0 0 var(--space-2);
    border-top: 1px solid var(--color-text);
    display: inline-block;
}

.post-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ---------- Index: a single post row ----------
   date rail (mono) | title + dek + category. Mirrors .timeline-item.
   The whole row is a link target; only the title carries the blue.
   ----------------------------------------------------------------- */
.post-row {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: var(--space-2);
    padding: var(--space-3) 0;
    border-top: 1px dashed var(--color-rule);
}
.post-row:first-child { border-top: none; padding-top: 0; }

.post-row__date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
    padding-top: 0.35em;
    white-space: nowrap;
}

.post-row__title {
    margin: 0 0 0.3rem;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.post-row__title a {
    color: var(--color-text);
    border-bottom: 1px solid transparent;
}
.post-row__title a:hover {
    color: var(--color-accent);
    border-bottom-color: transparent;
}

.post-row__dek {
    margin: 0 0 0.5rem;
    color: var(--color-text-soft);
    line-height: 1.6;
    max-width: 58ch;
}

/* meta line: category · reading time. Category is a mono tag, not a
   coloured pill — colour stays reserved for the accent. */
.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}
.post-meta__sep { color: var(--color-rule); }

/* the category tag — differentiates Books vs Technology with weight,
   not colour. A hairline underline marks it as a category. */
.post-cat {
    color: var(--color-text);
    font-weight: 500;
    border-bottom: 1px solid var(--color-rule);
    padding-bottom: 1px;
}

@media (max-width: 560px) {
    .post-row { grid-template-columns: 1fr; gap: 0.35rem; }
    .post-row__date { padding-top: 0; }
}

/* ============================================================
   SINGLE POST
   ============================================================ */

/* ---------- Post header ----------
   Kicker (category, mono) → title → meta line (date · reading time).
   No cover by default; an optional figure sits below the meta.
   ----------------------------------------------------------------- */
.article {
    padding-top: var(--space-5);
}

.article__head {
    margin: 0 0 var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-rule);
}

.article__kicker {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: var(--space-2);
}

.article__title {
    margin: 0 0 var(--space-3);
    font-size: clamp(2rem, 5vw, 2.6rem);
    line-height: 1.12;
    letter-spacing: -0.025em;
    font-weight: 700;
    text-wrap: balance;
}

.article__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}
.article__meta .post-meta__sep { color: var(--color-rule); }

/* optional cover image — soft surface frame, hairline, no shadow drama */
.article__cover {
    margin: var(--space-3) 0 0;
}
.article__cover img {
    width: 100%;
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: 0 0 0 1px var(--color-rule) inset;
}
.article__cover figcaption {
    margin-top: var(--space-1);
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

/* ---------- Book meta block ----------
   For book posts only. A quiet key/value card on warm surface:
   title/author/year/rating. No cover, no provider colour — rating
   shown as filled/empty discs in muted ink, not stars/colour.
   ----------------------------------------------------------------- */
.book-card {
    margin: 0 0 var(--space-4);
    padding: var(--space-3);
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: 0 0 0 1px var(--color-rule) inset;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.4rem var(--space-3);
    align-items: baseline;
}

.book-card__key {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    white-space: nowrap;
}
.book-card__val {
    color: var(--color-text);
    font-size: 0.95rem;
    line-height: 1.5;
}
.book-card__val em { font-style: italic; }

.rating {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.rating__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--color-text-muted) inset;
}
.rating__dot--on { background: var(--color-text-muted); }
.rating__num {
    margin-left: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

/* ---------- Table of contents (long posts only) ----------
   A bordered-left aside, collapsible feel. Mono numbers, muted.
   ----------------------------------------------------------------- */
.toc {
    margin: 0 0 var(--space-4);
    padding: var(--space-2) 0 var(--space-2) var(--space-3);
    border-left: 2px solid var(--color-rule);
}
.toc__label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin: 0 0 var(--space-1);
}
.toc ol {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: toc;
}
.toc li {
    counter-increment: toc;
    padding: 0.18rem 0;
    line-height: 1.4;
}
.toc li::before {
    content: counter(toc, decimal-leading-zero);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-right: 0.7rem;
}
.toc a { color: var(--color-text-soft); border-bottom: none; }
.toc a:hover { color: var(--color-accent); }

/* ---------- Prose (the md-rendered article body) ----------
   Everything below is what a Markdown → HTML converter emits.
   Scoped to .prose so it never leaks into homepage patterns.
   ----------------------------------------------------------------- */
.prose {
    color: var(--color-text-soft);
    font-size: 1.0625rem;
    line-height: 1.75;
}

.prose > * + * { margin-top: var(--space-2); }

.prose h2 {
    margin: var(--space-5) 0 var(--space-2);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.25;
    letter-spacing: -0.015em;
    scroll-margin-top: var(--space-3);
}

.prose h3 {
    margin: var(--space-4) 0 var(--space-1);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.3;
}

.prose p { margin: var(--space-2) 0 0; }
.prose strong { color: var(--color-text); font-weight: 600; }
.prose em { font-style: italic; }
.prose a { color: var(--color-accent); }

.prose ul, .prose ol {
    margin: var(--space-2) 0 0;
    padding-left: 1.4rem;
}
.prose li { margin: 0.35rem 0; padding-left: 0.2rem; }
.prose li::marker { color: var(--color-text-muted); }

/* blockquote / pull quote — left rule, larger, main ink. No italics
   by default (italics are for titles); the size carries the emphasis */
.prose blockquote {
    margin: var(--space-4) 0;
    padding: 0 0 0 var(--space-3);
    border-left: 2px solid var(--color-accent);
    color: var(--color-text);
    font-size: 1.2rem;
    line-height: 1.6;
}
.prose blockquote p { margin: 0 0 var(--space-1); }
.prose blockquote cite {
    display: block;
    margin-top: var(--space-1);
    font-size: 0.85rem;
    font-style: normal;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
}

/* inline code + fenced blocks — for technology posts */
.prose :not(pre) > code {
    font-family: var(--font-mono);
    font-size: 0.86em;
    background: var(--color-surface);
    padding: 0.12em 0.4em;
    border-radius: 4px;
    box-shadow: 0 0 0 1px var(--color-rule) inset;
    color: var(--color-text);
}

.prose pre {
    margin: var(--space-3) 0;
    padding: var(--space-3);
    background: #1a1a1a;
    color: #e8e8e3;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    -webkit-font-smoothing: auto;
}
.prose pre code {
    font: inherit;
    background: none;
    padding: 0;
    box-shadow: none;
    color: inherit;
}

/* images inside the body */
.prose img {
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: 0 0 0 1px var(--color-rule) inset;
    margin: var(--space-3) 0;
}
.prose figure { margin: var(--space-3) 0; }
.prose figcaption {
    margin-top: var(--space-1);
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

/* section divider inside an article */
.prose hr {
    border: none;
    border-top: 1px solid var(--color-rule);
    margin: var(--space-5) 0;
}

/* tables (occasionally useful in tech posts) */
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-3) 0;
    font-size: 0.95rem;
}
.prose th, .prose td {
    text-align: left;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px dashed var(--color-rule);
}
.prose th {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 600;
}

/* ---------- Share row ----------
   A quiet share affordance at the foot of the article. Text links in the
   site voice (blue link + mono label + middle-dot separators, mirroring
   .hero__links) — no brand-coloured icons, no boxes. One solid hairline
   above marks it as a closing block, consistent with .article__foot below.
   ----------------------------------------------------------------- */
.article__share {
    margin: var(--space-5) 0 0;
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-rule);
}

.article__share-label {
    margin: 0 0 var(--space-1);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.share-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0;
    font-size: 1rem;
}

.share-links li { display: inline-flex; align-items: center; }

/* middle-dot separators between items (mirrors .hero__links) */
.share-links li:not(:last-child)::after {
    content: "\00B7";              /* · */
    margin: 0 0.7rem;
    color: var(--color-text-muted);
}

/* the <a> items inherit the global link (blue, animated underline on
   hover). the copy control is a <button> painted to match them exactly. */
.share-copy {
    font: inherit;
    color: var(--color-accent);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    border-bottom: 1px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.share-copy:hover {
    color: var(--color-accent-hover);
    border-bottom-color: currentColor;
}
.share-copy.is-copied {
    color: var(--color-text-muted);
    cursor: default;
    border-bottom-color: transparent;
}

/* visually-hidden live region for the "Link copied" announcement */
.share-status {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Article footer: prev / next ---------- */
.article__foot {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-rule);
}

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.post-nav__item {
    border-bottom: none;
    color: var(--color-text);
}
.post-nav__item:hover { border-bottom: none; }
.post-nav__item:hover .post-nav__title { color: var(--color-accent); }
.post-nav__item--next { text-align: right; }

.post-nav__dir {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    display: block;
    margin-bottom: 0.35rem;
}
.post-nav__title {
    font-weight: 600;
    line-height: 1.35;
    color: var(--color-text);
}

.article__back {
    display: inline-block;
    margin-top: var(--space-4);
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    border-bottom: none;
}
.article__back:hover { color: var(--color-accent); border-bottom: none; }

@media (max-width: 560px) {
    .book-card { grid-template-columns: 1fr; gap: 0.15rem 0; }
    .book-card__key { margin-top: var(--space-1); }
    .post-nav { grid-template-columns: 1fr; gap: var(--space-2); }
    .post-nav__item--next { text-align: left; }
}

/* print: hide the chrome, keep the prose */
@media print {
    .topbar, .article__foot, .toc, .article__share { display: none; }
    .prose pre { background: #f4f4f0; color: #000; box-shadow: 0 0 0 1px #ccc inset; }
}
