/* =============================================================================
   Michelle — blog layer.

   This file assumes /css/main.css is already loaded (see default.hbs): the blog
   is served same-origin at /blog/, so it inherits the site's reset, tokens,
   fonts, header, footer, buttons and .container verbatim. Nothing here
   redefines a token or restyles a shared component — it only adds the surfaces
   Ghost needs that the marketing site has no equivalent for (a post feed, a
   reading column, Koenig editor cards, pagination).
   ========================================================================== */

/* --- Current-section marker in the shared nav ---------------------------- */
.main-nav a.is-current {
    color: var(--ink);
}
.main-nav a.is-current::after {
    transform: scaleX(1);
}

/* =============================================================================
   Heroes
   ========================================================================== */

/* The feed / archive hero: ink, because this is the writing. Same scrim recipe
   as the site's .page-hero--forest so the dark-hero treatment stays consistent. */
.page-hero--writing {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background-image: url('/images/web/ink-swirl.webp');
    background-size: cover;
    background-position: center 42%;
    padding: var(--space-32) 0 var(--space-24);
}

.page-hero--writing::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
        180deg,
        rgba(12, 14, 18, 0.62) 0%,
        rgba(12, 14, 18, 0.46) 45%,
        rgba(12, 14, 18, 0.66) 100%
    );
}

.page-hero--writing .hero-eyebrow { color: var(--yellow); }

.page-hero--writing h1 {
    color: #F6F1E8;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

.page-hero--writing .hero-subtitle {
    color: rgba(246, 241, 232, 0.84);
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.4);
    max-width: 54ch;
    margin-left: auto;
    margin-right: auto;
}

/* The single-entry hero stays quiet: the title is the only thing that matters. */
.page-hero--entry {
    padding: var(--space-24) 0 var(--space-10);
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(212, 168, 67, 0.10) 0%, transparent 62%),
        var(--bg);
}

.page-hero--entry h1 {
    max-width: 20ch;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    padding-bottom: var(--space-6);
}

/* The site's signature ornament: a gold diamond on a hairline rule. */
.page-hero--entry h1::after,
.entry-related h2::after,
.post-feed-empty h2::after {
    content: '◆';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    font-size: 0.55rem;
    color: rgba(212, 168, 67, 0.9);
    background:
        linear-gradient(to right,
            transparent,
            rgba(212, 168, 67, 0.55) 20%,
            rgba(212, 168, 67, 0.55) 80%,
            transparent) center / 72px 1px no-repeat;
    padding: 0 var(--space-3);
    line-height: 1;
}

.page-hero--entry .hero-eyebrow a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(135, 103, 38, 0.35);
}
.page-hero--entry .hero-eyebrow a:hover { color: var(--red); }

.entry-meta,
.post-card-meta {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--ink-muted);
    letter-spacing: 0.02em;
}

.meta-dot { margin: 0 var(--space-2); color: var(--yellow-quiet); }

/* =============================================================================
   The feed
   ========================================================================== */

.post-feed-section { padding: var(--space-20) 0 var(--space-24); }

.post-feed {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-10);
}

.post-card {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition:
        transform var(--motion-base) var(--ease-out),
        box-shadow var(--motion-base) var(--ease-out),
        border-color var(--motion-base) var(--ease-out);
}

.post-card:hover {
    transform: translateY(-3px);
    border-color: rgba(212, 168, 67, 0.45);
    box-shadow:
        0 14px 34px rgba(43, 43, 43, 0.10),
        0 0 0 1px rgba(212, 168, 67, 0.10);
}

/* The most recent entry gets the wide plate. */
.post-card--lead {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: stretch;
}

.post-card-figure {
    display: block;
    overflow: hidden;
    background: var(--surface);
    line-height: 0;
}

.post-card-figure img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 16 / 9;
    transition: transform var(--motion-slow) var(--ease-out);
}

.post-card--lead .post-card-figure {
    flex: 1 1 52%;
}
/* Crop the lead image to a fixed plate rather than letting a portrait feature
   image dictate the card's height (object-fit: cover does the cropping). */
.post-card--lead .post-card-figure img { aspect-ratio: 4 / 3; }

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

.post-card-body {
    padding: var(--space-8);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    flex: 1 1 auto;
}

.post-card--lead .post-card-body {
    flex: 1 1 48%;
    justify-content: center;
    padding: var(--space-12) var(--space-10);
}

.post-card-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    line-height: 1.25;
    margin: 0;
}

.post-card--lead .post-card-title { font-size: var(--text-4xl); }

.post-card-title a {
    color: var(--ink);
    text-decoration: none;
    transition: color var(--motion-fast) var(--ease-out);
}
.post-card-title a:hover { color: var(--red); }

.post-card-excerpt {
    color: var(--ink-muted);
    line-height: 1.75;
    margin: 0;
}

.post-card-meta { margin: var(--space-2) 0 0; }

/* A post with no feature image leans on type instead — a marginal note. */
.post-card--textual .post-card-body {
    border-left: 2px solid var(--yellow);
    padding-left: calc(var(--space-8) - 2px);
}

/* Tag chips */
.post-tag {
    align-self: flex-start;
    display: inline-block;
    font-family: var(--font-body);
    font-style: italic;
    font-size: var(--text-xs);
    letter-spacing: 0.14em;
    text-transform: lowercase;
    color: #876726;
    text-decoration: none;
    padding: var(--space-1) var(--space-3);
    border: 1px solid rgba(135, 103, 38, 0.28);
    border-radius: 999px;
    background: var(--yellow-light);
    transition: all var(--motion-fast) var(--ease-out);
}
.post-tag:hover {
    color: var(--bg);
    background: #876726;
    border-color: #876726;
}

/* Empty feed */
.post-feed-empty {
    text-align: center;
    padding: var(--space-24) 0;
}
.post-feed-empty .empty-glyph {
    font-size: var(--text-2xl);
    color: rgba(212, 168, 67, 0.8);
    margin-bottom: var(--space-4);
}
.post-feed-empty h2 {
    position: relative;
    display: inline-block;
    padding-bottom: var(--space-6);
    margin-bottom: var(--space-4);
}
.post-feed-empty p { color: var(--ink-muted); }

/* =============================================================================
   The entry (reading column)
   ========================================================================== */

.entry-feature {
    margin: 0 auto var(--space-16);
    max-width: 1100px;
    padding: 0 var(--space-6);
}

.entry-feature img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-md);
    /* A vellum mat + hairline bronze rule: the antique frames elsewhere on the
       site are baked into fixed-size artwork, so we echo them instead. */
    padding: var(--space-3);
    background: var(--surface);
    box-shadow:
        0 0 0 1px rgba(135, 103, 38, 0.30),
        0 18px 44px rgba(43, 43, 43, 0.14);
}

.entry-feature figcaption {
    margin-top: var(--space-4);
    text-align: center;
    font-size: var(--text-sm);
    font-style: italic;
    color: var(--ink-muted);
}

/* The measure. Everything below is tuned for sustained reading. */
.entry-content {
    max-width: 68ch;
    margin: 0 auto;
    font-size: var(--text-lg);
    line-height: 1.85;
    color: var(--ink);
}

/* Vertical rhythm. NOTE: do not add a `.entry-content p { margin: 0 }` rule —
   it has higher specificity (0,1,1) than this one (0,1,0) and would silently
   collapse the space between every paragraph. main.css already zeroes margins
   globally via the `*` reset, so there is nothing to re-zero here. */
.entry-content > * + * { margin-top: var(--space-6); }

/* Signature: the red Fraunces drop cap that opens philosophy chapters. */
.entry-content > p:first-of-type::first-letter {
    font-family: var(--font-display);
    font-weight: 500;
    float: left;
    font-size: 3.15em;
    line-height: 0.82;
    padding: 0.06em 0.12em 0 0;
    color: var(--red);
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
    font-family: var(--font-display);
    line-height: 1.3;
    margin-top: var(--space-12);
    margin-bottom: var(--space-5);
}

.entry-content h2 {
    font-size: var(--text-3xl);
    position: relative;
    padding-bottom: var(--space-5);
}

/* Left-aligned variant of the site's diamond rule. */
.entry-content h2::after {
    content: '◆';
    position: absolute;
    left: 0;
    bottom: 0;
    font-size: 0.5rem;
    color: rgba(212, 168, 67, 0.9);
    background:
        linear-gradient(to right,
            rgba(212, 168, 67, 0.55) 0%,
            rgba(212, 168, 67, 0.55) 70%,
            transparent) left center / 56px 1px no-repeat;
    padding-right: var(--space-3);
    padding-left: 62px;
    line-height: 1;
}

.entry-content h3 { font-size: var(--text-xl); }

.entry-content a {
    color: var(--red);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: rgba(196, 69, 54, 0.4);
    transition: text-decoration-color var(--motion-fast) var(--ease-out);
}
.entry-content a:hover { text-decoration-color: var(--red); }

.entry-content strong { font-weight: 600; }
.entry-content em { font-style: italic; }

.entry-content ul,
.entry-content ol { padding-left: var(--space-6); }
.entry-content li { margin-bottom: var(--space-2); }
.entry-content li::marker { color: var(--yellow-quiet); }

/* Quotes echo .inline-quote from the marketing pages. */
.entry-content blockquote {
    margin-left: 0;
    padding-left: var(--space-6);
    border-left: 2px solid var(--yellow);
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-style: italic;
    line-height: 1.5;
    color: var(--ink);
}
.entry-content blockquote cite,
.entry-content blockquote footer {
    display: block;
    margin-top: var(--space-3);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-style: normal;
    color: var(--ink-muted);
}

/* A rule is a threshold, not a line. */
.entry-content hr {
    border: 0;
    text-align: center;
    margin: var(--space-12) 0;
}
.entry-content hr::before {
    content: '◆';
    color: rgba(212, 168, 67, 0.9);
    font-size: 0.6rem;
    background:
        linear-gradient(to right,
            transparent,
            rgba(212, 168, 67, 0.45) 25%,
            rgba(212, 168, 67, 0.45) 75%,
            transparent) center / 180px 1px no-repeat;
    padding: 0 var(--space-4);
}

.entry-content code,
.entry-content kbd {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--surface);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-sm);
    padding: 0.1em 0.35em;
}

.entry-content pre {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.7;
    background: #24262B;
    color: #E8E3D9;
    padding: var(--space-6);
    border-radius: var(--radius-md);
    overflow-x: auto;
}
.entry-content pre code {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
}

.entry-content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

.entry-content figure { margin: var(--space-10) 0; }
.entry-content figcaption {
    margin-top: var(--space-3);
    text-align: center;
    font-size: var(--text-sm);
    font-style: italic;
    color: var(--ink-muted);
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-base);
}
.entry-content th,
.entry-content td {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.entry-content th {
    font-family: var(--font-display);
    color: var(--ink);
}

/* --- Koenig (Ghost editor) cards ---------------------------------------- */
.entry-content .kg-card { margin-top: var(--space-10); }

/* Wide/full-bleed images escape the reading measure. */
.entry-content .kg-width-wide {
    max-width: 1100px;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}
.entry-content .kg-width-full {
    width: 100vw;
    max-width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}
.entry-content .kg-width-full img { border-radius: 0; }

.entry-content .kg-image-card img { margin: 0 auto; }

.entry-content .kg-callout-card {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-6);
    border-radius: var(--radius-md);
    background: var(--yellow-light);
    border: 1px solid rgba(212, 168, 67, 0.35);
    border-left: 3px solid var(--yellow);
}
.entry-content .kg-callout-emoji { font-size: var(--text-xl); line-height: 1.4; }
.entry-content .kg-callout-text { margin: 0; }

.entry-content .kg-blockquote-alt {
    border-left: 0;
    padding-left: 0;
    text-align: center;
    font-size: var(--text-2xl);
    color: var(--ink-muted);
}

.entry-content .kg-bookmark-card a.kg-bookmark-container {
    display: flex;
    text-decoration: none;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--motion-base) var(--ease-out);
}
.entry-content .kg-bookmark-card a.kg-bookmark-container:hover {
    border-color: rgba(212, 168, 67, 0.5);
}
.entry-content .kg-bookmark-content { padding: var(--space-5); flex: 1 1 auto; }
.entry-content .kg-bookmark-title { font-family: var(--font-display); margin-bottom: var(--space-2); }
.entry-content .kg-bookmark-description { color: var(--ink-muted); font-size: var(--text-sm); }
.entry-content .kg-bookmark-thumbnail img { border-radius: 0; height: 100%; object-fit: cover; }

.entry-content .kg-embed-card { display: flex; justify-content: center; }
.entry-content .kg-embed-card iframe { max-width: 100%; }

.entry-content .kg-toggle-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-md);
    padding: var(--space-5) var(--space-6);
    background: var(--surface);
}
.entry-content .kg-toggle-heading { font-family: var(--font-display); }

/* --- Tags under the entry ------------------------------------------------ */
.entry-tags {
    max-width: 68ch;
    margin: var(--space-16) auto 0;
    padding-top: var(--space-8);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

/* --- Further reading ----------------------------------------------------- */
.entry-related {
    margin-top: var(--space-24);
    padding: var(--space-20) 0;
    background: var(--surface);
}
.entry-related h2 {
    text-align: center;
    position: relative;
    padding-bottom: var(--space-6);
    margin-bottom: var(--space-12);
}
.entry-related .post-card { background: var(--bg); }

/* =============================================================================
   Pagination
   ========================================================================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    margin-top: var(--space-16);
    font-family: var(--font-body);
}

.pagination a {
    display: inline-block;
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid rgba(135, 103, 38, 0.3);
    border-radius: var(--radius-md);
    transition: all var(--motion-base) var(--ease-out);
}
.pagination a:hover {
    color: var(--bg);
    background: #876726;
    border-color: #876726;
}

.page-number {
    font-size: var(--text-sm);
    font-style: italic;
    color: var(--ink-muted);
}

/* =============================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
    .post-feed { grid-template-columns: 1fr; gap: var(--space-8); }

    .post-card--lead { flex-direction: column; }
    .post-card--lead .post-card-figure { min-height: 0; }
    .post-card--lead .post-card-figure img { aspect-ratio: 16 / 9; }
    .post-card--lead .post-card-body { padding: var(--space-8); }
    .post-card--lead .post-card-title { font-size: var(--text-2xl); }

    .page-hero--writing { padding: var(--space-24) 0 var(--space-16); }

    .entry-content { font-size: var(--text-base); }
    .entry-content > p:first-of-type::first-letter { font-size: 2.6em; }

    /* Wide/full cards can't escape the column on small screens. */
    .entry-content .kg-width-wide,
    .entry-content .kg-width-full {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        transform: none;
    }
}
