/* The Muster Chart (#/muster-chart, muster.js): a dark Admiralty-style chart of the world,
   gold coastlines, scarlet pins, the viewer's own pin in gold. */

.page-body.mc { display: flex; flex-direction: column; }
.mc-stats { margin-bottom: 18px; }
.mc-stat-sub { margin-top: 4px; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
/* On a phone the chart comes first. */
@media (max-width: 640px) {
    .mc-stats { order: 2; margin: 18px 0 0; }
}

.mc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.mc-side > .panel + .panel { margin-top: 18px; }
.mc-panel { padding: 0; overflow: hidden; }
@media (max-width: 1040px) {
    .mc-layout { grid-template-columns: minmax(0, 1fr); }
}

/* -- the chart -- */

.mc-chart {
    position: relative;
    /* About the world's own shape (1000 x 440), so it fills the chart. */
    aspect-ratio: 2.15 / 1;
    min-height: 360px;
    max-height: 72vh;
    width: 100%;
    background: #060d1a;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
    overflow: hidden;
}
.mc-chart.mc-grabbing { cursor: grabbing; }
/* On a phone the chart takes every touch (to pan and pinch), so it's kept to half the
   screen: there's always page above or below it to scroll by. */
@media (max-width: 640px) {
    .mc-chart { aspect-ratio: auto; height: clamp(280px, 50vh, 440px); height: clamp(280px, 50svh, 440px); min-height: 0; }
}
.mc-svg { display: block; width: 100%; height: 100%; }
.mc-sea { fill: url(#mc-sea); }
.mc-edge { fill: none; stroke: rgba(201, 168, 76, 0.45); stroke-width: 1.2; }
.mc-grid { fill: none; stroke: rgba(201, 168, 76, 0.1); stroke-width: 0.7; }
.mc-grid.equator { stroke: rgba(201, 168, 76, 0.22); stroke-dasharray: 5 4; }
.mc-land { fill: #1c3051; stroke: rgba(201, 168, 76, 0.42); stroke-width: 0.6; stroke-linejoin: round; transition: fill 0.3s; }
.mc-land.has { fill: #2c4268; stroke: rgba(224, 195, 106, 0.7); }
.mc-states { fill: none; stroke: rgba(201, 168, 76, 0.16); stroke-width: 0.5; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.mc-close .mc-states { stroke: rgba(224, 195, 106, 0.34); stroke-width: 0.8; }
/* Touch screens: no state lines while the chart is being dragged or pinched (muster.js sets
   .mc-moving); redrawing them every frame is what made phones stutter. */
@media (pointer: coarse) {
    .mc-moving .mc-states { visibility: hidden; }
}

.mc-chart.mc-over-pin { cursor: pointer; }
.mc-pin-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mc-pin { outline: none; }
.mc-pin .mc-halo { fill: rgba(216, 69, 59, 0.22); stroke: none; }
.mc-pin .mc-dot { fill: var(--scarlet); stroke: var(--gold-bright); stroke-width: 1.6; }
.mc-pin.broad .mc-dot { stroke-dasharray: 3 2; }
.mc-pin .mc-count { fill: var(--white); font-family: var(--sans); font-size: 11.5px; font-weight: 600; }
.mc-pin.hover .mc-dot, .mc-pin:focus-visible .mc-dot { fill: var(--scarlet-bright); stroke: var(--white); }
.mc-pin:focus-visible .mc-halo { stroke: var(--white); stroke-width: 1.5; }
.mc-pin.me .mc-dot { fill: var(--gold); stroke: var(--white); }
.mc-pin.me .mc-halo { fill: rgba(224, 195, 106, 0.28); animation: mc-pulse 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.mc-pin.me .mc-count { fill: var(--navy-900); }
.mc-pin.on .mc-dot { stroke: var(--white); stroke-width: 2.6; }
@keyframes mc-pulse { 0%, 100% { opacity: 0.35; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1.25); } }
@media (prefers-reduced-motion: reduce) {
    .mc-pin.me .mc-halo { animation: none; }
}

/* The title strip above the chart (it used to float over the land). */
.mc-cartouche {
    display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px;
    padding: 10px 16px; border-bottom: 1px solid var(--line-strong);
    background: #081122;
}
.mc-cartouche-title { font-family: var(--serif); font-size: 20px; color: var(--white); line-height: 1.1; }
.mc-cartouche-sub { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.mc-credit { margin-left: auto; font-size: 10.5px; color: var(--faint); }
@media (max-width: 640px) {
    .mc-cartouche { padding: 8px 12px; }
    .mc-cartouche-title { font-size: 16px; }
    .mc-cartouche-sub, .mc-credit { display: none; }
}

/* Bottom left, over the empty South Pacific. */
.mc-rose { position: absolute; left: 16px; bottom: 16px; width: 70px; height: 70px; pointer-events: none; opacity: 0.85; }
.mc-rose-ring { fill: rgba(8, 17, 34, 0.55); stroke: rgba(201, 168, 76, 0.55); stroke-width: 1; }
.mc-rose-ring.thin { fill: none; stroke-width: 0.6; }
.mc-rose-point { fill: var(--gold); }
.mc-rose-point.dark { fill: var(--gold-dim); opacity: 0.7; }
.mc-rose-point.minor { fill: var(--cream); opacity: 0.55; }
.mc-rose-point.minor.dark { opacity: 0.3; }
.mc-rose-n { fill: var(--gold-bright); font-family: var(--sans); font-size: 10px; font-weight: 700; }
@media (max-width: 640px) {
    .mc-rose { width: 48px; height: 48px; left: 10px; bottom: 10px; }
}

.mc-controls { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 6px; }
.mc-ctl {
    width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: rgba(8, 17, 34, 0.85); color: var(--cream); cursor: pointer;
}
.mc-ctl:hover { border-color: var(--gold); color: var(--white); background: var(--navy-700); }
.mc-ctl:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.mc-ctl svg { width: 18px; height: 18px; }
/* Finger-sized on touch screens. */
@media (pointer: coarse) {
    .mc-controls { right: 10px; top: 10px; gap: 8px; }
    .mc-ctl { width: 44px; height: 44px; }
    .mc-ctl svg { width: 20px; height: 20px; }
}

/* -- the card for a marker -- */

.mc-card {
    position: absolute; z-index: 2; width: 300px; max-height: calc(100% - 20px); overflow-y: auto;
    padding: 14px 16px 12px; cursor: default; user-select: text; -webkit-user-select: text;
    background: var(--navy-800); border: 1px solid var(--line-strong); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.mc-docked .mc-card { left: 8px; right: 8px; bottom: 8px; top: auto; width: auto; max-height: 55%; }
.mc-card-close {
    position: absolute; right: 6px; top: 4px; width: 30px; height: 30px;
    border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer;
}
.mc-card-close:hover { color: var(--white); }
.mc-card-place + .mc-card-place { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.mc-card h3 { margin: 0 28px 2px 0; font-family: var(--serif); font-weight: 400; font-size: 21px; color: var(--white); }
.mc-card-where { margin: 0 0 10px; color: var(--muted); font-size: 12.5px; }

.mc-people, .mc-near-list, .mc-country-list, .mc-results { list-style: none; margin: 0; padding: 0; }
.mc-people li { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.mc-people li.me .mc-who > a, .mc-people li.me .mc-who > span { color: var(--gold-bright); }
.mc-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; background: var(--navy-700); }
.mc-avatar.blank { display: inline-flex; align-items: center; justify-content: center; color: var(--faint); }
.mc-avatar.blank svg { width: 16px; height: 16px; }
.mc-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.mc-who > a, .mc-who > span { color: var(--cream); font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-who > a { text-decoration: none; }
.mc-who > a:hover { color: var(--gold-bright); text-decoration: underline; }
.mc-who small { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-hidden .mc-who > span { font-weight: 500; color: var(--muted); }

/* -- your pin -- */

.mc-lead { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.mc-searcher { position: relative; margin-bottom: 12px; }
.mc-search { width: 100%; }
.mc-results { margin-top: 6px; border-radius: var(--radius-sm); overflow: hidden; }
.mc-results:empty { display: none; }
.mc-result {
    display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 8px 12px;
    border: 0; border-bottom: 1px solid var(--line); background: var(--navy-900); color: var(--cream);
    font: inherit; text-align: left; cursor: pointer;
}
.mc-results li:last-child .mc-result { border-bottom: 0; }
.mc-result strong { font-weight: 600; font-size: 14px; }
.mc-result span { color: var(--muted); font-size: 12.5px; }
.mc-result:hover, .mc-result:focus-visible { background: var(--navy-600); outline: none; }
.mc-result:hover strong, .mc-result:focus-visible strong { color: var(--gold-bright); }
.mc-none { padding: 8px 2px; color: var(--muted); font-size: 13px; }
.mc-check { margin: 2px 0 4px; }
.mc-check input { accent-color: var(--gold); width: 16px; height: 16px; }

.mc-mine {
    display: flex; flex-direction: column; align-items: flex-start; width: 100%; margin-bottom: 12px; padding: 12px 14px;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--navy-900);
    color: var(--cream); font: inherit; text-align: left; cursor: pointer;
}
.mc-mine:hover { border-color: var(--gold); }
.mc-mine strong { font-family: var(--serif); font-weight: 400; font-size: 22px; color: var(--white); }
.mc-mine span { color: var(--muted); font-size: 13px; }
.mc-move { margin-top: 12px; }
.mc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* -- nearest and by country -- */

.mc-near-list li + li, .mc-country-list li + li { border-top: 1px solid var(--line); }
.mc-near-list button, .mc-country-list button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 2px;
    border: 0; background: none; color: var(--cream); font: inherit; text-align: left; cursor: pointer;
}
.mc-near-list button:hover .mc-who > span, .mc-country-list button:hover .mc-country-name { color: var(--gold-bright); }
.mc-near-list .mc-who { flex: 1; }
.mc-dist { margin-left: auto; color: var(--gold); font-size: 13px; font-weight: 600; white-space: nowrap; }
.mc-country-name { flex: 0 0 42%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.mc-bar { flex: 1; height: 6px; border-radius: 3px; background: rgba(201, 168, 76, 0.12); overflow: hidden; }
.mc-bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--gold); }
.mc-country-count { flex: none; min-width: 28px; text-align: right; color: var(--white); font-weight: 600; font-size: 14px; }

/* -- live: a pin someone has just added flashes -- */
.mc-pin.fresh .mc-halo { fill: rgba(224, 195, 106, 0.4); animation: mc-fresh 1.2s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.mc-pin.fresh .mc-dot { stroke: var(--white); }
@keyframes mc-fresh { 0% { opacity: 1; transform: scale(0.8); } 100% { opacity: 0; transform: scale(2.2); } }
@media (prefers-reduced-motion: reduce) {
    .mc-pin.fresh .mc-halo { animation: none; }
}
.page-body.mc > .fame-bar { margin-top: -8px; }
