:root {
  --bg: hsl(0 0% 1%);
  --surface: hsl(0 0% 4%);
  --surface-hover: hsl(0 0% 9%);
  --border: hsl(0 0% 28%);
  --border-muted: hsl(0 0% 13%);
  --text: hsl(0 0% 95%);
  --text-muted: hsl(0 0% 69%);
  --text-dimmed: hsl(0 0% 95% / 0.35);
  --primary: hsl(311 78% 72%);
  --green: hsl(114 65% 42%);
  --red: hsl(0 65% 48%);
  --danger: hsl(9 26% 64%);
  --live: hsl(265 100% 75%);
  --live-hover: hsl(265 100% 84%);

  --normal-gap: 1rem;
  --content-width: 1250px;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: hsl(0 0% 96%);
  --surface: hsl(0 0% 100%);
  --surface-hover: hsl(0 0% 93%);
  --border: hsl(0 0% 72%);
  --border-muted: hsl(0 0% 87%);
  --text: hsl(0 0% 9%);
  --text-muted: hsl(0 0% 36%);
  --text-dimmed: hsl(0 0% 9% / 0.45);
  --primary: hsl(311 60% 45%);
  --green: hsl(122 60% 32%);
  --red: hsl(0 70% 45%);
  --danger: hsl(4 60% 42%);
  --live: hsl(265 75% 52%);
  --live-hover: hsl(265 80% 40%);

  color-scheme: light;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: "Outfit", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-size: 1.15rem;
}

.site-header,
#runs {
  width: min(100% - 2rem, var(--content-width));
  margin-inline: auto;
}

.icon {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  background-color: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
}

.icon-copy {
  mask-image: url("../img/copy.png");
  mask-size: 85%;
}

.icon-check {
  mask-image: url("../img/check.png");
  mask-size: 120%;
}

.icon-cross {
  mask-image: url("../img/cross.png");
  mask-size: 120%;
}

.icon-refresh {
  mask-image: url("../img/refresh.png");
  mask-size: 105%;
  transform-origin: 52% 55%;
}

.icon-mode {
  mask-image: url("../img/mode.png");
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}

.icon-button:hover {
  color: var(--text);
  background-color: var(--surface-hover);
}

.icon-button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.icon-button .icon {
  grid-area: 1 / 1;
  transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}

.copy .icon-copy {
  transition: transform 0.15s ease-out 0.1s, opacity 0.15s ease-out 0.1s;
}

.copy.copied .icon-copy,
.copy.failed .icon-copy {
  opacity: 0;
  transform: rotate(-180deg) scale(0.4);
  transition-delay: 0s;
}

.copy .icon-check {
  clip-path: inset(0 88% 0 0);
  transition: clip-path 0.1s ease-in;
}

.copy.copied .icon-check {
  clip-path: inset(0);
  transition: clip-path 0.2s ease-out 0.08s;
}

.copy .icon-cross {
  opacity: 0;
  transform: rotate(180deg) scale(0.4);
}

.copy.failed .icon-cross {
  opacity: 1;
  transform: none;
}

.copy.copied {
  border-color: var(--green);
  color: var(--green);
}

.copy.failed {
  border-color: var(--red);
  color: var(--red);
}

.theme-toggle .icon {
  transition: transform 0.3s ease-in-out;
}

:root[data-theme="light"] .theme-toggle .icon {
  transform: rotate(180deg);
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "theme title refresh";
  align-items: center;
  gap: var(--normal-gap);
  padding-block: 2rem;
}

.theme-toggle {
  grid-area: theme;
  justify-self: start;
}

.site-header h1 {
  grid-area: title;
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
}

.refresh-area {
  grid-area: refresh;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#status {
  font-size: 0.85rem;
  color: var(--text-dimmed);
  text-align: right;
}

#status.error {
  color: var(--danger);
}

/* Cards */
#runs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: var(--normal-gap);
  padding-bottom: 3rem;
}

.card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem;
  border: 1px solid var(--border-muted);
  border-radius: 10px;
  background-color: var(--surface);
  transition: border-color 0.15s;
}

.card:hover {
  border-color: var(--border);
}

.head {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background-color: var(--surface-hover);
  image-rendering: pixelated;
}

.info {
  flex: 1;
  min-width: 0;
  padding-right: 0.25rem;
}

.name {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.name a {
  color: var(--live);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
  transition: color 0.15s, text-decoration-color 0.15s;
}

.name a:hover {
  color: var(--live-hover);
  text-decoration-color: currentColor;
}

.stats {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.dot {
  color: var(--text-dimmed);
}

.label {
  margin-right: 0.3em;
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-dimmed);
}

.empty {
  grid-column: 1 / -1;
  padding: 4rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .site-header {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "title title"
      "theme refresh";
    padding-block: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
