/*
 * Radar dashboard styles -- dark/cyber theme, radar-sweep motif (D-05).
 * No build step (D-02): plain CSS, custom properties, no preprocessor.
 * Token values, spacing scale, typography roles, color budget, layout, and
 * motion are all taken verbatim from 04-UI-SPEC.md -- do not improvise
 * colors/spacing/copy outside that contract.
 */

:root {
  --bg: #0e0f11;
  --surface: #16181c;
  --border: #2a2d33;
  --accent: #4f9cf9;
  --accent2: #a78bfa;
  --text: #e8eaed;
  --muted: #7a7f8a;
  --danger: #f87171;
  --radius: 10px;
  --mono: "DM Mono", monospace;
  --serif: "DM Serif Display", serif;
  --sans: "DM Sans", sans-serif;

  /* Spacing scale (4px multiples), per UI-SPEC */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
}

textarea,
input {
  font-family: inherit;
  color: var(--text);
}

/* Typography roles */
.label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.heading {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
}

.display {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  font-style: italic;
  line-height: 1.2;
}

/* ---------------------------------------------------------------------- */
/* Sticky header                                                          */
/* ---------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-md) var(--space-lg);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sweep-mark {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    var(--accent) 20deg,
    transparent 45deg
  );
  animation: sweep 3s linear infinite;
}

.brand-icon {
  position: relative;
  width: 20px;
  height: 20px;
  display: block;
}

.wordmark-text {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@keyframes sweep {
  to {
    transform: rotate(360deg);
  }
}

.search-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: var(--space-sm) var(--space-md);
  min-width: 260px;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---------------------------------------------------------------------- */
/* Source-health strip                                                    */
/* ---------------------------------------------------------------------- */

.source-health-strip {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  overflow-x: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.source-health-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  white-space: nowrap;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.status-dot.stale {
  background: var(--danger);
}

.source-health-pill.stale {
  color: var(--danger);
}

/* ---------------------------------------------------------------------- */
/* Feed grid + item cards                                                 */
/* ---------------------------------------------------------------------- */

.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-md);
  padding: var(--space-lg);
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

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

.item-row-1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.source-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.publish-date {
  color: var(--muted);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius);
}

.icon-btn:hover {
  color: var(--text);
}

.item-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.badge-trending {
  color: var(--accent);
  border-color: var(--accent);
  position: relative;
}

.blip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(1.3);
  }
}

.badge-kev,
.badge-known-issue {
  color: var(--accent2);
  border-color: var(--accent2);
}

.epss-label {
  color: var(--muted);
}

.triage-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--muted);
}

.triage-indicator.triaged {
  color: var(--accent);
}

.note-textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 60px;
  resize: vertical;
  padding: var(--space-sm);
}

.note-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.note-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.save-note-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: var(--accent);
  color: #0a0f1e;
  border: none;
  border-radius: 6px;
  padding: var(--space-sm) var(--space-md);
}

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

/* ---------------------------------------------------------------------- */
/* Empty / error states                                                   */
/* ---------------------------------------------------------------------- */

.state-panel {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--muted);
}

.state-panel[hidden] {
  display: none;
}

.state-panel .heading {
  color: var(--text);
  margin-bottom: var(--space-sm);
}

.state-panel.error .heading,
.state-panel.error {
  color: var(--danger);
}

/* ---------------------------------------------------------------------- */
/* Footer                                                                 */
/* ---------------------------------------------------------------------- */

.site-footer {
  display: flex;
  justify-content: center;
  padding: var(--space-lg);
}

.site-credit {
  display: flex;
  align-items: center;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.site-credit:hover,
.site-credit:focus-visible {
  opacity: 1;
}

.site-credit img {
  height: 34px;
  width: auto;
  display: block;
}

/* ---------------------------------------------------------------------- */
/* Reduced motion                                                         */
/* ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .sweep-mark {
    animation: none;
    transform: rotate(45deg);
  }

  .blip {
    animation: none;
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 8px var(--accent);
  }
}
