/* ==========================================================================
   Discern Earth Ghost Theme
   Brand: Guayabera aesthetic — friendly, smart, distinctive
   Typography: Josefin Sans
   Colors: Purple + Gold + Neutrals
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
    /* Purple */
    --purple-500: #481785;
    --purple-400: #5F2D9E;
    --purple-300: #7851A9;
    --purple-200: #DFC4FF;
    --purple-100: #F8F3FF;

    /* Gold */
    --gold-500: #A47B11;
    --gold-400: #E5A502;
    --gold-300: #F1CB75;
    --gold-200: #FFF0C9;
    --gold-100: #FFFCF3;

    /* Neutrals */
    --neutral-500: #000000;
    --neutral-400: #6E6E6E;
    --neutral-300: #CBCBCB;
    --neutral-200: #EFEFEF;
    --neutral-100: #FFFFFF;

    /* Semantic */
    --color-brand: var(--purple-500);
    --color-brand-hover: var(--purple-400);
    --color-accent: var(--gold-400);
    --color-accent-soft: var(--gold-200);
    --color-text: #333;
    --color-text-heading: var(--purple-500);
    --color-text-secondary: var(--neutral-400);
    --color-text-muted: #5C5C5C;
    --color-border: var(--neutral-300);
    --color-border-accent: var(--gold-300);
    --color-link: var(--purple-400);
    --color-bg: var(--gold-100);
    --color-bg-card: var(--neutral-100);
    --color-bg-subtle: var(--purple-100);

    /* Typography */
    --font-sans: 'Josefin Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Josefin Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Spacing */
    --gap: 2rem;
    --content-width: 720px;
    --wide-width: 1200px;
}

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

body {
    margin: 0;
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-link); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-brand); }
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.5em;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 0.6em 1.6em;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-radius: 3px;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-subscribe {
    background: var(--color-brand);
    color: var(--neutral-100);
}

.btn-subscribe:hover {
    background: var(--purple-400);
    color: var(--neutral-100);
}

.btn-hero {
    background: var(--color-accent);
    color: var(--neutral-500);
    font-size: 1rem;
    padding: 0.8em 2em;
}

.btn-hero:hover {
    background: var(--gold-300);
    color: var(--neutral-500);
}

.btn-account {
    background: transparent;
    color: var(--color-brand);
    border: 1px solid var(--color-brand);
}

.btn-account:hover {
    background: var(--color-bg-subtle);
    color: var(--color-brand);
}


/* ==========================================================================
   Site Header
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.site-header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    max-width: var(--wide-width);
    margin: 0 auto;
    padding: 1rem var(--gap);
}

.site-header-actions {
    justify-self: end;
}

.site-logo img {
    height: 36px;
    width: auto;
}

.site-logo .site-title {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-brand);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.site-nav ul {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav a {
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--color-text);
    letter-spacing: 0.02em;
}

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


/* ==========================================================================
   Hero (Homepage)
   ========================================================================== */
.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    padding: 4rem var(--gap);
    background: var(--color-brand);
    color: var(--neutral-100);
    text-align: center;
    overflow: hidden;
}

.hero-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.2;
}

.hero-content {
    position: relative;
    max-width: 640px;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--neutral-100);
    margin-bottom: 0.5em;
}

.hero-description {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.9;
    margin-bottom: 1.5em;
}


/* ==========================================================================
   Post Feed (Card Grid)
   ========================================================================== */
.post-feed {
    padding: 3rem var(--gap);
}

.post-feed-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem;
    max-width: var(--wide-width);
    margin: 0 auto;
}

/* Post Card */
.post-card-link {
    display: flex;
    flex-direction: column;
    color: inherit;
    height: 100%;
}

.post-card-link:hover { color: inherit; }

.post-card-image {
    margin: 0;
    border-radius: 4px;
    overflow: hidden;
    aspect-ratio: 16 / 10;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-card-link:hover .post-card-image img {
    transform: scale(1.03);
}

.post-card-content {
    padding: 1rem 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card-tag {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-brand);
    margin-bottom: 0.4em;
}

.post-card-title {
    font-size: 1.35rem;
    margin-bottom: 0.3em;
}

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

.post-card-excerpt {
    font-size: 0.95rem;
    font-weight: 300;
    color: var(--color-text-secondary);
    margin: 0 0 auto;
    line-height: 1.5;
}

.post-card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--color-text-secondary);
    margin-top: 0.8rem;
}


/* ==========================================================================
   Post (Single Article) — the primary reading experience
   ========================================================================== */
.post-header {
    padding: 4rem var(--gap) 2rem;
    text-align: center;
}

.post-header-inner {
    max-width: var(--content-width);
    margin: 0 auto;
}

.post-tag {
    display: inline-block;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-brand);
    margin-bottom: 1rem;
}

.post-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin-bottom: 0.5em;
}

.post-excerpt {
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--color-text-secondary);
    margin-bottom: 1.5em;
}

.post-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--color-text-secondary);
}

/* Feature Image */
.post-feature-image {
    margin: 0 auto 3rem;
    max-width: 1000px;
    padding: 0 var(--gap);
}

.post-feature-image img {
    border-radius: 4px;
    width: 100%;
}

.post-feature-image figcaption {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--color-text-secondary);
    margin-top: 0.75rem;
}


/* ==========================================================================
   Post Content (gh-content) — Ghost's content output
   ========================================================================== */
.post-content {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 var(--gap) 3rem;
    font-weight: 300;
}

.post-content h2 {
    font-size: 1.6rem;
    margin-top: 2.5em;
}

.post-content h3 {
    font-size: 1.3rem;
    margin-top: 2em;
}

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

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

.post-content blockquote {
    margin: 2em 0;
    padding: 1em 1.5em;
    border-left: 4px solid var(--color-brand-hover);
    background: var(--color-bg-subtle);
    border-radius: 0 6px 6px 0;
    font-style: italic;
    color: var(--color-text);
}

.post-content ul, .post-content ol {
    margin: 0 0 1.5em;
    padding-left: 1.5em;
}

.post-content li {
    margin-bottom: 0.4em;
}

.post-content hr {
    border: none;
    border-top: 2px solid var(--color-border-accent);
    margin: 3em auto;
    max-width: 100px;
}

.post-content a {
    color: var(--color-link);
    text-decoration: underline;
    text-decoration-color: var(--purple-200);
    text-underline-offset: 2px;
    transition: text-decoration-color 0.2s;
}

.post-content a:hover {
    color: var(--color-brand);
    text-decoration-color: var(--color-brand);
}

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

.post-content figcaption {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--color-text-secondary);
    margin-top: 0.5rem;
}

.post-content pre {
    background: var(--neutral-200);
    padding: 1.5em;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.9rem;
    margin: 2em 0;
}

.post-content code {
    background: var(--neutral-200);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

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

/* Ghost card widths */
.gh-content .kg-width-wide {
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.gh-content .kg-width-full {
    max-width: none;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
}

.gh-content .kg-image-card img,
.gh-content .kg-gallery-card img {
    border-radius: 4px;
}

/* Ghost Gallery Card */
.kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 0.75em;
    margin: 2em 0;
}

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

.kg-gallery-image {
    flex: 1;
}

.kg-gallery-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Ghost Bookmark Card */
.kg-bookmark-card {
    margin: 2em 0;
}

.kg-bookmark-container {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s;
}

.kg-bookmark-container:hover {
    border-color: var(--neutral-300);
}

.kg-bookmark-content {
    flex: 1;
    padding: 1.25em;
    display: flex;
    flex-direction: column;
}

.kg-bookmark-title {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.3;
    margin-bottom: 0.4em;
}

.kg-bookmark-description {
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--color-text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.8em;
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--color-text-secondary);
    margin-top: auto;
}

.kg-bookmark-icon {
    width: 20px;
    height: 20px;
    border-radius: 2px;
}

.kg-bookmark-author {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kg-bookmark-publisher {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kg-bookmark-author::after {
    content: " \2022 ";
}

.kg-bookmark-thumbnail {
    flex-shrink: 0;
    width: 200px;
}

.kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 480px) {
    .kg-bookmark-container {
        flex-direction: column;
    }
    .kg-bookmark-thumbnail {
        width: 100%;
        height: 160px;
        order: -1;
    }
}


/* ==========================================================================
   Post Footer & Related
   ========================================================================== */
.post-footer {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 var(--gap) 2rem;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-link {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 400;
    padding: 0.3em 0.8em;
    background: var(--color-bg-subtle);
    color: var(--color-brand);
    border-radius: 3px;
}

.tag-link:hover {
    background: var(--purple-200);
    color: var(--color-brand);
}

/* Subscribe CTA */
.post-subscribe {
    background: var(--color-bg-subtle);
    text-align: center;
    padding: 3rem var(--gap);
}

.post-subscribe-inner {
    max-width: 480px;
    margin: 0 auto;
}

.post-subscribe h3 {
    font-size: 1.5rem;
    color: var(--color-brand);
}

.post-subscribe p {
    font-weight: 300;
    color: var(--color-text-secondary);
    margin-bottom: 1.5em;
}

/* Related Posts */
.related-posts {
    max-width: var(--wide-width);
    margin: 0 auto;
    padding: 3rem var(--gap);
}

.related-posts-title {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}


/* ==========================================================================
   Tag & Author Pages
   ========================================================================== */
.tag-header, .author-header {
    text-align: center;
    padding: 4rem var(--gap) 2rem;
}

.tag-header-inner, .author-header-inner {
    max-width: var(--content-width);
    margin: 0 auto;
}

.tag-title, .author-name {
    font-size: 2rem;
    color: var(--color-brand);
}

.tag-description, .author-bio {
    font-weight: 300;
    color: var(--color-text-secondary);
    max-width: 480px;
    margin: 0.5em auto;
}

.tag-count {
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--color-text-secondary);
}

.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    object-fit: cover;
}

.author-location {
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--color-text-secondary);
}


/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination {
    padding: 2rem var(--gap) 4rem;
}

.pagination-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    max-width: var(--wide-width);
    margin: 0 auto;
}

.pagination-prev, .pagination-next {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-brand);
}

.pagination-info {
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--color-text-secondary);
}


/* ==========================================================================
   Error Page
   ========================================================================== */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 4rem var(--gap);
}

.error-code {
    font-size: 6rem;
    color: var(--purple-200);
    margin-bottom: 0;
}

.error-message {
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
}


/* ==========================================================================
   Site Footer
   ========================================================================== */
.site-footer {
    border-top: 2px solid var(--color-border-accent);
    padding: 3rem var(--gap);
    background: var(--color-bg);
}

.site-footer-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1.5rem;
    max-width: var(--wide-width);
    margin: 0 auto;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-logo {
    height: 28px;
    width: auto;
}

.footer-tagline {
    font-size: 0.85rem;
    font-weight: 300;
    font-style: italic;
    color: var(--color-text-secondary);
    margin: 0;
}

.footer-nav ul {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-nav a {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--color-text-secondary);
}

.footer-nav a:hover {
    color: var(--color-brand);
}

.footer-meta {
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--color-text-secondary);
    justify-self: end;
}

.footer-meta p { margin: 0; }


/* ==========================================================================
   Ghost Portal & Members
   ========================================================================== */
.gh-portal-triggerbtn-iframe {
    color-scheme: light;
}


/* ==========================================================================
   Page-specific: Static pages
   ========================================================================== */
.page .post-header {
    padding-bottom: 1rem;
}

.page .post-content {
    padding-bottom: 4rem;
}


/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    :root {
        --gap: 1.25rem;
    }

    body {
        font-size: 1.05rem;
    }

    .site-header-inner {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .site-nav ul {
        gap: 1rem;
    }

    .hero {
        min-height: 40vh;
        padding: 3rem var(--gap);
    }

    .post-feed-inner {
        grid-template-columns: 1fr;
    }

    .post-header {
        padding-top: 2.5rem;
    }

    .post-content h2 { font-size: 1.35rem; }
    .post-content h3 { font-size: 1.15rem; }

    .site-footer-inner {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .footer-nav ul {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .site-nav { display: none; }
    .post-meta { flex-direction: column; gap: 0.25rem; }
}
