/* ==========================================================================
   Internet Folklore — Ghost Theme Stylesheet
   A warm, retro-inspired theme for internet history.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties
   -------------------------------------------------------------------------- */

:root {
    /* Palette */
    --color-bg:          #faf6ef;
    --color-bg-alt:      #f3ece0;
    --color-card:        #fffcf6;
    --color-text:        #3d3229;
    --color-text-muted:  #7a6b5d;
    --color-heading:     #2c2418;
    --color-accent:      #c4893b;
    --color-link:        #3a7d7e;
    --color-link-hover:  #2a5d5e;
    --color-border:      #c9b99a;
    --color-border-dash: #b5a48a;
    --color-hr:          #d4c5a9;

    /* 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;
    --gap:            2rem;
}


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

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

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

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);
}

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

a {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--color-link-hover);
}

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(--color-accent);
    background: var(--color-bg-alt);
    font-style: italic;
    color: var(--color-text-muted);
}

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

hr {
    border: none;
    border-top: 2px dashed var(--color-hr);
    margin: 2.5em auto;
    max-width: 200px;
}

pre {
    background: var(--color-bg-alt);
    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(--color-bg-alt);
    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(--color-bg-alt);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}


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

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


/* --------------------------------------------------------------------------
   4. Site Header
   -------------------------------------------------------------------------- */

.site-header {
    text-align: center;
    padding: 2.5rem 1.25rem 1.5rem;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 2rem;
}

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

.site-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    color: var(--color-heading);
    margin: 0 0 0.4rem;
    letter-spacing: -0.01em;
}

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

.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.25rem 1.25rem;
}

.site-nav li {
    margin: 0;
}

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

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


/* --------------------------------------------------------------------------
   5. Home Page
   -------------------------------------------------------------------------- */

.home-intro {
    text-align: center;
    margin-bottom: 2rem;
}

.intro-tagline {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-style: italic;
    color: var(--color-text-muted);
    margin: 0 0 0.75rem;
}

/* Tag browsing list */
.tag-list {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 1rem;
    background: var(--color-bg-alt);
    border: 1px dashed var(--color-border-dash);
    border-radius: 3px;
}

.tag-list-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    display: block;
    margin-bottom: 0.6rem;
}

.tag-chip {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 0.2em 0.6em;
    margin: 0.2em 0.15em;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    color: var(--color-link);
    text-decoration: none;
}

.tag-chip:hover {
    background: var(--color-link);
    color: var(--color-card);
    border-color: var(--color-link);
}


/* --------------------------------------------------------------------------
   6. Post Cards (Index Card Style)
   -------------------------------------------------------------------------- */

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

.post-card {
    background: var(--color-card);
    border: 2px dashed var(--color-border-dash);
    border-radius: 3px;
    padding: 1.25rem 1.5rem;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.15s ease;
}

.post-card:hover {
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.08);
}

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

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

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

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

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

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

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

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

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


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

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

.post-full-title {
    font-size: 2rem;
    margin-bottom: 0.6rem;
}

.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-text-muted);
    margin-top: 0.5rem;
}

/* 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 a {
    color: var(--color-link);
}

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

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

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

/* 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-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-text-muted);
    margin-top: 0.3em;
}

.post-full-content .kg-bookmark-metadata {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-text-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;
}

/* Post footer */
.post-full-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
}

.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(--color-bg-alt);
    border: 1px dashed var(--color-border-dash);
    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-text-muted);
    margin: 0.25rem 0 0;
    line-height: 1.5;
}


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

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

.tag-header-title,
.author-header-name {
    font-size: 1.6rem;
}

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

.tag-header-description,
.author-header-bio {
    font-size: 1rem;
    color: var(--color-text-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-text-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;
    border-bottom: 1px dotted var(--color-border);
}

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

.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-text-muted);
    flex-shrink: 0;
}


/* --------------------------------------------------------------------------
   10. Error Page
   -------------------------------------------------------------------------- */

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

.error-code {
    font-size: 5rem;
    font-weight: 700;
    color: var(--color-border);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.error-title {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
}

.error-message {
    font-size: 1rem;
    color: var(--color-text-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: 1.5rem;
    color: var(--color-text-muted);
    display: inline-block;
    margin: 1rem 0;
    padding: 0;
}

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


/* --------------------------------------------------------------------------
   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-text-muted);
}


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

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

.footer-visitor-counter {
    margin: 1.25rem 0;
}

.visitor-number {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    padding: 0.15em 0.5em;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.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-text-muted);
    text-decoration: none;
}

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

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

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

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

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

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


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

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


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

/* Members / subscription elements */
.gh-portal-triggerbtn-iframe {
    /* Move Ghost portal button out of the way if present */
}

/* Koenig editor card widths */
.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: 1.6rem;
    }

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

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

    .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;
    }
}
