/* Apocalypse Today - 2026 corporate intranet edition. Synergy-forward. */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f2f8;
  --ink: #14151f;
  --muted: #5d6175;
  --line: #e4e6ef;
  --accent: #6d4aff;
  --accent-soft: #efeaff;
  --ok: #18b26b;
  --shadow: 0 1px 2px rgba(20, 21, 31, .04), 0 8px 24px rgba(20, 21, 31, .06);
  --shadow-hi: 0 2px 4px rgba(20, 21, 31, .06), 0 16px 40px rgba(109, 74, 255, .16);
  --glow: linear-gradient(120deg, #6d4aff, #c04aff 45%, #00b3c7);
  --radius: 18px;
  --sans: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e14;
    --surface: #161722;
    --surface-2: #1d1f2c;
    --ink: #eceef6;
    --muted: #9a9eb4;
    --line: #2a2c3c;
    --accent: #9b85ff;
    --accent-soft: #241f45;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-hi: 0 2px 4px rgba(0, 0, 0, .3), 0 16px 40px rgba(155, 133, 255, .18);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(109, 74, 255, .12), transparent 70%),
    radial-gradient(700px 360px at -5% 10%, rgba(0, 179, 199, .10), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

/* ===== App bar ===== */
.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; text-decoration: none; letter-spacing: -.01em; }
.brand b { font-weight: 800; }
/* Corporate "A" monogram: heavy, tight, slightly italic, with a glossy edge. */
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 19px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -.06em;
  line-height: 1;
  color: #fff;
  background: var(--glow);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 4px 12px rgba(109, 74, 255, .35);
}
.brand-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
}
.copilot {
  flex: 1;
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: not-allowed;
}
.copilot kbd {
  margin-left: auto;
  font: 500 11px var(--sans);
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.appbar-right { display: flex; align-items: center; gap: 12px; }
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent);
}
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--glow);
}

/* ===== Page ===== */
.page { max-width: 1240px; margin: 0 auto; padding: 32px 24px 16px; }

.hero { margin-bottom: 24px; }
.eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 999px;
}
.hero .greeting { margin: 0; font-size: clamp(30px, 5vw, 46px); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.hero .greeting .grad {
  background: var(--glow);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede { margin: 10px 0 0; max-width: 640px; font-size: 17px; color: var(--muted); }

/* KPI tiles */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 24px;
}
.kpi {
  display: block;
  padding: 14px 16px;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-hi); }
.kpi[aria-current="page"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), var(--shadow-hi); }
.kpi-sev:empty { display: none; }
.kpi-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.kpi-value { display: block; margin-top: 2px; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.kpi-sev { display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.sev-high { color: #c4213a; background: #ffe6ea; }
.sev-elevated { color: #a65d00; background: #fff1dc; }
.sev-monitor { color: #11795a; background: #ddf6ec; }
@media (prefers-color-scheme: dark) {
  .sev-high { color: #ff8a9b; background: #3a1820; }
  .sev-elevated { color: #ffc070; background: #3a2a14; }
  .sev-monitor { color: #6be0b4; background: #12302a; }
}

/* Topic chips */
.topics {
  position: sticky;
  top: 59px;
  z-index: 5;
  margin: 0 -24px 20px;
  padding: 10px 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topics ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.topics ul::-webkit-scrollbar { display: none; }
.topic-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background .15s, border-color .15s;
}
.topic-btn:hover { border-color: var(--accent); }
.topic-btn[aria-current="page"] {
  color: #fff;
  background: var(--glow);
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(109, 74, 255, .3);
}
.topic-count { font-size: 12px; font-weight: 600; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.topic-btn[aria-current="page"] .topic-count { background: rgba(255, 255, 255, .22); color: #fff; }

.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.section-head h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.pill-soft { font-size: 13px; color: var(--muted); }

.status { margin: 0 0 16px; color: var(--muted); }
.status:empty { display: none; }

/* ===== Story cards ===== */
.stories { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.story {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.story:hover { transform: translateY(-3px); box-shadow: var(--shadow-hi); }

.story-pic { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--glow); }
.story-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Fallback art: a topic-colored gradient with a soft grid, a big icon, the
   topic name and the outlet, so imageless stories still look deliberate. */
.story-pic { --art: var(--glow); }
.story-pic[data-topic="war"] { --art: linear-gradient(135deg, #3a0d12, #a3202f 55%, #ff7a45); }
.story-pic[data-topic="epidemic"] { --art: linear-gradient(135deg, #053b2e, #0f8a5f 55%, #9be15d); }
.story-pic[data-topic="ai-threats"] { --art: linear-gradient(135deg, #1a1446, #5b3bff 55%, #00c2ff); }
.story-pic[data-topic="climate"] { --art: linear-gradient(135deg, #062b4a, #0077b6 50%, #f4a261); }
.story-pic[data-topic="economy"] { --art: linear-gradient(135deg, #2b2100, #b8860b 55%, #ffd166); }
.story-pic[data-topic="corruption"] { --art: linear-gradient(135deg, #14141c, #4a4e69 55%, #c9ada7); }
.story-pic[data-topic="microsoft"] { --art: linear-gradient(135deg, #00305e, #0078d4 55%, #50e6ff); }
.nopic {
  position: absolute;
  inset: 0;
  display: none;
  grid-template-rows: 1fr auto;
  justify-items: start;
  padding: 16px 18px;
  color: #fff;
  background:
    radial-gradient(circle at 75% 35%, rgba(255, 255, 255, .28), transparent 45%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .06) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .06) 0 1px, transparent 1px 24px),
    var(--art);
}
.story-pic.no-image img { display: none; }
.story-pic.no-image .nopic { display: grid; }
.story-pic.no-image .nopic::before {
  content: attr(data-icon);
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%) rotate(-8deg);
  font-size: 72px;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .35));
}
.nopic-topic {
  align-self: end;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  backdrop-filter: blur(4px);
}
.nopic-pub {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.02em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.nopic-pub:empty { display: none; }

.story-body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 16px 18px 18px; }

.story-tags { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.story-tags:empty { display: none; }
.tag {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--accent);
  background: var(--accent-soft);
}
.tag:hover { filter: brightness(.95); }

.story-title { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
.story-title a { text-decoration: none; }
.story-title a:hover { color: var(--accent); }
.new {
  margin-left: 8px;
  vertical-align: 2px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--glow);
  padding: 1px 8px;
  border-radius: 999px;
}

.story-summary { margin: 0; flex: 1; color: var(--muted); font-size: 14px; }
.story-summary:not(:empty)::before { content: "✨ Key insight · "; font-weight: 600; color: var(--accent); }

.story-meta { margin: 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.story-pub { font-weight: 600; color: var(--ink); }
.story-outlets { color: var(--accent); font-weight: 600; }

.more-wrap { padding: 28px 0 12px; text-align: center; }
.btn {
  font: 600 15px var(--sans);
  padding: 12px 26px;
  color: #fff;
  background: var(--glow);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(109, 74, 255, .3);
  transition: transform .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn[disabled] { opacity: .6; cursor: wait; }

/* ===== Footer ===== */
.footer {
  max-width: 1240px;
  margin: 24px auto 0;
  padding: 20px 24px 96px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.footer a { text-decoration: none; }
.footer a:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .story:hover, .kpi:hover, .btn:hover { transform: none; }
}

/* Social placeholders (top right) */
.social { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.social a:not(.social-cta) {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: color .15s, border-color .15s;
}
.social a:not(.social-cta):hover { color: var(--accent); border-color: var(--accent); }
.social svg { width: 16px; height: 16px; fill: currentColor; }
.social-cta {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 999px;
  color: #fff;
  background: var(--glow);
}

/* Help button (bottom left; the support chat sits bottom right) */
.help-fab {
  font-family: inherit;
  cursor: pointer;
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 110px);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-hi);
  transition: transform .15s, border-color .15s;
}
.help-fab:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }

/* ===== Wallet dialog ("My cortisol is maxxed out") ===== */
.donate-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 10, 20, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.donate-backdrop[hidden] { display: none; }
.donate-panel {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 24px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-hi);
}
.donate-panel h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: -.02em; }
.donate-panel p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.donate-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.donate-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.donate-coin {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: var(--glow);
}
.donate-info { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 14px; }
.donate-addr {
  font: 12px ui-monospace, "Cascadia Code", Consolas, monospace;
  color: var(--muted);
  overflow-wrap: anywhere;
  user-select: all;
}
.donate-copy {
  flex: none;
  font: 600 13px var(--sans);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}
.donate-copy:hover { border-color: var(--accent); color: var(--accent); }
.donate-panel .donate-note { font-size: 12px; }
.donate-actions { display: flex; justify-content: flex-end; }

@media (max-width: 1000px) {
  .social-cta { display: none; }
}

@media (max-width: 720px) {
  .help-fab { left: 12px; bottom: 16px; padding: 10px 14px; font-size: 13px; }
  .copilot { display: none; }
  .brand-tag { display: none; }
  .appbar { gap: 8px; }
  .appbar { justify-content: space-between; padding: 10px 16px; }
  .page { padding: 20px 16px 12px; }
  .topics { margin: 0 -16px 16px; padding: 8px 16px; top: 55px; }
  .stories { grid-template-columns: 1fr; gap: 14px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .footer { padding: 16px; }
}
