/* Styles for a blog post. The text keeps a reading width rather than running full width. */

.post-shell {
    width: 100%;
    max-width: calc(1240px + 2 * var(--page-gutter));
    margin-inline: auto;
    padding-inline: var(--page-gutter);
}

/* Fills as the article is read. post.js sets the width. */
.post-progress {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 101;
    height: 3px;
    pointer-events: none;
}

.post-progress span {
    display: block;
    height: 100%;
    background: var(--color-primary);
    transform: scaleX(0);
    transform-origin: left;
}


/* Title band
   ========================================================================== */

/* A flat band, with the photo below it, so the title is always readable. */
.post-hero {
    display: block;
    min-height: 0;
}

.post-hero__inner {
    display: grid;
    justify-items: start;
    gap: var(--space-3);
    padding-block: var(--space-6) var(--space-7);
}

/* The photo comes up over the foot of the band. */
.post-hero--over-image .post-hero__inner {
    padding-bottom: calc(var(--space-7) + 48px);
}

.post-hero h1 {
    max-width: 28ch;
}

.post-hero__standfirst {
    max-width: 62ch;
}

.post-hero__topic {
    color: inherit;
    text-decoration: none;
}

.post-hero__topic:hover {
    text-decoration: underline;
}

.post-crumbs ol,
.post-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-sm);
}

.post-crumbs {
    margin-bottom: var(--space-2);
    opacity: 0.8;
}

.post-crumbs a {
    color: inherit;
}

.post-crumbs li + li::before {
    content: "/";
    margin-inline-end: var(--space-2);
    opacity: 0.6;
}

.post-hero__meta {
    margin-top: var(--space-1);
    opacity: 0.85;
}

.post-hero__meta li + li::before {
    content: "·";
    margin-inline-end: var(--space-2);
}

.post-lead {
    position: relative;
    margin-top: -48px;
}

.post-lead a {
    display: block;
}

.post-lead img {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-card);
    background: var(--color-surface-raised);
    box-shadow: 0 24px 60px rgb(0 0 0 / 0.22);
    object-fit: cover;
}

@media (min-width: 900px) {
    .post-hero--over-image .post-hero__inner {
        padding-bottom: calc(var(--space-7) + 96px);
    }

    .post-lead {
        margin-top: -96px;
    }
}


/* Text and side column
   ========================================================================== */

.post-layout {
    display: grid;
    gap: var(--space-7);
    padding-block: var(--space-7) var(--space-8);
}

.post-article {
    min-width: 0;
}

.post-aside {
    display: grid;
    align-content: start;
    gap: var(--space-5);
    min-width: 0;
}

/*
 * The side column stays in view under the header. One taller than the screen scrolls
 * with the page until its last box is in view, and stays there, so its buttons can
 * always be reached. post.js gives it its height.
 */
@media (min-width: 1100px) {
    .post-layout {
        grid-template-columns: minmax(0, 1fr) 296px;
        gap: var(--space-8);
    }

    .post-aside {
        position: sticky;
        top: min(calc(var(--header-height) + var(--space-5)), calc(100vh - var(--post-aside-height, 0px) - var(--space-5)));
        align-self: start;
    }

    .post-contents-fold {
        display: none;
    }
}

@media (max-width: 1099.98px) {
    .post-contents-side {
        display: none;
    }
}

.post-panel {
    padding: var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    background: var(--color-surface);
}

.post-panel__title,
.post-contents-fold summary {
    margin-bottom: var(--space-3);
    color: var(--color-text);
    font-family: var(--font-label);
    font-size: var(--text-sm);
    font-weight: 700;
    letter-spacing: min(var(--eyebrow-tracking), 0.12em);
    text-transform: uppercase;
}

.post-panel__buttons {
    display: grid;
    gap: var(--space-2);
}

/* On this page */
.post-contents {
    margin: 0;
    padding: 0;
    list-style: none;
}

.post-contents a {
    display: block;
    padding: var(--space-2) 0 var(--space-2) var(--space-3);
    border-left: 2px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: 1.4;
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s;
}

.post-contents a:hover {
    border-color: var(--color-border-strong);
    color: var(--color-text);
}

.post-contents a[aria-current="true"] {
    border-color: var(--color-primary);
    color: var(--color-text);
    font-weight: 700;
}

.post-contents__sub a {
    padding-left: var(--space-6);
    font-size: 0.8125rem;
}

.post-contents-fold {
    margin-bottom: var(--space-6);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    background: var(--color-surface);
}

.post-contents-fold summary {
    margin: 0;
    cursor: pointer;
}

.post-contents-fold[open] summary {
    margin-bottom: var(--space-3);
}

/* More reading */
.post-mini-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.post-mini {
    position: relative;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3);
    padding-block: var(--space-3);
}

.post-mini + .post-mini {
    border-top: 1px solid var(--color-border);
}

.post-mini img {
    width: 64px;
    height: 52px;
    border-radius: calc(var(--radius-card) / 2);
    background: var(--color-surface-raised);
    object-fit: cover;
}

.post-mini h3 {
    display: -webkit-box;
    overflow: hidden;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: normal;
    text-transform: none;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.post-mini h3 a {
    color: inherit;
    text-decoration: none;
}

/* Makes the whole row one link. */
.post-mini h3 a::after {
    content: "";
    position: absolute;
    inset: 0;
}

.post-mini:hover h3 {
    color: var(--color-accent-text);
}

.post-mini p {
    margin-top: 2px;
    color: var(--color-text-muted);
    font-size: 0.75rem;
}


/* The article text
   ==========================================================================
   PostBody has already taken out pasted styles. The !important rules only matter
   if it ever hands back the text as it came, with styles written into it. */

.post-body :is(p, div, li, span, font, td, th, blockquote, dd, dt) {
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    color: inherit !important;
    background-color: transparent !important;
    text-align: start !important;
}

.post-body * {
    float: none !important;
    position: static !important;
    max-width: 100% !important;
}

.post-body {
    font-size: 1.0625rem;
    line-height: 1.75;
    overflow-wrap: break-word;
}

@media (min-width: 768px) {
    .post-body {
        font-size: 1.125rem;
    }
}

.post-body > :first-child {
    margin-top: 0;
}

.post-body > :last-child {
    margin-bottom: 0;
}

.post-body :is(p, dl) {
    margin: 0 0 1.25em;
}

/* Every post opens the same way, whatever the writer did to the first line. */
.post-body > p:first-of-type {
    font-size: 1.15em !important;
    line-height: 1.6 !important;
}

.post-body :is(h2, h3, h4, h5, h6) {
    scroll-margin-top: calc(var(--header-height) + var(--space-5));
}

.post-body h2 {
    margin: 2em 0 0.6em;
    font-size: 1.6em;
}

/* A short bar under each main heading gives a long post a rhythm. */
.post-body h2::after {
    content: "";
    display: block;
    width: 46px;
    height: 3px;
    margin-top: 0.45em;
    background: var(--color-primary);
}

.post-body h3 {
    margin: 1.8em 0 0.5em;
    font-size: 1.28em;
}

.post-body :is(h4, h5, h6) {
    margin: 1.6em 0 0.45em;
    font-family: var(--font-heading);
    font-size: 1.08em;
    font-weight: 700;
}

.post-body a {
    color: var(--color-accent-text);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.post-body a:hover {
    color: var(--color-text);
}

.post-body :is(strong, b) {
    font-weight: 700;
}

.post-body :is(ul, ol) {
    margin: 0 0 1.25em;
    padding-left: 1.4em;
}

.post-body li + li {
    margin-top: 0.5em;
}

.post-body li::marker {
    color: var(--color-primary);
}

.post-body :is(ul, ol) :is(ul, ol) {
    margin: 0.5em 0 0;
}

.post-body img {
    display: block;
    height: auto;
    border-radius: var(--radius-card);
}

.post-body figure {
    margin: 1.75em 0;
}

.post-body figcaption {
    margin-top: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.post-body blockquote {
    margin: 1.75em 0;
    padding: var(--space-4) var(--space-5);
    border-left: 4px solid var(--color-primary);
    background: var(--color-surface);
    font-size: 1.08em;
}

.post-body blockquote p:last-child {
    margin-bottom: 0;
}

.post-body hr {
    margin: 2.5em 0;
    border: 0;
    border-top: 1px solid var(--color-border);
}

.post-body pre {
    overflow-x: auto;
    margin: 0 0 1.25em;
    padding: var(--space-4);
    border-radius: var(--radius-card);
    background: var(--color-surface-raised);
    font-size: 0.875em;
}

.post-body code {
    font-size: 0.9em;
}

.post-body__table {
    overflow-x: auto;
    margin: 1.75em 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
}

.post-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92em;
}

.post-body :is(td, th) {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
    text-align: start;
    vertical-align: top;
}

.post-body th {
    background: var(--color-surface-raised);
    font-weight: 700;
}

.post-body tr:last-child :is(td, th) {
    border-bottom: 0;
}

.post-body__embed {
    margin: 1.75em 0;
}

.post-body__embed iframe,
.post-video iframe {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: var(--radius-card);
}


/* Gallery, videos, tags and sharing
   ========================================================================== */

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

/* A post has up to three more pictures, so they fit one row: three across, two, or one wide. */
.post-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: var(--space-3);
}

.post-gallery a {
    display: block;
    overflow: hidden;
    border-radius: var(--radius-card);
    background: var(--color-surface-raised);
    cursor: zoom-in;
}

.post-gallery img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.post-videos {
    display: grid;
    gap: var(--space-5);
}

.post-block .pill-list {
    margin-bottom: 0;
}

.post-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-top: var(--space-8);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border);
}


/* Bikes and more posts, under the article
   ========================================================================== */

.post-band--more {
    border-top: 1px solid var(--color-border);
}

@media (prefers-reduced-motion: no-preference) {
    .post-gallery img {
        transition: transform 0.3s;
    }

    .post-gallery a:hover img {
        transform: scale(1.03);
    }
}

@media print {
    .site-header,
    .site-footer,
    .post-progress,
    .post-aside,
    .post-contents-fold,
    .post-foot,
    .post-band,
    .lightbox {
        display: none !important;
    }

    .post-hero {
        background: none;
        color: #000;
    }

    .post-hero__inner,
    .post-hero--over-image .post-hero__inner {
        padding: 0 0 var(--space-4);
    }

    .post-lead {
        margin-top: 0;
    }

    .post-lead img {
        box-shadow: none;
    }

    .post-body {
        font-size: 11.5pt;
    }
}
