/* Kings & Queens page. Builds on app.css (colours, header, theme button); this page scrolls normally. */
html, body.page { height: auto; }
body.page { display: block; overflow: auto; }
body.page a.theme-btn { text-decoration: none; color: var(--text); }
.realms { display: flex; gap: 4px; }
.realms .on { background: var(--text); color: var(--bg); border-color: var(--text); cursor: default; }

.mon { padding: 12px 16px 40px; }   /* full width: the wider the window, the longer the reign bars */
/* Title bar + key pinned to the top; monarchs.js puts its height in --head-h for the year scale. */
.mon-sticky { position: sticky; top: 0; z-index: 20; background: var(--surface); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); }
.mon-sticky .topbar { border-bottom: 0; }
.mon-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0 16px 8px; font-size: 13px; border-bottom: 1px solid var(--line); }
.mon-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mon-legend i { width: 14px; height: 10px; border-radius: 3px; background: var(--house); display: inline-block; }
.mon-help, .mon-note { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.mon-note { margin-top: 16px; }

/* Grid: picture | name and years | the time track */
/* overflow-x: clip (not hidden) so nothing widens the page without breaking the pinned year scale */
.mon-chart { --name-w: 230px; --pic: 44px; position: relative; overflow-x: clip; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.mon-axis {
  /* left offset and width are set by monarchs.js to match the bars' column */
  position: sticky; top: var(--head-h, 0px); z-index: 3; height: 28px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.mon-axis span { position: absolute; top: 6px; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.mon-rows { list-style: none; margin: 0; padding: 0; position: relative; }
.mon-row { border-bottom: 1px solid var(--line); }
.mon-row:last-child { border-bottom: 0; }
.mon-row:nth-child(even) { background: rgba(127, 127, 127, 0.035); }
.mon-row > button {
  display: grid; grid-template-columns: var(--pic) var(--name-w) 1fr; align-items: center; gap: 12px;
  width: 100%; padding: 6px 14px 6px 10px; border: 0; background: none; text-align: left; cursor: pointer;
}
.mon-row > button:hover, .mon-row.open > button { background: color-mix(in srgb, var(--house) 10%, transparent); }
.mon-row > button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mon-pic {
  width: var(--pic); height: var(--pic); border-radius: 50%; object-fit: cover; object-position: 50% 15%;
  background: var(--surface-2); border: 2px solid var(--house); display: block;
}
.mon-pic.none { display: grid; place-items: center; font: 700 16px/1 var(--serif); color: var(--muted); }
/* Mouse users: the head shot grows on hover (out to the right, over the name), as a rounded square
   so more of the picture shows. Touch screens get the larger picture in the opened row instead. */
@media (hover: hover) {
  img.mon-pic { position: relative; transform-origin: 0 50%; transition: transform 0.15s ease, border-radius 0.15s ease, box-shadow 0.15s ease; }
  img.mon-pic:hover {
    z-index: 10; transform: scale(3.4); border-radius: 6px; border-width: 1px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  }
}
/* Coin: a small badge on the corner of the head shot; grows on hover like the portrait. */
.mon-pics { position: relative; display: block; width: var(--pic); height: var(--pic); }
.mon-coin {
  position: absolute; right: -8px; bottom: -5px; width: 26px; height: 26px; border-radius: 50%; object-fit: cover;
  background: #fff; box-shadow: 0 0 0 2px var(--surface), 0 1px 3px rgba(0, 0, 0, 0.4); z-index: 1;
}
@media (hover: hover) {
  .mon-coin { transform-origin: 30% 50%; transition: transform 0.15s ease, box-shadow 0.15s ease; }
  .mon-coin:hover { z-index: 11; transform: scale(5); box-shadow: 0 0 0 1px var(--surface), 0 6px 24px rgba(0, 0, 0, 0.45); }
}
.mon-more .mon-coin-big { float: left; width: 120px; margin: 2px 14px 6px 0; text-align: center; }
.mon-more .mon-coin-big img { width: 120px; height: 120px; object-fit: contain; border-radius: 50%; background: #fff; }
.mon-more .mon-coin-big figcaption { font-size: 11px; color: var(--muted); line-height: 1.3; }
.mon-more .mon-big { float: left; width: 120px; max-height: 160px; object-fit: cover; object-position: 50% 15%; margin: 2px 14px 6px 0; border-radius: 8px; border: 2px solid var(--house); }
.mon-more::after { content: ''; display: block; clear: both; }
.mon-name { min-width: 0; }
.mon-name strong { display: block; font: 600 15px/1.25 var(--serif); }
.mon-name small { color: var(--muted); font-size: 12px; }
.mon-track { position: relative; height: 22px; }
.mon-track .grid { position: absolute; top: -6px; bottom: -6px; width: 1px; background: var(--grid); }
.mon-bar {
  position: absolute; top: 3px; height: 16px; min-width: 4px; border-radius: 4px; background: var(--house);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.mon-row.disputed .mon-bar {
  background: repeating-linear-gradient(135deg, var(--house) 0 4px, color-mix(in srgb, var(--house) 35%, var(--surface)) 4px 8px);
}
.mon-row.disputed .mon-name strong { font-style: italic; }
.mon-band { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, #5f5f5f 12%, transparent); z-index: 0; pointer-events: none; }
.mon-band span { white-space: nowrap; position: sticky; top: calc(var(--head-h, 0px) + 30px); display: block; padding: 2px 4px; font-size: 11px; color: var(--muted); }

/* Opened row: summary and links */
.mon-more { display: none; padding: 4px 14px 12px calc(10px + var(--pic) + 12px); font-size: 14px; }
.mon-row.open .mon-more { display: block; }
.mon-more p { margin: 0 0 8px; max-width: 75ch; }
.mon-more .links { display: flex; gap: 14px; flex-wrap: wrap; }

@media (max-width: 760px) {
  .mon { padding: 12px 8px 32px; }
  /* keep the pinned area short on phones: the key is one row that scrolls sideways */
  .mon-legend { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; padding: 0 8px 8px; }
  .mon-sticky .where { display: none; }
  .mon-sticky .end { flex-wrap: wrap; gap: 6px; }
  .mon-sticky .theme-btn { padding: 5px 10px; font-size: 12px; }
  .mon-chart { --name-w: 120px; --pic: 34px; }
  .mon-name strong { font-size: 13px; }
  .mon-name small { font-size: 11px; }
  .mon-row > button { gap: 8px; padding: 5px 8px 5px 6px; }
  .mon-more { padding-left: 14px; }
}
