/* ==========================================================================
   schismo — custom Ghost theme for there-apy.com
   ========================================================================== */

/* Custom properties
   ========================================================================== */
:root {
    --paper:  #FAF7F2;
    --ink:    #1A1A1A;
    --quiet:  #6E6E6E;
    --accent: #2C4870;
    --rule:   #E8E5DD;

    --font: 'Atkinson Hyperlegible', system-ui, sans-serif;

    --size-body:  18px;
    --size-small: 13px;
    --size-h1:    36px;
    --size-h2:    24px;
    --size-h3:    20px;

    --lh:       1.65;
    --lh-tight: 1.15;
    --ls:       0.01em;

    --measure:   680px;
    --container: 1100px;

    --space-xs: 0.5rem;
    --space-s:  1rem;
    --space-m:  2rem;
    --space-l:  4rem;
    --space-xl: 7rem;
}

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

/* Base
   ========================================================================== */
html {
    font-size: var(--size-body);
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    background-color: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1rem;
    line-height: var(--lh);
    letter-spacing: var(--ls);
    min-height: 100vh;
}

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

a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 0.15em;
    text-decoration-thickness: 1px;
}

a:hover { opacity: 0.7; }

/* Typography
   ========================================================================== */
h1, h2, h3 {
    font-family: var(--font);
    font-weight: 700;
    line-height: var(--lh-tight);
    letter-spacing: 0;
}

h1 { font-size: var(--size-h1); }
h2 { font-size: var(--size-h2); }
h3 { font-size: var(--size-h3); }

/* Layout
   ========================================================================== */
.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 3rem;
}

/* Navigation
   ========================================================================== */
.site-header {
    padding: var(--space-m) 0;
    border-bottom: 1px solid var(--rule);
    margin-bottom: var(--space-l);
}

.site-nav {
    display: flex;
    align-items: baseline;
    gap: var(--space-m);
    flex-wrap: wrap;
}

.site-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
    margin-right: auto;
    letter-spacing: 0;
}

.site-name:hover { opacity: 0.7; }

.nav-search {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--quiet);
    align-self: center;
}

.nav-search:hover {
    color: var(--ink);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    align-self: center;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ink);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-list {
    list-style: none;
    display: flex;
    gap: var(--space-m);
    flex-wrap: wrap;
}

.nav-list a {
    font-size: var(--size-small);
    color: var(--quiet);
    text-decoration: none;
    letter-spacing: 0.02em;
    text-transform: lowercase;
}

.nav-list a:hover,
.nav-list a[aria-current="page"] {
    color: var(--ink);
    opacity: 1;
}

/* Footer
   ========================================================================== */
.site-footer {
    margin-top: var(--space-xl);
    padding: var(--space-m) 0;
    border-top: 1px solid var(--rule);
}

.footer-meta {
    font-size: var(--size-small);
    color: var(--quiet);
    text-align: center;
    line-height: 1.8;
}

.footer-meta a {
    color: var(--quiet);
    text-decoration: none;
}

.footer-meta a:hover { color: var(--ink); opacity: 1; }

/* Homepage
   ========================================================================== */
.home-hero {
    display: flex;
    align-items: flex-start;
    gap: var(--space-m);
    margin-bottom: var(--space-l);
    padding-bottom: var(--space-l);
    border-bottom: 1px solid var(--rule);
}

.home-hero-photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.home-hero-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.home-hero-tagline {
    color: var(--ink);
    margin-bottom: var(--space-s);
    font-size: var(--size-h3);
}

.home-hero-intro {
    max-width: var(--measure);
    font-size: 1rem;
    line-height: var(--lh);
}

.home-section {
    margin-bottom: var(--space-l);
    padding-bottom: var(--space-l);
    border-bottom: 1px solid var(--rule);
}

.home-section-label {
    font-size: var(--size-small);
    font-weight: 700;
    color: var(--quiet);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--space-s);
    display: block;
}

.home-section-desc {
    max-width: var(--measure);
    margin-bottom: var(--space-m);
}

.home-section-name {
    font-size: var(--size-h3);
    font-weight: 700;
    color: var(--ink);
    margin-bottom: var(--space-s);
}

.home-section-actions {
    display: flex;
    gap: var(--space-m);
    flex-wrap: wrap;
    align-items: baseline;
}

.home-section-cta {
    font-size: var(--size-small);
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.home-section-cta:hover { opacity: 0.7; }

.home-section-book {
    font-size: var(--size-small);
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.home-section-book:hover { opacity: 0.7; }

.home-newsletter {
    padding-top: var(--space-s);
}

.newsletter-heading {
    font-size: var(--size-h2);
    font-weight: 700;
    margin-bottom: var(--space-s);
}

.newsletter-desc {
    max-width: var(--measure);
    margin-bottom: var(--space-m);
}

.newsletter-form {
    display: flex;
    gap: var(--space-s);
    max-width: 440px;
}

.newsletter-form input[type="email"] {
    flex: 1;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--rule);
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1rem;
    outline: none;
    border-radius: 0;
}

.newsletter-form input[type="email"]:focus {
    border-color: var(--accent);
}

.newsletter-form button {
    padding: 0.55rem 1.25rem;
    background: var(--accent);
    color: var(--paper);
    border: none;
    font-family: var(--font);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 0;
    letter-spacing: 0.02em;
}

.newsletter-form button:hover { opacity: 0.85; }

/* Post list (used on homepage, writing index, tag pages)
   ========================================================================== */
.post-list {
    list-style: none;
    margin-bottom: var(--space-m);
}

.post-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-m);
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--rule);
}


.post-list-item:first-child {
    border-top: 1px solid var(--rule);
}

.post-list-text {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: var(--space-m);
    flex: 1;
    min-width: 0;
}

.post-list-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex-shrink: 0;
    width: 3.25rem;
}

.post-list-date {
    font-size: var(--size-small);
    color: var(--quiet);
    white-space: nowrap;
}

.post-list-type {
    font-size: var(--size-small);
    color: var(--quiet);
}

.post-list-type:empty {
    display: none;
}

.post-list-title a {
    color: var(--ink);
    text-decoration: none;
}

.post-list-title a:hover {
    color: var(--accent);
    opacity: 1;
}

/* Post / essay page
   ========================================================================== */
.post-header {
    max-width: var(--measure);
    margin-bottom: var(--space-l);
}

.post-tag {
    font-size: var(--size-small);
    color: var(--quiet);
    letter-spacing: 0.08em;
    text-decoration: none;
    margin-bottom: var(--space-s);
    display: block;
}

.post-tag:hover { color: var(--ink); opacity: 1; }

.post-title {
    font-size: var(--size-h1);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: var(--space-s);
}

.post-meta {
    font-size: var(--size-small);
    color: var(--quiet);
    display: flex;
    gap: var(--space-s);
    flex-wrap: wrap;
}

/* Post / page body content
   ========================================================================== */
.post-content,
.page-content,
.gh-content {
    max-width: var(--measure);
    overflow-wrap: break-word;
    word-break: break-word;
}

.gh-content h2 {
    margin-top: var(--space-l);
    margin-bottom: var(--space-s);
}

.gh-content h3 {
    margin-top: var(--space-m);
    margin-bottom: var(--space-xs);
}

.gh-content p {
    margin-bottom: 1.3em;
}

.gh-content ul,
.gh-content ol {
    padding-left: 1.5em;
    margin-bottom: 1.3em;
}

.gh-content li {
    margin-bottom: 0.4em;
}

.gh-content blockquote {
    border-left: 2px solid var(--rule);
    padding-left: var(--space-m);
    margin: var(--space-m) 0;
    color: var(--quiet);
    font-style: normal;
}

.gh-content hr {
    border: none;
    border-top: 1px solid var(--rule);
    margin: var(--space-l) 0;
}

.gh-content figure {
    margin: var(--space-m) 0;
    max-width: 100%;
    overflow: hidden;
}

.gh-content figcaption {
    font-size: var(--size-small);
    color: var(--quiet);
    margin-top: var(--space-xs);
}

.gh-content sup a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.75em;
    vertical-align: super;
}

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

.gh-content em { font-style: italic; }

.gh-content iframe {
    max-width: 100%;
}

.kg-embed-card {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.kg-embed-card iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Subscribe CTA (bottom of posts)
   ========================================================================== */
.subscribe-cta {
    max-width: var(--measure);
    margin-top: var(--space-xl);
    padding-top: var(--space-l);
    border-top: 1px solid var(--rule);
}

.subscribe-heading {
    font-size: var(--size-h3);
    font-weight: 700;
    margin-bottom: var(--space-s);
}

.subscribe-desc {
    margin-bottom: var(--space-m);
}

.subscribe-form {
    display: flex;
    gap: var(--space-s);
    max-width: 440px;
}

.subscribe-form input[type="email"] {
    flex: 1;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--rule);
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1rem;
    outline: none;
    border-radius: 0;
}

.subscribe-form input[type="email"]:focus {
    border-color: var(--accent);
}

.subscribe-form button {
    padding: 0.55rem 1.25rem;
    background: var(--accent);
    color: var(--paper);
    border: none;
    font-family: var(--font);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 0;
}

.subscribe-form button:hover { opacity: 0.85; }

.subscribe-success {
    font-size: var(--size-small);
    color: var(--quiet);
    margin-top: var(--space-s);
}

/* Page templates (counselling, about, conversing, methodology)
   ========================================================================== */
.page-header {
    max-width: var(--measure);
    margin-bottom: var(--space-l);
}

.page-title {
    font-size: var(--size-h1);
    font-weight: 700;
    line-height: 1.1;
}

/* Writing index (page-writing.hbs) and way page (page-way.hbs)
   ========================================================================== */
.writing-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: var(--space-xl);
    align-items: start;
}

.writing-main {
    min-width: 0;
}

.mobile-only-link {
    display: none;
}

.writing-title {
    font-size: var(--size-h1);
    font-weight: 700;
    margin-bottom: var(--space-l);
}

.writing-sidebar {
    position: sticky;
    top: var(--space-m);
}

/* Reading paths block */
.reading-paths {
    margin-bottom: var(--space-l);
    padding: var(--space-m);
    background: color-mix(in srgb, var(--paper) 60%, var(--rule));
    border-left: 2px solid var(--accent);
}

.reading-path-link {
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    display: block;
    margin-bottom: var(--space-xs);
}

.reading-path-link:hover { opacity: 0.7; }

.reading-path-desc {
    font-size: var(--size-small);
    color: var(--quiet);
    line-height: 1.5;
    margin: 0;
}

/* Archive sections */
.archive-section {
    margin-bottom: var(--space-xl);
}

.archive-heading {
    font-size: var(--size-h2);
    font-weight: 700;
    margin-bottom: var(--space-m);
    padding-bottom: var(--space-s);
    border-bottom: 1px solid var(--rule);
}

/* Working note label in short form */
.working-note-label {
    font-style: italic;
    color: var(--quiet);
    font-size: var(--size-small);
}

/* Page-specific sidebar elements
   ========================================================================== */
.sidebar-card {
    padding: var(--space-m);
    border: 1px solid var(--rule);
}

/* Align non-card sidebar sections with card's internal left indent */
.writing-sidebar .sidebar-section:not(.sidebar-card) {
    padding-left: var(--space-m);
}

.sidebar-logo {
    display: block;
    width: 100%;
    max-width: 160px;
    height: auto;
    margin-bottom: var(--space-m);
}

.sidebar-card-name {
    font-weight: 700;
    color: var(--ink);
    margin-bottom: var(--space-s);
}

.sidebar-card-detail {
    font-size: var(--size-small);
    color: var(--quiet);
    margin-bottom: var(--space-xs);
}

.sidebar-card-address {
    line-height: 1.6;
    margin-bottom: var(--space-xs);
}

.sidebar-book-btn {
    display: inline-block;
    margin-top: var(--space-s);
    font-size: var(--size-small);
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
}

.sidebar-book-btn:hover { opacity: 0.7; }

.sidebar-note {
    font-size: var(--size-small);
    color: var(--quiet);
    line-height: 1.5;
    margin-top: var(--space-s);
}

/* More breathing room between labelled sidebar items (e.g. email pairs) */
.sidebar-links li:has(.sidebar-detail) {
    margin-bottom: var(--space-s);
}

.sidebar-detail {
    display: block;
    font-size: 11px;
    color: var(--quiet);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

/* About page */
.about-photo {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: var(--space-m);
}

.about-methodology-link {
    margin-top: var(--space-l);
    font-size: var(--size-small);
    color: var(--quiet);
}

.about-methodology-link a {
    color: var(--quiet);
}

.about-methodology-link a:hover { color: var(--ink); opacity: 1; }

/* Methodology page */
.methodology-revised {
    font-size: var(--size-small);
    color: var(--quiet);
    margin-top: var(--space-xs);
}

/* Dialogue template
   ========================================================================== */
.dialogue-layout {
    display: grid;
    grid-template-columns: var(--measure) 1fr;
    gap: var(--space-l);
    align-items: start;
}

.dialogue-main {
    min-width: 0; /* Prevent grid blowout from wide images */
}

/* In dialogue content, H2 = section heading */
.dialogue-page .gh-content h2 {
    font-size: var(--size-h2);
    font-weight: 700;
    margin-top: var(--space-xl);
    margin-bottom: var(--space-s);
    color: var(--ink);
    font-variant: normal;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1.3;
}

/* In dialogue content, H3 = speaker attribution */
.dialogue-page .gh-content h3 {
    font-size: 15px;
    font-variant: small-caps;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--accent);
    margin-top: var(--space-l);
    margin-bottom: var(--space-s);
    text-transform: lowercase;
    line-height: var(--lh);
}

.dialogue-ornament {
    color: var(--quiet);
    margin: var(--space-l) 0 var(--space-m);
    font-size: 1.1rem;
    letter-spacing: 0.3em;
}

/* Dialogue sidebar */
.dialogue-sidebar {
    position: sticky;
    top: var(--space-m);
    padding-top: var(--space-xs);
}

.sidebar-section {
    margin-bottom: var(--space-l);
}

.sidebar-label {
    font-size: var(--size-small);
    font-weight: 700;
    color: var(--quiet);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: var(--space-s);
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--rule);
    display: block;
}

.sidebar-links {
    list-style: none;
}

.sidebar-links li {
    margin-bottom: var(--space-xs);
}

.sidebar-links a {
    font-size: var(--size-small);
    color: var(--quiet);
    text-decoration: none;
    line-height: 1.4;
    display: block;
}

.sidebar-links a:hover { color: var(--ink); opacity: 1; }
.sidebar-links .sidebar-current { color: var(--ink); font-weight: 700; }

/* The way — curated reading order
   ========================================================================== */
.way-intro {
    margin-bottom: var(--space-l);
}

.way-list {
    list-style: none;
    counter-reset: way;
    padding: 0;
    margin: var(--space-l) 0;
}

.way-item {
    counter-increment: way;
    padding: var(--space-m) 0;
    border-bottom: 1px solid var(--rule);
}

.way-item:first-child {
    border-top: 1px solid var(--rule);
}

.way-item-title {
    font-weight: 700;
    margin-bottom: var(--space-xs);
    display: flex;
    align-items: baseline;
    gap: var(--space-s);
}

.way-item-title::before {
    content: counter(way);
    font-size: var(--size-small);
    color: var(--quiet);
    min-width: 1.5rem;
    flex-shrink: 0;
}

.way-item-title a {
    color: var(--ink);
    text-decoration: none;
}

.way-item-title a:hover { color: var(--accent); opacity: 1; }

.way-item-annotation {
    font-size: var(--size-small);
    color: var(--quiet);
    line-height: var(--lh);
    margin: 0;
    padding-left: calc(1.5rem + var(--space-s));
}

.way-empty {
    color: var(--quiet);
    font-style: italic;
    margin: var(--space-l) 0;
}

.way-book-note {
    margin-top: var(--space-l);
    padding-top: var(--space-l);
    border-top: 1px solid var(--rule);
    font-size: var(--size-small);
    color: var(--quiet);
    font-style: italic;
    line-height: var(--lh);
}

/* Books page
   ========================================================================== */
.books-intro {
    margin-bottom: var(--space-s);
    max-width: var(--measure);
}

.books-tagline {
    font-style: italic;
    color: var(--quiet);
    font-size: var(--size-small);
    margin-bottom: var(--space-l);
}

.book-section {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--rule);
}

.book-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.book-section-title {
    font-size: var(--size-h2);
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.book-title-link {
    color: var(--ink);
    text-decoration: none;
}

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

.book-subtitle {
    font-size: var(--size-small);
    color: var(--quiet);
    margin-bottom: var(--space-s);
}

.book-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: var(--quiet);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid var(--rule);
    padding: 0.15em 0.5em;
    vertical-align: middle;
}

.book-status-line {
    margin-bottom: var(--space-s);
}

.book-description {
    max-width: var(--measure);
    color: var(--quiet);
}

.book-description p {
    margin-bottom: 1.3em;
}

.book-description p:last-child {
    margin-bottom: 0;
}

.book-series-intro {
    color: var(--quiet);
    font-size: var(--size-small);
    margin-bottom: var(--space-l);
    max-width: var(--measure);
}

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

.phenomenal-item {
    padding: var(--space-m) 0;
    border-bottom: 1px solid var(--rule);
}

.phenomenal-item:first-child {
    border-top: 1px solid var(--rule);
}

.phenomenal-title-row {
    display: flex;
    align-items: baseline;
    gap: var(--space-s);
    margin-bottom: var(--space-xs);
}

.phenomenal-title-link {
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
}

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

.phenomenal-precis {
    font-size: var(--size-small);
    color: var(--quiet);
    line-height: var(--lh);
    margin: 0;
}

.phenomenal-empty {
    color: var(--quiet);
    font-style: italic;
    margin: var(--space-l) 0;
}

/* Browse by topic (Writing index secondary nav)
   ========================================================================== */
.browse-topics {
    margin-top: var(--space-xl);
    padding-top: var(--space-l);
    border-top: 1px solid var(--rule);
}

.browse-topics-heading {
    font-size: var(--size-small);
    font-weight: 700;
    color: var(--quiet);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: var(--space-m);
}

.topic-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-l);
}

.topic-item a {
    font-size: var(--size-small);
    color: var(--quiet);
    text-decoration: none;
}

.topic-item a:hover { color: var(--ink); opacity: 1; }

.topic-count {
    font-size: 11px;
    color: var(--rule);
    margin-left: 0.3em;
    vertical-align: super;
}

/* Pagination
   ========================================================================== */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-l);
    padding-top: var(--space-m);
    border-top: 1px solid var(--rule);
    font-size: var(--size-small);
    color: var(--quiet);
}

.pagination a {
    color: var(--accent);
    text-decoration: none;
}

.pagination a:hover { opacity: 0.7; }

/* Error page
   ========================================================================== */
.error-page {
    max-width: var(--measure);
    padding: var(--space-xl) 0;
}

.error-code {
    font-size: 5rem;
    font-weight: 700;
    color: var(--rule);
    line-height: 1;
    margin-bottom: var(--space-m);
}

.error-message {
    margin-bottom: var(--space-m);
    color: var(--quiet);
}

/* Ghost content cards
   ========================================================================== */
.kg-width-wide {
    width: calc(var(--measure) + 12rem);
    max-width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin: var(--space-m) 0;
}

.kg-width-full {
    width: 100vw;
    margin-left: calc(-3rem - (100vw - min(100vw, var(--container))) / 2);
    margin-top: var(--space-m);
    margin-bottom: var(--space-m);
}

.kg-image-card {
    max-width: 100%;
}

.kg-image {
    max-width: 100%;
    width: 100%;
    height: auto;
}

.kg-bookmark-card {
    border: 1px solid var(--rule);
    padding: var(--space-m);
    margin: var(--space-m) 0;
    text-decoration: none;
    display: block;
    color: var(--ink);
}

.kg-bookmark-card:hover { border-color: var(--quiet); opacity: 1; }

.kg-bookmark-title {
    font-weight: 700;
    margin-bottom: var(--space-xs);
    display: block;
}

.kg-bookmark-description {
    font-size: var(--size-small);
    color: var(--quiet);
    display: block;
}

.kg-callout-card {
    display: flex;
    gap: var(--space-s);
    border-left: 2px solid var(--rule);
    padding: var(--space-s) var(--space-m);
    margin: var(--space-m) 0;
}

.kg-toggle-card {
    border: 1px solid var(--rule);
    padding: var(--space-s) var(--space-m);
    margin: var(--space-m) 0;
}

.kg-toggle-heading-text { font-weight: 700; }

.kg-button-card {
    margin: var(--space-m) 0;
}

.kg-btn {
    display: inline-block;
    padding: 0.55rem 1.25rem;
    background: var(--accent);
    color: var(--paper);
    text-decoration: none;
    font-size: 1rem;
}

.kg-btn:hover { opacity: 0.85; }

/* Code */
pre, code {
    font-family: ui-monospace, monospace;
    font-size: 0.875em;
}

pre {
    background: var(--rule);
    padding: var(--space-m);
    overflow-x: auto;
    margin: var(--space-m) 0;
}

code { background: var(--rule); padding: 0.15em 0.35em; }
pre code { background: none; padding: 0; }

/* Responsive
   ========================================================================== */
@media (max-width: 900px) {
    .dialogue-layout,
    .writing-layout {
        grid-template-columns: 1fr;
    }

    /* Row gap between TOC block and content */
    .dialogue-layout {
        row-gap: var(--space-m);
    }

    .dialogue-sidebar,
    .writing-sidebar {
        position: static;
        border-top: 1px solid var(--rule);
        padding-top: var(--space-m);
        margin-top: var(--space-m);
    }

    .mobile-only-link {
        display: block;
        margin-top: var(--space-l);
    }

    .mobile-only-link a {
        color: var(--ink);
        text-decoration: none;
    }

    .mobile-only-link a:hover {
        opacity: 0.7;
    }

    /* On mobile, pull the dialogue sidebar (TOC) above the content */
    .dialogue-sidebar {
        order: -1;
        border-top: none;
        border-bottom: 1px solid var(--rule);
        padding-top: 0;
        padding-bottom: var(--space-s);
        margin-top: 0;
        margin-bottom: 0;
    }

    /* Collapse the TOC section's own bottom margin so padding-bottom alone controls spacing */
    .dialogue-sidebar #dialogue-toc-section {
        margin-bottom: 0;
    }

    /* Remove last link's margin so bottom gap equals top gap (both 0.4rem) */
    .dialogue-sidebar .sidebar-links li:last-child {
        margin-bottom: 0;
    }

    /* Rule already separates TOC from content — no extra top margin needed */
    .dialogue-page .gh-content h2:first-child {
        margin-top: 0;
    }

    /* Hide the dialogues list on mobile — navigate via writing index instead */
    .dialogue-sidebar .sidebar-section:not(#dialogue-toc-section) {
        display: none;
    }

    /* Restore TOC visibility on mobile */
    #dialogue-toc-section {
        display: block !important;
    }
}

@media (max-width: 640px) {
    :root {
        --size-body: 17px;
        --size-h1:   28px;
        --size-h2:   22px;
        --space-l:   2.5rem;
        --space-xl:  4.5rem;
    }

    .container { padding: 0 2rem; }

    .nav-toggle { display: flex; }

    .nav-list {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: var(--space-s);
        padding: var(--space-s) 0;
    }

    .site-header.nav-open .nav-list {
        display: flex;
    }

    .site-header.nav-open .nav-toggle span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .site-header.nav-open .nav-toggle span:nth-child(2) {
        opacity: 0;
    }
    .site-header.nav-open .nav-toggle span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .home-hero { flex-direction: column; gap: var(--space-s); }

    .newsletter-form,
    .subscribe-form { flex-direction: column; }

    .post-list-item { flex-direction: row; }
    .post-list-thumb { display: none; }
    .post-list-date { min-width: auto; }
}

/* Accessibility
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
    html { scroll-behavior: auto; }
}

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