/* Mining by country: the stats board on every country page, the scroll stories of the biggest mining countries and
   the global view on /mining-in/. Built on minerals.css tokens; pages come from builder/minerals/build_guides.py. */

/* ---- stats board ---- */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 28px; }
.tile { position: relative; overflow: hidden; border-radius: 16px; padding: 18px 18px 16px; border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015)); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  display: flex; flex-direction: column; gap: 4px; min-height: 128px; }
.tile::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 60% at 100% 0%, color-mix(in srgb, var(--c, var(--lime)) 14%, transparent), transparent 70%); }
.tile .lbl { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.tile > b { font-family: var(--head); font-size: clamp(28px, 3vw, 36px); font-weight: 600; letter-spacing: -.03em; line-height: 1.05; margin-top: 4px; }
.tile .sub { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.tile .meter { display: block; height: 6px; margin-top: auto; border-radius: 3px; background: rgba(255, 255, 255, .06); position: relative; overflow: hidden; }
.tile .meter::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: linear-gradient(90deg, var(--c, var(--lime)), var(--teal)); border-radius: 3px;
  transform-origin: left; animation: grow 1.2s var(--ease) .2s both; }
@keyframes grow { from { transform: scaleX(0); } }
.tile.gov { grid-column: span 2; }
.tile.gov ul { display: grid; gap: 8px; margin: 10px 0 8px; }
.tile.gov li, .wgil li { display: grid; grid-template-columns: 128px 1fr 54px; gap: 10px; align-items: center; font-size: 13px; }
.tile.gov li span, .wgil li span { color: #c9d4d0; }
.tile.gov li small, .wgil li small { grid-column: 2 / 4; font-size: 11px; color: var(--faint); margin-top: -4px; }
.wgi { position: relative; display: block; height: 6px; border-radius: 3px; background: linear-gradient(90deg, rgba(255, 110, 110, .35), rgba(255, 255, 255, .08) 50%, rgba(95, 224, 200, .35)); }
.wgi::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line2); }
.wgi b { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--c, var(--lime)); box-shadow: 0 0 0 3px rgba(5, 8, 10, .9), 0 0 14px var(--c, var(--lime)); }
.tile.gov em, .wgil em { font-style: normal; font-family: var(--mono); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.guide .h1like { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.08; margin-top: 0; }
.scards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 14px; }
.scard { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 14px; text-decoration: none; border: 1px solid var(--line);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 14%, transparent), rgba(255, 255, 255, .02)); transition: transform .3s var(--ease), border-color .3s; }
.scard:hover { transform: translateY(-2px); border-color: var(--c); }
.scard b { font-family: var(--head); font-size: 18px; }
.scard span { font-size: 12.5px; color: var(--muted); }
.cols a.story::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--lime); align-self: center; box-shadow: 0 0 8px var(--lime); }

/* ---- country story (same stage mechanics as the mineral stories) ---- */
.cstory .rank li { grid-template-columns: 112px 1fr 62px; }
.cstory .rank b small { display: block; font-size: 10px; color: var(--faint); font-weight: 400; line-height: 1; }
.cstory .rank .bar { background: var(--c); }
.wgil { margin-top: 14px; display: grid; gap: 10px; }
.cstory + .guide, .hub + .guide { padding-top: 72px; }
.cstory + .guide { position: relative; z-index: 3; background: var(--bg); max-width: none; padding-left: 0; padding-right: 0; border-top: 1px solid var(--line); }
.cstory + .guide > * { max-width: 920px; margin-left: auto; margin-right: auto; padding-left: 24px; padding-right: 24px; }
.cstory + .guide .board, .cstory + .guide .tbl { max-width: 872px; }
.cstory .flows li { grid-template-columns: 1fr 64px 64px; }
.cstory .flows li small { color: var(--faint); font-size: 11px; }
.cstory .flows li i { background: var(--c); }
.guide-page[data-page="country"] .nav, .guide-page[data-page="hub"] .nav { background: transparent; border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
.guide-page[data-page="country"] .nav.solid, .guide-page[data-page="hub"] .nav.solid { background: rgba(5, 8, 10, .74); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); }

/* ---- global view (hub) ---- */
.hub { position: relative; min-height: 100vh; min-height: 100svh; display: flex; align-items: center; }
.hub .stage { position: absolute; inset: 0; height: auto; }
.hub .stage canvas { cursor: crosshair; }
.hub.ready .stage canvas { opacity: 1; }
.hub-copy { position: relative; z-index: 2; width: 100%; pointer-events: none; padding-top: 110px; padding-bottom: 60px; }
.hub-copy > * { pointer-events: auto; max-width: 620px; }
.hub h1 { font-size: clamp(40px, 6.4vw, 80px); line-height: .98; }
.hub-ui { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 26px; }
.hub-btns { display: flex; gap: 8px; }
.hub .seg { margin: 0; }
.hovercard { position: absolute; z-index: 5; left: 0; top: 0; width: 280px; padding: 14px 16px; border-radius: 14px; pointer-events: none; transform: translate(14px, 14px); font-size: 13px; }
.hovercard b.n { display: block; font-family: var(--head); font-size: 20px; margin-bottom: 6px; }
.hovercard dl { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; margin: 0; }
.hovercard dt { color: var(--muted); }
.hovercard dd { margin: 0; font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.hovercard .more { display: block; margin-top: 8px; color: var(--lime); font-size: 12.5px; }
.hub .legend { display: flex; align-items: center; gap: 10px; margin-top: 18px; font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.hub .legend i { flex: 1; max-width: 220px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, rgba(255, 255, 255, .06), var(--lime)); }
.hub .caption { position: absolute; left: 50%; bottom: 38px; transform: translateX(-50%); z-index: 3; max-width: min(720px, 92vw); padding: 14px 22px; border-radius: 14px; text-align: center;
  opacity: 0; transition: opacity .6s var(--ease); pointer-events: none; }
.hub .caption.on { opacity: 1; }
.hub .caption b { display: block; font-family: var(--head); font-size: clamp(20px, 2.6vw, 30px); letter-spacing: -.02em; }
.hub .caption span { color: #c9d4d0; font-size: 14px; }
.hub.touring .hub-copy { opacity: 0; pointer-events: none; transition: opacity .6s; }
.hub.touring .stop { position: absolute; right: 24px; top: 96px; z-index: 6; }
.hub .stop { display: none; }
.hub.touring .stop { display: inline-flex; }
.hub .rec-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ff5d5d; margin-right: 8px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }

@media (max-width: 900px) {
  .tile.gov { grid-column: 1 / -1; }
  .tile.gov li, .wgil li { grid-template-columns: 104px 1fr 50px; }
  .hub { align-items: flex-end; }
  .hub-copy { padding-bottom: 40px; }
  .hovercard { position: fixed; left: 12px !important; right: 12px; top: auto !important; bottom: 12px; width: auto; transform: none; }
  .hub .caption { bottom: 18px; }
  .cstory + .guide > * { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .tile .meter::after { animation: none; }
  .scard { transition: none; }
}
