/* Lifecycle swimlane — CAC state machine L* visualization */

:root {
  --bg: #0a110a;
  --bg-panel: #0f1810;
  --bg-card: #121f14;
  --text: #e8f0ea;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --fundamental-stripe: rgba(110, 231, 183, 0.06);
  --panel-bg: #111a12;
  --panel-border: rgba(134, 168, 140, 0.2);
  --fundamental-width: 1400px;
}

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

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body.lifecycle-page {
  padding-bottom: 96px;
}

.lifecycle-wrap {
  position: relative;
  z-index: 1;
  max-width: 100%;
  padding: 0 20px 48px;
}

.lifecycle-header {
  padding: 28px 0 20px;
  max-width: 1400px;
}

.lifecycle-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6ee7b7;
  margin: 0 0 8px;
}

.lifecycle-title {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.lifecycle-subtitle {
  margin: 0;
  max-width: 720px;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.lifecycle-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  margin-top: 20px;
}

.stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Offense type filter — compact bar, expands right */
.offense-filter {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  position: relative;
}

.offense-filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 14px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(134, 168, 140, 0.18);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, border-radius 0.2s ease;
}

.offense-filter.open .offense-filter-trigger {
  border-radius: 999px 0 0 999px;
  border-right: none;
  background: rgba(255, 255, 255, 0.05);
  color: #d1fae5;
}

.offense-filter-trigger:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(134, 168, 140, 0.28);
}

.offense-filter-eyebrow {
  color: #6ee7b7;
  font-weight: 600;
}

.offense-filter-summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 140px;
  overflow: hidden;
}

.offense-filter-summary-all {
  color: var(--text-dim);
}

.offense-filter-chip {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.offense-filter-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  background: rgba(15, 24, 16, 0.96);
  border: 1px solid rgba(134, 168, 140, 0.22);
  border-left: none;
  border-radius: 0 999px 999px 0;
  animation: offensePanelIn 0.18s ease;
}

@keyframes offensePanelIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}

.offense-filter-options {
  display: flex;
  align-items: center;
  gap: 5px;
}

.offense-filter-option {
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid rgba(134, 168, 140, 0.2);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}

.offense-filter-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.offense-filter-option.is-on {
  color: var(--chip-color, #e8f0ea);
  border-color: color-mix(in srgb, var(--chip-color, #6ee7b7) 55%, transparent);
  background: color-mix(in srgb, var(--chip-color, #6ee7b7) 12%, transparent);
}

.offense-filter-option.is-off {
  opacity: 0.45;
}

.offense-filter-all {
  padding: 5px 9px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid rgba(134, 168, 140, 0.15);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.offense-filter-all:hover {
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, 0.35);
}

@media (max-width: 720px) {
  .lifecycle-header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .offense-filter {
    width: 100%;
  }

  .offense-filter-panel {
    flex-wrap: wrap;
    border-radius: 0 12px 12px 0;
    max-width: calc(100vw - 48px);
  }

  .offense-filter-options {
    flex-wrap: wrap;
  }
}

.stat-pill {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(134, 168, 140, 0.18);
  color: #d1fae5;
}

.stat-pill strong {
  color: #6ee7b7;
  font-weight: 600;
}

.canvas-scroll {
  margin: 0 -20px;
  padding: 0 20px 8px;
  overflow: visible;
}

#lifecycle-canvas,
#lifecycle-canvas-expansion {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.lifecycle-svg .section-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}

.lifecycle-svg .section-note {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--text-dim);
}

.lifecycle-svg {
  display: block;
  /* Keep intrinsic width/height from SVG attributes — no viewport stretch */
  width: auto;
  height: auto;
  max-width: none;
  flex-shrink: 0;
  vertical-align: top;
}

.lifecycle-svg .fundamental-col {
  fill: var(--fundamental-stripe);
}

.lifecycle-svg .row-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lifecycle-svg .row-citation {
  font-size: 10px;
  fill: var(--text-dim);
}

.lifecycle-svg .col-header {
  font-family: var(--mono);
  font-size: 9px;
  fill: var(--text-dim);
  text-anchor: middle;
}

.lifecycle-svg .stage-node {
  cursor: pointer;
  transition: filter 0.15s ease;
}

.lifecycle-svg .stage-node:hover {
  filter: brightness(1.12);
}

.lifecycle-svg .node-class {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
}

.lifecycle-svg .node-label {
  font-size: 12px;
  font-weight: 600;
}

.lifecycle-svg .coverage-badge {
  font-family: var(--mono);
  font-size: 9px;
  fill: var(--text-muted);
}

.lifecycle-svg .edge-label {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--text-muted);
  pointer-events: none;
}

.lifecycle-svg .edge-disrupted {
  stroke: #f87171;
  opacity: 0.95;
}

.lifecycle-svg .edge-backward,
.lifecycle-svg .edge-intra {
  opacity: 0.9;
}

.lifecycle-svg .edge-blocked-ghost {
  fill: none;
  stroke: #6b7280;
  stroke-width: 1.5;
  stroke-dasharray: 4,6;
  opacity: 0.55;
}

.lifecycle-svg .disruption-x-bg {
  fill: #1a0d0d;
  stroke: #f87171;
  stroke-width: 2;
}

.lifecycle-svg .disruption-x-bg.ghost {
  fill: #141414;
  stroke: #6b7280;
  stroke-width: 1.5;
}

.lifecycle-svg .disruption-x-stroke {
  stroke: #f87171;
  stroke-width: 2.5;
  stroke-linecap: round;
}

.lifecycle-svg .ghost-x .disruption-x-stroke {
  stroke: #9ca3af;
  stroke-width: 2;
}

.lifecycle-svg .disruption-edge-label {
  fill: #fca5a5;
  font-style: italic;
}

.lifecycle-svg .disruption-badge {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
  /* fill set per-row in JS (modality color); fallback subtle enticement green */
  fill: #6ee7b7;
  opacity: 0.72;
}

.legend-disruption {
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid rgba(134, 168, 140, 0.2);
}

.legend-item .disruption-dot {
  background: transparent !important;
  border: 2px dashed #f87171;
  position: relative;
}

.legend-item .disruption-dot::after {
  content: "×";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #f87171;
  line-height: 1;
}

.panel-disruption h4 {
  color: #f87171;
}

.lifecycle-svg .gate-diamond {
  fill: #374151;
  stroke: #6b7280;
  stroke-width: 1;
}

.lifecycle-svg .gate-label {
  font-size: 10px;
  font-style: italic;
  fill: #9ca3af;
}

.lifecycle-svg .coercion-arc {
  fill: none;
  stroke: #f87171;
  stroke-width: 2;
  opacity: 0.85;
  animation: coercionPulse 2.5s ease-in-out infinite;
}

@keyframes coercionPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.flow-dot {
  opacity: 0.55;
}

.fundamental-section {
  margin: 28px 0 0;
  padding: 20px 22px;
  background: #111a12;
  border: 1px solid rgba(134, 168, 140, 0.14);
  border-radius: 12px;
  width: var(--fundamental-width);
  max-width: var(--fundamental-width);
  box-sizing: border-box;
  flex-shrink: 0;
}

.fundamental-section h2 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6ee7b7;
  margin: 0 0 6px;
}

.fundamental-section .fundamental-note {
  font-size: 11px;
  color: var(--text-dim);
  margin: 0 0 14px;
}

.fundamental-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
}

.fundamental-flow .bf-node {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(110, 231, 183, 0.08);
  border: 1px solid rgba(110, 231, 183, 0.25);
  color: #a7f3d0;
}

.fundamental-flow .bf-arrow {
  color: var(--text-dim);
}

.fundamental-math {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(134, 168, 140, 0.12);
}

.fundamental-basis-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6ee7b7;
  margin: 0 0 10px;
}

.fundamental-equation {
  padding: 12px 16px;
  background: rgba(110, 231, 183, 0.06);
  border: 1px solid rgba(110, 231, 183, 0.18);
  border-radius: 8px;
  margin-bottom: 12px;
  line-height: 1.6;
  overflow-x: auto;
}

.fundamental-equation-tex {
  display: inline-block;
}

.fundamental-equation .katex {
  color: #d1fae5;
  font-size: 1.12em;
}

.fundamental-equation .katex .mord,
.fundamental-equation .katex .mathnormal,
.fundamental-equation .katex .mathit,
.fundamental-equation .katex .mop,
.fundamental-equation .katex .mopen,
.fundamental-equation .katex .mclose,
.fundamental-equation .katex .mpunct,
.fundamental-equation .katex .minner,
.fundamental-equation .katex .mord.mathnormal {
  color: inherit;
}

.fundamental-basis-text {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 820px;
}

.fundamental-paper-link {
  font-family: var(--mono);
  font-size: 11px;
  color: #6ee7b7;
  text-decoration: none;
  border-bottom: 1px solid rgba(110, 231, 183, 0.35);
}

.fundamental-paper-link:hover {
  color: #a7f3d0;
  border-bottom-color: #a7f3d0;
}

.expansion-section {
  margin: 32px 0 0;
  padding-bottom: 24px;
  scroll-margin-bottom: 96px;
}

.expansion-header {
  padding: 0 0 16px;
}

.expansion-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fbbf24;
  margin: 0 0 8px;
}

.expansion-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.expansion-subtitle {
  margin: 0;
  max-width: 720px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.expansion-section .row-sublabel {
  font-size: 11px;
  fill: var(--text-muted);
}

.expansion-section .row-statute {
  font-family: var(--mono);
  font-size: 9px;
  fill: var(--text-dim);
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 92vw;
  height: 100vh;
  background: var(--panel-bg);
  border-left: 1px solid var(--panel-border);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  overflow-y: auto;
  padding: 22px 20px 40px;
}

.detail-panel.open {
  transform: translateX(0);
}

.detail-panel h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.detail-panel .panel-type {
  font-family: var(--mono);
  font-size: 10px;
  color: #6ee7b7;
  word-break: break-all;
  margin-bottom: 14px;
}

.detail-panel .panel-section {
  margin-top: 16px;
}

.detail-panel .panel-section h4 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 6px;
}

.detail-panel p,
.detail-panel li {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.detail-panel ul {
  margin: 0;
  padding-left: 18px;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.detail-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.affordance-legend {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: #070d08;
  border-top: 1px solid rgba(134, 168, 140, 0.12);
  padding: 10px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
}

.affordance-legend .legend-title {
  color: var(--text-dim);
  margin-right: 4px;
}

.affordance-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.affordance-legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lifecycle-error {
  padding: 40px;
  color: #f87171;
  font-family: var(--mono);
  font-size: 13px;
}

/* Nav stays light like other pages */
.nav {
  background: white;
  padding: 15px 0 15px 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  position: relative;
  z-index: 20;
}
.nav a {
  color: #4CAF50;
  text-decoration: none;
  margin-right: 20px;
  white-space: nowrap;
}
.nav a:hover { text-decoration: underline; }
.nav a.patterns {
  color: #dc2626;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.nav a[aria-current="page"] {
  color: #4CAF50;
}
.hood-link {
  margin-left: auto;
  font-weight: 600;
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
