/* Shared presentation for evidence-bound single-screenshot steppers. */
:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #65717f;
  --paper: #f7f4ed;
  --card: #fff;
  --line: #d9d6cc;
  --navy: #173f5f;
  --cyan: #22a6b3;
  --green: #176b45;
  --green-bg: #e5f5ec;
  --red: #9f2f2f;
  --red-bg: #fae9e7;
  --gold: #f4c542;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0%, rgb(34 166 179 / 11%), transparent 30rem),
    var(--paper);
}

a {
  color: var(--navy);
}

button {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 0.5rem;
  color: #fff;
  background: var(--navy);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  width: min(1480px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.top-nav,
.badge-row,
.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.top-nav {
  justify-content: space-between;
  margin-bottom: 2.25rem;
  font-weight: 750;
}

.hero {
  max-width: 900px;
  margin-bottom: 2rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge.archive {
  color: #68440e;
  background: #fff2d8;
}

.badge.ap {
  color: var(--navy);
  background: #e9f0f5;
}

.badge.violation {
  color: var(--red);
  background: var(--red-bg);
}

.eyebrow,
.section-label {
  margin: 1.2rem 0 0.45rem;
  color: var(--navy);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 18ch;
  margin-bottom: 0.75rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 0.98;
}

h2 {
  margin-bottom: 0.6rem;
  font-size: clamp(1.2rem, 2.3vw, 1.7rem);
}

.lede {
  max-width: 62ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.contract,
.review-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.5fr) minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--card);
}

.contract .section-label,
.review-card .section-label {
  margin-top: 0;
}

.formula,
.bombadil {
  display: block;
  overflow-x: auto;
  padding: 0.9rem;
  border-radius: 0.6rem;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
}

.formula {
  color: #f3f8fa;
  background: #142d3d;
}

.bombadil {
  margin: 0;
  border: 1px solid #d5e0e5;
  background: #f4f8fa;
  white-space: pre;
}

.trace-section {
  margin: 2.5rem 0 1.5rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: end;
  margin-bottom: 1rem;
}

.section-heading .section-label {
  margin-top: 0;
}

.section-heading > p {
  max-width: 36ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.trace-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--card);
  box-shadow: 0 14px 34px rgb(23 32 42 / 8%);
}

.trace-map {
  display: grid;
  grid-template-columns: 1fr 7rem 1fr 7rem 1fr;
  gap: 0.6rem;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  background: #faf9f5;
}

.trace-state {
  display: grid;
  gap: 0.25rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  color: var(--muted);
  background: #f0eee8;
  text-align: left;
  cursor: pointer;
}

.trace-state span {
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trace-state.active {
  border-color: var(--navy);
  color: var(--navy);
  background: #e9f0f5;
}

.trace-state.violation.active {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}

.trace-edge {
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  opacity: 0.25;
}

.trace-edge.active {
  opacity: 1;
}

.trace-edge small {
  display: block;
  margin-top: 0.25rem;
}

.trace-edge i {
  position: relative;
  display: block;
  height: 1px;
  margin: 0.75rem 0.5rem 0;
  background: currentColor;
}

.trace-edge i::after {
  position: absolute;
  top: -4px;
  right: 0;
  width: 7px;
  height: 7px;
  border-top: 1px solid;
  border-right: 1px solid;
  content: "";
  transform: rotate(45deg);
}

kbd {
  padding: 0.35rem 0.55rem;
  border: 1px solid #b9b6ad;
  border-bottom-width: 3px;
  border-radius: 0.4rem;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.evidence-view {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.65fr);
}

.shot-panel,
.facts-panel {
  padding: 1rem;
}

.shot-panel {
  border-right: 1px solid var(--line);
}

.shot-heading,
.facts-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.shot-heading .section-label,
.facts-heading .section-label {
  margin: 0;
}

.shot {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  background: #151817;
}

.shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.evidence-focus {
  position: absolute;
  z-index: 2;
  border: 4px solid var(--cyan);
  border-radius: 0.2rem;
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 7px rgb(34 166 179 / 28%);
  pointer-events: none;
}

.evidence-focus span {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.4rem);
  min-width: max-content;
  padding: 0.3rem 0.45rem;
  border-radius: 0.3rem;
  color: #fff;
  background: var(--navy);
  font-size: 0.68rem;
  font-weight: 850;
}

.evidence-focus.label-below span {
  top: calc(100% + 0.4rem);
  bottom: auto;
}

.caption {
  min-height: 2.8rem;
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.facts-panel {
  display: flex;
  flex-direction: column;
}

.action {
  align-self: start;
  margin: 0 0 1rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0.4rem;
  background: #f0eee8;
  font: 750 0.78rem/1.3 "SFMono-Regular", Consolas, monospace;
}

.action span {
  margin-right: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
}

.predicate-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem 1rem;
  margin: 0 0 1rem;
  font: 0.78rem/1.3 "SFMono-Regular", Consolas, monospace;
}

.predicate-grid dt,
.predicate-grid dd {
  margin: 0;
}

.predicate-grid dd {
  font-weight: 850;
  text-align: right;
}

.predicate-grid .true {
  color: var(--green);
}

.predicate-grid .false {
  color: var(--red);
}

.explain {
  flex: 1;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.step-verdict {
  margin: 0;
  padding: 0.75rem;
  border-left: 4px solid var(--green);
  background: var(--green-bg);
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.step-verdict.violation {
  border-left-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}

.controls {
  display: grid;
  grid-template-columns: 8rem 1fr 8rem;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--line);
  background: #faf9f5;
}

.controls > button {
  min-height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.controls > button:disabled {
  opacity: 0.35;
  cursor: default;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
}

.dot {
  width: 0.7rem;
  height: 0.7rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #bbbcb7;
  cursor: pointer;
}

.dot.active {
  background: var(--red);
}

.verdict-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.verdict-grid article {
  padding: 1rem;
  border-left: 4px solid var(--green);
  background: var(--green-bg);
}

.verdict-grid article.observed {
  border-left-color: var(--red);
  background: var(--red-bg);
}

.verdict-grid .section-label {
  margin-top: 0;
}

.verdict-grid p:last-child {
  margin-bottom: 0;
  line-height: 1.5;
}

.review-card {
  grid-template-columns: minmax(220px, 0.6fr) auto minmax(180px, 0.4fr);
  margin-top: 2rem;
}

.review-actions button {
  min-height: 2.7rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.review-actions button[aria-pressed="true"] {
  border-color: var(--navy);
  color: #fff;
  background: var(--navy);
}

#review-status {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.evidence-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

@media (max-width: 1120px) {
  .trace-map {
    grid-template-columns: 1fr;
  }

  .trace-edge {
    min-height: 2.5rem;
  }

  .trace-edge i {
    width: 2.5rem;
    margin-inline: auto;
    transform: rotate(90deg);
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 1.1rem, 1480px);
  }

  .contract,
  .review-card,
  .verdict-grid,
  .evidence-view {
    grid-template-columns: 1fr;
  }

  .shot-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .controls {
    grid-template-columns: 6.5rem 1fr 6.5rem;
  }

  .section-heading {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
