/* Dashboard overrides on top of tufte-css */

body {
  background: #fffff8;
  color: #111;
  padding-left: 5%;
  padding-right: 5%;
  margin-left: auto;
  margin-right: auto;
}

/* Override tufte-css dark mode */
@media (prefers-color-scheme: dark) {
  body {
    background: #fffff8;
    color: #111;
  }
}

h1 {
  margin-bottom: 0.2rem;
}

.subtitle {
  font-style: italic;
  color: #666;
  margin-top: 0;
}

.last-updated {
  font-size: 0.85rem;
  color: #999;
  margin-top: 0;
}

/* Metrics grid: small multiples */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.metric-card {
  border: 1px solid #e0e0e0;
  padding: 1rem 1.2rem;
  background: #fff;
  position: relative;
}

.metric-card h3 {
  font-size: 1rem;
  margin: 0 0 0.3rem 0;
}

.metric-card a,
#hf-table a {
  color: inherit;
  text-decoration: none;
  text-shadow: none;
  background: none;
}

.metric-card a:hover,
#hf-table a:hover {
  text-decoration: underline;
}

.metric-card .headline {
  font-size: 1.6rem;
  font-weight: bold;
  margin: 0.2rem 0;
}

.metric-card .detail {
  font-size: 0.85rem;
  color: #666;
  margin: 0.15rem 0;
}

.sparkline-container {
  margin-top: 0.5rem;
  height: 36px;
}

.sparkline path {
  fill: none;
  stroke: #333;
  stroke-width: 1.5;
}

.sparkline circle {
  fill: #333;
}

/* HuggingFace table */
#hf-section {
  max-width: none;
  width: 100%;
}

#hf-table {
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1rem 0;
}

@media (max-width: 600px) {
  #hf-table thead { display: none; }

  #hf-table,
  #hf-table tbody,
  #hf-table tr,
  #hf-table td {
    display: block;
    width: 100%;
  }

  #hf-table tr {
    padding: 0.6rem 0;
    border-bottom: 1px solid #e8e8e8;
  }

  #hf-table td {
    padding: 0.15rem 0;
    white-space: normal;
  }

  #hf-table td:first-child {
    font-weight: bold;
  }

  #hf-table td[data-label="24hr"] {
    display: none;
  }

  #hf-table td[data-label]::before {
    content: attr(data-label) ": ";
    color: #999;
    font-weight: normal;
  }

  #hf-table td[data-label="Total downloads"],
  #hf-table .sparkline-cell {
    display: inline-block;
    width: auto;
    text-align: left;
    vertical-align: middle;
  }

  #hf-table .sparkline-cell {
    margin-left: 0.5rem;
  }

  #hf-table .sparkline-cell::before {
    display: none;
  }
}

#hf-table th,
#hf-table td {
  text-align: left;
  padding: 0.35rem 1.2rem 0.35rem 0;
  white-space: nowrap;
}

#hf-table th.num,
#hf-table td.num {
  text-align: right;
  white-space: nowrap;
}

#hf-table thead th {
  font-weight: bold;
}

#hf-table tbody tr:hover {
  background: #f5f5f0;
}

.sparkline-cell {
  width: 100px;
  position: relative;
}

.sparkline-cell svg {
  display: block;
}

.sparkline-hover {
  stroke: #c44;
  stroke-width: 0.75;
}

.sparkline-tip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  font-size: 0.7rem;
  line-height: 1.4;
  padding: 0.3rem 0.5rem;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  text-align: center;
  z-index: 10;
  margin-bottom: 2px;
}

/* Time-series charts */
.chart-container {
  margin-top: 0.5rem;
  height: 200px;
}

.chart-container svg {
  width: 100%;
  height: 100%;
}

.time-chart .axis text {
  font-size: 10px;
  fill: #999;
}

.time-chart .axis path {
  display: none;
}

.time-chart .axis line {
  stroke: none;
}

.time-chart .time-line {
  fill: none;
  stroke: #555;
  stroke-width: 1.5;
}

.time-chart .time-dot {
  fill: #555;
}

/* Project tags */
.tag {
  display: inline-block;
  font-size: 0.7rem;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem;
  border-radius: 2px;
}

.metric-card > .tag {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
}

#hf-table .tag {
  margin-right: 0.4rem;
  vertical-align: middle;
}

.tag-marin     { background: #e4eaf0; color: #4a5568; }
.tag-boltzgen  { background: #e5ede5; color: #4a6a4a; }
.tag-plantcad  { background: #eeebe4; color: #7a6a55; }

.hf-footer {
  font-size: 0.85rem;
  color: #999;
  margin-top: 0.25rem;
}

.hf-footer .show-more {
  color: #555;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  text-shadow: none;
}

.delta-positive { color: #2a7; }
.delta-negative { color: #c44; }
.delta-zero { color: #999; }
