/*
Theme Name: Knuckledust Chronicles
Theme URI: https://knuckledustchronicles.com
Author: Frank Robinson
Description: Old West meets Modern Tech - a personal blog theme for all things Frank, Suno, AI, HomeLab and beyond.
Version: 2.0
License: GNU General Public License v2 or later
Text Domain: knuckledust
*/

/* Self-hosted Google Fonts */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/inter-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Special Elite';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/special-elite-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Special Elite';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/special-elite-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --color-bg: #1a1714;
    --color-bg-card: #252017;
    --color-bg-header: #0f0d0a;
    --color-text: #d4c9b8;
    --color-text-muted: #8a7e6e;
    --color-heading: #e8d5b5;
    --color-accent: #c87533;
    --color-accent-hover: #e09040;
    --color-border: #3a3228;
    --color-parchment: #f5e6c8;
    --color-gold: #d4a04a;
    --font-heading: 'Special Elite', cursive;
    --font-body: 'Inter', -apple-system, sans-serif;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    z-index: 999;
    padding: 0.5rem 1rem;
    background: var(--color-accent);
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.9rem;
    text-decoration: none;
    border-radius: 0 0 4px 0;
}
.skip-link:focus {
    left: 0;
    top: 0;
    color: #fff;
}

a.kd-autolink {
    border-bottom: 1px dotted var(--color-accent);
}
a.kd-autolink:hover {
    border-bottom-style: solid;
}

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

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    font-size: 17px;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%233a3228' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { color: var(--color-accent-hover); }

img { max-width: 100%; height: auto; }

/* ── Header ──────────────────────────────── */

.site-header {
    background: var(--color-bg-header);
    border-bottom: 3px solid var(--color-accent);
    padding: 0.8rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(15, 13, 10, 0.95);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.site-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--color-parchment);
    letter-spacing: 1px;
    text-align: center;
}

body.home .site-header .site-title,
body.blog .site-header .site-title {
    display: none;
}

.site-title a { color: var(--color-parchment); }
.site-title a:hover { color: var(--color-accent); }

.site-tagline {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.1rem;
}

/* ── Navigation ──────────────────────────── */

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

.main-nav a {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.3rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.main-nav a:hover,
.main-nav .current-menu-item a {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

/* ── Hero Banner ─────────────────────────── */

.hero-banner {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-bottom: 4px solid var(--color-accent);
    background: var(--color-bg-header);
    text-align: center;
}

.hero-banner img {
    width: 100%;
    display: block;
    height: auto;
}

.hero-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(transparent, var(--color-bg));
    pointer-events: none;
}

/* ── Category Filter Pills ───────────────── */

.category-pills {
    margin: 0 0 1.5rem 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.category-pills-label {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-right: 0.5rem;
}

.category-pill {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--color-parchment);
    background: var(--color-bg-card);
    border: 1px solid var(--color-accent);
    padding: 0.3rem 1rem;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
    position: relative;
}

.category-pill:hover {
    background: var(--color-accent);
    color: var(--color-bg);
    box-shadow: 0 0 12px rgba(200, 117, 51, 0.3);
}

.category-pill::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border: 1px dashed var(--color-accent);
    border-radius: 3px;
    opacity: 0.4;
    pointer-events: none;
}

.category-pills-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-card);
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
    font-size: 0.9rem;
    width: 2rem;
    height: 1.8rem;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.category-pills-toggle:hover,
.category-pills-toggle.is-active {
    background: var(--color-accent);
    color: var(--color-bg);
}

.category-pills-overflow {
    display: none;
    flex-basis: 100%;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding-top: 0.4rem;
}

.category-pills-overflow.is-visible {
    display: flex;
}

/* ── Decorative Divider ─────────────────── */

.divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin: 2.5rem 0;
    color: var(--color-accent);
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--color-accent), transparent);
}

.divider-star {
    font-size: 1.8rem;
    line-height: 1;
    text-shadow: 0 0 10px rgba(200, 117, 51, 0.5);
}

/* ── Main Content ────────────────────────── */

.site-content {
    max-width: min(1200px, 100%);
    margin: 0 auto;
    padding: 2rem 2rem 3rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 3rem;
}

/* ── Featured Post (first post) ──────────── */

.post-featured {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 2rem;
    min-height: 400px;
    display: flex;
    align-items: flex-end;
    border: 2px solid var(--color-accent);
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 30px rgba(200, 117, 51, 0.1);
}

.post-featured:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 40px rgba(200, 117, 51, 0.2);
}

.post-featured-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.post-featured:hover .post-featured-bg {
    transform: scale(1.03);
}

.post-featured-overlay {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 3rem 2rem 2rem;
    background: linear-gradient(transparent, rgba(15, 13, 10, 0.95));
}

.post-featured-badge {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--color-bg);
    background: var(--color-accent);
    padding: 0.35rem 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(200, 117, 51, 0.4);
}

.post-featured-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: var(--color-parchment);
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.post-featured-title a { color: var(--color-parchment); }
.post-featured-title a:hover { color: var(--color-accent); }

.post-featured-excerpt {
    color: var(--color-text);
    font-size: 1rem;
    margin-bottom: 1rem;
    max-width: 600px;
}

.post-featured-meta {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.post-featured-nothumb {
    background: linear-gradient(135deg, #2a2015 0%, #1a1510 50%, #251a10 100%);
    min-height: auto;
    display: block;
    padding: 3rem 2.5rem 2.5rem;
    position: relative;
    overflow: hidden;
}

.post-featured-nothumb::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 10% 0%, rgba(200, 117, 51, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 100%, rgba(200, 117, 51, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.post-featured-nothumb::after {
    content: '\201C';
    position: absolute;
    top: -1.5rem;
    right: 1.5rem;
    font-family: var(--font-heading);
    font-size: 16rem;
    color: var(--color-accent);
    opacity: 0.08;
    line-height: 1;
    pointer-events: none;
}

.post-featured-nothumb .post-featured-overlay {
    position: relative;
    z-index: 2;
    background: none;
    padding: 0;
}

.post-featured-nothumb .post-featured-title {
    font-size: 2.5rem;
}

.post-featured-nothumb .post-featured-excerpt {
    font-size: 1.1rem;
    max-width: 700px;
    color: var(--color-text);
}

/* ── Section Label ────────────────────────── */

.section-label {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--color-accent), transparent);
}

/* ── Post Grid ───────────────────────────── */

.posts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* ── Post Cards ──────────────────────────── */

.post-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.3s;
    position: relative;
}

.post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.post-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 20px rgba(200, 117, 51, 0.1);
}

.post-card:hover::before {
    opacity: 1;
}

.post-card-no-thumb {
    padding-top: 1rem;
    border-top: 3px solid var(--color-accent);
}

.post-card-no-thumb .post-card-content {
    padding-top: 1.5rem;
}

.post-card-no-thumb .post-card-title {
    font-size: 1.4rem;
}

.post-card-image-wrap {
    position: relative;
    overflow: hidden;
}

.post-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.5s;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), 85% 100%, 60% calc(100% - 8px), 30% 100%, 0 calc(100% - 6px));
}

.post-card:hover .post-card-image {
    transform: scale(1.05);
}

.post-card-category {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    font-family: var(--font-heading);
    font-size: 0.65rem;
    color: var(--color-parchment);
    background: rgba(15, 13, 10, 0.85);
    border: 1px solid var(--color-accent);
    padding: 0.15rem 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 2;
}

.post-card-content {
    padding: 1.25rem;
}

.post-card-meta {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.post-card-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--color-heading);
    margin-bottom: 0.6rem;
    line-height: 1.3;
}

.post-card-title a { color: var(--color-heading); }
.post-card-title a:hover { color: var(--color-accent); }

.post-card-excerpt {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.read-more {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--color-accent);
    padding-bottom: 2px;
    transition: all 0.2s;
}

.read-more:hover {
    padding-bottom: 4px;
}

/* ── Search ──────────────────────────────── */

.search-form {
    display: flex;
    max-width: 400px;
}

.search-form input[type="search"] {
    flex: 1;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 0.5rem 1rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    border-radius: 4px 0 0 4px;
}

.search-form input[type="submit"] {
    background: var(--color-accent);
    color: var(--color-bg);
    border: none;
    padding: 0.5rem 1rem;
    font-family: var(--font-heading);
    cursor: pointer;
    border-radius: 0 4px 4px 0;
    transition: background 0.2s;
}

.search-form input[type="submit"]:hover {
    background: var(--color-accent-hover);
}

/* ── Single Post ─────────────────────────── */

.single-post-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--color-border);
    position: relative;
}

.single-post-header::after {
    content: '\2726';
    position: absolute;
    bottom: -0.7rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-bg);
    padding: 0 1rem;
    color: var(--color-accent);
    font-size: 1rem;
}

.single-post-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--color-parchment);
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.single-post-meta {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.single-post-featured {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin-bottom: 2rem;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 20px), 80% 100%, 50% calc(100% - 12px), 20% 100%, 0 calc(100% - 16px));
}

/* Drop cap for first paragraph */
.single-post-content > p:first-child::first-letter {
    float: left;
    font-family: var(--font-heading);
    font-size: 4.5rem;
    line-height: 0.8;
    padding: 0.1rem 0.5rem 0 0;
    color: var(--color-accent);
    font-weight: bold;
}

.single-post-content {
    font-size: 1.05rem;
    line-height: 1.8;
}

.single-post-content h2,
.single-post-content h3,
.single-post-content h4 {
    font-family: var(--font-heading);
    color: var(--color-heading);
    margin: 2rem 0 1rem;
}

.single-post-content h2 { font-size: 1.8rem; }
.single-post-content h3 { font-size: 1.4rem; }

.single-post-content p { margin-bottom: 1.25rem; }

.single-post-content blockquote {
    border-left: 4px solid var(--color-accent);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: var(--color-bg-card);
    font-style: italic;
    color: var(--color-parchment);
    position: relative;
}

.single-post-content blockquote::before {
    content: '\201C';
    font-family: var(--font-heading);
    font-size: 4rem;
    position: absolute;
    top: -0.5rem;
    left: 0.5rem;
    color: var(--color-accent);
    opacity: 0.3;
    line-height: 1;
}

.single-post-content pre {
    background: #0d0b08;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 1.25rem;
    overflow-x: auto;
    font-size: 0.9rem;
    margin: 1.5rem 0;
}

.single-post-content code {
    background: #0d0b08;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
}

.single-post-content pre code {
    background: none;
    padding: 0;
}

/* Syntax highlighting — Knuckledust warm palette */
.single-post-content .hljs { color: #d4c5a9; background: #0d0b08; }
.single-post-content .hljs-keyword,
.single-post-content .hljs-selector-tag,
.single-post-content .hljs-type { color: #c87533; }
.single-post-content .hljs-string,
.single-post-content .hljs-attr { color: #d4a545; }
.single-post-content .hljs-comment,
.single-post-content .hljs-quote { color: #6e6456; font-style: italic; }
.single-post-content .hljs-number,
.single-post-content .hljs-literal { color: #a67b5b; }
.single-post-content .hljs-title,
.single-post-content .hljs-function .hljs-title { color: #e8d5b7; }
.single-post-content .hljs-built_in { color: #b8860b; }
.single-post-content .hljs-variable,
.single-post-content .hljs-template-variable { color: #cc9966; }
.single-post-content .hljs-tag { color: #c87533; }
.single-post-content .hljs-name { color: #c87533; }
.single-post-content .hljs-attribute { color: #d4a545; }
.single-post-content .hljs-symbol,
.single-post-content .hljs-bullet { color: #d4a545; }
.single-post-content .hljs-meta { color: #8a7e6e; }
.single-post-content .hljs-addition { color: #5a8a5a; }
.single-post-content .hljs-deletion { color: #a85454; }

.single-post-content ul,
.single-post-content ol {
    margin: 1rem 0 1.5rem 1.5rem;
}

.single-post-content li {
    margin-bottom: 0.5rem;
}

.post-tags {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.post-tags a {
    display: inline-block;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    padding: 0.25rem 0.75rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-family: var(--font-heading);
    margin: 0 0.25rem 0.5rem 0;
    transition: all 0.2s;
}

.post-tags a:hover {
    border-color: var(--color-accent);
    background: var(--color-bg-card);
}

/* ── Sidebar ─────────────────────────────── */

.sidebar .widget {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.sidebar .widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent), var(--color-gold), var(--color-accent));
}

/* Widget headings */
.sidebar .widget-title,
.sidebar .wp-block-heading {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--color-parchment);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--color-border);
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar .wp-block-heading::before {
    content: '\2726';
    color: var(--color-accent);
    font-size: 0.8rem;
}

/* Search widget */
.sidebar .wp-block-search__label {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--color-parchment);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.75rem;
    display: block;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--color-border);
}

.sidebar .wp-block-search__label::before {
    content: '\2726';
    color: var(--color-accent);
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.sidebar .wp-block-search__inside-wrapper {
    display: flex;
    gap: 0;
}

.sidebar .wp-block-search__input {
    flex: 1;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-right: none;
    color: var(--color-text);
    padding: 0.6rem 0.75rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    border-radius: 4px 0 0 4px;
    transition: border-color 0.2s;
}

.sidebar .wp-block-search__input:focus {
    border-color: var(--color-accent);
    outline: none;
}

.sidebar .wp-block-search__input::placeholder {
    color: var(--color-text-muted);
}

.sidebar .wp-block-search__button {
    background: var(--color-accent);
    color: var(--color-bg);
    border: none;
    padding: 0.6rem 1rem;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 0 4px 4px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: background 0.2s;
}

.sidebar .wp-block-search__button:hover {
    background: var(--color-accent-hover);
}

/* Post lists (Recent Posts, Archives) */
.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar ul li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--color-border);
    position: relative;
    padding-left: 1rem;
}

.sidebar ul li::before {
    content: '\203A';
    position: absolute;
    left: 0;
    color: var(--color-accent);
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1.5;
}

.sidebar ul li:last-child { border-bottom: none; }

.sidebar ul li a {
    color: var(--color-text);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.sidebar ul li a:hover {
    color: var(--color-accent);
    padding-left: 0.25rem;
}

/* Recent Comments */
.sidebar .wp-block-latest-comments {
    padding: 0;
    margin: 0;
}

.sidebar .wp-block-latest-comments__comment {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0;
}

.sidebar .wp-block-latest-comments__comment:last-child {
    border-bottom: none;
}

.sidebar .wp-block-latest-comments__comment-author {
    color: var(--color-parchment);
    font-family: var(--font-heading);
    font-size: 0.85rem;
}

.sidebar .wp-block-latest-comments__comment-link {
    color: var(--color-accent);
    font-size: 0.85rem;
}

.sidebar .no-comments {
    color: var(--color-text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

/* Categories with count badges */
.sidebar .wp-block-categories li {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Inner wrapper reset */
.sidebar .wp-block-group__inner-container {
    padding: 0;
    margin: 0;
}

/* ── Pagination ──────────────────────────── */

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2.5rem;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: var(--font-heading);
    font-size: 0.9rem;
}

.pagination a:hover {
    border-color: var(--color-accent);
}

.pagination .current {
    background: var(--color-accent);
    color: var(--color-bg);
    border-color: var(--color-accent);
}

/* ── Footer ──────────────────────────────── */

.site-footer {
    background: var(--color-bg-header);
    border-top: 3px solid var(--color-accent);
    padding: 2rem;
    text-align: center;
    margin-top: 3rem;
}

.site-footer p {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ── Comments ────────────────────────────── */

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

.comments-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--color-heading);
    margin-bottom: 1.5rem;
}

.comment-list {
    list-style: none;
}

.comment-body {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.comment-author {
    font-family: var(--font-heading);
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

.comment-respond input,
.comment-respond textarea {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 0.5rem 1rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    border-radius: 4px;
    width: 100%;
    margin-bottom: 0.75rem;
}

.comment-respond input[type="submit"] {
    width: auto;
    background: var(--color-accent);
    color: var(--color-bg);
    font-family: var(--font-heading);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    padding: 0.6rem 1.5rem;
}

/* ── Page ────────────────────────────────── */
/* Pages reuse .single-post styles. Disable drop cap on pages. */

.page .single-post-content > p:first-child::first-letter {
    float: none;
    font-size: inherit;
    line-height: inherit;
    padding: 0;
    color: inherit;
    font-weight: inherit;
}

/* ── No Posts State ──────────────────────── */

.no-posts {
    text-align: center;
    padding: 4rem 2rem;
    font-family: var(--font-heading);
    color: var(--color-text-muted);
    font-size: 1.2rem;
}

/* ── Responsive ──────────────────────────── */

@media (max-width: 900px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .single-post {
        min-width: 0;
    }

    .single-post-title {
        font-size: 1.8rem;
    }

    .site-title {
        font-size: 1.2rem;
        text-align: center;
    }

    .hero-banner img {
        width: 100%;
    }

    .post-featured {
        min-height: 280px;
    }

    .post-featured-title {
        font-size: 1.6rem;
    }

    .category-pills {
        justify-content: center;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Portfolio / Projects ───────────────── */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.project-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.3s, transform 0.2s;
}

.project-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

.project-card-image-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.project-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.project-card:hover .project-card-image {
    transform: scale(1.03);
}

.project-card-status {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-family: var(--font-heading);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    background: rgba(15, 13, 10, 0.85);
}

.project-status-active, .project-status-inline.project-status-active { color: #5cb85c; }
.project-status-wip, .project-status-inline.project-status-wip { color: #f0ad4e; }
.project-status-archived, .project-status-inline.project-status-archived { color: #8a7e6e; }
.project-status-completed, .project-status-inline.project-status-completed { color: #5bc0de; }

.project-card-content {
    padding: 1.25rem;
}

.project-card-meta {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.project-type-icon {
    margin-right: 0.3rem;
}

.project-card-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.project-card-title a {
    color: var(--color-parchment);
    text-decoration: none;
}

.project-card-title a:hover {
    color: var(--color-accent);
}

.project-card-excerpt {
    font-size: 0.9rem;
    color: var(--color-text);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.project-tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
    align-items: center;
}

.tech-tag {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-accent);
    background: rgba(200, 117, 51, 0.12);
    border: 1px solid rgba(200, 117, 51, 0.3);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.tech-tag:hover {
    background: rgba(200, 117, 51, 0.25);
    border-color: var(--color-accent);
    color: var(--color-accent-hover);
}

.project-card-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.project-link {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    padding: 0.35rem 0.8rem;
    border-radius: 3px;
    transition: background 0.2s, color 0.2s;
}

.project-link-details {
    color: var(--color-parchment);
    background: var(--color-border);
}

.project-link-details:hover {
    background: var(--color-accent);
    color: #fff;
}

.project-link-github {
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.project-link-github:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.project-link-demo {
    color: var(--color-accent);
    border: 1px solid var(--color-accent);
}

.project-link-demo:hover {
    background: var(--color-accent);
    color: #fff;
}

/* Single Project */

.project-action-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.project-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    transition: background 0.2s, border-color 0.2s;
}

.project-action-github {
    color: var(--color-parchment);
    background: #333;
    border: 1px solid #555;
}

.project-action-github:hover {
    background: #444;
    border-color: var(--color-accent);
    color: #fff;
}

.project-action-github svg {
    flex-shrink: 0;
}

.project-action-demo {
    color: #fff;
    background: var(--color-accent);
    border: 1px solid var(--color-accent);
}

.project-action-demo:hover {
    background: var(--color-accent-hover);
}

.project-back-link {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.project-back-link a {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-accent);
    text-decoration: none;
}

.project-back-link a:hover {
    color: var(--color-accent-hover);
}

/* No drop cap on project pages */
.single-project .single-post-content > p:first-child::first-letter {
    float: none;
    font-size: inherit;
    line-height: inherit;
    padding: 0;
    color: inherit;
    font-weight: inherit;
}

/* Give project pages more breathing room for wide tables */
main.single-project {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* ── Post Navigation ────────────────────── */

.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.post-nav-prev,
.post-nav-next {
    flex: 1;
    min-width: 0;
}

.post-nav-next {
    text-align: right;
}

.post-nav a {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--color-text);
    transition: color 0.2s;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-nav a:hover {
    color: var(--color-accent);
}

/* ── Related Posts ───────────────────────── */

.related-posts {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.related-post-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    transition: all 0.2s;
    text-decoration: none;
}

.related-post-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.related-post-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--color-heading);
    line-height: 1.3;
}

.related-post-card:hover .related-post-title {
    color: var(--color-accent);
}

.related-post-date {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .related-posts-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Footer Links ───────────────────────── */

.footer-links {
    margin-top: 0.5rem;
}

.footer-rss {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.2s;
}

.footer-rss:hover {
    color: var(--color-accent);
}

/* ── Uses / Stack Page ──────────────────── */

.uses-section {
    margin-bottom: 3rem;
}

.uses-section-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.uses-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--color-accent), transparent);
}

.uses-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    transition: border-color 0.2s;
}

.uses-item:hover {
    border-color: var(--color-accent);
}

.uses-item-name {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--color-parchment);
    margin-bottom: 0.25rem;
}

.uses-item-desc {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.uses-item-why {
    font-size: 0.8rem;
    color: var(--color-accent);
    font-style: italic;
    margin-top: 0.25rem;
}

.uses-item p {
    margin: 0;
}

.uses-intro {
    font-size: 1.05rem;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    line-height: 1.7;
}

h3.uses-section-title {
    font-size: 1.1rem;
    margin-top: 1.5rem;
}

/* ── Reading Progress Bar ───────────────── */

.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--color-accent), var(--color-gold));
    z-index: 9999;
    transition: width 0.1s linear;
    box-shadow: 0 0 8px rgba(200, 117, 51, 0.4);
}

/* ── Hamburger Menu ─────────────────────── */

.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 5px;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-parchment);
    transition: all 0.3s;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .header-inner {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        position: relative;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(15, 13, 10, 0.97);
        border-bottom: 2px solid var(--color-accent);
        z-index: 200;
    }

    .main-nav.open {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: center;
        padding: 1rem 0;
        gap: 1rem;
    }
}

/* ── Theme Toggle ───────────────────────── */

.theme-toggle {
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-parchment);
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-size: 1.1rem;
    line-height: 1;
    transition: all 0.2s;
}

.theme-toggle:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* ── Light Mode ─────────────────────────── */

html.light-mode {
    --color-bg: #f0e6d3;
    --color-bg-card: #e8dcc8;
    --color-bg-header: #2a2218;
    --color-text: #3a3228;
    --color-text-muted: #6b5e4e;
    --color-heading: #2a1f14;
    --color-accent: #b56820;
    --color-accent-hover: #d47a2a;
    --color-border: #c8b89a;
    --color-parchment: #2a1f14;
    --color-gold: #8a6a1e;
}

html.light-mode body {
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c8b89a' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

html.light-mode .site-header {
    background: rgba(42, 34, 24, 0.97);
}

html.light-mode .main-nav {
    background: rgba(42, 34, 24, 0.97);
}

html.light-mode .site-header .site-title a,
html.light-mode .site-header .main-nav a,
html.light-mode .site-header .theme-toggle {
    color: #f5e6c8;
}

html.light-mode .site-header .hamburger span {
    background: #f5e6c8;
}

html.light-mode .category-pill {
    color: var(--color-heading);
    border-color: var(--color-accent);
}

html.light-mode .sidebar .widget-title,
html.light-mode .sidebar .wp-block-heading,
html.light-mode .sidebar .wp-block-search__label {
    color: var(--color-heading);
}

html.light-mode .post-featured-title a,
html.light-mode .post-featured-badge {
    color: #f5e6c8;
}

html.light-mode .post-featured-overlay {
    background: linear-gradient(transparent, rgba(15, 13, 10, 0.95));
}

html.light-mode .post-card-category {
    color: #f5e6c8;
}

html.light-mode .post-card-image {
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), 85% 100%, 60% calc(100% - 8px), 30% 100%, 0 calc(100% - 6px));
}

html.light-mode .single-post-content pre,
html.light-mode .single-post-content code {
    background: #2a2218;
    color: #d4c9b8;
}

html.light-mode .single-post-content pre code {
    background: none;
}

/* Keyboard focus indicators */
*:focus-visible {
    outline: 2px solid #c87533;
    outline-offset: 2px;
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
    outline: none;
}

/* -------------------------------------------------------------
   Script Hub — kd_script CPT styles
   ------------------------------------------------------------- */

.script-card .post-card-content {
    padding: 1.25rem;
}

.script-language {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: var(--color-ink, #2b2420);
    color: var(--color-parchment, #f5e6c8);
    vertical-align: middle;
}

.script-lang-bash       { background: #4eaa25; color: #fff; }
.script-lang-powershell { background: #2f72b6; color: #fff; }
.script-lang-python     { background: #3776ab; color: #fff; }
.script-lang-sql        { background: #cc6600; color: #fff; }
.script-lang-batch      { background: #555;    color: #fff; }
.script-lang-perl       { background: #39457e; color: #fff; }
.script-lang-ruby       { background: #cc342d; color: #fff; }
.script-lang-javascript { background: #f1c40f; color: #1d2327; }
.script-lang-yaml       { background: #cb171e; color: #fff; }
.script-lang-dockerfile { background: #2496ed; color: #fff; }
.script-lang-text       { background: #888;    color: #fff; }

.script-lines {
    font-variant-numeric: tabular-nums;
    color: var(--color-muted, #6c6660);
}

.archive-header {
    margin-bottom: 1.5rem;
}

.archive-header .archive-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 2rem;
    margin: 0 0 0.3rem;
    color: var(--color-accent, #c87533);
}

.archive-header .archive-description {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-muted, #6c6660);
    margin: 0 0 0.5rem;
}

/* Copy-to-clipboard button on code blocks */
.single-post-content pre {
    position: relative;
}
.kd-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(200, 117, 51, 0.9);
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.single-post-content pre:hover .kd-copy-btn,
.kd-copy-btn:focus {
    opacity: 1;
}
.kd-copy-btn:hover {
    background: var(--color-accent, #c87533);
}

.related-scripts {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--color-border, #d4c7a8);
}
.related-scripts-heading {
    color: var(--color-accent, #c87533);
    font-size: 1.3rem;
    margin: 0 0 1rem;
}
