/* Homepage "Live dashboards" tile row (markup in content/portfolio/index.html,
   behaviour in /assets/live-tiles.js). Cyan Ledger tokens from site.css.
   Fixed row heights: the static and live states occupy the same box, so the
   upgrade never shifts layout. Tiles are opaque over the digital rain. */
.page-section.live-dashboards,
.home-page .page-section.live-dashboards {
  padding-block: 0;
}

.lt-title {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

.lt-title::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  vertical-align: 1px;
}

.lt-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.lt {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 18px 36px 18px;
  row-gap: 6px;
  column-gap: 12px;
  padding: 14px 16px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.lt::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--edge, var(--accent)), transparent 72%);
  opacity: 0.85;
}

.lt[data-live-tile='options'] { --edge: var(--gold); }
.lt[data-live-tile='factors'] { --edge: var(--cyan); }
.lt[data-live-tile='oil'] { --edge: var(--red); }

.lt:hover,
.lt:focus-within {
  border-color: color-mix(in srgb, var(--edge, var(--accent)) 40%, var(--line-strong));
  box-shadow: 0 0 32px -14px color-mix(in srgb, var(--edge, var(--accent)) 45%, transparent);
}

.lt-top {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 18px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lt-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  white-space: nowrap;
}

.lt-link {
  color: var(--cyan);
  font-weight: 600;
  text-decoration: none;
}

/* Whole tile is the click target; the link keeps the accessible name. */
.lt-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.lt-link:focus-visible {
  outline: none;
}

.lt-link:focus-visible::after {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.lt-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.lt-label {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--faint);
  letter-spacing: 0.04em;
  text-transform: none; /* keeps β a beta, not a capital B */
}

.lt-label:not(:empty)::before {
  content: '· ';
}

.lt-value {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 36px;
}

.lt[data-state='static'] .lt-value {
  grid-column: 1 / -1;
  display: block;
}

.lt-num {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}

.lt-unit {
  font-size: 13px;
  color: var(--muted);
}

.lt-band {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 20px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.lt-band::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--band, var(--muted));
}

.lt-band[data-band='low'] { --band: var(--green); }
.lt-band[data-band='elevated'] { --band: var(--gold); }
.lt-band[data-band='high'],
.lt-band[data-band='severe'],
.lt-band[data-band='critical'] { --band: var(--red); }

.lt-badge {
  padding: 0 6px;
  border: 1px solid color-mix(in srgb, var(--gold) 60%, transparent);
  border-radius: var(--radius-sm);
  font-size: 9px;
  line-height: 15px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.lt-line {
  grid-column: 1 / -1;
  grid-row: 3;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 12.5px;
  line-height: 18px;
}

.lt[data-state='static'] .lt-line {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.lt-spark-slot {
  grid-column: 2;
  grid-row: 2;
  align-self: center;
  width: 112px;
  height: 34px;
}

.lt[data-state='static'] .lt-spark-slot {
  display: none;
}

.lt-spark {
  display: block;
  overflow: visible;
}

.lt-spark-line {
  fill: none;
  stroke: color-mix(in srgb, var(--accent) 50%, var(--muted));
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.lt-spark-end {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 1.5;
}

@media (max-width: 860px) {
  .lt-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
}

@media (max-width: 380px) {
  .lt-spark-slot { width: 84px; }
  .lt-spark { width: 84px; }
}

@media (forced-colors: active) {
  .lt { border-color: CanvasText; }
  .lt-spark-line { stroke: CanvasText; }
  .lt-spark-end { fill: Highlight; }
}
