/* Demo-only styles. Everything here is built from the production tokens and
   components in jarvis.css (surfaces, borders, the blue/green/red glows, Sora
   and Inter). No new colours. */

/* ---------- Demo bar (same pattern as the Northbank demos) ---------- */
.demo-bar {
  background: #101018;
  border-bottom: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 12.5px;
  position: relative;
  z-index: 6;
}
.demo-bar-inner {
  padding: 8px 36px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 6px 18px;
}
.demo-bar-lead { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; }
/* Persistent link back to the portfolio, in the demo bar so it is on every view and never floats over content */
.back-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px;
  color: var(--text-secondary); font-weight: 500; text-decoration: none;
}
.back-link:hover { color: var(--text-primary); text-decoration: underline; text-underline-offset: 3px; }
.back-link:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.demo-bar-text { color: var(--text-secondary); }
.demo-bar-text strong {
  color: var(--text-primary); font-family: 'Sora', sans-serif; font-weight: 600;
  display: inline-block; padding: 1px 8px; margin-right: 2px;
  border: 1px solid rgba(76,139,255,0.5); border-radius: 999px; background: rgba(76,139,255,0.16);
}
.demo-bar-links { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.demo-bar-links a, .demo-bar-button {
  color: var(--text-primary); font: inherit; font-weight: 500;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255,255,255,0.35);
  background: none; border: 0; padding: 4px 0; cursor: pointer; min-height: 30px;
  display: inline-flex; align-items: center; line-height: 1.2;
}
.demo-bar-links a:hover, .demo-bar-button:hover { text-decoration-color: var(--blue); }
.demo-bar-links a:focus-visible, .demo-bar-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Things the production markup did with <div onclick> ---------- */
a.nav-item { text-decoration: none; }
.nav-item { cursor: pointer; }
.nav-count { color: var(--blue); font-weight: 600; }
.btn { cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn:disabled { opacity: 0.55; cursor: default; }
.icon-btn { cursor: pointer; }
.label-note { color: var(--text-muted); font-family: 'Inter', sans-serif; font-weight: 400; }
.insight-actions { flex-wrap: wrap; }
.insight-tag.tag-green { color: var(--green); background: rgba(46,212,163,0.14); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; color: var(--text-primary); }

/* ---------- Feed dots: two extra states for the loop and guard rails ---------- */
.feed-dot.blue { background: var(--blue); box-shadow: 0 0 3px var(--blue), 0 0 14px 2px var(--blue-glow); }
.feed-dot.muted { background: var(--text-muted); }
.feed-dot.pulse { animation: pulse-live 1.4s ease-in-out infinite; }
/* production leaves .feed-time unstyled; the new screens' rows get a quieter one */
.loop-feed .feed-time, .guard-row .feed-time, .mail-row .feed-time { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

/* ---------- Break a site + Jarvis loop ---------- */
.scenario-row { flex-wrap: wrap; }
.scenario-row .feed-dot { align-self: flex-start; margin-top: 6px; }
.scenario-row .desc { font-size: 12.5px; }
.scenario-action { margin-left: auto; }
.loop-feed { margin-bottom: 32px; }
.loop-row { align-items: flex-start; padding-top: 11px; padding-bottom: 11px; }
.loop-row .feed-dot { margin-top: 6px; }
.loop-row .feed-text { font-size: 12.5px; line-height: 1.55; overflow-wrap: anywhere; }
.loop-head { background: var(--surface-2); }
.loop-actions .insight-actions { width: 100%; }
#scenarioList { margin-bottom: 32px; }

/* "Break a site" was pressed: point at the choices until one is picked */
.pick-label { color: var(--blue); font-size: 13px; font-weight: 600; margin: -6px 0 10px; }
.pick-label[hidden] { display: none; }
#scenarioList.pick-pending {
  border-radius: 14px;
  box-shadow: 0 0 0 2px var(--blue), 0 0 18px 2px var(--blue-glow);
  animation: pick-glow 1.6s ease-in-out infinite;
}
@keyframes pick-glow {
  0%, 100% { box-shadow: 0 0 0 2px var(--blue), 0 0 8px 0 var(--blue-glow); }
  50% { box-shadow: 0 0 0 2px var(--blue), 0 0 30px 6px var(--blue-glow); }
}
/* Reduced motion: no pulse, just a static highlight */
@media (prefers-reduced-motion: reduce) {
  #scenarioList.pick-pending { animation: none; }
}

/* ---------- Site cards: uptime and response history ---------- */
.site-chart { margin-top: 12px; }
.spark { display: block; width: 100%; height: 34px; }
.spark.tall { height: 64px; }
.spark-line { fill: none; stroke: var(--blue); stroke-width: 1.6; filter: drop-shadow(0 0 4px var(--blue-glow)); }
.spark-area { fill: rgba(76,139,255,0.10); }
.spark-bad { fill: var(--red); filter: drop-shadow(0 0 3px var(--red-glow)); }
.chart-label { font-size: 10.5px; color: var(--text-muted); margin: 14px 0 6px; }
.uptime-bars { display: flex; gap: 2px; height: 22px; }
.uptime-bars span { flex: 1; border-radius: 2px; background: var(--green); opacity: 0.75; box-shadow: 0 0 6px var(--green-glow); }
.uptime-bars span.dip { background: var(--red); opacity: 1; box-shadow: 0 0 6px var(--red-glow); }
.check-list { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; }
.check-list > div { display: flex; align-items: center; gap: 9px; }
.check-list .feed-dot { width: 6px; height: 6px; }
.check-list .when { margin-left: auto; color: var(--text-muted); font-size: 11.5px; }

/* ---------- Inbox ---------- */
.mail-layout { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 14px; align-items: start; }
.mail-list { max-height: calc(100vh - 230px); overflow-y: auto; }
.mail-row { text-decoration: none; color: inherit; align-items: flex-start; }
.mail-row .feed-dot { margin-top: 6px; }
.mail-row .feed-text { min-width: 0; }
.mail-row .site { font-weight: 400; }
.mail-row .desc { font-size: 12px; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.mail-row.unread .site { font-weight: 600; }
.mail-row.unread { background: var(--surface-2); }
.mail-row.selected { background: rgba(76,139,255,0.12); }
.mail-back { display: none; margin-bottom: 12px; }
.mail-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.mail-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.mail-subject { font-family: 'Sora', sans-serif; font-size: 16px; font-weight: 500; margin-bottom: 8px; }
.mail-meta { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }
.mail-body { padding: 20px 24px 24px; font-size: 13.5px; line-height: 1.65; color: var(--text-secondary); overflow-wrap: anywhere; }
.mail-body p { margin-bottom: 12px; }
.mail-body strong { color: var(--text-primary); font-weight: 600; }
.mail-body hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.mail-body a:not(.btn), .prose a, .about a, .modal p a { color: #8a6bff; }
.mail-body .btn { margin-top: 2px; }

/* ---------- Fix PR view (Jarvis's own design) ---------- */
.pr-head .insight-title { font-size: 18px; }
.pr-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 18px; overflow-wrap: anywhere; }
.pr-meta .add, .diff-stat .add { color: var(--green); }
.pr-meta .del, .diff-stat .del { color: var(--red); }
.prose { text-align: left; line-height: 1.65; color: var(--text-secondary); margin-bottom: 32px; }
.prose p { margin-bottom: 10px; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--text-primary); }
.prose .muted { font-size: 12.5px; }
.prose h4 { font-family: 'Sora', sans-serif; font-size: 13.5px; font-weight: 600; color: var(--text-primary); margin: 16px 0 6px; }
.prose h4:first-child { margin-top: 0; }
.prose ul { margin: 0 0 10px 18px; }
.prose li { margin-bottom: 4px; }
.guard-row { align-items: flex-start; }
.guard-row .feed-dot { margin-top: 6px; }
.guard-row .desc { font-size: 12.5px; }
.guard-row .guard-pass { color: var(--green); }
.guard-row .guard-fail { color: var(--red); }
.guard-row .guard-held { color: var(--blue); }
#view-pr .feed { margin-bottom: 32px; }
.diff {
  background: #0d0d14; border: 1px solid var(--border); border-radius: 14px;
  overflow-x: auto; padding: 10px 0; margin-bottom: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.7;
}
.diff-line { display: flex; min-width: max-content; padding-right: 16px; }
.diff-line .ln { width: 34px; flex-shrink: 0; text-align: right; padding-right: 8px; color: var(--text-muted); user-select: none; }
.diff-line .sign { width: 18px; flex-shrink: 0; text-align: center; user-select: none; }
.diff-line .code { white-space: pre; color: var(--text-secondary); }
.diff-line.add { background: rgba(46,212,163,0.10); box-shadow: inset 3px 0 0 var(--green); }
.diff-line.add .sign, .diff-line.add .code { color: #6bf0c8; }
.diff-line.del { background: rgba(255,77,106,0.10); box-shadow: inset 3px 0 0 var(--red); }
.diff-line.del .sign, .diff-line.del .code { color: #ff8a9d; }
.pr-foot { font-size: 11.5px; color: var(--text-muted); overflow-wrap: anywhere; }

/* ---------- Weekly report ---------- */
.report-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.report-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.report-sub { font-size: 12.5px; color: var(--text-muted); margin-bottom: 18px; overflow-wrap: anywhere; }
.report-note { font-size: 12px; color: var(--text-secondary); margin-top: 8px; line-height: 1.5; overflow-wrap: anywhere; }
#view-reports .insight-body { max-width: 680px; margin-bottom: 0; }

/* ---------- Modal extras ---------- */
.modal-actions { margin-top: 6px; }
.modal-feed { margin-top: 8px; }
.modal-feed .feed-row { padding: 12px 14px; }
.modal pre.raw {
  background: #06060a; border: 1px solid var(--border); border-radius: 10px; padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; line-height: 1.5;
  color: var(--text-secondary); overflow: auto; max-height: 44vh;
}
.about p { font-size: 13.5px; line-height: 1.65; color: var(--text-secondary); margin-bottom: 10px; }
.about strong { color: var(--text-primary); }

/* ---------- Toast (styled like the notification dropdown) ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px); z-index: 9998;
  background: #101018; border: 1px solid var(--border-strong); border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  padding: 12px 16px; font-size: 13px; color: var(--text-primary); cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

/* Ask Jarvis typing indicator (inside the production chat styles) */
.jarvis-typing { display: flex; gap: 4px; padding: 12px 14px !important; }
.jarvis-typing span { width: 6px; height: 6px; border-radius: 50%; background: #9696a5; animation: pulse-live 1s ease-in-out infinite; }
.jarvis-typing span:nth-child(2) { animation-delay: 0.15s; }
.jarvis-typing span:nth-child(3) { animation-delay: 0.3s; }
#jarvis-suggest { padding-top: 4px; }
#jarvis-suggest .jarvis-pr-link { font-family: inherit; text-align: left; }

/* ---------- Mobile ---------- */
@media (max-width: 780px) {
  .demo-bar { font-size: 11.5px; }
  .demo-bar-inner { padding: 6px 0 0; gap: 0; display: block; }
  .demo-bar-text { padding: 0 12px; font-size: 11px; letter-spacing: -0.1px; }
  .demo-bar-text strong { padding: 0 6px; margin-right: 0; }
  .demo-bar-lead { padding: 0 12px; }
  .demo-bar-lead .demo-bar-text { padding: 0; }
  .demo-bar-links {
    flex-wrap: nowrap; gap: 0 16px; padding: 0 16px 2px;
    overflow-x: auto; white-space: nowrap; scrollbar-width: none;
  }
  .demo-bar-links::-webkit-scrollbar { display: none; }
  .demo-bar-links a, .demo-bar-button { min-height: 32px; flex-shrink: 0; }
  .prose { padding: 18px; }
  .mail-layout { grid-template-columns: 1fr; }
  .mail-list { max-height: none; }
  .mail-layout.has-selection .mail-list { display: none; }
  .mail-layout:not(.has-selection) .mail-view { display: none; }
  .mail-back { display: inline-flex; }
  .mail-head { padding: 16px 18px 14px; }
  .mail-body { padding: 16px 18px 20px; }
  .scenario-action { width: 100%; margin-left: 22px; }
  .scenario-action .btn { width: calc(100% - 22px); }
  .loop-row .feed-time { display: none; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .report-tabs .btn { padding: 7px 11px; }
  .diff { font-size: 11.5px; }
  .diff-line .ln { width: 26px; padding-right: 6px; }
}
