:root {
    --inline-image-max-width: min(100%, 680px);
    --inline-image-max-height: 560px;
    --gallery-card-max-width: min(100%, 680px);
    --gallery-natural-max-height: 420px;
    --post-image-radius: 10px;
    --pb-grid-gap: clamp(12px, 2vw, 20px);
    --pb-split-gap: clamp(20px, 4vw, 48px);
    --pb-split-flow-gap: clamp(12px, 2vw, 20px);
}

.gh-content img {
    height: auto;
}

.gh-content .kg-image-card {
    width: fit-content;
    max-width: 100%;
    margin-right: auto;
    margin-left: auto;
}

.gh-content .kg-image-card:not(.kg-width-wide):not(.kg-width-full) {
    max-width: var(--inline-image-max-width);
}

.gh-content .kg-image-card:not(.kg-width-wide):not(.kg-width-full) .kg-image,
.gh-content > img,
.gh-content p:has(> img:only-child) > img {
    width: auto;
    max-width: 100%;
    max-height: var(--inline-image-max-height);
    margin-right: auto;
    margin-left: auto;
    object-fit: contain;
    border-radius: var(--post-image-radius);
}

.gh-content .kg-image-card.pb-card-mode-cropped:not(.kg-width-wide):not(.kg-width-full) {
    width: min(100%, var(--inline-image-max-width));
}

.gh-content .kg-image-card.pb-card-mode-cropped a {
    display: block;
}

.gh-content .kg-image-card.pb-card-mode-cropped:not(.kg-width-wide):not(.kg-width-full) .kg-image {
    width: 100%;
    max-height: none;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.gh-content p:has(> img:only-child) {
    width: fit-content;
    max-width: var(--inline-image-max-width);
    margin-right: auto;
    margin-left: auto;
}

.kg-image[width][height],
.kg-gallery-image {
    cursor: zoom-in;
}

.gh-content .kg-gallery-card {
    grid-column: main;
    width: min(100%, var(--gallery-card-max-width));
    max-width: 100%;
    margin-right: auto;
    margin-left: auto;
    overflow: hidden;
}

.gh-content .kg-gallery-container {
    width: 100%;
    max-width: 100%;
}

.gh-content .kg-gallery-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: var(--pb-grid-gap);
    justify-content: stretch;
    width: 100%;
}

.gh-content .kg-gallery-row:not(:first-of-type) {
    margin-top: var(--pb-grid-gap);
}

.gh-content .kg-gallery-image {
    min-width: 0;
    width: auto !important;
    margin: 0 !important;
}

.gh-content .kg-gallery-image img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--post-image-radius);
}

.gh-content .kg-gallery-card.pb-card-mode-natural .kg-gallery-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.gh-content .kg-gallery-card.pb-card-mode-natural .kg-gallery-image {
    display: flex;
    flex-basis: 0;
    flex-grow: var(--pb-gallery-grow, 1);
    flex-shrink: 1;
    justify-content: center;
    align-items: flex-start;
    max-width: min(100%, var(--pb-gallery-max-width, 100%));
}

.gh-content .kg-gallery-card.pb-card-mode-natural .kg-gallery-image img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto !important;
    max-height: var(--gallery-natural-max-height);
    aspect-ratio: auto !important;
    object-fit: contain !important;
}

.gh-content .pb-layout-grid figcaption {
    margin-top: 0.75rem;
    color: var(--secondary-text-color);
    font-size: 0.9em;
    text-align: center;
    text-wrap: balance;
}

.gh-content .pb-layout-grid {
    display: grid;
    grid-template-columns: repeat(var(--pb-grid-columns, 2), minmax(0, 1fr));
    gap: var(--pb-grid-gap);
    width: min(100%, 920px);
    margin: 2rem auto;
}

.gh-content .pb-layout-grid > * {
    min-width: 0;
    margin: 0;
}

.gh-content .pb-layout-grid > .kg-image-card,
.gh-content .pb-layout-grid > .kg-image-card:not(.kg-width-wide):not(.kg-width-full) {
    width: auto;
    max-width: none;
    margin: 0;
}

.gh-content .pb-layout-grid > .kg-image-card:not(.kg-width-wide):not(.kg-width-full) .kg-image {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    aspect-ratio: var(--pb-grid-aspect-ratio, 1 / 1);
    object-fit: cover;
    border-radius: var(--post-image-radius);
}

.gh-content .pb-layout-grid--natural {
    align-items: start;
    justify-items: center;
}

.gh-content .pb-layout-grid--natural > * {
    align-self: center;
    justify-self: center;
    display: grid;
    justify-items: center;
    align-content: center;
    width: 100%;
    text-align: center;
}

.gh-content .pb-layout-grid--natural > .kg-image-card:not(.kg-width-wide):not(.kg-width-full) .kg-image {
    width: auto;
    max-width: 100%;
    height: auto !important;
    max-height: none;
    aspect-ratio: unset !important;
    object-fit: contain !important;
}

.gh-content .pb-layout-grid .kg-image,
.gh-content .pb-layout-split-media .kg-image {
    cursor: zoom-in;
}

.gh-content .pb-layout-grid--2 {
    --pb-grid-columns: 2;
}

.gh-content .pb-layout-grid--3 {
    --pb-grid-columns: 3;
}

.gh-content .pb-layout-grid--4 {
    --pb-grid-columns: 4;
}

.gh-content .pb-layout-grid--wide {
    width: min(100%, 1120px);
}

.gh-content .pb-layout-split {
    --pb-split-media-column: 46%;
    --pb-split-media-max-width: 32rem;
    --pb-split-media-ratio: 1;
    display: flow-root;
    width: min(100%, 920px);
    margin: 2.5rem auto;
}

.gh-content .pb-layout-split > * {
    min-width: 0;
}

.gh-content .pb-layout-split-media {
    float: left;
    width: min(100%, var(--pb-split-media-column), var(--pb-split-media-max-width));
    max-width: 100%;
    margin: 0;
    margin-right: var(--pb-split-gap);
    margin-bottom: var(--pb-split-flow-gap);
}

.gh-content .pb-layout-split-media .kg-image-card {
    width: 100%;
    max-width: 100%;
    margin: 0;
}

.gh-content .pb-layout-split-media .kg-image {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: none;
    height: auto;
    margin: 0;
    object-fit: contain;
    border-radius: var(--post-image-radius);
}

.gh-content .pb-layout-split-copy > :first-child {
    margin-top: 0;
}

.gh-content .pb-layout-split-copy > * {
    margin-bottom: 0;
}

.gh-content .pb-layout-split-copy > * + * {
    margin-top: var(--pb-split-flow-gap);
}

.gh-content .pb-layout-split-copy > :last-child {
    margin-bottom: 0;
}

.gh-content .pb-layout-split--reverse .pb-layout-split-media {
    float: right;
    margin-right: 0;
    margin-left: var(--pb-split-gap);
}

.gh-content .pb-layout-split--compact {
    --pb-split-gap: clamp(16px, 3vw, 32px);
    --pb-split-media-column: 42%;
    width: min(100%, 760px);
}

.gh-content .pb-layout-split--cropped {
    --pb-split-media-column: 42%;
}

.gh-content .pb-layout-split--cropped .pb-layout-split-media .kg-image-card {
    width: 100%;
    height: auto;
    margin: 0;
}

.gh-content .pb-layout-split--cropped .pb-layout-split-media .kg-image-card:not(.kg-width-wide):not(.kg-width-full) .kg-image {
    width: 100%;
    max-width: none;
    height: auto;
    max-height: none;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--post-image-radius);
}

@media (max-width: 900px) {
    .gh-content .pb-layout-grid--4 {
        --pb-grid-columns: 3;
    }

    .gh-content .pb-layout-split {
        --pb-split-gap: clamp(16px, 3vw, 28px);
    }

    .gh-content .pb-layout-split-media,
    .gh-content .pb-layout-split--reverse .pb-layout-split-media {
        width: min(100%, 44%, var(--pb-split-media-max-width));
    }
}

@media (max-width: 720px) {
    .gh-content .pb-layout-grid--3,
    .gh-content .pb-layout-grid--4 {
        --pb-grid-columns: 2;
    }

    .gh-content .pb-layout-split-media,
    .gh-content .pb-layout-split--reverse .pb-layout-split-media {
        float: none;
        width: min(100%, var(--inline-image-max-width));
        margin-right: auto;
        margin-left: auto;
    }
}

@media (max-width: 520px) {
    .gh-content .pb-layout-grid {
        --pb-grid-columns: 1;
    }
}
