/* aak.dev/pi: the Raspberry Pi that serves this site. On top of style.css (its type and colours).

   Without the class "gl" on <html> (pi.js puts it there when the graphics card can draw the board), and
   on any window narrower than 1000px, the page is one column: words, board, cards. With it, on a wide
   window, the first screen is held in place while the board changes into the labelled one. */
html, body { background: #000 !important; }
.pi-bar { position: absolute; z-index: 20; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px var(--m); }
.pi-bar .mark { font-weight: 600; letter-spacing: -0.02em; text-decoration: none; }
.pi-bar nav { display: flex; gap: clamp(14px, 2.2vw, 32px); }
.pi-bar nav a { text-decoration: none; font-size: var(--step-small); transition: color .2s; }
.pi-bar nav a:hover, .pi-bar .mark:hover { color: var(--accent); }

.pi { padding: 0 var(--m) clamp(48px, 8vw, 96px); }
.pi h1 { font-size: var(--step-head); letter-spacing: -0.035em; line-height: 1; font-weight: 600; }
.pi-lead { margin-top: 18px; max-width: 30ch; font-size: var(--step-lead); line-height: 1.22; letter-spacing: -0.02em; }
.pi-heard { margin-top: 14px; color: var(--muted); font-size: var(--step-small); font-variant-numeric: tabular-nums; min-height: 1.4em; }
.pi-heard::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; background: #48484a; vertical-align: 1px; transition: background-color .3s; }
.pi-heard.live::before { background: #30d158; }
.pi-heard.beat::before { animation: pi-beat .9s ease-out; }
@keyframes pi-beat { 0% { box-shadow: 0 0 0 0 rgba(48, 209, 88, .6); } 100% { box-shadow: 0 0 0 9px rgba(48, 209, 88, 0); } }
.pi-note { margin-top: 12px; color: var(--muted); font-size: 0.8125rem; }
.pi-foot { margin-top: clamp(32px, 5vw, 64px); color: #77777c; font-size: var(--step-small); max-width: 70ch; }
.pi-foot:empty { display: none; }

/* ---------- the board, and where it stands ---------- */
.p6-track { position: relative; margin: 0 calc(var(--m) * -1); }
.p6-stage { position: relative; padding-top: 84px; }
.p6-left { padding: 0 var(--m); }
.p6-slot { position: relative; width: min(100%, 560px); aspect-ratio: 1; margin: -7% auto -9%; }      /* the board lies flat, so the square's top and foot are spare: the words and cards close in on it */
.p6-slot > canvas { display: block; width: 100%; height: 100%; outline: none; }
.p6-view { position: absolute; left: 0; top: 0; }
.p6-view canvas { display: block; pointer-events: none; }
.p6-grab { position: absolute; left: 0; top: 0; border-radius: 50%; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; outline-offset: -6px; }
.p6-grab.held { cursor: grabbing; }

/* the labels of the second board, their lines, and the note that follows the pointer over the first */
.pi-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; display: none; }
.pi-lines line { stroke: rgba(245, 245, 247, .38); stroke-width: 1; }
.pi-lines line.hot { stroke: var(--accent); }
.pi-lines circle { fill: var(--ink); }
.pi-tags { position: absolute; inset: 0; pointer-events: none; display: none; }
.pi-tag { position: absolute; left: 0; top: 0; font-size: 0.8125rem; line-height: 1.25; opacity: 0; transition: opacity .25s; }
.pi-tag.on { opacity: 1; }
.pi-tag b { display: block; font-weight: 600; }
.pi-tag span { display: block; color: var(--muted); font-variant-numeric: tabular-nums; }
.pi-tag .live { color: var(--ink); }
.pi-tag .live:empty { display: none; }
.pi-tag.hot b { color: var(--accent); }
.pi-tip { position: absolute; left: 0; top: 0; margin: 0; padding: 8px 12px; border-radius: 10px; background: #1d1d1f; font-size: var(--step-small); line-height: 1.3; max-width: 17rem; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 3; }
.pi-tip.on { opacity: 1; }
.pi-tip b { display: block; font-weight: 600; }
.pi-tip span { color: var(--muted); }

/* ---------- a card: a thin line round a little room; a small grey name and a big figure ---------- */
.card { border: 1px solid #252528; border-radius: 12px; background: #0a0a0b; padding: 13px 15px; min-width: 0; }
.card .lab { display: block; color: var(--muted); font-size: 0.8125rem; line-height: 1.3; white-space: nowrap; }
.card .val, .mini figcaption b, .dcard .now { font-size: clamp(1.125rem, 1.5vw, 1.375rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card .val { display: block; margin-top: 3px; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.minis { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 10px; }
.mini { margin: 0; }
.mini canvas { display: block; width: 100%; height: clamp(72px, 13vh, 126px); }
.mini figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 8px; color: var(--muted); font-size: 0.8125rem; }
.mini figcaption b { color: var(--ink); }

/* the second screen's cards: name and figure, the chart, what the chart covers, then three smaller figures */
.p6-detail { margin-top: 10px; }
.dgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.dcard { display: flex; flex-direction: column; }
.dcard header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.dcard h3 { margin: 0; font-size: 0.8125rem; font-weight: 400; color: var(--muted); }
.dcard .plot { position: relative; height: 92px; margin-top: 8px; }
.dcard .plot.bar { height: 26px; margin-top: 12px; }
.dcard .plot canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.dcard .cap { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; color: #77777c; font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.dcard dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: auto 0 0; padding-top: 10px; }
.dcard .plot + dl, .dcard .cap + dl { margin-top: 10px; border-top: 1px solid #1c1c1e; }
.dcard dt { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.dcard dd { margin: 1px 0 0; font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* below: what it is running, and what it is */
.p6-more { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 10px; }
.p6-more .card { padding: 16px 18px; }
.p6-more table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.p6-more th { text-align: right; font-weight: 400; color: var(--muted); font-size: 0.8125rem; padding: 0 0 8px; }
.p6-more td { text-align: right; padding: 8px 0; border-top: 1px solid #1c1c1e; }
.p6-more th:first-child, .p6-more td:first-child { text-align: left; }
.p6-more th:not(:first-child) { width: 7rem; }
.facts { margin: 0; }
.facts div { display: flex; justify-content: space-between; gap: 18px; padding: 8px 0; border-top: 1px solid #1c1c1e; }
.facts div:first-child { border-top: 0; padding-top: 0; }
.facts dt { color: var(--muted); flex: none; }
.facts dd { margin: 0; text-align: right; }

@media (max-width: 700px) { .pi-bar nav a:nth-child(n+3) { display: none; } }
@media (min-width: 560px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .minis, .dgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 760px) { .p6-more { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }

@media (min-width: 1000px) {
  html.gl .p6-track { height: 220vh; height: 220svh; }
  html.gl .p6-stage { position: sticky; top: 0; height: 100vh; height: 100svh; padding-top: 0; overflow: hidden; }
  html.gl .p6-slot { display: none; }
  /* the left of the screen: first the words and the small cards, then (--hero and --detail are set from the scroll, and are never both above nought) a card for everything */
  html.gl .p6-left { position: absolute; z-index: 2; left: 0; top: 0; height: 100%; width: min(44%, calc(660px + var(--m))); padding: 0 0 0 var(--m); display: flex; flex-direction: column; justify-content: center; will-change: opacity, transform; }
  html.gl .p6-hero { opacity: var(--hero, 1); transform: translate3d(0, calc((1 - var(--hero, 1)) * -28px), 0); }
  html.gl .p6-detail { opacity: var(--detail, 0); transform: translate3d(0, calc((1 - var(--detail, 0)) * 28px), 0); visibility: hidden; margin-top: 0; padding-top: 68px; padding-bottom: 22px; justify-content: flex-start; }
  html.gl .p6-stage.at-detail .p6-detail { visibility: visible; }
  html.gl .p6-stage.at-detail .p6-hero { visibility: hidden; }
  html.gl .kpis { margin-top: clamp(18px, 3.4vh, 34px); }
  html.gl .dgrid { height: 100%; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) auto; }
  html.gl .dcard .plot { flex: 1; height: auto; min-height: 40px; }
  html.gl .dcard .plot.bar { flex: none; height: 26px; min-height: 0; }
  html.gl .pi-tags, html.gl .pi-lines { display: block; opacity: var(--tags, 0); }
  html.gl .pi-tag { width: var(--tagw, 12rem); }
  html.gl .pi-tags.tight .pi-tag span:not(.live) { display: none; }
  html.gl .pi-tag.right { text-align: left; }
  html.gl .pi-tag.left { text-align: right; }
  html.gl .p6-stage.labelled .pi-tag { pointer-events: auto; cursor: default; }
  html.gl .p6-more { margin-top: 0; }
}
@media (min-width: 1000px) and (max-height: 760px) {
  html.gl .card { padding: 10px 14px; }
  html.gl .dcard dl { padding-top: 7px; }
  html.gl .p6-detail { padding-top: 60px; padding-bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) { .pi-heard.beat::before { animation: none; } }
