/* heiberg theme: Ghost content cards (.kg-*). Colour: ink, mist, rule on paper; accent only for links, buttons, focus. */
.kg-card { margin: 0 0 1.6em; }
.kg-card img { border-radius: var(--radius); }

/* image widths (required by Ghost). They break out of the article column to the left, on the same grid. */
.kg-width-wide, .kg-width-full { position: relative; max-width: none; }
.kg-width-wide { margin-left: calc(-1 * (var(--label) + var(--gap))); width: calc(min(var(--page), 100vw) - 2 * var(--pad)); }
.kg-width-full { margin-left: calc(-1 * ((100vw - min(var(--page), 100vw)) / 2 + var(--pad) + var(--label) + var(--gap) - 20px)); width: calc(100vw - 40px); }
@media (max-width: 639px) { .kg-width-wide, .kg-width-full { margin-left: 0; width: 100%; } }
.kg-image-card img, .kg-gallery-image img { display: block; width: 100%; height: auto; }

figcaption, .kg-card figcaption { color: var(--mist); font-size: 13px; line-height: 1.45; margin-top: 8px; text-align: left; }
figcaption a { color: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }

/* gallery */
.kg-gallery-container { display: flex; flex-direction: column; gap: 8px; }
.kg-gallery-row { display: flex; flex-direction: row; gap: 8px; }
.kg-gallery-image { flex: 1 1 0; min-width: 0; }
.kg-gallery-image img { border-radius: var(--radius); object-fit: cover; height: 100%; }

/* bookmark */
.kg-bookmark-card { width: 100%; }
.kg-bookmark-container {
  display: flex; min-height: 120px; color: inherit; text-decoration: none; overflow: hidden;
  border: 1px solid var(--rule); border-radius: var(--radius); background: transparent; box-shadow: none;
}
.kg-bookmark-container:hover { border-color: var(--ink); }
.kg-bookmark-content { flex: 1 1 0; min-width: 0; padding: 18px 20px; display: flex; flex-direction: column; justify-content: flex-start; }
.kg-bookmark-title { font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.kg-bookmark-description { color: var(--mist); font-size: 14px; line-height: 1.45; margin-top: 6px; max-height: 4.4em; overflow: hidden; overflow-wrap: anywhere; }
.kg-bookmark-metadata { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 12px; color: var(--mist); font-size: 13px; flex-wrap: wrap; }
.kg-bookmark-icon { width: 18px; height: 18px; border-radius: 3px; }
.kg-bookmark-thumbnail { position: relative; flex: 0 0 32%; min-width: 96px; }
.kg-bookmark-thumbnail img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
@media (max-width: 639px) {
  .kg-bookmark-container { flex-direction: column-reverse; min-height: 0; }
  .kg-bookmark-content { flex: none; }
  .kg-bookmark-thumbnail { flex: none; min-height: 140px; }
}

/* Ghost draws card borders with an inset shadow; we use real borders */
.kg-toggle-card, .kg-audio-card, .kg-file-card a.kg-file-card-container, .kg-callout-card[class] { box-shadow: none; }

/* embed, video, audio */
.kg-embed-card { display: flex; flex-direction: column; align-items: stretch; }
.kg-embed-card iframe { max-width: 100%; border-radius: var(--radius); }
.kg-video-card video, .kg-video-container { border-radius: var(--radius); overflow: hidden; }
.kg-audio-card { border: 1px solid var(--rule); border-radius: var(--radius); background: transparent; box-shadow: none; }
.kg-audio-title { color: var(--ink); font-weight: 500; }
.kg-audio-player-container, .kg-audio-current-time, .kg-audio-time { color: var(--mist); }

/* callout */
.kg-callout-card[class] {
  display: flex; gap: 14px; padding: 18px 20px; background: transparent;
  border: 1px solid var(--rule); border-left: 3px solid var(--ink); border-radius: var(--radius); color: var(--ink);
}
.kg-callout-emoji { font-size: 1.1em; line-height: 1.5; }
.kg-callout-text { flex: 1; min-width: 0; line-height: 1.5; overflow-wrap: anywhere; }
.kg-callout-text p:last-child { margin-bottom: 0; }

/* toggle */
.kg-toggle-card[class] { border: 1px solid var(--rule); border-radius: var(--radius); background: transparent; padding: 14px 18px; }
.kg-toggle-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; }
.kg-toggle-heading-text { margin: 0; font-size: 1em; font-weight: 500; letter-spacing: 0; }
.kg-toggle-card-icon { background: transparent; border: 0; color: var(--ink); cursor: pointer; padding: 0; }
.kg-toggle-card-icon svg { width: 14px; height: 14px; }
.kg-toggle-content { margin-top: 10px; color: var(--mist); }
.kg-toggle-content p:last-child { margin-bottom: 0; }

/* quotes */
blockquote {
  margin: 0 0 1.6em; padding: 0 0 0 20px; border-left: 3px solid var(--ink);
  font-size: 1.15em; line-height: 1.45; font-weight: 500; letter-spacing: -0.01em;
}
blockquote p:last-child { margin-bottom: 0; }
blockquote.kg-blockquote-alt {
  border-left: 0; padding: 0; text-align: center; color: var(--mist); font-size: 1.3em; font-weight: 400;
}

/* divider */
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4em 0; height: 0; }

/* button */
.kg-button-card { display: flex; }
.kg-button-card.kg-align-center { justify-content: center; }
.kg-button-card .kg-btn, .kg-btn[class] {
  background: var(--accent); color: #fff; border-radius: 4px; padding: 10px 18px; font-weight: 500;
  height: auto; text-decoration: none;
}

/* file */
.kg-file-card-container {
  display: flex; align-items: center; gap: 16px; padding: 16px 18px; color: inherit; text-decoration: none;
  border: 1px solid var(--rule); border-radius: var(--radius); background: transparent;
}
.kg-file-card-container:hover { border-color: var(--ink); }
.kg-file-card-contents { flex: 1; min-width: 0; }
.kg-file-card-title { font-weight: 500; overflow-wrap: anywhere; }
.kg-file-card-caption { color: var(--mist); font-size: 14px; }
.kg-file-card-metadata { color: var(--mist); font-size: 13px; }
.kg-file-card-icon { background: transparent; }
.kg-file-card-icon:before { display: none; }
.kg-file-card-icon svg { width: 24px; height: 24px; color: var(--ink); }

/* header card */
.kg-header-card { padding: 40px 24px; border: 1px solid var(--rule); border-radius: var(--radius); background: transparent; color: var(--ink); text-align: left; min-height: 0; }
.kg-header-card h2, .kg-header-card h3 { color: var(--ink); }

/* code */
pre {
  margin: 0 0 1.6em; padding: 16px 18px; overflow-x: auto; background: #F3F3EF; color: var(--ink);
  border-radius: var(--radius); font-size: 14px; line-height: 1.55; max-width: 100%;
}
code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 0.92em; }
:not(pre) > code { background: #F3F3EF; padding: 0.1em 0.35em; border-radius: 3px; }
pre code { font-size: inherit; }

.kg-audio-thumbnail.placeholder { background: var(--rule); }
.kg-audio-thumbnail.placeholder svg, .kg-audio-thumbnail.placeholder path { color: var(--ink); fill: var(--ink); }
