/* ===========================================================================
   rickysays — site stylesheet (v2: technical-warm)
   IBM Plex Sans body, Plex Mono for dates/code. Featured hero, tag pills,
   drop caps, byline+avatar, decorative dividers, accent dot on wordmark.
   =========================================================================== */

:root {
    --bg:           #FFFFFF;
    --text:         #1F2937;
    --muted:        #6B7280;
    --muted-soft:   #9CA3AF;
    --border:       #E5E7EB;
    --accent:       #2563EB;
    --accent-soft:  #EFF6FF;
    --code-bg:      #F8FAFC;
    --sans:         "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --mono:         "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --container:    680px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== 2-column page grid (main + sidebar) on widescreen ===== */
.page-grid {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}
.main-col {
    max-width: var(--container);
    margin: 0 auto;
}
.sidebar-col { display: none; }
@media (min-width: 1100px) {
    .page-grid {
        display: grid;
        grid-template-columns: 1fr 260px;
        gap: 64px;
        align-items: start;
    }
    .main-col {
        min-width: 0;
        max-width: 680px;
        margin: 0;
    }
    .sidebar-col {
        display: block;
        position: sticky;
        top: 32px;
        font-size: 14px;
    }
}

.sidebar-widget {
    margin-bottom: 32px;
}
.widget-label {
    font-family: var(--mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--muted-soft);
    margin-bottom: 14px;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tag-cloud .tag-pill { font-size: 10px; }
.tag-cloud .tag-pill-md { font-size: 11px; padding: 3px 9px; }
.tag-cloud .tag-pill-lg { font-size: 12px; padding: 4px 11px; font-weight: 600; }

/* ===== Reading progress bar (post pages) ===== */
/* Sits at the very top of the viewport above the sticky header; the header
   has a higher z-index for its background but the bar shows through at the
   top edge thanks to position:fixed + higher z-index. */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    z-index: 200;
    pointer-events: none;
}
.reading-progress span {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #60a5fa);
    transition: width 80ms linear;
}

/* ===== Heading anchors (post pages) ===== */
.post-body h2, .post-body h3 { position: relative; }
.heading-anchor {
    opacity: 0;
    margin-left: 8px;
    color: var(--muted-soft);
    font-weight: 400;
    text-decoration: none;
    transition: opacity 120ms ease;
}
.post-body h2:hover .heading-anchor,
.post-body h3:hover .heading-anchor,
.heading-anchor:focus {
    opacity: 1;
    color: var(--accent);
}
.heading-anchor:hover { text-decoration: none; }

/* ===== Header (sticky) ===== */
.site-header {
    border-bottom: 2px solid var(--accent);
    padding: 14px 0;
    margin-bottom: 48px;
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
}
.header-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.header-inner .wordmark { margin-right: auto; }  /* push everything else to the right */
.header-search {
    width: 260px;
    flex-shrink: 1;
}
.header-search input[type="search"] {
    width: 100%;
    font-family: var(--sans);
    font-size: 13px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--code-bg);
    color: var(--text);
    transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}
.header-search input[type="search"]::placeholder {
    color: var(--muted-soft);
    font-family: var(--mono);
    font-size: 12px;
}
.header-search input[type="search"]:focus {
    outline: none;
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 3px var(--accent-soft);
}
@media (max-width: 720px) {
    .header-search { display: none; }
    .header-inner { gap: 16px; }
}
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.wordmark {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 20px;
    color: var(--text) !important;
    letter-spacing: -0.01em;
}
.wordmark:hover { text-decoration: none; }
.wordmark::after {
    content: ".";
    color: var(--accent);
    margin-left: 1px;
}
.header-nav a {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.02em;
}
.header-nav a:hover { color: var(--text); text-decoration: none; }

/* ===== Section dividers (decorative little dots) ===== */
.divider {
    text-align: center;
    color: var(--muted-soft);
    font-family: var(--mono);
    letter-spacing: 0.6em;
    font-size: 11px;
    margin: 48px 0;
    user-select: none;
}
.divider::before { content: "· · ·"; }

/* ===== Homepage ===== */
.intro {
    font-size: 17px;
    line-height: 1.7;
    margin: 0 0 24px;
    color: var(--text);
}
.intro p { margin: 0 0 1em; }

.section-label {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--muted-soft);
    margin: 0 0 20px;
    font-weight: 500;
}

/* Featured (newest) post block on homepage */
.featured-post {
    margin: 0 0 56px;
    padding-bottom: 48px;
    border-bottom: 1px solid var(--border);
}
.featured-post .label {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--accent);
    margin-bottom: 12px;
}
.featured-post h2 {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 32px;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0 0 12px;
}
.featured-post h2 a { color: var(--text); }
.featured-post h2 a:hover { color: var(--accent); text-decoration: none; }
.featured-post .excerpt {
    font-size: 16px;
    color: var(--muted);
    line-height: 1.6;
    margin: 0 0 14px;
}
.featured-post .meta {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted-soft);
    letter-spacing: 0.04em;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
}

/* Post list rows */
.post-list {
    list-style: none;
    margin: 0 0 48px;
    padding: 0;
}
.post-list-item {
    border-bottom: 1px solid var(--border);
    padding: 18px 16px;
    margin: 0 -16px;
    border-radius: 4px;
    transition: background 120ms ease, transform 120ms ease;
}
.post-list-item:hover {
    background: var(--code-bg);
}
.post-list-item:first-child { border-top: 1px solid var(--border); }
.post-list-item .title {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 17px;
    line-height: 1.3;
    margin: 0 0 4px;
}
.post-list-item .title a { color: var(--text); }
.post-list-item .title a:hover { color: var(--accent); text-decoration: none; }
.post-list-item .excerpt {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.5;
    margin: 0 0 8px;
}
.post-list-item .meta {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted-soft);
    letter-spacing: 0.04em;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
}
.post-list-item .meta .date { white-space: nowrap; }
.post-list-item .meta .sep { color: var(--border); }

/* Tag pills (used on homepage rows and inside posts) */
.tag-pill {
    font-family: var(--mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 500;
}
.tag-pill:hover {
    background: var(--accent);
    color: white;
    text-decoration: none;
}

/* ===== Single post ===== */
.post-header { margin: 0 0 36px; }
.post-byline {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.byline-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, #1e40af 100%);
    color: white;
    display: grid;
    place-items: center;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.byline-text {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.02em;
    line-height: 1.4;
}
.byline-text .name {
    color: var(--text);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.post-title {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 38px;
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin: 0 0 14px;
    color: var(--text);
}
.post-meta {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted-soft);
    letter-spacing: 0.04em;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
}
.post-meta .sep { color: var(--border); }
.post-tags-row {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.post-body {
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.75;
    margin: 0 0 56px;
    color: var(--text);
}
/* Drop cap on the first letter of the first paragraph */
.post-body > p:first-of-type::first-letter {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 56px;
    float: left;
    line-height: 0.9;
    margin: 6px 8px 0 -2px;
    color: var(--accent);
}
.post-body h1, .post-body h2, .post-body h3 {
    font-family: var(--sans);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 1.8em 0 0.5em;
    line-height: 1.3;
}
.post-body h2 { font-size: 24px; }
.post-body h3 { font-size: 19px; }
.post-body p { margin: 0 0 1.1em; }
.post-body img { max-width: 100%; height: auto; border-radius: 4px; margin: 1.2em 0; }
.post-body a { word-break: break-word; }
.post-body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 18px;
    color: var(--muted);
    margin: 1.5em 0;
    font-style: italic;
}
.post-body code {
    font-family: var(--mono);
    background: var(--accent-soft);
    color: var(--accent);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}
.post-body pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 18px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.55;
}
.post-body pre code { background: none; color: inherit; padding: 0; }
.post-body ul, .post-body ol { margin: 0 0 1.2em; padding-left: 1.5em; }
.post-body li { margin-bottom: 0.4em; }
.post-body hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }

/* Social share row */
.share-row {
    border-top: 1px solid var(--border);
    margin-top: 48px;
    padding-top: 24px;
    display: flex;
    gap: 8px;
    align-items: center;
    font-family: var(--mono);
    font-size: 11px;
}
.share-row .label {
    color: var(--muted-soft);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-right: 4px;
}
.share-row a {
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 11px;
    letter-spacing: 0.04em;
}
.share-row a:hover {
    color: var(--accent);
    border-color: var(--accent);
    text-decoration: none;
}

/* ===== Comments ===== */
.comments-section { margin: 56px 0; }
.comments-section h2 {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 18px;
    color: var(--text);
    margin: 0 0 24px;
    letter-spacing: -0.01em;
}
.comment {
    border-left: 2px solid var(--border);
    padding: 12px 0 12px 18px;
    margin-bottom: 24px;
}
.comment.is-author {
    border-left-color: var(--accent);
}
.comment .meta {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted-soft);
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}
.comment .meta .name {
    font-weight: 600;
    color: var(--text);
    font-family: var(--sans);
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
}
.comment.is-author .meta .name { color: var(--accent); }
.comment .body { font-size: 15px; line-height: 1.6; }
.comment .body p:last-child { margin-bottom: 0; }
.comment .replies { margin-left: 18px; margin-top: 18px; }

/* New-comment form */
.comment-form {
    margin-top: 32px;
    padding: 22px 24px;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.comment-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 540px) { .comment-form .form-row { grid-template-columns: 1fr; } }
.comment-form label {
    display: block;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.comment-form input, .comment-form textarea {
    width: 100%;
    font-family: var(--sans);
    font-size: 15px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    color: var(--text);
}
.comment-form input:focus, .comment-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.comment-form textarea { min-height: 120px; resize: vertical; }
.comment-form button {
    font-family: var(--sans);
    font-weight: 500;
    font-size: 13px;
    background: var(--accent);
    color: white;
    border: 0;
    padding: 10px 22px;
    border-radius: 4px;
    cursor: pointer;
    letter-spacing: 0.02em;
}
.comment-form button:hover { filter: brightness(0.95); }
.comment-form .hint {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    margin-top: 8px;
    line-height: 1.5;
}
.comment-form .honeypot { position: absolute; left: -9999px; }

/* ===== Newsletter signup ===== */
.newsletter-card {
    margin: 56px 0;
    padding: 28px 30px;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.newsletter-card .label {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--accent);
    margin-bottom: 8px;
}
.newsletter-card h3 {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 20px;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}
.newsletter-card p {
    font-size: 14px;
    color: var(--muted);
    margin: 0 0 16px;
    line-height: 1.5;
}
.newsletter-card form { display: flex; gap: 8px; }
.newsletter-card input[type="email"] {
    flex: 1;
    font-family: var(--sans);
    font-size: 15px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
}
.newsletter-card input[type="email"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.newsletter-card button {
    font-family: var(--sans);
    font-weight: 500;
    font-size: 13px;
    background: var(--accent);
    color: white;
    border: 0;
    padding: 10px 18px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: 0.02em;
}
@media (max-width: 540px) {
    .newsletter-card form { flex-direction: column; }
}

/* ===== Search ===== */
.search-page input[type="search"] {
    width: 100%;
    font-family: var(--sans);
    font-size: 16px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 32px;
}
.search-page input[type="search"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ===== Tag pages ===== */
.tag-header { margin: 0 0 32px; }
.tag-header .label {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--accent);
    margin-bottom: 8px;
}
.tag-header h1 {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 28px;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}
.tag-header .count {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted-soft);
    letter-spacing: 0.04em;
}

/* ===== About page ===== */
.about-page h1 {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 28px;
    margin: 0 0 24px;
    letter-spacing: -0.01em;
}
.about-page p { margin: 0 0 1.1em; }
.about-page h2 {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--muted-soft);
    margin-top: 36px;
    margin-bottom: 14px;
}
.about-page .projects {
    list-style: none;
    padding: 0;
    margin: 16px 0;
}
.about-page .projects li {
    padding: 14px 0;
    border-top: 1px solid var(--border);
    font-size: 15px;
}
.about-page .projects li:last-child { border-bottom: 1px solid var(--border); }
.about-page .projects .name { font-weight: 600; color: var(--text); }
.about-page .projects .desc { color: var(--muted); font-size: 14px; margin-left: 8px; }

/* ===== Admin-only inline Edit/Delete pills (visible only when signed in) ===== */
.admin-edit-link, .admin-delete-btn {
    font-family: var(--mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 1px 7px;
    border-radius: 3px;
    font-weight: 500;
    cursor: pointer;
    background: white;
}
.admin-edit-link {
    color: var(--accent) !important;
    border: 1px solid var(--accent);
}
.admin-edit-link:hover {
    background: var(--accent);
    color: white !important;
    text-decoration: none;
}
.admin-delete-btn {
    color: #B91C1C;
    border: 1px solid #FCA5A5;
}
.admin-delete-btn:hover {
    background: #FEE2E2;
}
.admin-delete-form { display: inline; }

/* ===== Footer ===== */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 96px;
    padding: 36px 0 48px;
    color: var(--muted);
}
.footer-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 18px 32px;
    align-items: center;
}
.footer-left {
    display: flex;
    align-items: baseline;
    gap: 16px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.04em;
}
.footer-wordmark {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
}
.footer-wordmark .dot { color: var(--accent); }
.footer-right {
    display: flex;
    gap: 8px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.footer-right a { color: var(--muted); }
.footer-right a:hover { color: var(--accent); text-decoration: none; }
.footer-projects {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
    padding-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.04em;
}
.footer-projects .label {
    color: var(--muted-soft);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    margin-right: 8px;
}
.footer-projects a {
    color: var(--muted);
    font-family: var(--sans);
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
}
.footer-projects a:hover { color: var(--accent); text-decoration: none; }
@media (max-width: 720px) {
    .footer-inner { grid-template-columns: 1fr; text-align: center; }
    .footer-left, .footer-right { justify-content: center; }
}

/* ===== Back link ===== */
.back-link {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    display: inline-block;
    margin-bottom: 32px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.back-link:hover { color: var(--accent); text-decoration: none; }
