/* ============================================================
   Learned Context — Ghost Theme Stylesheet
   Fonts: Instrument Serif, Instrument Sans, JetBrains Mono
   Colors: Charcoal #302E2A, Gold #E89B1C, Warm Grey #F0EDE6
   ============================================================ */

/* --- Reset & Base --- */

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

html {
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #302E2A;
    background-color: #F0EDE6;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

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

/* --- Typography --- */

h1, h2, h3, h4, h5, h6 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    line-height: 1.2;
}

code, pre {
    font-family: 'JetBrains Mono', monospace;
}

/* --- Layout --- */

.site-content {
    min-height: calc(100vh - 200px);
}

.post-feed-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
}

/* Section label (e.g. "Latest essays") */

.section-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.667rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6B6860;
    padding: 1rem 0;
    border-top: 1px dashed #D8D3CA;
    border-bottom: 1px dashed #D8D3CA;
    margin-bottom: 0;
}

/* --- Header --- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(240, 237, 230, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(48, 46, 42, 0.08);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.site-logo {
    font-family: 'Canela', 'Instrument Serif', Georgia, serif;
    font-size: 18px;
    font-weight: 400;
    color: #302E2A;
    white-space: nowrap;
    letter-spacing: 0.04em;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
    justify-content: center;
}

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

.header-nav a {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #302E2A;
    text-decoration: none;
    transition: opacity 120ms ease-out;
}

.header-nav a:hover {
    opacity: 0.7;
}

.header-nav a.is-active {
    opacity: 1;
    color: #E89B1C;
}

.header-subscribe {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.833rem;
    font-weight: 600;
    color: #302E2A;
    background-color: #E89B1C;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    white-space: nowrap;
    transition: background-color 0.15s ease;
}

.header-subscribe:hover {
    background-color: #d48a14;
}

/* --- Hero --- */

.hero {
    text-align: center;
    padding: 4rem 1.5rem 3rem;
    max-width: 1080px;
    margin: 0 auto;
}

.hero-title {
    font-size: 2.5rem;
    letter-spacing: -0.02em;
    color: #302E2A;
}

.hero-description {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 1.111rem;
    color: #6B6860;
    margin-top: 0.75rem;
    line-height: 1.5;
}

/* Author hero */

.author-hero {
    padding-bottom: 2rem;
}

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

.author-location {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.722rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6B6860;
    margin-top: 0.5rem;
}

/* --- Post Feed (index, tag, author pages) --- */

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

/* --- Post Card --- */

.post-card {
    padding: 2rem 0;
    border-bottom: 1px dashed #D8D3CA;
}

.post-card:first-child {
    padding-top: 0;
}

.post-card:last-child {
    border-bottom: none;
}

.post-card-image-link {
    display: block;
    margin-bottom: 1.25rem;
}

.post-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 6px;
}

.post-card-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.667rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6B6860;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.post-card-tag {
    color: #E89B1C;
}

.post-card-tag:hover {
    text-decoration: underline;
}

.post-card-title {
    font-size: 1.5rem;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}

.post-card-title a:hover {
    color: #E89B1C;
}

.post-card-excerpt {
    font-size: 0.944rem;
    color: #6B6860;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Featured post card — larger, vertical layout */

.post-card.featured {
    padding: 2.5rem 0;
}

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

.post-card.featured .post-card-excerpt {
    font-size: 1rem;
    -webkit-line-clamp: 4;
}

/* Compact post card — horizontal layout with small thumbnail */

.post-card.compact {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.post-card.compact .post-card-image-link {
    flex-shrink: 0;
    width: 120px;
    margin-bottom: 0;
}

.post-card.compact .post-card-image {
    width: 120px;
    height: 120px;
    aspect-ratio: 1;
    border-radius: 6px;
}

.post-card.compact .post-card-content {
    flex: 1;
    min-width: 0;
}

.post-card.compact .post-card-title {
    font-size: 1.25rem;
}

.post-card.compact .post-card-excerpt {
    -webkit-line-clamp: 2;
}

/* --- Single Post --- */

.post-full {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
}

.post-header {
    text-align: center;
    padding: 3rem 0 2rem;
}

.post-tag {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.722rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #E89B1C;
    margin-bottom: 0.75rem;
}

.post-tag:hover {
    text-decoration: underline;
}

.post-title {
    font-size: 2.5rem;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.post-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.722rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6B6860;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

/* Feature image */

.post-feature-image {
    margin: 0 0 2.5rem;
}

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

.post-feature-image figcaption {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.722rem;
    color: #6B6860;
    text-align: center;
    margin-top: 0.75rem;
}

/* --- Ghost Content (gh-content) --- */

.gh-content {
    font-size: 1rem;
    line-height: 1.75;
}

.gh-content > * + * {
    margin-top: 1.5rem;
}

.gh-content h2 {
    font-size: 1.667rem;
    margin-top: 3rem;
    letter-spacing: -0.01em;
}

.gh-content h3 {
    font-size: 1.333rem;
    margin-top: 2.5rem;
}

.gh-content h4 {
    font-size: 1.111rem;
    margin-top: 2rem;
}

.gh-content a {
    color: #E89B1C;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.gh-content a:hover {
    color: #d48a14;
}

.gh-content strong {
    font-weight: 600;
}

.gh-content blockquote {
    border-left: 3px solid #E89B1C;
    padding-left: 1.25rem;
    margin-left: 0;
    font-style: italic;
    color: #6B6860;
}

.gh-content pre {
    background-color: #302E2A;
    color: #F0EDE6;
    padding: 1.25rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.833rem;
    line-height: 1.6;
}

.gh-content code {
    font-size: 0.889rem;
}

.gh-content :not(pre) > code {
    background-color: rgba(48, 46, 42, 0.06);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.833rem;
}

.gh-content ul,
.gh-content ol {
    padding-left: 1.5rem;
}

.gh-content li + li {
    margin-top: 0.5rem;
}

.gh-content hr {
    border: none;
    border-top: 1px dashed #D8D3CA;
    margin: 3rem 0;
}

.gh-content figure {
    margin: 2rem 0;
}

.gh-content figcaption {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.722rem;
    color: #6B6860;
    text-align: center;
    margin-top: 0.75rem;
}

.gh-content img {
    border-radius: 6px;
}

/* Ghost card widths */

.gh-content .kg-width-wide {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    max-width: 1040px;
    margin-left: max(calc(-50vw + 50%), calc(-1040px / 2 + 720px / 2));
    margin-right: max(calc(-50vw + 50%), calc(-1040px / 2 + 720px / 2));
}

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

.gh-content .kg-width-full img {
    border-radius: 0;
}

/* Ghost bookmark card */

.gh-content .kg-bookmark-card {
    border: 1px solid #D8D3CA;
    border-radius: 6px;
    overflow: hidden;
}

.gh-content .kg-bookmark-container {
    display: flex;
    text-decoration: none;
    color: inherit;
}

.gh-content .kg-bookmark-content {
    flex: 1;
    padding: 1rem 1.25rem;
}

.gh-content .kg-bookmark-title {
    font-family: 'Instrument Serif', serif;
    font-size: 1rem;
    font-weight: 400;
}

.gh-content .kg-bookmark-description {
    font-size: 0.833rem;
    color: #6B6860;
    margin-top: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gh-content .kg-bookmark-metadata {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.667rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6B6860;
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gh-content .kg-bookmark-icon {
    width: 16px;
    height: 16px;
}

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

.gh-content .kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

/* Ghost callout card */

.gh-content .kg-callout-card {
    border-radius: 6px;
    padding: 1.25rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.gh-content .kg-callout-emoji {
    font-size: 1.25rem;
    line-height: 1;
}

/* Ghost button card */

.gh-content .kg-button-card {
    display: flex;
    justify-content: center;
}

.gh-content .kg-btn {
    display: inline-block;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.889rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
}

.gh-content .kg-btn-accent {
    background-color: #E89B1C;
    color: #302E2A;
}

/* Ghost gallery */

.gh-content .kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gh-content .kg-gallery-row {
    display: flex;
    gap: 0.5rem;
}

.gh-content .kg-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Subscribe CTA (in-post) --- */

.post-subscribe-cta {
    background-color: #E89B1C;
    color: #302E2A;
    border-radius: 6px;
    padding: 2.5rem;
    text-align: center;
    margin-top: 3rem;
}

.post-subscribe-cta h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.post-subscribe-cta p {
    font-size: 0.944rem;
    margin-bottom: 1.5rem;
    opacity: 0.85;
}

.post-subscribe-cta .subscribe-input {
    background-color: rgba(255, 255, 255, 0.9);
    color: #302E2A;
    border-color: transparent;
}

.post-subscribe-cta .subscribe-button {
    background-color: #302E2A;
    color: #F0EDE6;
}

.post-subscribe-cta .subscribe-button:hover {
    background-color: #1a1917;
}

/* --- Author Card (post footer) --- */

.post-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px dashed #D8D3CA;
}

.author-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

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

.author-name {
    font-size: 1rem;
}

.author-name a:hover {
    color: #E89B1C;
}

.author-bio {
    font-size: 0.889rem;
    color: #6B6860;
    margin-top: 0.25rem;
    line-height: 1.5;
}

/* --- Read Next --- */

.read-next {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px dashed #D8D3CA;
}

.read-next-heading {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.722rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6B6860;
    margin-bottom: 1.5rem;
}

/* --- Subscribe Form --- */

.subscribe-form-fields {
    display: flex;
    gap: 0.5rem;
    max-width: 420px;
    margin: 0 auto;
}

.subscribe-input {
    flex: 1;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.889rem;
    padding: 0.65rem 1rem;
    border: 1px solid #D8D3CA;
    border-radius: 6px;
    background-color: #fff;
    color: #302E2A;
    outline: none;
    transition: border-color 0.15s ease;
}

.subscribe-input:focus {
    border-color: #E89B1C;
}

.subscribe-input::placeholder {
    color: #6B6860;
}

.subscribe-button {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.889rem;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    background-color: #E89B1C;
    color: #302E2A;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease;
}

.subscribe-button:hover {
    background-color: #d48a14;
}

.subscribe-message {
    font-size: 0.833rem;
    text-align: center;
    margin-top: 0.75rem;
}

.subscribe-success {
    color: #1E9960;
}

.subscribe-error {
    color: #C23B3B;
}

/* --- Pagination --- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2.5rem 0 0;
    border-top: 1px dashed #D8D3CA;
    margin-top: 1rem;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.889rem;
}

.pagination-prev,
.pagination-next {
    color: #302E2A;
    font-weight: 500;
    transition: color 0.15s ease;
}

.pagination-prev:hover,
.pagination-next:hover {
    color: #E89B1C;
}

.pagination-info {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.722rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6B6860;
}

/* --- Footer --- */

.site-footer {
    background-color: #F0EDE6;
    color: #302E2A;
    border-top: 1px dashed #D8D3CA;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 1.5rem 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr;
    gap: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px dashed #D8D3CA;
}

.footer-logo {
    font-family: 'Canela', 'Instrument Serif', Georgia, serif;
    font-size: 20px;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: #302E2A;
    display: block;
    margin-bottom: 0.75rem;
}

.footer-description {
    font-size: 13px;
    color: #6B6860;
    max-width: 280px;
    line-height: 1.5;
}

.footer-col-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.667rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6B6860;
    margin-bottom: 1rem;
}

.footer-link-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-link-list a {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #6B6860;
    transition: color 0.15s ease;
}

.footer-link-list a:hover {
    color: #E89B1C;
}

.footer-subscribe {
    max-width: none;
}

.footer-subscribe-heading {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.667rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6B6860;
    margin-bottom: 1rem;
}

.footer-subscribe-text {
    font-size: 13px;
    color: #6B6860;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.footer-subscribe .subscribe-input {
    background-color: #FAF9F6;
    border-color: #D8D3CA;
    color: #302E2A;
}

.footer-subscribe .subscribe-input::placeholder {
    color: #9E9A90;
}

.footer-subscribe .subscribe-input:focus {
    border-color: #E89B1C;
}

.footer-subscribe .subscribe-form-fields {
    margin: 0;
}

.footer-note {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.611rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9E9A90;
    margin-top: 0.75rem;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1.5rem;
}

.footer-copyright {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.667rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9E9A90;
}

.footer-tagline {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 13px;
    font-style: italic;
    color: #9E9A90;
}

/* --- Error Page --- */

.error-page {
    text-align: center;
    padding: 6rem 1.5rem;
    max-width: 720px;
    margin: 0 auto;
}

.error-code {
    font-size: 5rem;
    color: #D8D3CA;
    line-height: 1;
}

.error-message {
    font-size: 1.25rem;
    color: #6B6860;
    margin-top: 1rem;
}

.error-link {
    display: inline-block;
    margin-top: 2rem;
    font-weight: 600;
    color: #E89B1C;
}

.error-link:hover {
    text-decoration: underline;
}

/* --- Responsive (< 660px) --- */

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

    .header-inner {
        padding: 0.75rem 1rem;
    }

    .header-nav {
        display: none;
    }

    .site-logo {
        font-size: 1.1rem;
    }

    .hero {
        padding: 3rem 1rem 2rem;
    }

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

    .post-feed-container {
        padding: 0 1rem 3rem;
    }

    .post-card {
        padding: 1.5rem 0;
    }

    .post-card-title {
        font-size: 1.333rem;
    }

    .post-full {
        padding: 0 1rem 3rem;
    }

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

    .post-subscribe-cta {
        padding: 2rem 1.5rem;
    }

    .subscribe-form-fields {
        flex-direction: column;
    }

    .post-feed-container {
        max-width: 720px;
    }

    .post-card.compact {
        flex-direction: column;
        gap: 0;
    }

    .post-card.compact .post-card-image-link {
        width: 100%;
        margin-bottom: 1rem;
    }

    .post-card.compact .post-card-image {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

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

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

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

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