/* ==========================================================================
   Plain Light — a quiet single-column reading theme
   ========================================================================== */

:root {
    --paper:       #FBF9F4;
    --surface:     #FFFFFF;
    --ink:         #2C2A26;
    --ink-soft:    #5B564C;
    --ink-faint:   #8A8375;
    --rule:        #E4DFD2;
    --rule-soft:   #EFEBE0;
    --gold:        #E5B800;
    --gold-wash:   #FBF0C4;
    --forest:      #3A6B44;
    --forest-deep: #2C5335;

    --display: "Newsreader", Georgia, "Times New Roman", serif;
    --body:    "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    --measure: 34rem;   /* ~68 characters of body text */
    --gutter:  1.5rem;

    --step--1: 0.82rem;
    --step-0:  1.0625rem;
    --step-1:  1.25rem;
    --step-2:  1.5rem;
    --step-3:  1.9rem;
    --step-4:  2.4rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper:       #1A1815;
        --surface:     #232019;
        --ink:         #EFEADC;
        --ink-soft:    #B5AD9B;
        --ink-faint:   #857E6E;
        --rule:        #38332A;
        --rule-soft:   #2C281F;
        --gold:        #F0C93A;
        --gold-wash:   #3A3117;
        --forest:      #8FBE99;
        --forest-deep: #A9D0B1;
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--body);
    font-size: var(--step-0);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a {
    color: var(--forest);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
a:hover { color: var(--forest-deep); }

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Shared shell
   -------------------------------------------------------------------------- */
.shell {
    width: 100%;
    max-width: var(--measure);
    margin: 0 auto;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
}

/* Let feature images and wide cards break the measure a little */
.shell--wide { max-width: 46rem; }

.skip-link {
    position: absolute;
    top: -100px;
    left: var(--gutter);
    z-index: 100;
    padding: 0.5rem 0.9rem;
    background: var(--gold);
    color: #2C2A26;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 3px 3px;
}
.skip-link:focus { top: 0; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   Masthead
   -------------------------------------------------------------------------- */
.masthead {
    border-bottom: 1px solid var(--rule);
    background: var(--paper);
}

.masthead-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1.4rem;
    padding-bottom: 1.4rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--ink);
}

.brand-mark {
    width: 30px; height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
}

.brand-name {
    font-family: var(--display);
    font-size: var(--step-1);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.1;
}

.masthead-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
}
.icon-btn:hover { background: var(--rule-soft); color: var(--ink); }

.btn-subscribe {
    font-family: var(--body);
    font-size: var(--step--1);
    font-weight: 600;
    padding: 0.42rem 0.85rem;
    border-radius: 3px;
    background: var(--gold);
    color: #2C2A26;
    text-decoration: none;
    white-space: nowrap;
}
.btn-subscribe:hover { color: #2C2A26; filter: brightness(0.95); }

/* Navigation sits under the brand as a quiet mono row */
.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.15rem;
    padding-bottom: 1rem;
    margin: 0;
    list-style: none;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.nav a { color: var(--ink-faint); text-decoration: none; }
.nav a:hover { color: var(--ink); }
.nav .nav-current a { color: var(--ink); }

/* --------------------------------------------------------------------------
   Index — an archival list, not a grid of cards
   -------------------------------------------------------------------------- */
.index-intro {
    padding-top: 3rem;
    padding-bottom: 0.5rem;
}

.index-title {
    font-family: var(--display);
    font-size: var(--step-3);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin: 0 0 0.4rem;
    text-wrap: balance;
}

.index-description {
    font-family: var(--display);
    font-style: italic;
    font-size: var(--step-1);
    color: var(--ink-soft);
    margin: 0;
    text-wrap: pretty;
}

.entries {
    list-style: none;
    margin: 2rem 0 0;
    padding: 0;
}

.entry {
    padding: 1.75rem 0;
    border-top: 1px solid var(--rule-soft);
}
.entry:first-child { border-top: 1px solid var(--rule); }

.entry-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem 0.9rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 0.4rem;
}
.entry-meta a { color: var(--ink-faint); text-decoration: none; }
.entry-meta a:hover { color: var(--forest); }

.entry-title {
    font-family: var(--display);
    font-size: var(--step-2);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0 0 0.4rem;
    text-wrap: balance;
}
.entry-title a { color: var(--ink); text-decoration: none; }
.entry-title a:hover { color: var(--forest); }

.entry-excerpt {
    margin: 0;
    color: var(--ink-soft);
    text-wrap: pretty;
}

.entry-feature {
    display: block;
    margin: 0 0 0.9rem;
    border-radius: 3px;
    overflow: hidden;
}
.entry-feature img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* --------------------------------------------------------------------------
   Asides — short notes, set apart from full articles
   -------------------------------------------------------------------------- */
.entry--aside {
    border-top: 0;
    padding: 0.6rem 0;
}

.aside-box {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-left: 3px solid var(--gold);
    border-radius: 3px;
    padding: 1rem 1.15rem;
}

.aside-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.8rem;
    font-family: var(--mono);
    font-size: 0.64rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 0.35rem;
}

.aside-label { color: var(--ink-soft); font-weight: 500; }

/* Sans-serif and smaller, against the serif titles of full entries — the
   difference is what makes the two formats readable apart while skimming. */
.aside-title {
    font-family: var(--body);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0;
    margin: 0 0 0.3rem;
    text-wrap: pretty;
}
.aside-title a { color: var(--ink); text-decoration: none; }
.aside-title a:hover { color: var(--forest); }

.aside-excerpt {
    margin: 0 0 0.5rem;
    font-size: var(--step--1);
    line-height: 1.6;
    color: var(--ink-soft);
    text-wrap: pretty;
}

.aside-more {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-decoration: none;
}
.aside-more:hover { text-decoration: underline; }

/* Consecutive asides sit closer together than full entries do */
.entry--aside + .entry--aside { padding-top: 0; }

/* A full entry following an aside still needs its dividing rule back */
.entry--aside + .entry:not(.entry--aside) { border-top: 1px solid var(--rule-soft); padding-top: 1.75rem; }

/* A short label for members-only entries */
.entry-lock {
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
    background: var(--gold-wash);
    color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 2.5rem 0 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.74rem;
}

.pagination a { color: var(--forest); text-decoration: none; }
.pagination a:hover { text-decoration: underline; }
.pagination .page-number { color: var(--ink-faint); }
.pagination span.spacer { flex: 1; }

/* --------------------------------------------------------------------------
   Article
   -------------------------------------------------------------------------- */
.article { padding-top: 3rem; }

.article-header { margin-bottom: 2rem; }

.article-kicker {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 0.75rem;
}
.article-kicker a { color: var(--ink-faint); text-decoration: none; }
.article-kicker a:hover { color: var(--forest); }

.article-title {
    font-family: var(--display);
    font-size: var(--step-4);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 0.7rem;
    text-wrap: balance;
}

.article-standfirst {
    font-family: var(--display);
    font-style: italic;
    font-size: var(--step-1);
    color: var(--ink-soft);
    margin: 0 0 1rem;
    text-wrap: pretty;
}

.article-byline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
}
.article-byline a { color: var(--ink-soft); text-decoration: none; }
.article-byline a:hover { color: var(--forest); }

.article-feature {
    margin: 0 0 2rem;
}
.article-feature img {
    display: block;
    width: 100%;
    border-radius: 3px;
}
.article-feature figcaption {
    margin-top: 0.5rem;
    font-family: var(--body);
    font-size: var(--step--1);
    color: var(--ink-faint);
    text-align: center;
}

/* --------------------------------------------------------------------------
   Prose — Ghost content
   -------------------------------------------------------------------------- */
.prose { font-size: var(--step-0); }

.prose > * { margin-top: 0; margin-bottom: 1.15rem; }
.prose > *:last-child { margin-bottom: 0; }

.prose p { text-wrap: pretty; }

.prose h2, .prose h3, .prose h4 {
    font-family: var(--display);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin-top: 2.25rem;
    margin-bottom: 0.6rem;
    text-wrap: balance;
}
.prose h2 { font-size: var(--step-2); }
.prose h3 { font-size: var(--step-1); }
.prose h4 { font-size: var(--step-0); }

.prose a { color: var(--forest); }

.prose blockquote {
    margin-left: 0;
    margin-right: 0;
    padding-left: 1.1rem;
    border-left: 2px solid var(--gold);
    font-family: var(--display);
    font-style: italic;
    font-size: var(--step-1);
    color: var(--ink-soft);
}
.prose blockquote p { margin-bottom: 0.6rem; }
.prose blockquote p:last-child { margin-bottom: 0; }

.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: 0.4rem; }

.prose hr {
    border: 0;
    border-top: 1px solid var(--rule);
    margin: 2.5rem 0;
}

.prose code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--rule-soft);
    padding: 0.12em 0.36em;
    border-radius: 3px;
}

.prose pre {
    font-family: var(--mono);
    font-size: 0.82rem;
    line-height: 1.5;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 3px;
    padding: 0.9rem 1rem;
    overflow-x: auto;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }

.prose figure { margin-left: 0; margin-right: 0; }
.prose figcaption {
    margin-top: 0.5rem;
    font-size: var(--step--1);
    color: var(--ink-faint);
    text-align: center;
}

.prose img { border-radius: 3px; }

.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--step--1);
}
.prose th, .prose td {
    text-align: left;
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid var(--rule-soft);
}
.prose thead th {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    font-weight: 400;
    border-bottom: 1px solid var(--rule);
}

/* Wide content must scroll inside itself, never the page */
.prose .table-wrap { overflow-x: auto; }

/* Ghost's own cards.
   package.json sets card_assets:true, so Ghost injects its cards.min.css and
   owns the *inside* of bookmark, gallery and signup cards. Restyling those from
   here would need higher specificity than Ghost's, which quietly replaces its
   card design with a partial copy — so this file leaves them alone.

   The width modifiers below are a different matter: Ghost requires every theme
   to style them, because how far a card may break out of the column depends on
   the theme's measure, which only the theme knows. Omitting them fails upload
   validation (GS050-CSS-KGWW / KGWF). */
.prose .kg-card { margin-bottom: 1.5rem; }

/* Break out of the 34rem reading column, without ever letting the page itself
   scroll sideways. */
.kg-width-wide {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    width: min(46rem, calc(100vw - 2rem));
}

.kg-width-full {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100vw - 2rem);
    max-width: calc(100vw - 2rem);
}

.kg-width-full img {
    width: 100%;
    max-width: 100%;
}

/* Ghost's cards ship with their own system font stack. Lending them the
   theme's face is a typography choice; their layout is left alone. */
.prose .kg-card,
.prose .kg-bookmark-title,
.prose .kg-bookmark-description,
.prose .kg-bookmark-metadata { font-family: var(--body); }

.prose .kg-embed-card { display: flex; flex-direction: column; align-items: center; }
.prose .kg-embed-card iframe { max-width: 100%; }

/* --------------------------------------------------------------------------
   Article footer bits
   -------------------------------------------------------------------------- */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rule);
}

.tag-chip {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--rule);
    border-radius: 2px;
    color: var(--ink-soft);
    text-decoration: none;
}
.tag-chip:hover { border-color: var(--gold); color: var(--ink); }

.cta {
    margin: 3rem 0 0;
    padding: 1.5rem;
    border: 1px solid var(--rule);
    border-radius: 3px;
    background: var(--surface);
    text-align: center;
}
.cta h2 {
    font-family: var(--display);
    font-size: var(--step-1);
    font-weight: 600;
    margin: 0 0 0.4rem;
}
.cta p { margin: 0 0 1rem; color: var(--ink-soft); font-size: var(--step--1); }

.post-nav {
    display: grid;
    gap: 1rem;
    margin: 3rem 0 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
}
@media (min-width: 34rem) {
    .post-nav { grid-template-columns: 1fr 1fr; }
    .post-nav .post-nav-next { text-align: right; }
}

.post-nav-label {
    display: block;
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 0.25rem;
}
.post-nav a { text-decoration: none; }
.post-nav-title {
    font-family: var(--display);
    font-size: var(--step-0);
    color: var(--ink);
    line-height: 1.3;
}
.post-nav a:hover .post-nav-title { color: var(--forest); }

.comments { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }

/* --------------------------------------------------------------------------
   Tag / author headers
   -------------------------------------------------------------------------- */
.collection-header {
    padding-top: 3rem;
    padding-bottom: 0.5rem;
}

.collection-eyebrow {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 0.5rem;
}

.collection-title {
    font-family: var(--display);
    font-size: var(--step-3);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin: 0 0 0.4rem;
    text-wrap: balance;
}

.collection-description {
    margin: 0;
    color: var(--ink-soft);
    text-wrap: pretty;
}

.author-portrait {
    width: 64px; height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.9rem;
}

/* --------------------------------------------------------------------------
   Error page
   -------------------------------------------------------------------------- */
.error-page { padding: 5rem 0; text-align: center; }
.error-code {
    font-family: var(--mono);
    font-size: 3rem;
    color: var(--gold);
    margin: 0 0 0.5rem;
}
.error-message {
    font-family: var(--display);
    font-size: var(--step-2);
    font-weight: 500;
    margin: 0 0 1rem;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
    margin-top: 4rem;
    border-top: 1px solid var(--rule);
    padding-top: 1.5rem;
    padding-bottom: 3rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--ink-faint);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
}
.site-footer a { color: var(--ink-faint); text-decoration: none; }
.site-footer a:hover { color: var(--forest); }

.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.15rem; }

/* --------------------------------------------------------------------------
   Search dialog — markup and behaviour shared with the main theme
   -------------------------------------------------------------------------- */
.gil-search[hidden] { display: none; }

.gil-search {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 8vh 1rem 1rem;
}

.gil-search-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 26, 22, 0.5);
}

body.gil-search-open { overflow: hidden; }

.gil-search-panel {
    position: relative;
    width: 100%;
    max-width: 36rem;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 4px;
    box-shadow: 0 12px 40px rgba(28, 26, 22, 0.18);
    overflow: hidden;
}

.gil-search-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--rule);
}

.gil-search-icon { flex: none; color: var(--ink-faint); }

.gil-search-input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    font-family: var(--body);
    font-size: var(--step-1);
    color: var(--ink);
    appearance: none;
    -webkit-appearance: none;
}
.gil-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.gil-search-input::placeholder { color: var(--ink-faint); }

.gil-search-close {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
}
.gil-search-close:hover { background: var(--rule-soft); }

.gil-search-status {
    margin: 0;
    padding: 0.3rem 1rem;
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--ink-faint);
    min-height: 1.3em;
}

.gil-search-results {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem 0.5rem;
}

.gil-search-section {
    margin: 0.6rem 0 0.2rem;
    padding: 0 0.5rem;
    font-family: var(--mono);
    font-size: 0.64rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    font-weight: 400;
}

.gil-search-result {
    display: block;
    padding: 0.55rem;
    border-radius: 3px;
    text-decoration: none;
    color: inherit;
}
.gil-search-result:hover,
.gil-search-result:focus-visible,
.gil-search-result.is-active {
    background: var(--gold-wash);
    outline: none;
}

.gil-search-result-title {
    display: block;
    font-family: var(--display);
    font-size: var(--step-0);
    line-height: 1.25;
    color: var(--ink);
}

.gil-search-result-meta {
    display: block;
    margin-top: 2px;
    font-family: var(--mono);
    font-size: 0.66rem;
    color: var(--ink-faint);
}

.gil-search-result-context {
    display: block;
    margin-top: 0.3rem;
    font-size: var(--step--1);
    line-height: 1.5;
    color: var(--ink-soft);
}

.gil-search-result mark {
    background: var(--gold);
    color: #2C2A26;
    border-radius: 2px;
    padding: 0 1px;
}

.gil-search-empty {
    margin: 0;
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--ink-soft);
}

.gil-search-hint {
    margin: 0;
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.66rem;
    color: var(--ink-faint);
    text-align: center;
}

@media (max-width: 600px) {
    .gil-search { padding: 0; }
    .gil-search-panel {
        max-width: none;
        max-height: 100vh;
        height: 100%;
        border: 0;
        border-radius: 0;
    }
}
