/* ==========================================================================
   Cassamino: a quiet, typographic Ghost theme
   ========================================================================== */

/* Fonts (Figtree, SIL Open Font License, self-hosted)
   -------------------------------------------------------------------------- */
@font-face {
    font-family: "Figtree";
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url("../fonts/figtree-latin-ext-wght-normal.woff2") format("woff2-variations");
    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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Figtree";
    font-style: italic;
    font-weight: 300 900;
    font-display: swap;
    src: url("../fonts/figtree-latin-ext-wght-italic.woff2") format("woff2-variations");
    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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Figtree";
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url("../fonts/figtree-latin-wght-normal.woff2") format("woff2-variations");
    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: "Figtree";
    font-style: italic;
    font-weight: 300 900;
    font-display: swap;
    src: url("../fonts/figtree-latin-wght-italic.woff2") format("woff2-variations");
    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;
}

/* Tokens
   -------------------------------------------------------------------------- */
:root {
    --bg-light: #f6f5f3;
    --font-body: var(--gh-font-body, "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif);
    --font-heading: var(--gh-font-heading, var(--font-body));

    --bg: var(--bg-light);
    --text: #1c1d1c;
    --muted: #6e6d6a;
    --rule: #d6d4d0;
    --thumb-bg: #e8e6e2;
    --button-text: #fdfcfa;

    /* Widths measured from the reference at desktop size */
    --container: 960px;   /* header, footer, feature images, wide cards */
    --wide: 960px;
    --narrow: 632px;      /* reading column and post list */
    --hero: 690px;        /* home headline */
    --gutter: 32px;

    /* Fluid type: 19px/38px on phones up to 22px/54px from ~1024px */
    --fs-base: clamp(19px, 0.42vw + 17.7px, 22px);
    --fs-h1: clamp(38px, 2.8vw + 27px, 54px);
}

:root.scheme-dark {
    --bg: #161716;
    --text: #ecebe8;
    --muted: #9a9894;
    --rule: #34353a;
    --thumb-bg: #26272a;
    --button-text: #161716;
}

@media (prefers-color-scheme: dark) {
    :root.scheme-auto {
        --bg: #161716;
        --text: #ecebe8;
        --muted: #9a9894;
        --rule: #34353a;
        --thumb-bg: #26272a;
        --button-text: #161716;
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

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

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

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

.skip-link {
    position: absolute; left: -9999px; top: 12px;
    background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 999px; z-index: 10;
}
.skip-link:focus { left: 12px; }

.site { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1; }

.container,
.container-narrow,
.container-wide {
    width: 100%;
    margin-inline: auto;
    padding-inline: var(--gutter);
}
.container { max-width: calc(var(--container) + var(--gutter) * 2); }
.container-narrow { max-width: calc(var(--narrow) + var(--gutter) * 2); }
.container-wide { max-width: calc(var(--wide) + var(--gutter) * 2); }

/* Header
   -------------------------------------------------------------------------- */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-top: clamp(28px, 5vw, 56px);
    padding-bottom: 20px;
    font-size: 18px;
}

.site-title { font-weight: 500; letter-spacing: -0.005em; }
.site-logo { max-height: 36px; width: auto; }

.menu-toggle,
.menu-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: -8px -8px -8px 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text);
    cursor: pointer;
}

.site-nav .nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px 32px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-nav a { transition: opacity .15s ease; }
.site-nav a:hover { opacity: .6; }
.site-nav .nav-current a { color: var(--text); }

/* Hero
   -------------------------------------------------------------------------- */
.hero {
    text-align: center;
    padding-top: clamp(56px, 10vw, 120px);
    padding-bottom: clamp(48px, 7vw, 76px);
}

.hero-headline {
    max-width: 14em;
    margin: 0 auto;
    font-family: var(--font-heading);
    font-size: clamp(34px, 5.2vw, 48px);
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.022em;
    text-wrap: balance;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: 32px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 20px;
    border: 2px solid var(--text);
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    transition: background-color .15s ease, color .15s ease, opacity .15s ease;
}
.button-solid { background: var(--text); color: var(--button-text); }
.button-solid:hover { opacity: .85; }
.button-outline { background: transparent; color: var(--text); }
.button-outline:hover { background: var(--text); color: var(--button-text); }

/* Carousel arrows: quiet previous/next under the home headline and square photo */
.carousel-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}
.carousel-word {
    padding: 0 6px;
    color: var(--muted);
    font-size: 14px;
    letter-spacing: .01em;
}
.carousel-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--text);
    cursor: pointer;
    transition: opacity .15s ease, background-color .15s ease;
}
.carousel-button:hover { background: var(--thumb-bg); }
.carousel-button[aria-disabled="true"] { opacity: .25; cursor: default; background: none; }
.carousel-nav[hidden] { display: none; }

/* The Square Photo: one square photo at half the post-list width, centred,
   with its title running up the photo's left edge */
.hero:has(+ .home-columns .square-photo) { padding-bottom: 56px; }
.square-photo { padding-bottom: 125px; }
.square-photo-frame {
    --photo-size: calc(var(--narrow) / 2);
    position: relative;
    width: min(var(--photo-size), 100%);
    margin: 0 auto;
}
/* Exactly the photo's height (it's square), so the title starts at the
   photo's bottom corner, not the caption's */
.square-photo-label {
    position: absolute;
    right: 100%;
    top: 0;
    height: var(--photo-size);
    margin: 0 14px 0 0;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: start;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: .12em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--muted);
}
.square-photo-item { margin: 0; }
.square-photo-image {
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--thumb-bg);
}
.square-photo-image img { width: 100%; height: 100%; object-fit: cover; }
.square-photo-item figcaption {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.45;
    text-align: center;
    color: var(--muted);
}
.square-photo-item figcaption a { text-decoration: underline; text-underline-offset: 3px; }
.square-photo-item figcaption a:hover { color: var(--text); }
.square-photo .carousel-nav { margin-top: 6px; }

/* "Latest: post →" under the headline, hidden where the photo sits beside the list */
.hero-latest {
    margin: 24px 0 0;
    font-size: 15px;
    color: var(--muted);
}
.hero-latest span { color: var(--text); }
.hero-latest a:hover span { text-decoration: underline; text-underline-offset: 3px; }

/* Each home headline links to its post */
.hero-headline .headline { color: inherit; transition: opacity .15s ease; }
.hero-headline .headline:hover { opacity: .7; }

/* Right column (.home-side): Drawings, one at a time and shown whole in a
   fixed square, then Tags. Centred under the post list below 1200px; a sticky
   column from 1200px (see Home columns) */
.home-side { margin-top: 64px; }
.home-side:not(:has(.drawings, .home-tags)) { display: none; }
.drawings-label,
.home-tags-label {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: .12em;
    text-transform: uppercase;
    white-space: nowrap;
    text-align: center;
    color: var(--muted);
}
.drawings { width: 200px; margin: 0 auto; }
.drawings-item {
    display: block;
    aspect-ratio: 1 / 1;
    padding: 8px;
    background: var(--thumb-bg);
}
.drawings-item[hidden] { display: none; }
.drawings-item img { width: 100%; height: 100%; object-fit: contain; transition: opacity .15s ease; }
.drawings-item:hover img { opacity: .85; }
.drawings .carousel-nav { margin-top: 6px; }
.home-tags {
    margin-top: 32px;
    padding: 12px 14px;
    border: 1px solid var(--rule);
}
.home-tags-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 14px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
    line-height: 1.45;
}
.home-tags-list a { color: var(--muted); transition: color .15s ease; }
.home-tags-list a:hover { color: var(--text); }

/* Collection archives: /headlines/ list, /photos/ and /drawings/ grids */
.headline-archive-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 24px;
    padding: 14px 0;
    border-top: 2px solid var(--rule);
}
.headline-archive-item:last-child { border-bottom: 2px solid var(--rule); }
.headline-archive-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.015em;
    transition: opacity .15s ease;
}
.headline-archive-item:hover .headline-archive-title { opacity: .6; }
.headline-archive-item time { font-size: 15px; color: var(--muted); white-space: nowrap; }

.image-archive { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 16px; }
.image-archive > .post-list-empty { grid-column: 1 / -1; }
.image-archive-item { display: block; }
.image-archive-image { display: block; aspect-ratio: 1 / 1; overflow: hidden; background: var(--thumb-bg); }
.image-archive-image img { width: 100%; height: 100%; object-fit: cover; }
.image-archive-contain .image-archive-image img { object-fit: contain; }
.image-archive-title { display: block; margin-top: 8px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.image-archive-item:hover .image-archive-title { color: var(--text); }

/* /tags/ index */
.tag-index-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 24px;
    padding: 12px 0;
    border-top: 2px solid var(--rule);
}
.tag-index-item:last-child { border-bottom: 2px solid var(--rule); }
.tag-index-name { font-size: 19px; font-weight: 500; transition: opacity .15s ease; }
.tag-index-item:hover .tag-index-name { opacity: .6; }
.tag-index-count { font-size: 15px; color: var(--muted); white-space: nowrap; }

/* Post list
   -------------------------------------------------------------------------- */
.post-list {
    max-width: calc(640px + var(--gutter) * 2);
    margin-bottom: 40px;
}

.post-item {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: center;
    column-gap: 20px;
    padding: 16px 0;
    border-top: 1px solid var(--rule);
}
.post-item:last-child { border-bottom: 1px solid var(--rule); }
.post-item.no-thumb { grid-template-columns: 1fr auto; }

.post-item-thumb {
    display: block;
    width: 32px;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 3px;
    background: var(--thumb-bg);
}
.post-item-thumb img,
.post-item-thumb-empty {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}
.post-item:hover .post-item-thumb img { transform: scale(1.04); }

.post-item-body { min-width: 0; }

.post-item-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: -0.005em;
}
.post-item-title a { transition: opacity .15s ease; }
.post-item-title a:hover { opacity: .6; }

.post-item-tags {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--muted);
    letter-spacing: .01em;
}
.post-item-tags a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.post-item-tags .sep { margin: 0 6px; }

.post-item-date {
    font-size: 17px;
    color: var(--muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.post-list-empty { color: var(--muted); text-align: center; }


/* Pagination
   -------------------------------------------------------------------------- */
.pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 40px;
    font-size: 15px;
    color: var(--muted);
}
.pagination-next { text-align: right; }
.pagination a { color: var(--text); }
.pagination a:hover { opacity: .6; }

/* Archive headers (tag, author, index)
   -------------------------------------------------------------------------- */
.archive-header {
    text-align: center;
    padding-top: clamp(48px, 8vw, 96px);
    padding-bottom: clamp(36px, 5vw, 56px);
}
.archive-kicker {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}
.archive-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(32px, 5vw, 44px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}
.archive-description { margin: 14px auto 0; max-width: 32em; color: var(--muted); }
.archive-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; margin: 0 auto 18px; }

/* Article
   -------------------------------------------------------------------------- */
.article-header {
    text-align: center;
    padding-top: clamp(48px, 8vw, 96px);
    padding-bottom: clamp(32px, 4vw, 48px);
}
.article-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(34px, 5.2vw, 48px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.022em;
    text-wrap: balance;
}
.article-excerpt {
    margin: 18px auto 0;
    max-width: 30em;
    font-size: 20px;
    line-height: 1.5;
    color: var(--muted);
}
.article-meta {
    margin: 22px 0 0;
    font-size: 15px;
    color: var(--muted);
}
.article-meta a { color: var(--text); }
.article-meta a:hover { text-decoration: underline; text-underline-offset: 3px; }
.article-meta .sep { margin: 0 8px; }

.article-image { margin-top: 0; margin-bottom: clamp(36px, 5vw, 56px); }
.article-image img { width: 100%; border-radius: 6px; }
.article-image figcaption,
.gh-content figcaption {
    margin-top: 10px;
    font-size: 14px;
    color: var(--muted);
    text-align: center;
}

/* Content: Ghost's recommended grid so wide/full cards break out */
.gh-content {
    display: grid;
    grid-template-columns:
        [full-start] minmax(var(--gutter), 1fr)
        [wide-start] minmax(0, calc((var(--wide) - var(--narrow)) / 2))
        [main-start] min(var(--narrow), calc(100% - var(--gutter) * 2)) [main-end]
        minmax(0, calc((var(--wide) - var(--narrow)) / 2)) [wide-end]
        minmax(var(--gutter), 1fr) [full-end];
    font-size: 19px;
    line-height: 1.7;
}
.gh-content > * { grid-column: main-start / main-end; margin-top: 0; margin-bottom: 0; }
.gh-content > * + * { margin-top: 1.4em; }
.gh-content > .kg-width-wide { grid-column: wide-start / wide-end; }
.gh-content > .kg-width-full { grid-column: full-start / full-end; }
.gh-content > .kg-width-full img { width: 100%; border-radius: 0; }

.gh-content h2, .gh-content h3, .gh-content h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.25;
}
.gh-content > h2 { font-size: 30px; margin-top: 1.8em; }
.gh-content > h3 { font-size: 24px; margin-top: 1.6em; }
.gh-content > h4 { font-size: 20px; margin-top: 1.5em; }
.gh-content > h2 + *, .gh-content > h3 + *, .gh-content > h4 + * { margin-top: .6em; }

.gh-content a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: var(--muted);
}
.gh-content a:hover { text-decoration-color: var(--text); }
.gh-content .kg-card a, .gh-content .kg-bookmark-container { text-decoration: none; }

.gh-content ul, .gh-content ol { padding-left: 1.3em; }
.gh-content li + li { margin-top: .4em; }

.gh-content blockquote:not([class]) {
    margin-inline: 0;
    padding-left: 1.2em;
    border-left: 3px solid var(--text);
    font-size: 1.1em;
}
.gh-content blockquote.kg-blockquote-alt {
    text-align: center;
    font-size: 1.35em;
    font-style: italic;
    color: var(--muted);
    padding: 0 1em;
}

.gh-content hr {
    width: 100%;
    border: 0;
    height: 1px;
    background: var(--rule);
    margin-top: 2.4em;
    margin-bottom: 1em;
}

.gh-content img { border-radius: 4px; }
.gh-content figure { margin-inline: 0; }

.gh-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .85em;
    background: var(--thumb-bg);
    padding: .15em .35em;
    border-radius: 4px;
}
.gh-content pre {
    overflow-x: auto;
    padding: 18px 20px;
    background: #1c1d1c;
    color: #ecebe8;
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.55;
}
.gh-content pre code { background: none; padding: 0; font-size: inherit; }

.gh-content table { width: 100%; border-collapse: collapse; font-size: 16px; }
.gh-content th, .gh-content td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); }

/* Subscribe box, comments, prev/next */
.subscribe-box {
    width: min(var(--narrow), calc(100% - var(--gutter) * 2));
    padding-inline: 0;
    margin-top: 64px;
    text-align: center;
}
.subscribe-box > * { margin: 0; }
.subscribe-box {
    padding-top: 40px;
    padding-bottom: 40px;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}
.subscribe-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.subscribe-text { margin: 6px 0 20px !important; color: var(--muted); }

.article-comments { margin-top: 64px; }

.article-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 72px;
    margin-bottom: 24px;
}
.article-nav:empty { display: none; }
.article-nav-link {
    display: block;
    padding-top: 16px;
    border-top: 1px solid var(--rule);
    font-weight: 500;
    line-height: 1.35;
    transition: opacity .15s ease;
}
.article-nav-link:hover { opacity: .6; }
.article-nav-link span {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 400;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}
.article-nav-link.next { grid-column: 2; text-align: right; }
@media (max-width: 560px) {
    .article-nav { grid-template-columns: 1fr; }
    .article-nav-link.next { grid-column: 1; text-align: left; }
}

/* Footer
   -------------------------------------------------------------------------- */
.site-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-top: clamp(72px, 10vw, 128px);
    padding-bottom: clamp(32px, 5vw, 56px);
    text-align: center;
    font-size: 15px;
    line-height: 1.5;
    color: var(--muted);
}
/* Every footer item shares one size, weight and colour */
.footer-left { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 20px; }
.footer-copyright { margin: 0; }
.footer-nav .nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; list-style: none; margin: 0; padding: 0; }
.footer-nav a:hover { color: var(--text); }
.footer-right p { margin: 0; }
.footer-right a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.footer-right a:hover { color: var(--text); }


/* Error pages */
.error { padding-bottom: clamp(80px, 12vw, 160px); }

.article-meta time, .article-meta .reading-time { white-space: nowrap; }



/* Desktop measurements matched to the reference
   (960px frame, 632px reading column, 690px headline, 22px/54px type)
   -------------------------------------------------------------------------- */
body { font-size: var(--fs-base); line-height: 1.45; }

.site-header { padding-top: 64px; padding-bottom: 0; font-size: var(--fs-base); }
/* Header: the bold site title anchors the left; nav links are quiet tracked
   capitals in grey, like The Square Photo label (current page in full colour) */
.site-title { line-height: 1.45; font-family: var(--font-heading); font-weight: 700; letter-spacing: -0.01em; }
.site-nav .nav {
    gap: 6px 28px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.site-nav .nav a { color: var(--muted); transition: color .15s ease; }
.site-nav .nav a:hover { opacity: 1; color: var(--text); }
.site-nav .nav-current a { color: var(--text); }

.hero { padding-top: 126px; padding-bottom: 125px; }
.hero-headline {
    max-width: var(--hero);
    font-size: var(--fs-h1);
    line-height: 1.25;
    letter-spacing: -0.02em;
}
.hero-actions { gap: 16px; margin-top: 32px; }
.button { min-height: 51px; padding: 0 24px; font-size: 18px; }

.post-list { max-width: calc(var(--narrow) + var(--gutter) * 2); margin-bottom: 0; }
/* Compact rows (~66px): 32px thumbnail, 19px title, small tags beneath */
.post-item { padding: 10px 0; border-top-width: 2px; column-gap: 16px; }
.post-item:last-child { border-bottom-width: 2px; }
.post-item-title { font-size: 19px; line-height: 1.35; font-weight: 500; }
.post-item-tags { margin-top: 1px; font-size: 13px; }
.post-item-date { font-size: 16px; }
.pagination { margin-top: 40px; margin-bottom: 0; font-size: 18px; }

.archive-header { padding-top: 126px; padding-bottom: 96px; }
.archive-title { font-size: var(--fs-h1); line-height: 1.25; letter-spacing: -0.02em; }

.article-header { padding-top: 126px; padding-bottom: 125px; }
.article-title {
    font-size: var(--fs-h1);
    line-height: 1.25;
    letter-spacing: -0.02em;
}
.article-excerpt { font-size: var(--fs-base); max-width: var(--narrow); }
.article-meta { font-size: 18px; }
.article-image { margin-bottom: 126px; }
.article-image img { border-radius: 0; }
/* Square Photo posts keep the square crop from the home page */
.article-image-square img { aspect-ratio: 1 / 1; object-fit: cover; }

.gh-content { font-size: var(--fs-base); line-height: 1.45; }
.gh-content > * + * { margin-top: 1.2em; }
.gh-content > h2 { font-size: 1.6em; }
.gh-content > h3 { font-size: 1.3em; }
.gh-content > h4 { font-size: 1.1em; }

.subscribe-box { margin-top: 96px; }
.article-nav { margin-top: 96px; }
.article-nav-link { border-top-width: 2px; }

.site-footer { padding-top: 154px; padding-bottom: 64px; }

/* Post date: small and grey, directly beneath the title */
.article-date {
    margin: 16px 0 0;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.45;
    color: var(--muted);
}
.article-header .article-excerpt { margin-top: 28px; }
/* With the date small, posts need less room before the image or text */
.post-template .article-header { padding-bottom: 64px; }

/* Tags after the post text: "In Rails, Engineering" */
.article-tags {
    margin: 64px auto 0;
    font-size: 18px;
    color: var(--muted);
}
.article-tags a { color: var(--text); }
.article-tags a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Home columns
   1024px+: The Square Photo on the left (sticky, sideways title in the gap
   to its left) and the post list on the right; Drawings sit under the list.
   title ~26 + photo 290 + gap 44 + list 600 = the 960 frame.
   1200px+: the frame widens to 1128 and Drawings become a third column right
   of the list, half the photo's width, with its sideways title on its right:
   26 + 290 + 40 + 560 + 40 + 145 + 26 = 1127.
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
    .hero-latest { display: none; }
    /* Pull the columns up so the photo, caption and arrows fit on a ~700px-tall window */
    .hero:has(+ .home-columns .square-photo) { padding-top: 56px; padding-bottom: 40px; }

    .home-columns:has(.square-photo) {
        display: grid;
        grid-template-columns: 290px 600px;
        column-gap: 44px;
        justify-content: end;
        align-items: start;
        max-width: calc(var(--container) + var(--gutter) * 2);
        margin-inline: auto;
        padding-inline: var(--gutter);
    }
    .home-columns:has(.square-photo) > * {
        grid-column: 2;
        max-width: none;
        margin-inline: 0;
        padding-inline: 0;
    }
    .home-columns > .square-photo {
        grid-column: 1;
        grid-row: 1 / span 3;
        position: sticky;
        top: 32px;
        padding-bottom: 0;
    }
    .home-columns .square-photo-frame { --photo-size: 290px; }
    .home-columns:has(.square-photo) > .home-side { margin-top: 48px; }
}

@media (min-width: 1200px) {
    :root { --container: 1128px; }
    .home-columns:has(.square-photo) { justify-content: center; }
    .home-columns:has(.square-photo):has(.home-side :is(.drawings, .home-tags)) {
        grid-template-columns: 290px 560px 145px;
        column-gap: 40px;
    }
    /* Sticky like the photo, and exactly as tall as the photo itself (290),
       so the Tags box's bottom border lines up with the photo's bottom edge */
    .home-columns:has(.square-photo) > .home-side {
        grid-column: 3;
        grid-row: 1 / span 3;
        position: sticky;
        top: 32px;
        display: flex;
        flex-direction: column;
        height: 290px;
        margin-top: 0;
    }
    .home-side .drawings { position: relative; flex: none; width: auto; }
    /* Tighter arrows here (24px tall, 2px under the drawing) to give Tags ~14px more */
    .home-side .drawings .carousel-nav { margin-top: 2px; }
    .home-side .drawings .carousel-button { height: 24px; }
    .home-side .drawings-label {
        position: absolute;
        left: 100%;
        top: 0;
        margin: 0 0 0 14px;
        writing-mode: vertical-rl;
    }
    .home-side .home-tags {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        margin-top: 8px;
        padding: 10px 12px;
    }
    .home-side .home-tags-label { text-align: left; }
    .home-side .home-tags-label { margin-bottom: 8px; }
    /* More tags than fit: the list scrolls inside the box */
    .home-side .home-tags-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        align-content: flex-start;
        justify-content: flex-start;
        gap: 2px 12px;
        font-size: 13px;
    }
}

/* Phone layout
   Mirrors the reference at phone width: menu collapses behind a two-line
   icon into a full-screen, right-aligned list; wider 32px edges; roomier
   vertical rhythm; dates stay top-right beside the title; footer stays on
   one row.
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
    :root { --gutter: 32px; }
    body { font-size: 19px; }

    .site-header {
        padding-top: 48px;
        padding-bottom: 0;
        font-size: 19px;
    }
    .site-title { line-height: 28px; }

    .menu-toggle { display: inline-flex; }

    .site-nav {
        position: fixed;
        inset: 0;
        z-index: 100;
        display: none;
        overflow-y: auto;
        padding: 48px var(--gutter);
        background: var(--bg);
        text-align: right;
    }
    .menu-open .site-nav { display: block; }
    .menu-open body { overflow: hidden; }

    .site-nav .menu-close {
        display: inline-flex;
        margin: -6px -8px 0 0;
    }
    .site-nav .nav {
        flex-direction: column;
        align-items: flex-end;
        gap: 0;
        margin-top: 20px;
        font-size: 19px;
        font-weight: 400;
        letter-spacing: normal;
        text-transform: none;
    }
    .site-nav .nav a {
        display: inline-block;
        padding: 17px 0;
        line-height: 28px;
        color: var(--text);
    }

    .hero {
        padding-top: 118px;
        padding-bottom: 118px;
    }
    .hero-headline {
        max-width: none;
        font-size: 38px;
        line-height: 1.25;
        letter-spacing: -0.02em;
    }
    .hero-actions { gap: 18px; margin-top: 32px; }
    .carousel-nav { margin-top: 8px; }
    .carousel-button { width: 40px; height: 40px; }

    /* No room beside the photo on phones: the title sits above it instead */
    .hero:has(+ .home-columns .square-photo) { padding-bottom: 40px; }
    .square-photo { padding-bottom: 96px; }
    .home-side { margin-top: 48px; }
    .image-archive { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .headline-archive-title { font-size: 20px; }
    .square-photo-label {
        position: static;
        height: auto;
        margin: 0 0 10px;
        writing-mode: horizontal-tb;
        transform: none;
        text-align: center;
    }
    .button { min-height: 46px; padding: 0 22px; font-size: 16px; }

    .post-list { margin-bottom: 0; }
    .post-item {
        grid-template-columns: 32px 1fr auto;
        align-items: start;
        column-gap: 12px;
        padding: 10px 0;
        border-top-width: 2px;
    }
    .post-item:last-child { border-bottom-width: 2px; }
    .post-item.no-thumb { grid-template-columns: 1fr auto; column-gap: 16px; }
    .post-item-thumb { width: 32px; margin-top: 2px; }
    .post-item-title { font-size: 18px; line-height: 1.35; }
    .post-item-tags { font-size: 13px; margin-top: 1px; }
    .post-item-date { font-size: 15px; line-height: 24px; }

    .pagination { margin-top: 32px; margin-bottom: 0; }

    .archive-header,
    .article-header { padding-top: 96px; padding-bottom: 48px; }
    .archive-title,
    .article-title { font-size: 38px; line-height: 1.25; letter-spacing: -0.02em; }
    .article-excerpt { font-size: 19px; }
    .article-date { margin-top: 12px; font-size: 16px; }
    .post-template .article-header { padding-bottom: 36px; }
    .article-image { margin-bottom: 48px; }
    .article-tags { margin-top: 48px; font-size: 16px; }
    .gh-content { font-size: 19px; }

    .article-nav { grid-template-columns: 1fr; }
    .article-nav-link.next { grid-column: 1; text-align: left; }

    .site-footer {
        padding-top: 146px;
        padding-bottom: 48px;
    }
}
