/* Cyber watch page. Builds on main.css variables. */
:root {
  --sev-severe: #b3261e;
  --sev-high: #c76a00;
  --sev-moderate: #4d6a8a;
  --cw-sea: #dfe6ee;
  --cw-land: #f6f8fa;
  --cw-border: #b9c3cf;
}
[data-theme="dark"] {
  --sev-severe: #ff6b5e;
  --sev-high: #f0a03c;
  --sev-moderate: #8fb0d4;
  --cw-sea: #0f1318;
  --cw-land: #222a35;
  --cw-border: #3a4554;
}

.cw-intro { padding-bottom: var(--space-5); }
.cw-intro .section-head { max-width: 760px; margin-bottom: var(--space-5); }
.cw-h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 0 0 var(--space-3);
}
.cw-lead { font-size: 18px !important; }
.cw-meta { margin-top: var(--space-3) !important; font-size: 14px !important; }
.cw-meta time { color: var(--ink); font-weight: 600; }

.cw-stats {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.cw-stats li { padding: var(--space-4) var(--space-3) var(--space-4) 0; }
.cw-stats li + li { padding-left: var(--space-3); border-left: 1px solid var(--line); }
.cw-stat-num {
  display: block; font-family: var(--font-display); font-weight: 700;
  font-size: clamp(26px, 3vw, 38px); letter-spacing: -0.03em; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.cw-stat-label { display: block; color: var(--muted); font-size: 14px; line-height: 1.35; }

.cw-tool { padding-bottom: var(--space-6); }
.cw-controls {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3); padding: var(--space-4);
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
}
.cw-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cw-field-search { grid-column: span 2; }
.cw-field label {
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.cw-field input, .cw-field select {
  font: inherit; font-size: 15px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  height: 42px; padding: 0 10px; width: 100%; min-width: 0;
}
.cw-field input:focus-visible, .cw-field select:focus-visible,
.cw-check input:focus-visible, .cw-reset:focus-visible, .cw-card button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.cw-toggles {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4);
}
.cw-check { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; }
.cw-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.cw-reset { height: 38px; margin-left: auto; cursor: pointer; font-size: 13px; }
.cw-count { margin: var(--space-3) 0; color: var(--muted); font-size: 15px; }
.cw-count strong { color: var(--ink); }

.cw-map-wrap { margin-bottom: var(--space-4); }
.cw-map {
  height: clamp(320px, 52vh, 520px); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--cw-sea); z-index: 0;
}
.cw-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-2); font-size: 13px; color: var(--muted); }
.cw-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.dot.sev-Severe { background: var(--sev-severe); }
.dot.sev-High { background: var(--sev-high); }
.dot.sev-Moderate { background: var(--sev-moderate); }
.dot.fin { background: transparent; border: 2px solid var(--ink); }
.cw-map-note { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.cw-caution {
  margin: 0 0 var(--space-5); padding: var(--space-3) var(--space-4);
  border-left: 2px solid var(--accent); background: var(--accent-soft);
  font-size: 15px; color: var(--ink); max-width: 80ch;
}
.cw-h2, .cw-takeaway h3 {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em;
}
.cw-h2 { font-size: clamp(24px, 2.6vw, 32px); margin: 0 0 var(--space-3); }

.leaflet-container { font-family: var(--font-body); background: var(--cw-sea); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; line-height: 1.4; }
.leaflet-popup-content strong { font-family: var(--font-display); }
.cw-pop-btn {
  margin-top: 6px; background: none; border: 0; padding: 0; color: #0f6b5c;
  text-decoration: underline; cursor: pointer; font: inherit; font-size: 13px;
}
[data-theme="dark"] .leaflet-popup-content-wrapper, [data-theme="dark"] .leaflet-popup-tip { background: #1a2029; color: #e8ecf1; }
[data-theme="dark"] .cw-pop-btn { color: #3dbaa0; }
[data-theme="dark"] .leaflet-control-attribution { background: rgba(26, 32, 41, 0.85); color: #9aa5b5; }
[data-theme="dark"] .leaflet-control-attribution a { color: #3dbaa0; }

.cw-timeline { list-style: none; margin: 0; padding: 0; }
.cw-month {
  font-family: var(--font-display); font-size: 13px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent);
  padding: var(--space-4) 0 var(--space-2); border-bottom: 1px solid var(--line);
}
.cw-card {
  display: grid; grid-template-columns: 110px 1fr; gap: var(--space-4);
  padding: var(--space-4) 0; border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.cw-card.is-flash { animation: cwflash 1.6s var(--ease); }
@keyframes cwflash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
.cw-date { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cw-date small { display: block; font-size: 12px; margin-top: 2px; }
.cw-card h3 {
  font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 4px; line-height: 1.25;
}
.cw-place { font-size: 14px; color: var(--muted); margin: 0 0 var(--space-2); }
.cw-summary { margin: 0 0 var(--space-2); max-width: 72ch; }
.cw-tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 var(--space-2); padding: 0; }
.cw-tag {
  font-size: 12px; line-height: 1; padding: 6px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: var(--bg-elev);
}
.cw-tag.sev { color: #fff; border-color: transparent; font-weight: 600; }
.cw-tag.sev-Severe { background: var(--sev-severe); }
.cw-tag.sev-High { background: var(--sev-high); }
.cw-tag.sev-Moderate { background: var(--sev-moderate); }
[data-theme="dark"] .cw-tag.sev { color: #12161c; }
.cw-tag.ai { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.cw-tag.fin { color: var(--ink); }
.cw-facts { display: flex; flex-wrap: wrap; gap: 4px var(--space-4); margin: 0 0 var(--space-2); font-size: 14px; }
.cw-facts div { display: flex; gap: 6px; }
.cw-facts dt { color: var(--muted); }
.cw-facts dd { margin: 0; }
.cw-sources { font-size: 14px; margin: 0; }
.cw-sources a { color: var(--accent); }
.cw-actions button {
  background: none; border: 0; padding: 0; margin-top: 6px; color: var(--muted);
  font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer;
}
.cw-actions button:hover { color: var(--accent); }
.cw-empty { padding: var(--space-5) 0; color: var(--muted); }

.cw-ai { border-top: 1px solid var(--line); }
.cw-ai .section-head { max-width: 760px; }
.cw-ai-list .focus-item { grid-template-columns: minmax(150px, 220px) 1fr; }
.cw-ai-list .focus-item p { max-width: 70ch; }
.cw-ref {
  display: inline-block; font-size: 12px; line-height: 1.2; padding: 2px 6px; margin: 0 2px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--accent); text-decoration: none;
  white-space: nowrap; vertical-align: 1px;
}
.cw-ref:hover, .cw-ref:focus-visible { border-color: var(--accent); }
.cw-takeaway {
  margin-top: var(--space-5); padding: var(--space-4); background: var(--bg-elev);
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius);
}
.cw-takeaway h3 { font-size: 20px; margin: 0 0 var(--space-3); }
.cw-takeaway ul, .cw-method-list { margin: 0; padding-left: 1.1em; }
.cw-takeaway li, .cw-method-list li { margin-bottom: var(--space-2); max-width: 80ch; }
.cw-method { border-top: 1px solid var(--line); }
.cw-method-list { color: var(--muted); }
.cw-method-list strong { color: var(--ink); }

@media (max-width: 960px) {
  .cw-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cw-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cw-stats li:nth-child(3) { border-left: 0; padding-left: 0; }
  .cw-stats li:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .cw-controls { grid-template-columns: 1fr; padding: var(--space-3); }
  .cw-field-search { grid-column: auto; }
  .cw-reset { margin-left: 0; }
  .cw-card { grid-template-columns: 1fr; gap: 4px; }
  .cw-ai-list .focus-item { grid-template-columns: 1fr; gap: var(--space-2); }
  .cw-map { height: 340px; }
}
@media (prefers-reduced-motion: reduce) {
  .cw-card.is-flash { animation: none; outline: 2px solid var(--accent); }
}
.cw-month h3 { font: inherit; letter-spacing: inherit; margin: 0; }
/* How they got in */
.cw-entry {
  margin: 0 0 var(--space-2); padding: 8px 12px; max-width: 72ch; font-size: 15px;
  background: var(--bg-elev); border-left: 2px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0;
}
.cw-entry-label { font-weight: 700; color: var(--ink); }
.cw-cve { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.cw-tag.vec { border-style: dashed; color: var(--ink); }
.cw-tag.vec-nd { color: var(--muted); }
.cw-src-note { font-size: 12px; color: var(--muted); }
.cw-pop-entry { display: inline-block; margin-top: 6px; }
