/* AI infrastructure board. Tokens, header, cards and controls live in ../theme.css. */

.card h3 { font-size: 22px; line-height: 1.3; font-weight: 700; font-stretch: 108%; }
.hint.small { margin-top: 14px; }
.num { text-align: right; }
.swatch { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--line-ctl); }

/* ---------- Topics: the table that picks a topic ---------- */
.topics { margin-top: 32px; padding: 28px 16px 22px; }
.topics h2, .topics .lead { padding: 0 16px; }
.topics .lead { margin-top: 2px; }
.topic-cols, .topic { display: grid; grid-template-columns: minmax(170px, 16%) minmax(110px, 9%) minmax(130px, 10%) minmax(0, 1fr); gap: 20px; align-items: center; padding: 0 16px; }
.topic-cols { margin-top: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.topic { position: relative; width: 100%; min-height: 68px; border: 0; border-radius: 6px; background: transparent; text-align: left; }
.topic + .topic::before { content: ''; position: absolute; left: 16px; right: 16px; top: 0; height: 1px; background: var(--line); }
.topic.on::before, .topic.on + .topic::before { display: none; }
.topic:hover { background: var(--blush); }
.topic.on { background: var(--cobalt-tint); }
.topic-name { font-family: var(--display); font-size: 19px; font-weight: 700; font-stretch: 108%; }
.topic.on .topic-name { color: var(--cobalt); }
.topic-week { font-family: var(--display); font-size: 20px; font-weight: 700; }
.topic-change { font-size: 16px; color: var(--mist); }
.topic svg { display: block; width: 100%; height: 44px; overflow: visible; }
.topic rect { fill: var(--line-ctl); }
.topic.on rect { fill: var(--cobalt); }
.topic rect:hover { fill: var(--ink); }
.topic .base { stroke: var(--line); stroke-width: 1; }
.topics-note { padding: 12px 16px 0; }

/* ---------- Charts ---------- */
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 24px; }
.pair.compare { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.chart-card { padding: 28px 32px; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; }
.chart-box { position: relative; height: 400px; margin-top: 18px; }
/* Beside the taller bar chart, the line chart takes the spare height instead of leaving it empty. */
.trend-card { display: flex; flex-direction: column; }
.trend-card .chart-box { flex: 1 1 400px; height: auto; min-height: 400px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.lg { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border: 0; border-radius: 6px; background: var(--blush); color: var(--ink); font-size: 15px; }
.lg:hover { background: var(--blush-2); }
.lg[aria-pressed="false"] { color: var(--mist); text-decoration: line-through; }
.lg[aria-pressed="false"] .swatch { opacity: 0.3; }
.key-row { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 12px 0 6px; font-size: 15px; color: var(--mist); }
.key-row:empty { display: none; }
.key-item { display: inline-flex; align-items: center; gap: 7px; }
.key-item i, .bar { display: block; height: 10px; border-radius: 0 3px 3px 0; }
.key-item i { width: 18px; }
.now { background: var(--cobalt); }
.before { background: var(--line-ctl); }

/* Horizontal bars as plain rows: the label, then one or two bars with their numbers beside them. */
.bar-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 14px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); font-size: 16px; }
.bar-row:first-child { border-top: 0; }
.bar-row.on .bar-label { color: var(--cobalt); }
.bar-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-lines { display: grid; gap: 4px; min-width: 0; }
/* The number has its own column so every bar in a chart is measured against the same width. */
.bar-line { display: grid; grid-template-columns: minmax(0, 1fr) 5ch; align-items: center; gap: 10px; min-height: 16px; }
.bar-val { color: var(--mist); text-align: right; white-space: nowrap; }
.bar-line:first-child .bar-val { color: var(--ink); font-weight: 600; }
.bar-note { grid-column: 2; color: var(--mist); }
.bars .state { padding: 24px 0; }

/* ---------- Hours of the week: one row per weekday, one cell per hour ---------- */
.hours-card { margin-top: 24px; }
.heat-peak { margin-top: 12px; }
.heat { display: grid; grid-template-columns: 52px repeat(24, minmax(0, 1fr)); gap: 3px; margin-top: 14px; }
.heat-hour { grid-column: span 3; font-size: 14px; color: var(--mist); }
.heat-day { display: flex; align-items: center; font-size: 15px; color: var(--mist); }
.heat i { display: block; height: 32px; border-radius: 2px; }
.heat i:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.heat-key { display: flex; align-items: center; gap: 3px; margin-top: 16px; font-size: 15px; color: var(--mist); }
.heat-key i { width: 26px; height: 12px; border-radius: 2px; }
.heat-key span:first-child { margin-right: 5px; }
.heat-key span:last-child { margin-left: 5px; }

/* ---------- The selected topic ---------- */
.detail-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin-top: 56px; }
.detail-head h2 { font-size: clamp(1.875rem, 2.6vw, 2.75rem); line-height: 1.15; font-weight: 800; font-stretch: 112%; letter-spacing: -0.025em; }
.detail-head .hint { margin-top: 6px; font-size: 18px; }

.stories { margin-top: 24px; padding: 28px 32px 14px; }
.stories .hint { margin-top: 2px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
#stories ol { counter-reset: rank; }
.story { counter-increment: rank; display: grid; grid-template-columns: 34px minmax(0, 1fr) 200px; gap: 4px 18px; align-items: baseline; padding: 18px 0; border-bottom: 1px solid var(--line); }
.story:last-child { border-bottom: 0; }
.story::before { content: counter(rank); font-family: var(--display); font-weight: 700; color: var(--mist); }
.story-title { font-family: var(--display); font-size: 21px; line-height: 1.3; font-weight: 700; font-stretch: 104%; color: var(--ink); }
.story-meta { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 15px; color: var(--mist); }
.story-votes { grid-column: 3; grid-row: 1 / span 2; align-self: center; font-size: 15px; color: var(--mist); }
.story-votes b { display: block; font-family: var(--display); font-size: 18px; font-weight: 700; color: var(--ink); }
.story-votes .bar { margin: 4px 0; }

@media (max-width: 900px) {
  .pair, .pair.compare { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .topics { padding: 20px 6px 16px; }
  .topic-cols { display: none; }
  .topics .lead { padding-bottom: 10px; }
  .topic { grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 14px; padding: 12px 14px; }
  .topic svg { grid-column: 1 / -1; }
  .topic-week::after { content: ' this week'; font-family: var(--body); font-size: 14px; font-weight: 400; color: var(--mist); }
  .chart-card { padding: 20px 18px; }
  .chart-box { height: 260px; }
  .heat { grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 1px; }
  .heat i { height: 18px; }
  .bar-row { grid-template-columns: 116px minmax(0, 1fr); }
  .detail-head { margin-top: 44px; }
  .stories { padding: 20px 18px 8px; }
  .story { grid-template-columns: 22px minmax(0, 1fr); }
  .story-votes { grid-column: 2; grid-row: auto; }
}
@media (pointer: coarse) {
  .lg { min-height: 44px; padding: 0 14px; }
}
