/* Blog-only styles. The site stylesheet (css/styles.css) already supplies the
   tokens, the reset, the nav and the footer, so nothing here re-states them; these
   are the classes the blog adds on top. Ported from the approved prototype. */

:root {
    --chip-bg: #eff6ff;
    --chip-text: #1d4ed8;
    --code-bg: #f3f4f6;
    --note-bg: #fffbeb;
    --note-border: #f59e0b;
    --ok-bg: #ecfdf5;
    --ok-border: #10b981;
    --ok-text: #065f46;
}

/* #navbar is fixed on this site, so the first thing on the page has to clear it. */
.blog-page main {
    padding-top: 64px;
}

.blog-page img {
    max-width: 100%;
}

[hidden] {
    display: none !important;
}

.wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 2.5rem 16px 4rem;
}

.page-head {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.25rem;
    margin-bottom: 1.75rem;
}

.page-head h1 {
    font-size: 2rem;
    line-height: 1.2;
    text-wrap: balance;
}

.page-head > p {
    color: var(--text-light);
    margin-top: 0.4rem;
}

.head-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

.head-meta .count {
    color: var(--text-light);
}

.rss {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--secondary-color);
    font-weight: 600;
}

.rss svg {
    flex: none;
}

/* Post list */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.post-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-light);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.post-card h2 {
    font-size: 1.2rem;
    line-height: 1.35;
    text-wrap: balance;
}

.post-card h2 a {
    color: var(--text-dark);
    text-decoration: none;
}

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

.post-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.dot {
    color: var(--border-color);
}

.excerpt {
    margin-top: 0.6rem;
    color: var(--text-light);
    font-size: 0.95rem;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.85rem;
}

/* The site's .tech-tag shape, in the chip colours from the prototype, plus the
   link affordance a tag needs here. min-width/overflow-wrap come with .tech-tag. */
.blog-tag {
    background: var(--chip-bg);
    color: var(--chip-text);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    text-decoration: none;
}

.blog-tag:hover {
    text-decoration: underline;
}

.empty {
    color: var(--text-light);
}

.pagination {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-light);
}

.page-btn {
    display: inline-block;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    background: var(--bg-light);
    color: var(--primary-color);
    font-size: 0.85rem;
    text-decoration: none;
}

.page-btn[aria-disabled="true"] {
    color: var(--text-light);
    opacity: 0.6;
}

/* Article */
.crumb {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.article h1 {
    font-size: 1.9rem;
    line-height: 1.22;
    text-wrap: balance;
}

/* Titles break mid-word rather than push the viewport out; the same rule for the
   rendered body lives in post-body.css, with the rest of what rendered Markdown looks like. */
.article h1,
.post-card h2 {
    overflow-wrap: anywhere;
}

/* Where the rendered body sits in the article. Its insides are post-body.css's job. */
.article-body {
    margin-top: 1.75rem;
}

/* Comments */
.comments {
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.comments h2 {
    font-size: 1.2rem;
}

.comment-count {
    color: var(--text-light);
    font-weight: 400;
    font-size: 0.9rem;
}

.thread {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.comment {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.avatar {
    position: relative;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    background: var(--primary-color);
    letter-spacing: 0.02em;
    overflow: hidden;
}

/* The Gravatar covers the initials when the commenter has one. When they do not,
   d=blank returns a transparent image and the circle underneath shows through. */
.avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* A removed comment that is still holding replies up. It reads as an absence —
   muted, unnamed, no body — rather than as a comment someone wrote. */
.avatar.deleted {
    background: transparent;
    border: 1px dashed var(--border-color);
    color: var(--text-light);
    font-weight: 400;
}

.cdeleted {
    color: var(--text-light);
    font-weight: 600;
    font-style: italic;
}

.cdeleted-note {
    color: var(--text-light);
    font-size: 0.92rem;
    font-style: italic;
}

.avatar.a2 { background: #0f766e; }
.avatar.a3 { background: #6d28d9; }
.avatar.a4 { background: var(--secondary-color); }
.avatar.a5 { background: var(--text-light); }

.cbody {
    min-width: 0;
    flex: 1;
}

.cname {
    font-weight: 600;
    font-size: 0.92rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--chip-text);
}

.cdate {
    font-size: 0.78rem;
    color: var(--text-light);
    font-weight: 400;
}

.ctext {
    font-size: 0.93rem;
    margin-top: 0.3rem;
    overflow-wrap: anywhere;
}

.ctext > * + * {
    margin-top: 0.6rem;
}

.ctext pre {
    background: var(--code-bg);
    border-radius: 6px;
    padding: 0.75rem;
    overflow-x: auto;
    max-width: 100%;
}

/* Standalone controls are thumb targets, not inline links: a 33x15 "Reply" is a
   miss on a phone. The padding buys the height, the negative margin keeps the
   visible text where it was so nothing below it moves. */
.creply {
    margin-top: 0.45rem;
    font-size: 0.8rem;
    background: none;
    border: 0;
    padding: 0.7rem 0.6rem;
    margin-left: -0.6rem;
    min-height: 44px;
    color: var(--primary-color);
    cursor: pointer;
    font-family: inherit;
}

.replies {
    margin-top: 1.25rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.pending {
    background: var(--note-bg);
    border: 1px dashed var(--note-border);
    border-radius: 8px;
    padding: 0.85rem;
}

.pending-note {
    font-size: 0.76rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    display: flex;
    gap: 0.4rem;
    align-items: baseline;
}

.pending-note strong {
    color: var(--text-dark);
}

/* Form */
.cform {
    margin-top: 2.25rem;
    background: var(--bg-section);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
}

.cform h3 {
    font-size: 1rem;
}

.replying-to {
    margin-top: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-light);
}

.field {
    margin-top: 1rem;
}

.field label {
    display: block;
    font-size: 0.83rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.field .hint {
    display: block;
    font-weight: 400;
    color: var(--text-light);
    font-size: 0.76rem;
    margin-top: 0.15rem;
}

.cform input[type="text"],
.cform input[type="email"],
.cform textarea {
    width: 100%;
    max-width: 100%;
    font: inherit;
    /* 16px keeps iOS from zooming the page when the field takes focus. */
    font-size: 1rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-light);
    color: var(--text-dark);
}

.cform textarea {
    min-height: 120px;
    resize: vertical;
}

.req {
    color: var(--primary-color);
}

.turnstile {
    margin-top: 1rem;
    min-height: 65px;
}

.submit {
    margin-top: 1.15rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    border: 0;
    border-radius: 6px;
    background: var(--primary-color);
    color: #fff;
    cursor: pointer;
}

.submit:hover {
    filter: brightness(1.07);
}

.submit[disabled] {
    opacity: 0.6;
    cursor: progress;
}

.cancel-reply {
    margin-top: 1.15rem;
    margin-left: 0.6rem;
    font: inherit;
    font-size: 0.85rem;
    background: none;
    border: 0;
    padding: 0 0.7rem;
    min-height: 44px;
    color: var(--text-light);
    cursor: pointer;
}

/* "← All posts" sits alone above the title, so it gets the same treatment. */
.crumb a {
    display: inline-block;
    padding: 0.55rem 0.6rem;
    margin: -0.55rem -0.6rem;
    min-height: 44px;
    box-sizing: border-box;
}

.success {
    margin-top: 1rem;
    background: var(--ok-bg);
    border: 1px solid var(--ok-border);
    border-radius: 6px;
    padding: 0.75rem 0.85rem;
    font-size: 0.86rem;
    color: var(--ok-text);
}

/* No red in the palette, per the owner's preference: an error is the same amber
   the "held for approval" note uses. */
.form-error {
    margin-top: 1rem;
    background: var(--note-bg);
    border: 1px solid var(--note-border);
    border-radius: 6px;
    padding: 0.75rem 0.85rem;
    font-size: 0.86rem;
    color: var(--text-dark);
}

.closed {
    margin-top: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-section);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.92rem;
}

.closed strong {
    display: block;
    color: var(--text-dark);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

@media (max-width: 767px) {
    .article h1,
    .page-head h1 {
        font-size: 1.6rem;
    }
}

/* The name in the nav is a link back to the home page here (the portfolio's own
   copy is a plain span), so it needs the link underline taken off. */
.blog-page .nav-name {
    text-decoration: none;
}
