/* =========================================================================
   Pythonation — media kit (/mediakit/ · /mediakit/ar/ · /mediakit/zh/)
   Loads after site.css and reuses its fonts, tokens, header, cards and footer.
   Strict CSP: no inline styles; bar widths are set from mediakit.js (CSSOM).
   Chart colours: brand set A (Python Blue, Crimson) + context gray.
   ========================================================================= */

@font-face { font-family: "Plex SC MK"; font-weight: 400; font-display: swap;
  src: url("../fonts/plex-sc-mk-400.woff2") format("woff2"); }
@font-face { font-family: "Plex SC MK"; font-weight: 600; font-display: swap;
  src: url("../fonts/plex-sc-mk-600.woff2") format("woff2"); }
:lang(zh-Hans) { --font: "Plex SC MK", "Plex Arabic", "PingFang SC", "Microsoft YaHei", sans-serif; }

:root {
  --s1: #416DA7;          /* Python Blue (shade) */
  --s2: #B32351;          /* Crimson (shade) */
  --ctx: #9DA5B3;         /* context gray */
  --grid: #CED1D6;
  --zero: #A6ABB5;
  --tile: #FFFFFF;
  --track: rgba(31, 42, 61, 0.07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --s1: #5B88C5;
    --s2: #D3456C;
    --ctx: #4D5566;
    --grid: #242B3B;
    --zero: #363D4D;
    --tile: #1F2A3D;
    --track: rgba(143, 176, 218, 0.10);
  }
}

.mk-top-right { display: flex; align-items: center; gap: 10px; }
@media (max-width: 640px) { .mk-top-right .btn { display: none; } }

.mk-hero { padding-block: clamp(8px, 3vw, 32px) clamp(28px, 5vw, 48px); text-align: center;
  display: flex; flex-direction: column; align-items: center; }
.mk-hero h1.bi { max-width: 26ch; }
.mk-hero h1.bi:lang(zh-Hans) { max-width: 20em; }
.mk-hero .lede { margin-block: 14px 24px; }
.mk-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.mk-section { padding-block-end: clamp(32px, 5vw, 52px); }
.mk-h2 { font-size: clamp(22px, 3vw, 30px); font-weight: 600; line-height: 1.35; margin-block-end: 4px; }
.mk-intro { color: var(--muted); max-width: 62ch; margin-block-end: 18px; font-size: 16px; }

/* Number tiles */
.mk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 14px;
  list-style: none; padding: 0; }
.mk-stat { background: var(--tile); border: 1px solid var(--card-line); border-radius: var(--radius);
  padding: 20px 24px; min-width: 0; }
.mk-stat-label { font-weight: 600; font-size: 15px; line-height: 1.4; }
.mk-stat-num { font-weight: 600; font-size: clamp(32px, 4.4vw, 44px); line-height: 1.15; margin-block: 8px 2px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.mk-stat-note { font-size: 13px; color: var(--muted); }

/* Period switch */
.mk-pickrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  margin-block-end: 18px; }
.mk-period { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; list-style: none;
  background: var(--card); border: 1px solid var(--card-line); border-radius: 999px; }
.mk-period button { font: 500 15px/1.4 var(--font); padding: 8px 16px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap;
  transition: background-color .2s var(--ease), color .2s var(--ease); }
.mk-period button:hover { color: var(--text); }
.mk-period button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
@media (prefers-color-scheme: dark) { .mk-period button[aria-pressed="true"] { background: var(--paper); color: var(--night); } }
.mk-range { font-family: var(--mono); font-size: 13px; color: var(--muted); }
@media (max-width: 520px) {
  .mk-pickrow { flex-direction: column; align-items: stretch; }
  .mk-period { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .mk-period::-webkit-scrollbar { display: none; }
  .mk-period button { padding: 7px 12px; font-size: 14px; }
  .mk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mk-stat { padding: 16px 16px; }
  .mk-stat-num { font-size: 28px; }
}

/* Cards */
.mk-card { background: var(--tile); box-shadow: none; border-radius: var(--radius); min-width: 0; }
.mk-card-h { font-size: 19px; font-weight: 600; margin-block-end: 2px; }
.mk-note { font-size: 14px; color: var(--muted); margin-block-end: 16px; }
.mk-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 860px) { .mk-cards { grid-template-columns: 1fr; } }
.mk-gap { margin-block-start: 14px; }

/* Views chart */
.mk-chartbox { position: relative; direction: ltr; min-height: 180px; }
.mk-chart { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.mk-chart .b { fill: var(--s1); transition: opacity .15s; }
.mk-chart .b.on { fill: var(--s2); }
.mk-chart .g { stroke: var(--grid); stroke-width: 1; }
.mk-chart .z { stroke: var(--zero); stroke-width: 1; }
.mk-chart .hit { fill: transparent; cursor: crosshair; }
.mk-chart text { font-family: var(--mono); font-size: 13px; fill: var(--muted); }
.mk-tip { position: absolute; z-index: 2; pointer-events: none; display: flex; flex-direction: column; gap: 2px;
  padding: 6px 10px; border-radius: 10px; background: var(--ink); color: var(--paper); font-size: 13px;
  line-height: 1.35; white-space: nowrap; }
.mk-tip[hidden] { display: none; }
.mk-tip b { font-weight: 600; font-variant-numeric: tabular-nums; }
.mk-tip-d { opacity: .8; }
@media (prefers-color-scheme: dark) { .mk-tip { background: var(--paper); color: var(--night); } }

/* Horizontal bars */
.mk-bars { list-style: none; padding: 0; display: grid; gap: 10px; }
.mk-bar { display: grid; grid-template-columns: minmax(6.5rem, 10rem) 1fr 3.8rem; gap: 14px; align-items: center;
  font-size: 15px; line-height: 1.35; }
.mk-track { display: block; height: 12px; border-radius: 4px; background: var(--track); overflow: hidden; }
.mk-fill { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--s1);
  transition: width .45s var(--ease); }
.mk-fill.hi { background: var(--s2); }
.mk-fill.lo { background: var(--ctx); }
.mk-bar-v { text-align: end; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .mk-fill { transition: none; } }

.mk-big { font-weight: 600; font-size: clamp(46px, 7vw, 68px); line-height: 1.05; font-variant-numeric: tabular-nums; }
.mk-big small { font-size: 17px; font-weight: 400; color: var(--muted); margin-inline-start: 8px; }
.mk-split { display: flex; gap: 3px; height: 18px; margin-block: 18px 12px; }
.mk-split span { display: block; height: 100%; border-radius: 4px; transition: width .45s var(--ease); }
.mk-split .m { background: var(--s1); }
.mk-split .f { background: var(--s2); }
.mk-key { display: flex; flex-wrap: wrap; gap: 8px 22px; list-style: none; padding: 0; font-size: 15px; color: var(--muted); }
.mk-key i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-inline-end: 8px; }
.mk-key .km { background: var(--s1); }
.mk-key .kf { background: var(--s2); }
.mk-key b { color: var(--text); font-weight: 600; margin-inline-start: 6px; font-variant-numeric: tabular-nums; }
.mk-callout { font-size: 15px; color: var(--muted); margin-block: -8px 14px; }

/* Top videos */
.mk-videos { list-style: none; padding: 0; }
.mk-video { display: grid; grid-template-columns: 2.4rem 1fr auto; gap: 16px; align-items: center;
  padding-block: 13px; border-block-start: 1px solid var(--card-line); }
.mk-video:first-child { border-block-start: 0; padding-block-start: 0; }
.mk-rank { font-family: var(--mono); color: var(--crimson); font-size: 15px; }
@media (prefers-color-scheme: dark) { .mk-rank { color: #D3456C; } }
.mk-vbody { min-width: 0; display: grid; gap: 8px; }
.mk-vt { font-weight: 600; line-height: 1.5; color: var(--text); text-decoration: none; font-family: "Plex Arabic", var(--font); }
.mk-vt:hover { color: var(--link); text-decoration: underline; }
.mk-vtrack { height: 6px; }
.mk-vv { text-align: end; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mk-vv span { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
@media (max-width: 520px) {
  .mk-bar { grid-template-columns: 6rem 1fr 3.4rem; gap: 10px; font-size: 14px; }
  .mk-video { grid-template-columns: 1.8rem 1fr; align-items: start; gap: 6px 12px; }
  .mk-vv { grid-column: 2; text-align: start; }
  .mk-vv span { display: inline; margin-inline-start: 6px; }
}

/* Waiting for data: keep the boxes, hide the dashes */
[data-mk]:not(.mk-ready) [data-chart] { min-height: 120px; }

/* Contact */
.mk-contact { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; }
.mk-contact h2 { font-size: 22px; font-weight: 600; }
.mk-contact ul { display: flex; flex-wrap: wrap; gap: 8px 22px; list-style: none; padding: 0; }
.mk-contact a { color: var(--lightblue); }
.mk-noscript { margin-block-end: 16px; color: var(--muted); font-size: 15px; }
