@import url('./snapshot.css');

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

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(155, 27, 48, 0.08), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(11, 31, 58, 0.12), transparent 50%),
    linear-gradient(180deg, var(--color-navy-050) 0%, var(--color-white) 40%);
  color: var(--text-primary);
  font-family: "DM Sans", system-ui, sans-serif;
  font-optical-sizing: auto;
}

h1, h2, .brand-name {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

a { color: var(--text-link); }

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.85rem 1.5rem;
  background: rgba(11, 31, 58, 0.96);
  color: var(--text-inverse);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  display: block;
  border-radius: 2px;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-name {
  font-size: 1.35rem;
  color: var(--color-white);
  line-height: 1.1;
}

.brand-desc {
  font-size: 0.72rem;
  opacity: 0.7;
  font-family: "DM Sans", system-ui, sans-serif;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-link {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

.header-link:hover { color: #fff; }

.persona {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.75rem;
  line-height: 1.25;
  padding-left: 1rem;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.persona-role { font-weight: 600; }
.persona-team { opacity: 0.65; }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 1.5rem;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.65);
  border-bottom: 1px solid var(--border-subtle);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--brand-accent); }
.bc-sep { color: var(--border-default); margin: 0 0.15rem; }
.bc-current { color: var(--text-strong); font-weight: 600; }

.app-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 0;
  flex: 1;
  min-height: 0;
}

.app-main {
  padding: 1.5rem 1.75rem 3rem;
  min-width: 0;
}

.context-rail {
  border-left: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.72);
  padding: 1.25rem 1rem 2rem;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow: auto;
}

.rail-title {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

.rail-line {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--brand-accent);
  margin: 0 0 0.5rem;
  font-family: "DM Sans", system-ui, sans-serif;
}

.view-header h1,
.spider-intro h1,
.demo-intro h1 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  margin: 0 0 0.6rem;
  line-height: 1.15;
}

.lede {
  margin: 0 0 1.25rem;
  max-width: 42rem;
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.5;
}

.lede .fig {
  color: var(--brand-accent);
  font-weight: 700;
  font-family: "DM Sans", system-ui, sans-serif;
}

.section-title {
  font-size: 1.25rem;
  margin: 1.75rem 0 0.75rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

.intel-card {
  background: var(--color-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.95rem 1rem;
  border-radius: 2px;
}

.intel-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.55rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.source-chip {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  background: var(--color-navy-100);
  color: var(--color-navy);
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}

.confidence { text-transform: uppercase; letter-spacing: 0.04em; }
.conf-high { color: #1f6b3a; }
.conf-medium { color: #8a6d1d; }
.conf-low { color: var(--brand-accent); }

.intel-headline {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.45rem;
  line-height: 1.35;
  color: var(--text-strong);
}

.intel-implication {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Spider */
.spider-stage {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 360px);
  gap: 1.25rem;
  align-items: start;
}

.spider-svg {
  width: 100%;
  max-height: 560px;
  background: linear-gradient(160deg, rgba(11, 31, 58, 0.04), rgba(155, 27, 48, 0.03));
  border: 1px solid var(--border-subtle);
}

.spider-hub {
  fill: var(--color-navy);
  stroke: var(--color-crimson);
  stroke-width: 2;
}

.spider-hub-label {
  fill: #fff;
  font-size: 11px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 600;
}

.spider-spoke {
  stroke: rgba(11, 31, 58, 0.35);
  stroke-width: 1.5;
}

.spider-node-hex {
  fill: #fff;
  stroke: var(--color-navy);
  stroke-width: 1.5;
  transition: fill 160ms ease, stroke 160ms ease;
}

.spider-node:hover .spider-node-hex,
.spider-node:focus .spider-node-hex {
  fill: var(--color-crimson-100);
  stroke: var(--color-crimson);
}

.spider-node-label {
  fill: var(--color-navy);
  font-size: 10px;
  font-weight: 700;
  font-family: "DM Sans", system-ui, sans-serif;
  pointer-events: none;
}

.spider-headlines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.headline-row button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-subtle);
  background: #fff;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.15rem 0.5rem;
  font: inherit;
  transition: border-color 150ms ease, transform 150ms ease;
}

.headline-row button:hover {
  border-color: var(--color-crimson);
  transform: translateY(-1px);
}

.hl-area {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.hl-fig {
  font-weight: 700;
  color: var(--brand-accent);
  font-size: 0.95rem;
}

.hl-text {
  grid-column: 1 / -1;
  font-size: 0.84rem;
  color: var(--text-primary);
  line-height: 1.35;
}

.dir-up .hl-fig { color: #1f6b3a; }
.dir-down .hl-fig { color: var(--brand-accent); }

/* Demo */
.demo-toggle {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--border-default);
  margin-bottom: 1rem;
}

.demo-toggle button {
  border: 0;
  background: transparent;
  padding: 0.45rem 0.9rem;
  font: inherit;
  cursor: pointer;
  color: var(--text-muted);
}

.demo-toggle button.is-active {
  background: var(--color-navy);
  color: #fff;
}

.demo-svg {
  width: 100%;
  max-width: 820px;
  background: linear-gradient(160deg, rgba(11, 31, 58, 0.05), #fff);
  border: 1px solid var(--border-subtle);
}

.mesh-line {
  stroke: rgba(155, 27, 48, 0.35);
  stroke-width: 1;
}

.hub-spoke-line {
  stroke: var(--color-navy);
  stroke-width: 2;
}

.demo-hub {
  fill: var(--color-navy);
  stroke: var(--color-crimson);
  stroke-width: 2;
}

.demo-hub-label {
  fill: #fff;
  font-size: 12px;
  font-weight: 600;
  font-family: "DM Sans", system-ui, sans-serif;
}

.demo-role-hex {
  fill: #fff;
  stroke: var(--color-navy);
  stroke-width: 1.5;
}

.demo-role-label {
  fill: var(--text-muted);
  font-size: 10px;
  font-family: "DM Sans", system-ui, sans-serif;
}

/* Globe */
.globe-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(260px, 0.9fr);
  gap: 1.25rem;
}

.globe-wrap {
  border: 1px solid var(--border-subtle);
  background: #061222;
  min-height: 420px;
}

.globe-hint {
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
  background: rgba(11, 31, 58, 0.9);
}

.globe-side .market-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.globe-side .market-list button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-subtle);
  background: #fff;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.4rem;
  cursor: pointer;
  font: inherit;
  display: flex;
  justify-content: space-between;
}

.deal-row {
  display: grid;
  gap: 0.15rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}

.deal-row .muted { color: var(--text-muted); }

.entity-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.entity-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 1rem;
  text-align: left;
  border: 1px solid var(--border-subtle);
  background: #fff;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  font: inherit;
}

.entity-row:hover { border-color: var(--color-crimson); }
.er-name { font-weight: 600; color: var(--text-strong); }
.er-meta { grid-column: 1; font-size: 0.8rem; color: var(--text-muted); }
.er-items { grid-row: 1 / span 2; align-self: center; font-size: 0.8rem; color: var(--brand-accent); font-weight: 600; }

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.history-list li {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.25rem 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}

.history-list time { color: var(--text-muted); }
.history-list span { grid-column: 2; color: var(--text-muted); }

.snapshot-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.text-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

.empty {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Query */
.query-panel {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.query-form label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
}

.query-row {
  display: flex;
  gap: 0.35rem;
}

.query-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border-default);
  padding: 0.45rem 0.55rem;
  font: inherit;
  font-size: 0.85rem;
  background: #fff;
}

.query-row button {
  border: 0;
  background: var(--color-navy);
  color: #fff;
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.query-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0.4rem 0 0;
}

.query-answer {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

.query-cache-tag {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}

.num-chip {
  display: inline-block;
  border: 0;
  padding: 0.05rem 0.35rem;
  margin: 0 0.1rem;
  font: inherit;
  font-weight: 700;
  cursor: default;
  border-radius: 2px;
}

.num-chip.verified {
  background: var(--color-navy-100);
  color: var(--color-navy);
}

.num-chip.unverified {
  background: var(--color-crimson-100);
  color: var(--color-crimson);
  outline: 1px dashed var(--color-crimson);
}

.evidence-record {
  margin: 0.5rem 0 0;
  padding: 0.65rem;
  background: var(--color-navy-050);
  font-size: 0.75rem;
  overflow: auto;
  border: 1px solid var(--border-subtle);
}

.evidence-item { margin-bottom: 1rem; }

@media (max-width: 960px) {
  .app-body {
    grid-template-columns: 1fr;
  }
  .context-rail {
    position: static;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--border-subtle);
  }
  .spider-stage,
  .globe-layout {
    grid-template-columns: 1fr;
  }
  .header-actions .header-link:nth-child(2) { display: none; }
}
