/* The explainer figures (js/cme-explainer.js), used by /what-is-a-cme and the /learn modules.
   Loaded after help.css (tokens). A figure is a dark "stage" holding a real image or a drawn
   canvas, an optional row of controls, and a caption.
   The .article rules are for /what-is-a-cme alone (the only page here with an .article): it
   sets the site's text measure to the figures' width, so every block shares the same edges.
   The /learn pages do the same in css/learn.css. */

:root { --prose: 960px; }
.article p, .article ul li { font-size: 15px; }
.article p.lead { font-size: 17px; }

.cx-fig { margin: 22px 0 26px; }
.cx-stage { position: relative; background: #05070c; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cx-stage canvas, .cx-stage > img, .cx-stage iframe { display: block; width: 100%; border: 0; border-radius: 0; }
.cx-stage > img { height: auto; }
.cx-fig figcaption { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.55; }
.cx-fig figcaption b { color: #c3cbe2; }
.cx-kind { display: inline-block; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; padding: 1px 7px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); margin-right: 6px; vertical-align: 1px; }
.cx-kind.real { color: var(--green); border-color: rgba(61,220,151,.5); }
.cx-kind.model { color: var(--accent); border-color: rgba(255,179,71,.5); }

/* canvas shapes */
#cx-erupt canvas { aspect-ratio: 16 / 9; }
#cx-race canvas { aspect-ratio: 16 / 6.2; }
#cx-journey canvas { aspect-ratio: 16 / 8.4; }
#cx-anatomy canvas { aspect-ratio: 16 / 10.4; }
#cx-shield canvas { aspect-ratio: 16 / 9; }
#cx-live iframe { aspect-ratio: 16 / 10; }

/* controls under a stage */
.cx-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--bg2); }
.cx-btn { font: inherit; font-size: 12px; line-height: 1.3; padding: 6px 11px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; text-align: left; }
.cx-btn:hover { border-color: var(--accent); }
.cx-btn.on { border-color: var(--accent); color: var(--accent); background: rgba(255,179,71,.10); }
.cx-btn .k { color: var(--accent); font-weight: 700; margin-right: 6px; }
.cx-ctl input[type=range] { flex: 1 1 160px; min-width: 120px; accent-color: var(--accent); }
.cx-clock { font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cx-ctl label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.cx-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; flex: 1 1 100%; }
.cx-cap, .cx-say { flex: 1 1 100%; font-size: 13.5px; color: #c3cbe2; line-height: 1.55; min-height: 3.1em; margin: 0; }
.cx-say b { color: var(--text); }

/* a real image with labels laid over it */
.cx-anno { position: relative; }
.cx-anno img { display: block; width: 100%; height: auto; border: 0; border-radius: 0; }
.cx-tag { position: absolute; left: var(--x); top: var(--y); font-size: 11.5px; line-height: 1.35; color: var(--text); white-space: nowrap; transform: translate(12px, -50%); padding: 2px 7px; border-radius: 5px; background: rgba(5,7,12,.74); border: 1px solid rgba(215,221,238,.22); pointer-events: none; }
.cx-tag::before { content: ""; position: absolute; left: -16px; top: 50%; width: 7px; height: 7px; margin-top: -4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px rgba(5,7,12,.7); }
.cx-tag::after { content: ""; position: absolute; left: -9px; top: 50%; width: 9px; height: 1px; background: rgba(215,221,238,.5); }
.cx-tag.l { transform: translate(calc(-100% - 12px), -50%); }
.cx-tag.l::before { left: auto; right: -16px; }
.cx-tag.l::after { left: auto; right: -9px; }
.cx-tag small { display: block; color: var(--muted); font-size: 10.5px; }
/* Earth to scale on the filament photo: the dot IS the measurement */
.cx-earth { position: absolute; left: var(--x); top: var(--y); width: .46%; aspect-ratio: 1; border-radius: 50%; background: #6fb4ff; box-shadow: 0 0 0 1.5px rgba(5,7,12,.8), 0 0 8px rgba(77,163,255,.9); transform: translate(-50%, -50%); }

.cx-pair { display: grid; grid-template-columns: 1.33fr 1fr; gap: 14px; align-items: start; }
.cx-pair .cx-fig { margin: 0; }

/* effect cards */
.cx-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 16px 0; }
.cx-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none; transition: border-color .15s, transform .15s; }
a.cx-card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.cx-card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border: 0; border-radius: 0; }
.cx-card .b { padding: 11px 14px 13px; }
.cx-card h3 { margin: 0 0 4px; font-size: 14px; color: var(--text); letter-spacing: 0; }
.cx-card p { margin: 0; font-size: 12.5px; color: #c3cbe2; line-height: 1.5; }
.cx-card .go { display: block; margin-top: 6px; font-size: 12px; color: var(--accent); font-weight: 700; }

/* G-scale strip */
.cx-gscale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 14px 0; }
.cx-gscale div { border-radius: 8px; padding: 8px 9px; font-size: 11px; line-height: 1.4; color: #1a1205; }
.cx-gscale b { display: block; font-size: 15px; color: inherit; }
.cx-gscale .g1 { background: #e8c97a; } .cx-gscale .g2 { background: #ffb347; } .cx-gscale .g3 { background: #ff8c1a; }
.cx-gscale .g4 { background: #ff5470; color: #fff; } .cx-gscale .g5 { background: #ff3b5c; color: #fff; }

/* contents line under the lead */
.cx-toc { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 16px 0 4px; font-size: 12px; }
.cx-toc a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); }
.cx-toc a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

@media (max-width: 900px) { .cx-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) {
  #cx-erupt canvas { aspect-ratio: 4 / 3.4; }
  #cx-race canvas { aspect-ratio: 4 / 3.1; }
  #cx-journey canvas { aspect-ratio: 4 / 3; }
  #cx-anatomy canvas { aspect-ratio: 4 / 4.6; }
  #cx-shield canvas { aspect-ratio: 4 / 3.2; }
  #cx-live iframe { aspect-ratio: 1 / 1; }
  .cx-steps { grid-template-columns: repeat(2, 1fr); }
  .cx-pair { grid-template-columns: 1fr; }
  .cx-cards { grid-template-columns: 1fr; }
  .article p, .article ul li { font-size: 14px; }
  .article p.lead { font-size: 16px; }
  .cx-gscale { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .cx-gscale div { padding: 6px 5px; font-size: 9.5px; }
  .cx-gscale span { display: none; }
  .cx-tag { font-size: 10px; padding: 1px 5px; }
  .cx-tag.opt { display: none; }
  .cx-cap, .cx-say { min-height: 4.6em; }
}
