/* FCS Magazine — Koenig editor card styles.
 *
 * Ghost's Koenig editor produces a fixed set of card classes whenever editors
 * use rich-text features (wide/full images, galleries, bookmark previews).
 * GScan flags missing styles for these as errors. This file owns ALL of them
 * so the post-template typography file stays focused on reading-vehicle work.
 *
 * Cascade order (default.hbs): tokens → base → ... → post → page → koenig → reveal
 * Sits AFTER post.css/page.css so Koenig cards layer onto the reading-vehicle
 * defaults rather than fighting them.
 *
 * Design posture (Doc #163 §0):
 *   - Wide and full bleeds extend past the 720px reading well into wider grounds.
 *   - Bookmark cards visually rhyme with the homepage closing-CTA / Media Kit
 *     card pattern — paper-soft background, copper hover, soft shadow lift.
 *     This is the embedded-link expression of FCS's "structural rhyme that
 *     holds the magazine together" rule.
 *   - Galleries are simple flex/grid; no lightbox (v1.1 backlog).
 *   - No new color tokens introduced. Everything reads from tokens.css.
 */

/* ─── 1. WIDE AND FULL BLEED IMAGES ────────────────────────────
 * Wide: extends past the 720px reading well into the wider container.
 * Full: edge-to-edge of the viewport.
 * Both inherit ample vertical breathing room (3rem top/bottom — Heidi spec).
 */
.post-body .kg-width-wide,
.page-body-inner .kg-width-wide {
  /* Push beyond the 720px reading well to a magazine-wide measure.
   * Negative margin technique keeps the cell inside the centered container
   * without requiring a layout change. Capped at the 1320px container max
   * so it doesn't exceed the homepage's outer container. */
  position: relative;
  width: calc(100% + 18rem);
  max-width: min(1320px, 100vw - 4rem);
  margin-left: 50%;
  transform: translateX(-50%);
  margin-top: 3rem;
  margin-bottom: 3rem;
}

.post-body .kg-width-full,
.page-body-inner .kg-width-full {
  /* Full-bleed: edge-to-edge of viewport. Breaks fully out of the centered
   * container by anchoring to viewport coordinates. */
  position: relative;
  width: 100vw;
  max-width: 100vw;
  margin-left: 50%;
  transform: translateX(-50%);
  margin-top: 3rem;
  margin-bottom: 3rem;
}

.post-body .kg-width-wide img,
.post-body .kg-width-full img,
.page-body-inner .kg-width-wide img,
.page-body-inner .kg-width-full img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px; /* wide retains the rounding; full goes square edges via override below */
}

.post-body .kg-width-full img,
.page-body-inner .kg-width-full img {
  border-radius: 0;
}

/* Captions on wide/full bleeds — copper-pale italic, breathing space. */
.post-body .kg-card figcaption,
.page-body-inner .kg-card figcaption {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-style: italic;
  color: var(--ink-whisper);
  text-align: center;
  padding: 0.85rem 1.25rem 0;
  max-width: 720px;
  margin: 0 auto;
}

/* ─── 2. GALLERY CARD ──────────────────────────────────────────
 * Simple flex layout. Ghost's Koenig produces a column-stack of rows;
 * each row is a flex container of images that auto-size to fill the row.
 * No lightbox — v1.1 backlog.
 */
.post-body .kg-gallery-card,
.page-body-inner .kg-gallery-card {
  margin-top: 3rem;
  margin-bottom: 3rem;
}

.kg-gallery-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: min(1320px, 100vw - 4rem);
  margin-left: 50%;
  transform: translateX(-50%);
  width: calc(100% + 18rem);
}

.kg-gallery-row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 0.75rem;
}

.kg-gallery-image img {
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 4px;
  display: block;
  object-fit: cover;
}

/* ─── 3. BOOKMARK CARD ─────────────────────────────────────────
 * Ghost auto-generates these when an editor pastes a URL on its own line.
 * Visual rhyme with the homepage closing-CTA / Media Kit card pattern:
 * paper-soft ground, copper-hover state, soft shadow lift.
 *
 * Layout: text left, thumbnail right. Stacks on mobile.
 */
.kg-bookmark-card {
  display: block;
  margin: 2rem 0;
  position: relative;
  width: 100%;
}

.kg-bookmark-container {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  color: inherit;
  min-height: 148px;
}

.kg-bookmark-container:hover {
  transform: translateY(-3px);
  border-color: var(--copper);
  box-shadow: var(--shadow-float);
}

.kg-bookmark-content {
  flex: 1 1 60%;
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0; /* allow text truncation inside flex */
}

.kg-bookmark-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
  /* No underline — the entire card is the affordance, not the title text. */
  transition: color 0.25s ease;
}

.kg-bookmark-container:hover .kg-bookmark-title { color: var(--copper-dark); }

.kg-bookmark-description {
  font-family: var(--font-body);
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-mute);
  font-weight: 500;
  margin-bottom: 0.85rem;
  /* Two-line clamp keeps the card height stable across long descriptions. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kg-bookmark-metadata {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-whisper);
}

.kg-bookmark-icon {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}

.kg-bookmark-author,
.kg-bookmark-publisher {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Subtle separator dot between author and publisher when both render. */
.kg-bookmark-author + .kg-bookmark-publisher::before {
  content: '·';
  margin: 0 0.4rem;
  color: var(--ink-whisper);
}

.kg-bookmark-thumbnail {
  flex: 0 0 40%;
  max-width: 220px;
  position: relative;
  background: var(--sage-wash);
  overflow: hidden;
}

.kg-bookmark-thumbnail img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0;
  border-radius: 0;
}

/* ─── 4. RESPONSIVE ────────────────────────────────────────────
 * Bleeds and galleries collapse cleanly under the 720px reading well at
 * mobile widths; bookmarks stack vertically.
 */
@media (max-width: 1024px) {
  .post-body .kg-width-wide,
  .page-body-inner .kg-width-wide,
  .kg-gallery-container {
    width: calc(100% + 8rem);
  }
}

@media (max-width: 768px) {
  .post-body .kg-width-wide,
  .page-body-inner .kg-width-wide,
  .kg-gallery-container {
    width: 100%;
    margin-left: 0;
    transform: none;
    max-width: 100%;
  }

  .kg-gallery-row {
    flex-direction: column;
  }

  .kg-bookmark-container {
    flex-direction: column-reverse;
    min-height: 0;
  }

  .kg-bookmark-thumbnail {
    flex: 0 0 200px;
    max-width: 100%;
    width: 100%;
    height: 200px;
  }

  .kg-bookmark-content {
    padding: 1.25rem 1.5rem;
  }
}
