/* Historical Notes — facts bubble + trivia slider on place pages.
   Follows the .place-faq module rhythm (top rule, coral serif heading) and
   the .place-meta-item card language (soft border, rounded, cream fill). */

.pg-hist {
  /* Soft sage — warm enough to sit beside the cream page without reading as
     a different palette. Scoped here so both card types stay in step. */
  --hist-bg: #eef3e8;
  --hist-border: #d9e3cf;

  margin-top: 28px;
  /* Trailing space keeps the sources line from reading as a caption for
     whatever module follows (usually the video mentions). */
  margin-bottom: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.pg-hist__heading {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  color: var(--coral);
  font-size: 22px;
  letter-spacing: -.01em;
  margin-bottom: 14px;
}

/* ── Basic facts bubble ───────────────────── */

.pg-hist__bubble {
  border: 1px solid var(--hist-border);
  border-radius: 14px;
  background: var(--hist-bg);
  padding: 16px 18px;
}

.pg-hist__dl {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 0;
}

.pg-hist__pair {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.pg-hist__pair dt {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  flex: none;
}

.pg-hist__pair dd {
  margin: 0;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.35;
}

/* ── Sources footer (foot of the whole block) ─ */

.pg-hist__sources {
  /* Tucked up against the cards it cites — the breathing room belongs below
     the block (margin-bottom on .pg-hist), not between the two. */
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
}

.pg-hist__sources-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 11px;
  margin-right: 2px;
}

.pg-hist__sources a { color: var(--muted); text-decoration: underline; }
.pg-hist__sources a:hover { color: var(--coral); }
.pg-hist__sep { margin: 0 5px; color: var(--muted-2); }

/* ── Trivia slider ────────────────────────── */

.pg-hist__facts { margin-top: 18px; }

.pg-hist__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.pg-hist__subhead {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.25;
  color: var(--ink);
  margin: 0;
  /* Keeps a lone trailing word off its own line. */
  text-wrap: balance;
}

.pg-hist__nav { display: flex; gap: 6px; flex: none; }

.pg-hist__btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.pg-hist__btn:hover { border-color: var(--coral); color: var(--coral); }

.pg-hist__viewport { overflow: hidden; }

.pg-hist__track {
  display: flex;
  transition: transform .35s ease;
}

/* Slides are full-width panes; without JS they simply stack side by side and
   the viewport shows the first — no content is ever hidden from crawlers. */
/* One layout for every slide, image or not: a centred column. Keeping the two
   cases identical is what makes the slider read as one component rather than
   two — the image simply sits above the same centred text. */
.pg-hist__slide {
  flex: 0 0 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--hist-border);
  border-radius: 14px;
  background: var(--hist-bg);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
}

.pg-hist__slide.is-text { min-height: 108px; }

/* With a picture the column wastes the width beside a portrait scan, so the
   image moves to the side and the text takes the rest. Text stays centred —
   only the arrangement changes, not the character of the card. */
.pg-hist__slide.has-img {
  flex-direction: row;
  align-items: center;
  gap: 20px;
}

.pg-hist__slide.has-img .pg-hist__body { flex: 1 1 auto; }

/* Image opens in the shared lightbox. Sized by max-height with width auto, so
   portrait and landscape scans both fit without cropping or distortion. */
.pg-hist__imglink {
  flex: 0 0 auto;
  display: block;
  /* Never let a wide landscape scan crowd out the text. */
  max-width: 38%;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
  line-height: 0;
}

.pg-hist__img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 240px;
  display: block;
}

.pg-hist__imglink:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }

/* Capped for readability — centred text needs a shorter measure than ragged
   left, or the eye loses the start of each line. */
.pg-hist__body {
  min-width: 0;
  max-width: 56ch;
}

.pg-hist__fact-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 8px;
  text-wrap: balance;
}

.pg-hist__text {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.pg-hist__text p { margin: 0 0 .7em; }
.pg-hist__text p:last-child { margin-bottom: 0; }

/* Dots */
.pg-hist__dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}

.pg-hist__dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--line);
  cursor: pointer;
  transition: background .15s, transform .15s;
}

.pg-hist__dot.on { background: var(--coral); transform: scale(1.25); }

/* Not a slider (single fact) — drop the pane sizing so it fills naturally. */
.pg-hist__facts:not(.is-slider) .pg-hist__slide { flex: 1 1 auto; }

/* ── Compact variant (guide place-cards) ───── */

.pg-hist--compact {
  margin-top: 18px;
  margin-bottom: 24px;
  padding-top: 16px;
}

.pg-hist--compact .pg-hist__heading { font-size: 16px; margin-bottom: 10px; }
.pg-hist--compact .pg-hist__bubble { padding: 12px 14px; border-radius: 12px; }
.pg-hist--compact .pg-hist__dl { gap: 8px 18px; }
.pg-hist--compact .pg-hist__pair dt { font-size: 11px; }
.pg-hist--compact .pg-hist__pair dd { font-size: 14px; }
.pg-hist--compact .pg-hist__facts { margin-top: 12px; }
.pg-hist--compact .pg-hist__subhead { font-size: 15px; }
.pg-hist--compact .pg-hist__slide { padding: 12px; gap: 12px; border-radius: 12px; }
.pg-hist--compact .pg-hist__slide.has-img { gap: 14px; }
.pg-hist--compact .pg-hist__imglink { max-width: 32%; }
.pg-hist--compact .pg-hist__img { max-height: 180px; }
.pg-hist--compact .pg-hist__fact-title { font-size: 15px; margin-bottom: 6px; }
.pg-hist--compact .pg-hist__text { font-size: 14.5px; line-height: 1.55; }
.pg-hist--compact .pg-hist__slide.is-text { min-height: 88px; }
.pg-hist--compact .pg-hist__btn { width: 26px; height: 26px; font-size: 15px; }

@media (max-width: 700px) {
  .pg-hist__heading { font-size: 20px; }

  .pg-hist__dl { gap: 9px 20px; }

  /* Arrows are redundant next to swipe, and the heading needs the width. */
  .pg-hist__nav { display: none; }

  .pg-hist__slide { padding: 16px 14px; gap: 12px; }

  /* Too narrow to sit side by side, so the image goes back on top — but
     full-bleed across the card rather than floating in the middle of it.
     overflow:hidden lets the card's own radius clip the top corners, so the
     bleed needs no corner values of its own. */
  .pg-hist__slide.has-img {
    flex-direction: column;
    padding-top: 0;
    overflow: hidden;
  }

  .pg-hist__slide.has-img .pg-hist__imglink {
    align-self: stretch;
    max-width: none;
    margin: 0 -14px;
    border-radius: 0;
  }

  /* A fixed band crops — deliberately. The lightbox still opens the
     uncropped original on tap. */
  .pg-hist__slide.has-img .pg-hist__img {
    width: 100%;
    height: 220px;
    max-height: none;
    object-fit: cover;
    object-position: center;
  }

  /* Card padding is tighter, so the bleed has to match it. */
  .pg-hist--compact .pg-hist__slide.has-img .pg-hist__imglink { margin: 0 -12px; }
  .pg-hist--compact .pg-hist__slide.has-img .pg-hist__img { height: 180px; }

  .pg-hist__fact-title { font-size: 16px; }
  .pg-hist__text { font-size: 15.5px; }
}
