/* Atomic structure-evidence workspace. Extends the Context shell without changing its semantics. */

.context-three-pane--evidence {
  grid-template-columns: minmax(15rem, 0.65fr) minmax(29rem, 1.5fr) minmax(20rem, 0.9fr);
}

.structure-source-list,
.structure-tie-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.structure-source > a,
.structure-tie > a {
  border-block-end: var(--ok-rule) solid var(--color-rule);
  display: grid;
  gap: var(--ok-space-2);
  grid-template-columns: minmax(0, 1fr) auto;
  padding: var(--ok-space-3) var(--ok-space-4);
  text-decoration: none;
}

.structure-source small,
.structure-tie small {
  color: var(--color-text-muted);
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

.structure-source.is-selected > a,
.structure-tie.is-selected > a,
.structure-claim-row.is-selected {
  background: var(--color-surface-focus);
  border-inline-start: var(--ok-space-1) solid var(--color-focus);
}

.structure-page-controls,
.structure-form-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ok-space-2);
}

.structure-reconstruction {
  padding: 0;
}

.structure-reconstruction__header,
.structure-presentation-panel > header {
  align-items: center;
  display: flex;
  gap: var(--ok-space-4);
  justify-content: space-between;
}

.structure-reconstruction__header {
  border-block-end: var(--ok-rule) solid var(--color-rule-strong);
  padding: var(--ok-space-4);
}

.structure-reconstruction__header h3,
.structure-presentation-panel h4,
.structure-selection-summary h4,
.structure-semantic-index h4 {
  margin: var(--ok-space-1) 0 0;
  text-transform: uppercase;
}

.structure-reconstruction__header .meta {
  margin: 0 0 var(--ok-space-1);
}

.structure-reconstruction__authority {
  border: var(--ok-rule) solid var(--color-conflict);
  color: var(--color-conflict);
  font-size: var(--text-metadata);
  letter-spacing: var(--tracking-label);
  max-inline-size: 25rem;
  padding: var(--ok-space-2) var(--ok-space-3);
  text-align: end;
  text-transform: uppercase;
}

.structure-reconstruction__jumps {
  display: none;
}

.structure-resolution-status {
  border-block-end: var(--ok-rule) solid var(--color-rule-strong);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.structure-resolution-status span {
  color: var(--color-text-muted);
  font-size: var(--text-metadata);
  padding: var(--ok-space-2) var(--ok-space-3);
  text-transform: uppercase;
}

.structure-resolution-status span + span {
  border-inline-start: var(--ok-rule) solid var(--color-rule);
}

.structure-resolution-status strong {
  color: var(--color-text);
}

.structure-reconstruction__warning {
  border-block-end: var(--ok-rule) solid var(--color-rule-strong);
  color: var(--color-text-muted);
  margin: 0;
  padding: var(--ok-space-3) var(--ok-space-4);
}

.structure-reconstruction__presentations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr));
}

.structure-presentation-panel {
  min-inline-size: 0;
}

.structure-presentation-panel + .structure-presentation-panel {
  border-inline-start: var(--ok-rule) solid var(--color-rule-strong);
}

.structure-presentation-panel > header {
  border-block-end: var(--ok-rule) solid var(--color-rule-strong);
  min-block-size: var(--ok-space-20);
  padding: var(--ok-space-3) var(--ok-space-4);
}

.structure-presentation-panel > header > span {
  color: var(--color-text-muted);
  font-size: var(--text-metadata);
  text-transform: uppercase;
}

.structure-visual-stage {
  aspect-ratio: 4 / 3;
  background: var(--color-surface);
  min-block-size: 22rem;
  overflow: hidden;
  position: relative;
}

.structure-visual-stage canvas {
  block-size: 100%;
  cursor: grab;
  inline-size: 100%;
  position: absolute;
}

.structure-visual-stage canvas:active {
  cursor: grabbing;
}

.structure-visual-stage__fallback {
  color: var(--color-text-muted);
  inset: 50% auto auto 50%;
  margin: 0;
  position: absolute;
  text-transform: uppercase;
  transform: translate(-50%, -50%);
}

[data-structure-evidence-viewer-ready="true"] .structure-visual-stage__fallback {
  display: none;
}

.structure-viewer-controls {
  border-block: var(--ok-rule) solid var(--color-rule-strong);
  display: grid;
  gap: var(--ok-space-1);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: var(--ok-space-2);
}

.structure-viewer-controls .button {
  min-inline-size: 0;
  padding-inline: var(--ok-space-2);
}

.structure-viewer-controls [aria-pressed="true"] {
  background: var(--color-surface-focus);
  border-color: var(--color-focus);
  color: var(--color-text);
}

.structure-sheet-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ok-space-1);
  justify-content: flex-end;
}

.structure-sheet-controls .button {
  min-inline-size: 0;
  padding-inline: var(--ok-space-2);
}

.structure-sheet-controls [aria-pressed="true"] {
  background: var(--color-surface-focus);
  border-color: var(--color-focus);
  color: var(--color-text);
}

.structure-sheet-frame {
  align-items: center;
  aspect-ratio: 11 / 8.5;
  background: var(--color-text);
  color: var(--color-page);
  display: flex;
  inline-size: 100%;
  justify-content: center;
  min-block-size: 22rem;
  overflow: hidden;
}

.structure-sheet-frame > p {
  color: var(--color-page);
  padding: var(--ok-space-4);
  text-transform: uppercase;
}

.structure-technical-sheet {
  block-size: 100%;
  inline-size: 100%;
}

.structure-technical-sheet a {
  cursor: pointer;
}

.structure-evidence-legend {
  border-block: var(--ok-rule) solid var(--color-rule-strong);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.evidence-state {
  font-size: var(--text-metadata);
  letter-spacing: var(--tracking-label);
  padding: var(--ok-space-2) var(--ok-space-3);
  text-transform: uppercase;
}

.evidence-state + .evidence-state {
  border-inline-start: var(--ok-rule) solid var(--color-rule);
}

.evidence-state--accepted {
  border-block-start: var(--ok-focus-rule) solid var(--color-text);
}

.evidence-state--candidate {
  border-block-start: var(--ok-focus-rule) solid var(--color-confirmed);
  color: var(--color-confirmed);
}

.evidence-state--dissent {
  border-block-start: var(--ok-focus-rule) dashed var(--color-conflict);
  color: var(--color-conflict);
}

.evidence-state--inferred {
  border-block-start: var(--ok-focus-rule) dotted var(--color-text-muted);
  color: var(--color-text-muted);
}

.structure-reconstruction__reading-row {
  display: grid;
  grid-template-columns: minmax(16rem, 0.75fr) minmax(0, 1.25fr);
}

.structure-selection-summary,
.structure-semantic-index {
  padding: var(--ok-space-4);
}

.structure-semantic-index {
  border-inline-start: var(--ok-rule) solid var(--color-rule-strong);
}

.structure-semantic-index > div {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ok-space-2);
  margin-block-start: var(--ok-space-3);
}

.structure-semantic-index .button {
  font-size: var(--text-metadata);
}

.structure-viewer-status {
  color: var(--color-text-muted);
  font-size: var(--text-metadata);
  margin-block-end: 0;
}

.structure-validation-ledger {
  border-block-start: var(--ok-rule) solid var(--color-rule-strong);
  padding: var(--ok-space-4);
}

.structure-validation-ledger summary {
  cursor: pointer;
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.structure-validation-list {
  list-style: none;
  margin: var(--ok-space-4) 0;
  padding: 0;
}

.structure-validation-result {
  align-items: center;
  border-block-end: var(--ok-rule) solid var(--color-rule);
  display: grid;
  gap: var(--ok-space-2);
  grid-template-columns: minmax(0, 1fr) auto;
  padding: var(--ok-space-2) 0;
}

.structure-validation-result small {
  color: var(--color-text-muted);
  grid-column: 1 / -1;
}

.structure-terrain-heading {
  border-block-start: var(--ok-rule) solid var(--color-rule-strong);
}

.structure-terrain {
  border-block-end: var(--ok-rule) solid var(--color-rule-strong);
  display: grid;
  gap: var(--ok-space-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: var(--ok-space-4);
}

.structure-terrain--single {
  grid-template-columns: minmax(0, 1fr);
}

.structure-page {
  border: var(--ok-rule) solid var(--color-rule-strong);
  margin: 0;
  min-inline-size: 0;
}

.structure-page__frame {
  aspect-ratio: 11 / 8.5;
  background: var(--color-text);
  overflow: hidden;
  position: relative;
}

.structure-page__frame > a,
.structure-page__frame img {
  block-size: 100%;
  inline-size: 100%;
}

.structure-page__frame img {
  object-fit: contain;
}

.structure-page__locator {
  border: var(--ok-focus-rule) solid var(--color-action);
  box-shadow: 0 0 0 var(--ok-rule) var(--color-page);
  pointer-events: none;
  position: absolute;
}

.structure-page figcaption {
  display: grid;
  font-size: var(--text-metadata);
  gap: var(--ok-space-1);
  padding: var(--ok-space-2);
}

.structure-page figcaption span {
  color: var(--color-text-muted);
}

.structure-claim-group {
  border: var(--ok-rule) solid var(--color-rule-strong);
  margin-block-start: var(--ok-space-3);
}

.structure-claim-group > header {
  align-items: center;
  background: var(--color-surface);
  display: flex;
  font-size: var(--text-metadata);
  justify-content: space-between;
  padding: var(--ok-space-2) var(--ok-space-3);
  text-transform: uppercase;
}

.structure-claim-row {
  align-items: center;
  border-block-start: var(--ok-rule) solid var(--color-rule);
  display: grid;
  gap: var(--ok-space-2);
  grid-template-columns: minmax(0, 1fr) auto;
  padding: var(--ok-space-3);
  text-decoration: none;
}

.structure-claim-row small {
  color: var(--color-text-muted);
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

.structure-claim-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ok-space-1);
  justify-content: flex-end;
}

.structure-warrant-alert {
  border-block: var(--ok-rule) solid var(--color-conflict);
}

.structure-warrant-alert h3,
.structure-warrant-alert p {
  color: var(--color-conflict);
}

.structure-tie .context-compact-definition,
.structure-tie .curation-decisions,
.structure-tie .curation-decision-form,
.structure-tie .structure-action {
  margin: var(--ok-space-3) var(--ok-space-4);
}

.structure-action {
  border: var(--ok-rule) solid var(--color-rule-strong);
  margin-block-start: var(--ok-space-3);
}

.structure-action > summary {
  cursor: pointer;
  font-weight: 700;
  padding: var(--ok-space-3);
  text-transform: uppercase;
}

.structure-action-stack .curation-decision-form + .curation-decision-form {
  border-block-start: var(--ok-rule) solid var(--color-rule);
  margin-block-start: var(--ok-space-4);
  padding-block-start: var(--ok-space-4);
}

.structure-evidence-form fieldset {
  border: var(--ok-rule) solid var(--color-rule-strong);
  display: grid;
  gap: var(--ok-space-2);
  margin-block: var(--ok-space-3);
  padding: var(--ok-space-3);
}

.structure-evidence-form fieldset label {
  letter-spacing: 0;
  text-transform: none;
}

.structure-evidence-shell code {
  overflow-wrap: anywhere;
}

@media (max-width: 70rem) {
  .context-three-pane--evidence {
    grid-template-columns: minmax(16rem, 0.65fr) minmax(0, 1.35fr);
  }

  .structure-reconstruction__presentations {
    grid-template-columns: 1fr;
  }

  .structure-presentation-panel + .structure-presentation-panel {
    border-block-start: var(--ok-rule) solid var(--color-rule-strong);
    border-inline-start: 0;
  }
}

@media (max-width: 48rem) {
  .context-three-pane--evidence {
    display: block;
    min-block-size: auto;
  }

  .structure-terrain {
    grid-template-columns: 1fr;
  }

  .structure-reconstruction__header {
    align-items: start;
    flex-direction: column;
  }

  .structure-reconstruction__authority {
    text-align: start;
  }

  .structure-reconstruction__jumps {
    border-block-end: var(--ok-rule) solid var(--color-rule-strong);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .structure-reconstruction__jumps a {
    font-size: var(--text-metadata);
    padding: var(--ok-space-3) var(--ok-space-2);
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
  }

  .structure-reconstruction__jumps a + a {
    border-inline-start: var(--ok-rule) solid var(--color-rule);
  }

  .structure-resolution-status,
.structure-evidence-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .structure-resolution-status span:nth-child(3),
  .evidence-state:nth-child(3) {
    border-block-start: var(--ok-rule) solid var(--color-rule);
    border-inline-start: 0;
  }

  .structure-resolution-status span:nth-child(4),
  .evidence-state:nth-child(4) {
    border-block-start: var(--ok-rule) solid var(--color-rule);
  }

  .structure-visual-stage,
  .structure-sheet-frame {
    min-block-size: clamp(22rem, 95vw, 25rem);
  }

  .structure-viewer-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .structure-presentation-panel > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .structure-sheet-controls {
    inline-size: 100%;
    justify-content: flex-start;
  }

  .structure-reconstruction__reading-row {
    grid-template-columns: 1fr;
  }

  .structure-semantic-index {
    border-block-start: var(--ok-rule) solid var(--color-rule-strong);
    border-inline-start: 0;
  }

  .structure-evidence-form input,
  .structure-evidence-form select,
  .structure-evidence-form textarea {
    font-size: 16px;
  }
}

.structure-evidence-legend--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
