/*
 * NEXONOMY · DECISION RECORD PAGE
 * Page-specific surfaces for the Record object page: the interactive anatomy
 * of a Record, the completeness toggle (what survives), the seal lifecycle,
 * the calibration pull-quote, and the record-to-graph hand-off.
 * Reuses tokens and the shared system. Import after pillar.css.
 */


/* ─── ANATOMY (record + annotation panel) ────────────────────────────────── */

.anatomy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

/* The Decision Record card as a physical, sealed artifact (D-028 object exception):
   layered elevation, a lit surface with a top bevel, a gradient seal ribbon, and
   restrained in-system grain. Depth and material only, no glow, no AI-stock. */
.anatomy-rec {
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025) 0%, rgba(255,255,255,0) 16%),
    linear-gradient(180deg, #0d0e15 0%, #08090d 62%);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),         /* lit top bevel */
    0 1px 1px rgba(0,0,0,0.55),                    /* contact shadow */
    0 10px 22px -10px rgba(0,0,0,0.60),            /* mid lift */
    0 46px 84px -30px rgba(0,0,0,0.88);            /* ambient cast */
}
/* the seal: a lit-at-top accent ribbon down the left edge */
.anatomy-rec::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  z-index: 2;
  background: linear-gradient(180deg, #a98bff 0%, var(--color-accent) 45%, var(--color-accent-deep) 100%);
}
/* restrained material grain (in-system SVG noise, tile-repeated; opacity is the dial) */
.anatomy-rec::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

.an-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  position: relative;
  transition: background var(--duration-fast) var(--ease-out);
}
.an-row:last-child { border-bottom: none; }
.an-row:hover { background: rgba(255,255,255,0.018); }
.an-row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--color-accent);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.an-row--active { background: rgba(140,101,247,0.06); }
.an-row--active::before { opacity: 1; }
.an-row:focus-visible { outline: none; background: rgba(140,101,247,0.06); }

.an-row__label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding-top: 3px;
}
.an-row__value { font-size: 13px; line-height: 19px; color: var(--color-text-primary); min-width: 0; }

/* Header + hash special rows */
.an-rec-head, .an-rec-hash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.an-rec-id { font-family: var(--font-mono); font-size: 12px; color: var(--color-accent); letter-spacing: 0.04em; }
.an-rec-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-text-muted);
}
.an-rec-status .icon { width: 12px; height: 12px; color: var(--color-affirm); opacity: 0.8; }
.an-hash { font-family: var(--font-mono); font-size: 10px; color: var(--color-text-muted); letter-spacing: 0.06em; }
.an-hash b { color: var(--color-accent); font-weight: var(--weight-normal); }
.an-verify {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--color-text-secondary);
}
.an-verify .icon { width: 12px; height: 12px; color: var(--color-affirm); }

/* Options */
.an-opts { display: flex; flex-direction: column; gap: 6px; }
.an-opt {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--color-text-secondary);
}
.an-opt .icon { color: var(--color-accent); }
.an-opt--chosen { color: var(--color-text-primary); }
.an-opt__x {
  width: 14px; height: 14px; border-radius: 3px;
  border: 1px solid var(--color-border); flex-shrink: 0;
}

/* Evidence chips */
.an-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.an-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px;
  padding: 4px 8px; border-radius: 6px;
  border: 1px solid var(--color-border); background: var(--color-surface-0);
  color: var(--color-text-secondary);
}
.an-chip .icon { width: 11px; height: 11px; color: var(--color-text-muted); }

/* Confidence */
.an-conf-head { display: flex; align-items: baseline; justify-content: space-between; }
.an-conf-head b { font-size: 12.5px; color: var(--color-text-primary); font-weight: var(--weight-medium); }
.an-conf-head span { font-family: var(--font-mono); font-size: 10px; color: var(--color-text-muted); }
.an-conf-bars { display: flex; gap: 4px; margin: 8px 0; }
.an-seg { height: 6px; flex: 1; border-radius: 3px; background: var(--color-surface-2); }
.an-seg--hi { background: rgba(16,185,129,0.50); }
.an-seg--med { background: rgba(245,165,36,0.50); }
.an-conf-note { font-size: 11px; line-height: 16px; color: var(--color-text-secondary); }

/* Sign-offs */
.an-signoffs { display: flex; flex-wrap: wrap; gap: 14px; }
.an-so {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--color-text-primary);
}
.an-so__a {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 8px; color: var(--color-text-secondary);
}

/* Annotation panel */
.an-notes {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-0);
  padding: 22px;
  position: sticky;
  top: 96px;
}
.an-note { display: none; flex-direction: column; gap: 12px; }
.an-note.is-shown { display: flex; }
.an-note__icon {
  width: 38px; height: 38px; border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(140,101,247,0.10); border: 1px solid rgba(140,101,247,0.22);
  color: var(--color-accent);
}
.an-note__icon .icon { width: 19px; height: 19px; }
.an-note__title {
  font-family: var(--font-display); font-size: 19px; letter-spacing: -0.3px;
  color: var(--color-text-primary); font-weight: var(--weight-medium);
}
.an-note__body { font-size: 13.5px; line-height: 21px; color: var(--color-text-secondary); }
.an-note__tag {
  margin-top: 2px; padding-top: 14px; border-top: 1px solid var(--color-border);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--color-accent);
}


/* ─── COMPLETENESS TOGGLE (what survives) ────────────────────────────────── */

.survive {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface-0);
  padding: 24px;
  max-width: 720px;
}
.survive__head { margin-bottom: 18px; }
.survive__list { display: flex; flex-direction: column; }
.survive-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  padding: 11px 2px;
  border-bottom: 1px solid var(--color-border);
}
.survive-row:last-child { border-bottom: none; }
.survive-mark { grid-column: 1; grid-row: 1; display: none; place-items: center; }
.survive-mark--kept .icon { color: var(--color-affirm); }
.survive-mark--dropped .icon { color: var(--color-text-muted); opacity: 0.7; }
.survive-label { grid-column: 2; grid-row: 1; font-size: 13.5px; color: var(--color-text-primary); transition: color var(--duration-fast) var(--ease-out); }

/* Record mode: everything kept */
.survive__list[data-mode="record"] .survive-mark--kept { display: grid; }
.survive__list[data-mode="record"] .survive-label { color: var(--color-text-primary); }

/* Tool mode: only what a dashboard or chat keeps */
.survive__list[data-mode="tool"] .survive-row[data-tool="kept"] .survive-mark--kept { display: grid; }
.survive__list[data-mode="tool"] .survive-row[data-tool="dropped"] .survive-mark--dropped { display: grid; }
.survive__list[data-mode="tool"] .survive-row[data-tool="dropped"] .survive-label { color: var(--color-text-muted); }

.survive__foot {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--color-border);
  display: flex; align-items: center; gap: 8px;
}
.survive__count {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  color: var(--color-text-secondary);
}


/* ─── SEAL LIFECYCLE (3-step) ────────────────────────────────────────────── */

.rec-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 28px;
  background: var(--color-surface-0);
}
.rec-step { padding: 22px; }
.rec-step + .rec-step { border-left: 1px solid var(--color-border); }
.rec-step__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.rec-step__icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(140,101,247,0.10); border: 1px solid rgba(140,101,247,0.22);
  color: var(--color-accent);
}
.rec-step__icon .icon { width: 18px; height: 18px; }
.rec-step__num { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; color: var(--color-text-muted); }
.rec-step__verb {
  font-family: var(--font-display); font-size: 22px; letter-spacing: -0.5px;
  font-weight: var(--weight-medium); color: var(--color-text-primary); margin-bottom: 6px;
}
.rec-step__def { font-size: 12.5px; line-height: 19px; color: var(--color-text-secondary); }
.rec-step__state {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 14px;
  padding-top: 14px; border-top: 1px solid var(--color-border);
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--color-accent);
}
.rec-step__state::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--color-accent); }
.rec-step--final .rec-step__icon {
  background: rgba(16,185,129,0.10); border-color: rgba(16,185,129,0.24); color: var(--color-affirm);
}
.rec-step--final .rec-step__state { color: var(--color-affirm); }
.rec-step--final .rec-step__state::before { background: var(--color-affirm); }


/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .anatomy { grid-template-columns: 1fr; }
  .an-notes { position: static; }
  .rec-steps { grid-template-columns: 1fr; }
  .rec-step + .rec-step { border-left: none; border-top: 1px solid var(--color-border); }
}
