/* Mary Queen of Scots pop-up (#mqs). Colors come from the active theme; the serif
   headings give the page its own character in every theme. */


.mqs {
  --mq-serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --mq-gold: var(--link);
}
.mqs .sub { max-width: 68ch; }

/* --- Hero ------------------------------------------------------------------ */
.mq-hero {
  display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 32px; align-items: center;
  padding: 26px; margin: 4px 0 18px; border-radius: var(--radius); position: relative; overflow: hidden;
  background: var(--surface-sunk);
  border: 1px solid var(--border-soft);
}
.mq-portrait { margin: 0; }
.mq-portrait img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 18%; border-radius: 14px;
  border: 3px solid var(--mq-gold); box-shadow: 0 0 0 6px color-mix(in srgb, var(--mq-gold) 18%, transparent), 0 18px 40px rgba(0, 0, 0, 0.45);
}
.mq-portrait figcaption { text-align: center; }
.mq-dates { margin: 0 0 8px; color: var(--mq-gold); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.78rem; }
.mq-hook { font-family: var(--mq-serif); font-style: italic; font-size: clamp(1.7rem, 3.6vw, 2.6rem); line-height: 1.12; margin: 0 0 14px; }
.mq-lede { font-size: 1.06rem; line-height: 1.6; color: var(--text); margin: 0 0 16px; max-width: 60ch; }
.mq-motto {
  margin: 0 0 18px; padding: 10px 16px; border-left: 3px solid var(--mq-gold); font-family: var(--mq-serif); font-style: italic;
  font-size: 1.15rem; background: color-mix(in srgb, var(--mq-gold) 8%, transparent); border-radius: 0 10px 10px 0;
}
.mq-motto small { display: block; font-style: normal; font-family: var(--font); font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.mq-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* --- Pictures ------------------------------------------------------------- */
.mq-pic { margin: 0; cursor: zoom-in; position: relative; }
.mq-pic img { display: block; width: 100%; height: auto; border-radius: 10px; background: var(--surface-sunk); transition: transform 0.25s var(--ease), box-shadow 0.25s; }
.mq-pic:hover img, .mq-pic:focus-visible img { transform: scale(1.02); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4); }
.mq-pic:focus-visible { outline: none; }
.mq-pic figcaption { font-size: 0.78rem; color: var(--muted); margin-top: 6px; line-height: 1.35; }
.mq-pic.broken img { min-height: 120px; }
.mq-pic.broken::before { content: "Picture unavailable"; position: absolute; inset: 0 0 auto 0; height: 120px; display: grid; place-items: center; color: var(--muted); font-size: 0.8rem; }

/* --- Stats ----------------------------------------------------------------- */
.mq-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.mq-stat {
  padding: 16px 14px; border-radius: var(--radius-sm); background: var(--surface-sunk); border: 1px solid var(--border-soft);
  text-align: center; position: relative; overflow: hidden;
}
.mq-stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.mq-stat .num { font-family: var(--mq-serif); font-size: 2.2rem; font-weight: 700; line-height: 1; color: var(--mq-gold); }
.mq-stat .num span { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.mq-stat .lbl { margin-top: 6px; font-size: 0.85rem; color: var(--muted); }

/* --- Sections -------------------------------------------------------------- */
.mq-section { margin-top: 34px; scroll-margin-top: 10px; }
.mq-head { margin-bottom: 10px; }
.mq-kicker { display: block; font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mq-gold); font-weight: 700; }
.mq-head h3 { margin: 2px 0 0; font-family: var(--mq-serif); font-size: 1.6rem; }
.mq-head h3::after { content: ""; display: block; width: 64px; height: 2px; margin-top: 8px; background: linear-gradient(90deg, var(--mq-gold), transparent); }

.mq-chart svg { display: block; width: 100%; height: auto; }
.mq-chart { overflow-x: auto; }
.mq-chart.tree svg { min-width: 720px; }
.mq-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; font-size: 0.85rem; color: var(--muted); }
.mq-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* --- Timeline (extends the base .timeline styles) --------------------------- */
.mqs .timeline summary .what { font-family: var(--mq-serif); font-size: 1.05rem; }
.mqs .timeline .has-img { margin-left: 4px; font-size: 0.85rem; opacity: 0.7; }
.mqs .timeline .body { display: grid; gap: 14px; }
.mqs .timeline .body.has-pic { grid-template-columns: 150px 1fr; align-items: start; }
.mqs .timeline .body p { margin: 4px 0 0; line-height: 1.55; }
.mq-thumb img { aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 20%; }
.mq-thumb figcaption { font-size: 0.7rem; }

/* --- Marriages ------------------------------------------------------------- */
.mq-marriages { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.mq-marriage { padding: 16px; border-radius: var(--radius-sm); background: var(--surface-sunk); border: 1px solid var(--border-soft); }
.mq-marriage-pic { position: relative; width: 108px; height: 108px; margin: 0 auto 12px; }
.mq-marriage-pic .mq-pic img { width: 108px; height: 108px; object-fit: cover; object-position: 50% 15%; border-radius: 50%; border: 3px solid var(--mq-gold); }
.mq-marriage-pic .ord { position: absolute; bottom: -4px; right: -6px; padding: 2px 9px; border-radius: 99px; font-size: 0.72rem; font-weight: 700; background: var(--mq-gold); color: #1d1206; }
.mq-marriage h4 { margin: 0; text-align: center; font-family: var(--mq-serif); font-size: 1.12rem; }
.mq-marriage .meta { margin: 2px 0 12px; text-align: center; color: var(--muted); font-size: 0.82rem; }
.mq-bar { height: 10px; border-radius: 99px; background: var(--border-soft); overflow: hidden; }
.mq-bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.mq-marriage .dur { margin: 6px 0 0; font-weight: 700; font-size: 0.9rem; }
.mq-marriage .end { margin: 6px 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.45; }

/* --- Map ------------------------------------------------------------------- */
.mq-map { display: grid; grid-template-columns: minmax(280px, 500px) 1fr; gap: 20px; align-items: start; }
.mq-stop { cursor: pointer; transition: transform 0.15s; }
.mq-stop circle { transition: r 0.15s, stroke-width 0.15s; }
.mq-stop.on circle, .mq-stop:hover circle, .mq-stop:focus circle { r: 13; stroke-width: 3; }
.mq-stops { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; counter-reset: stop; }
.mq-stops li {
  counter-increment: stop; display: grid; grid-template-columns: 26px 1fr; column-gap: 8px; padding: 7px 10px;
  border-radius: 10px; background: var(--surface-sunk); border: 1px solid transparent; cursor: default; transition: border-color 0.15s, background 0.15s;
}
.mq-stops li.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface-sunk)); }
.mq-stops li i { grid-row: span 2; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; align-self: center; font-style: normal; }
.mq-stops li i::before { content: counter(stop); font-size: 0.7rem; font-weight: 800; color: #000; }
.mq-stops li b { font-size: 0.9rem; }
.mq-stops li small { color: var(--muted); font-size: 0.78rem; }

/* --- Prisons --------------------------------------------------------------- */
.mq-split { display: grid; grid-template-columns: 1fr 220px; gap: 24px; align-items: start; }
.mq-prison { display: grid; grid-template-columns: 210px 1fr 60px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.mq-prison .where { font-weight: 600; font-size: 0.92rem; }
.mq-prison .where small { display: block; font-weight: 400; color: var(--muted); font-size: 0.78rem; }
.mq-prison .mq-bar { height: 14px; }
.mq-prison .len { text-align: right; font-weight: 700; font-size: 0.9rem; color: var(--mq-gold); }
.mq-side img { border: 3px solid var(--mq-gold); }

/* --- Family tree ----------------------------------------------------------- */
.mq-person image { cursor: zoom-in; }

/* --- Gallery --------------------------------------------------------------- */
.mq-gallery { columns: 4 200px; column-gap: 14px; }
.mq-gallery .mq-pic { break-inside: avoid; margin-bottom: 14px; padding: 8px; border-radius: 12px; background: var(--surface-sunk); border: 1px solid var(--border-soft); }

/* --- Facts ----------------------------------------------------------------- */
.mqs .fact { position: relative; padding-top: 16px; }
.mqs .fact h4 { font-family: var(--mq-serif); font-size: 1.05rem; }
.fact-icon { font-size: 1.5rem; display: block; margin-bottom: 4px; }

.mq-credits { margin: 30px 0 0; padding-top: 14px; border-top: 1px solid var(--border-soft); color: var(--muted); font-size: 0.8rem; }

/* --- Lightbox -------------------------------------------------------------- */
#lightbox .viewer-body img { max-height: calc(100vh - 120px); width: auto; }

/* --- Small screens ---------------------------------------------------------- */
@media (max-width: 760px) {
  .mq-hero { grid-template-columns: 1fr; padding: 18px; text-align: center; }
  .mq-portrait { max-width: 230px; margin: 0 auto; }
  .mq-motto { text-align: left; }
  .mq-actions { justify-content: center; }
  .mq-map, .mq-split { grid-template-columns: 1fr; }
  .mq-map .mq-chart.map { max-width: 420px; margin: 0 auto; width: 100%; }
  .mq-side { max-width: 220px; margin: 0 auto; }
  .mq-prison { grid-template-columns: 1fr 52px; }
  .mq-prison .mq-bar { grid-column: 1 / -1; grid-row: 2; }
  .mqs .timeline .body.has-pic { grid-template-columns: 96px 1fr; }
  .mq-stats { grid-template-columns: repeat(2, 1fr); }
}

.mq-secret { margin: 12px 0 0; font-size: 13px; color: var(--muted); font-style: italic; }
