/* PM Data Story: interactive data infographic. Everything is scoped to .pmds so site themes can't leak in. */
.pmds {
	--bg: #fff; --ink: #3f4a63; --title: #0b1f4e; --muted: #5b6680; --accent: #2563eb;
	--bar: #2563eb; --bar-hi: #0b1f4e; --bar2: #dc2626; --panel: #eef2fb; --rule: #dde3ee;
	--split-a: #2563eb; --split-b: #0b1f4e; --radius: 10px;
	--display: "Plus Jakarta Sans", Inter, system-ui, sans-serif; --body: Inter, system-ui, sans-serif;
	--title-weight: 800; --title-style: normal;
	box-sizing: border-box; margin: 2em 0; padding: clamp(18px, 4vw, 40px); background: var(--bg); color: var(--ink);
	font-family: var(--body); font-size: 16px; line-height: 1.45; border: 1px solid var(--rule); border-radius: var(--radius);
	-webkit-font-smoothing: antialiased; position: relative;
}
.pmds[data-theme="management"] {
	--ink: #2d2d2d; --title: #014f7a; --muted: #5f6b76; --accent: #0177b6; --bar: #0177b6; --bar-hi: #014f7a;
	--bar2: #b42318; --panel: #e6f1f7; --rule: #dfe5ec; --split-a: #0177b6; --split-b: #014f7a; --radius: 8px;
	--display: "Open Sans", system-ui, sans-serif; --body: "Open Sans", system-ui, sans-serif;
}
.pmds[data-theme="passionfruit"] {
	--bg: #14111a; --ink: #f4f1f6; --title: #fff; --muted: #b7afc0; --accent: #ff3399; --bar: #ff3399; --bar-hi: #ff6600;
	--bar2: #ff6600; --panel: #221c2b; --rule: #3a3244; --split-a: #ff3399; --split-b: #ff6600; --radius: 8px;
	--display: "Noto Serif", Georgia, serif; --body: "Work Sans", system-ui, sans-serif; --title-weight: 900; --title-style: italic;
}
.pmds *, .pmds *::before, .pmds *::after { box-sizing: border-box; }
.pmds p, .pmds ol, .pmds li { margin: 0; padding: 0; }
.pmds ol { list-style: none; }
.pmds img { max-width: none; box-shadow: none; border: 0; }
.pmds .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); }

/* Head */
.pmds-title { font-family: var(--display); font-weight: var(--title-weight); font-style: var(--title-style); color: var(--title);
	font-size: clamp(26px, 4.4vw, 44px); line-height: 1.08; letter-spacing: -.01em; }
.pmds-title em { font-style: inherit; color: var(--accent); }
.pmds-sub { margin-top: .6em !important; color: var(--muted); font-size: clamp(15px, 1.8vw, 17px); max-width: 60ch; }

/* Big numbers */
.pmds-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px 24px; margin: 24px 0 8px; }
.pmds-stat { border-top: 3px solid var(--accent); padding-top: 10px; }
.pmds-stat b { display: block; font-family: var(--display); font-weight: 800; color: var(--title); font-size: clamp(28px, 3.6vw, 38px); line-height: 1; }
.pmds-stat span { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); line-height: 1.35; }

/* Controls */
.pmds-controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin: 24px 0 6px; }
.pmds-controls[hidden] { display: none; }
.pmds-search input { font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--rule);
	border-radius: 999px; padding: 8px 14px 8px 36px; width: min(260px, 70vw); outline: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%235b6680' d='M10 2a8 8 0 0 1 6.3 12.9l5.4 5.4-1.4 1.4-5.4-5.4A8 8 0 1 1 10 2zm0 2a6 6 0 1 0 0 12 6 6 0 0 0 0-12z'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: 12px 50%; }
.pmds-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.pmds-sort { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; padding: 3px; gap: 2px; }
.pmds-sort button { font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); background: none; border: 0; border-radius: 999px;
	padding: 6px 12px; cursor: pointer; line-height: 1.2; box-shadow: none; text-transform: none; letter-spacing: 0; }
.pmds-sort button[aria-pressed="true"] { background: var(--title); color: var(--bg); }
.pmds[data-theme="passionfruit"] .pmds-sort button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* Chart */
.pmds-chart { position: relative; margin-top: 10px; }
.pmds-axis { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; letter-spacing: .07em; text-transform: uppercase;
	color: var(--muted); border-bottom: 1px solid var(--rule); padding-bottom: 6px !important; margin-bottom: 6px !important; }
.pmds-axis-ref { white-space: nowrap; }
.pmds-row { display: grid; grid-template-columns: 30px minmax(130px, 34%) 1fr auto; align-items: center; gap: 10px; min-height: 34px;
	border-radius: 6px; cursor: default; outline: none; transition: background-color .15s; }
.pmds-row:hover, .pmds-row:focus-visible, .pmds-row.is-match { background: var(--panel); }
.pmds-row.is-dim { opacity: .35; }
.pmds-row[hidden] { display: none; }
.pmds-rank { text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pmds-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; font-size: 15.5px; color: var(--title); }
.pmds-name > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmds-row.is-hl .pmds-name { font-weight: 800; }
.pmds .pmds-flag { width: 22px !important; height: 16.5px !important; border-radius: 2px !important; object-fit: cover; margin: 0 !important; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.08) !important; }
.pmds-track { position: relative; height: 22px; display: block; }
.pmds-bar { position: absolute; left: 0; top: 0; bottom: 0; width: var(--w); background: var(--barc, var(--bar)); border-radius: 0 5px 5px 0;
	transform-origin: left; transition: transform .7s cubic-bezier(.2,.7,.2,1); }
.pmds-row.is-hl .pmds-bar { background: var(--bar-hi); }
.pmds-val { position: absolute; top: 50%; left: var(--w); transform: translate(8px, -50%); font-weight: 800; font-size: 14.5px;
	color: var(--title); font-variant-numeric: tabular-nums; white-space: nowrap; transition: opacity .3s .4s; }
.pmds-row.is-inside .pmds-val { left: auto; right: calc(100% - var(--w)); transform: translate(-8px, -50%); color: #fff; }
.pmds-ref { position: absolute; top: -6px; bottom: -6px; border-left: 2px dashed var(--muted); z-index: 2; opacity: .8; }
.pmds-v2 { min-width: 76px; text-align: center; font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--title);
	background: var(--panel); border-radius: 999px; padding: 3px 10px; }
.pmds.is-anim .pmds-bar { transform: scaleX(0); }
.pmds.is-anim .pmds-val { opacity: 0; }

/* Double ranking */
.pmds-panel + .pmds-panel { margin-top: 26px; }
.pmds-panel-h { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 19px; color: var(--title);
	margin-bottom: 8px !important; }
.pmds-panel-h::before { content: ""; width: 13px; height: 13px; border-radius: 3px; background: var(--sw); }

/* Split bar */
.pmds-legend { display: flex; gap: 20px; font-size: 14px; font-weight: 700; margin-bottom: 8px !important; }
.pmds-legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
.pmds-legend .a::before { background: var(--split-a); } .pmds-legend .b::before { background: var(--split-b); }
.pmds[data-format="split-bar"] .pmds-row { grid-template-columns: minmax(120px, 30%) 1fr; }
.pmds-split { position: relative; display: flex; height: 24px; border-radius: 5px; overflow: hidden; }
.pmds-split span { display: flex; align-items: center; font-weight: 800; font-size: 13.5px; color: #fff; font-variant-numeric: tabular-nums; }
.pmds-split .a { background: var(--split-a); padding-left: 8px; }
.pmds-split .b { background: var(--split-b); justify-content: flex-end; padding-right: 8px; }
.pmds-split::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 2px dashed var(--bg); }

/* Tooltip */
.pmds-tip { position: absolute; z-index: 5; pointer-events: none; max-width: 280px; background: var(--title); color: var(--bg); font-size: 13.5px;
	line-height: 1.35; padding: 8px 11px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.pmds[data-theme="passionfruit"] .pmds-tip { background: #fff; color: #14111a; }
.pmds-empty { padding: 14px 0 !important; color: var(--muted); }

/* Callouts, footer, actions */
.pmds-callouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 22px; margin-top: 22px; }
.pmds-callout { border-left: 3px solid var(--accent); padding-left: 12px !important; font-size: 15px; }
.pmds-callout b { color: var(--title); }
.pmds-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px 24px; flex-wrap: wrap; margin-top: 22px;
	padding-top: 14px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.pmds-brand { font-family: var(--display); font-weight: 800; font-size: 18px; color: var(--accent); }
.pmds[data-theme="networth"] .pmds-brand { color: var(--title); }
.pmds-src { flex: 1 1 320px; text-align: right; }
.pmds-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.pmds-btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 15px; font-weight: 700; line-height: 1; cursor: pointer;
	padding: 12px 18px; border-radius: var(--radius); border: 1.5px solid var(--rule); background: transparent; color: var(--title);
	text-decoration: none !important; box-shadow: none; text-transform: none; letter-spacing: 0; }
.pmds-btn:hover { border-color: var(--accent); color: var(--accent); }
.pmds-btn--primary { background: var(--accent); border-color: var(--accent); color: #fff !important; }
.pmds-btn--primary:hover { filter: brightness(1.08); color: #fff; }
.pmds-btn.is-done { border-color: var(--accent); color: var(--accent); }

/* Phone: label above a full-width bar */
@media (max-width: 640px) {
	.pmds { padding: 18px 14px; margin-left: 0; margin-right: 0; }
	.pmds-row { grid-template-columns: 24px 1fr auto; grid-template-areas: "rank name v2" ". track track"; row-gap: 4px; padding: 6px 4px; }
	.pmds-rank { grid-area: rank; }
	.pmds-name { grid-area: name; font-size: 15px; }
	.pmds-v2 { grid-area: v2; min-width: 64px; font-size: 13px; }
	.pmds-track { grid-area: track; margin-right: 52px; }
	.pmds[data-format="split-bar"] .pmds-row { grid-template-columns: 1fr; grid-template-areas: none; }
	.pmds-axis { font-size: 11px; }
	.pmds-axis-ref { display: block; }
	.pmds-src { text-align: left; }
	.pmds-controls { flex-direction: column; align-items: stretch; }
	.pmds-search input { width: 100%; }
	.pmds-sort { align-self: flex-start; }
	.pmds-btn { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
	.pmds-bar, .pmds-val { transition: none !important; }
	.pmds.is-anim .pmds-bar { transform: none; } .pmds.is-anim .pmds-val { opacity: 1; }
}
