/* ==========================================================================
   Internet Folklore — Ghost Theme Stylesheet
   "The Folklorist" — A library card catalog for the internet age.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties — "The Folklorist" Palette
   -------------------------------------------------------------------------- */

:root {
    /* Palette */
    --aged-paper:      #F4ECD8;
    --card-stock:      #FFF8F0;
    --deep-ink:        #1a1a2e;
    --body-text:       #2C1810;
    --pencil:          #8B8680;
    --stamp-red:       #C23B22;
    --catalog-blue:    #2F5496;
    --catalog-blue-dark: #1E3A6B;
    --dewey-green:     #4A7C59;
    --date-purple:     #7B4B94;
    --manila:          #E8D5B5;
    --card-line:       #D4C5A9;
    --highlight-gold:  #FFCC33;

    /* Functional aliases */
    --color-bg:        var(--aged-paper);
    --color-card:      var(--card-stock);
    --color-heading:   var(--deep-ink);
    --color-text:      var(--body-text);
    --color-muted:     var(--pencil);
    --color-link:      var(--catalog-blue);
    --color-link-hover: var(--catalog-blue-dark);
    --color-border:    var(--card-line);
    --color-accent:    var(--stamp-red);

    /* Typography */
    --font-serif:     Georgia, "Times New Roman", Times, serif;
    --font-sans:      system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --font-mono:      "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;

    /* Sizing */
    --content-width:  720px;
    --wide-width:     900px;
}


/* --------------------------------------------------------------------------
   2. Reset & Base
   -------------------------------------------------------------------------- */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 17px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-text);
    background-color: var(--color-bg);
    /* Subtle paper grain */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
}

::selection {
    background: rgba(194, 59, 34, 0.15);
    color: var(--color-heading);
}

::-moz-selection {
    background: rgba(194, 59, 34, 0.15);
    color: var(--color-heading);
}

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

a {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: transparent;
    transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

a:hover {
    color: var(--color-link-hover);
    text-decoration-color: var(--stamp-red);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    color: var(--color-heading);
    line-height: 1.3;
    margin: 0 0 0.5em;
}

p {
    margin: 0 0 1.4em;
}

blockquote {
    margin: 1.5em 0;
    padding: 0.8em 1.2em;
    border-left: 3px solid var(--stamp-red);
    background: var(--manila);
    font-style: italic;
    color: var(--color-muted);
}

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

hr {
    border: none;
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        var(--card-line) 0px,
        var(--card-line) 8px,
        transparent 8px,
        transparent 12px
    );
    margin: 2.5em auto;
    max-width: 200px;
}

pre {
    background: var(--manila);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 1em;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.5;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--manila);
    padding: 0.15em 0.35em;
    border-radius: 2px;
}

pre code {
    background: none;
    padding: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
}

th, td {
    padding: 0.5em 0.75em;
    border: 1px solid var(--color-border);
    text-align: left;
}

th {
    background: var(--manila);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}


/* --------------------------------------------------------------------------
   2b. Focus Styles
   -------------------------------------------------------------------------- */

:focus-visible {
    outline: 2px solid var(--stamp-red);
    outline-offset: 2px;
}

a:focus-visible {
    outline: 2px solid var(--stamp-red);
    outline-offset: 2px;
    text-decoration-color: var(--stamp-red);
}

.site-nav a:focus-visible {
    outline: 2px solid var(--stamp-red);
    outline-offset: 2px;
    border-color: var(--stamp-red);
}

.tag-chip:focus-visible {
    outline: 2px solid var(--stamp-red);
    outline-offset: 2px;
}


/* --------------------------------------------------------------------------
   2c. Skip Link
   -------------------------------------------------------------------------- */

.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 1000;
    padding: 0.5em 1em;
    background: var(--stamp-red);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-decoration: none;
    border-radius: 0 0 3px 3px;
}

.skip-link:focus {
    top: 0;
    color: #fff;
    text-decoration-color: transparent;
}


/* --------------------------------------------------------------------------
   3. Layout
   -------------------------------------------------------------------------- */

.site-main {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 1.25rem 3rem;
    position: relative;
    z-index: 1;
}


/* --------------------------------------------------------------------------
   4. Site Header — Catalog card header with red ruled line
   -------------------------------------------------------------------------- */

.site-header {
    text-align: center;
    padding: 2.5rem 1.25rem 0;
    margin-bottom: 2rem;
    position: relative;
}

.site-header::after {
    content: "";
    display: block;
    margin: 1.25rem auto 0;
    max-width: var(--content-width);
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--stamp-red) 15%,
        var(--stamp-red) 85%,
        transparent 100%
    );
    opacity: 0.5;
}

.site-title-link {
    text-decoration: none;
}

.site-title-link:hover {
    background: none;
    text-decoration-color: transparent;
}

.site-title {
    font-family: var(--font-serif);
    font-size: 2.6rem;
    color: var(--color-heading);
    margin: 0 0 0.15rem;
    letter-spacing: -0.02em;
    font-weight: 700;
    display: block;
}

.site-title-link:hover .site-title {
    color: var(--stamp-red);
}

.site-tagline {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-style: italic;
    color: var(--color-muted);
    margin: 0 0 0.6rem;
    letter-spacing: 0.01em;
}

.site-nav {
    margin-top: 0.75rem;
}

.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
}

.site-nav li {
    margin: 0;
}

/* Catalog drawer label styling */
.site-nav a {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--body-text);
    text-decoration: none;
    padding: 0.35em 0.9em;
    border: 1px solid var(--card-line);
    border-bottom: 2px solid var(--card-line);
    background: var(--card-stock);
    margin: 0 0.15rem;
    border-radius: 3px 3px 0 0;
    transition: background 0.15s ease, border-color 0.15s ease;
    display: inline-block;
}

.site-nav a:hover {
    background: var(--manila);
    border-color: var(--stamp-red);
    color: var(--stamp-red);
    text-decoration: none;
    text-decoration-color: transparent;
}


/* --------------------------------------------------------------------------
   5. Home Page — Library Entrance, Staff Picks, Card Catalog
   -------------------------------------------------------------------------- */

/* --- Library Entrance --- */
.library-entrance {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1.8rem 1.5rem 1.4rem;
    background: var(--color-card);
    border: 1px solid var(--card-line);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    position: relative;
}

/* Red top stripe */
.library-entrance::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stamp-red);
    opacity: 0.7;
    border-radius: 2px 2px 0 0;
}

/* Faint left margin rule — like a real index card */
.library-entrance::after {
    content: "";
    position: absolute;
    top: 3px;
    bottom: 0;
    left: 2.2rem;
    width: 1px;
    background: var(--stamp-red);
    opacity: 0.18;
}

.entrance-greeting {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-heading);
    margin: 0 0 0.4rem;
    line-height: 1.3;
}

.entrance-invitation {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-style: italic;
    color: var(--color-muted);
    margin: 0 0 0.8rem;
}

.entrance-rule {
    border: none;
    height: 1px;
    background: var(--card-line);
    max-width: 120px;
    margin: 0 auto 0.8rem;
}

.entrance-hours {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-muted);
    margin: 0;
    letter-spacing: 0.02em;
}

/* --- Section Label (reusable) --- */
.section-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-muted);
    text-align: center;
    margin: 0 0 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-label::before,
.section-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--card-line);
}

/* --- Staff Picks / On Display --- */
.staff-picks {
    margin-bottom: 1.5rem;
}

.picks-shelf {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.pick-card {
    display: block;
    background: var(--color-card);
    border: 2px solid var(--highlight-gold);
    border-radius: 2px;
    padding: 1.2rem 1.1rem;
    text-decoration: none;
    color: inherit;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Gold gradient top stripe */
.pick-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--highlight-gold), var(--stamp-red), var(--highlight-gold));
    border-radius: 2px 2px 0 0;
}

.pick-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-decoration: none;
    text-decoration-color: transparent;
    color: inherit;
}

.pick-tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dewey-green);
    margin-bottom: 0.4rem;
}

.pick-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-heading);
    line-height: 1.35;
    margin: 0 0 0.4rem;
}

.pick-card:hover .pick-title {
    color: var(--catalog-blue);
}

.pick-excerpt {
    font-size: 0.82rem;
    color: var(--color-muted);
    line-height: 1.5;
    margin: 0;
}

/* --- Card Catalog Cabinet --- */
.catalog-cabinet {
    margin-bottom: 1.5rem;
    padding: 1.2rem;
    background: var(--manila);
    border: 1px solid var(--card-line);
    border-radius: 3px;
    box-shadow:
        0 2px 0 var(--card-line),
        0 4px 0 rgba(0,0,0,0.04);
}

.cabinet-drawers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

.cabinet-drawer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.7rem;
    background: var(--color-card);
    border: 1px solid var(--card-line);
    border-bottom: 3px solid var(--card-line);
    border-radius: 2px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.cabinet-drawer:hover {
    border-color: var(--dewey-green);
    background: rgba(74, 124, 89, 0.06);
    text-decoration: none;
    text-decoration-color: transparent;
    color: inherit;
}

.drawer-label {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--body-text);
}

.cabinet-drawer:hover .drawer-label {
    color: var(--dewey-green);
}

.drawer-count {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-muted);
    background: var(--manila);
    padding: 0.1em 0.4em;
    border-radius: 2px;
    min-width: 1.4em;
    text-align: center;
}

.tag-chip {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    padding: 0.2em 0.55em;
    margin: 0.2em 0.12em;
    background: var(--dewey-green);
    color: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 2px;
    text-decoration: none;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.tag-chip:hover {
    transform: scale(0.96);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
    text-decoration: none;
    text-decoration-color: transparent;
    color: #fff;
}

.tag-count {
    font-size: 0.65rem;
    opacity: 0.8;
    margin-left: 0.15em;
}


/* --------------------------------------------------------------------------
   6. Post Cards — Clean warm cards with personality in the details
   -------------------------------------------------------------------------- */

.post-feed {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.post-card {
    background: var(--color-card);
    border: 1px solid var(--card-line);
    border-radius: 2px;
    padding: 1.4rem 1.6rem;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Thin red top border — the one catalog-card nod */
.post-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--stamp-red);
    opacity: 0.65;
    border-radius: 2px 2px 0 0;
}

/* Hover: gentle lift */
.post-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

/* Featured post cards */
.post-card.featured {
    border-color: var(--highlight-gold);
    border-width: 2px;
}

.post-card.featured::before {
    background: linear-gradient(90deg, var(--stamp-red), var(--highlight-gold), var(--stamp-red));
}

.post-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.post-card-link:hover {
    background: none;
    text-decoration: none;
    text-decoration-color: transparent;
}

.post-card-header {
    margin-bottom: 0.4rem;
}

.post-card-subject {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--color-heading);
    line-height: 1.35;
    font-weight: 700;
}

.post-card-subject-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
    font-weight: 400;
}

.post-card-link:hover .post-card-subject {
    color: var(--catalog-blue);
}

.post-card-badges {
    display: inline;
}

.post-card-featured-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--highlight-gold);
    background: rgba(255, 204, 51, 0.15);
    border: 1.5px solid var(--highlight-gold);
    padding: 0.15em 0.5em;
    border-radius: 2px;
    margin-left: 0.5em;
    vertical-align: middle;
    white-space: nowrap;
    font-weight: 700;
}

.post-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    margin-bottom: 0.6rem;
}

.meta-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
}

.meta-item {
    font-size: 0.85rem;
    color: var(--color-muted);
}

.mono {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* Date text — clean purple mono */
.date-text {
    color: var(--date-purple);
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.reading-time {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--color-muted);
}

.post-card-excerpt {
    font-size: 0.92rem;
    color: var(--color-muted);
    line-height: 1.55;
    margin: 0;
}


/* --------------------------------------------------------------------------
   7. Single Post
   -------------------------------------------------------------------------- */

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

.post-full-title {
    font-size: 2.2rem;
    margin-bottom: 0.6rem;
    font-weight: 700;
}

.post-full-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1.5rem;
}

.post-full-image {
    margin: 0 0 2rem;
}

.post-full-image img {
    border-radius: 3px;
    border: 1px solid var(--color-border);
}

.post-full-image figcaption {
    text-align: center;
    font-size: 0.82rem;
    font-family: var(--font-mono);
    color: var(--color-muted);
    margin-top: 0.5rem;
}

/* Table of Contents */
.post-toc {
    background: var(--manila);
    border: 1px solid var(--card-line);
    border-radius: 3px;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
}

.post-toc-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
    margin: 0 0 0.6rem;
}

.post-toc ol {
    margin: 0;
    padding: 0 0 0 1.25rem;
    list-style: none;
    counter-reset: toc;
}

.post-toc li {
    counter-increment: toc;
    margin: 0.3rem 0;
}

.post-toc li::before {
    content: counter(toc) ".";
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--color-muted);
    margin-right: 0.4em;
}

.post-toc a {
    font-family: var(--font-serif);
    font-size: 0.92rem;
    color: var(--color-link);
    text-decoration: none;
}

.post-toc a:hover {
    text-decoration: underline;
    text-decoration-color: var(--color-link);
}

.post-toc ol ol {
    padding-left: 1rem;
    counter-reset: toc-sub;
}

.post-toc ol ol li {
    counter-increment: toc-sub;
}

.post-toc ol ol li::before {
    content: counter(toc) "." counter(toc-sub);
}

/* Post content typography */
.post-full-content {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.75;
}

.post-full-content h2 {
    font-size: 1.5rem;
    margin-top: 2.5rem;
}

.post-full-content h3 {
    font-size: 1.25rem;
    margin-top: 2rem;
}

.post-full-content h4 {
    font-size: 1.1rem;
    margin-top: 1.8rem;
}

.post-full-content h5 {
    font-size: 1rem;
    margin-top: 1.5rem;
}

.post-full-content h6 {
    font-size: 0.92rem;
    margin-top: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.post-full-content a {
    color: var(--color-link);
}

.post-full-content img {
    border-radius: 3px;
    margin: 1.5em auto;
}

.post-full-content figure {
    margin: 1.5em auto;
}

.post-full-content figcaption {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-muted);
    margin-top: 0.5rem;
}

/* Catalog card divider for hr in post content */
.post-full-content hr {
    border: none;
    height: auto;
    background: none;
    max-width: 100%;
    margin: 2em 0;
    text-align: center;
    line-height: 1;
}

.post-full-content hr::before {
    content: "· · ·  ✦  · · ·";
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--card-line);
    letter-spacing: 0.2em;
}

/* Ghost bookmark & gallery cards */
.post-full-content .kg-bookmark-card,
.post-full-content .kg-gallery-card {
    margin: 1.5em 0;
}

.post-full-content .kg-bookmark-container {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
}

.post-full-content .kg-bookmark-container:hover {
    background: none;
    text-decoration: none;
    text-decoration-color: transparent;
}

.post-full-content .kg-bookmark-content {
    flex: 1;
    padding: 1em;
}

.post-full-content .kg-bookmark-title {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
}

.post-full-content .kg-bookmark-description {
    font-family: var(--font-sans);
    font-size: 0.82rem;
    color: var(--color-muted);
    margin-top: 0.3em;
}

.post-full-content .kg-bookmark-metadata {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-muted);
    margin-top: 0.5em;
}

.post-full-content .kg-bookmark-thumbnail {
    width: 160px;
    flex-shrink: 0;
}

.post-full-content .kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
}

/* Gallery */
.post-full-content .kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 0.75em;
}

.post-full-content .kg-gallery-row {
    display: flex;
    gap: 0.75em;
}

.post-full-content .kg-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
}

/* Back to top */
.back-to-top {
    display: block;
    text-align: center;
    margin-top: 2.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-muted);
    text-decoration: none;
}

.back-to-top:hover {
    color: var(--color-link);
    text-decoration-color: transparent;
}

/* Post footer */
.post-full-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 2px dashed var(--card-line);
}

.post-tags {
    margin: 1.25rem 0;
}

.post-tags .tag-chip {
    margin: 0.15em 0.1em;
}

.post-author-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--manila);
    border: 1px solid var(--card-line);
    border-radius: 3px;
}

.author-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    flex-shrink: 0;
}

.author-name {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1rem;
}

.author-bio {
    font-size: 0.88rem;
    color: var(--color-muted);
    margin: 0.25rem 0 0;
    line-height: 1.5;
}

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

.post-nav-prev,
.post-nav-next {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-decoration: none;
    max-width: 48%;
}

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

.post-nav-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
}

.post-nav-title {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    color: var(--color-link);
    line-height: 1.35;
}

.post-nav-prev:hover .post-nav-title,
.post-nav-next:hover .post-nav-title {
    color: var(--color-link-hover);
}

.post-nav-prev:hover .post-nav-label,
.post-nav-next:hover .post-nav-label {
    color: var(--stamp-red);
}


/* --------------------------------------------------------------------------
   8. Tag & Author Headers
   -------------------------------------------------------------------------- */

.tag-header,
.author-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

.tag-header-title {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.author-header-name {
    font-size: 1.8rem;
}

.tag-post-count {
    font-size: 0.82rem;
    color: var(--color-muted);
    margin: 0.5rem 0 0;
}

.tag-dewey-label {
    display: inline-block;
    background: var(--dewey-green);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.2em 0.6em;
    border-radius: 2px;
    margin-bottom: 0.5rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tag-header-description,
.author-header-bio {
    font-size: 1rem;
    color: var(--color-muted);
    max-width: 540px;
    margin: 0.5rem auto 0;
}

.author-header-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 0.75rem;
}

.author-header-location,
.author-header-link {
    display: block;
    font-size: 0.82rem;
    color: var(--color-muted);
    margin-top: 0.3rem;
}


/* --------------------------------------------------------------------------
   9. Archive Page
   -------------------------------------------------------------------------- */

.archive-list {
    margin-top: 1rem;
}

.archive-entry {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px dotted var(--color-border);
    transition: background 0.15s ease, padding-left 0.15s ease;
}

.archive-entry:hover {
    background: var(--manila);
    padding-left: 1rem;
}

.archive-date {
    flex-shrink: 0;
    font-size: 0.8rem;
    color: var(--date-purple);
    min-width: 6.5em;
    font-family: var(--font-mono);
}

.archive-title {
    font-family: var(--font-serif);
    font-size: 1rem;
    flex: 1;
}

.archive-tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--color-muted);
    flex-shrink: 0;
}


/* --------------------------------------------------------------------------
   10. Error Page — "Card Not Found"
   -------------------------------------------------------------------------- */

.error-page {
    text-align: center;
    padding: 3rem 0;
}

.error-code {
    font-family: var(--font-mono);
    font-size: 5rem;
    font-weight: 700;
    color: var(--stamp-red);
    line-height: 1;
    margin-bottom: 0.5rem;
    opacity: 0.7;
    letter-spacing: 0.1em;
}

.error-heading {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-heading);
    margin-bottom: 1.5rem;
}

.error-message {
    font-size: 1rem;
    color: var(--color-muted);
    max-width: 460px;
    margin: 0 auto 1.5rem;
}

.error-message p {
    margin-bottom: 0.6em;
}

.error-ascii pre {
    background: none;
    border: none;
    font-size: 0.85rem;
    color: var(--color-muted);
    display: inline-block;
    margin: 1rem auto;
    padding: 0;
    text-align: left;
    line-height: 1.3;
}

.error-link {
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.error-suggestions {
    margin-top: 2.5rem;
    text-align: left;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.error-suggestions-title {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
    margin-bottom: 0.75rem;
}

.error-suggestion-item {
    padding: 0.5rem 0;
    border-bottom: 1px dotted var(--color-border);
}

.error-suggestion-item a {
    font-family: var(--font-serif);
    font-size: 0.95rem;
}

.error-suggestion-date {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--date-purple);
    margin-left: 0.5rem;
}


/* --------------------------------------------------------------------------
   11. Pagination
   -------------------------------------------------------------------------- */

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

.pagination-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pagination-prev,
.pagination-next {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.pagination-info {
    font-size: 0.78rem;
    color: var(--color-muted);
}


/* --------------------------------------------------------------------------
   12. Site Footer
   -------------------------------------------------------------------------- */

.site-footer {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 2.5rem;
    text-align: center;
}

.footer-rule {
    border: none;
    height: 1px;
    background: var(--card-line);
    max-width: 100%;
    margin: 0 0 1.5rem;
}

/* Visitor counter */
.footer-visitor-counter {
    margin: 1rem 0;
}

.visitor-number {
    display: inline-block;
    background: #0a0a0a;
    color: #33ff33;
    border: 2px inset #444;
    padding: 0.2em 0.7em;
    font-weight: 700;
    letter-spacing: 0.12em;
    font-size: 0.85rem;
    min-width: 5em;
    text-align: center;
    font-family: var(--font-mono);
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.5);
}

.footer-nav ul {
    list-style: none;
    margin: 1rem 0;
    padding: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}

.footer-nav a {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
    text-decoration: none;
}

.footer-nav a:hover {
    color: var(--color-link);
    text-decoration: underline;
    text-decoration-color: var(--color-link);
    background: none;
}

.footer-meta {
    margin-top: 1rem;
}

.best-viewed {
    font-size: 0.72rem;
    color: var(--color-muted);
    margin-bottom: 0.3rem;
}

.powered-by {
    font-size: 0.72rem;
    color: var(--color-muted);
}

.powered-by a {
    color: var(--color-muted);
}

.powered-by a:hover {
    color: var(--color-link);
    text-decoration-color: var(--color-link);
}


/* --------------------------------------------------------------------------
   13. Decorative Elements
   -------------------------------------------------------------------------- */

.decorative-divider {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--card-line);
    text-align: center;
    margin: 1rem 0;
    letter-spacing: 0.15em;
    user-select: none;
}


/* --------------------------------------------------------------------------
   14. Ghost-specific Overrides
   -------------------------------------------------------------------------- */

.kg-width-wide {
    max-width: var(--wide-width);
    margin-left: calc(50% - var(--wide-width) / 2);
    margin-right: calc(50% - var(--wide-width) / 2);
}

.kg-width-full {
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.kg-width-wide img,
.kg-width-full img {
    width: 100%;
}


/* --------------------------------------------------------------------------
   15. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
    html {
        font-size: 16px;
    }

    .site-title {
        font-size: 2rem;
    }

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

    .post-card {
        padding: 1rem 1.1rem;
    }

    .post-card:hover {
        transform: none;
    }

    .post-card-meta {
        flex-direction: column;
        gap: 0.2rem;
    }

    .archive-entry {
        flex-wrap: wrap;
        gap: 0.2rem 0.5rem;
    }

    .archive-tag {
        display: none;
    }

    .pagination-inner {
        flex-direction: column;
        gap: 0.5rem;
    }

    .post-full-meta {
        flex-direction: column;
        gap: 0.2rem;
    }

    .post-author-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .kg-width-wide {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .post-full-content .kg-bookmark-container {
        flex-direction: column;
    }

    .post-full-content .kg-bookmark-thumbnail {
        width: 100%;
        height: 160px;
    }

    .post-toc {
        margin-bottom: 1.5rem;
    }

    .site-nav a {
        font-size: 0.7rem;
        padding: 0.3em 0.6em;
    }

    .picks-shelf {
        grid-template-columns: 1fr;
    }

    .cabinet-drawers {
        grid-template-columns: 1fr;
    }

    .pick-card:hover {
        transform: none;
    }

    .post-nav {
        flex-direction: column;
        gap: 1rem;
    }

    .post-nav-prev,
    .post-nav-next {
        max-width: 100%;
    }

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


/* --------------------------------------------------------------------------
   16. Reduced Motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .post-card {
        transition: none;
    }

    .post-card:hover {
        transform: none;
    }

    a {
        transition: none;
    }

    .archive-entry {
        transition: none;
    }

    .site-nav a {
        transition: none;
    }

    .tag-chip {
        transition: none;
    }

    .pick-card {
        transition: none;
    }

    .pick-card:hover {
        transform: none;
    }

    .cabinet-drawer {
        transition: none;
    }
}


/* --------------------------------------------------------------------------
   17. Print Stylesheet
   -------------------------------------------------------------------------- */

@media print {
    body {
        background: #fff;
        background-image: none;
        color: #000;
        font-size: 12pt;
        line-height: 1.5;
    }

    .site-header,
    .site-footer,
    .site-nav,
    .footer-nav,
    .footer-visitor-counter,
    .footer-meta,
    .post-tags,
    .post-author-card,
    .back-to-top,
    .post-nav,
    .pagination,
    .library-entrance,
    .staff-picks,
    .catalog-cabinet,
    .section-label,
    .decorative-divider,
    .post-toc {
        display: none !important;
    }

    .site-main {
        max-width: 100%;
        padding: 0;
    }

    .post-card {
        border: 1px solid #ccc;
        box-shadow: none;
    }

    .post-card::before {
        display: none;
    }

    .post-full-title {
        font-size: 22pt;
        color: #000;
    }

    .post-full-meta {
        font-size: 9pt;
        color: #555;
    }

    .post-full-content {
        font-size: 11pt;
    }

    .post-full-content a {
        color: #000;
        text-decoration: underline;
    }

    .post-full-content a::after {
        content: " (" attr(href) ")";
        font-size: 8pt;
        color: #666;
        font-family: var(--font-mono);
    }

    .post-full-content a[href^="#"]::after,
    .post-full-content a[href^="javascript"]::after {
        content: "";
    }

    .post-full-image img {
        border: none;
        max-height: 400pt;
    }

    .post-full-header {
        border-bottom: 1pt solid #ccc;
    }

    h2, h3, h4 {
        page-break-after: avoid;
    }

    img, pre, blockquote {
        page-break-inside: avoid;
    }

    .kg-width-wide,
    .kg-width-full {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}
