/* ==========================================================================
   Sound — a minimal Ghost theme for essays, notes and photographs
   ========================================================================== */

@font-face {
    font-family: "Newsreader";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/newsreader-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Newsreader";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/newsreader-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Newsreader";
    font-style: italic;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/newsreader-italic-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Newsreader";
    font-style: italic;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/newsreader-italic-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --------------------------------------------------------------------------
   Tokens. Colours use light-dark(): the system preference applies unless
   the reader picks a scheme with the toggle (html[data-theme]).
   -------------------------------------------------------------------------- */

:root {
    color-scheme: light dark;

    --bg: light-dark(#fbfaf7, #121211);
    --bg-raised: light-dark(#f3f1ec, #1b1b19);
    --text: light-dark(#1d1c1a, #e9e6df);
    --text-soft: light-dark(#4a4843, #bdb9b0);
    --muted: light-dark(#7a766e, #8d897f);
    --rule: light-dark(#e6e2da, #2a2926);
    --rule-strong: light-dark(#cfcac0, #3d3b37);
    /* Ghost's single accent colour can't adapt to dark mode, so the theme uses its own pair */
    --accent: light-dark(#8a4b2a, #d9a27e);
    --link: light-dark(#1d1c1a, #e9e6df);
    --selection: light-dark(#ece4d6, #3a332b);
    --overlay: light-dark(rgb(251 250 247 / 0.97), rgb(10 10 9 / 0.97));

    --font-serif: "Newsreader", "Iowan Old Style", "Charter", "Sitka Text", Cambria, Georgia, serif;
    --font-body: var(--gh-font-body, var(--font-serif));
    --font-heading: var(--gh-font-heading, var(--font-serif));
    --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

    --measure: 38rem;
    --wide: 62rem;
    --gutter: clamp(1.25rem, 5vw, 3rem);
    --space: clamp(3.5rem, 8vw, 6rem);
    --radius: 3px;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    font-size: 100%;
    scroll-padding-top: 2rem;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: clamp(1.125rem, 1.04rem + 0.35vw, 1.3125rem);
    font-optical-sizing: auto;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-kerning: normal;
    font-variant-ligatures: common-ligatures;
}

::selection { background: var(--selection); }

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

a {
    color: var(--link);
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--rule-strong);
    text-underline-offset: 0.18em;
    transition: text-decoration-color 0.15s ease, color 0.15s ease;
}
a:hover { text-decoration-color: currentColor; }

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

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

p, li { text-wrap: pretty; }

.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;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    z-index: 100;
    padding: 0.5rem 0.9rem;
    background: var(--text);
    color: var(--bg);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* Small sans-serif metadata line used everywhere: date · place · reading time */
.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.55em;
    margin: 0;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    line-height: 1.5;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.meta > * + *::before {
    content: "·";
    margin-right: 0.55em;
}
.meta a { color: inherit; text-decoration: none; }
.meta a:hover { color: var(--text); }

/* --------------------------------------------------------------------------
   Layout: a named-line grid with main / wide / full tracks.
   Direct children sit in "main"; .kg-width-wide / .kg-width-full break out.
   -------------------------------------------------------------------------- */

.canvas {
    display: grid;
    grid-template-columns:
        [full-start] minmax(var(--gutter), 1fr)
        [wide-start] minmax(0, calc((var(--wide) - var(--measure)) / 2))
        [main-start] min(var(--measure), calc(100% - var(--gutter) * 2))
        [main-end] minmax(0, calc((var(--wide) - var(--measure)) / 2))
        [wide-end] minmax(var(--gutter), 1fr)
        [full-end];
}
.canvas > * { grid-column: main; min-width: 0; }
.canvas > .kg-width-wide { grid-column: wide; }
.canvas > .kg-width-full { grid-column: full; }

.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}
.site-main { flex: 1; padding-bottom: var(--space); }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 2rem;
    max-width: calc(var(--wide) + var(--gutter) * 2);
    margin: 0 auto;
    padding: clamp(1.25rem, 4vw, 2.5rem) var(--gutter);
}

.site-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 500;
    font-style: italic;
    letter-spacing: -0.01em;
    line-height: 1.1;
    color: var(--text);
    text-decoration: none;
}
.site-logo { max-height: 2.25rem; width: auto; }

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
}
.site-nav .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-nav .nav a {
    color: var(--muted);
    text-decoration: none;
}
.site-nav .nav a:hover,
.site-nav .nav-current a { color: var(--text); }

.site-tools { display: flex; gap: 0.25rem; margin-right: -0.5rem; }

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.icon-button:hover { color: var(--text); background: var(--bg-raised); }

.theme-icon { display: none; line-height: 0; }
.theme-toggle[data-mode="auto"] .theme-icon-auto,
.theme-toggle[data-mode="light"] .theme-icon-light,
.theme-toggle[data-mode="dark"] .theme-icon-dark,
.theme-toggle:not([data-mode]) .theme-icon-auto { display: block; }

/* --------------------------------------------------------------------------
   Intro & archive headers
   -------------------------------------------------------------------------- */

.intro { margin: clamp(1rem, 4vw, 3rem) 0 calc(var(--space) * 0.9); }
.intro p {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem);
    line-height: 1.3;
    letter-spacing: -0.015em;
    font-weight: 400;
    color: var(--text);
    text-wrap: balance;
}

.archive-header { margin: clamp(1rem, 4vw, 3rem) 0 calc(var(--space) * 0.75); }
.archive-header .meta { margin-bottom: 0.6rem; }
.archive-title {
    font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
    font-weight: 400;
    letter-spacing: -0.02em;
}
.archive-description {
    margin: 0.75rem 0 0;
    color: var(--text-soft);
    font-size: 1.05em;
}

/* --------------------------------------------------------------------------
   Stream entries
   -------------------------------------------------------------------------- */

.stream { row-gap: var(--space); }

/* Essay: date, title, optional illustration, excerpt */
.entry-essay .meta { margin-bottom: 0.7rem; }
.entry-title {
    font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.5rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.12;
}
.entry-title a { color: inherit; text-decoration: none; }
.entry-title a:hover { color: var(--text-soft); }
.entry-image { display: block; margin-top: 1.5rem; }
.entry-image img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: var(--radius);
}
.entry-excerpt {
    margin: 1rem 0 0;
    color: var(--text-soft);
}
.entry-more {
    display: inline-block;
    margin-top: 0.85rem;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    color: var(--text);
    text-decoration: none;
}
.entry-more:hover { color: var(--accent); }

/* Note: the words themselves, slightly larger, no chrome */
.entry-note {
    position: relative;
    padding-left: 1.25rem;
    border-left: 1px solid var(--rule-strong);
}
.entry-note-title {
    font-size: 1.2em;
    font-weight: 500;
    margin-bottom: 0.5rem;
}
.entry-note-title a { color: inherit; text-decoration: none; }
.entry-note-body { font-size: 1.08em; line-height: 1.55; }
.entry-note-body > :first-child { margin-top: 0; }
.entry-note-body > :last-child { margin-bottom: 0; }
.entry-note .meta { margin-top: 0.85rem; }

/* Photo: wider than the text column, edge to edge on phones */
.stream > .entry-photo { grid-column: wide; }
.entry-photo-frame {
    position: relative;
    display: block;
    /* Landscape fills the track, portrait is capped by viewport height; --ar set by main.js */
    width: min(100%, calc(86vh * var(--ar, 1.5)));
    cursor: zoom-in;
}
.entry-photo-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
}
.entry-photo-count {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.55rem 0.3rem 0.45rem;
    border-radius: 99px;
    background: rgb(0 0 0 / 0.55);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.entry-photo-count svg { width: 15px; height: 15px; }
.entry-photo-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 1rem;
    margin-top: 0.85rem;
}
.entry-photo-title {
    font-size: 1.05em;
    font-weight: 500;
    font-style: italic;
    letter-spacing: 0;
}
.entry-photo-title a { color: inherit; text-decoration: none; }

@media (max-width: 40rem) {
    .stream > .entry-photo { grid-column: full; }
    .entry-photo-frame { width: 100%; }
    .entry-photo-img { border-radius: 0; }
    .entry-photo-meta { padding: 0 var(--gutter); }
}

/* --------------------------------------------------------------------------
   Archive list (/posts/)
   -------------------------------------------------------------------------- */

.archive { list-style: none; margin: 0; padding: 0; }
.archive-item + .archive-item { border-top: 1px solid var(--rule); }
.archive-link {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 1rem;
    align-items: baseline;
    padding: 0.8rem 0;
    color: var(--text);
    text-decoration: none;
}
.archive-date {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.archive-name { font-size: 1.05em; }
.archive-note { color: var(--text-soft); font-style: italic; }
.archive-link:hover .archive-name { color: var(--accent); }

@media (max-width: 30rem) {
    .archive-link { grid-template-columns: 1fr; gap: 0.1rem; }
}

/* --------------------------------------------------------------------------
   Photo grid (/photo/)
   -------------------------------------------------------------------------- */

.photo-grid-wrap > * { grid-column: wide; }
.photo-grid {
    --cols: 3;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(0.25rem, 1vw, 0.75rem);
    list-style: none;
    margin: 0;
    padding: 0;
}
@media (min-width: 40rem) {
    .photo-grid { grid-template-columns: repeat(var(--cols), 1fr); }
    .photo-grid-2 { --cols: 2; }
    .photo-grid-4 { --cols: 4; }
}
.photo-thumb {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--bg-raised);
}
.photo-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(.2,.7,.2,1), opacity 0.3s ease;
}
.photo-thumb:hover img { transform: scale(1.025); }
.photo-thumb-stack {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    display: grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 99px;
    background: rgb(0 0 0 / 0.45);
    color: #fff;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.photo-thumb-stack svg { width: 13px; height: 13px; }
.photo-thumb-meta {
    position: absolute;
    inset: auto 0 0 0;
    display: flex;
    flex-direction: column;
    padding: 2.5rem 0.75rem 0.6rem;
    background: linear-gradient(transparent, rgb(0 0 0 / 0.6));
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.photo-thumb-title { font-family: var(--font-heading); font-size: 1rem; font-style: italic; }
.photo-thumb:hover .photo-thumb-meta,
.photo-thumb:focus-visible .photo-thumb-meta { opacity: 1; }
@media (hover: none) { .photo-thumb-meta { display: none; } }

/* --------------------------------------------------------------------------
   Photo strip (top of the homepage)
   -------------------------------------------------------------------------- */

.photo-strip { margin: clamp(0.5rem, 2vw, 1.5rem) 0 0; }
.photo-strip > * { grid-column: wide; }
.photo-strip-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(0.25rem, 0.8vw, 0.6rem);
    list-style: none;
    margin: 0;
    padding: 0;
}
@media (min-width: 40rem) {
    .photo-strip-6 { grid-template-columns: repeat(6, 1fr); }
    .photo-strip-12 { grid-template-columns: repeat(6, 1fr); }
}
.photo-strip-more {
    justify-self: end;
    margin-top: 0.6rem;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    color: var(--muted);
    text-decoration: none;
}
.photo-strip-more:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   Single post
   -------------------------------------------------------------------------- */

.post-header { margin: clamp(1rem, 4vw, 3rem) 0 clamp(2rem, 5vw, 3.5rem); }
.post-header .meta { margin-bottom: 1rem; }
.post-title {
    font-size: clamp(2.1rem, 1.5rem + 2.6vw, 3.6rem);
    font-weight: 400;
    letter-spacing: -0.025em;
    line-height: 1.06;
}
.post-dek {
    margin: 1.1rem 0 0;
    font-size: 1.2em;
    line-height: 1.45;
    color: var(--text-soft);
}

.post-feature { margin: 0 0 clamp(2rem, 5vw, 3.5rem); }
.post-feature > .post-feature-inner { grid-column: wide; }
.post-feature img { width: 100%; border-radius: var(--radius); }
.post-feature figcaption { margin-top: 0.75rem; }

.post-footer { margin-top: 3rem; }

.topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: 0.8rem;
}
.topics:not(:has(li)) { display: none; }
.topics a {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border: 1px solid var(--rule-strong);
    border-radius: 99px;
    color: var(--text-soft);
    text-decoration: none;
}
.topics a:hover { color: var(--text); border-color: var(--text-soft); }

.post-comments { margin-top: var(--space); }

/* Note page */
.post-note-inner {
    margin: clamp(1rem, 6vw, 4rem) 0 0;
}
.post-note-title { font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem); margin-bottom: 1rem; }
.post-note-body { font-size: 1.2em; line-height: 1.5; }
.post-note-body > :first-child { margin-top: 0; }
.post-note-inner > .meta { margin: 1.5rem 0 1.25rem; }

/* Photo page */
.post-photo-figure {
    margin: 0 auto;
    padding: 0 var(--gutter);
    max-width: calc(76rem + var(--gutter) * 2);
}
.post-photo-figure a { display: block; cursor: zoom-in; }
.post-photo-img {
    width: auto;
    max-width: 100%;
    max-height: 88vh;
    margin: 0 auto;
    border-radius: var(--radius);
}
.post-photo-header { margin: 1.5rem 0 0; }
.post-photo-title {
    font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem);
    font-weight: 400;
    font-style: italic;
    margin-bottom: 0.5rem;
}
.post-photo-caption {
    margin: 0.75rem 0 0;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    color: var(--muted);
}
.post-photo .post-content:not(:has(> *)) { display: none; }
.post-photo .post-content { margin-top: 2rem; }
.post-photo .topics { margin-top: 2rem; }

@media (max-width: 40rem) {
    .post-photo-figure { padding: 0; }
    .post-photo-img { border-radius: 0; max-height: none; width: 100%; }
}

/* Previous / next */
.post-nav { margin-top: var(--space); }
.post-nav-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
}
.post-nav-link { display: flex; flex-direction: column; gap: 0.3rem; text-decoration: none; color: var(--text); }
.post-nav-link:hover .post-nav-title { color: var(--accent); }
.post-nav-older { grid-column: 2; text-align: right; }
.post-nav-older .meta { justify-content: flex-end; }
.post-nav-title { font-size: 1rem; line-height: 1.35; }

/* --------------------------------------------------------------------------
   Content (Ghost editor output)
   -------------------------------------------------------------------------- */

.gh-content > * + * { margin-top: 1.3em; }
.gh-content > * { margin-bottom: 0; }
.gh-content p, .gh-content ul, .gh-content ol, .gh-content dl { margin-block: 0; }
.gh-content > * + :is(p, ul, ol, dl) { margin-top: 1.1em; }

.gh-content h2, .gh-content h3, .gh-content h4 { margin-top: 2em; }
.gh-content h2 { font-size: 1.55em; }
.gh-content h3 { font-size: 1.25em; }
.gh-content h4 {
    font-family: var(--font-sans);
    font-size: 0.8em;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.gh-content :is(h2, h3, h4) + * { margin-top: 0.6em; }

.gh-content ul, .gh-content ol { padding-left: 1.3em; }
.gh-content li + li { margin-top: 0.35em; }
.gh-content li::marker { color: var(--muted); }

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

.gh-content hr {
    width: 100%;
    height: 1px;
    margin-block: 2.5em;
    border: 0;
    background: none;
    text-align: center;
    overflow: visible;
}
.gh-content hr::after {
    content: "⁂";
    position: relative;
    top: -0.8em;
    color: var(--muted);
    font-size: 1.1em;
}

.gh-content blockquote:not(.kg-blockquote-alt) {
    margin-inline: 0;
    padding-left: 1.25em;
    border-left: 2px solid var(--rule-strong);
    color: var(--text-soft);
    font-style: italic;
}
.gh-content blockquote p + p { margin-top: 0.8em; }

/* Ghost's "alternative" quote doubles as an aside */
.gh-content .kg-blockquote-alt {
    margin-inline: 0;
    padding: 0;
    font-size: 0.86em;
    font-style: italic;
    line-height: 1.55;
    color: var(--muted);
    text-align: left;
}
.gh-content .kg-blockquote-alt a { color: inherit; }

.gh-content code {
    font-family: var(--font-mono);
    font-size: 0.82em;
    padding: 0.1em 0.3em;
    border-radius: 3px;
    background: var(--bg-raised);
}
.gh-content pre {
    overflow-x: auto;
    padding: 1.1em 1.25em;
    border-radius: var(--radius);
    background: var(--bg-raised);
    font-size: 0.8em;
    line-height: 1.6;
    tab-size: 4;
}
.gh-content pre code { padding: 0; background: none; font-size: inherit; }

.gh-content table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-sans);
    font-size: 0.85em;
}
.gh-content th, .gh-content td { padding: 0.5em 0.75em; border-bottom: 1px solid var(--rule); text-align: left; }

.gh-content figure { margin-inline: 0; }
.gh-content img { border-radius: var(--radius); }
.gh-content .kg-width-full img { border-radius: 0; }
.gh-content figcaption,
.post-feature figcaption {
    margin-top: 0.7rem;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--muted);
}
.gh-content .kg-width-full figcaption { padding-inline: var(--gutter); }
.gh-content figcaption a, .post-feature figcaption a { color: inherit; }

.gh-content .kg-image-card img,
.gh-content .kg-gallery-image img { cursor: zoom-in; }
.gh-content .kg-image-card img { margin-inline: auto; }

.gh-content .kg-embed-card { display: block; }
.gh-content .kg-embed-card iframe { display: block; width: 100%; border: 0; border-radius: var(--radius); }
.gh-content .kg-embed-card iframe[src*="youtube"],
.gh-content .kg-embed-card iframe[src*="vimeo"] { aspect-ratio: 16 / 9; height: auto; }

.gh-content .kg-callout-card {
    font-size: 0.92em;
    border-radius: var(--radius);
}

.gh-content .kg-bookmark-card a.kg-bookmark-container { color: var(--text); border-color: var(--rule); }

/* Footnotes */
.gh-content .footnotes {
    margin-top: 3em;
    padding-top: 1.25em;
    border-top: 1px solid var(--rule);
    font-size: 0.85em;
    color: var(--text-soft);
}
.gh-content .footnotes ol { padding-left: 1.25em; }
.gh-content sup a { text-decoration: none; color: var(--accent); }

/* Notes in the stream keep embedded media inside the text column */
.entry-note-body :is(.kg-width-wide, .kg-width-full) { width: 100%; }

/* --------------------------------------------------------------------------
   Pagination, error, footer
   -------------------------------------------------------------------------- */

.pagination { margin-top: var(--space); }
.pagination-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rule);
    font-family: var(--font-sans);
    font-size: 0.85rem;
}
.pagination-link { color: var(--text); text-decoration: none; }
.pagination-link:hover { color: var(--accent); }
.pagination-count { color: var(--muted); font-variant-numeric: tabular-nums; }

.error { margin-top: clamp(2rem, 10vw, 7rem); }
.error .meta { margin-bottom: 0.6rem; }

.site-footer-inner {
    max-width: calc(var(--wide) + var(--gutter) * 2);
    margin: 0 auto;
    padding: 2rem var(--gutter) 2.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem 2rem;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--muted);
    border-top: 1px solid var(--rule);
}
.site-footer .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.site-footer-meta { margin: 0; }
.site-footer .sep { margin: 0 0.35em; }

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    grid-template-columns: 4rem 1fr 4rem;
    align-items: center;
    background: var(--overlay);
    opacity: 0;
    transition: opacity 0.2s ease;
    touch-action: pan-y pinch-zoom;
}
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }
.lightbox-figure {
    grid-column: 2;
    margin: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 0 1rem;
    min-width: 0;
}
.lightbox-img {
    max-width: 100%;
    max-height: calc(100dvh - 8rem);
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}
.lightbox-caption {
    min-height: 1.5em;
    margin-top: 0.9rem;
    max-width: 40rem;
    text-align: center;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    color: var(--muted);
}
.lightbox-caption a { color: inherit; }
.lightbox-close { position: absolute; top: 0.75rem; right: 0.75rem; }
.lightbox-prev { grid-column: 1; justify-self: center; }
.lightbox-next { grid-column: 3; justify-self: center; }
.lightbox-counter {
    position: absolute;
    top: 1.35rem;
    left: 1.25rem;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.lightbox.is-single .lightbox-prev,
.lightbox.is-single .lightbox-next,
.lightbox.is-single .lightbox-counter { visibility: hidden; }

@media (max-width: 40rem) {
    .lightbox { grid-template-columns: 0 1fr 0; }
    .lightbox-prev, .lightbox-next { display: none; }
    .lightbox-figure { padding-inline: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}

@media print {
    .site-header, .site-footer, .post-nav, .pagination, .lightbox { display: none !important; }
    body { background: #fff; color: #000; }
}
