/* Atlas Refresh — one-click refresh + freshness layer.
   Reuses the Atlas brand kit only: --ink / --paper / --phosphor / --copper
   plus the hsl() theme vars. No new palette, no layout rewrites. */

#ap-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: hsl(var(--primary));
  border: 1px solid hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 0.5rem 0.9rem;
  min-height: 44px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}
#ap-refresh:hover { filter: brightness(1.08); }
#ap-refresh:disabled { opacity: 0.65; cursor: wait; }
#ap-refresh:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}
#ap-refresh .ap-refresh-icon {
  display: inline-block;
  font-size: 0.9rem;
  line-height: 1;
}
#ap-refresh[aria-busy="true"] .ap-refresh-icon {
  animation: ap-spin 1s linear infinite;
}
@keyframes ap-spin { to { transform: rotate(360deg); } }

#ap-fresh {
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  padding: 0.6rem 1rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.5;
  color: hsl(var(--foreground) / 0.85);
}
.ap-fresh-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
}
.ap-fresh-snap[data-age="fresh"] { color: hsl(var(--foreground) / 0.85); }
.ap-fresh-snap[data-age="stale"] { color: var(--copper); }
.ap-fresh-snap[data-age="old"] {
  color: #e0655f;
  font-weight: 600;
}
.ap-fresh-live[data-live="on"] { color: hsl(var(--foreground) / 0.9); }
.ap-fresh-live[data-live="error"] { color: #e0655f; }
.ap-fresh-live[data-live="off"] { color: hsl(var(--muted-foreground)); }
.ap-fresh-reset {
  margin-top: 0.5rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  color: hsl(var(--foreground) / 0.9);
  padding: 0.5rem 0.9rem;
  min-height: 44px;
  font: inherit;
  cursor: pointer;
}
.ap-fresh-reset:hover { background: hsl(var(--muted)); }
.ap-fresh-reset:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}

#ap-newstrip {
  margin-top: 0.6rem;
  border: 1px dashed var(--copper);
  padding: 0.6rem 0.8rem;
}
#ap-newstrip summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--copper);
}
#ap-newstrip summary:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}
#ap-newstrip ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.3rem;
  max-height: 16rem;
  overflow: auto;
}
#ap-newstrip li { line-height: 1.5; }
.ap-newstrip-more {
  margin-top: 0.5rem;
  color: hsl(var(--muted-foreground));
}

.ap-live-badge {
  display: inline-block;
  border: 1px solid var(--copper);
  color: var(--copper);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  margin-bottom: 0.4rem;
  cursor: help;
}

#ap-empty {
  margin: 1rem;
  border: 1px dashed hsl(var(--border));
  padding: 1.2rem 1rem;
  text-align: center;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  color: hsl(var(--muted-foreground));
}
#ap-empty[hidden] { display: none; }
#ap-empty button {
  margin-top: 0.7rem;
  border: 1px solid hsl(var(--primary));
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 0.55rem 0.9rem;
  min-height: 44px;
  font: inherit;
  cursor: pointer;
}
#ap-empty button:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}

@media (max-width: 767px) {
  #ap-refresh { flex: 1 1 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  #ap-refresh[aria-busy="true"] .ap-refresh-icon { animation: none; }
}
