/* Dashboard panel: a side pane of titled frames. One font size for the
   whole pane, square corners, characters instead of drawn shapes. */
.dashboard {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  height: 100%;
  height: 100dvh;
  background: var(--widget-bg);
  border-left: 1px solid var(--widget-border);
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  transition: transform 0.3s ease;
}

.dashboard.hidden {
  transform: translateX(100%);
  pointer-events: none;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--widget-border);
  flex-shrink: 0;
}

.dashboard-title {
  color: var(--accent);
  font-weight: 700;
}

.dashboard-close {
  color: var(--dim);
  cursor: pointer;
  font-family: var(--font-mono);
  padding: 0 1ch;
}

.dashboard-close:hover {
  color: var(--accent);
}

.dashboard-widgets {
  padding: 4px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

/* Widget base: a .frame (see terminal.css) */
.widget.frame {
  padding: calc(var(--line-height) * 0.5em) 1.5ch;
}

/* Status widget */
.status-grid {
  display: flex;
  flex-direction: column;
}

.status-item {
  display: flex;
  align-items: baseline;
  gap: 1ch;
}

.status-dot {
  flex-shrink: 0;
  color: var(--accent);
}

.status-label {
  color: var(--accent);
  font-weight: 700;
}

.status-key {
  color: var(--dim);
  flex: none;
  width: 7ch;
}

.status-value {
  color: var(--text);
  white-space: nowrap;
}

/* The pane is narrow: one cell of side padding keeps the title on one line */
.dashboard .frame {
  padding-inline: 1ch;
}

.status-label a,
.status-value a {
  color: var(--accent);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: background-size 0.25s ease, color 0.25s ease;
}

.status-label a:hover,
.status-label a:focus-visible,
.status-value a:hover,
.status-value a:focus-visible {
  color: var(--highlight);
  background-size: 100% 1px;
}

/* Uptime widget */
.uptime-big {
  font-weight: 700;
  color: var(--accent);
}

.uptime-unit {
  color: var(--dim);
  font-weight: 400;
}

.uptime-small {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.uptime-label {
  color: var(--dim);
}

/* ■■■ meter: as many cells as fit, clipped at the frame edge */
.uptime-bar {
  color: var(--bar-fill);
  white-space: nowrap;
  overflow: hidden;
}

.uptime-sla {
  color: var(--dim);
}

/* GitHub widget: right-aligned numbers, then labels */
.github-stat {
  display: flex;
  gap: 1ch;
}

.github-stat-value {
  flex: none;
  width: 6ch;
  text-align: right;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.github-stat-label {
  color: var(--dim);
}

/* This year's running total: one area + 2px line, crosshair tooltip on hover */
.github-curve {
  margin: calc(var(--line-height) * 1em) 0 0;
}

.github-curve-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.github-curve-head .github-stat-value {
  width: auto;
}

.github-curve-plot {
  position: relative;
  height: 72px;
  margin-top: 4px;
  touch-action: pan-y;
}

.github-curve-plot svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.github-curve-area {
  fill: var(--accent);
  opacity: 0.14;
}

.github-curve-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2px;
  stroke-linejoin: round;
}

.github-curve-cross {
  stroke: var(--dim);
  stroke-width: 1px;
  opacity: 0;
}

.github-curve-tip {
  position: absolute;
  top: -4px;
  transform: translate(8px, -100%);
  white-space: nowrap;
  padding: 2px 6px;
  font-size: 0.85em;
  color: var(--text);
  background: var(--widget-bg);
  border: 1px solid var(--frame);
  pointer-events: none;
}

.github-curve-tip.flip {
  transform: translate(calc(-100% - 8px), -100%);
}

.github-curve-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.85em;
}

.github-static {
  margin-top: calc(var(--line-height) * 1em);
}

/* Dashboard toggle button */
.dashboard-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 99;
  background: var(--widget-bg);
  color: var(--accent);
  border: 1px solid var(--frame);
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
}

.dashboard-toggle:hover {
  background: var(--accent);
  color: var(--bg);
}

/* Hide toggle when dashboard is open */
body:has(.dashboard:not(.hidden)) .dashboard-toggle {
  display: none;
}

/* Dashboard open: shrink terminal */
body:has(.dashboard:not(.hidden)) #terminal-output,
body:has(.dashboard:not(.hidden)) #input-line,
body:has(.dashboard:not(.hidden)) #quick-commands {
  margin-right: 340px;
}

/* Fireflies stay in the terminal's right margin, not under the pane */
body:has(.dashboard:not(.hidden)) .fireflies i:nth-child(3),
body:has(.dashboard:not(.hidden)) .fireflies i:nth-child(4) {
  right: 362px;
}

/* Tech stack tags, printed as [Kubernetes] */
.stack-group + .stack-group {
  margin-top: calc(var(--line-height) * 0.5em);
}

.stack-label {
  color: var(--dim);
}

.stack-tags {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1ch;
}

.stack-tag {
  color: var(--text);
  white-space: nowrap;
}

.stack-tag::before {
  content: '[';
  color: var(--dim);
}

.stack-tag::after {
  content: ']';
  color: var(--dim);
}

a.stack-tag {
  text-decoration: none;
}

a.stack-tag:hover,
a.stack-tag:focus-visible {
  color: var(--accent);
  background: var(--tag-bg);
}
