/* Everything else that shows data: stat tiles, key and value lists,
   timelines, the category tree, photo galleries. */

/* ---------- Stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.stat {
  padding: var(--s4);
  border-right: 1px solid var(--border);
  display: grid;
  gap: var(--s1);
}

.stat:last-child {
  border-right: 0;
}

.stat-label {
  font-size: var(--fs-meta);
  color: var(--text-muted);
}

.stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-stat);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-foot {
  font-size: var(--fs-meta);
}

.stat-bar {
  display: flex;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--surface-3);
}

.stat-bar span {
  display: block;
  height: 100%;
}

/* ---------- Key and value list ---------- */

.kv {
  display: grid;
  gap: 0;
}

.kv div {
  display: flex;
  gap: var(--s4);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-cell);
}

.kv div:last-child {
  border-bottom: 0;
}

.kv dt {
  color: var(--text-muted);
  min-width: 132px;
  flex-shrink: 0;
}

.kv dd {
  margin: 0;
  text-align: right;
  margin-left: auto;
}

/* ---------- Timeline ---------- */

.timeline {
  display: grid;
  gap: 0;
  position: relative;
}

.tl-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: var(--s3);
  padding-bottom: var(--s5);
  position: relative;
}

.tl-item:last-child {
  padding-bottom: 0;
}

.tl-item::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 26px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.tl-item:last-child::before {
  display: none;
}

.tl-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  background: var(--surface-3);
  color: var(--text-muted);
  border: 1px solid var(--border);
  z-index: 1;
}

.tl-dot.ok {
  background: var(--ok-bg);
  color: var(--ok-fg);
  border-color: transparent;
}

.tl-dot.info {
  background: var(--info-bg);
  color: var(--info-fg);
  border-color: transparent;
}

.tl-dot.warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
  border-color: transparent;
}

.tl-dot.danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
  border-color: transparent;
}

.tl-body {
  padding-top: 2px;
}

.tl-title {
  font-size: var(--fs-cell);
  font-weight: 500;
}

.tl-meta {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  margin-top: 2px;
}

.tl-note {
  margin-top: var(--s2);
  padding: var(--s2) var(--s3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-meta);
  color: var(--text-muted);
}

/* ---------- Category tree ---------- */

.tree {
  font-size: var(--fs-cell);
}

.tree-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  height: var(--row-h);
  padding: 0 var(--s4);
  border-bottom: 1px solid var(--border);
}

.tree-row:last-child {
  border-bottom: 0;
}

.tree-row:hover {
  background: var(--surface-2);
}

.tree-row .name {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-weight: 500;
}

.tree-row .name i {
  color: var(--text-faint);
  font-size: 16px;
}

.tree-row[data-depth="1"] .name {
  padding-left: var(--s6);
  font-weight: 400;
}

.tree-row[data-depth="2"] .name {
  padding-left: var(--s9);
  font-weight: 400;
}

.tree-row .tools {
  margin-left: auto;
  display: flex;
  gap: var(--s1);
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease-out);
}

.tree-row:hover .tools,
.tree-row:focus-within .tools {
  opacity: 1;
}

/* ---------- Images ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: var(--s2);
}

.gallery img,
.gallery .add-photo {
  aspect-ratio: 4 / 3;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: cover;
  background: var(--surface-3);
}

.gallery .add-photo {
  display: grid;
  place-items: center;
  color: var(--text-faint);
  border-style: dashed;
  cursor: pointer;
  font-size: 20px;
}

.hero-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-3);
}

.file-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-cell);
}

.file-row:last-child {
  border-bottom: 0;
}

.file-row i {
  font-size: 18px;
  color: var(--text-faint);
}

.file-row .size {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  color: var(--text-muted);
}

/* ---------- Skeleton ---------- */

.skeleton {
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  height: 12px;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.5;
  }
}

/* A date shown as a stat keeps the sans face. */

.stat-value .date {
  font-family: var(--font-sans);
  font-weight: 500;
}

/* Photos taken at the moment of a handover. */

.tl-photos {
  display: flex;
  gap: var(--s2);
  margin-top: var(--s2);
  flex-wrap: wrap;
}

.tl-photos img {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-3);
  cursor: zoom-in;
}
