/* AIS Lookout build 2: Periscope panel and card tokens below the header;
   header is option 5 (Michroma title, amber robot arm photo). */
@font-face {
  font-family: "Michroma";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/michroma.woff2") format("woff2");
}

:root {
  --bg: #0e1116;
  --panel: #161b22;
  --tile: #1f262e;
  --text: #e6edf3;
  --muted: #8b949e;
  --soft: #aab4be;
  --up: #3fb950;
  --down: #f85149;
  --border: #30363d;
  --accent: #58a6ff;
  --heart: #f85149;
  --amber: #d29922;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* hidden on html (passed to the viewport) and clip on body: no sideways scroll, and the sticky header still sticks */
html { overflow-x: hidden; }
body { overflow-x: clip; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Header: title left, controls right, photo with left-to-right vignette ---- */
.hdr {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 118px;
  padding: 0 32px;
  border-bottom: 1px solid #1a3a52;
  background:
    linear-gradient(90deg, rgba(6,10,16,.92) 0%, rgba(6,10,16,.55) 38%, rgba(6,10,16,.35) 62%, rgba(6,10,16,.85) 100%),
    url("header-bg.jpg") center 30% / cover no-repeat,
    var(--panel);
  box-shadow: inset 0 -28px 36px -24px rgba(0, 0, 0, 0.7);
}
.brand { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.brand h1 {
  margin: 0;
  font-family: "Michroma", "Eurostile", "Arial Black", system-ui, sans-serif;
  font-weight: 400;
  font-size: 28px;
  letter-spacing: .2em;
  line-height: 1;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .55);
}
.brand .sub { color: #b9c6d2; font-size: 12.5px; letter-spacing: .04em; text-shadow: 0 1px 8px rgba(0,0,0,.6); white-space: nowrap; }
.hctl {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #d8e1ea;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
  min-width: 0;
}
.updated { white-space: nowrap; font-variant-numeric: tabular-nums; }
.hdr button, .hdr .btn {
  background: rgba(22, 27, 34, .75);
  border-color: #4a5563;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  text-shadow: none;
}
.hdr button:hover, .hdr .btn:hover { border-color: var(--accent); }

button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--tile);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.2;
}
button:hover, .btn:hover { border-color: var(--accent); text-decoration: none; }
button:disabled { opacity: .35; cursor: not-allowed; }
button:disabled:hover { border-color: var(--border); }
button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: rgba(88, 166, 255, 0.10); }
#f-favs[aria-pressed="true"] { border-color: var(--heart); color: var(--heart); background: rgba(248, 81, 73, 0.10); }
button.small, .btn.small { font-size: 11px; padding: 4px 10px; }

.ico { width: 14px; height: 14px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#f-favs[aria-pressed="true"] .ico { fill: currentColor; }

/* ---- Live indicator: a state is a plain word with a dot ---- */
.conn-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.conn-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.conn-status.ok { color: var(--up); }
.conn-status.ok .dot { background: var(--up); box-shadow: 0 0 8px var(--up); animation: pulse 2s infinite; }
.conn-status.warn { color: var(--accent); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(63,185,80,0.55); } 70% { box-shadow: 0 0 0 7px rgba(63,185,80,0); } 100% { box-shadow: 0 0 0 0 rgba(63,185,80,0); } }
.new-count { white-space: nowrap; color: #c3ced8; }
.new-count.has { color: var(--accent); font-weight: 600; }

/* ---- Filter bar: one row, scrolls inside itself on narrow screens ---- */
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filters button { font-size: 12px; padding: 5px 11px; }
.seg, .chips { display: flex; gap: 4px; flex: 0 0 auto; }
.seg button { padding: 5px 9px; }
.search {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto;
  flex: 0 1 220px; min-width: 150px;
  background: var(--tile); border: 1px solid var(--border); border-radius: 6px;
  padding: 0 10px; color: var(--muted);
}
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--text); font-size: 12px; padding: 6px 0; font-family: inherit; }

/* ---- Stacked full-width panels (Periscope) ---- */
.stack { display: flex; flex-direction: column; gap: 16px; padding: 14px 24px 32px; min-width: 0; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px 18px;
  min-width: 0;
}
.panel-head { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; margin-bottom: 12px; min-width: 0; }
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.panel-head .tools { display: flex; align-items: center; justify-content: center; gap: 8px; }
.panel-head .win { font-size: 11px; color: var(--muted); min-width: 92px; text-align: center; white-space: nowrap; }
.panel-meta { font-size: 11px; color: var(--muted); white-space: nowrap; text-align: right; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ---- Video grid (Periscope's Trusted Voices card) ---- */
.vgrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; align-items: start; font-size: 12px; color: var(--muted); }
.vcard {
  background: var(--tile); border-radius: 8px; overflow: hidden; min-width: 0;
  display: flex; flex-direction: column;
  border-left: 3px solid var(--border); cursor: pointer; transition: border-left-color 120ms ease;
}
.vcard:hover, .vcard.open { border-left-color: var(--accent); }
.vcard.new { border-left-color: var(--accent); }
.vthumb { position: relative; display: block; background: #000; aspect-ratio: 16 / 9; overflow: hidden; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 200ms ease; }
.vthumb:hover img { transform: scale(1.04); }
.vplay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: .9; }
.vplay svg { width: 22px; height: 22px; fill: #fff; margin-left: 3px; }
.vbody { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }

/* ---- Article cards ---- */
.cgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; font-size: 12px; color: var(--muted); }
.card {
  background: var(--tile); border-radius: 8px; overflow: hidden; min-width: 0;
  display: flex; flex-direction: column;
  border-left: 3px solid transparent; cursor: pointer; transition: border-left-color 120ms ease;
}
.card:hover { border-left-color: var(--border); }
.card.new { border-left-color: var(--accent); }
.card.open { border-left-color: var(--accent); }
.pic { aspect-ratio: 16 / 9; background: #0b0f14; overflow: hidden; display: block; }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic.ph { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a2a3d, #0f1a26); }
.pic.ph span { font-size: 42px; font-weight: 700; color: #2d4a66; text-transform: uppercase; }
.cbody { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); min-width: 0; }
.vcard .top { font-size: 11px; gap: 6px; }
.top .who { font-weight: 600; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.top .t { margin-left: auto; white-space: nowrap; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.top .plus { flex: 0 0 auto; font-size: 11px; color: var(--soft); white-space: nowrap; }
.hearticon { background: transparent; border: none; padding: 0 2px; color: var(--muted); flex: 0 0 auto; display: inline-flex; }
.hearticon:hover { color: var(--heart); border: none; }
.hearticon.on { color: var(--heart); }
.hearticon .ico { width: 16px; height: 16px; }
.hearticon.on .ico { fill: currentColor; }

.ttl {
  margin: 2px 0 0; font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.vcard .ttl { font-size: 12.5px; }
.card:hover .ttl, .vcard:hover .ttl { color: var(--accent); }
.card.raw .ttl { font-weight: 500; }
.sum {
  margin: 0; color: var(--soft); font-style: italic; font-size: 12.5px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.vcard .sum { font-size: 11.5px; }
.stop { align-self: flex-start; margin-top: 4px; font-size: 11px; color: var(--amber); border: 1px solid rgba(210, 153, 34, .5); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

/* Unfold in place: the card grows in its own cell, never a side panel */
.detail { display: none; min-width: 0; }
.open .detail { display: block; }
.open .ttl, .open .sum { -webkit-line-clamp: unset; overflow: visible; }
.detail ul { margin: 8px 0 0; padding-left: 18px; font-size: 12px; color: var(--text); line-height: 1.45; }
.detail li { margin-bottom: 3px; overflow-wrap: anywhere; }
.detail .alsoby { margin-top: 8px; font-size: 12px; color: var(--soft); line-height: 1.45; overflow-wrap: anywhere; }
.detail .states { margin-top: 8px; font-size: 11px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; overflow-wrap: anywhere; }
.detail .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.detail .actions .btn, .detail .actions button { font-size: 12px; padding: 4px 11px; }

.more { grid-column: 1 / -1; justify-self: center; font-size: 12px; padding: 5px 14px; }
.empty { grid-column: 1 / -1; padding: 14px 4px; font-size: 12px; color: var(--muted); }

/* ---- Tabs (groups 3 to 8) ---- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.tabs button { font-size: 12.5px; padding: 5px 11px; flex: 0 0 auto; background: var(--bg); }
.tabs .count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }
.tabs button[aria-selected="true"] { border-color: var(--accent); color: var(--accent); background: rgba(88, 166, 255, 0.10); }
.tabs button[aria-selected="true"] .count { color: var(--accent); }

/* ---- Importance badge (as Periscope) ---- */
.imp { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 700; color: #0e1116; }
.imp-hot { background: var(--down); color: #fff; }
.imp-mid { background: var(--accent); color: #0e1116; }
.imp-low { background: var(--muted); color: #0e1116; }
.imp-none { background: transparent; border: 1px dashed var(--border); color: var(--muted); }

/* ---- People page ---- */
.people-wrap { max-width: 1180px; margin: 0 auto; padding: 14px 24px 40px; }
.people-bar { display: flex; align-items: center; gap: 10px; padding: 0 0 12px; overflow-x: auto; scrollbar-width: none; }
.people-bar::-webkit-scrollbar { display: none; }
.people-bar button { font-size: 12px; padding: 5px 11px; }
.people-bar .tally { font-size: 12px; color: var(--muted); white-space: nowrap; display: flex; gap: 12px; }
.jump { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 12px; }
.jump::-webkit-scrollbar { display: none; }
.jump a { font-size: 12px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); white-space: nowrap; background: var(--tile); }
.jump a:hover { border-color: var(--accent); text-decoration: none; }
.group { margin-bottom: 16px; scroll-margin-top: 134px; }
.group .panel-head { display: flex; justify-content: space-between; align-items: baseline; }
.group .panel-head h2 { white-space: normal; }
.people-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 6px; }
.person { background: var(--tile); border-radius: 6px; padding: 9px 11px; border-left: 3px solid transparent; scroll-margin-top: 140px; min-width: 0; }
.person.target { border-left-color: var(--accent); background: #1d2a3a; }
.person-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.person-top .name { font-weight: 600; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.person-top .kind { font-size: 11px; color: var(--muted); white-space: nowrap; }
.person-top .home { margin-left: auto; font-size: 11px; padding: 3px 9px; flex: 0 0 auto; }
.person .who { font-size: 12px; color: var(--muted); line-height: 1.4; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.person .stopline { font-size: 11px; color: var(--amber); line-height: 1.4; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.person .feeds { font-size: 11px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.state { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; white-space: nowrap; color: var(--muted); }
.state .dot { width: 8px; height: 8px; border-radius: 50%; }
.state.live .dot { background: var(--up); } .state.live { color: var(--up); }
.state.quiet .dot { background: var(--amber); } .state.quiet { color: var(--amber); }
.state.stale .dot { background: var(--down); } .state.stale { color: var(--down); }
.state.empty .dot { background: var(--muted); }
.state.nofeed .dot { background: transparent; border: 1px solid var(--muted); }

/* ---- Widths ---- */
@media (max-width: 1100px) {
  .vgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hctl { gap: 8px; }
  .hctl .updated { display: none; }
}
@media (max-width: 760px) {
  .hdr { position: static; height: auto; flex-direction: column; align-items: flex-start; padding: 18px 16px 14px; gap: 12px; }
  .brand h1 { font-size: 20px; letter-spacing: .16em; }
  .hctl { flex-wrap: wrap; gap: 8px; font-size: 12px; }
  .hctl .updated { display: inline; }
  .hdr button, .hdr .btn { padding: 4px 10px; font-size: 12px; }
  .filters { padding: 12px 12px 0; }
  .search { margin-left: 0; flex: 0 0 170px; }
  .stack { padding: 12px 12px 28px; gap: 12px; }
  .panel { padding: 12px; }
  .panel-head { grid-template-columns: minmax(0, 1fr) auto; }
  .panel-head .tools { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .people-wrap { padding: 12px 12px 32px; }
  .people-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .cgrid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .vgrid { grid-template-columns: minmax(0, 1fr); }
}
