/* ──────────────────────────────────────────────────────────────────────────
   Editorial art direction — "Contour"
   Loaded after dark-theme.css. Pure presentation: no font-family changes
   (Literata / Inter / JetBrains Mono stay exactly as configured), no new
   markup. The visual signature is the flowing contour-line pattern in
   assets/images/bg-pattern.svg, used as atmosphere rather than decoration,
   plus hairlines, a mat-framed image treatment, and typographic ornaments.

   Root font-size is 10px in this theme (1rem = 10px). Values below are in px
   where they are fixed and rem only where they should scale with type.
   ────────────────────────────────────────────────────────────────────────── */

:root {
    --ed-paper: #faf8f4;               /* warm paper (light mode) */
    --ed-ink: #1b1917;
    --ed-hairline: rgba(27, 25, 23, 0.10);
    --ed-hairline-strong: rgba(27, 25, 23, 0.18);
    --ed-muted: rgba(27, 25, 23, 0.56);
    --ed-glow-a: rgba(139, 92, 246, 0.16);   /* violet */
    --ed-glow-b: rgba(244, 114, 182, 0.12);  /* rose   */
    --ed-glow-c: rgba(56, 189, 248, 0.10);   /* sky    */
    --ed-mat: var(--ed-paper);
    --ed-shadow: 0 18px 48px rgba(27, 25, 23, 0.10), 0 2px 6px rgba(27, 25, 23, 0.05);
    --ed-ornament-font: "Literata", "Georgia", "Apple Symbols", "Segoe UI Symbol", serif;
}

:root.dark-theme {
    --ed-paper: #0a1024;
    --ed-ink: #eef1fb;
    --ed-hairline: rgba(148, 163, 214, 0.16);
    --ed-hairline-strong: rgba(148, 163, 214, 0.30);
    --ed-muted: rgba(214, 222, 250, 0.62);
    --ed-glow-a: rgba(139, 92, 246, 0.30);
    --ed-glow-b: rgba(236, 72, 153, 0.16);
    --ed-glow-c: rgba(56, 189, 248, 0.14);
    --ed-mat: #0d1530;
    --ed-shadow: 0 24px 60px rgba(2, 6, 23, 0.55), 0 2px 8px rgba(2, 6, 23, 0.4);
}

/* ── Ground ─────────────────────────────────────────────────────────────── */

:root:not(.dark-theme) {
    --background-color: var(--ed-paper);
    --color-darker-gray: var(--ed-ink);
    --color-secondary-text: var(--ed-muted);
    --color-border: var(--ed-hairline);
}

:root:not(.dark-theme) .gh-navigation {
    background-color: rgba(250, 248, 244, 0.84);
    border-bottom-color: var(--ed-hairline);
}

::selection {
    background: rgba(139, 92, 246, 0.22);
    color: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--ghost-accent-color);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ── Shared ornaments ───────────────────────────────────────────────────── */

/* Small tracked label used for eyebrows everywhere */
.gh-hero-eyebrow,
.gh-section-eyebrow,
.gh-card-tag,
.gh-article-tag,
.gh-toc-title {
    font-family: var(--font-sans);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

/* A short centred rule — the theme's "breath" between blocks */
.ed-rule,
.gh-hero-description::before,
.gh-article-meta::after {
    content: "";
    display: block;
    width: 44px;
    height: 1px;
    margin: 0 auto;
    background: var(--ed-hairline-strong);
}

/* ── Hero ───────────────────────────────────────────────────────────────── */

.gh-hero {
    overflow: visible;
}

:root .gh-hero-panel,
:root:not(.dark-theme) .gh-hero-panel,
:root.dark-theme .gh-hero-panel {
    position: relative;
    isolation: isolate;
    max-width: 1120px;
    margin: 3.2rem auto 0;
    border-radius: 28px;
    border: 1px solid var(--ed-hairline);
    background-color: var(--ed-mat);
    background-image: none;
    box-shadow: var(--ed-shadow);
    overflow: hidden;
}

/* Layer 1 — colour weather: three soft glows that drift across the panel */
.gh-hero-panel::before {
    content: "";
    position: absolute;
    inset: -20%;
    z-index: -2;
    background:
        radial-gradient(42% 48% at 18% 22%, var(--ed-glow-a), transparent 70%),
        radial-gradient(38% 42% at 84% 18%, var(--ed-glow-c), transparent 70%),
        radial-gradient(46% 40% at 62% 92%, var(--ed-glow-b), transparent 70%);
    filter: blur(2px);
    animation: ed-drift 28s ease-in-out infinite alternate;
}

/* Layer 2 — the contour lines, faded out at the edges so they read as
   a topography rather than a tile */
.gh-hero-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: url('../images/bg-pattern.svg');
    background-size: 120% auto;
    background-position: 50% 40%;
    opacity: 0.22;
    -webkit-mask-image: radial-gradient(110% 90% at 50% 50%, #000 30%, transparent 78%);
    mask-image: radial-gradient(110% 90% at 50% 50%, #000 30%, transparent 78%);
    pointer-events: none;
}

:root.dark-theme .gh-hero-panel::after {
    opacity: 0.10;
    filter: invert(1);
}

@keyframes ed-drift {
    from { transform: translate3d(-2%, -1%, 0) rotate(-1deg); }
    to   { transform: translate3d(2%, 2%, 0) rotate(1.5deg); }
}

@media (prefers-reduced-motion: reduce) {
    .gh-hero-panel::before { animation: none; }
}

.gh-hero-inner {
    max-width: 780px;
    padding: 9.6rem 2.4rem 7.2rem;
}

@media (min-width: 640px) {
    .gh-hero-inner {
        padding: 12rem 2.4rem 8.8rem;
    }
}

.gh-hero-eyebrow {
    margin-bottom: 2.4rem;
    color: var(--ghost-accent-color);
}

.gh-hero-title {
    letter-spacing: -0.02em;
    line-height: 1.04;
    text-wrap: balance;
}

:root.dark-theme .gh-hero-title {
    background: linear-gradient(180deg, #ffffff 0%, #d7dcf5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.gh-hero-tagline {
    margin-top: 2rem;
    color: var(--ed-muted);
}

.gh-hero-description {
    margin-top: 3.2rem;
    color: var(--ed-muted);
}

.gh-hero-description::before {
    margin-bottom: 2.8rem;
}

.gh-hero-form {
    margin-top: 4rem;
}

/* ── Subscribe form ─────────────────────────────────────────────────────── */

.gh-subscribe-form,
:root.dark-theme .gh-subscribe-form,
:root:not(.dark-theme) .gh-subscribe-form {
    border: 1px solid var(--ed-hairline-strong);
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(27, 25, 23, 0.08);
    background-color: rgba(255, 255, 255, 0.85);
    transition: box-shadow 0.25s ease, border-color 0.25s ease, background-color 0.3s ease;
}

:root.dark-theme .gh-subscribe-form {
    background-color: rgba(17, 25, 49, 0.85);
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.45);
}

.gh-subscribe-form:focus-within {
    border-color: var(--ghost-accent-color);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.14), 0 10px 30px rgba(27, 25, 23, 0.08);
}

.gh-subscribe-form .gh-form-input {
    background: transparent;
    padding-inline: 24px;
}

.gh-subscribe-form .gh-button,
.gh-subscribe-form button.gh-button {
    border-radius: 999px;
    margin: 4px;
    height: calc(100% - 8px);
}

.gh-subscribe-note {
    margin-top: 1.2rem;
    letter-spacing: 0.02em;
}

/* Centre the footer form (it was flush-left inside a centred flex column) */
.gh-footer-signup .gh-subscribe-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 32px;
}

.gh-footer-signup .gh-form {
    margin-top: 0;
}

/* ── Section headers ────────────────────────────────────────────────────── */

.gh-section-header,
.gh-section-header:first-of-type {
    max-width: 800px;
    margin: 6.4rem auto 2.8rem;
    padding: 0;
    border: 0;
}

.gh-section-title {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-family: var(--font-sans);
    color: var(--ed-muted);
}

.gh-section-title::before,
.gh-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--ed-hairline);
}

.gh-container-title {
    letter-spacing: -0.015em;
}

/* ── Featured (latest issue) ────────────────────────────────────────────── */

.gh-feed-featured {
    margin-bottom: 0;
}

.gh-feed-featured .gh-section-eyebrow {
    text-align: center;
    color: var(--ghost-accent-color);
    margin-bottom: 2.8rem;
}

.gh-container.is-list .gh-feed-featured .gh-card-link {
    flex-direction: column;
    align-items: stretch;
    gap: 28px;
}

.gh-container.is-list .gh-feed-featured .gh-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0;
    border-radius: 6px;
    overflow: hidden;
    /* mat frame: hairline / paper gap / hairline, like a print in a mount */
    box-shadow:
        0 0 0 1px var(--ed-hairline-strong),
        0 0 0 7px var(--ed-mat),
        0 0 0 8px var(--ed-hairline),
        var(--ed-shadow);
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

:root:not(.dark-theme) .gh-feed-featured .gh-card-image {
    box-shadow:
        0 0 0 1px var(--ed-hairline-strong),
        0 0 0 7px var(--ed-mat),
        0 0 0 8px var(--ed-hairline),
        var(--ed-shadow);
}

.gh-feed-featured .gh-card-link:hover .gh-card-image {
    transform: translateY(-3px);
}

.gh-container.is-list .gh-feed-featured .gh-card-wrapper {
    max-width: 680px;
    margin: 12px auto 0;
    text-align: center;
}

.gh-feed-featured .gh-card-tag {
    display: block;
    color: var(--ghost-accent-color);
    margin-bottom: 14px;
}

.gh-feed-featured .gh-card-title {
    font-size: clamp(2.8rem, 3.4vw, 4rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.gh-feed-featured .gh-card-excerpt {
    -webkit-line-clamp: 3;
    font-size: 1.8rem;
    line-height: 1.55;
    margin-top: 14px;
    color: var(--ed-muted);
}

.gh-feed-featured .gh-card-meta {
    justify-content: center;
}

/* ── List feed ──────────────────────────────────────────────────────────── */

.gh-container.is-list .gh-feed {
    --grid-gap: 40px;
}

.gh-container.is-list .gh-card-link {
    align-items: flex-start;
    gap: 32px;
}

.gh-container.is-list .gh-card-image {
    width: 200px;
    aspect-ratio: 4 / 3;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--ed-hairline), 0 8px 20px rgba(27, 25, 23, 0.08);
}

.gh-card-image img {
    transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.gh-card-link:hover .gh-card-image img {
    transform: scale(1.04);
}

.gh-card-tag {
    display: block;
    color: var(--ghost-accent-color);
    margin-bottom: 8px;
}

.gh-container.is-list .gh-card-title {
    font-size: 2.3rem;
    line-height: 1.25;
    letter-spacing: -0.015em;
    transition: color 0.2s ease;
}

.gh-card-link:hover .gh-card-title {
    opacity: 1;
    color: var(--ghost-accent-color);
}

.gh-container.is-list .gh-card-excerpt {
    margin-top: 8px;
    font-size: 1.6rem;
    line-height: 1.5;
    color: var(--ed-muted);
}

.gh-card-meta {
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--ed-muted);
}

.gh-card-author + .gh-card-date:before {
    content: "·";
    margin: 0 4px 0 2px;
}

.gh-card-reading-time,
:root.dark-theme .gh-card-reading-time {
    color: var(--ed-muted);
    opacity: 0.7;
}

.gh-container.is-list .gh-card + .gh-card:before {
    background: var(--ed-hairline);
}

.gh-more {
    margin-top: 56px;
    font-weight: 600;
}

.gh-more a {
    gap: 8px;
    transition: gap 0.2s ease;
}

.gh-more a:hover {
    gap: 14px;
    color: var(--ghost-accent-color);
}

/* ── Article ────────────────────────────────────────────────────────────── */

.gh-article-header {
    margin-top: clamp(48px, 5vw, 88px);
    text-align: center;
}

.gh-article-tag {
    display: inline-block;
    margin-bottom: 20px;
}

.gh-article-title {
    text-wrap: balance;
    line-height: 1.08;
}

.gh-article-excerpt {
    margin: 20px auto 0;
    font-style: italic;
    color: var(--ed-muted);
    text-wrap: pretty;
}

.gh-article-meta {
    flex-direction: column;
    gap: 14px;
    margin: 32px 0 0;
}

.gh-article-author-image a {
    border-color: var(--ed-mat);
}

.gh-article-meta-wrapper {
    align-items: center;
    gap: 6px;
}

.gh-article-author-name {
    font-size: 1.5rem;
}

.gh-article-meta-content .bull {
    color: var(--ed-hairline-strong);
    margin: 0 2px;
}

.gh-article-meta::after {
    margin-top: 14px;
}

.gh-article-image {
    margin-top: 56px;
}

.gh-article-image img {
    border-radius: 6px;
    box-shadow:
        0 0 0 1px var(--ed-hairline-strong),
        0 0 0 7px var(--ed-mat),
        0 0 0 8px var(--ed-hairline),
        var(--ed-shadow);
}

.gh-article-image figcaption,
.gh-content figcaption {
    margin-top: 22px;
    font-family: var(--font-serif-alt);
    font-style: italic;
    font-size: 1.45rem;
    line-height: 1.5;
    text-align: center;
    color: var(--ed-muted);
}

/* Body copy */
.gh-content {
    font-variant-numeric: oldstyle-nums proportional-nums;
    text-wrap: pretty;
}

.gh-content a {
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    text-decoration-color: color-mix(in srgb, var(--ghost-accent-color) 50%, transparent);
    transition: text-decoration-color 0.2s ease, background-color 0.2s ease;
}

.gh-content a:hover {
    text-decoration-color: var(--ghost-accent-color);
    background: color-mix(in srgb, var(--ghost-accent-color) 10%, transparent);
    border-radius: 2px;
}

.gh-content h2,
.gh-content h3 {
    text-wrap: balance;
}

.gh-content > h2:not(:first-child) {
    padding-top: 40px;
    position: relative;
}

.gh-content > h2:not(:first-child)::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 44px;
    height: 1px;
    background: var(--ed-hairline-strong);
}

/* Drop cap: three lines deep, serif, ink */
.post-template .gh-content.drop-cap > p:first-of-type:first-letter,
.has-serif-body.post-template .gh-content.drop-cap > p:first-of-type:first-letter {
    font-family: var(--font-serif-alt);
    font-size: 4.4em;
    font-weight: 500;
    line-height: 0.78;
    margin: 0.09em 0.16em 0 -0.02em;
    color: var(--ed-ink);
}

/* Pull-quote treatment */
.gh-content > blockquote,
:root.dark-theme blockquote {
    position: relative;
    margin-inline: 0;
    padding: 12px 36px 12px 40px;
    border: 0;
    background: transparent;
    font-family: var(--font-serif-alt);
    font-style: italic;
    font-size: 1.22em;
    line-height: 1.45;
    letter-spacing: -0.005em;
    color: var(--ed-ink);
    text-wrap: pretty;
}

.gh-content > blockquote::before {
    content: "\201C";
    position: absolute;
    left: -4px;
    top: -14px;
    font-family: var(--font-serif-alt);
    font-style: normal;
    font-size: 4.2em;
    line-height: 1;
    color: var(--ghost-accent-color);
    opacity: 0.55;
}

.gh-content > blockquote::after {
    content: "";
    position: absolute;
    left: 14px;
    top: 52px;
    bottom: 8px;
    width: 1px;
    background: var(--ed-hairline-strong);
}

.gh-content > blockquote p {
    margin: 0;
}

/* Section break: asterism instead of a line */
.gh-content hr {
    height: auto;
    width: auto;
    background: transparent;
    border: 0;
    text-align: center;
    line-height: 1;
}

.gh-content hr::before {
    content: "\2042";
    display: inline-block;
    font-family: var(--ed-ornament-font);
    font-size: 3rem;
    letter-spacing: 0.1em;
    color: var(--ed-muted);
    opacity: 0.7;
}

/* In-body images: hairline frame, no heavy mat */
.gh-content .kg-image-card img,
.gh-content .kg-gallery-image img {
    border-radius: 4px;
    box-shadow: 0 0 0 1px var(--ed-hairline), 0 10px 28px rgba(27, 25, 23, 0.10);
}

/* Code */
.gh-content pre {
    border: 1px solid var(--ed-hairline);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.gh-content :not(pre) > code {
    border: 1px solid var(--ed-hairline);
    border-radius: 4px;
}

/* End of article: fleuron */
.gh-article .gh-content:last-of-type::after,
.post-template .gh-content.is-body::after {
    content: "\2766";
    grid-column: main;
    display: block;
    margin-top: 56px;
    text-align: center;
    font-family: var(--ed-ornament-font);
    font-size: 3rem;
    line-height: 1;
    color: var(--ed-muted);
    opacity: 0.7;
}

/* Article footer + comments */
.gh-article-footer,
:root.dark-theme .gh-article-footer {
    margin-top: 24px;
    padding-top: 28px;
    border-top: 1px solid var(--ed-hairline);
}

.gh-share-btn,
:root.dark-theme .gh-share-btn {
    border-color: var(--ed-hairline-strong);
    color: var(--ed-ink);
}

.gh-share-btn:hover,
:root.dark-theme .gh-share-btn:hover {
    background: color-mix(in srgb, var(--ghost-accent-color) 12%, transparent);
    border-color: var(--ghost-accent-color);
    color: var(--ghost-accent-color);
}

/* Table of contents */
.gh-toc-title {
    color: var(--ed-muted);
}

@media (min-width: 1280px) {
    .gh-toc-wrapper,
    :root.dark-theme .gh-toc-wrapper {
        border-left: 1px solid var(--ed-hairline);
    }

    .gh-toc-link,
    :root.dark-theme .gh-toc-link {
        color: var(--ed-muted);
        position: relative;
    }

    .gh-toc-link.is-active::before {
        content: "";
        position: absolute;
        left: calc(-2rem - 1px);
        top: 0;
        bottom: 0;
        width: 1px;
        background: var(--ghost-accent-color);
    }
}

/* Reading progress */
.gh-reading-progress {
    height: 2px;
}

.gh-reading-progress-bar {
    background: linear-gradient(90deg, var(--ghost-accent-color), #f472b6);
    border-radius: 0;
}

/* Related posts grid: image frames + eyebrows */
.gh-container.is-grid .gh-card-image {
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--ed-hairline), 0 8px 20px rgba(27, 25, 23, 0.08);
}

.gh-container.is-grid .gh-card-title {
    font-size: 2rem;
    line-height: 1.28;
}

/* ── Paywall CTA ────────────────────────────────────────────────────────── */

.gh-post-upgrade-cta-content,
:root.dark-theme .gh-post-upgrade-cta-content {
    background: var(--ed-mat);
    border: 1px solid var(--ed-hairline-strong);
    border-radius: 16px;
    box-shadow: var(--ed-shadow);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.gh-footer {
    position: relative;
    margin-top: 10vw;
    isolation: isolate;
    overflow: hidden;
}

/* The contours resurface at the foot of every page, mirrored, very faint */
.gh-footer::before {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 520px;
    z-index: -1;
    background-image: url('../images/bg-pattern.svg');
    background-size: 140% auto;
    background-position: 50% 100%;
    transform: scaleY(-1);
    opacity: 0.16;
    -webkit-mask-image: linear-gradient(to top, #000, transparent 90%);
    mask-image: linear-gradient(to top, #000, transparent 90%);
    pointer-events: none;
}

:root.dark-theme .gh-footer::before {
    opacity: 0.07;
    filter: invert(1);
}

.gh-footer-bar {
    border-color: var(--ed-hairline);
    margin-bottom: 96px;
}

.gh-footer-signup-header {
    text-wrap: balance;
}

.gh-footer-signup-subhead {
    opacity: 1;
    color: var(--ed-muted);
}

/* ── Small screens ──────────────────────────────────────────────────────── */

@media (max-width: 767px) {
    :root .gh-hero-panel,
    :root:not(.dark-theme) .gh-hero-panel,
    :root.dark-theme .gh-hero-panel {
        border-radius: 18px;
        margin-top: 1.6rem;
    }

    .gh-hero-inner {
        padding: 6.4rem 2rem 5.2rem;
    }

    .gh-container.is-list .gh-card-link {
        gap: 18px;
    }

    .gh-container.is-list .gh-card-image {
        width: 100%;
        aspect-ratio: 16 / 9;
    }

    .gh-container.is-list .gh-card-title {
        font-size: 2.1rem;
    }

    .gh-content > blockquote {
        padding-left: 28px;
        padding-right: 0;
    }
}
