/* ghostwriter base: reset, page frame, header, footer, lists, forms, buttons. */

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

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

body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: calc(var(--text-base) * var(--body-scale));
    font-weight: var(--prose-weight);
    line-height: var(--leading-body);
    font-kerning: normal;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

main { flex: 1 0 auto; }

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

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: var(--heading-weight);
    letter-spacing: var(--heading-tracking);
    line-height: var(--heading-leading);
    text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

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

:is(.slowclap-note, .more-link, .content-cta .actions) a { font-weight: var(--chrome-link-weight); }
:is(.error, .site-intro) a { font-weight: var(--link-weight); }
:is(.post-content :is(p, li, blockquote, dd, td, .kg-callout-text), .slowclap-note, .content-cta .actions, .error, .site-intro) a:hover,
.feed-item h2 a:hover, .post-meta a:hover, .pagination a:hover, .post-nav a:hover { color: var(--accent-ink); }

::selection { background: color-mix(in srgb, var(--ghost-accent-color) 30%, transparent); }

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

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    padding: 0.5rem 0.75rem;
    background: var(--fg);
    color: var(--bg);
    font-family: var(--font-chrome);
    z-index: 100;
}
.skip-link:focus { top: 1rem; }

.site-footer { font-weight: var(--chrome-weight); margin-top: 4rem; padding-block: 1.5rem 2.5rem; border-top: 1px solid var(--rule); }
.site-footer-inner,
.list-wrap {
    width: min(var(--site-width), 100% - 2 * var(--page-gutter));
    margin-inline: auto;
}
.site-footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    text-align: center;
    font-family: var(--font-chrome);
    font-size: 0.9375rem;
}

.site-title {
    font-family: var(--font-chrome);
    font-weight: 600;
    letter-spacing: -0.02em;
    font-size: 1.375rem;
    text-decoration: none;
}
.site-title img { height: 2rem; width: auto; }

.site-social { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.5rem 1.25rem; width: min(var(--site-width), 100% - 2 * var(--page-gutter)); margin: 1.5rem auto 0; }
.icon-link, .feed-icon { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.icon-link { width: 1.5rem; height: 1.5rem; }
.icon-link:hover, .feed-icon:hover { color: var(--accent-ink); }
.feed-icon svg { display: block; width: 0.75rem; height: 0.75rem; }
.icon-link svg { display: block; }

.site-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.75rem 1.25rem; }

@media (min-width: 56rem) {
    .site-footer-inner { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.75rem; text-align: left; }
    .site-footer-inner .site-nav ul { justify-content: flex-start; }
    .site-actions { margin-left: auto; align-items: baseline; justify-content: flex-start; }
}

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

.site-nav a, .site-social a, .site-actions a, .site-actions button {
    text-decoration: none;
    color: var(--muted);
}
.site-nav .nav-current a { color: var(--fg); }
.site-nav a:hover, .site-social a:hover, .site-actions a:hover, .site-actions button:hover { color: var(--accent-ink); }

.site-actions button {
    font: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.button, .site-actions a.button, .subscribe-form button {
    display: inline-block;
    padding: 0.5em 1.1em;
    font: inherit;
    font-family: var(--font-chrome);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    color: var(--accent-on);
    background: var(--accent-fill);
    border: 1px solid var(--accent-fill);
    border-radius: var(--radius-button);
    cursor: pointer;
}
.button:hover, .site-actions a.button:hover, .subscribe-form button:hover { color: var(--accent-on-hover); background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }

.list-wrap { max-width: var(--measure); padding-block: var(--header-top) 4rem; }

.home-hero { position: relative; isolation: isolate; margin-bottom: var(--header-gap); text-align: center; }
.home-hero-inner { width: min(var(--measure), 100% - 2 * var(--page-gutter)); margin-inline: auto; padding-top: var(--header-top); }
.home-title { font-family: var(--font-title); font-size: clamp(2.5rem, 1.5rem + 4vw, 4rem); font-weight: var(--title-weight); line-height: var(--title-leading); }
.home-title-ui { font-family: var(--font-chrome); font-weight: 600; letter-spacing: -0.02em; }
.home-hero .site-intro { margin: 1.25rem 0 0; }
.home-actions { margin-top: 2.25rem; }
.subscribe-inline { max-width: 28rem; margin: 0 auto; justify-content: center; }
.subscribe-inline .success-message, .subscribe-inline .error-message { text-align: center; }
.home-hero .read-link { margin: 1.5rem 0 0; }
.home-hero .read-link .button { font-size: 1rem; }
.home-hero .subscribe-form { justify-content: center; }


.home-hero.has-cover { display: grid; align-items: center; aspect-ratio: var(--hero-ratio); padding-block: var(--header-top) clamp(1.25rem, 4vw, 3rem); color: #fff; }
.home-hero.has-cover .home-hero-inner { padding-top: 0; }
.home-hero.hero-post.has-cover { align-items: stretch; }
.hero-post .home-hero-inner { display: grid; grid-template-rows: 1fr auto 1fr; }
.hero-post .post-meta { grid-row: 1; align-self: start; margin: 0; }
.hero-post .post-title { grid-row: 2; }
.hero-post .post-deck { grid-row: 3; align-self: start; }
.home-hero-image { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.home-hero.has-cover::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgb(0 0 0 / 0.55); }
.home-hero.has-cover .site-intro { color: rgb(255 255 255 / 0.9); }
.hero-caption { position: absolute; bottom: 0.75rem; left: 0; right: 0; margin: 0; padding-inline: var(--page-gutter); font-family: var(--font-ui); font-size: 0.8125rem; color: rgb(255 255 255 / 0.8); }
.home-hero.has-cover .post-meta dt { color: rgb(255 255 255 / 0.78); }
.home-hero.has-cover .subscribe-form input[type="email"] { background: rgb(255 255 255 / 0.95); color: #1a1a1a; border-color: transparent; }
.home-hero.has-cover .subscribe-form input[type="email"]::placeholder { color: #5c5c5c; }

.site-intro {
    margin-bottom: var(--header-gap);
    font-size: 1.3em;
    line-height: 1.45;
    color: var(--muted);
    text-wrap: balance;
}

.home-hero .author-avatar { display: block; width: 4.5rem; height: 4.5rem; margin: 0 auto 1.25rem; border-radius: 50%; object-fit: cover; }
.home-hero .meta { justify-content: center; margin-top: 1.25rem; }
.home-hero.has-cover .meta { color: rgb(255 255 255 / 0.85); }

.feed { list-style: none; margin: 0; padding: 0; }

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

.feed-item h2 { font-family: var(--font-title); font-size: var(--list-title-size); font-weight: var(--title-weight); }
.feed-item h2 a { text-decoration: none; }
.feed-item p.excerpt { margin-top: 0.6rem; }

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.25rem;
    margin-top: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--muted);
}
.meta a { color: inherit; text-decoration: none; }
.meta a:hover { color: var(--accent-ink); }

.pagination {
    font-family: var(--font-chrome);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    font-family: var(--font-ui);
    font-size: 0.9375rem;
    color: var(--muted);
}
.pagination a { text-decoration: none; color: var(--fg); }

.post-header {
    width: min(var(--measure), 100% - 2 * var(--page-gutter));
    margin-inline: auto;
    padding-block: var(--header-top) var(--header-gap);
    text-align: center;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem 2.75rem;
    margin: 0 0 var(--meta-gap);
    padding: 0;
    font-family: var(--font-chrome);
}
.post-meta { font-weight: var(--chrome-weight); }
.post-meta > div { min-width: 0; text-align: center; }
.post-meta dt { margin: 0; font-size: 0.75rem; font-weight: 300; letter-spacing: 0.03em; color: var(--muted); }
.post-meta dd { margin: 0.2rem 0 0; font-weight: var(--chrome-weight); font-size: 0.9375rem; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-meta a { color: inherit; text-decoration: none; }


.post-title { font-family: var(--font-title); font-size: var(--title-size); font-weight: var(--title-weight); line-height: var(--title-leading); }
.post-deck { margin-top: 1.25rem; font-size: 1.25em; line-height: 1.4; font-style: italic; color: var(--muted); text-wrap: balance; }


.post-footer {
    width: min(var(--measure), 100% - 2 * var(--page-gutter));
    margin: 3rem auto 0;
    padding-bottom: 4rem;
    font-family: var(--font-chrome);
    font-size: 1rem;
    line-height: 1.5;
}

.post-footer, .pagination, .content-cta { font-weight: var(--chrome-weight); }
.slowclap-note { margin: 0 0 2.5rem; font-size: 0.9375rem; line-height: 1.55; color: var(--muted); }
.slowclap-note a { color: var(--fg); }

.post-tags { list-style: none; margin: 0 0 2.5rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 0.875rem; }
.post-tags a { display: block; padding: 0.2em 0.75em; border: 1px solid var(--rule); border-radius: var(--radius-button); color: var(--muted); text-decoration: none; }
.post-tags a:hover { color: var(--accent-ink); border-color: var(--accent-ink); }

.post-nav { display: grid; gap: 1.25rem; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
@media (min-width: 40rem) { .post-nav { grid-template-columns: 1fr 1fr; } }
.post-nav a { text-decoration: none; display: block; }
.post-nav small { display: block; color: var(--muted); font-size: 0.8125rem; }
.post-nav span { font-weight: 600; font-size: 1.15rem; line-height: 1.25; }
.post-nav .next { text-align: left; }
@media (min-width: 40rem) {
    .post-nav .prev { grid-column: 1; }
    .post-nav .next { grid-column: 2; text-align: right; }
}

.comments { margin-top: 3rem; color: light-dark(rgb(26 26 26), rgb(238 238 238)); }
.comments iframe { color-scheme: normal; }

.subscribe-box { padding: 1.75rem; background: var(--surface); border-radius: var(--radius-chrome); }
.subscribe-box h2 { font-family: var(--font-chrome); font-weight: 600; letter-spacing: -0.01em; font-size: 1.4rem; line-height: 1.2; }
.subscribe-box p { margin-top: 0.4rem; color: var(--muted); font-size: 0.9375rem; }

.subscribe-form { position: relative; display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.1rem; }
.subscribe-form input[type="email"] {
    flex: 1 1 8rem;
    min-width: 0;
    padding: 0.55em 0.9em;
    font: inherit;
    font-family: var(--font-chrome);
    font-size: 1rem;
    font-weight: var(--chrome-weight);
    color: var(--fg);
    caret-color: var(--accent-ink);
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: var(--radius-button);
}
.subscribe-form input[type="email"]::placeholder { color: var(--muted); opacity: 1; }
.subscribe-form button { flex: 0 0 auto; }
.subscribe-form .loading-label, .subscribe-form .success-message, .subscribe-form .error-message { display: none; }
.subscribe-form.loading .idle-label { display: none; }
.subscribe-form.loading .loading-label { display: inline; }
.subscribe-form .success-message, .subscribe-form .error-message { flex-basis: 100%; margin: 0; font-size: 0.9375rem; }
.subscribe-form.success .success-message { display: block; }
.subscribe-form.error .error-message { display: block; color: #b3261e; }
.subscribe-form.success input, .subscribe-form.success button { display: none; }

.content-cta { grid-column: wide; justify-self: center; width: min(var(--measure), 100%); margin-top: 2.5rem; padding: 1.75rem; border: 1px solid var(--rule); border-radius: var(--radius-chrome); text-align: center; font-family: var(--font-chrome); font-size: 1rem; line-height: 1.5; }
.content-cta h2 { font-size: 1.5rem; font-family: var(--font-chrome); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.content-cta p { margin-top: 0.6rem; color: var(--muted); }
.content-cta .actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; justify-content: center; align-items: center; margin-top: 1.1rem; }

.page-narrow { width: min(var(--measure), 100% - 2 * var(--page-gutter)); margin-inline: auto; padding-block: 4rem; }
.error h1 { font-family: var(--font-title); font-size: clamp(3rem, 2rem + 6vw, 6rem); }
.error p { margin-top: 1rem; color: var(--muted); }
.error a { display: inline-block; margin-top: 1.5rem; }

@media print {
    .site-footer, .subscribe-box, .post-nav, .comments { display: none; }
    body { background: #fff; color: #000; }
}

.home-body { display: grid; gap: var(--header-gap); }
.section-head { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 1.25rem; }
.section-head .section-label { margin: 0; }
.section-label { margin: 0 0 1.25rem; font-family: var(--font-chrome); font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.more-link { margin-top: 2rem; font-family: var(--font-chrome); font-size: 0.9375rem; }
.more-link a { color: var(--muted); }
.more-link a:hover { color: var(--accent-ink); }

.project-updates { width: min(var(--measure), 100% - 2 * var(--page-gutter)); margin: var(--header-gap) auto 0; }


.featured-section { width: min(var(--measure), 100% - 2 * var(--page-gutter)); margin-inline: auto; }
.featured-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr)); gap: 1.75rem 1.25rem; margin: 0; padding: 0; list-style: none; }
.featured-card { display: block; text-decoration: none; }
.featured-tile, .is-image-only img { display: block; width: 100%; aspect-ratio: var(--card-ratio); border-radius: var(--radius-box); }
.is-image-only img { object-fit: cover; border: 1px solid var(--rule); box-sizing: border-box; }
.is-image-only:hover img { opacity: 0.92; border-color: var(--muted); }
.featured-tile { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.9rem 1rem; overflow: hidden; background: var(--surface); border: 1px solid var(--rule); }
.featured-tile-title { font-family: var(--font-title); font-weight: var(--title-weight); font-size: 1.15rem; line-height: 1.2; text-wrap: balance; }
.featured-tile-text { font-size: 0.875rem; line-height: 1.45; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.featured-card.is-text:hover .featured-tile { border-color: var(--muted); }

.is-overlay .featured-tile { position: relative; isolation: isolate; color: #fff; border-color: transparent; }
.is-overlay .featured-tile img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.is-overlay .featured-tile::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgb(0 0 0 / 0.55); }
.is-overlay:hover .featured-tile::before { background: rgb(0 0 0 / 0.45); }
.is-overlay .featured-tile-text { color: rgb(255 255 255 / 0.88); }

.hero-image-only { margin: 0; }
.hero-image-only img { display: block; width: 100%; aspect-ratio: var(--hero-ratio); object-fit: cover; }
.hero-image-only figcaption { margin: 0; padding: 0.6rem var(--page-gutter) 0; font-family: var(--font-ui); font-size: 0.8125rem; color: var(--muted); text-align: center; }
.image-only-header { width: min(var(--measure), 100% - 2 * var(--page-gutter)); margin: 0 auto; padding: 2rem 0 var(--header-gap); text-align: center; }
.image-only-header:not(:has(.site-intro, .read-link, .post-deck)) { padding-top: 0; }
.image-only-header .site-intro { margin: 0; }
.image-only-header .read-link { margin: 1.5rem 0 0; }
.image-only-header .read-link .button { font-size: 1rem; }

.feed-only { width: min(var(--measure), 100% - 2 * var(--page-gutter)); margin: 3rem auto 0; text-align: center; }
.feed-only .feed-icon svg { width: 0.875rem; height: 0.875rem; }

.poster-corner .feed-icon { color: color-mix(in srgb, var(--muted) 55%, var(--bg)); }
.poster-corner .feed-icon:hover { color: var(--accent-ink); }

@media (max-width: 40rem) {
    .post-meta { flex-wrap: nowrap; justify-content: center; gap: 0.9rem; }
    .post-meta dt { font-size: 0.6875rem; letter-spacing: 0.01em; }
    .post-meta dd { font-size: 0.8125rem; }

    .home-hero.has-cover { aspect-ratio: auto; min-height: clamp(22rem, 100vw, 30rem); padding-block: 2rem 2.75rem; }
    .home-hero .home-title { font-size: clamp(1.9rem, 8.5vw, 2.5rem); }
    .home-hero .site-intro { margin-top: 1.5rem; font-size: 1.05rem; }
    .home-actions { margin-top: 2.5rem; }
    .hero-post .home-hero-inner { row-gap: 2rem; }
    .hero-post .post-deck { margin-top: 0; font-size: 1.1em; }
    .post-header { padding-top: 2rem; }
    .post-deck { margin-top: 1.5rem; }
}

@media (max-width: 40rem) {
    .subscribe-box { padding: 1.25rem; }
    .subscribe-box h2 { font-size: 1.125rem; }
    .subscribe-box p { font-size: 0.875rem; }
    .subscribe-form input[type="email"] { padding: 0.5em 0.75em; font-size: 0.9375rem; }
    .subscribe-form button { padding-inline: 0.9em; font-size: 0.875rem; }
}
